An Astronaut's Guide to Life on Earth review
Mood: productive
Posted on 2014-01-11 15:15:00
Tags: reviews books
Words: 54

An Astronaut's Guide to Life on EarthAn Astronaut's Guide to Life on Earth by Chris Hadfield
My rating: 4 of 5 stars

Very good memoir - Col. Hadfield talks about his life and lessons he learned along the way. It was more memoir-y than space-y which I didn't expect, but I definitely enjoyed and would recommend it.


View all my reviews

0 comments

New Windows Phone app: Baseball Odds!
Posted on 2014-01-10 13:33:00
Tags: windowsphone projects
Words: 124

Baseball Odds is now available in the Windows Phone Store!

This free app will calculate the probability of a team winning from a given situation. (i.e. tie game, top of the 8th, 1 out, runners on 1st and 3rd) It will also give the expected runs that a team will score in an inning - for example, your expected runs are higher with a runner on first and no outs than with a runner on second and one out, so a sacrifice bunt isn't a great idea in general. (of course, if the batter is terrible, then it might be anyway...)

This was the first project that I used Blend extensively to design controls, and I'm pretty happy with the results: check out these screenshots!

0 comments

Windows Phone: performance of parsing different file types
Mood: chipper
Posted on 2014-01-09 22:26:00
Tags: windowsphone projects wpdev
Words: 1033

When I started to work on Baseball Odds I knew I was going to have to worry about performance - the data set I have for the win probability has right around 15000 records. So I thought it would be neat to compare different file formats and how long it took to read their data in. Each record had the inning number (with top or bottom), how many outs, what runners are on base, the score difference, and the number of situations and the number of times the current team won. Here's a brief description of each format and some sample code:


Text:
This was actually the format I already had the data in, as it matched Phil Birnbaum's data file format. A sample line looks like this:

"H",1,0,1,0,81186,47975
and there are 15000 lines in the file. The code to parse this looks something like this:

const bool USE_AWAIT = false;
const bool CONFIGURE_AWAIT = false;
var resource = System.Windows.Application.GetResourceStream(
new Uri(@"Data\winProbs.txt", UriKind.Relative));
using (StreamReader sr = new StreamReader(resource.Stream))
{
string line;
if (USE_AWAIT)
{
if (CONFIGURE_AWAIT)
{
line = await sr.ReadLineAsync().ConfigureAwait(false);
}
else
{
line = await sr.ReadLineAsync();
}
}
else
{
line = sr.ReadLine();
}
while (line != null)
{
var parts = line.Split(',');
bool isHome = (parts[0] == "\"H\"");
_fullData.Add(new Tuple<bool, byte, byte, byte, sbyte>(
isHome, byte.Parse(parts[1]), byte.Parse(parts[2]), byte.Parse(parts[3]),
sByte.Parse(parts[4])),
new Tuple<UInt32, UInt32>(UInt32.Parse(parts[5]), UInt32.Parse(parts[6])));

if (USE_AWAIT)
{
if (CONFIGURE_AWAIT)
{
line = await sr.ReadLineAsync().ConfigureAwait(false);
}
else
{
line = await sr.ReadLineAsync();
}
}
else
{
line = sr.ReadLine();
}
}
}


(what are USE_AWAIT and CONFIGURE_AWAIT all about? See the results below...)


JSON:

To avoid having to write my own parsing code, I decided to write the data in a JSON format and use Json.NET to parse it. One line of the data file looks like this:
{isHome:1,inning:1,outs:0,baserunners:1,runDiff:0,numSituations:81186,numWins:47975}

This is admittedly a bit verbose, and it makes the file over a megabyte. The parsing code is simple, though:

var resource = System.Windows.Application.GetResourceStream(
new Uri(@"Data\winProbs.json", UriKind.Relative));
using (StreamReader sr = new StreamReader(resource.Stream))
{
string allDataString = await sr.ReadToEndAsync();
JArray allDataArray = JArray.Parse(allDataString);
for (int i = 0; I < allDataArray.Count; ++i)
{
JObject dataObj = (JObject)(allDataArray[i]);
_fullData.Add(new Tuple<bool, byte, byte, byte, sbyte>(
(int)dataObj["isHome"] == 1, (byte)dataObj["inning"],
(byte)dataObj["outs"], (byte)dataObj["baserunners"], (sbyte)dataObj["runDiff"]),
new Tuple<UInt32, UInt32>((UInt32)dataObj["numSituations"],
(UInt32)dataObj["numWins"]));
}
}


