Git and .pycs – not the best of friends

Coming from a C++ background, using Python for the first time was pretty amazing.  The ease with which you can link in other libraries and quickly write code is fantastic.  Learning and using Git for the first time on the other hand – that took some adjustment.

Git and I are on fairly good terms these days, and I’ve learned to love some of the features it offers compared to TFS (the last source control system I was using), especially when used in conjunction with Github.  However I hit a problem the other day that made _zero_ sense to me – and took a surprisingly long time to track down, due to lots of false positives in figuring out the issue.

I’d been switching back and forth between a few branches, and all of a sudden my unit tests were failing, and the app appeared to be testing things that shouldn’t exist in this branch. Not only that, the app suddenly refused to run – I kept getting a pyramid.exceptions.ConfigurationExecutionError error.  I found that if I added in a bunch of routes that existed in the _other_ branch, suddenly everything worked.

Experienced Python/Pyramid coders will probably know exactly what the problem was, but I was stumped.  It turns out that our Git is configured to ignore .pyc files – which is normally what you want and works fine. However when files exist in one branch and not in another, it can cause all sorts of issues.

There are two main ways of solving this:

  1. Create a clean_pycs alias in your .bashrc file, that you can run to clean your pycs when you need to – i.e. alias clean_pycs='find . -name "*.pyc" -exec rm {} \;'
  2. Use a Git hook to automatically clean up the files every time you change branches – more info here.

There are other ways you can do it, mentioned in the follow-up to the blog post above, but these are the two easiest.  Which one you use is up to you – I’ve spoken to a few other coders at work, and because we work on a lot of different projects they tend to use the former, rather than having to add the hook in so many Git configs.

Hopefully this blog post helps somebody – I was incredibly thankful when I finally found the blog post linked above!

Learning Python

About a year ago my wife and I packed up all our things and moved to the Silicon Valley to work for SurveyMonkey.  As well as changing job, city and country, I switched from being a Windows application developer to being a backend web developer.  I spent over 8 years writing high performance trading applications in C++ and SQL under Windows, and traded it all in for Python, Javascript, open source libraries, virtual Linux environments, and OS X.  I did get to keep using SQL Server 2008 though surprisingly!

I have noticed in Silicon Valley people tend to be a lot more collaborative than in Melbourne.  I suspect it may be because of the heavier use of open source software, and also the rise of distributed source control like Git.  Back in Melbourne most technology companies seemed to use either Java, C++, or C# – when I left Python and Ruby were becoming more prominent, particularly due to a burgeoning startup community, but still pretty relatively rare compared to here.  These languages don’t seem to lend themselves as well to open source collaboration – however I will admit my experience was extremely filtered as a developer working in a Windows dev-shop that rarely used a third party library.

I’ve found the many tech blogs about Python and Pyramid extremely helpful when trying to solve problems, and in the spirit of this collaborative effort, would like to give back a little with what I’ve found.  I also find that writing up technology discussions and solutions very helpful for refining and consolidating my own thoughts, so even if this isn’t widely read, it’s a very useful exercise.

To kick off, I thought I’d mention something that seems to have caught surprisingly few people out on the web, but had me completely stumped a few weeks back at work.  It’ll follow in my next post.  Thanks for reading!

This is the golden age for new gadgets

Back in 2002 when I started work on my PhD, I remember feeling in awe of all the amazing new devices being released.  Bluetooth had just come out, PDAs were getting wifi, and mobile phones were getting cameras.

A lot of the designs back then were kind of clunky, but a lot were pretty amazing.  I remember being amazed by the sleek design of the iPaq 3870.  The very cool (and thoughtfully ergonomic) T68 from Ericsson. The Sony Vaios were to be the coolest thing in laptops for the next 8 years (I still love the S58GP/B).

Since then I haven’t been nearly as excited about new devices, and I’ve often wondered if it was just a phase I was going through.  It was certainly better for my wallet.

This year though has been a pretty amazing year for design and technology.  Here are a few of the gadgets wowing me at the moment:

Macbook Air

When the Macbook Air came out a few years ago I was pretty impressed from a technology perspective.  However from a price/performance balance I was less than enthused.  Incredibly high price coupled with middling performance?  No thank you.  This year Apple suddenly releases an even SMALLER Macbook Air as well as a version of the original with bumped specs and much lower prices? Done.  Between the SSD, the higher resolution screen and the lighter weight/longer battery life, the Macbook Air ceases to be a novelty and begins to be a competitor as an every day computer.  Looking forward to the 15″ version hopefully some day soon.

