Ben HughesI'm Ben Hughes and I approved this message.

Using Fluid For Convenient Rails Diagnostics

I recently got a Macbook Pro and have been quite impressed with it. I have also been doing a ton of work for BigThink. I’m a tabbed browsing nut, and I discovered that if I ever wanted to get anything done I had to limit my tabs to the point where they all still fit in the bar. This forces me to actually read or act upon the things I have thrown into tabs rather than just letting them simmer.

Working on a large Rails project means that I often find myself needing information from trendy websites like Lighthouse, Hoptoad, and New Relic. That’s three more tabs towards my limit. Every time I closed those tabs to make more room for normal web browsing, something happened that caused me to have to check them again. Then I discovered that Fluid supports tabs and saves the tab session per application.

The trick is to set up the SSB to one site (in my case New Relic) and then on first run open up tabs and go to the other diagnostic services (Hoptoad and Lighthouse for me). The end result is a full diagnostic panel that pops up whenever you click the icon.

Using Rails Across Git Branches Without A Care In The World

I’m working on refactoring a Rails project, but at the same time I’m actively developing the “stable” codebase in another branch on git. Git makes branching so easy and so much fun, that it’s a hard realization that things are just not going to get along once the branches start experimenting with database migrations and other typical rebellions. For a brief period of time, I was manually sql dumping and sourcing on every branch change. Needless to say, I was perpetually pissed off and developed quite the appreciation for My Chemical Romance and other stories of teenage rage.

There had to be a better way. This better way was revealed to me once I noticed that one can place ERB into database.yml. Using this weapon of justice, I went about making it so that the database to which I connected was always the right one for my git branch.

First, databases for each of the branches were created. In this case ‘development_snapshot.sql’ refers to a db dump of my sample data. Your communications with your client of SQL should resemble:

Now it is only a matter of modifying config/database.yaml. The following code should do quite nicely.

And that is why they call it Llanfairpwllgwyngyll.

Kubuntu Intrepid Uselessness

I just don’t understand why Kubuntu 8.10 had to switch to a desktop environment that is just not ready in any way for daily use. KDE4 is almost completely unusable on my machine due to the dual monitors and nvidia video card. Many of the features of KDE4 just feel incomplete. It is very pretty, but pretty does not make up for stability.

Normally this wouldn’t matter, but 8.04.1 causes system death with my wireless card. It all worked so wonderfully over the summer, but now it is broken.

I need my Linux to be a stable platform for development as I have a large amount of work that needs to be done. I’m in the process of reinstalling 8.10 with the intent of switching to XFCE. I don’t actually like XFCE, but I need something that works. If 8.10 does not solve my system freeze problem, then I’m going to have to switch distros. I don’t really have the time for this.

I hate it when this happens.

Why Windows, Why?

Pop Quiz: You are writing an operating system that sometimes needs to restart to install updates. How do you accommodate this?

  1. Place an icon informing the user of the need to reboot on the system tray.
  2. Pop up a dialog giving the user the option to restart now or not.
  3. Do nothing, restart will happen someday.
  4. Pop up a dialog informing the user of an imminent reboot. If there is no answer, reboot in 5 minutes. If the user cancels the reboot, pop up the dialog again in 5 minutes. Repeat until user goes to use the bathroom or get a snack, then go down for reboot while killing all unsaved data with extreme prejudice. Bonus points if this reboot can knock out a carefully arranged workspace full of consoles and Vim windows. Ensure that your desktop environment also provides no session management.

Just when I start finding Windows usable, it goes and sucks harder. The fact that ruby on rails development is a nightmare and a half on Windows further contributes to my foul demeanor. I don’t understand how Windows manages to make Ruby slower — an outcome I considered impossible. I also find Window’s lack of being UNIX disturbing.

That all said, I’m pretty sure Linux won’t work on my laptop anyway, and it certainly wouldn’t work particularly well (being a tablet and all). I wish things had worked out in a less complex way that would have involved me being able to buy a MacBook (but that is another story entirely).

VMWare also boots incredibly slowly on my laptop. My laptop is a 2.5ghz Intel Core 2 Duo with 4gb of RAM, so I can only assume that the 10 minutes of near lockup that occurs every time I press the VM power on button is related to Windows in some way. If I can get VMWare running well, then I will be back in business.

Fog Creek Interview

Last week I was flown up to New York City by Fog Creek Software for an interview for a summer internship. The whole trip was amazing. Fog Creek took great care of me, I like the city, and I got to see one of my cousins while I was there. The actual interviews were grueling, and I didn’t get the job, but I still have nothing but the warmest feelings about Fog Creek as a company.

