Archive for May, 2008

Some fairly large computer news

I’ve been working away from home more and more often lately, and the 13″ screen on my MacBook has been feeling more and more restrictive. So I decided to replace it with a something bigger. Obvoiusly my first thought was a MacBook Pro, but they’re just so expenssive that it’s hard to justify the cost. So instead, I bought a ThinkPad. I got a T61 with a 15″ WSXGA+ screen, 802.11n, dual-layer dvd burner, 2.5 GHz Core2Duo… basically the exact same features (and even hardware probably) as a MacBook pro. The biggest difference? I spent less than $1000 dollars on it.

This is actually my second ThinkPad; I had an x61 that I bought in college and actually used as my main computer when I first moved to Boston because my PowerMac was in-transit and I didn’t have anything else. I’ve also been impressed with the ThinkPad line, the higher end ones have very nice build quality, and they’re popular enough with the Linux crowd to have good Linux support. So, for the second time in my life, I’m running Linux as my main OS (specifically Gentoo Linux on kernel 2.6.25 with the tuxonice patches).

The biggest issue with using Linux was finding the appropriate replacements for my commonly used apps. Most of them were Easy: Firefox stays the same, I use Google Apps to host my email so no problems there either. For instant messaging I was planning on using Pidgin, but ended up going with Kopete because after trying it out, I just like it better (that’s right, I’m using KDE, 3.5 for now). The biggest challenge, was trying to find something to replace TextMate for coding in. I absolutely love TextMate, and take advantage of a lot of its advanced features all the time. Fortunately, back when I was a CS student, I got nice and familiar with Emacs, and was well aware that, even if the functionality I wanted wasn’t built in, someone’s probably created an add-on for it, and if not it would be pretty simple for me to do it myself. Turns out I was right.

I haven’t completed all my Emacs modification yet, but so far just two little scripts have given me most of what I was looking for. First was yasnippet, which provides a snippet feature that works in pretty much the exact same was as TextMate’s. Someone even wrote a script that will download TextMate bundles directly from the repository and covert the snippets they contain to work with yasnippet. You can’t do much better than that. I’m also using emacs-textmate which provides an Emacs minor mode that emulates some more of TextMate’s behaviors; specifically, it adds in the ability to automatically insert paired characters, so if you type ‘(’ it automatically inserts ‘)’, and handles deleting them gracefully as well.

There were a few other features that I use extensively in TextMate as well that weren’t provided by either of these add-ons. Fortunately, it was relatively simple for me to implement them myself (with a little help from a friendly Emacs guru on the Gentoo forums) and patch emacs-textmate to provide it. Specifically, I duplicated TextMate’s auto indent feature by adding an extra keybinding to emacs-textmate to bind the return key to the built-in Emacs function newline-and-indent. I also bound M- to a new function of my own creation defined thusly:

(defun open-next-line()
  (interactive)
  (move-end-of-line nil)
  (newline-and-indent))

This duplicates the behavior of command-return in TextMate, which is pretty much the same as ‘o’ in vi[m]. I’m still working on how to duplicate command-shift-return, which inserts the appropriate line ending character based on language (’;’ for C and C-like languages, ‘:’ for Python, &c.) and then opens and goes to the next line. But I don’t think that will be too hard once I learn a little more elisp. After that I just need to figure out how to duplicate Textmate’s tag closing function, which is a huge time-saver when coding HTML.

All in all, I’m quite happy with my new computer. Things may not be quite as pretty as in OS X, but they can be if I just put a little work in to making them so (I’ve already got e17 installed, which comes close and with some more tweaking may replace KDE as my default environment). As much as I love Mac OS X, there is definitely a strong argument to be made for Linux, at least for people who aren’t afraid to get their hands dirty with the command line and a good old text editor. Even with just a couple days spent adjusting the system, I think it’s already at a point where I could see using it full time, maybe even prefer it to OS X. Which is really saying something when you consider that I’ve been a Mac user for about 24 years.

I love Django

I’m currently working on a fairly large Django project that I think I’ve mentioned a couple times in the past. In that Django project there is a Person model and an Organization model. Both Persons and Organizations have email addresses. Organizations are related to Sites (through a ManyToMany field), but Persons are not (they’re related to Organizations through an intermediary table). I’m currently attempting to create a contact form, so that people can email either a Person or an Organization using newforms.

For security reasons, we don’t want the user to actually see the email address, just the name of the Organization or Person. Fortunately, newforms has the ModelChoiceField class that you pass a queryset of options. In keeping with DRY principles, I want to be able to use a single Form regardless of whether the person is trying to email a Person or an Organization (both models have a field named ‘email_address’). Unfortunately, this is where I ran into my first problem: ModelChoiceField doesn’t really allow you to define the queryset dynamically, you have to define it in the form definition. Luckily I found this blog entry which provides a method to re-define the queryset in the __init__() method which allows you to change it based on the HttpRequest object. My next problem was that I only want the user to be able to email Organizations and Persons on the current Site. Since Organizations are directly related to Sites I just used the CurrentSiteManager. However since People are not directly related to Sites, and are instead related only to Organizations (through an intermediary table), I couldn’t do this. Instead, I decided to try this crazy bit of code:

