Jun 16 2009

Why I chose Facebook over Google

May was a busy month, and not in a “fast-track-to-finish-dissertation” kind of way. I zoomed to Florida for a family reunion, then zoomed across the country to San Fransisco for an interview at Facebook, then the next week zoomed over to NYC for an interview at Google in their Manhattan office. Then, lest the last week in May should feel left out, I zoomed up to Utah for an interview with AST. As May drew to a close and June entered the scene, I found myself with four offers of employment, including Google and Facebook (Boeing just did a phone interview). Wow! I was feeling pretty pleased with myself.

Now dear casual reader from yonder internet, I know what you’re thinking. It’s exactly what I would have thought a few months ago. “No-brainer. Work for Google.” But I found myself perplexingly unable to decide between Google and Facebook. It didn’t help that Google was in New York and my wife wasn’t keen on New York, and that the Google position offered was a Site Reliability Engineer (SRE) which is, to grossly oversimplify, a glorified systems programmer. Not faced with an attractive competing offer like the one from Facebook, I’d have been headed to Manhattan to be an SRE in a heartbeat. But as it was I was torn.

I applied for the Facebook position on a whim. I had been on Facebook only a month or two and I noticed an ad on the side about how they were hiring. I clicked on it, looked at their careers page for awhile, liked what I saw, and decided to apply for a Machine Learning Engineer position. I came home and told my wife, who was instantly convinced I had lost my marbles. She is not a programmer, so how could she know that although I’m not a big social network guy and had only grudgingly signed up for Facebook a month or two before, I could be intensely interested in working on such a site.

Theoretically speaking, I love networks, and that includes graph theory, computer networks, and yes even social networks. I knew Facebook problems would be about networks and about scale. They would be hard problems. They would be fun problems. The perks page looked good, and I think it would be fun to be in Silicon Valley. So I applied.

Facebook called and had me do one of their pre-screening programming puzzles (you can enjoy them even if you’re not being considered for employment). I got a little obsessed and did 3 over the better part of a week. Then there was a phone screen, and then the invitation to interview on-site (This all happened over several weeks time, of course, and more or less in parallel with a similar process for Google, except that Google didn’t have a puzzle step).

I’ll skip to the end, lest I bore you. Facebook continually impressed me the more I interacted with them and the more I saw. I was similarily surprised at how enjoyable, useful, and private Facebook was as a user since I had signed up. Facebook skyrocketed from just another one of those pesky social networking sites to a daily habit and potential employer in a few short months.

Still, it can’t compare to Google right? Well, actually they try very hard to compare to Google. It’s quite obvious that most of the perks and benefits are directly inspired by Google’s, compensation was comparable, and I found that they have smart people working on hard problems just like Google. In addition, there are two things they have that Google doesn’t anymore: they’re still small and they’re pre-IPO. Of course, Google has more smart people and Facebook is more-or-less a one-trick pony. Publishing would probably be easier at Google. Here I go again… I was back and forth for a solid week. It drove me and my wife crazy. I talked to people at Facebook who had been at Google (at my request). I talked to people at Google. I talked to friends and family. I tried every decision making trick in the book. Both sides sweetened the deal a bit to make it easier for me to choose them (Google switched the offer to be in Mountain View as a Software Engineer, Facebook offered a bit more money). I just couldn’t make up my mind.

Well finally I did, and this is what it came down to: time off, impact, and stock.

Although both were generous with paid time off (PTO) compared to most US companies, Facebook offered more, especially in the area of paternity leave (my wife is expecting). As much as I anticipate enjoying either job, I enjoy being at home or on vacation with my family more.

Facebook is small—they’re hiring like crazy because they’re smaller than they want to be. Because of that, I feel that my wacky background in system administration, agileish pragmatic open-source programming, and high-brow CS theory and research would be more broadly brought to bear than in some team at Google responsible for some small part of one of the many wonderful Google products. I would have more impact—not on the world at large but on the thing that we are doing. Then there’s also the draw of quick seniority in a small and fast-growing company.