This all started about three weeks ago when I sent in my cover letter and resume. I saw Fog Creek as pretty much the ultimate long shot internship (read about the intern perks and the reasons will become clear), so I basically expected to be condescendingly dismissed for even attempting to apply to such an elite position. Within a few days, I had a response asking for a phone screen. The next Monday I was on the phone with a developer being brutalized over data structures and the like.

The phone screen was a rather grueling hour. I walked around in a daze for the rest of the day. I felt like I did somewhat acceptably, but figured that this was where my adventure ended. I was just honored to have gotten that far. I woke up the next day to an email inviting me to interview in person at their Lower Manhattan office. After much celebration (including a few misguided attempts at dance), I rushed to Barnes and Noble to pick up a copy of K&R C to study for the interview.

My schedule is fairly complex due to the general expectation that I attend class and don’t fail exams, but I had a surprising free spot in my schedule after my Sanskrit midterm last Monday afternoon. A week after my phone screen, I was on a small airplane from Charlottesville Airport (CHO) to LaGuardia (LGA).

Charlottesville Airport really is a nice airport. The view into the mountains is wonderful. It is a clean, modern, convenient facility. My biggest complaint with it is that I scheduled a lot of extra time for dealing with the usual crap of modern air travel, so I had a huge amount of time to just sit around after I picked up a boarding pass and cleared security in under ten minutes. The fall is a quite nice time to fly from the mountains and over the East Coast.

I arrived in New York and found a limo waiting for me. I felt pretty pimp. I arrived at the hotel and checked into my beautiful suite with no incident, though I did fear that the jig was up when I was asked my age (18, which is less than 21 which is probably what hotels say they require). I then headed out to Greenwich Village to meet up with my cousin.

The next day I got up early, cleaned up, and hit the town. My interview was not until 10:00, so I took the opportunity to explore the financial district. Fog Creek’s new office is a block or two away from Wall Street. I slicked back my hair, put on suspenders, and started my corporate raiding because greed, for lack of a better word, is good. After those shenanigans, I headed up to the 25th floor of 55 Broadway to get interviewed.

They really have a nice set up with a great view. I met with two people in the office and one guy for lunch. The first interview was on data structures. It took a little while for me to get my brain in gear and I was too slow starting off. I gradually improved as I got into the right mode for it, but I wasn’t exceptional at it. A lot of this was my general inexperience with data structures and a lot of it was my nerves. I know the fundamentals of data structures, but I just don’t practice with them too much. I get a little lazy and generally hide behind my abstractions. Going forward, I will definitely work on my DS chops as that seems to be a good investment.

The second interview was on pointers and recursion. One section of it involved de-obfuscating a bit of C code. Generally I’m pretty good with pointer arithmetic and foolishness, but I was way off that day. I think I just got overwhelmed initially and tried to depend on idioms that I only half remembered rather than actual thought. I stumbled through it and mixed up silly things, but I was eventually prodded to recovery. It was completely embarassing. I beasted the recursion though, so that was decent.

For lunch, we went to a nice Italian place, and I had a nice conversation with a member of the Smalltalk cult. I quite fancy Smalltalk myself, but I have not really walked the walk. This conversation convinced me to give GNU Smalltalk a shot. It was actually a really fun lunch.

After lunch, we went back to the office and I was told that I was done and could go on my merry way. I pretty much knew that I was still on the job market at this point, but I was only a little bummed. I walked back to my hotel room and watched some daily show and family guy. Then I hit the streets and just walked around soaking it all in. I managed to, through Brownian motion, make my way from just south of TriBeCa to somewhere in Greenwich Village. I wandered for a while looking at things. At some point my cousin called and I happened to be a few blocks away from his apartment, which was an odd bit of chance. One of my cousin’s roommates is an entrepreneur and founder of BigThink, which is pretty cool.

The next morning, I got into a limo headed to the airport and prepared for life back in Charlottesville. A few days later I got the email from Fog Creek telling me that I didn’t get the gig, but I was neither surprised nor disappointed. It was a pretty amazing couple of days and a great trip regardless. I do hope to find a cool internship this summer, but I am not dreadfully worried about it (yet).

Sanskrit Test

I just want to test whether Devanagari is possible for this system. I expect encoding hell.

अहं रेमै स्निह्यामि

UPDATE: It seems to have worked. Sweet.

Git For Story Telling