After I posted this, Martin Suchan pointed out that using JsonConvert might be faster, and even wrote some code to try it out.

Binary:

To try to get the file to be as small as possible (which I suspected correlated with parsing time), I converted the file to a custom binary format. Here's my textual description of the format:
UInt32 = total num records
UInt32 = num of records that have UInt32 for num situations
(these come first)
each record is:
UInt8 = high bit = visitor=0, home=1
rest is inning (1-26)
UInt8 = high 2 bits = num outs (0-2)
rest is baserunners (1-8)
Int8 = score diff (-26 to 27)
UInt32/UInt16 = num situations
UInt16 = num of wins

To format the file this way, I had to write a Windows 8 app that read in the text file and wrote out the binary version using a BinaryWriter with the Write(Byte), etc. methods. Here's the parsing code:

var resource = System.Windows.Application.GetResourceStream(
new Uri([@"Data\winProbs.bin", UriKind.Relative));
using (var br = new System.IO.BinaryReader(resource.Stream))
{
UInt32 totalRecords = br.ReadUInt32();
UInt32 recordsWithUInt32 = br.ReadUInt32();
for (UInt32 i = 0; i < totalRecords; ++i)
{
byte inning = br.ReadByte();
byte outsRunners = br.ReadByte();
sbyte scoreDiff = br.ReadSByte();
UInt32 numSituations = (i < recordsWithUInt32) ? br.ReadUInt32() : br.ReadUInt16();
UInt16 numWins = br.ReadUInt16();
_compressedData.Add(new Tuple<byte, byte, sbyte>(inning, outsRunners, scoreDiff),
new Tuple<uint, ushort>(numSituations, numWins));
}
}



Results:

Without further ado, here are the file sizes and how long the files took to read and parse (running on my Lumia 1020):








TypeFile sizeTime to parse
Text (USE_AWAIT=true)
(CONFIGURE_AWAIT=false)
278K4.8 secs
Text (USE_AWAIT=true)
(CONFIGURE_AWAIT=true)
278K0.4 secs
Text (USE_AWAIT=false)278K0.4 secs
JSON (parsing one at a time)1200KB3.2 secs
JSON (using JsonConvert)1200KB1.3 secs
Binary103KB0.15 secs


A few observations:

So since I had already done all the work I went with the binary format, and Baseball Odds starts up lickety-split!

--

See all my Windows Phone development posts.

I'm planning on writing more posts about Windows Phone development - what would you like to hear about? Reply here, on twitter at @gregstoll, or by email at ext-greg.stoll@nokia.com.

--

Interested in developing for Windows Phone? I'm the Nokia Developer Ambassador for Austin - drop me a line at ext-greg.stoll@nokia.com!

0 comments

many-link Friday: almost nuking the East Coast, raising the minimum wage, white privilege
Mood: jolly
Posted on 2013-12-20 10:38:00
Tags: links
Words: 502

I wrote a long (and unorganized) link post because I lacked the time to write a shorter one. Sorry!

- That one time we almost accidentally nuked the East Coast - for a while I didn't really see the point of the USA and USSR both reducing their nuclear arsenal, but fewer chances for accidents like this are definitely a good thing!

- From the Onion: If I Had One Piece Of Advice For Today's Youth, It Would Be To Throw A Baseball Really, Really Well

- Two posts on those Upworthy-style headlines that have been going around: We Wrote a Heartbreaking and Terrifying Post about Viral Content without Lists or GIFs. Then You Clicked on It, and Magic Happened. and Why Are Upworthy Headlines Suddenly Everywhere? Personally, those kinds of headlines worked on me for a few months and now I have an instinctual aversion to them.

- How Many American Men Are Gay? - probably around 5%. The interesting part, although not too surprising, is that the share of people that are out of the closet depends on how tolerant your state is.

- Top 10 (Crowd-Sourced) Gift Ideas for Engineers - man, I want that LabVIEW wrapping paper!

- Snacking Your Way to Better Health - nuts are good for you again! Also, apparently multivitamins aren't that good for you.

- If a Story Is Viral, Truth May Be Taking a Beating - a bunch of recently viral stories were fake, including that kid's crayon letter to Santa with a long amazon.com link. Be careful out there!

- Rice football team goes crazy in locker room after getting Liberty Bowl invite - the "Say yes, coach! Say yes!" is undoubtedly the best part.

- Coffee Overkill Has More Marketers Thinking That It's Time for Tea - wooo tea!

- King James Programming - Markov-chain generated posts of the King James Bible and a computer textbook. Sample:

And David said unto Saul, The LORD sent me from Kadeshbarnea to see the value of the variable search that can be stored in a very efficient manner.

- NORAD Tracks Santa's Path on Christmas Eve Because of a Typo - neat, I didn't know that!

- A few minimum-wage related links: Should We Raise the Minimum Wage? 11 Questions and Answers and Supersize My Wage. Obviously economics is not an exact science, but I think raising the minimum wage would do more good than harm.

- Anti-Vaccination Movement Causes a Deadly Year in the U.S. - grrrrrrr thanks a lot Andrew Wakefield

- When “Life Hacking” Is Really White Privilege - The title made me a bit uncomfortable, but after reading the article I think it's fair. White privilege (or, really, any sort of privilege) is not realizing that you have advantages because you are white, and I think that's what was going on in the original article. (as a white person myself I probably wouldn't have thought of this had I just read the original article, but that's privilege for you...)

- South Korean Theme Park Dress Up Penguins In Novelty Outfits For Christmas - I want to go to there! (thanks Jessica!)

Merry Christmas/Happy Holidays to all!

0 comments

World Cup: how many points do you need to advance?
Mood: geeky
Posted on 2013-12-08 21:45:00
Tags: soccer math
Words: 84

After the USA was drawn into the "Group of Death", I wondered how many points the USA would need to be relatively assured of making it out of the group. So I wrote a little Python script to do the calculation, and the answer is below:

Basically, 5 points (1 win, 2 draws) means you're almost guaranteed to get out of the group, while 4 points (1 win, 1 draw) means you have around a 50-50 shot.

So...now I know! And so do you!

0 comments

mega-link wednesday: self-driving cars, radiation poisoning, yet more about a basic income
Mood: busy
Posted on 2013-12-04 20:38:00
Tags: links
Words: 420

There are a ton of these, so here's a terrible effort at categorization!

Long reads:
- Long New Yorker article about Google's self-driving cars - sounds like they're making good progress!

- How radioactive poison became the assassin’s weapon of choice - long read about the poisoning of Alexander Litvinenko by Russian agents. Scary!

- A state drug analyst in Boston altered test results and mishandled evidence for nine years, and over 150 defendants have been released already. Amazing the damage that one person can do...

Economics and politics:
- A universal income is not such a silly idea - an economist weighs in on Switzerland's proposal.

- Is Work Necessary? - the idea goes hand in hand with a universal income.

- Does Medicaid Breed Dependency? - I read the headline and thought "of course not", but I guess that's my ideology showing :-) Anyway, this is a reasonable experiment, although the share of the population that's employed isn't a perfect metric. If someone is suffering crippling pain but has to work without Medicaid, is it really a good thing if that person is still in the workforce?

Visualizations and...videos?:
- 2013 winners of the Kantar Information is Beautiful Awards - some very nice visualizes in here!

- Baseball Games Beautifully Visualized Like Transit Maps

- Nyan Cat Bus - the video speaks for itself!

Copyright and, um, health:
- Goldieblox and the Three MCs - Goldieblox used a Beastie Boys song in their original ad (with new words), and it turns out copyright is complicated. Although Goldieblox later replaced the music in the ad. And while the idea for the toys is very cool, apparently the toys themselves may not be that great?

- Vaccinations have prevented at least 103 million cases of contagious disease since 1924 - and that's just in the US!

Punctuation, algorithms, public speaking, quizzes, Star Trek, and soccer:
- How the period became a sign of anger - sounds weird, but reading the examples I totally see it!

- Neural Network Follies - good story of a neural network gone awry...

- 7 Little-Known Ways to Conquer Your Fear of Public Speaking - I enjoy public speaking, and I plan on trying a few of these next time I do. (probably meeting the audience in advance and planning a perk for afterwards :-) )

