New Car Posted on 2010-04-07 - Comment

It was the Friday before my Spring Break and quite possibly the worst thing in the world happened to me: I got rear-ended while at a stop. Well, okay, it's not the worst thing in the world but to a college student who loves his car, it was pretty bad. The lady who hit me did quite a number on my back end, and then pushed me into the car in front of me. Despite my airbags not going off, my car was totaled. The damage to the bumper, right rear quarter panel, and unibody frame were just too much.

Damage to the Jetta

With the Jetta totaled I had three options: Buy it back and spend the $1000 left over on repairs/hookers, give it away to the insurance company and spend <$2400 on a beater from Craigslist, or do the financially irresponsible thing and buy the new car I've been dreaming of, going into debt even further than I already was.

Guess which option I chose:

2010 VW GTI

Yes, that's right. I bought myself a new MkVI GTI. Since I had some money saved up from my recent internship, will be starting work in a couple of months, and was planning on buying one within a year I decided to go for it. I ended up paying $22,500 for it, which is a few hundred below dealer invoice for the options that I wanted on it. I won't go into any car buying tips here, I'll save that for another post.

Overall, I'm very pleased with my purchase. Here's why:

Performance: It's got the VW 2.0L TSI turbocharged engine in it which puts out 200 hp. That's only a little more than my old VR6 Jetta, but the lighter engine makes a difference. I'm still breaking the engine in, but from what I can tell from accidentally giving too much gas, it can put down some power.

Handling: With the sport-tuned suspension, this thing handles like a beast. With simply taking corners quickly and turning smoothly, I have yet to break the tires loose from the road. There's also a roundabout here in Rolla which I took at speeds that I'm not at liberty to discuss publicly since I'm sure that the city police would frown upon that.

The car also has a pseudo-locking differential called XDS. This is part of the electronic stability control system. What XDS does is when it senses that one wheel is getting too much power compared to the other, it applies the brakes to that first wheel to slow it down, giving more power to the second wheel. I haven't noticed this kick in yet, but probably because I'm not giving it full throttle due to the break-in period

Electronics: Included standard on the car is a touchscreen radio with Volkswagen's MDI interface. The MDI interface provides a port in the arm rest where different devices can be plugged in, such as an iPod or USB drive. With the addition of an SD card slot right in the radio, with support up to 32 GB, I no longer need a car computer. The software can be a little flaky at times and could use certain features (like creating an on-the-go playlist), but it suits my needs fine.

Also included is the MFI, which is essentially a trip computer. It tells you trip time, distance, fuel consumption, range left on the tank of gas, etc. The cool part about this is that in the settings menu, you can adjust some convenience settings which normally could only be done using a VAG-COM, such as which doors unlock when you use the keyfob, rolling windows down with the key, etc.

Practicality: The folks on Top Gear always talk about the practicality of a car whenever they review something the average person could buy. Since I'm not going through a mid-life crisis, something practical is what I need. The GTI fits this bill nicely.

There's plenty of room for passengers in the back (a change VW made starting with the MkV) along with all of the creature comforts you would expect from sitting in the front. There's also a good amount of space in the hatch area, and the back seats fold down in case I need to haul anything big. I was able to fit a whole recliner in the back with room to spare, for example.

All in all, I really love this car. It's quick, fun to drive, can get good gas mileage, and it's still useful for when I need it.

Unicode in Django, It'll Getcha Posted on 2010-02-11 - Comment

I've been having an insane time trying to squash a weird unicode bug in Beertraq. This was one of the first bugs that was found after starting the beta and it's taken me this long to get it worked out. It all started with a cryptic-seeming error upon viewing the add-a-beer page:

UnicodeEncodeError: 'ascii' codec can't encode characters in position 0-9: ordinal not in range(128)

Real descriptive, right? Looking through the stack trace wasn't much help either. It was a bunch of stuff pertaining to trying to render the template. One thing I did notice is that a brewer with a unicode name had recently gotten added and this error was only happening on the new beer form (which includes a ChoiceField of brewers), but the brewer was being displayed just fine on its own page.