Finally, although both companies offered restricted stock units to vest over 4 years, Facebook’s offering has the potential to be worth several times what Google’s offering would. Or, Facebook’s offering could be worth about what Google’s would be. Or, in a really really bad scenario, worth less. I ran the numbers, pulled some probabilities out of the air, and decided at least as good as Google and possibly much better was the most likely scenario. Since they’re RSUs and not options, the only risk is in making less extra cash than I would have made at the other company. Google was the safer choice, Facebook the more potentially lucrative. I tried to leave this out of the decision making process as much as possible, because I didn’t want my decision to be about money. I wanted it to be about the work. But I have to admit there’s a draw here.

I believe more strongly now than I did before that Google is a fantastic place to work, and I would reapply there in a heartbeat down the road if my path takes me there. I wish I could just be in two places at once and work at both, at least long enough to know for sure where I really want to be. But life doesn’t work that way. I’ve decided to take the path that seems the most exciting and unsure out of a sheer sense of adventure. Google will be there in a few years if I want to reapply, and they may even want me then as they do now. The time to really make a difference at Facebook is now, while they’re small.

You may think I’m crazy to turn down Google. I think that sometimes too. One thing is certain: the next few years will be an amazing adventure that I never dared dream would come to me. Thanks to everyone who has helped me to this point in my life, especially my loving and supportive wife and kids, my parents who taught me to love learning, and my brothers who “let” me hog the computer when we were young (ha!).

Well, I think I have a dissertation lying around here that needs finishing.


Jun 16 2009

Firefox book-like bookmarks

Can anyone point me to a trick or extension that makes bookmarks more like, um, bookmarks? You know, in the real world, when you’re reading a book and you decide to stop reading so you can go get a drink of water or go to bed or something, you put in a bookmark. That bookmark is only good until the next time you read—then you’ll put the bookmark in a different place. Web “bookmarks” are more like gluing tongue depressors to the book to help you find the book later.

Use case: you’re reading a web comic, or an online book, or some other serial content that takes days or months to go through. You want a very simple way to update the bookmark whenever you stop. Ideally, it would be automatic.


Apr 24 2009

Crunch Time

I’ve been writing my dissertation in earnest for a couple of months now, for some definition of in earnest. As expected, things have come up to slow the process down—research that after closer scrutiny needed refinement, job hunting, sickness (my family and then I got the flu), presenting at a conference (remotely), some procrastination and writer’s block, and a general inability to write faster than is humanly possible. Just in case you were wondering, the rule of thumb to multiply coding estimates by 3 applies to writing as well.

That said, I’m still on track to graduate in August and making good progress. But because I don’t want that to change, and because I don’t know how the next few months will pan out with the job hunt and potential on-site interviews, I am going into super crunch mode. It’s like when they tried to make Knight Rider more exciting by modifying the car by adding extra drag so it would go faster. But not as glamorous.

This means that during the day when I should be working I won’t be haunting the usual haunts: IRC, Instant Messenger, email. I will of course check my email at least a few times a day, but when I’m writing my MUA will be closed. I will keep at least Jabber (Google Talk) online, set as away, as I have done previously. All this is not because I want to hide from you but because I want to minimize the event-based distraction mode I sometimes find myself in—constantly jumping between IRC, IM, email, social networks, RSS, etc. looking for the next communication task. If you do need to contact me urgently don’t hesitate to hit me up where you find me, or in the worst case talk to Erin, who will know how to get ahold of me.

While I’m on the subject, I’ll bore you with the methodology I’m employing in the never-ending battle against procrastination. First and most importantly, I have a goal to write 15 minutes every day, as a bare minimum. Even on otherwise-unproductive days (whatever the reason) I can squeeze in 15 minutes which means at least a little progress. More importantly, it means my mind keeps engaged on the problem and my dissertation doesn’t get swapped out. I’ve been doing this since January and it has made a huge difference in my productivity. I highly recommend it to anyone. For more information, check out the workshop homepage, read the summary, or grab the book. Or just write 15 minutes a day and let your success speak for itself.