- Can You Guess Famous Simpsons Quotes From Just a GIF or Freeze-Frame? - fun! I got 11/12, although there was some guessing involved.

- Five Leadership Lessons From Jean-Luc Picard - obviously a bit of linkbait, but I actually enjoyed the article. (thanks Mom!)

- The World Cup Draw explained - it happens on Friday! Hopefully it's a good one for the USA!

0 comments

Windows Phone: tips for lock screen functionality
Mood: busy
Posted on 2013-12-03 22:35:00
Tags: windowsphone wpdev
Words: 352

Motivational Penguin was my first app that had any lock screen functionality, so I thought I'd write up a few tips I learned along the way.

- The official lock screen documentation is quite good - see also the lock screen design guidelines. Although I didn't strictly obey the "Keep any text or graphics within this area" boxes - it seems like there's nothing wrong with spreading out to the right of the box?

- Motivational Penguin updates the lock screen in the background (which is common), and I ran into some trouble with the background agent. This is why I wrote a post about debugging scheduled tasks recently - there are some helpful tips in there!

- You will need some way to let the user decide whether to have the app update your lock screen or not (my app does this via a ToggleSwitch, part of the Windows Phone Toolkit). Be careful that if the user does let your app update your lock screen that you also check the value of Windows.Phone.System.UserProfile.LockScreenManager.IsProvidedByCurrentApplication - if this is false then your app won't have permission to update the lock screen. In my app I check this every time I show the ToggleSwitch and if it is false, make sure the ToggleSwitch is false as well.

