HNHacker News
TopNewBestAskShowJobs

meekaaku

253 karma · joined June 12, 2017

submissionscomments
meekaaku··on Accounting for Developers, Part II
Its a tree. Eg:

Expense

- Salaries

- Rent

-- Warehouses

-- Retail space

- Utilities

meekaaku··on Accounting for Developers, Part II
The above looks like $70 was taken from cash and deposited to bank. Thats not whats happening in the real world. Since cash is fungible, one could ignore that. But if it was cheque + bank-transfer or something else that leaves a record, then that wont work. Or when you include VAT/GST/Sales tax. Or when you pay a loan monthly payment of $1000 that needs to be split to principal and interest. etc.
meekaaku··on Accounting for Developers, Part II
Its not a problem in practice. There might be a way to enforce that through database constraints, but in practice, checking transaction lines sums to 0 in business logic is not that hard. Having said that, you can run accounting entry sanity checks on the entire database. As previously said

SELECT SUM(amount) /* this should sum to zero */

FROM transaction_line

---

Also to identify any non-balancing transaction is easy:

SELECT tx.id, tx.date, SUM(amount) tx_sum

FROM transaction tx

INNER JOIN transaction_line txl ON txl.transaction_id = tx.id

GROUP BY tx.id

HAVING tx_sum != 0

---

This will identify them even if caused by your business logic bug, database bug, disk corruption etc.

This can also be done on the single accounting transaction just after insert too and can be done within the same database transaction.

meekaaku··on Accounting for Developers, Part II
The problem with this will be when you have 3 accounts involved on a transaction. Eg, you take a sales receipt with part bank transfer, part cash.

Sales Cr $100

Cash Dr $30

Bank Dr $70

Your approach will have:

Sales Cr $70, Bank Dr $70

Sales Cr $30, Cash $30

That looks like two sales, which is not really the case.

meekaaku··on Accounting for Developers, Part II
To build a chart of accounts, you can have a parent column in accounts table. Account balances is just:

SELECT account.name, SUM(amount) balance

FROM account ac

INNER JOIN transaction_line tl ON tl.account_id = ac.id

GROUP BY account.name

You can cache this balance values with a current_balance column on accounts table

Once you have that, for any real world transaction, all you need to figure out is what are the accounts to debit/credit, ie classification. That is a higher level thing and is the business logic of an accounting application.

meekaaku··on Accounting for Developers, Part II
The heart of double entry accounting is extremely simple. Forget about asset/liability/expense. Money always flows from one account to another. What goes out from account_1 must go into another account(s). Typical tables:

accounts (id, name)

transaction (id, date) /* some call it journal */

transaction_line (id, transaction_id[fk], account_id[fk], amount)

I use -ve amount for credit, +ve for debit. That way when you do SUM(trascation_line.amount) it would come to 0.

This also cleanly maps to database transaction too where all transaction_line rows and transaction row should be atomic.