15 minutes a day is great, but when you’re writing a dissertation and nothing else, it’s not sufficient. So I’ve had to kick it up a notch. Eddie Jung has some good advice: “Don’t get distracted. Keep starting. That’s all.” We’ve already talked about the public face of my efforts to not get distracted. I also have a plan for doing the “keep starting” part, which is I think the hardest part. Once I’m started and in the zone, you could be screaming my name in IRC or calling me on the phone and I won’t even notice let alone be distracted. So I think it boils down to “Keep starting. That is all.”

So how does one keep starting something that is frequently uninviting? “Just do it,” I can hear you say. That’s easy for a construction worker or someone doing something physical, but it’s hard for those of us who work with our brains, especially creative work. Because the very instrument we are trying to bring to bear is the instrument that is so easily distracted.

I like the metaphor of a train getting started. It’s big, it’s heavy, and at first the wheels spin and things move very slowly. Some glorious days, I wake up already rolling down the tracks. Maybe I went to sleep at the top of a hill, I don’t know, but I’m off and running before I’ve finished rubbing my eyes and the day is an outstanding success. Other days I sit down and keep trying to start without ever starting.

My plan to keep starting is to set up a ritual. A personal algorithm, if you will, for beginning to write. Just as the dog turns around three times before lying down to sleep. It has to be something that I can consciously do to trigger myself to begin writing. It has to be a trigger, and facilitate writing. It has to be portable—I have to be able to do it on my couch, in my “office” (the rocking chair in the kid’s room), at school in my real office, in the library (sometimes when I’m having a hard time focusing going to the library for a change of scenery helps), a café (ditto, but close to home), or just about anywhere. It has to be quick, like turning around three times and not like doing 30 minutes of yoga and upside-down meditation or something.

I have no idea if it will work, but here’s what I came up with: prep, timer, visualize. By prep I mean close my email client, IRC, etc., get situated, and get my water bottle filled if necessary. Minimize distractions and optimize the environment. By timer I mean grab my timer and set it for 15 minutes or whatever minumum chunk of time I feel up to. When the timer goes off, I can take a short break if I need to. It’s my sanity escape hatch—you can do anything for 15 minutes, even write. It’s also my distraction safety net—if the timer goes off and I am not writing, I got distracted and it’s time to start over. The visualization step is to close my eyes and engage my brain on the task, and not open my eyes until I have an action to perform. With my eyes closed, none of my distractions can reach me even if they made it through the cracks.

I have high hopes for my new plan. I know some parts work already, and I’m optimistic about the rest. I think it’s simple enough to actually work. Maybe my sharing it with you will inspire you to refine your process a little bit.

How do you avoid distractions and keep starting?


Apr 21 2009

HeadBlade

Reports of me regrowing my hair have been greatly exaggerated. Fact is, I went about a week or maybe two and decided I really like being bald, and haven’t looked back since.

Not long after I really got the hang of using the HeadBlade, and shaving every day if I so choose isn’t a big deal. I sometimes skip a day or even two, but usually I shave every day.

If you’re getting started with the HeadBlade, or thinking about it, here’s some tips.

First, prep is important. I get my head wet with hot water when I first step into the shower, and keep it wet with an occasional splash while I do the whole washing thing. Then I lather up some shaving soap (rubbing it right on my pate) until it’s good and slick.

Using the HeadBlade is basically like they say in HeadBlade 101. I would just mention that if you have been shaving your face with a safety razor or a straight razor, “no pressure” is actually an overstatement. You need some pressure on the front—just enough to keep contact with the skin, no more—otherwise you don’t shave anything. Compared to how most guys shave, this really does feel like “no pressure.” If at any time you get razor burn or uncomfortable chafing, you probably used too much pressure. If you go over and over your head and nothing happens, you used too little.