- A nice feature to add is to configure how often to update the lock screen. I took my list of choices from Memorylage, my favorite lock screen updater. (seriously, check it out, it's great and well worth it!) Memorylage allows updates Hourly, TwiceDaily, Daily, and EveryOtherDay. To implement this, you can store the last time you updated the lock screen in System.IO.IsolatedStorage.IsolatedStorageSettings.ApplicationSettings, and if enough time hasn't passed, just exit early.


I hope these are helpful! Being able to update the lock screen in the background is really pretty cool :-)

--

See all my Windows Phone development posts.

I'm planning on writing more posts about Windows Phone development - what would you like to hear about? Reply here, on twitter at @gregstoll, or by email at ext-greg.stoll@nokia.com.

--

Interested in developing for Windows Phone? I'm the Nokia Developer Ambassador for Austin - drop me a line at ext-greg.stoll@nokia.com!

0 comments

Days of Fire: Bush and Cheney in the White House book review
Mood: peaceful
Posted on 2013-11-28 19:47:00
Tags: reviews books
Words: 144

Days of Fire: Bush and Cheney in the White HouseDays of Fire: Bush and Cheney in the White House by Peter Baker
My rating: 4 of 5 stars

The book is quite long, but it has a lot of fascinating details about the Bush presidency. I was most interested in what it had to say about the whole Iraq war thing - what I took away was that there were people who were thinking about going to war with Iraq very soon after 9/11, and while the administration may not have falsified intelligence about WMDs, it was very clear what the White House wanted to find which probably had some influence on the CIA.

It also talks about how Cheney did have a lot of influence during his first term, but his influence definitely waned by the second term.

Anyway, I'd definitely recommend reading it, even at over 800 pages(!)


View all my reviews

0 comments

New Windows Phone app: Motivational Penguin!
Mood: proud
Posted on 2013-11-23 20:52:00
Tags: windowsphone projects
Words: 45

Motivational Penguin is now available in the Windows Phone Store!

This free app will give you all the motivational penguin goodness you could ever want on your Windows Phone, including updating your lock screen. Download it now!

Thanks to chibird, who drew the original image.

0 comments

link friday: company loyalty, sleep, The Price Is Right
Mood: calm
Posted on 2013-11-22 15:43:00
Tags: links
Words: 220

- Loyalty and Layoffs - I thought this was interesting but I mostly disagree. Certainly not all companies are worthy of your loyalty, but saying that none are seems equally extreme. If your company treats you well, try to treat your company well. I do agree that it's generally a good idea to keep developing your skills to keep yourself employable, etc.

- Sleep: The Ultimate Brainwasher? - more evidence that sleep clears out toxins and such.

- Winning The Price Is Right - a very thorough guide to all 71 pricing games from a game theory perspective; you don't even have to know the prices! It was surprising to me that there are some games you can win 100% of the time. Also, looks like they need a better random number generator? (see Bargain Game, for example)

- Why Are We Building Jailbait Sexbots? (NSFW?) - the short version is that researchers built a very realistic 3D model of a 10 year old girl, then used that to catch sexual predators. This raises all kinds of legal and ethical issues...

- Machine learning is way easier than it looks - aw, man, now I want to play around with this!

- The Changing Rules of Outing - interesting perspective on not giving special treatment to gay celebrities.

- Together and Alone, Closing the Prime Gap - the prime gap is down to 600!

0 comments

Windows Phone: debugging scheduled tasks
Mood: happy
Posted on 2013-11-19 22:32:00
Tags: windowsphone wpdev
Words: 113

I'm running into trouble with a scheduled task in an app I'm working on. I was going to write a post about how to debug a scheduled task, and then I realized I had already written one! Here's info on how to effectively debug a scheduled task. In my case, the ScheduledTaskLogger is going to come in very handy!

--