For programming, blog post tutorial series are very common and helpful. Having kindly individuals document the design and construction of systems using neat technology is exceedingly valuable for the programming community. The most thorough and handy one that I have found in the last few days has been the SpawnLink Introduction to Erlang’s Open Telecom Platform. Erlang is a major interest of mine, and I have been trying to learn OTP off and on for a while. Previous blog tutorials have taught me everything from Rails tricks to the concepts of neural networks.

I started playing with the otp branch on my erlang_ann (Artificial Neural Network) with the intent of learning by doing and possibly also writing up my experiences into a tutorial. Then I started thinking about whether git itself could be used for making the guides. It seems like appropriately fine grained commits with detailed commit messages could serve as an interested medium for telling stories about code. The power of this approach is that the instructions and rationale are written as the code evolves, with the commentary always corresponding to a full tree of code. This would allow easier experimentation at all steps through the tutorial. I don’t know how well this will work, but I’m trying it out on erlang_ann.

Now the only issue that remains is my chronic lack of overlap between time and energy.

Politics

The upcoming election should be pretty interesting. I’m just not quite sure how it will end. At various points in this year, I felt certain that the election had been decided one way or another, but it has stayed dynamic. It promises to hold a few more surprises, in any case.

I have mixed feelings about this election. I, being an internet geek, supported Ron Paul in the primaries. I’m pretty moderate, with the tendency to come off as flamboyantly libertarian. Neither of the candidates truly grab me, but McCain-Palin has been scaring me greatly as of late. I’m pessimistic about the prospects for real, positive change under Barack Obama, and I definitely have my qualms about his various social programs. Overall, his charisma and his openness to diplomacy and hearing outside opinions are what lean me in his general direction. I feel that he has the chops to be a perfectly fine president. At the very least, I doubt he would be catastrophic.

My support for Obama might be relatively unenthusiastic, but my opposition to McCain-Palin is vehement. I view McCain as basically a chump who would represent a lighter, friendlier third term for Bush. He is undoubtedly better than our boy George, but he isn’t actually good. There might have been a time when he actually was a maverick, but those days are long gone now (2-4 years I would say). Sarah Palin on the other hand is a living embodiment of all my worst dreams. She represents nearly everything that I don’t want at any political position above editor of a high school newspaper. Suffice it to say that I get all kinds of warm fuzzies from having leaders who put at least a couple million years between us and the dinosaurs.

In the state election, my ticket becomes more split. For the 5th district House race, I am a strong supporter of Virgil Goode. I disagree with him on many issues, but I feel that he has a good grasp on what’s good for the district. His stances on economic issues also bring a smile to my face. I wish more Representatives would agree with his fiscal restraint. For the Virginia senate race, I am voting for Mark Warner. He is a fantastic politician, and I wish I there were more Radical Centrists that I could give my support.

This election promises to be close and probably critical. I was on the fence for a long time about the president, but given the alternative, I believe that Obama deserves the full force of our support. Hopefully, everything will turn out for the best

New New-Blog

After setting up my blog with hobix installed on my Dreamhost account yesterday, I realized that I wasn’t dreadfully fond of that situation either. Ideally I should be able to write content in the most convenient manner possible and have it somehow get to the interwebs. I’m much happier using my local install of Vi and having full control of all the libs that bake my blog into a delicious website ready for dissemination. I am also happy when my data can survive me randomly overwriting critical things.

Given these general desires, I set out to modify hobix to run on my laptop and then, using git and github, get the compiled website to my webserver. Hobix seemed to operate in a very simple manner than would make it easy to modify, so I forked it on github and got to work. I quickly added in a hook and configuration option to commit and push to the remote repo specified by blahg. I then hooked that up to a repo on github. When changes are pushed to github, a post-receive message is sent to a PHP file on my webserver that then performs a git pull. All the plumbing is working now.

While I was hacking this together, I ran into some issues that required going deeper into the code of Hobix. I ended up completely deleting the lockfile capabilities and also changing some of the path handling code that screwed up the templates when generated on Windows. While I was going through this, I realized just how much code was there. It seems to be an extremely fully featured and complicated piece of blogging software. I’m not entirely sure how I feel about that. I’m getting somewhat burnt out on blog features. I kind of feel that I should be able to compile my blog using make like god intended. If I get some more free time, I will probably end up trying my hand at a Rake based blog build system.

I really like my current setup and I think Hobix is quite the tool. I will continue using Hobix while I think of ways that might make me happier about my blog system.

New Blog

Typo angered me for the final time by not working for the last month. I am now trying this Hobix tomfoolery. I will be gradually migrating old postings over to my new blag.