The real key to the HeadBlade is not using the blades they sell for it. Because of the way the HeadBlade works, which is very similar to properly using a safety razor (it’s all about angle), the more blades you have the worse shave you get. Your head is bumpy, and to fit the curves you need a VW bug not a Cadillac. More blades will just make the shave rougher and less close. It’s also important to steer clear of those rubber things they put on most fancy cartridge blades because they act like brakes forcing you to use more pressure on the front.

They don’t make cartridges with just one blade, that I have been able to find, so you’ll have to use two blades. Fortunately the ones that work best are also the cheapest. There are two options: the Atra blades and the Sensor blades (not Sensor Excel). The Atra are cheaper (especially the knock-offs, like the Personna, which works fabulously) but they tend to clog easier (the back isn’t open) and the blades don’t flex like the Sensor blades do. But they work much better than the fancy rubber bumper triple blade cartridges. I’ve had good luck with the Sensor blades but my sensor adaptor broke and I have to order a new one, and the Personna Atra-compatible blades are so cheap I had to see how they worked. They give me an excellent close shave with little effort, just like the Sensor blades, and they’re cheaper.

So if you found the HeadBlade lacking, try another blade. Any Atra or Sensor compatible blade works (with the adaptors included in the HeadBlade package), and if you have a favorite for your face try it in the HeadBlade, but do try one with only 2 blades and no rubber bumper because I think you’ll be amazed.


Apr 10 2009

Kill your Kids

Not literally, of course. This is programming talk, those of you who aren’t programmers can let your eyes glaze over.

I wanted a script to start a bunch of little servers, then wait around for them to finish or when the user interrupts with Ctrl-C, clean up the servers instead of orphaning them. I wanted to propagate the SIGINT to the child processes. I wanted to kill the kids.

The simple way, if you just want to make sure the kids are killed and you don’t care how:

sleep 300 &
# etc.
trap "kill $(echo $(jobs -p)) 2>/dev/null" EXIT
wait

If you only want to trap SIGINT and want to make sure you send SIGINT (not SIGKILL) to the children, then you want to do something like:

trap "kill -INT $(echo $(jobs -p)) 2>/dev/null" INT
wait

Update: I was asked by a shell scripting guru why I needed to do $(echo $(jobs -p)) and not just $(jobs -p). I intended to cover that but forgot. The reason is that $(jobs -p) has newlines and while that’s not usually a problem it is in a trap statement, because it’s evaluated at creation time not at run time. It also means that processes created after you create the trap wouldn’t be killed. Then, he suggested a function instead. Pure brilliance. Where does he come up with these things? Here’s the improved version:

function killkids() { kill $(jobs -p); }
trap "killkids" EXIT

You can still redirect stderr if you want to, but the reason I was directing stderr was because some of the kids may have already died (early evaluation remember) and then kill would needlessly complain. This way, it kills all the kids that are still alive, none more none less.


Apr 2 2009

DFT Magnitude/Power Spectra

I often get confused about the scaling of magnitude and power spectra. I think I’ve worked it out so I’m puttin it here for my own benefit, and maybe the benefit of someone on the internet. If I’m wrong, please tell me.

Let’s take a unit-amplitude sinusoid at 100 Hz, and do a Fourier transform. If we look at the amplitude we’d get two components at 100 Hz and -100 Hz, each with amplitude 1/2. Something like this.

Now, if we do the same with a DFT we will get basically the same thing, except we’ll see the effects of discretization of course. But depending on which variation of the DFT you’re using, the magnitude of the components will be either about 1/2 or about N/2. The difference is, of course, the 1/N factor that you included or left out. In the case of the fft function in Octave (and I assume MATLAB), it’s without the 1/N factor.
max(abs(fft(x,1024)))
ans = 443.23

