Code Reviews

A common thing that is often observed in code reviews is people taking them personally, which is the worst thing a dev can do. CRs are meant to encourage best practices, catch errors a dev may overlook as their eyes gloss over the changes, and ensure code quality, while also aiding the skill development of the author AND the code reviewer.

Reviewers aren’t trying to judge the author – they just care about the quality and maintainability of the code being checked in and the more code reviews one does, the more patterns they start seeing of things which become problems in the future. Which is why even the most experienced of developers don’t check-in code without a CR.

A lot many devs myself included, and especially those in the senior/principal levels, tend to look at all code reviews in their team/skip-team – to see where they can jump in and help, to learn from others, and to watch out for things that seem innocent and correct at the component level but could become problems in the future or when looking at the bigger picture.

Downloading Fidelity 401k transactions into an Excel spreadsheet

The Fidelity 401k account transactions download option just lets you download amount/shares per transaction – i.e., they don’t give you the option to download the split of each transaction (employee pretax, employer match, after tax etc.). I maintain an excel spreadsheet of my own for this but it’s a pain as it needs to be kept up to date manually by looking at the Fidelity website (and clicking the pesky ‘show details’ link to expand each transaction).

So I automated a bunch of this – you can get the scripts from https://github.com/amalani/FidelityTransactions.

  • Copy pasting the first file (fidelity.js) in the F12/developer options’ console tab of the browser when you’re on the transaction history page of Fidelity downloads all the transactions into a new file (transactions.js) on your machine.
  • Dropping this file on the second file (ExportToCSV.js) in Windows Explorer generates a CSV file containing all the transactions which can then be opened in MS Excel.

The CSV looks something like this but MS Excel treats it as a spreadsheet.
Date,Investment,TransactionType,Amount,Shares,Blank,01 - EMPLOYEE PRE-TAX,02 - EMPLOYER MATCH,05 - REGULAR AFTER-TAX,
12/31/2015,FIMM MONEY MKT INST,Contribution,1094.79,1094.790,,,60.08,1034.71
02/02/2016,VANG S&P 500 IDX TR,Exchange In,1000.00,9.82,,764,236
02/03/2016,FIMM MONEY MKT INST,Dividends,0.43,0.430,,0.25,0.18

Let me know if you find it useful.

Monthly/Annual Cash flow spreadsheet

I’m a big fan of using MS Excel to do calculations, plan and budget. If you’re planning a yearly budget, it helps to make a list of income vs major expenses on a rolling 12 month period to see whether you expect the cash in your bank accounts to cover anticipated expenses.

Here’s a sample cash flow spreadsheet for a couple and their child. I’ve come up with some random numbers and a scenario where the couple doesn’t work (or is on unpaid leave) for a month or two (and thus doesn’t get a paycheck) and some estimated expenses to illustrate how to use the spreadsheet.

This is what it looks like – preview link.

The yellow background cells are the ones that need to be filled. Blue indicates calculations arising from the spreadsheet. The red cells are alerts to watch out for. The last row indicates the amount expected to be in your bank account at the end of the month.

To use this spreadsheet, go to this link and click File -> Make a copy to make a copy of this in your Google account (you’ll have a to login for this). Then you can make changes to the numbers in your own copy of the sheet. Keep coming back to the sheet and check the version history tab to see if I have any more changes than what were there in your copy.

Let me know if you’d like any additional features in this spread sheet.

Psychic Debugging

A peer team member (his manager and my manager report to the same person) was investigating a bug that the Office team had reported about in the Taskbar. The issue was a bit hard to repro and under a particular condition, would fix itself up but up until now the investigation from our side had mostly been about trying to figure out the best way to repro this bug to then try and figure out what’s going on. My colleague got some other high priority work assigned to him so I got pulled in to continue the investigation.

After spending some time debugging Lync and explorer under windbg simultaneously (so I could track the API calls from Lync), I replied with my findings and the bug opener’s (OP) reference became a rather happy moment me. (email summarized and actual details removed)

OP: That’s exactly my reference. 😉

Me: OMG, I’m the new Raymond Chen 😉

OP: I think, it’s a fine example of psychic debugging! 🙂 That’s exactly what my settings are.

