Sam Trenholme's webpage
Support this website

August round-up


August 20 2019

This blog is a collection of thoughts I have had in August of 2019.

==HJSON: Better JSON==

I always felt Yaml is far too complicated of a format for storing hierarchical data. JSON is too simple (no comments; hard to store multi-line strings).

HCL, the hierarchical data storage language used by Terraform, is one possible happy medium between JSON and Yaml.

Another option, if the string values are not multi-line, is CommentJSON (use the Python module or write 10 lines of code that strips out comments from JSON if using another language).

If multi-line strings are needed, the best format is probably HJSON (human-readable JSON). This is JSON with comments and multi-line strings. It also allows the final element of an object to have a trailing comma, and for strings to not be quoted. Several languages are supported: Javascript, .NET, Go, Java, PHP, Python, C++, and Rust. If I were writing MaraDNS’s parser today (I have no plans to), it would use the HJSON format for configuration and zone files.

Another option is JSON5, but that JSON superset appears to only have Javascript support.

==Paying off student loans==

Let’s look at a student loan of $100,000. This is a reasonable amount to pay to get a four-year degree at a private college; $50,000 for four years of tuition and fees, and $50,000 for four years of living expenses.

Here is how a student loan works. The loan has two parts: The part the bankers get which you will never see again, and the part which actually pays off the loan. The money the bankers get is “interest”, and the monthly interest is calculated by calculating “loanAmount * (loanPercent / 12)”, so for a $100,000 loan with 6% interest, take 6%, divide it by 12 (1/2 of a percent), then multiply that by $100,000 (the amount owed in the loan), to get $500.

If one pays $501 a given month, the amount given to bankers is $500, and $1 is used to make the amount owed in the loan (the principle) lower. So, when paying $501, the loan is now for $99,999. If paying $1000, the loan is now $99,500. If one only pays $400, the loan is now $100,100 which means one is going in to a hole.

The more one pays over and above the interest, the more quickly the loan gets paid off. If one pays $1,000 a month to pay off a $100,000 loan at 6% interest, they will be debt free within 12 years.

The “getting $1000 a month just to pay off the loan” requires, if someone is in California, having a cheap $1500/month apartment (or a house in the middle of nowhere), not eating out or going to Lady Gaga concerts to reduce monthly other expenses to $500/month (and we’ll add another $500/month for their car they have to keep running), means they have to make $3500/month after taxes, which is about $5250 a month before taxes or a $63,000/year job ($70,000/year because they also have to deduct medical from the paycheck).

Point being, if one has $100,000 in student loan debt and lives in California, one needs to make about $70,000 a year to pay it off in a reasonable amount of time while paying all the other expenses.

Comments are closed.