Kindle 3

The first Kindle was of course groundbreaking, and the second was a worthy successor.  However, the Kindle 3 combined an impressive upgrade (smaller, lighter, and with a better contrast screen), with a killer price point – $139.  Suddenly the greatest ebook reader was a commodity purchase.  Until the Kindle 3, I knew of a single person with a Kindle.  Now, at least a dozen of my close friends own one.

iPad

There were rumours for years.  And tablets were pretty woeful too – so the jokes about a second Newton actually seemed pretty accurate.  However Apple did two really impressive things with the iPad.  The first is the price – they crammed in a really solid mix of tech in a beautiful device, yet without the design premium.  Already they’re ahead – but unlike Microsoft with their woeful tablet version of Windows XP, they successfully redesigned the OS paradigm.  They took the best of iPhone and OS X and figured out an all new way to use computers.  And it was an immediate success!  I’m still in awe that they achieved this, and with a 1.0 product too.  I somewhat regret my decision to be a late adopter to the iPad, but I am hoping 2.0 will justify my wait.  As someone who dreamed about ubiquitous computing becoming mainstream as an academic, I’m truly jealous of the designers and engineers at Apple for pulling this off.

Volkswagen Golf Mk 6

This seems a little odd.  Gushing about the design of a car?  Yes, cars are a fairly well-known format, but since having lengthy discussions with the Volkswagen Electronics Research Laboratory I’ve been really excited about the user-centred approach to design employed there.  I originally test-drove the latest Golf as one of several possible cars based only on its looks, but the attention to detail compared to the price point is amazing.  Subtle touches like a cooling glove box, consistent ambient reading lights, 12V chargers in the boot, and a well-designed “second dashboard” UI, give a suitable wow factor.  I’ve never enjoyed using a car as much as I have the Golf Mk 6 (well, except maybe the Audi S5 Coupe).

Canon Powershot S95

I was disappointed with Canon after the apparent peak of point-and-shoots with the Ixus 860IS.  I had just planned to get another Ixus, even though I had known there were issues with the latest sensors, however when I went to Best Buy to compare them, I stumbled across the S95.  I immediately knew I had to get one.  The S95 boasts a very sharp and clear LCD, a large sensor, high quality lens and nearly full manual controls.  Since buying this I have retired my Ixus 860IS (apart from for concerts, given its great audio attenuation) as well as my wife’s Rebel XTi.  Mr Pogue sums up my feelings pretty well in his love letter.

Ruby on Rails

Yes, I’m kind of late to the party, but I’m traditionally a Java man, having dallied in Struts and used Spring/Hibernate.  Writing a web-app used to be kind of a big deal.  With Ruby on Rails all the smart decisions have already been made for you.  Ruby is a fun language to write in, and Rails takes care of all the hard stuff.  This is what programming is meant to be like.

Everything, really

Furthermore, have you noticed how much more it feels like we’re living in the future at the moment? I think the mobile/ubiquitous computing nature of devices is fueling this.

  • Identifying a song on the radio using Shazam
  • No longer having to plan every detail of vacation.  Finding an amazing restaurant using Yelp, booking it on OpenTable and navigating with Google Maps – all on your smartphone.
  • Wireless broadband – how did I make do without you before?
  • Playing Xbox without any controllers at all – I still remember the weird feeling of just not having a cable and how disconcerting that was.
  • VOIP calling anywhere, anytime.
  • Fitbit, WakeMate, RunKeeper, Nike Plus – you can monitor almost all your everyday activities now.
  • Having applications in the cloud – find any computer, and you’ve got access to all your data and applications.
  • A mobile phone with a 960×640 display? The iPhone 4 wows me every time I use one.
  • WordLens – realtime OCR/translation and augmented reality for translating text – all on a mobile device.

It’s difficult to make strong predictions, but 2011 looks to be another amazing year for technology, even if it is “just” incremental (the S95 was “just” an update to the S90).  I’m looking forward in particular to what Apple do next (of course), and the continued innovation in web applications, particularly in the cloud.  Y Combinator continues to be very successful and with nearly 80 new companies likely to emerge next year that will be another exciting scene. It is hard to imagine a strong follow-up to a year which included Xbox Kinect, WordLens, iPhone 4, and the iPad, but I am optimistic.

A long time off the air