The power spectrum is the magnitude spectrum squared. abs(fft(x)).^2 or (abs(fft(x))/N).^2. Why would you want to square it? Well there are of course many reasons but the nature of audio signals makes most of the ones I know about moot. Furthermore the relative shape of the power spectrum and the magnitude spectrum is the same.

Try this. Take an audio signal (something more interesting than a single sinusoid) and plot the magnitude spectrum in dB, then plot the power spectrum also in dB, e.g.
plot(20*log10(abs(fft(x))))
figure
plot(20*log10(abs(fft(x)).^2))

They have a different scale, but they have the same shape. If you were doing something like peak-picking, it wouldn’t matter which you used if you’re working in dB.


Mar 22 2009

An English Muffin Investigation

Recipe writers of the world, pay attention! This is an English Muffin (Thomas brand):
TopBottomSideCrumb

See those big holes? (”Nooks and crannies”) See how they’re not just holes, they’re big holes? It ain’t an English Muffin unless it has those big holes. I’ve tried a few recipes and passed on others that look like more of the same. I get results that range from “thick pancakes” to “bread”. Some had a few itty bitty bubbles. None were anywhere close to the real thing. This photo is typical of the results I’ve gotten (the ones that ended up edible in the first place). The ones on the left are real, the ones on the thick sweet pancake things I made.

Side-by-side

Now, I’m going to do something unheard of right here on this very blog. I’m going to apply science! We’re going to figure out what a successful recipe would have to look like. In part two, I will share with you the recipe that actually works.

Look at those pictures again. I want to point out a few important features. First, the bottom of the muffin is flatter than the top, and evenly brown. Also, it’s coated with farina. Second, the top is uneven but also browned. Third, the muffin is not perfectly round, and the sides are not neatly vertical. Finally, there’s some creases on the side that almost look like folding.

Here’s what these clues tell me. The imperfect circle and sloping sides rule out a batter baked in a ring. Sorry, AB. The flat bottom and browned but not flat top tells us they’re cooked on a griddle not baked in an oven—this is one thing most recipes get right. (Actually, this article about Thomas’ oven alludes to a brick oven—perhaps they were cooked in a brick oven and flipped. That wouldn’t be entirely unlike cooking on a griddle but it could have implications. Something to keep in mind.)

The fact that they are good circles and the bottom is so neatly flat, and not too tall, tells me the dough is quite slack. Maybe even a thick batter. But the farina coating I think is a telling sign. I bet they proof the dough and the farina makes it easy to get the muffin onto the griddle without collapsing it (similar to what you do to keep pizza from sticking to the peel). Of course the biggest hint for a slack dough is the big holes. You don’t get holes like that from a stiff dough, and probably not easily from a batter. Holes in a batter, e.g. introduced by baking powder, give you pancake-like texture. These holes are more like artisan bread holes. These are holes you get from gluten structure and yeast. Another good hint is this quote from the Thomas FAQ:

What is on the bottom of our Thomas’ English Muffins?
The small white particles on the bottom of THOMAS’® English Muffins are farina. This is used to prevent the doughball from sticking to the oven plate and also to give the product its unique taste.

The creases are probably from when they’re flipped. The uneven texture means the top wasn’t liquid, but the creases mean it wasn’t quite cooked through when turned.

Finally let’s consider taste. (You’ll have to take my word for it, I can’t take pictures of taste.) They taste more or less like bread. Not a sweet bread, not a rich bread, not a sour bread. Just bread. They’re a little chewy but not like a bagel. Although they’re not sour, there are some subtle sour notes especially when toasted. This isn’t surprising if you look at the ingredients list:

INGREDIENTS: UNBLEACHED ENRICHED WHEAT FLOUR [...], WATER, FARINA, YEAST, SUGAR, SALT, SOYBEAN OIL, PRESERVATIVES (…), GRAIN VINEGAR, MONOGLYCERIDES, NONFAT MILK, SOY FLOUR, WHEY.

