I’m working on an application that needs to be able to read a date from a string. Obviously there are countless libraries that will do this for me, so I essentially renamed the long datetime.datetime.strptime(string, “%m/%d/%Y”) to a shorter name.
I had initially assumed everything would be in mm/dd/yyyy format, but occasionally I would notice people leaving off the first two digits of the year. So I altered my wrapper method to deal with that, and things were working well. Then I noticed that sometimes people left off an initial 0 in front of a month, like 6/31/2008 vs. 06/31/2008. So I altered it again to deal with that.
But I was still having trouble parsing certain dates, and I couldn’t figure out why. Specifically, “6/31/08” wouldn’t work. At first I thought it was because it was both missing a leading 0 and two digits of the year, but after a while I realized that it wasn’t formatting because June has only 30 days, not 31.
Kind of annoying, but I guess it’s a good thing.
Crazy Link Of The Day: Fibonacci Edition -
Let F(n) be the nth Fibonacci number - that is, F(1) = 1, F(2) = 1, F(3) = 2, F(4) = 3, etc.
Then (in pseudo-latex notation)
sum_n F(n) / 10^{n+1} =
0.01 +
0.001 +
0.0002 +
0.00003 +
0.000005 +
0.0000008 +
0.00000013 +
...
is equal to 1/89.
The shortest path between two points is apparently a mess.
To be fair, Google Maps doesn’t know about the monorail, and this image with the map overlay loaded and zoomed in looks a lot better.
The Picture: A single slice of bread
The Caption: PSEUDO MAKE ME A SANDWICH
I apologize for making that last post a chat instead of just plain text, but I had already explained it to a few people and didn’t feel like retyping it all. And all of that actually happened, I promise.
Oh, also check out my new blog, Google Food. It’s my attempt to document every lunch and dinner that I eat at Google. Hopefully I’ll remember to take pictures in the future.