Apologies for the long delay.  I had worried I would stop updating a blog on my own volition, but instead a nasty Firestats bug shut down my WordPress install.  Every time I sat down to try and fix it, I’d get interrupted and never had quite enough time to finish figuring it out.  All sorted now though, so back to the usual miscellanea.

A participatory design approach in the engineering of ubiquitous computing systems

I’m very excited to report that I finally completed all my graduation requirements, including of course, attending the ceremony and I am now officially Dr Tim Cederman-Haysom.

Some obligatory photos of floppy hats:

And of course, my thesis is now available for helping insomniacs everywhere.  My abstract isn’t a bad summary for figuring it all out.

Products I like and wish I actually used

Sometimes you see something that looks so cool that you want to use it, but quickly realise you don’t have any actual compelling need or interest.  I’ve raved a few times about products I’m using at the moment and really enjoying but wanted to mention a few deserving products that I wish I used more often but for whatever reason don’t.

Posterous
Posterous is named as such because they make it preposterously simple to blog.  It’s very easy to use and a great product — I’ve even heard people on the T to work raving about how much they love it.  I think their landing page, with its three steps of use, says it all:

Posterous landing page

I’d really like to enjoy that simplicity myself — I love the site, the implementation, and the look of posterous blogs, but with my comfy custom WordPress installation, I can’t see myself using it anytime soon.  Bummer.

Balsamiq

Balsamiq is what I spent years wanting to have.  It’s a very simple-to-use but powerful creator for wireframes.  Instead of doing the smart thing and inventing my own version of it, I languished in Visio, PowerPoint and Photoshop.  Balsamiq provides a great toolkit for quickly creating digital sketches of UIs and is a joy to use.  While it’s been very useful for my own personal projects on occasion, unfortunately it doesn’t fit in with my current work flow at TripAdvisor where we’re doing a pretty decent job with Photoshop and paper sketches.  I would’ve loved having a tool like this at Trovix though.  Oh, and a hearty congratulations to the Balsamiq team for what sounds like a very successful 2009.

Amazon Kindle

I got to borrow one of these from Google over Thanksgiving and I loved using it.  It meant I had plenty to read while on vacation (where I get the bulk of my book-length reading done), without the bulk of the books.  I bought Under The Dome by Stephen King recently, and wow, there’s a book that shows the utility of the Kindle (1074 pages).

Unfortunately the clunky update speed and grayscale screen doesn’t do it for me.  The lure of the mythical Apple tablet is proving too strong and I can’t pull the trigger on one just yet.  More than happy to keep borrowing one of Google’s though.

Google Voice

I managed to snag a GrandCentral account a while back, but the inertia of my existing phone number meant it was more of a technical toy than a serious phone replacement.  I do love the idea of a unified phone system, and with realtime voicemail and transcription, call recording, conference calls and a slew of other great features, it seems like an amazing product… but only if you can get around the limitations of having to change your number, and to call the Google Voice service to take advantage of said features.  I think the rejected-by-AT&T iPhone app would’ve gone a long way to helping me switch.

RadRails

RadRails is one of the few products where I’m not sure if it’s me at fault or them for not using it.  As someone who got very comfortable in Eclipse and is a little lazy, I’d like to continue my Rails hacking in a familiar IDE.  Unfortunately I just can’t seem to get RadRails to play nice with the latest releases of Ruby and RoR.  When I get more time I’ll take another crack at it.

In theory though, it’s a great environment for us ex-Eclipse users.  I’m not sure about other users, but I spent a fair bit of time in Eclipse using J2EE/Spring as a framework, and RadRails feels like home.

Edit: updated to add…

Google Website Optimizer

This is an amazing free product that allows for A/B and bucket testing.  Happily we have some very nice pool testing at TripAdvisor already, but perhaps I’ll get to use it on a future side project.

Fixing a corrupted/deleted partition table

About a month ago, while trying to upgrade to Windows 7, I managed to wipe the partition table and in trying to fix it, created a corrupted table.

(incidentally, if you can’t update Vista with the latest service pack, you won’t be able to upgrade to Windows 7, so don’t bother trying without fixing your boot configuration. Turns out my problem was having a dual-boot configuration with XP)

I had backed up my key files, but I wasn’t keen on losing my nice Vista configuration. I posted the whole sordid tale on Superuser.

Happily, I managed to figure out what had happened, what I was actually doing at a low level (sometimes I am a little too lazy and do just blindly run commands, something that Raymond Chen despises), and completely recover. I figured I’d post a link to the solution in case anyone else has their own troubles.