Wednesday, July 16, 2014

Tax Brackets

I saw a post where someone was advocating a sliding tax scale instead of tax brackets.  The thing is I think many people misunderstand that tax brackets don't mean that two people making $37k and $89k pay the same tax rate, despite both belonging to the 25% bracket.

I wrote a quick perl script to calculate the effective tax rate for taxable incomes $0 - $1,000,000 and plotted it.  Let me stress taxable incomes here, this is after deductions are applied.


Here's another for just up to $100k:

The result is more or less a logarithmic curve, which is realistically the curve you'd end up with using a sliding scale since you couldn't have the rate rise to infinity.  The other alternative would be a logistic curve.

If you thirst for sweet sweet data here it is:
http://pastebin.com/W8S5qLtg

Monday, June 30, 2014

On being sane in insane places

http://en.wikipedia.org/wiki/Rosenhan_experiment
Rosenhan's study was done in two parts. The first part involved the use of healthy associates or "pseudopatients" (three women and five men) who briefly feigned auditory hallucinations in an attempt to gain admission to 12 different psychiatric hospitals in five different States in various locations in the United States. All were admitted and diagnosed with psychiatric disorders. After admission, the pseudopatients acted normally and told staff that they felt fine and had not experienced any more hallucinations. All were forced to admit to having a mental illness and agree to take antipsychotic drugs as a condition of their release. The average time that the patients spent in the hospital was 19 days. All but one were diagnosed with schizophrenia "in remission" before their release. The second part of his study involved an offended hospital administration challenging Rosenhan to send pseudopatients to its facility, whom its staff would then detect. Rosenhan agreed and in the following weeks out of 193 new patients the staff identified 41 as potential pseudopatients, with 19 of these receiving suspicion from at least 1 psychiatrist and 1 other staff member. In fact Rosenhan had sent no one to the hospital.

Friday, June 13, 2014

Detroit: A Hurrican Without Water

http://goobingdetroit.tumblr.com/

This is a blog that goes through Google and Bing street view images and compares recent ones to old ones.  This shows the rapid deterioration of houses in Detroit.

Keep in mind the oldest images are from 2008, and the newest are from 2013.  So, 5 years is all it takes for a couple of houses to turn into couches.

Let me stress that these pictures are of the same place.


Friday, May 30, 2014

Everything there is to know about NES Tetris

http://meatfighter.com/nintendotetrisai/

When I was a kid, I kept track of the pieces I received in Tetris on a piece of paper, because I was convinced that the in game stats were lying (they weren't).

This guy wrote 25,000 words about the inner workings of Tetris (including an interesting RNG, which is actually truly random in practice).

Even if you don't understand or care about the technical details I recommend you skim through it, as there were a lot of interesting items.

Friday, May 2, 2014

The Graphing Calculator Story

http://www.pacifict.com/Story/
People around the Apple campus saw us all the time and assumed we belonged. Few asked who we were or what we were doing.When someone did ask me, I never lied, but relied on the power of corporate apathy. The conversations usually went like this:
Q: Do you work here?
A: No.
Q: You mean you're a contractor?
A: Actually, no.
Q: But then who's paying you?
A: No one.
Q: How do you live?
A: I live simply.
Q: (Incredulously) What are you doing here?!

Sunday, April 27, 2014

Block editing text in Notepad++ or Geany

The other day I showed the concept of block editing text to 3 different people in 3 different contexts.  All were unaware of it, and agreed it was a very useful feature.

Block editing allows you to drag your cursor down across several rows of text and edit them all at once.  Two main uses are to either type on several rows at once, or to select a column of data to be copied to somewhere else.

In Notepad++ it is Alt + Shift, in Geany is it Ctrl + Shift.

Consider this data:
-7.1382    6918.30976
-7.4637    7244.35
-7.7947    7585.7757
-8.1307    7943
-8.4715    8317.637
-8.8169    8709.635
-9.1664    9120.1
-9.5199    9549.9258
-9.8770   10000


If you wanted to remove those negatives, there are a few ways you could go about it, but with the ability to drag your cursor across several rows it is a simple matter to drag it down those rows and delete the negative.

If you wanted to paste this into a spreadsheet it may be able to figure out how to separate the columns, but by just selecting one column at a time and pasting it you can guarantee each column will end up organized properly.

I think block editing is pretty self explanatory, and the stolen gif does a good job of showing its potential.  However, I'd like to also touch on using find and replace.

Ctrl+H will bring up the find and replace box.  There is an option for regular, extended (escape sequences), or regex.  I prefer the extended option.  Let's say we wanted to enclose all the above data in quotes, separated by commas, and semicolons for each pair.  In other words we want this output:
"-7.1382", "6918.30976";
"-7.4637", "7244.35";
"-7.7947", "7585.7757";
"-8.1307", "7943";
"-8.4715", "8317.637";
"-8.8169", "8709.635";
"-9.1664", "9120.1";
"-9.5199", "9549.9258";
"-9.8770", "10000"


This is a pretty common format for input to various programs.  First, I would use block editing to change the spaces to ", " which admittedly wouldn't work for the last one.  If there were more of varied length I'd have to use a regex to check for multiple spaces (\s+).  The real usefulness comes from find and replace with newlines.

The newline character (\n) represents the each line break.  Search for that, and in the replace box enter ";\n"  If you want the output to just be on the same line leave out the \n from the replace text, maybe use a space instead.  On Windows you will likely need to use \r\n instead of just \n (\r = return, \n = newline).

These two techniques have saved me countless hours manually formating text.

Jack Churchill

http://en.wikipedia.org/wiki/Jack_Churchill
Lieutenant Colonel John Malcolm Thorpe Fleming "Jack" Churchill, DSO & Bar, MC & Bar (16 September 1906 – 8 March 1996), nicknamed Fighting Jack Churchill and Mad Jack, was a British soldier who fought throughout the Second World War armed with a longbow, and a Scottish sword (a basket-hilted claybeg commonly but incorrectly called a claymore). He is known for the motto "any officer who goes into action without his sword is improperly dressed." Churchill also carried out the last recorded bow and arrow killing in action, shooting a German officer in 1940 in a French village.