Me: I spent some time looking at this and although I haven’t been able to repro this myself, I think this would happen for either of the following two reasons, although reason 2 seems less likely the case. Reason 1 …, 2 ….

OP – are you running Lync.exe under these non-default settings (settings Lync doesn’t ship with) which is probably what’s causing the bug? I haven’t been able to repro this myself but I’d expect this to happen only under those settings due to …

Raymond is a resident ninja, and probably one of the best Win32 devs of all time. So, this is probably one of the best compliments ever.

Fixed Deposit Interest Calculation Spreadsheet

I stay in the United States but I’m originally from India. I have a few fixed deposit accounts in India for which I need to calculate the interest in terms of US Dollars (as IRS taxes worldwide foreign income for US residents) and Indian rupees (so I can get a refund of the taxes in India – or not pay taxes for NRE accounts as interest is tax free).

Tracking this is difficult as my bank in India doesn’t provide a monthly/annual interest income chart, and even if it did, it would be difficult to track since the tax year in US is Jan-Dec while in India is Apr-Mar. Another complexity is that there are two kinds of fixed deposit accounts RIP (aka reinvestment accounts – where the interest is compounded quarterly but paid at the end of the term) and FD (aka fixed deposit – where the interest is deposited to another account quarterly). Either account type requires you pay the interest on an annual basis which is easy to calculate for FDs but not so much for RIPs.

So I created a spread sheet that I use to track the interest income so I don’t have to back track all this each April when taxes are due in US.

  • It supports FDs (quarterly compounding and deposit) and RIPs (quarterly compounding, deposit on maturity).
  • Once you setup the FDs, it will highlight entries that need an update (update meaning, you need to update the interest earned for that entry). The interest for that term is shown in the last column (FDs will have same interest, RIP interest will change every term). Once you’ve updated the ‘Last updated’ column, the ‘next update’ column will point to the minimum of (FD expiration, or the next quarterly term) so you know when this entry will next need to be updated.
  • Two columns per year where you update interest (Jan-Mar) and (Apr-Dec). When calculating Indian taxes for say 2013, I’ll use 2013 Apr-Dec + 2014 Jan-Mar. To determine foreign interest so I can pay taxes in US, I’ll use 2013 Jan-March and 2013 Apr-Dec.
  • Doesn’t handle non-month terms (e.g.: 1 year and 5 days, It will just show four quarters, but you can figure out the interest for the rest of the 5 days based on the maturity amount you might have been told when you created the FD).
  • The total amount (cell I4) will look at only active FDs and skip matured FDs so you know how much money is invested.
  • Just make sure to follow the help in the first sheet. 🙂 There are a lot of formulae and the rows are different for FD/RIP/Savings bank interest so you don’t want to overwrite the wrong cell.
  • Disclaimer: By using this spreadsheet, you agree to not hold me liable for any calculation mistake made by the spreadsheet or you. I use this spreadsheet myself so it has gone through more than a few iterations of fixes or feature additions and I’m certain all calculations are correct but this basically absolves me from any mistakes that happen

So, without further ado, here’s the link to the spread sheet: http://bit.ly/amalani_fdcalc. To use this, click the link and make a copy of the spread sheet in your own Google account. If you’d like to be notified when I make a change to the spread sheet, please fill this form. http://bit.ly/amalani_fdcalcnotify.

Thanks, hope this makes your life easier 🙂 Let me know how you like it or if you want additional features.

Lenovo Yoga Pro 2 Tips and Tricks

If you have a Lenovo Yoga 2 Pro laptop/tablet device, here are my tips and tricks for it:

1. If you hate the reverse touch pad scrolling but are annoyed there’s no way to change that

  • Uninstall the Synaptics Touch pad driver from “Add Remove Windows Programs” (hint: Press Win+X and open Programs and Features).
  • Then, download and install the Synaptics Touch Pad driver for the Lenovo Yoga 13  which had the option to disable the reverse scrolling. Link to the download page.
  • Restart your laptop.
  • Click on the touch pad icon in the taskbar (it may be in the overflow area – click the up arrow to open that) and choose the option to disable reverse scrolling.