See all my Windows Phone development posts.

I'm planning on writing more posts about Windows Phone development - what would you like to hear about? Reply here, on twitter at @gregstoll, or by email at ext-greg.stoll@nokia.com.

--

Interested in developing for Windows Phone? I'm the Nokia Developer Ambassador for Austin - drop me a line at ext-greg.stoll@nokia.com!

0 comments

a few thoughts about Oblivion (with spoilers!) and my emotional state
Mood: weird
Location: home!
Posted on 2013-11-16 23:09:00
Tags: movies essay
Words: 249

I just got back from a quick jaunt to St. Louis, and on the way back I watched Oblivion. (the recent Tom Cruise sci-fi movie)

beyond here lie SPOILERS for Oblivion


Near the end of the movie, it becomes clear that Tom Cruise (he has a name in the movie but, come on, he's Tom Cruise) and his wife Julia are going to have to sacrifice themselves to defeat the evil Tet, and Julia has to go up there in suspended animation. So we see Tom Cruise fly up there with the suspended animation pod and stuff happens and eventually he opens the pod and it's Morgan Freeman! (who is the leader of the humans but, come on, he's Morgan Freeman)

I did not see this coming (which is more than I can say for another major plot twist), but my first thought was that this was horribly unfair to Julia. She volunteered to martyr herself to save humanity, but Tom Cruise robbed her of that right, and now she has to live without him, which struck me as very very sad. Is that weird?

Anyway, I usually like unexpected endings to movies, but I was pretty bummed about this. Some combination of watching a movie while traveling/on an airplane and without David around often puts me in a weird emotional state. And I was very excited to see that there was indeed a happy ending when one of Tom Cruise's clones found Julia! (which actually made total sense)

0 comments

lots of links: misconceptions of poverty, more basic income stuff, baseball
Mood: content
Posted on 2013-11-14 15:53:00
Tags: links
Words: 200

- Poverty in America is Mainstream - some interesting facts here, like it affects way more people than I thought, although the average time spent in poverty is relatively short, which certainly challenges my preconceptions. Along the same lines - 7 Things No One Tells You About Being Homeless (a surprisingly serious piece from Cracked)

- Yet another article about Switzerland's proposal for a basic income - the more I read about this the more I'm convinced this is a good idea, or at least worth trying.

- How the Super-Rich Are Abandoning America - yeah, that's depressing.

- Interesting article on how baseball would be different if they only played 16 games a season instead of 162.

- An article about how an ad agency would market broccoli - apparently, picking a fight with kale is good business!

- 39% of people in South Carolina support same-sex marriage - whoa! For some perspective, in 2006 a constitutional amendment banning same-sex marriage passed 78-22%.

- Oklahoma! Where the Kids Learn Early - wow, apparently Oklahoma has universal prekindergarten!

- Occupy Wall Street activists buy $15M of Americans' personal debt - at the cost of $400K. Nifty!

- China discovers that pollution makes it really hard to spy on people - well, that's...something.

- An awesome-looking tea calendar (thanks Andrew!)

0 comments

November developer registration drive
Posted on 2013-11-12 22:55:00
Tags: nokia windowsphone wpdev
Words: 284

Would you like to win a pair of Monster Purity in-ear headphones in cyan, fuschia, or black? (your choice) Sure you would! The rules are simple:

1. You MUST live in my region - southern Texas (including San Antonio, Austin and Houston - if you're not sure, ask!), Louisiana, Arkansas, Mississippi, Tennessee, Missouri, or Iowa.
2. You MUST be an existing Windows Phone Developer WITH at least one published app currently in the marketplace.
3. You MUST be an active Windows Phone developer as of November 30th 2013, which means you must have either published a new Windows Phone application or have published an update to an existing Windows Phone application that required xap certification within a 180 day period. (counting back from November 30th your last updated date must be June 3rd 2013 or later)

Below is an example of where to find the last updated date on your Windows Phone application page in the Windows Phone Store.


Now that you know if you can participate or not here's what you need to do. Email me the REQUIRED information below.

1. First and Last Name
2. Email address (this is the one we can reach you at, one you actually check daily)
3. The link to your qualifying application in the Windows Phone Store.
4. DVLUP.com username (If you haven't registered yet, go do it, it's free and you'll be glad you did)
5. Your Windows Dev Center Publisher GUID (it's on your dev center dashboard)
6. Your location: City, State/Province (and county if you are in TX)

Entries must be received by November 30th - the drawing will be done on December 1st.

To enter, email ext-greg.stoll@nokia.com with the subject "November Registration Drive". Good luck!

0 comments

quick link friday: scary Toyota firmware,
Mood: okay
Posted on 2013-11-01 16:37:00
Tags: links
Words: 92

- Toyota's killer firmware: Bad design and its consequences - apparently the unintended acceleration problem was probably a software bug...reading the description of the code made me shudder! (11,000 global variables!)

- Help me optimize this code which enumerates all possible GUIDs - I read this and could not stop laughing!

- It's Halloween, so here's a picture of Patrick Stewart wearing a lobster costume in a bathtub - awesome? Yes.

- A cover of "This is Halloween" from The Nightmare Before Christmas done by one guy!

- CHART: 'Winners And Losers From Obamacare' - there are more winners than losers.

0 comments

Dixie Dude Ranch trip recap and pictures
Mood: relaxed
Posted on 2013-10-27 20:01:00
Tags: pictures travel
Words: 248

<- click for full album

We went to Dixie Dude Ranch for a long weekend and had a good time! Our room was nice:
(click pictures for full versions)

We arrived late Friday night. All of the meals were provided, but breakfast was at 8 AM every morning, so we slept in. Friday afternoon we rode horses for the first time:

We also did a lot of reading. One of the places we hung out was the main lodge:

There were some trails to walk on, although they were longer than they looked. They also weren't marked terribly well so we got a little lost a few times.

But mostly we hung around the ranch and did a lot of reading and such. There was no cell service on the ranch, although there was (slow) WiFi in the main lodge. After a day of adjusting to this, I found that my attention span got much longer, which was nice. We also played washers and horseshoes and such.

Sunday evening the ranch doesn't server dinner, so we went into Bandera for a bit of shopping and food.

No other guests were staying Sunday night, so things got a little spooky. Luckily a few more people were around Monday and Tuesday before we left.

Anyway, it was a very relaxing vacation and the staff was very friendly. (they even started bringing breakfast to our room when we woke up!) If you're looking for a dude ranch type place I'd recommend it!

0 comments

Falling in love by the end of this song - doing the math!
Mood: nerdy
Posted on 2013-10-26 16:19:00
Tags: math
Words: 544

But somewhere in the world someone is gonna fall in love by the end of this song,
--"Odds Are" by Barenaked Ladies

We saw the Barenaked Ladies in concert this week (it was fun!) and not for the first time I heard that line and wondered if that was true. So let's do the math!

For these purposes, I'm going to define "falling in love" as "something that leads to a wedding". [1] There are 7.12 billion people in the world[2], and average world life expectancy is 70 years.[3] The average number of marriages a person has throughout her life is a little tricky to track down, but I'll go with the estimate of 1.21.[4] Again to simplify things, I'm going to assume these marriages as evenly distributed throughout one's life.[5]

So, each person will have an average of 1.21/70 = 0.017286[6] falling in loves per year. Multiplying by 7.12 billion (and dividing by 2, assuming each "falling in love" involves exactly 2 people) gives us around 61.5 million falling in loves per year, or 168,500 falling in loves per day.

That sounded really high to me, but after some thought (and checking the numbers if we just look at US couples), it looks about right. The world is a big place!

The song "Odds Are" is 182 seconds long[7], so on average if you start playing the song there will be (182 (seconds/song)/86400 (seconds/day))*(168,500 (falling in loves/day)) = 354.9 (falling in loves/song).[8]

Now while things are looking good for BNL's assertion, this just tells us the average, not the probability that this will happen. For that we need to look at the Poisson distribution. Here our gamma is 354.9, and the probability that we will get no events is

(354.9)^0*(e^-354.9)/(0!) = e^-354.9

Wolfram Alpha says that this probability is around 7*10^-155, so the odds that someone will fall in love by the end of this song are extremely good. (for some perspective, there are "only" around 10^80 atoms in the universe[9], so the chances of not having anyone fall in love during the song are about the same as if you pick two random atoms in the universe, and I do the same and happen to pick the same two atoms)

So: BNL is correct! Kudos.


References:

[1] - Yes, I realize you could define "falling in love" a bunch of different ways, but this one is one of the easier to count. Feel free to do your own math!
[2] - World Population article on Wikipedia
[3] - Quote by Colin Mathers, coordinator for mortality and burden of disease at the World Health Organization
[4] - naderalmaleh on Yahoo Answers. I would not recommend using this citation should you be writing a research paper!
[5] - Obviously this isn't true on an individual basis, but in aggregate it's not bad. To be more precise you'd have to come up with a reasonable distribution for a person and then look at how demographics are changing over time. If you want that kind of detail, I'd recommend sending this in to xkcd's what if? and getting off my back!
[6] - Math!
[7] - Odds Are article on Wikipedia
[8] - Hooray for dimensional analysis!
[9] - Wolfram Alpha query "atoms in the universe", because I got lazy.

0 comments

link friday: cash grants for the poor, nonpartisan primaries are awesome, trouble in Wikipedialand
Mood: busy
Posted on 2013-10-25 13:36:00
Tags: links
Words: 157

- Research Finds Outright Grants of Cash Are Surprisingly Effective Form of Aid to the Poor - more evidence! (previously)

- California Sees Gridlock Ease in Governing - good for California, and I really wish more places would adopt nonpartisan primaries. (with the top two candidates going on to the general election)

- The Decline of Wikipedia - long article about how fewer people are editing Wikipedia, and the people that do aren't very diverse.

- T-Mobile Hands Consumers a Pleasant Shocker - amazing international rates for data! T-Mobile is awesome, although their network seems a bit worse than AT&T's...

- Eating popcorn in the cinema makes people immune to advertising - so, advertisers: no more ads at the movies!

- The 9 State Propositions Texans Will Vote On Next Week - nothing terribly interesting, except for Proposition 6 (the water one). Anyway, early voting has started, so find an early voting place here!

- Tea Party Group Leader: File 'Class Action Lawsuit' Against Homosexuality - too crazy not to share.

2 comments

link friday: the NFL and head injuries, women in science, Antonin Scalia
Mood: nervous
Posted on 2013-10-11 14:18:00
Tags: football links
Words: 316

I was going to write something about how I don't want to talk about the government shutdown or impending debt ceiling disaster, and then I looked at my list of links and lo and behold, there were a few doing just that.

- This summary of some Republican focus groups is pretty interesting/slightly depressing.

- Atul Gawande has a good short column about Obamacare and Republican obstructionism.

- The 10 Stealth Economic Trends That Rule the World Today - I rolled my eyes at the title, but there was some interesting stuff in here.

- NFL deliberately campaigned against science regarding head injuries - I was going to write a full post about this at some point, but I've been too depressed about it all. Here's the thing: I don't regularly watch football, but I do follow it some. But all this news about head injuries, the pain that many players suffer while playing and after retiring, and (to a much smaller extent) the fact that the NFL receives huge subsidies (did you know the NFL is technically a non-profit?) really make me think that I shouldn't be supporting football for moral reasons. So...I don't know.

- The press-release conviction of a biotech CEO and its impact on scientific research - the CEO was convicted for subdividing his patient group after the fact and touting that the drug worked great on "mild to moderate" sufferers of a disease. Be careful out there, statisticians!

- Why Are There Still So Few Women in Science? - very interesting article by one of the first two women to get a bachelor's degree in physics from Yale.

- WATCH: Rice University placekicker uses a soccer "rabona" to execute an onside kick - nifty little kick. (see: ambivalent comments about football above)

- A long, kinda weird, interview with Antonin Scalia - apparently he has friends "that I know, or very much suspect, are homosexual" but none have come out to him. I wonder why...

0 comments

Scarcity: Why Having Too Little Means So Much review
Mood: happy
Posted on 2013-10-06 22:17:00
Tags: reviews books
Words: 506

Scarcity: Why Having Too Little Means So MuchScarcity: Why Having Too Little Means So Much by Sendhil Mullainathan
My rating: 4 of 5 stars

A fascinating book about how scarcity (especially in money or time) changes you. Some highlights:

- One experiment was run on people during World War II (conscientious objectors, apparently) where they ate very few calories for weeks. The point of the study was to figure out how to safely start feeding them normal amounts again, but during the experiment they had some personality changes - they became obsessed with cookbooks and menus, and focused on the scenes in movies where characters ate.

- Scarcity makes you tunnel on what you're lacking, at the cost of more long-term thinking.

- A school next to a loud railroad line showed that students nearest the noise were a full grade level behind those farthest away from the noise. Installing noise dampening pads caught them back up.

- Scarcity reduces your mental bandwidth (which the book defines as some combination of cognitive capacity and executive control)

- They were able to trigger scarcity by asking people to imagine they needed to make a $3000 car repair. After doing this, the lower-income people did significantly worse on a test of cognitive capacity, while the higher-income people didn't see such an effect. (the control was asking people to imagine they needed a $300 car repair, which didn't affect either group) This was even bigger than the effect on people who were forced to pull an all-nighter!

- Scarcity means you have to think of everything in terms of trade-offs - if I buy this $10 cocktail, that's $10 I don't have to buy something else. When you're not suffering from scarcity you don't tend to think that way as much.

- They looked at street vendors in India who have to borrow money at the beginning of the day to buy items to sell, and then pay back the daylong loan at the end of the day with the money they make during the day. This happens every day, and the interest rate they pay is 5% a day, which is of course really really high. So they ran an experiment where they gave a collection of vendors enough money to buy out their debt, so they wouldn't have to borrow every day. They wanted to see if the vendors would be able to not fall into the "scarcity trap" again (having to borrow every day). The result was interesting - the vendors didn't waste the money and were able to stay out of debt for a few months, but then one by one they all fell back into the scarcity trap. The reason was that while the vendors weren't in debt anymore, they had no slack in their budget, and so the first time they had an unexpected expense they would fall back into debt.

Anyway, while the book gets a bit repetitive in its second half, I still enjoyed it a lot and it's definitely worth a read. The biggest takeaway: scarcity is bad, but slack can defeat it!

View all my reviews

0 comments

a few pictures from Houston, Battlehack and Rose-Hulman
Mood: content
Posted on 2013-10-05 16:18:00
Tags: pictures travel
Words: 120

Click for full images!

<- RIP Astrodome

<- The most amazing Buc-ees ever. (in Waller) The first thing I've come across that the Lumia 1020 can't capture all of it's awesomeness :-)

<- I thought "hmm, I actually didn't know waterjets could cause injury!" And then...

<- The waterjets are punching out lines in the metal! It eventually made the shape of an axe. Then I stayed away from the waterjets.

<- The "What would you make?" board at TechShop. (that might not be its official name, but it's kinda catchy, no?)

<- I went to Rose-Hulman for recruiting. The career fair was held on a track!

<- In the Chicago airport, I saw this penguin tie (at the Field Museum gift shop) that I had to get :-)

0 comments

link friday: a bunch of Obamacare stuff, and then some other things
Mood: okay
Posted on 2013-09-27 14:55:00
Tags: politics links
Words: 195

The Affordable Care Act (aka Obamacare) health exchanges open next week (if the government doesn't shut down!), so here are some interesting links about it/them:
- Final Word On Obamacare Coverage: Cheaper Than Expected - definitely some caveats here, but premiums are lower than expected. The free market at work!

- How eight lives would be affected by the health law - interesting look by the Washington Post, although of course this is a tiny sample size.

- The Plot To Kill Obamacare - this just in, Republicans will do almost anything to prevent Obamacare from happening or working.

Other things:
- Free to Be Hungry - it blows my mind that, with the growing inequality we have in the US, some people think that cutting food stamps is a good idea. (food stamps are less than $5 a day per person)

- Here Are the GOP's Debt-Ceiling Demands, and They Are Insane - the title says it all.

Other non-politics things, which you might need after the depressing state of politics these days, or at least I sure do:
- Unhappy Truckers and Other Algorithmic Problems - interesting article about optimizing routes for UPS drivers.

- A Hospital Tells Police Where Fights Happen, And Crime Drops - neat!

0 comments

a few pictures from Rice
Mood: tired
Posted on 2013-09-20 22:51:00
Tags: pictures travel
Words: 44

Click for full images!

<- The Gibbs rec center has these...weird things hanging from the ceiling. I didn't see any explanation, although I didn't look too hard.

<- This amazing store called Rocket Fizz is now in Rice Village! I had to stop in.

<- Rice gets a Texas historical marker!

0 comments

Pictures from Mike and Catherine's wedding
Mood: content
Posted on 2013-09-15 22:14:00
Tags: pictures
Words: 48

Here are a few - see the gallery for the rest!

(click for full picture) <- David and I all dressed up before Mike and Catherine's wedding.

<- People hanging out outside before dinner started.

<- Our table had a giant bouquet of flowers!

<- Jonathan and Sarah tearing up the dance floor!

0 comments

SatRadioGuide now available on Windows Phone!
Mood: happy
Posted on 2013-09-11 21:52:00
Tags: windowsphone
Words: 61

I'm happy to announce SatRadioGuide is now available on Windows Phone! It's an unofficial channel guide for SiriusXM radio channels, and the only SiriusXM app in the Windows Phone store. The app is free with ads, with an in-app purchase available to get rid of the ads. (which is why I wrote this article about how to do ads + in-app purchasing...)



Download from the Windows Phone Store

0 comments

Go earlier/later

This backup was done by LJBackup.