Person.objects.filter(persontoorganization_map__organization__in=Organization.on_site.all())

Amazingly, it just worked exactly as I would have wanted it to. No fuss, no problems, just a queryset of Persons related to the current site. Go Django!

Getting there with the TV

I posted a while ago about my plans for our TV setup. In the intervening months I’ve made a few changes to my plans and taken a big step towards getting it all set up.

The biggest change is that I’ve removed MythTV from the picture. Originally I was planning on either building my own MythTV powered HTPC or buying a TVease Zodiac MythTV system. It appears that TVease has gone out of business, so that’s now out of the question. But in the course of my research on building a MythTV box, I realized that it would be a similar price and far far easier for me to just buy my HDHomeRun through Elgato and get their EyeTV software with it. I can then just run it on a Mac Mini using Pyetv to control it all through Front Row.

With that in mind, I’ve now purchased my HDHomeRun from Elgato, and am currently watching the Detroit and Dallas in the Stanley Cup playoff live in a window next to my browser as I write this. We’ve also get it scheduled to automatically record Lost and Grey’s Anatomy.

So far I really like the EyeTV software. With the HDHomeRun we’ve got two tuners so we can do picture in picture and/or record one thing while watching another (or just record two shows simultaneously). I’ve had no problems or complains with either the software or hardware so far, though I have had a few problems actually introduced by my computers. For some reason, my iMac occassionally loses its AirPort connection which means it loses its connection to the HDHomeRun. As a result, our recording of the latest Grey’s Anatomy stopped after 7 minutes. Fortunately this won’t be a problem with the final setup because I’ll just connect the Mini to the network via ethernet. On the plus side, the 802.11n network I setup for my iMac gives me no problems watching two HD shows simultaneously. The other problem we’ve run into is that occasionally the reception isn’t that good. But that’s easily fixable by just getting a better antenna, which won’t be hard to do since we’re currently using some cheapo rabbit ears.

All in all, I’m pretty confident that this is going to work out well. And it will be easily upgradeable if we decide we want to get cable and/or sattelite (probably sattelite because if we’re paying all that money I’m going to want Setanta Sports).

Last night at the Apple Store

AppleSo as I mentioned, I was at the opening of the new Boston Apple Store on Boyleston St. last night. Unfortunately I was a little late showing up and didn’t get my free t-shirt. :(

As I mentioned, it’s an extremely nice location with some extremely cool design. The entire top floor (of three) is dedicated to support with a gigantic Genius Bar that is apparently able to support several thousand people per day, and a ton of iMacs lining the walls where you can get one on one help/tutoring (they call it their One-to-One program). Another cool new features they’re rolling out (or possible already had and I just haven’t been paying attention) is their personal shopping service. You can make an appointment to show up and have, essentially, a personal shopper to help you out with any questions or help you might need while shopping. Seems like a pretty cool idea, and I imagine it will be very useful for the parents who want to get their kid a new computer or something but really have no idea what they’re looking for.

All in all, I think this store is going to be a huge success. Especially positioned, as it is, directly across the street from the Prudential Center and the soon-to-be-opened Mandarin Oriental hotel. It will definitely be a little more pleasant to visit than the Cambridgeside location, though parking won’t be nearly as easy so you’ll probably start seeing more people with big iMac boxes on the T…

And in closing, these people weren’t on the guest list and therefore aren’t as cool as me:
These people aren't as cool as me.

(Yes, both pictures in this post were taken with my iPhone.)

Apple Store Boyleston

I’m currently at the grand opening event of Apple’s new flagship retail store in Boston. I’ve only just gotten here, but so far I’ve hot to say that I’m impressed. It’s something like a cross between the 5th Ave. location in New York and the Miracle Mile location in Chicago. In short: three stories of beautiful, glassy architecture with a huge skylight topping it off and the iconic white Apple logo overlooking the Pru. Also, they’re giving me free beer and appetizers, so far so good. I’ll write more about itlater, for now I’ll just enjoy it, and play with the toys.

And another thing

Why is everything that disrupts parking labelled an ‘emergency’ around here? When it snows enough to disrupt parking it’s a ’snow emergency’. When they’re forbidding parking so that they can paint lines on the street it’s an ‘emergency’. Last night we walked into Porter Square for dinner and passed no fewer than two different ‘emergencies’: ‘Emergency! We’re painting lines on the street! Please file calmly, but quickly to the nearest exit!’, ‘Emergency! We’ve torn up the sidewalk! Please …walk around it!’.

Seriously, people, these are not emergencies… Ok, there’s a vague case for the ’snow emergency’, but there is absolutely no excuse for labeling an event that has been planned for weeks if not months as an emergency.