If you want multi-currency support, instead of amount column, it needs to be currency_code, currency_rate, amount_in_currency, amount_in_basecurrency ( i know we don't need this all, but sometimes you want to record the amount as entered, eg EURO 52.10 u want to record as entered even if your base currency is USD)

meekaaku··on Accounting For Developers, Part I
Inventory is not a second currency. Multiple currencies are handled using Exchange loss/gain accounts. I will try running your example from scratch. You begin business with $100 capital which is deposited to your bank account. I am using Cr for credit, Db for Debit

1. Starting capital: Capital Cr $100, Bank Db $100

2. Purchase widgets worth $50: Bank Cr $50, Inventory Db $50

3. You sell half of this inventory (valued $25) for $75 in cash:

Sales Cr $75, Cash Db $75

Inventory Cr $25, Cost of goods sold Db $25

4. You sell rest of your inventory on credit to John for $110:

Sales Cr $110, Accounts Receivable-John Db $110,

Inventory Cr $25, Cost of goods sold Db $25

5. You pay $30 salaries via cheque: Bank Cr $30, Expense-Salary Db $30

At the end of all this your PL (profit loss statement) would look like this

Sales: $185 (110 + 75)

Cost of goods sold: $50 (as you sold all of the inventory)

Gross profit = sales - cost of goods sold = 185 - 50 = $135

Expenses = $30 (salaries only)

Net profit = gross profit - expenses = 135 - 30 = $105

Your balance sheet at the end of all this will be :

Capital: Cr $100

Accumulated profit: Cr $105

Bank: Db $20

Cash: Db $75

AR John: Db $110

Inventory: 0 (as you sold all).

Note the balance sheet balances nicely as Capital + Accumulated profit = bank + cash + AR + inventory

meekaaku··on Accounting For Developers, Part I
> its better to have one row in a table with a debit and credit.

No. Some transactions have 3 lines, eg: two debits and one credit. Some examples: - Split payment at a shop, $100 item bought with $70 cheque and $30 cash would be credit sales $100 debit cash $30 debit bank $70

Now if you introduce sales tax or VAT/GST, its more complicated. Say the $100 item is actually $90 + $10 VAT, then entries goes: credit sales $90 credit vat-payable $10 debit cash $30 debit bank $70

meekaaku··on London’s Lost Ringways
The dartboard should be done for the London tube/rail network. It easy to get into central London from periphery (say Bromley to Victoria is 20min by train, 1hr by car), but periphery to periphery is not good if you dont have direct train (eg Bromley to Greenwich is 45min by train, but 20 min by car). The situation is worse if you are carrying luggage and/or kids.
meekaaku··on Show HN: Datagridxl2.js – Fast Excel-like data table library
This looks very nice! I am looking for a spreadsheet like component for a project I am working on. Had evaluated jspreadsheet before. Question I have is, how would one go about integrating formulas and references? The demo doesnt seem to support that.
meekaaku··on Cities should not pay for new stadiums
I agree with your basic point. Businesses (the sports teams are) should fund themselves, apart from common things paid for by taxes like roads, bridge and such infrastructure. But London/Paris are well known for their sports teams. London alone as Tottenham, Chelsea, Arsenal which are big Premier league teams. Others lesser known Watford, westham, Crystal Palace are all basically London teams. Besides all? of PL teams are city based, Manchester City/Utd, Liverpool, Leeds, Leicester etc.
meekaaku··on Happy New Year HN! What are your plans for the new year?
- Get closer to nature. Just completed PADI Openwater with my son few days ago. So hopefully more of diving/nature stuff.

- Shift more to sales/marketing and a bit less on dev in my current work.

- Side hustles in SaaS/ecommerce/blockchain

- Read more

meekaaku··on OKRs vs. KPIs: understanding measurements for your SaaS business
I have read the John Doerr's Measure What Matters, and trying to implement some. Do you keep all OKR's visible to everyone in the organisation?
meekaaku··on A from-scratch tour of Bitcoin in Python
He was doing this kind of hobby work well before. I learnt solving Rubik's cube from his page[0].

[0] http://badmephisto.com

meekaaku··on Ask HN: How do I find a good startup idea?
Problem 2: It is very manaul and error prone to prepare Bill of Quantities/Materials in arch/engineering sector. Most firms rely on Excel. Once the data has been put in excel, there is no way to split/sort/question about the data. You cannot for example generate material bill for all 2nd floor electrical works, or say get me all reinforcement details for foundation.

Solution: Preferably a cloud based quantity take-off software that can read/mark cad/pdf files. Once the data has been input (manually or otherwise), it should be able to generate various reports (or presentation bills) based on what is being asked,(see questions above).

The only cloud based one I know is Stack[0]

[0] https://www.stackct.com/

meekaaku··on Ask HN: How do I find a good startup idea?
I have some ideas I believe that, if done well, will be transformative:

Problem 1: Architecture/Engineering is still very much traditional. Various distributed teams across cities/countries email CAD (mostly autocad) files back and forth or host it in cloud, with changes highlighted in revision clouds. The delivery of final design involved the interplay of specialisted teams, architecture/structure/M&E/QS/Civl/Onsite etc. Lack of proper tools cause problems in synchronising and keeping everyone uptodate with all the changes, error prone and its extremely manual. This becomes evenmore important when the actual construction is going on and you need to keep track of ammendments etc. A simple architectural change (eg moving a door), need to be reflected in structure/m&e all drawings, possiblly reworking internal wiring etc.

They (I dont mean everyone, but most of the industry) have never seen how distributed teams of programmers use version control software to sync/branch/diff/merge work from multiple teams.

Solution: A tool that can seemlessly do diff/merge/branch of CAD drawings (perhaps integrated into AutoCAD or other CADs itself) will bring a lot of efficiency into architecture/engineering field. Lead Architect could have his team working on various parts of the design/experimental ideas (think feature branches), which he merges to his tree. Engineering team will pull from Lead Architect. M&E team can pull from both these teams etc (this is similar to Linus trusted leutinent model). The idea is NOT to change how they organise their team or automate everything, but provide tools to help the human to make things more efficient.

As far as I know OnShape are the only people working on such a thing and that is 3D. Most arch/eng is still 2D. Autodesk themselves have Revit but I am not sure of to what extent it does all these.

meekaaku··on Microsoft bids $44.6B to buy Yahoo (2008)
No. Opera from early 2000s atleast had tabbed browsing. It also had gestures, paste-and-go, open non-hyper plaintext links in tab etc.
meekaaku··on Comparing Svelte and React
How come I rarely see mention of Aurelia when discussing JS frameworks? Aurelia 2 will be out soon, and I find things well thought out even in v1. You basically write just html and pretty much plain javascript. It is batteries included with DI/router/Event listener/validation etc.
meekaaku··on Ask HN: What’s the most important modern simple invention?
Not post 1700, Luca Pacioli's double entry accounting is simple but extremly effective one.
meekaaku··on Stephen Hawking’s Final Paper: How to Escape from a Black Hole
"SR similarly wasn't required to explain anything important"

Wasnt it the case that no one was able to explain Michaelson-Morley experiment? That speed of light was measured to be the same irresective of observer speed? Ppl came with all sorts of explanations (ether/lorentz tx etc), but it was Einstein who had the creativity to suggest that maybe time itself was slowing down. With that insight, the rest was beautifuly derivable.

And this is also why, Hilbert was able to (and otherws were racing to) derive the field equations before Einstein, since Einstein needed help from mathematicians (Grossman?), and Hilbert was an already excellent mathematician. SR and GR is derivable from beautifuly simple insights (time slowdown, gravity/acceleration equivalence).

One could say Einstein came with this insight out of the blue, but Poincare was also investigating time dilation, but stopped because it was too counter-intuitive.

Edit: typos

meekaaku··on Stripe Is Now a $20B Company
This is soo true. One of the best comments I have seen on HN.

Thanks.

meekaaku··on Show HN: Cell.js – A Self-constructing web app framework
Ok. I found a way using factory:

  ItemMaker = function(data){
    return {
    $cell: true,
    $type: "h1",
    style: "font-size: 100px;",
    $text: data,
  
    }
  }
  var i1 = ItemMaker('foo');
  var i2 = ItemMaker('bar')
meekaaku··on Show HN: Cell.js – A Self-constructing web app framework
This is interesting. I have had a look at the examples. One question that comes to mind, how do you make a reusable component? Say I have: Part = { $cell: true, $type: "h2", $text: "Part No: ", } Part is to be instantiated multiple times in the same page, but I want different $text. How do I pass this data?
← PreviousPage 4 of 4