2020-11-15 GnuCash IRC logs

00:43:51 <CDB-PHONE> well I would simply use a vanilla asset account for that Chris
00:43:57 <CDB-PHONE> no need to create anything fancy
00:59:49 *** geneAum has joined #gnucash
01:01:20 <geneAum> i'm having trouble putting together a basic GnuCash API integration. i've got all the details at https://github.com/feuGeneA/a-gnucash-integration/pull/2 . i'd love any feedback, either here or there on the PR. thanks in advance!
01:25:06 *** jervin has quit IRC
01:47:45 *** fell has quit IRC
01:48:42 *** frakturfreak has quit IRC
01:49:04 *** fell has joined #gnucash
01:49:04 *** ChanServ sets mode: +o fell
02:03:18 *** frakturfreak has joined #gnucash
02:28:13 *** Mechtilde has joined #gnucash
02:46:28 *** sbluhm has joined #gnucash
02:46:28 *** ChanServ sets mode: +v sbluhm
03:05:13 *** sbluhm has quit IRC
03:16:43 *** ghost has quit IRC
03:34:25 *** Mechtilde has quit IRC
03:39:23 *** sbluhm has joined #gnucash
03:39:23 *** ChanServ sets mode: +v sbluhm
03:42:04 *** Mechtilde has joined #gnucash
03:43:53 *** sbluhm has quit IRC
04:20:22 *** jcarl43 has quit IRC
04:22:02 <chris> CDB-PHONE: ofcouse a regular account is best. But users will complain about custom securities eg BTC. Buy in UK, move to FR, sell in FR. Where does the BTC get recorded? (TBH I don't partic care myself)
04:25:01 <chris> geneAum: good skills. I suspect the answer is that the API is not well documented yet for your use. We'd will be very grateful for you to update the wiki with your findings as you experiment (and file bugs) wiki.gnucash.org bugs.gnucash.org
04:37:00 *** sbluhm has joined #gnucash
04:37:00 *** ChanServ sets mode: +v sbluhm
04:56:17 *** User has joined #gnucash
04:59:39 *** Aussie_matt has quit IRC
05:17:16 *** sbluhm has quit IRC
05:24:45 *** sbluhm has joined #gnucash
05:24:45 *** ChanServ sets mode: +v sbluhm
05:31:15 *** giuseppef has joined #gnucash
05:31:15 *** ChanServ sets mode: +v giuseppef
05:31:29 *** sbluhm has quit IRC
05:33:01 *** Herbert has joined #gnucash
05:59:56 *** peanutbutterandcrackers has joined #gnucash
05:59:56 *** ChanServ sets mode: +v peanutbutterandcrackers
06:00:28 <peanutbutterandcrackers> Hey there, I am trying to use gnucash python to bulk record invoices/sales and payments....
06:00:38 <peanutbutterandcrackers> but I have this really strange issue:
06:00:54 <peanutbutterandcrackers> If I record the payments first and then the invoices, everything works just fine
06:01:24 <peanutbutterandcrackers> however, if I try adding the invoices first and payment second, it's a segmentation fault
06:01:47 <peanutbutterandcrackers> This happens when the invoice is made to customer X, and then I'm trying to record payment made by the same customer
06:02:03 <peanutbutterandcrackers> Really strange.
06:02:26 <peanutbutterandcrackers> I'm using gnucash version 3.8 (because that is what is available in the packages)
06:03:05 <peanutbutterandcrackers> I have worked around the issue for now by adding the payments first... but if anybody has any ideas, please do let me know. Adding invoices first is more logical.
06:10:04 *** fell has quit IRC
06:10:25 *** fell has joined #gnucash
06:10:25 *** ChanServ sets mode: +o fell
06:45:57 *** fabior has joined #gnucash
06:47:58 <fell> geneAum, I have problems to understand, what you are trying to do. Perhaps you should fill the README of your project with your intension, conditions, ….
06:59:17 *** fabior has quit IRC
07:05:33 <peanutbutterandcrackers> This is the related code: https://github.com/peanutbutterandcrackers/ekaterina/blob/28d9985c617918660837177a2471326a1e962a81/ekaterina/parsers/csv_parser.py#L265
07:05:57 <peanutbutterandcrackers> the succeeding lines
07:18:25 <warlord> peanutbutterandcrackers, this does not look anything like the GnuCash API
07:19:23 <warlord> I have no clue what Ekat is..
07:20:06 <peanutbutterandcrackers> warlord, sorry. I take the list that is returned from this function and then use this https://github.com/peanutbutterandcrackers/ekaterina/blob/28d9985c617918660837177a2471326a1e962a81/ekaterina/mazurka.py#L137 to write to the gnucash file
07:20:15 <peanutbutterandcrackers> This project is still a work in progress
07:20:39 <peanutbutterandcrackers> what I do is: Have the transactions is .ods file (Libreoffice) with a specified mapping (1st row)
07:21:07 <peanutbutterandcrackers> then I take that .ods file as input, parse it up, create Ekaterina.{Customer,Account,etc.} objects
07:21:14 <peanutbutterandcrackers> out of the parsed strings
07:21:50 <peanutbutterandcrackers> and then turn these Ekat.Customer Ekat.Invoices to gnucash Invoice/customers
07:22:07 <peanutbutterandcrackers> and write to .gnucash file
07:23:52 <peanutbutterandcrackers> anyways, the thing is: for gnucash 3.8, if I have 2 transactions by the same customer, and the first is a purchase (invoice) and the next is a payment (made by the same customer).... I get a segfault if I try to add invoice first and payment later.
07:24:50 <peanutbutterandcrackers> If anybody wants to test it, I can send a sample .ods file, and a .gnucash file.... and a small script.
07:25:40 <warlord> Aha, okay, there's the GnUCash API calls.. You don't say how it crashes.
07:25:42 <peanutbutterandcrackers> And you can switch the lines in my first link to have the returned list contain the invoices first and payment second. just to verify
07:25:49 <warlord> What are you putting into the ExatPayment.GList ?
07:26:00 * warlord is not running the code.
07:26:09 <peanutbutterandcrackers> warlord, None, I think
07:27:21 *** AdrienM has quit IRC
07:27:37 <peanutbutterandcrackers> warlord, This really is a rewrite of this: https://github.com/peanutbutterandcrackers/gnucash_invoice_automator/blob/master/gnc_auto_inv.py
07:28:01 <peanutbutterandcrackers> ...and for that I seem to be using None there: https://github.com/peanutbutterandcrackers/gnucash_invoice_automator/blob/fb485ede6dd2090214279c29e2c72b55a2b2a0cc/gnc_auto_inv.py#L225
07:28:05 *** AdrienM has joined #gnucash
07:28:06 *** ChanServ sets mode: +v AdrienM
07:28:50 <warlord> Did gnc_auto_inv.py work?
07:29:01 <peanutbutterandcrackers> warlord, Yes, it did
07:29:26 <peanutbutterandcrackers> warlord, and so does ekaterina... but I should like to add invoice first and payment second
07:29:50 <warlord> Isn't auto_inv applying the invoice first and then the payment?
07:30:07 <warlord> What is the crash you see? Can you pastebin the traceback?
07:31:09 <peanutbutterandcrackers> warlord, It only says a curt: "Segmentation fault: core dumped"
07:31:21 <peanutbutterandcrackers> would you like me to send the core file? o.O
07:31:37 <peanutbutterandcrackers> I will need to look up how to retreive core files then
07:32:07 <peanutbutterandcrackers> and yes... autoinv is doing it invoice first and then the payment.... but there's a catch:
07:32:14 <peanutbutterandcrackers> there one difference between autoinv and ekat
07:33:11 <peanutbutterandcrackers> where autoinv uses GNCCustomer.ApplyPayment() https://github.com/peanutbutterandcrackers/gnucash_invoice_automator/blob/fb485ede6dd2090214279c29e2c72b55a2b2a0cc/gnc_auto_inv.py#L234
07:33:47 <peanutbutterandcrackers> ..... ekaterina uses GNCCustomer.ApplyPaymentSecs() https://github.com/peanutbutterandcrackers/ekaterina/blob/28d9985c617918660837177a2471326a1e962a81/ekaterina/mazurka.py#L126
07:34:25 <peanutbutterandcrackers> I don't know why.... but this time around gnucash-python was complaining about missing code for GNCCustomer.ApplyPayment()
07:34:36 <peanutbutterandcrackers> Let me reproduce that
07:37:15 <peanutbutterandcrackers> https://termbin.com/l61j
07:37:52 <peanutbutterandcrackers> AttributeError: module 'gnucash.gnucash_core_c' has no attribute 'gncOwnerApplyPayment'
07:40:27 *** fabior has joined #gnucash
07:40:51 <warlord> Is that using the same version of the python bindings / gnucash ?
07:41:35 <warlord> As for core file; that means it is crashing the C/C++. Sending me the core file wont help, you would need to load it under GDB locally against the actual executable (probably python)
07:41:47 <warlord> (stepping away for a bit)
07:50:34 <peanutbutterandcrackers> warlord, No, not the same python bindings/gnucash version. That is why I didn't bring that up.... hmmmm..... okay I'll try to see if I can do some gdb-fu then....
08:10:21 <peanutbutterandcrackers> warlord, I got help from a kind python hacker to get these tracebacks:
08:10:28 <peanutbutterandcrackers> first: https://termbin.com/0mrco
08:10:35 <peanutbutterandcrackers> second: https://termbin.com/v0mo
08:10:41 <peanutbutterandcrackers> the same thing...really
08:16:13 <warlord> The second one is much more detailed and interesting (although there are no debug symbols). The key is Thread 1, frames 4 to 0. My guess is that something is NULL that shouldn't be. Without actual DEBUG symbols it's a little hard to tell.
08:16:43 <warlord> The people who would really need to help are jralls (who is still asleep -- it's only 5:16am for him), and gjanssens, who is not online.
08:17:31 <peanutbutterandcrackers> I see.... I don't have a bouncer (whatever that thing is) yet. :[
08:17:57 <peanutbutterandcrackers> i'll just leave this computer open and hope the internet connection does not glitch out then
08:20:22 <warlord> Without better debug symbols it might be hard to track this down. GncInvoiceGetInvoiceFromLot() is called multipole times from within gncOwnerAutoApplyPaymentsWithLots(). So without knowing WHICH call is failing, it might be hard to track this down.
08:20:55 <warlord> So either you might need to build GnuCash yourself (with debug symbols), or you might need to work with a developer to track this one down.
08:21:05 <warlord> Does it fail if you start with an empty data file?
08:21:51 *** peanutbutterandcrackers has quit IRC
08:24:02 <warlord> (stepping away again)
08:24:18 <chris> warlord: what's the architectural argument against scripting via File > Run Script... (py or scm)
08:25:57 *** fabior has quit IRC
08:26:37 <fell> peanutbutterandcrackers: Does your distribution not offer some gnucash*-dbg or -debug packages?
09:47:07 *** PowaBanga has quit IRC
09:49:04 <geneAum> @fell did you notice the README.md file in the PR itself? It's not much, but does say that what I'm going for here is "A minimum viable GnuCash integration using a PostgreSQL backend." Also in the PR description I mentioned that I'm trying to follow the tutorial at https://wiki.gnucash.org/wiki/Using_the_API , but having trouble trying to figure how to get an Account from a QofSession.
09:49:04 <gncbot> geneAum: Error: "fell" is not a valid command.
09:49:32 <geneAum> fell: ^
10:30:35 *** ghost has joined #gnucash
10:32:12 *** giuseppef has quit IRC
10:32:43 *** giuseppef has joined #gnucash
10:32:43 *** ChanServ sets mode: +v giuseppef
10:52:11 *** sbluhm has joined #gnucash
10:52:11 *** ChanServ sets mode: +v sbluhm
11:10:18 *** Hamaryns has joined #gnucash
11:10:18 *** ChanServ sets mode: +v Hamaryns
11:34:09 *** Agfarmer18 has joined #gnucash
11:39:54 *** Hamaryns has quit IRC
11:49:58 <fell> geneAum. later I saw your mail to -devel. BTW I have updated Using_the_API.
11:55:10 *** sbluhm has quit IRC
11:55:54 <CDB-PHONE> [04:22] (@chris) CDB-PHONE: ofcouse a regular account is best. But users will complain about custom securities eg BTC. Buy in UK, move to FR, sell in FR. Where does the BTC get recorded? (TBH I don't partic care myself)
11:56:20 <CDB-PHONE> well as jralls and I said earlier, you necessarily need to open a new book when you move
12:00:29 <CDB-PHONE> changing home currencies will involve a new book. you would transfer the closing balance in GBP to an opening balance in EUR
12:03:50 <fell> That way you will loose the stock history, which may be important for tax declaration (long vs. short therm; taxable if bougth after date of law change, …)
12:06:21 *** sbluhm has joined #gnucash
12:06:21 *** ChanServ sets mode: +v sbluhm
12:08:14 <fell> OTOH if your moving is not temporary, you want another book currency.
12:09:50 <fell> So will have to regenerate parts of the history.
12:11:59 *** angel has joined #gnucash
12:13:33 <CDB-PHONE> [12:03] (@fell) That way you will loose the stock history, which may be important for tax declaration (long vs. short therm; taxable if bougth after date of law change, …)
12:13:38 <CDB-PHONE> well yes and no
12:14:20 <CDB-PHONE> a decent number of countries impose an exit tax, where they tax all the accrued capital gains upon exit
12:14:43 <CDB-PHONE> in terms of the entering country, there's a diverse range of rules
12:15:13 <CDB-PHONE> some for example simply take the mark to market value on the day you move in, so all prior history become irrelevant
12:16:10 <CDB-PHONE> this is separate from the issue of FIFO, but can effectively make moot the question of FIFO
12:17:27 <fell> That may be different if you stay in the same economic comunity like Euro zone and another part of the EU.
12:19:06 *** sbluhm has quit IRC
12:20:21 *** David has quit IRC
12:20:26 *** David has joined #gnucash
12:21:30 <CDB-PHONE> yes, it greatly varies with jurisdiction
12:21:50 <CDB-PHONE> further, if the move is temporary, you should not start a new book
12:22:21 <CDB-PHONE> for example, if someone from France does a 2 year expatriate work assignment in Japan
12:22:44 <CDB-PHONE> keep the book in EUR, but run reports on JPY to have the information for everyday use
12:23:41 <CDB-PHONE> have JPY accounts in the register, but everything is transaction currency EUR with per transaction conversions via the stock account mechanism
12:29:19 <fell> I wonder, if we should write down such rules to avoid running in traps.
12:45:26 <CDB-PHONE> this is why IFRS takes several years each time they contemplate a new rule!
12:50:25 *** giuseppef has quit IRC
12:50:50 *** giuseppef has joined #gnucash
12:50:50 *** ChanServ sets mode: +v giuseppef
12:55:48 *** sbluhm has joined #gnucash
12:55:48 *** ChanServ sets mode: +v sbluhm
13:11:32 *** sbluhm has quit IRC
13:12:21 <jralls> warlord, do you know how to edit https://bugs.gnucash.org/page.cgi?id=bug-writing.html? For that matter, do you know how to *find* it?
13:12:38 *** sbluhm has joined #gnucash
13:12:39 *** ChanServ sets mode: +v sbluhm
13:21:17 *** Mechtilde has quit IRC
13:21:53 *** Mechtilde has joined #gnucash
13:22:53 <jralls> fell, CDB-PHONE, If you're a US citizen you keep paying US taxes unless you go to a US embassy and formally renounce your citizenship, and at that point you pay the clearing taxes. If you haven't done that and you have to pay taxes in your country of residence then you might need two books, one for US-taxable income and one for the other country's.
13:23:07 *** sbluhm has quit IRC
13:24:28 <CDB-PHONE> right... the USA citizenship based taxation
13:24:31 <CDB-PHONE> I remember that
13:24:49 <CDB-PHONE> indeed you'll probably need a second book just for the stocks
13:25:13 <CDB-PHONE> such are the "benefits" of American citizenship
13:26:44 <jralls> All income, foreign and domestic, is taxable under US law, so your US books have to have everything. Most other countries tax only domestic income so that book would only need the parts needed for that country's tax requirements.
13:28:54 <jralls> The tax paid in the country of residence is a credit on the US taxes (not the accounting meaning of credit, BTW, it means that the amount is subtracted from the tax owed after all of the other calculations are done instead of deducted from income).
13:35:29 *** angel has quit IRC
13:36:32 *** angel has joined #gnucash
13:39:01 <CDB-PHONE> yes, foreign tax credits (FTCs)
13:40:09 <CDB-PHONE> the earned income can be exempted via the foreign earned income (FEI) exemption
13:40:37 <CDB-PHONE> if your income is under that bar, it becomes a moot point, no need to double track in as high detail
13:41:01 <CDB-PHONE> though it can also be said that having 2 books allows for better tracking to ensure you stay under
13:42:25 <jralls> Ah, didn't know about FEI. I've never been in that situation. I have to do FTC because of dividends on ADRs.
13:42:56 <jralls> chris, you should stop praising people's skill in things about which you know nothing.
13:42:57 <CDB-PHONE> you can FEI the general basket and FTC the pass
13:43:03 <CDB-PHONE> the passive one*
13:43:41 <CDB-PHONE> you're also USA domestic, so no need to ever access FEI
13:44:06 <CDB-PHONE> you only qualify for FEI if you are a "bona fide resident of a foreign country"
13:44:27 <CDB-PHONE> and it's only on *earned* income meaning employment
13:46:28 <CDB-PHONE> then there's also section 901 (IIRC) excess FTC to consider on your passive basket in a foreign jurisdiction with passive income tax rates higher than America (i.e. many countries in the world with something higher than the 15% LT CG and qualified dividend rate)
13:47:17 <CDB-PHONE> also good luck with PFIC reporting on any non USA domiciled mutual funds and ETFs...
13:49:18 <geneAum> chris: thank you! yes, i intend to improve the wiki, at the very least updating the Using the API article, and of course filing bugs along the way. but i really could use some advice on how to get started, if anyone has any. i'm sure i could figure out eventually, but i wanted to reach out before spending too many more hours on it.
13:50:41 <jralls> No earned income at all, I'm retired. And I'm allergic to tedious taxes so I trade only on US markets and in US mutual funds. I've got an MLP and hate dealing with the K1 though I like the tax-deferred income.
13:58:08 *** sbluhm has joined #gnucash
13:58:08 *** ChanServ sets mode: +v sbluhm
13:58:09 *** giuseppef has quit IRC
14:16:59 <jralls> geneAum. Ot
14:17:26 <jralls> Sigh. It's way past time for you to be writing C++11/14 instead of C++98.
14:20:31 *** Herbert has joined #gnucash
14:22:40 *** Herbert has quit IRC
14:24:25 <geneAum> jralls: i know a few 11/14 things, but none that came to mind while writing those <100 lines of code. any specific tips on some 11/14 idioms you would have expected me to use there?
14:25:42 <jralls> The most glaring is NULL. You should always use nullptr, NULL is a C macro that may or may not tell the compiler the right thing.
14:27:55 <geneAum> ah indeed, thanks. fyi both of my uses of NULL were just copy/pasted from function usages in the gnucash codebase; was just trying to change as little as possible until i actually get something working.
14:28:05 <jralls> You've also got two globals, that's bad practice all the way back to K&R C circa 1972.
14:28:31 <geneAum> indeed; i'm just hacking right now; until i can get things actually working. but thanks for reinforcing that for me.
14:28:48 *** angel has quit IRC
14:30:46 <jralls> It should be second nature that you at least always use "static" for variables at file scope. The C++ way is supposedly to use the anonymous namespace but I've never seen any code outside of Stroustoup's and Meyers's books that actually does that.
14:32:53 <geneAum> in a larger codebase i would certainly have gone static. does it make any material difference when you've only got a single compilation unit anyways?
14:33:31 <geneAum> little to no intention of re-use of this code at this point, just trying to get my bearings
14:36:04 <jralls> You don't have a single compilation unit. The global namespace includes all of the linked libraries. The linker might flag conflicts, but you'd be nuts to rely on it.
14:39:31 <jralls> Ah, another C++11/14 point, in your main function use auto instead of types and curly-brace initialization instead of assignment: e.g. auto session{sessionRaii.session}; at line 87.
14:40:27 <jralls> Wrapping QofEngine in an object that you initalize but never use is risky, the compiler might decide to optimize it away.
15:07:01 <geneAum> do you always opt for auto? i often find code to be more readable when types are explicit.
15:07:54 <geneAum> is there an advantage to brace initialization over the assignment operator? i'll look it up myself of course, but curious of your opinion there.
15:08:21 <jralls> The guidance from on high is to always use auto because it makes code more portable and safer.
15:08:41 <geneAum> and good point about the QofEngine object that doesn't get used, i'll consider that. (though, gcc isn't optimizing it away in this case)
15:08:57 <geneAum> great feedbacks though, thank you for them all!
15:10:06 <geneAum> do you have any ideas about the error conditions i'm hitting? (non-sensical error from qof_session_destroy(), most specifically; perhaps the other QofBook-centered one will go away when I switch to the other functions fell referred me to when he linked to the Python usage from the "Using the API" wiki page.)
15:10:30 <jralls> C++ initializes on declaration so assignment wastes instructions by initializing and then calculating the value into a temporary and swapping the local var with the temporary.
15:10:52 <jralls> Did you see my reply on gnucash-devel?
15:11:14 <geneAum> oh no i missed it but i see it now i'll go read there, thank you!
15:20:04 <CDB-Man_> chris: i dont have a linux instance or an easy way to spin one up, so you are correct, I kinda need a win32/64 build to be able to test anything
15:27:34 <CDB-Man_> Rant: well, 2 weeks ago i made 20 stock trades in a single day. sadly my broker **date** stamps the trade confirmations, but not **time** stamps.... so i have no idea the order I did them (which matters a lot ofr tax reporting)
15:27:42 <CDB-Man_> broker issued the end of month statement today which still has no timestamps, but at least lists the trades in chronological order, so time to reconcile 20 transactions -- there goes the next 2 hours
15:31:40 <jralls> CDB-Man_ why does time of day matter for taxes?
15:31:59 <CDB-Man_> for average cost method basis it matters
15:32:10 <CDB-Man_> as purchases will affect the cost basis, but not sales
15:33:00 <CDB-Man_> B/S/B/S will be a different cost basis thant B/B/S/S or S/B/B/S wtc
15:33:04 <CDB-Man_> etc*
15:33:20 *** CDB-Man_ is now known as CDB-Man
15:33:23 <jralls> Eww.
15:33:40 <CDB-Man> there are advantages adn disadvantages to FIFO vs cost basis
15:33:40 <jralls> *Another* reason not to day-trade.
15:33:52 <CDB-Man> this is one of the disadvantages
15:34:37 <jralls> If you strictly apply FIFO you still need the right trading order during the day.
15:35:02 <CDB-Man> well yes and no, if all the sales are designated as older tax lots from prior to today then it won't matter what was bougth today
15:36:59 *** jw4 has quit IRC
15:37:32 *** jw4 has joined #gnucash
15:46:33 <CDB-Man> chris: instead of me copy pasting your acb-tool scm into the lot view.scm file and overwriting that each time i want to update the test, can we make it so that I cna actually just drag and drop acb_tool.scm into the C:\Program Files (x86)\gnucash\share\guile\site\2.2\gnucash\reports\standard\ folder?
15:46:54 <CDB-Man> (if there's a better way to do this, i'm all ears -- this is what im currently doing)
15:57:46 <CDB-Man> ... and it looks like i broke it
15:59:44 *** Mechtilde has quit IRC
16:01:04 *** halipaul has quit IRC
16:29:02 *** bertbob has joined #gnucash
16:29:02 *** ChanServ sets mode: +v bertbob
16:34:06 *** sbluhm has quit IRC
16:34:39 *** bertbob has quit IRC
17:01:48 *** Aussie_matt has joined #gnucash
17:08:48 <chris> jralls: praise is meant to be encouraging and helping with documentation :)
17:13:17 <jralls> chris, praise isn't always an appropriate encouragement. You would want me praising the local barber's surgical skills...
17:13:34 <jralls> s/would/wouldn't/
17:15:27 <chris> I wonder if this example is apt... You may know barbers were originally known as barber-surgeons
17:15:51 <jralls> I do indeed.
17:16:35 <jralls> Do you want them taking up that sideline again?
17:17:18 <chris> lol Nowadays anyone wants to be offering extra services... I say good luck, more work for licensed workers to fix mistakes
17:18:30 <jralls> Some of those mistakes can be hard to fix, like the surgeon in Florida a couple of years ago who amputated the patient's good leg.
17:19:09 *** AdrienM has quit IRC
17:19:19 *** AdrienM has joined #gnucash
17:19:19 *** ChanServ sets mode: +v AdrienM
17:20:32 <chris> This is a tragedy indeed
17:21:25 <CDB-Man> chris: how should i be loading acbtool into the software?
17:22:43 <chris> There was mechanism in the past for autoload any .scm in /*/standard-reports as a report, but this is now removed.
17:23:05 <chris> Now the idea is to load via config-user.scm which is another known hack.
17:23:21 <chris> well it was documented so officially not a hack
17:25:07 <chris> one of https://wiki.gnucash.org/wiki/Custom_Reports#Load_the_report_from_a_user_account should still work
17:25:52 <CDB-Man> chris: hmm, can we add acb tool into the actual nightly builds?
17:26:04 <CDB-Man> that way, when we test it, i can jsut overwrite with whatever is on your github latest
17:27:19 <CDB-Man> okay lets see if i can figure out the steps on the wiki here
17:27:21 <CDB-Man> but first, dinner time
17:27:23 <chris> this would be if jralls agreed
17:27:50 <chris> it'll be hidden behind --extra
17:27:55 *** bertbob has joined #gnucash
17:27:56 *** ChanServ sets mode: +v bertbob
17:28:24 * jralls is not keen on using the nightlies for test builds, but if you use master it would have less potential for harm.
17:29:51 <chris> or, CDB-Man can set up a Linux VM and run flatpak
17:29:59 <jralls> It's a bit of swatting flies with a sledgehammer too. chris, can't you write up a little config.scm that CDB-Man could put in ~/.gnucash along with acb.scm?
17:30:32 <CDB-Man> me running linux is a tall order
17:31:11 <CDB-Man> we wpouldnt be using the nightlies to actualyl push updates, but at least get it into the extras tab where the new balance shet resides
17:31:22 <CDB-Man> so that its eaiser to test, and can be easily overwritten
17:31:23 <CDB-Man> dinner time now
17:31:49 *** bertbob has quit IRC
17:31:56 <chris> I haven't done win32 hacking for couple years now, so, will get back to it in due course
17:32:25 <warlord> jralls, I see /usr/share/bugzilla/template/en/default/pages/bug-writing.html.tmpl
17:33:34 <warlord> I'm not sure how to edit or override that without literally editing the page template.
17:33:48 <warlord> (but we might be able to create a local override. I don't recall)
17:34:40 <CDB-PHONE> yes please, if there is an easier way for me to load up the test reports and not crash the program each time I try :)
17:36:58 <jralls> warlord: https://www.bugzilla.org/docs/4.4/en/html/cust-templates.html
17:47:02 <chris> CDB-PHONE: your tidbits of knowledge should be summarised into the guide intro or appendix... we don't need "Accounting The Reference Guide" but a paragraph or two for each policy, with reference to IFRS
17:48:07 <chris> especially "A datafile must have a home currency which is invariant. This means all foreign incomes, expenses, must be converted to home currency using FX applicable at the posted date. Reference: IFRS 12.345.67"
17:48:23 <CDB-PHONE> perhaps the best way to do that is to use the finished transaction tool to create one of every type of transaction, and have an explanation for each transaction
18:00:07 <chris> .au is also annoying in taxing worldwide income
18:00:26 <chris> the counterpart is it has franking credits
18:01:45 <jralls> "frankking"? In US English that refers to a congress perk where they can use the postal service for free. What does it mean in AU?
18:02:34 <chris> something about if I hold Australian ASX stocks I get tax credits with dividends
18:03:25 <chris> i.e. extra income cf holding US-stocks
18:04:08 <chris> lots of retirees have it in their financial plan to rely on franking credits
18:06:19 <jralls> Interesting. Seems sort of like the lower rate I pay on dividends if I've held the stock for more that 3 months, but with credits instead of an adjustable rate.
18:06:44 <jralls> I wonder how they derived the word usage.
18:09:26 <chris> jralls: if you have time to suggest a snippet of code (both definition and usage) to replace my string bitfield I'll amend.
18:09:46 *** Herbert has joined #gnucash
18:11:51 <jralls> chris, it'll take a bit more than a snippet because I think that you decomposed the problem the wrong way around. But I'll explain what a real bitfield is and maybe you'll undersand why your string thing isn't one.
18:12:45 *** Herbert has quit IRC
18:12:45 <chris> ok. (brb short walk with byb)
18:12:48 <chris> ok. (brb short walk with bub)
18:13:09 *** David has quit IRC
18:13:14 *** David has joined #gnucash
18:13:15 <jralls> As you know everything in a computer is represented in binary numbers. You sort of mirrored that in the character representation of the digits 0-7.
18:14:41 <jralls> Computer languages have the ability to manipulate those representations as bits. Here's the Guile documentation: https://www.gnu.org/software/guile/manual/html_node/Bitwise-Operations.html
18:15:45 <jralls> In C we use the operators & | and ^ for logand, logior, and logxor.
18:16:23 <CDB-Man> back from a quick dinner. trying out https://wiki.gnucash.org/wiki/Custom_Reports#Load_the_report_from_a_user_account now
18:22:38 <CDB-Man> > For GnuCash v3.x edit GNC_CONFIG_HOME/config-user.scm to add a line of the form:
18:22:38 <CDB-Man> no such file "config-user.scm at this path?
18:22:41 <jralls> Unsigned integers are represented purely, such that 1, 2, 3, and 4 are represented as 01, 10, 11, and 100 respectively. So your scheme in dialog-stock-editor.c is to represent can-be-positive with the first bit, can-be-zero with the second, and can-be-negative with the third.
18:23:07 <jralls> CDB-Man, it doesn't exist unless the user creates it.
18:23:37 <CDB-Man> so I just need a blank text file, renamed to scm, and put in this 1 line (load (gnc-build-userdata-path "my-report.scm")) ?
18:24:04 <jralls> CDB-Man I think so. I've not ever done it.
18:24:18 <CDB-Man> OK. then for gnc-build-userdata-path, what is said path?
18:24:41 <CDB-Man> is it this same folder, meaning i can drop the chris tool at C:\Users\CDB\AppData\Roaming\GnuCash\ ?
18:24:52 <jralls> Uh, whereever you put the file that you want to load.
18:25:05 <jralls> Ah, yes.
18:27:33 <CDB-Man> ok, lets see if this works and load the chris report into Reports > experimental
18:28:38 <CDB-Man> success! it's there. lets see if it runs...
18:29:10 <CDB-Man> time to actually process those 20 transactions i had the other week
18:29:20 <CDB-Man> lets see if chris ' recent fixes make it match my excel
18:29:27 <jralls> chris, so if you put the variable you want to check in val you could see if zero values are allowed with if (val & 2).
18:31:13 <jralls> A "mask" is a constant value; you might do static uint8_t POS_OK = 1, uint8_t ZERO_OK = 2, uint8_t NEG_OK = 4.
18:35:46 *** bertbob has joined #gnucash
18:35:46 *** ChanServ sets mode: +v bertbob
18:37:21 <jralls> Then to test if zero or negative is allowed you could `if (val & (ZERO_OK | NEG_OK))...`; if you want to see if positive *isn't* allowed you would say `if (val ^ POS_OK)`. Each of those tests is a single machine instruction. Notice that in the first example two conditions are combined in a single test with | and that using the named mask values makes for clearer code than using magic numbers.
18:42:15 *** bertbob has quit IRC
18:45:56 <chris> CDB-Man isn't hacking fun
18:46:26 <chris> https://www.commsec.com.au/education/learn/managing-investments/how-do-franking-credits-work.html
18:47:58 *** bertbob has joined #gnucash
18:47:58 *** ChanServ sets mode: +v bertbob
18:49:32 <jralls> That principle can be expanded to pack multiple such checks into a single value. If instead of that 6-character string you have a uint32_t with a hex digit representing the value of each variable then the proceeds value would be in the 4th hex digit. If you want to look at just that value you would "mask" it with proceeds_sign = val & 0x000f0000; so that only the ones from that digit contribute to proceeds_sign.
18:50:10 <chris> ^ uh probably not, for simplicity's sake
18:50:23 <chris> i'll have a try tonght
18:50:55 <jralls> No, don't, because as I said before beginning the lesson, it's the wrong way to approach the problem.
18:54:40 <jralls> You want a functional decomposition where you define a set of actions that need to be combined in different ways for each transaction type.
18:55:16 <jralls> Changing the implementation won't fix the bad design.
19:12:37 <chris> don't -> as in don't try, or don't use the multiple-acking?
19:13:33 <chris> don't -> as in don't try, or don't use the multiple-packing into a single value?
19:14:40 <jralls> Don't waste your time changing the sign-character-string-mess into a real bitmask one. Do write a sample program to play around with bitmasks because they're used a lot and it will help you to be familiar with them.
19:17:14 <jralls> Two more binary operators to learn too: << and >> are shift left and shift right. 010 << 1 = 100, 010 >> 1 = 001. Some languages have rotate functions/operators so that [pseudocode] lrotate(1010, 1) would be 0101, but C doesn't.
19:21:10 <jralls> Shifts are much faster than integer multiplication and division; << 1 is equivalent to * 2 and >> 1 is the same as / 2. In the proceeds_sign example above you'd really do proceeds_sign = (val & 0x000f0000) >> 16 to make it more convenient to test the bits.
19:30:46 <chris> I'll hope the account_get_linked_account mechanism is self-explanatory. very orthogonal to #762.
19:31:06 <chris> it would also be useful for the stock-split assistant.
19:31:16 <chris> (and acb-tool)
19:31:56 <chris> I guess the big issue is whether to enforce "transaction-currency must be home currency" rule
19:32:09 <chris> ^ ths is out of my field for now
19:34:00 <jralls> I don't think we can do that with the current design and we have too much spaghetti to change the design for the next couple of design cycles.
19:40:54 *** User has quit IRC
19:53:37 <chris> jralls: its an easy change. it's either stock->parent currency (curremt), default-pref-currency (no!!), or root-account-currency (proposal)
19:54:57 <chris> the root account being home currency is a natural policy change
20:31:16 <warlord> jralls, I can send you the tmpl file to edit and you can send it back to me and I can place is in template/en/custom/pages/...
20:33:46 *** David has quit IRC
20:33:52 *** David has joined #gnucash
20:51:29 <CDB-Man> chris: in your acb tool, what sthe proceeds account for?
20:51:39 <CDB-Man> that's where the cash goes?
21:02:31 <CDB-Man> aha, chris you'll be happy to know that on transaction #1 of 20, ive already identified a data gap in my excel, since your report pucks up all transactions in gnucash. huzzah!
21:32:13 <CDB-PHONE> CDB-Man: remember to action the to-do in the ticket regarding adding negative checking into the CDB spreadsheet
22:21:21 <CDB-Man> done
22:32:38 <CDB-Man> jralls: in the past, has Wm ever taken the hint when people just ignore him? or is he fairly oblivious and keeps bantering on?
22:33:51 *** angel has joined #gnucash
23:25:53 *** angel has quit IRC
23:26:24 *** TownsendHardware has quit IRC
23:30:16 *** angel has joined #gnucash
23:35:52 *** Agfarmer18 has quit IRC
23:51:58 *** angel has quit IRC