From 6cb50806c015e8f630a1e680de7ef950753ef10f Mon Sep 17 00:00:00 2001 From: Simon Michael Date: Fri, 3 Sep 2010 02:11:34 +0000 Subject: [PATCH] notes --- NOTES | 478 +++++++++++++++++++++++++++++++++++++++------------------- 1 file changed, 319 insertions(+), 159 deletions(-) diff --git a/NOTES b/NOTES index 489d78ae1..1a5fcc9f9 100644 --- a/NOTES +++ b/NOTES @@ -15,6 +15,17 @@ little old Scottish ladies cried out to me 'LIVE DANGEROUSLY, SON! LIVE DANGEROUSLY'" --kowey +* principles +*** we aim to make reliable, maintainable, usable, useful software, sustainably. +*** docs before packaging before tests before fixes before refactoring before features +*** "bugs" are errors, as in the programmers messed up +*** automate +*** measure +*** test continuously, test everything +*** less is more +*** code review/pair programming + + * todo/backlog ** documentation, marketing *** developer notes & log @@ -338,26 +349,19 @@ competitors/fellow niche inhabitants **** home edition **** real-time project ledger ** packaging, installability -*** easier installation -**** all platforms -***** binary build/publish process -***** reduce dependencies -***** split packages ? -**** linux -***** keep up with debian/ubuntu haskell packagers -**** mac -***** easy data entry, then +*** linux +***** debian/ubuntu packaging +*** mac ***** easy installer ***** easy startup -**** windows -***** easy data entry, then +*** windows ***** easy installer ***** easy startup ** testing *** documentation -**** site up, current -**** demo up, current -**** haddock building, current +**** site up, current ? +**** demo up, current ? +**** haddock building, current ? **** doctests ? *** unit **** hunit @@ -368,8 +372,6 @@ competitors/fellow niche inhabitants ***** test all ledger file format features ***** clarify hledgerisms in file format - that hledger can read but ledger can't **** ledger 3 baseline tests -**** auto-compare xml output with ledger's ? -**** allow multiple tests in .test ? *** performance **** speed, benchmark tests **** memory usage @@ -392,81 +394,95 @@ competitors/fellow niche inhabitants **** usability **** download & usage stats ** errors -*** docs: manual needs a table of contents -*** windows: fix browser starting (starts firefox but says could not start) -*** non-blockers/retest -**** docs: need to be less wall-of-text -**** docs:installing:list three install options -**** balance: --depth with --flat should show aggregate balances -**** register: --depth should show aggregate postings -**** parsing: only journals can include, and only another journal -**** convert: rules file can't have blank lines after last data +*** unicode tests fail on linux - retest +*** web: doesn't support multiple filter patterns +*** web: accounts final balance can be -0, colored red +*** web: post handlers should preserve a p +*** web: --base-url trailing slash gives redirect loop +hledger web --port 5001 --base-url http://localhost:5001/ -f ~/personal/household.journal +*** web: assets.bank.checking indentation in demo journal +*** web: loses -B after an edit, and/or a filesystem edit +*** balance: --depth with --flat should show aggregate balances +*** register: intervals with unspecified from should start from first txn not first matched txn ? +*** convert: rules file can't have blank lines after last data -**** parsing: misleading error when final newline missing +*** problem with ~ in path ? +CICMD=web --debug # -f data/sample.journal +No journal file "~/personal/current.journal", creating it. +Edit this file or use "hledger add" or "hledger web" to add transactions. +hledger: ~/personal/current.journal: openFile: does not exist (No such file or directory) +*** parsing: period expressions should allow interval at the end +*** parsing: double error output +could not parse journal data in (stdin) +"(stdin)" (line 7, column 1): +unexpected end of input +could not balance this transaction (real postings are off by $0.01) +2010/08/01 (2420) simon monthly contribution + eleonore $40.50 + simon $-100.00 ; car payment contribution for aug + simon $38.46 ; 50-50 car adjustment for jul + simon $49.13 ; 50-50 food adjustment for jul + simon $-28.08 ; 50-50 home adjustment for jul + + +hledger: could not parse journal data in (stdin) +"(stdin)" (line 7, column 1): +unexpected end of input +could not balance this transaction (real postings are off by $0.01) +2010/08/01 (2420) simon monthly contribution + eleonore $40.50 + simon $-100.00 ; car payment contribution for aug + simon $38.46 ; 50-50 car adjustment for jul + simon $49.13 ; 50-50 food adjustment for jul + simon $-28.08 ; 50-50 home adjustment for jul + +*** parsing: canonicalise account name case +*** parsing: only journals can include, and only another journal +*** parsing: misleading error when journal lacks a final newline hledger -f- balance <<< -2010/1/1 +2010/1/2 a 1 b ->>> ->>>2 -"-" (line 1, column 9): -unexpected "\r" -expecting digit, effective date, cleared flag, transaction code or description and/or comment ->>>= 1 - -**** parsing: wrong line number in error -hledger -f- print -<<< -2010-03-18 Postage - Foo 11.04 GBP @@ 12.46 EUR ; @ 1.129 EUR - Bar ->>> -hledger: parse error at (line 1, column 24): -unexpected "@" -expecting comment or new-line - -**** parsing: errors should include the file name -This one does: -$ hledger -b today -"/Users/simon/personal/current.journal" (line 4, column 1) in included file "2010.journal": -"2010.journal" (line 1013, column 1): -unexpected "\n" -could not balance this transaction (real postings are off by $-3156.72) - -This one doesn't: -$ hledger -f 2008.journal stat -hledger: parse error at (line 1, column 59): -unexpected "[" -expecting comment or new-line - -**** parsing: better leap year checking +*** parsing: better leap year checking ledger: While parsing file "/Users/simon/personal/2010.ledger", line 442: While parsing transaction: > 2/27=2/29 (20100201ucla) ucla payment Error: Day of month is not valid for year -**** print: virtual parentheses/brackets throw off alignment -<<< -2009/01/27 (1/2009) Foobar 2 - VLL:VLL_1_Year -7140.00 USD ; Some comment - (Company:Baz) -7140.00 USD - FLL:Foreign 6000.0 USD - VLL_VAT 1140.0 USD ->>> -2009/03/27 (000007) Foobar 1 - FLL 6783.00 USD - (Company:Baz) 6783.00 USD - VAT -5700.00 USD - VLL_VAT -1083.00 USD +*** docs: need to be less wall-of-text +*** docs:installing:describe three install options in one place +*** LEDGER vs LEDGER_FILE +*** data safety issues +**** clarify read-only story +***** auto-create of empty files annoying ? +***** data-modifying commands: add, web->add/edit +*** compile warnings on linux +simon@joyful:/repos/hledger$ ghc --make hledger.hs -o bin/`runhaskell ./hledger.hs --binary-filename` -L/usr/lib -DMAKE -DPATCHLEVEL=0 -DCHART -DVTY -DWEB -W -fwarn-tabs -ihledger-lib -O2 -static -optl-static -optl-pthread +hledger.hs:1:0: + The main function `main' is not exported by module `Main' +[16 of 35] Compiling Hledger.Cli.Version ( Hledger/Cli/Version.hs, Hledger/Cli/Version.o ) +[19 of 35] Compiling Hledger.Read ( Hledger/Read.hs, Hledger/Read.o ) +[20 of 35] Compiling Hledger.Cli.Options ( Hledger/Cli/Options.hs, Hledger/Cli/Options.o ) +[21 of 35] Compiling Hledger.Cli.Commands.Balance ( Hledger/Cli/Commands/Balance.hs, Hledger/Cli/Commands/Balance.o ) +[22 of 35] Compiling Hledger.Cli.Commands.Convert ( Hledger/Cli/Commands/Convert.hs, Hledger/Cli/Commands/Convert.o ) +[23 of 35] Compiling Hledger.Cli.Commands.Chart ( Hledger/Cli/Commands/Chart.hs, Hledger/Cli/Commands/Chart.o ) + +Hledger/Cli/Commands/Chart.hs:16:0: + Warning: The import of `Control.Monad' is redundant + except perhaps to import instances from `Control.Monad' + To import instances alone, use: import Control.Monad() + +Hledger/Cli/Commands/Chart.hs:23:0: + Warning: The import of `Data.List' is redundant + except perhaps to import instances from `Data.List' + To import instances alone, use: import Data.List() ** refactoring, cleanup *** more modularity **** packages/namespace -***** make cli reusable -****** balance sheet add-on script -***** more package splits +***** more package splits ? ****** hledger-web ****** hledger-vty **** plugin strategy @@ -487,10 +503,6 @@ Error: Day of month is not valid for year *** inspiration http://community.haskell.org/~ndm/downloads/paper-hoogle_overview-19_nov_2008.pdf -> Design Guidelines ** features -*** register: depth could aggregate deeper txns, or only with reporting interval -when you do register --depth 1 and all transactions use depth-2 accounts, should it display synthetic aggregated depth-1 transactions ? -I have been wanting that, at least in the case when you have a reporting interval like -p daily - *** register --wide and/or --format ... *** --related *** Double -> Decimal @@ -508,68 +520,22 @@ improve reliability *** upload feature *** payee & account anonymisation *** easier timelog formats -*** implicit timelog account *** add: completion etc. *** convert: generalise/reuse add's history awareness *** web: charts (Chart or google) *** wide/customisable/consistent layout -*** --flat balance report format -#not: -#hledger bal clearview -# 43.4h TIME:work:jobs:clearview -# 1.7h bad retention collection -# 0.1h cash receipts sales co heading -# 0.4h commissions dashboard breakage -# 4.1h commissions:total detail starting balance -# 0.5h cvmanage issues -# 1.3h dashboard error -# 0.5h update error logging system -# 1.0h filter views by sales co:commissions -# 1.0h html2ps error -# 6.1h payments have wrong sales co -# 0.4h site hang -# 0.2h sysadmin -# 26.6h title 24 -#-------------------- -# 43.5h -#but: -#hledger bal clearview --flat --depth 5 -# 1.7h bad retention collection -# 0.1h cash receipts sales co heading -# 0.4h commissions dashboard breakage -# 4.1h commissions:total detail starting balance -# 0.5h cvmanage issues -# 1.3h dashboard error -# 1.0h filter views by sales co:commissions -# 1.0h html2ps error -# 6.1h payments have wrong sales co -# 0.4h site hang -# 0.2h sysadmin -# 26.6h title 24 -#-------------------- -# 43.4h -# -#- only depth 5 accounts are shown -#- extra amount in parent account, if any, is added as misc -#- visible numbers add up to the visible total *** effective/actual dates for postings *** better web ui/gui *** nice reports with charts -*** ledger-compatible xml output ? -*** allow no command or unordered command with pattern args *** more automated bank data conversion -*** ofx download +*** parse more file formats - gnucash, qif, ofx, csv.. +*** download via ofx protocol *** watching a changing ledger *** more date syntax ? last nov, next friday, optional this, week of *** more period syntax ? every N days, biweekly *** accept multiple -f files *** more reliable tidy layout from print -*** parse more file formats - gnucash, qif, ofx, csv.. *** i18n -import Codec.Binary.UTF8.String (encodeString, decodeString) -import Data.ByteString.UTF8 (fromString, toString) -import Data.ByteString.Char8 (pack, unpack) -import Data.Text.Encoding (decodeUtf8) *** speed, memory usage *** clear, documented interfaces/surfaces *** plugin architecture/modular packaging @@ -609,15 +575,6 @@ plugins can be discovered/loaded by module path or by loading files directly * misc -** principles -*** we aim to make reliable, maintainable, usable, useful software, sustainably. -*** "bugs" are errors, as in the programmers messed up -*** docs before packaging before tests before fixes before refactoring before features -*** automate -*** measure -*** test continuously, test everything -*** less is more -*** code review/pair programming ** things I want to know *** time where have I been spending my time in recent weeks ? @@ -780,29 +737,9 @@ Or to see how your expenses will add up: *** http://www.xtuple.com/postbooks *** http://weberp.org **** http://www.weberp.org/weberp/doc/Manual/ManualContents.php -** code snippets --- trace a MixedAmount -matrace :: MixedAmount -> MixedAmount -matrace a@(Mixed as) = trace (show as) a - --- normalise and trace a MixedAmount -nmatrace :: MixedAmount -> MixedAmount -nmatrace a = trace (show as) a where (Mixed as) = normaliseMixedAmount a - --- cabal test -import System.FilePath -main = defaultMainWithHooks $ simpleUserHooks { runTests = runTests' } -runTests' :: Args -> Bool -> PackageDescription -> LocalBuildInfo -> IO () -runTests' _ _ _ lbi = system testprog >> return () - where testprog = (buildDir lbi) "hledger" "hledger test" - -** issues with pandoc's rst support -*** treats HOME's h2s as h1 -*** quotes only first line of a :: literal block -*** doesn't support http://docutils.sourceforge.net/docs/ref/rst/restructuredtext.html#indirect-hyperlink-targets -** must-read article on currency & capital gains accounting +** selinger article on currency & capital gains accounting http://www.mscs.dal.ca/~selinger/accounting/tutorial.html#1.2 -** feedback +** hledger feedback *** fabrice niessen +For me, what would be very useful for a 1.0 version would be: + @@ -825,6 +762,213 @@ http://www.mscs.dal.ca/~selinger/accounting/tutorial.html#1.2 + soon. + +** hamlet feedback +*** thread data through nested templates with Reader monad +*** HDString constructor for HamletData ? +*** data type for non-RT Hamlet as well, or better, the same type for both +*** allow (RT or non-RT) templates in $ $ as well, drop ^ ^ +*** allow literal arguments in references +*** easier verbatim content quoting, eg lines starting with \\. Having to escape $$ is not so convenient for jquery +*** docs and compiler errors should say something clearer than "Hamlet url" (Hamlet routetype, urltype, routet, urlt ?) + + +*** 2010/8 +**** $ $ could handle templates as well; drop ^ ^ +**** @ @ could recognise tuples automatically; drop ? +**** why !: : for conditional attributes ? How about !? ? + +** code snippets + +Name: test +Version: 0.1 +Synopsis: test package for linking against internal libraries +Author: Stefan Wehr +Build-type: Simple +Cabal-version: >=1.8 -- IMPORTANT + +Library + Hs-source-dirs: lib -- IMPORTANT + Exposed-modules: A + Build-Depends: base >= 4 + +Executable test-exe + Build-depends: base >= 4, test, -- link against the internal library + Main-is: Main.hs -- imports A + Hs-source-dirs: prog -- IMPORTANT + + +-- trace a MixedAmount +matrace :: MixedAmount -> MixedAmount +matrace a@(Mixed as) = trace (show as) a + +-- normalise and trace a MixedAmount +nmatrace :: MixedAmount -> MixedAmount +nmatrace a = trace (show as) a where (Mixed as) = normaliseMixedAmount a + +-- cabal test +import System.FilePath +main = defaultMainWithHooks $ simpleUserHooks { runTests = runTests' } +runTests' :: Args -> Bool -> PackageDescription -> LocalBuildInfo -> IO () +runTests' _ _ _ lbi = system testprog >> return () + where testprog = (buildDir lbi) "hledger" "hledger test" + +-- queryStringFromAP a p = if null ap then "" else "?" ++ ap +-- where +-- ap = intercalate "&" [a',p'] +-- a' = if null a then "" else printf "&a=%s" a +-- p' = if null p then "" else printf "&p=%s" p + +-- toggleScriptFor name = [$hamlet| +-- +-- |] + +-- group register report items by transaction + groupeditems [] = [] + groupeditems items = is:(groupeditems js) + where (is,js) = span (\(ds,_,_) -> isNothing ds) items + + +/* html, body {height: 100%} */ +/* #content {min-height: 100%} */ +/* #editform textarea { height:100%; } */ + +/* input:focus { background-color: #efe; } */ + +/* a.tooltip {position: relative} */ +/* a.tooltip span {display:none; padding:5px; width:200px;} */ +/* a:hover {background:#fff;} /\*background-color is a must for IE6*\/ */ +/* a.tooltip:hover span{display:inline; position:absolute;} */ + +/* div#page {width: 960px; margin: 0 auto} */ + +/* div#container {height: 35px; line-height: 35px} */ + +/* div#content {position: absolute; top: 50%; height: 500px; margin-top: -250px} */ + +/* div#content {position: absolute; top: 50%; left:50%; width:800px; height: 500px; margin-left: -400px; margin-top: -250px} */ + +/* div#button {background: #888; border: 1px solid; border-color: #999 #777 #777 #999 } */ + +/* .element {border-radius: 5px} */ + +; prototype "equalising" transactions +; +; generate a transfer between alice & bob equalising their contribution to rent's 5/1 balance +; A 2010/5/1 expenses:rent +; alice 50% +; bob 50% + +; generate a transfer between alice & bob such that alice's contribution to car payment's 5/1 balance is $100 +; A 2010/5/1 expenses:car:payment +; alice $100 +; bob + +; A 2010/5/1 expenses:car not:expenses:car:payment +; alice 50% +; bob + +; A 2010/5/1 expenses:food +; alice +; bob + +; A 2010/5/1 expenses:home +; alice +; bob + +; A 2010/5/1 expenses:utilities +; alice +; bob + + +maybeFileInput :: String -> FormInput sub master (Maybe FileInfo) +maybeFileInput name = GForm $ \_ env -> do + let res = FormSuccess $ lookup name env + return (res, [addBody [$hamlet| +%input!type=file!name=$name$ +|]], Multipart) + +-- handler for add form auto-complete requests +-- "); + +-- $link = mysql_pconnect($mysql_host, $mysql_user, $mysql_pasw); +-- $db = mysql_select_db ($mysql_db); + +-- if (!isset($_GET["pos"])) $_GET["pos"]=0; + +-- //Create database and table if doesn't exists +-- //mysql_create_db($mysql_db,$link); +-- $sql = "Select * from Countries"; +-- $res = mysql_query ($sql); +-- if(!$res){ +-- $sql = "CREATE TABLE Countries (item_id INT UNSIGNED not null AUTO_INCREMENT,item_nm VARCHAR (200),item_cd VARCHAR (15),PRIMARY KEY ( item_id ))"; +-- $res = mysql_query ($sql); +-- populateDBRendom(); +-- }else{ +-- +-- } +-- //populate db with 10000 records +-- function populateDBRendom(){ +-- $filename = getcwd()."../../common/countries.txt"; +-- $handle = fopen ($filename, "r"); +-- $contents = fread ($handle, filesize ($filename)); +-- $arWords = split("\r\n",$contents); +-- //print(count($arWords)); +-- for($i=0;$i"); +-- else +-- print(""); +-- $res = mysql_query ($sql); +-- if($res){ +-- while($row=mysql_fetch_array($res)){ +-- print(""); +-- } +-- }else{ +-- echo mysql_errno().": ".mysql_error()." at ".__LINE__." line in ".__FILE__." file
"; +-- } +-- print("
"); +-- } +-- ?> + * journal ** 2010 @@ -856,3 +1000,19 @@ cleaned up notes *** 5/20 converted manual to markdown more detailed installation docs +*** 5/21 +upgraded hakyll +fixed hakyll/pandoc quotes issue +*** 5/22 +refactored journal/ledger construction +updated benchmarks +resolved register memory leak +*** 5/23 +clarified Journal & Ledger roles +various 6.12, utf8 and other fixes +released 0.10 + +*** 5/24 +implemented --flat, --drop +*** 5/25 +support, investigated rounding issue