After asking my friend and fellow Django-user Dan-o what he thought, he asked if I had str() and unicode() defined in my models. I had str() defined (generally a good idea) but not unicode(). I popped it in to my Brewer model as so:

    class Brewer(models.Model):
      TYPE_CHOICES = (
        ('Macrobrewer', 'Macrobrewer'),
        ('Microbrewer', 'Microbrewer/Craft brewer'),
        ('Homebrewer', 'Homebrewer'),
        ('Unknown', 'Unknown'),

      name = models.CharField(&quot;Brewer name&quot;, max_length=255)
      brewer_type = models.CharField("Type of brewer", max_length=25, choices=TYPE_CHOICES)
      city = models.CharField("Brewer's city", max_length=255, blank=True)
      approved = models.BooleanField(default=False)

      def __str__(self):

      def __unicode__(self):

      class Meta:
        ordering = ['name']

And guess what? My problems went away. I feel like an idiot for being foiled by something so simple that I overlooked. It makes sense too because str() is used quite a bit in forms where the model instance's name needs to be magically generated. Without unicode() it would cause Django to barf on unicode names, just like it did on me.

Let this be a lesson to you. If you might EVER have ANY unicode text in your model instance's names, for crap's sake define _unicode_()!

Whiteboard Posted on 2010-02-09 - Comment

If you know me personally, you know that I can be pretty scatterbrained from time to time. I've desperately needed a whiteboard to keep my thoughts organized, and I've finally gotten one. I know, it's not the most exciting thing in the world to talk about, but it should be a change in the right direction for me.


But, wait. What's this? "Beertraq Road to Stable"?


Part of why I want to get my thoughts organized is because I want a good view of what all is left before I fully release Beertraq to the public. With this list looming over my head (literally) it will hopefully get my butt in gear to reach a stable release.

Holiday Ham Recipe Posted on 2009-12-25 - Comment

I don't cook/bake all that often, but when I do I like to have some fun with it. I came up with a ham recipe that turned out well, so I figured I'd share it with everyone.

First, put your ham in a baking pan and cut the diamond pattern into it. Trust Alton Brown when he says that utility knives work well for this. Then, mix the following in a bowl

Once you have that all mixed up, pack it gently onto the ham. Uniformity is nice, but not required. Then cook the ham at 325 degrees Fahrenheit until the inside meat temperature reaches 150 degrees (about 3 hours with a 20 pound ham). I guarantee that it'll be tasty when it's done.

More Fun With Graphs Posted on 2009-12-18 - Comment

I figured I'd post the latest graph magic from my work at Nucor-Yamato Steel. This is a graph of the entire network, switches AND hosts!

NYS Network Graph

(click for full-sized version, warning: LARGE image)

Here, the yellow boxes are center switches/routers, the green boxes are switches, and the peach-colored nodes are hosts. Also, red lines are switch-to-switch connections and blue lines are switch-to-host connections.

Another somewhat off-topic thing about these graphs is that the manager of IT at Nucor-Yamato is interested in open-sourcing the code that manages all of the data and generates these graphs, AND let me use company time to work on and manage the project. If anyone knows of any open-source project (or software that doesn't cost an arm and a leg) that already does network discovery, data collection, and automated mapping then please let me know! If I'm not going to be re-inventing the wheel, then I'll probably be kicking the project off shortly after I start working full-time in June 2010.

Beertraq Beta! Posted on 2009-12-05 - Comment

I'm glad to announce that my recent pet project, Beertraq, is now in a (somewhat closed) beta stage! The basic idea is there and functioning, but the extra functionality isn't done and it's far from polished. Nonetheless, it's time to take her for a test drive!

So what is Beertraq, you ask? It's a way for you to keep track of which beers you've tasted, compare those with others, read beer reviews, and most importantly discover new beers to try. I originally got the idea from The Flying Saucer's UFO Club, where members work toward a goal of drinking 200 different beers. Once they complete the task, they get their name on a plate which gets put on the wall of the bar. The cool part about the UFO Club is that it's all computerized, using a magstripe card to login at a kiosk in the bar. You can also log in to their website to check your progress and read reviews on there. I figured that if The Flying Saucer can have that system for their bar, I could do the same for the world.

If you're interested in becoming a BeerTraq beta user, send an email to beertraq (at) beertraq (dot) com with the email address you want to use for your account. All I ask is that you give feedback by filling out issue requests with bugs you find or suggestions you might have.

Fun With Graphs Posted on 2009-11-30 - Comment

I've always been utterly fascinated with graph theory, mostly with its applications to networks. As an added bonus, they can be represented with pretty pictures!

NYS Network
(click on image for full-sized version)

That graph represents the network behind Nucor-Yamato Steel and Nucor Castrip Arkansas, sanitized of sensitive information of course. All of the nodes are Cisco switches, the yellow boxes representing backbone switches (6500 series to be exact). This graph is part of the network information system that I've been working on during the majority of my internship at NYS and gets auto-generated every day, along with more centralized graphs on a per-switch basis. The way the system works is that a periodic Python script goes out to a list of known switches and gathers CDP neighbor information as well as the MAC address tables. Then Nmap scans are ran every 6 hours to scan for hosts, gathering IP addresses, hostnames, and MAC addresses. These MAC addresses are correlated with the MAC tables from the switches to determine which hosts are connected to which ports on what switches. The CDP neighbor information also gives which switches are connected to each other, giving a full scope of how the network's connected. The script which generates the graphs grabs all of that information out of the database, uses NetworkX and pydot to create the graph, and then graphviz to render it into a PNG image. The graph is pretty plain, though. The real version shows switch names and IP addresses. Since the time between graph generation is so long, any more useful information that I could throw onto the graph would quickly become outdated. My grand scheme is to make a quickly-updated graph showing live stats like switch load, link load, link types (fiber, twisted pair, wireless), downed switches, etc. That way, I (or the network supervisor, I guess...) could have a big-screen TV displaying the live health of the network.

I've been asked what parameters I set to get that graph to look that way. I didn't set anything special in code, it's all in the command line:

    twopi -q -Ksfdp  -Tpng -Goverlap="prism" -Eoverlap="prism" -Gsplines="true" -Gratio="compress"  -oclean.png

Really, I'm just a data visualization nerd looking to get a fix.

Doing it Right Posted on 2009-11-26 - Comment

Well, I finally bit the bullet and got a Linode account. So far I'm pretty happy with it. I figured that with the costs of power and bandwidth, I was almost spending $20/month to run my old server on my own hardware. Incidentally, the lowest-grade Linode VM costs that much and is enough to suit my needs.

So now that I've been setting up a webserver from scratch again, I'm doing it right this time. I'm setting up some monitoring software to notify me when things go down, I'm no longer relying on myself for DNS (no more dynamic IPs!), and I'm also branching out and trying an alternative webserver.

The webserver in question is Cherokee which claims to use less memory and perform better than Apache. It sure does use less memory, but as a down side it doesn't have a native PHP module, so I'm required to use FastCGI for that purpose. Right now, there's five php-cgi processes running each using about 25-30 MB. This wouldn't be a problem except that I've only got 360 MB of memory to play with. On the plus side its got a pretty sweet admin interface with wizards to help you set up things like WordPress, Drupal, Ruby on Rails, Django, etc. and you can setup some pretty complex rules for what and how files should be hosted.

On the monitoring side of things, I'm using Munin to monitor the various stats on the server, Piwik for website visit statistics, and I plan on getting Monit going for service monitoring. It's a bit more important now that I keep and eye on memory and data transfer now that I'm limited on that. Also, if some process goes wild and starts using crazy amounts of CPU power and memory, I'll be able to catch it.

Unfortunately when you move servers, you have to move everything that was running on them. I'm still in that process, but it's been going pretty smoothly.

Stupid Linux Trick #5245 Posted on 2009-08-18 - Comment

Want to share what you're doing with another person logged into the same system? All you need is a FIFO, cat, and script. On your session:

    mkfifo foo
    script -f foo

On the viewer's session:

    cat foo

The viewer can then see everything that you're doing as if they're looking over your shoulder!