Sep 3 2009

git whereami

Update: I added git branch -a so that you can actually see where you are, and --since='2 months' so if your repo is huge like mine it doesn’t take 2 seconds to run. (The actual value of --since will probably need tweaking for your situation.)

Here’s the awesome git trick of the day:

# in ~/.gitconfig
[alias]
w = !git branch -a && git log --branches --oneline --graph --decorate --simplify-by-decoration --since='2 months ago'


$ git w
* 0bfd287 (refs/remotes/git-svn, refs/heads/foo) commit message
| * 0b5d8d4 (refs/heads/bar) another commit message
|/
| * 575185a (refs/heads/baz) YACM
|/
* b98de6b (refs/remotes/origin/master, refs/remotes/origin/HEAD) YACM
* eadfbbe initial commit message

If you’re lucky enough to have a recent version of git, the --decorate option doesn’t print out the boring refs/{remotes,heads} stuff by default.


Aug 24 2009

Terminal Merge Conflict Resolution

A very important tool in the toolbox of any collaborating developer is a merge conflict resolution tool. OS X has the fantastic FileMerge, there are various graphical tools for linux like kdiff3, but I have yet to hear of one for the terminal. There’s vimdiff, but it is really not up to the task of merge conflict resolution (doesn’t handle 3-way diffs). There’s probably something in emacs, just because there’s always something for emacs. Emacs users please enlighten me, I’m not above using emacs for merge-conflict resolution. Might even be the gateway drug.

It doesn’t seem overly hard (at least, no harder than writing kdiff3 or FileMerge) to make an ncurses tool that will take a 3-way merge and let you efficiently choose A, B, or edit for each diff section. Can it really be that nobody has done it yet?


Jul 22 2009

Turabian

Long ago in the days of yore (1937), Kate Turabian, the dissertation secretary at the University of Chicago, wrote a booklet of guidelines for student writers. Fast forward seventy years, and you get the excellent “A Manual for Writers of Research Papers, Theses, and Dissertations.”

Turabian is still listed as the author. It says “revised by Wayne C. Booth, Gregory G. Colomb, Joseph M. Williams, and the University of Chicago Press editorial staff.” I think that’s a bit ironic, like attributing a Wikipedia page to whoever made the first revision. But I don’t worry myself about who wrote what in this fantastic tome.

The part that Turabian probably wrote, and has probably been heavily edited, revised, and updated since 1937, is the style guide. It’s everything the student writer would need to know about the Chicago Manual of Style, including how to cite internet sources, with a much more reasonable price tag. That right there is a good reason to buy the book.

But for me, the best part of the book was not the style guide, though it will definitely be an important reference as I finish my dissertation, but the writing guide in Part 1 which I understand is new to this edition and is adapted from “The Craft of Research” by Booth, Colomb, and Wililams. I won’t say it answered every question or definitively told me everything I ever need to know about writing a dissertation. But compared to other books and websites on writing a dissertation, it was lucid, concrete, and very helpful. Maybe I’m just a literal kind of guy and needed some concrete steps to follow, even if they’re not perfect steps. But this part of the book helped me finally come to a comfortable structure and tone for my dissertation. I found what I want to say and how I want to say it and how to organize what I want to say largely thanks to following some steps outlined in this writing guide. But it did come from within, they didn’t hand me the answers on a platter. This is good I think, because I think the answers are different for different people and certainly for different disciplines, and also because I would have just ignored it if they had.

The writing section, at least, is slightly geared towards what I’d call the soft sciences (whether or not that’s an accurate term), but not terribly so and not to the point that you can’t make the in-flight adjustments to your hard-science needs.

Excellent book and well worth the $17. But be sure you get the 7th edition. And forget about buying the Chicago Manual of Style ($50+) unless you’re going to be an editor or something.


Jul 22 2009

mp3m4b

I wrote a script to do what Audiobook Maker does without the GUI. i.e., convert a bunch of mp3 files into a monolithic but chapter-enhanced iPod audiobook.

http://github.com/fugalh/mp3m4b

Enjoy!


Jul 15 2009

Encoder mailbox not found

My PVR-150 that I got used from eBay would occasionally spaz out and complain “Encoder mailbox not found” when trying to load the firmware. It happened when I first got it, then didn’t happen for months, then happened again and went away with a reboot, then happened and wouldn’t stop until I switched PCI slots.

Then it worked, for about an hour, and puked with “Encoder firmware dead!” or something like that. Something was dead, anyway. I took this as a sign that it wasn’t a driver or IRQ problem, but a bad card. (Yes, I’m rather thick.) So I got a (supposedly) new card from eBay for just a few more dollars than the original used one cost. It has been working for several days without complaint, so I think it must be a bad card.

But if you want to try your luck with this PVR-150, I’ll be happy to mail it to you. Maybe it was a problem with my VIA motherboard.

And most importantly, for those of you out there searching for “encoder mailbox not found”, it may just be time to get a new card. If not, try switching PCI slots.


Jul 14 2009

sendxmpp in Lenny

sendxmpp in Debian Lenny doesn’t work properly with Pidgin or Adium. I don’t know if it’s a libpurple problem or a sendxmpp problem. sendxmpp can talk to Psi ok. Upgrading sendxmpp to the version in Sid fixes the problem. The difference seems to be that now sendxmpp is sending messages of type “chat” instead of type “message” or “normal” (by default—now you can specify which message type to use). But Psi can send “message” messages to libpurple clients ok, so it doesn’t seem to be quite that simple.


Jul 12 2009

MacVim :recover

When your battery dies while editing a new unsaved file in MacVim, and instead of going to sleep as it should your laptop rudely shuts down, when you boot up and start MacVim again you may begin to panic because it doesn’t do the regular Vim recovery dance.

Fear not, all is not lost. It’s there ready for recovery. Just type :recover.


Jul 6 2009

NUV to ???

Wanted: something that will reliably remux .nuv files generated by MythTV to some sane container. Bonus points if it can use the cutlist (to eliminate commercials).

My own guess was ffmpeg with -acodec copy -vcodec copy, but alas it’s not working. I get sundry errors that don’t make sense to mortals but no doubt stem from the horrific hodgepodge that is the NUV container as implemented by MythTV.


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.