So we have a little vinegar for sourness, but it’s not much. Nor do we have much sugar or oil or even milk. Mostly just flour and water. Remember the ingredients list is in order of quantity, and salt is on the order of 2% of the flour quantity, and the only farina is what you find on the bottom of the muffin.

The nutritional information indicates not very much fat (1g per muffin), nor sugar (1g per muffin). The milk is probably there simply for its help in giving a nice golden brown color, and the little bit of sugar to encourage the yeast.

That said, as long as they’re not a sweet or rich bread I’m not concerned about the taste. It’s the texture that matters. I think sourdough English Muffins would be superb.

So there you have it. My disclaimer is that I haven’t yet made a decent English Muffin, only bad ones. Some people seem to be very happy with the recipes I’ve tried, even claiming they have nooks and crannies. I don’t know if their standards for bubble size are lower, or if I just fail. What do you think?


Mar 13 2009

Beauty in Nature

I was walking home yesterday and walked past a girls soccer team practicing. The coach blew his whistle and they all started running around the circumference of the field. Naturally this brought up unpleasant memories of doing the same thing in basketball practice. But then I noticed something I hadn’t noticed in basketball practice. I wish I had my camera with me.

As they ran, they began to strew out—that annoying short girl with boundless energy in front, a pack of normal girls in the middle, and the tall and/or not-very-fit girls in the back (you can guess where I usually fell). What struck me is that even with a sample size of only about 15 girls, it was almost immediately very obviously a normal distribution. As they continued running, they got more strewn out, but the bell curve remained essentially intact. (It got a little bimodal for a bit, but give them a break—they’re only middle school girls.)

Is it sad that I think beauty in nature is noticing statistical truths everywhere?


Mar 13 2009

Parens

I’m a little let down this morning. I learned somewhere in college (probably from a classmate) that the singular of parentheses was paren. Certainly a lot easier to say, anyway. But when I looked it up in the dictionary this morning…

pa·ren·the·sis |pəˈrɛnθɪsɪs|
noun ( pl. -ses |-siːz|)

  • (usu. parentheses) one or both of a pair of marks ( ) used to include such a word, clause, or sentence.

The singular is parenthesis, and it all but condones using the plural for a single mark. But all is not lost!

paren |pəˈrɛn|
noun (usu. parens) Printing
a parenthesis.

ORIGIN early 20th cent.: abbreviation of parenthesis.

I don’t know about you, but I’m sick and tired of saying parentheses (we say that a lot in programming). I propose that we usher in the shift from parentheses to parens. In programming, at least, let’s use the word paren for singular and parens for plural. Will you join me?

P.S. The British tend to call parens “brackets,” which is short for “round brackets.” I was teaching a class on C and had a British student, and I had her totally confused because to me “brackets” meant square brackets. When I said brackets (meaning square brackets) she thought parens. When she said brackets (meaning round brackets by default) I thought square brackets. When I said braces I meant curly braces (what other kind are there on the keyboard?), but to her braces was a synonym for brackets…


Mar 12 2009

Microwave Duty Cycle

As you may know, when you change the power setting on most microwaves, it doesn’t change the power output of the magnetron. It changes the duty cycle, i.e. when the magnetron is on and when it is off.

In a bout of curiousity I sat down with my microwave today and figured out exactly what those duty cycles are (you can hear when the magnetron switches on and off). My microwave apparently has a cycle period of 32 seconds. High is power level 100 and the magnetron is on all the time. Power level 50 is on 18 seconds and off 14 seconds. Power level 40 is on 16 and off 16 (which I would have guessed would be the case for power level 50). Power level 10 (the lowest setting) is on for 6 seconds and off for 26 seconds. Here’s a graph with all 10 settings:

Microwave Duty Cycle

As you can see it’s more or less linear, which is nice because it makes mental visualization easy.

Now you know.