Here lies the last 25 entries in my weblog. Follow the yearly archives to the right for more.

Help with Launchpad Bug Import Script

I and my fellow Launchpad bugs hackers have always helped people migrate to Launchpad by doing bug imports for people running other bug trackers. This has increasingly taken more and more of our time, and we've gotten worse at doing it in a timely manner for people. This is mostly because we really want to get fixes and improvements to the bug tracker itself landed. And really there's no need for us to do all this. Anyone can import their bugs into Launchpad using a Launchpad API script.  So here's where I come to you, dear reader, asking for help....

Does anyone have an existing API script to import bugs into Launchpad they would be willing to open source? Or would anyone be willing to take our existing Launchpad import script and convert it to use the API? Ping me in the comments on this blog or via email if you're interested. Or catch me on IRC on the Freenode network (nick is deryck).

For those who might be interested in converting the current script, take a look at the existing Launchpad bug import script. Note that this script assumes you've created an import file in Launchpad's bug import format.

Link | Posted by deryck on September 1, 2010 | 0 comments

Playing Champions Online on Ubuntu

I've been playing Champions Online for a little over a month now, and I've been playing it on Linux, running on Ubuntu 10.04. I searched online for help and had to piece a few things together to get the game running smoothly under wine in Ubuntu, so I thought I would do a quick post here detailing the steps I took.

The quick start guide is this:

  1. Create a new wineprefix
  2. Install ie6 and gecko with winetricks
  3. Create script to export WINEPREFIX, cd to prefix, and use renderthread argument
  4. Disable mmdevapi via winecfg
  5. Add -softwarecursor and -ignorex64check at launcher options

For further details, see my comments below.

Create a new wine prefix

For some reason Champions Online plays better if it doesn't share the wineprefix with any other games or the wine prefix is not otherwise heavily customized. In fact, I've since found that having each of my MMOs in its own wineprefix has made each play better. This is a bit of a disk space hog, so I would love to know if there's a way to better share the wineprefix without causing problems for each game. But for now, this works well.

The wineprefix is the directory where wine stores its data. If you don't specify the wineprefix by exporting the WINEPREFIX environment variable, then $HOME/.wine is used. I did something like this:

wineprefixcreate --prefix ~/.champions

Install ie6 and gecko with winetricks

winetricks makes installing windows software via wine easy. IE6 and gecko are required for the Champions launcher to run. So this is as easy as:

$ winetricks ie6 gecko

This is pretty well documented online for any recent Cryptic Studios game (Champions or Star Trek Online).

At this point, you should be able to install the game. Download the game, and run:

$ wine $PATH-TO-GAME-DOWNLOAD/setup.exe

Don't worry if the installer hangs. Kill it and start the launcher, which will patch the game and finish installing everything.

Create script to export WINEPREFIX, cd to prefix, and use renderthread argument

There are a couple of tricks to getting Champions to run now, so I make this easier by using a script to run the game. Basically, we want to export WINEPREFIX to point to the right place for the game, cd into the directory where the game is installed, and pass in a renderthread argument. This renderthread argument prevents the game crashing at startup.

The script looks something like:

#!/bin/bash

export WINEPREFIX=$HOME/.champions
cd $HOME/.champions/drive_c/Program\ Files/Cryptic\ Studios
wine Champions\ Online.exe -renderthread 0

I cd to the directory for the game because sometimes the game leaves behind log files, and I don't want them littered wherever I happen to start the command from.

Disable mmdevapi via winecfg

Sound was a bit of a pain to get running, but I discovered a simple trick to make this happen.

$ export WINEPREFIX=$HOME/.champions
$ winecfg

And then click the "Libraries" tab. Then click "Add". Then create an entry for mmdevapi, and set it to disabled.

Presto. Sound!

Add -softwarecursor and -ignorex64check at launcher options

Finally, I had to add a couple options in the game launcher. The first is to get the cursor working in game well.

Once the launcher appears, click "Options" in the menu items at the top. Under "Advanced command line" add:

-softwarecursor

(Note the leading dash.)

Then, to make sound a bit more stable add:

-ignorex64check

Again, the leading dash. This last option could be because of my system and may not be neccessary for everyone. I'm running Ubuntu on Mac hardware

Now the game runs well.  Enjoy!  I know I have.  And for those cursious about the difference between this and City of Heroes, I'll try to do a post on that later.

Link | Posted by deryck on August 5, 2010 | 0 comments

Watching Graphs Flap

I love watching this graph lately.  It's the percentage of bugs that status flap marked opinion (green) and marked invalid (red). By status flap, I mean that the bug was set to the opinion or invalid status once, and has had any number of status changes since then.

People are still trying to get their heads around the opinion status on Launchpad bugs, I think.

Link | Posted by deryck on August 2, 2010 | 2 comments

Beware of "Facebook Social Plugins"

I discovered today that Facebook allows third party sites to make use of something called "Facebook Social Plugins" which can make it appear as if you are logged into other sites through Facebook.  You are not able to opt out of this.

For my non-tech friends who wander by here, this uses what's called an "iframe."  There are some protections built in because of your web browser's security policies, but this is open to abuse easily.  Facebook could snoop on what sites you visit that use these plugins.  Facebook could list what you've visited on your profile.  The only thing preventing abuse is trust.  You have no way to turn this off in Facebook settings currently.  Please see FAQ items linked above to confirm this.

You should log out of Facebook after every use or use a browser plugin that does this for you to prevent abuse until Facebook changes its policy on this.  I have to admit this is so shady and open to abuse and coupled with the fact that it was not announced widly that I am now seriously considering abandoning Facebook altogether, despite the great personal value I get from connections with people on the site.

Link | Posted by deryck on May 19, 2010 | 0 comments

Back Home After UDS-M

It's Friday of UDS-M. I'm writing this from home, waiting on my electricity to be restored. I'm anxious to get to work today, to put in place plans to act on some of the ideas for Launchpad Bugs that came out of UDS-M.

With timezone differences between Alabama and Brussels, the day is half done at UDS, while the sun isn't yet up here. I came home Wednesday, but due to 5 hours of delay at the Brussels airport and 2 hours of delay getting through customs in Atlanta, I didn't get home until early AM yesterday, finishing at a better than twenty-two hour travel day. I was exhausted, and spent most of Thursday in bed. I can begin to imagine how my New Zealand and Australian friends feel every time they travel, and I wonder how they can even function afterwards.

I really only spent two full days at UDS. Monday was mostly about Launchpad Bugs for me. I went into a couple QA-related sessions. Jorge put together a couple sessions around patches and bugs that I attended. There was also the developer workflow sessions on both Monday and Tuesday. Certain themes came up frequently -- converting patches to branches and dealing with loads of bugs were mentioned often. Tuesday I had some time for a couple sessions of interest to me personally, mostly to do with the desktop track and application development on Ubuntu. Quickly and Ground Control are amazing, and you should be using these if you're not already.

I even found small bits of time for hacking next to friends on the Landscape and Bazaar teams who were sprinting at UDS. I contributed a tiny patch to Ground Control, and between these two days at UDS and hacking nights at the SomeHands meeting we had for work the week before, finished off 3 Launchpad branches and got some serious work done on lazr-js/Launchpad branches exploring ways to clean up all the icons on the bug page. I also did a bit of mockup hacking, to get the ideas from these branches in a form easy to show and talk about. We've made some progress in the last six months making the bugs home page for a project really nice, and I hope we can do something similar for the bug page over the next six months.

Our plans currently include making subscriptions and notifications better for Launchpad bugs. The rest of our 6 month cycle is yet to be planned, though we have certain themes we know we will be exploring. Everyone at UDS had ideas about what we could be doing to make Launchpad better. We're all software engineers, so opinions are easy to come by. Now we have to find a way to schedule the fixes that make sense, while also thinking of clever ways to address the larger problems, and all of this has to be done in the themes we've set for the coming development cycle for Launchpad.

There's lots to do, definitely. Now if my power would just come back up, I could get started working on some of this.

Link | Posted by deryck on May 14, 2010 | 0 comments

I know I've seen this bug before

I've spent the last couple days catching up on bug traige. Triage often leads to one of those moments where I think, "I know I've seen this bug before." I could go through the normal search page on Launchpad, looking for recently changed or newest bugs, but I usually don't do this. The search form feels slow and heavyweight when I just want something to nudge my brain about a bug I know I've seen before.

The "Report a bug" page for a project on Launchpad features a duplicate search before allowing you to a file a bug. Take the filebug page for malone, the project I work on, for example. This page loads fast for me and has just the "Summary" form input. I usally type a couple words in this "Summary" field and hit enter. Something like "ubuntu bug timeout." The dupe search gives me ten hits quickly, and the bug I'm trying to remember is almost always listed here. I often use the filebug page dupe search for these quick and easy search queries, rather than the normal search page.

I've heard from others that do this, too, but I'm not sure how widely this is known. The filebug page makes a great quick search page. Give it a try if you haven't yet.

Link | Posted by deryck on April 27, 2010 | 5 comments

Why No One Is Happy Today (and what that means for web developers)

I read mdz's post on "Breadth and depth" today and found it contained many, many interesting links. Take this video of Barry Schwartz's 2005 Ted talk.

I had heard of Schwartz's research before but this is the first time I sat through a talk from him. His arguments are compelling, and I find myself fully convinced. We have too much choice and it's killing us. For those who don't know him or don't have time to sit through the video, his main point is that despite all the choice and opportunity we have in affluent, western societies, we find ourselves more unhappy than ever.

There is a lesson here for makers of web sites and web apps, too. More choice is clearly not a good thing. We know that sites that focus on a smaller set of tools are often more popular than fuller-featured counter parts. Now we know why.

Link | Posted by deryck on April 7, 2010 | 0 comments

Doing A Launchpad Release Manager Rotation

I'm doing a release manager rotation for Launchpad this week, helping see us to the rollout of Launchpad 10.03. It's been a nice experience, and I've learned a lot about various aspects of Launchpad and our releases that I would not have learned otherwise. I'm still amazed at how much time we invest in a release as compared to development time when we only have 4 week development cycles.

Here's a comment I wrote on Facebook after co-workers commented on a status update where I wrote something similar to the above.

Think about all the wasted dev time we have around release, and with short cycles anyway.

I lose a week on a release manager rotation. Devs on our teams lose 3-5 days depending on what is going on. Continual deployment would keep us moving forward much faster. There are some technical issues for Launchpad to do this, and also, there is some progress being made towards a form of this.

But still, I want to think about coding and quality of features not release semantics. :-)

I've written before that release is a word give too much weight in web development. Having done a rotation as an actual release manager now, I still feel the same.  Again, I'm hopeful this is changing, at least somewhat, for Launchpad, but I want to continue to talk about how we can move to continual deployments. I see nothing but positives to be gained from this, assuming the blocking technical issues can be overcome.

Link | Posted by deryck on March 30, 2010 | 0 comments

Book Review: Making an Elephant

Making an Elephant Making an Elephant by Graham Swift

This book on his life and writing is good, though not as good as other books I've read like this. I enjoyed the personal passages about his life, more than the thoughts on his craft. The chapter written on his father's death stands out as a moving essay.

I have always been a fan of Graham Swift's fiction, so as a fan, I enjoyed this book. It's not as good as others like this I've read. Art Objects by Jeanette Winterson is better by a contemporary British author, and Mystery and Manners by Flannery O'Connor is a great example by an American author. Still, fans of Swift and other writers might enjoy this.

Every time I read a book like this, I wish for more books like this in my field (computer programming, for those who don't know me). I would love to read from great hackers on how they became the person they are, how life has affected craft, and so on.

View all my reviews >>

Link | Posted by deryck on March 8, 2010 | 0 comments

Simple Rules for De-Fatting Myself

I've got to lose weight. Working from home and the sweeties that line the red bar in the kitchen 6 feet from my desk are killing me. I can't do diets. So here are my simple principals for de-fatting myself that I plan to stick to for the next 3 months to see if it makes a difference.

  • No snacks between meals (at all!)
  • No desserts
  • Evening meal must be the smallest meal of the day
  • Drink lots of water

I'm going with the keep-it-simple path to see if just controlling my food consumption is enough. I'll let you all know how it's going in a few days.

Link | Posted by deryck on February 17, 2010 | 0 comments

Websites Don't Release Anything

A couple weeks ago I was in London for a Launchpad team leads sprint. There were lots of cool discussions, focused mostly on processes within Launchpad. Because of all this process talk, we ended up talking about our release process a fair amount. I had some ideas forming before this, but a week's worth of discussion helped cement my thinking about "releases" for websites. Now some two weeks later, I'm still thinking about this, so here's a quick sketch of what's on my mind.

First, websites don't "release" anything. It's a metaphor, and a poor one at that. We update the site with some version of our code. Different sites do this differently. With regular updates to edge (our beta site which many of our users use anyway) Launchpad has many levels of release -- code updates to edge regularly, db updates to staging regularly, and roll outs of both to the main site monthly. Other sites just continually do the equivalent of svn up on trunk on their site and apply DB updates as needed.

Using the term "release" so casually also makes you feel like you have to build in artificial barriers to make the false release feel more like a traditional software release. Version numbers are a prime example of this. We give a version number to each month's "release" on Launchpad, and I think the only purpose this serves is to confuse developers and users about the meaning of the number. If I download Django 1.1 and hate it, I can choose to download Django 1.0 and use that instead. If you hate Launchpad 10.01, there's nothing you can do about it. If we bork something in 10.01, it's not like we're rolling back to December's release (whatever it was numbered). We will continue moving forward, adding a new branch that removes the busted feature or fixes the newly introduced bug, or what have you.

And it's this very act -- the act of continually moving forward -- that makes me hate talking about website releases all the more. What everyone who works on websites wants to do is move forward as quickly as possible, constantly adding new features and bug fixes to a site. The moment you place some arbitrary stopping point on the process and name it a release, you slow down forward progress.

I realize some would argue this a good thing, that stopping causes you to assess or do QA or ensure some other permanent quality is in the "release." But there's nothing permanent on the web. I would argue that rather than faking something permanent, your time would be better spent getting features and fixes to your users more quickly. I know I'm not alone in this, but still this word "release" hangs on, even in web development.

I'm excited, then, to see some of the changes we're proposing to our "release" process for Launchpad. Björn has proposed a way to release features when they are done which will require a new merge workflow for our work on Launchpad. These are all good things, even if the specifics may change as we discuss this among LP developers. The only thing that would make this better is to drop the word "release" from any discussions of these new proposals. But old habits die hard, as the saying goes.

Link | Posted by deryck on February 16, 2010 | 2 comments

Life Through the Lens of a Machine

Last night I watched Surrogates, which was a fun movie. (Yes, I have kids and watch every movie later than the rest of the movie-going world.) I've also been watching Caprica. Then there's this little film called Avatar, which it seems the entire world has seen. As I finished watching Surrogates last night, I was struck by how much I'm seeing similar themes in sci-fi films and tv shows lately. These stories deal with people living their lives virtually through some intermediary -- an avatar in a virtual world, a robot, or a life-like robotic avatar, and so on. I suspect this will become even more common as time passes.

This suggests to me that there is a deep-seated sense among artists that such a future (or present) is immanent. People have been doing the machines-take-over-from-humans meme forever, but this is slightly different. This is humans-live-through-machines. Surrogates starts with a 10 year timeline that maps from creation of the first surrogate unit to world-wide adoption, which is realistic for how quickly technology can cause a paradigm shift. I think some form of this experience is very close to being a reality.

I say this as someone who views every activity of life through the "lens" of a computer screen. I'm not alone in this. Everyone I know might as well have a computer or smart phone attached to the body permanently.

I started reading The Singularity is Near some time last year. I've read bits and pieces but haven't committed to finishing it yet. I just recently moved this from "reading" to "to-read" on Goodreads because of this. I mention the book here because it deals with similar ideas -- this notion of a convergence of machine and humanity as we human beings push forward our own evolution. This can sound fantastic in the abstract, until you read the book, take an honest look at our computer-connected lives, or see a few stories like Surrogates, Caprica, or Avatar that make some version of this concept seem possible.

I'm not a technophobe, nor do I work in an area of software development that directly touches this kind of work. I do think, however, that inevitably I'll be connected to this kind of work, if I'm not already. "Everything that rises must converge" is not only a great Flannery O'Connor story, but also a great principal of life and technology. No one really knows what this future will look like, or what parts of it will be good or bad for us. It's nice to see artists wrestling with these questions, though. I'm sure the increase in stories like these only confirms how near such a future really is.

Link | Posted by deryck on February 12, 2010 | 0 comments

Book review -- JavaScript: The Good Parts

JavaScript: The Good Parts

JavaScript: The Good Parts by Douglas Crockford

Anyone doing a lot of JavaScript development would benefit from reading this book. I feel very comfortable in the depth of my JavaScript knowledge, and I work with JavaScript on a weekly, if not daily, basis. I still learned things from this book. In many cases, I already knew about the particular peculiarity of JavaScript being outlined, but I learned a bit more about why a particular wart exists in the language.

View all my reviews

Link | Posted by deryck on February 8, 2010 | 0 comments

2010 is here, now what?

With it being the new year, I feel compelled to do one of those predictions or new-year-resolutions posts. I'm not big on either so here's a bit about where I've been and where I'm going.

2009 saw me take a job with Canonical. I started working on the bugs app in Launchpad in April and have since been promoted to team lead for the bugs app team. It's been an amazing few months. Working for Canonical has been a wonderful experience for me. I went from working in companies as the lone telecommuter to a company filled with remote workers. It's wonderful and in the process I've learned a lot about being an effective telecommuter and managing a team remotely. I'll probably put these thoughts into a post sometime in the next couple months.

I'm also working with Zope more these days than Django. From 2005 until 2009, I was doing Django development heavily. There are days I miss Django, but I dip my hand in where I can, mostly with code that runs this site and a couple little toy projects I occasionally hack on. Launchpad is a Zope application, so since April, I've really tried to learn Zope as well as I can. I'm surrounded by great Zope developers on Launchpad, so like working with the Samba team, learning is made easier by absorbing from colleagues. I do like Zope, which may seem weird for a Django guy to say. I'm not a framework zealot, though, and I think Launchpad is a unique Zope app, so I should say, I like Launchpad's use of Zope. I need to do a simple Zope app at some point to get that perspective.

(I still don't love zcml, I have to be honest. The template language is growing on me, and I see it's power. Zope component architecture has won me over completely, though.)

Personally, I feel quite happy about where I'm at with balancing work and life as 2010 begins. I'm as productive as I ever been as both a manager and a coder, and I still have plenty of time with my kids and wife. Some of this is due to time shifting my day to better match European colleagues, but some of it is due to Canonical's focus on project management and communication in a distributed environment, which help to make work time very productive.

Some of my pet projects and hobbies languished a bit in 2009. Anytime you take a new job, this is to be expected. I didn't get the number of books read that I would have liked. I also didn't spend much time in world in Second Life, due to older hardware issues making the experience not so nice. So I want to read more and spend more time in world in Second Life. Discipline will help with the first, and the new laptop I got at Christmas will help with the second. I want to do some personal hacking a bit more, which is what I've always used Second Life for, honestly -- a bit of in world scripting to work on 3D math and similar concepts, viewer hacking to work on my C/C++ skills. I'm planning to work on being disciplined in releasing more of my personal, social-site hacking stuff, too, which is all Python and Django. I've swallowed the lean kool-aid, and I'm on a war against leaving work in progress. In everything personal and professional, I'm taking a task and seeing it through to completion before moving on to something new.

I guess that's my new year's resolution, if I have one -- no unfinished work in progress in 2010! With any luck, I won't wait until 2011 to post here again about how that's working out for me.

Link | Posted by deryck on January 10, 2010 | 0 comments

Kindle Crapped with Black Lines but Amazon Customer Service Rocks

I woke up Saturday morning and reached for my Kindle only to find the screen went boom when I slid the power switch to wake the device. Black lines filled the screen and the device was unusable.

This is what it looked like:

Kindle Screen Gone Bad

I have no idea what caused the screen to do this. I didn't use the device for about a week. It was sitting on my desk on top of a stack of paper books. Nothing was on top of the device and nothing around it.

Today my replacement Kindle arrived via FedEx. I only found time to call Amazon about the problem yesterday. Amazon's customer service rocks. I waited so long because I thought this was going to be a pain to deal with. The Kindle support site was nicely setup. It guided me through a form to submit a support ticket, and then the follow up email walked me through making a call to Amazon. A five minute phone call later, I had a new Kindle en-route, I assume covered by the warranty.

So while it was a bummer to have this happen, Amazon really is to be commended for making it better quickly.

Link | Posted by deryck on December 15, 2009 | 2 comments

Neil Gaiman Has My Dog

Pictures from Gaiman's recent post, What I plan to do this week show that his dog and mine could be twins.

The resemblance is uncanny. Except that my dog, Macy, has about 50 pounds on Gaiman's dog. I don't have any current pics of Macy but I'll try to snap a couple today.

I would include the pics, but can't. Go to his site and see for yourself.

This confirms my impeccable tastes, btw.

Link | Posted by deryck on December 11, 2009 | 0 comments

Book review: Web Component Development with Zope 3

Web Component Development with Zope 3

Web Component Development with Zope 3 by Philipp von Weitershausen

This is a good introduction to Zope 3. I've been reading it off and on since I started working on Launchpad, which uses Zope. The book was good for helping me get the terms and conventions of Zope development, but Launchpad has a very particular use of Zope 3. Some of the more general web dev uses of Zope 3 covered in the book don't apply, for that reason.

But still, this is a good overview of web development using Zope 3. I would recommend the book if you're trying to get up to speed with Zope.

View all my reviews

Link | Posted by deryck on November 28, 2009 | 0 comments

5 Years of Ubuntu

Yesterday was 5 years to the day from the first Ubuntu release, Warty Warthog. 8 days from now we will have the eleventh release, Karmic Koala. I say "we" because I work for Canonical now. While I don't have the historical context that those who have been working on Ubuntu from the beginning have, I do share a sense of wonder at what the last 5 years have been for Ubuntu.

I don't work on Ubuntu at Canonical; I work on Launchpad. But I still feel very much a part of the development process of Ubuntu, just because Ubuntu is so tightly bound to Launchpad. I have to say, too, that Canonical is unlike any company I have ever worked for. Everyone I work with -- literally everyone -- is smart, kind, generous, motivated, and generally a pleasure to work with. To me, this speaks to the heart of what Ubuntu is and what it means to me. Community, collaboration, and a more human computing experience are not just concepts weaved into Ubuntu, but literally, it's the ethos of the people involved in the project and in Canonical.

So my day to day experience of using Ubuntu and hacking on code that contributes to shipping an Ubuntu release is an experience of the best parts of humanity and software development. And I'm quite glad for the opportunity.

Here's to the last 5 years of Ubuntu! I hope I can keep this front-row seat for the next 5, and beyond.

Link | Posted by deryck on October 21, 2009 | 0 comments

Taking on a New Role in Launchpad

Today marked my official start as team lead for my team on Launchpad. I work on the Launchpad bugs app, a.k.a malone, for those who might know yet know. I've only been working for Canonical and working on Launchpad for a little over 4 months, so it's an incredible honor to be given this responsibility. Each of my co-workers is an amazing coder, each one with an impressive set of skills, backgrounds, and abilities. I've counted myself lucky every day since I joined Canonical to get to work with Abel, Gavin, Graham, and Tom.

So I'm going to try hard not to suck as a team lead. :)

Here's to two weeks down, and a few more to go as we close out Launchpad 3.0, and many more after that as we plan and work out the next year of Launchpad 4.0 development.

Link | Posted by deryck on September 3, 2009 | 0 comments

Book review: Sag Harbor

Sag Harbor: A Novel

Sag Harbor: A Novel by Colson Whitehead

I spent all summer on this book. I enjoyed my time in Sag Harbor so much that I couldn't bring myself to finish the book, even as I waited anxiously between reading spurts. The characters are so richly and lovingly drawn, the community is vivid. I just can't say enough good things about this book. When I finished, I wanted to start it again. Right then. I'm not sure if I've ever had that feeling about a book.

I've been a fan of Colson Whitehead since his first novel, The Intuitionist. I read Apex Hides the Hurt, too. I liked each of these, and liked them a lot even, but it's Sag Harbor that really has won my heart. This is a beautiful story about growing up in the 1980s that I could really identify with. And I could go on, on, on. It's really just that good.

View all my reviews.

Link | Posted by deryck on August 24, 2009 | 0 comments

Testing for undefined variables in JavaScript

There are all manner of tests for undefined in JavaScript it seems. if typeof(foo) == 'undefined' or foo === undefined. So when should you use which?

The following shell example explains:


deryck@domino:~$ js
js> foo === undefined;
typein:10: ReferenceError: foo is not defined
js> typeof(foo) == 'undefined';
true
js> var foo;
js> foo === undefined;
true
  

In browser, there is also the window.foo === undefined construction, instead of typeof(foo), but the latter seems clearer in code to me.

Link | Posted by deryck on July 23, 2009 | 0 comments

Launchpad Available As Free Software

Today Launchpad source code has been made available as free/open source software under the GNU AGPLv3. This is a very exciting day for those of us working on Launchpad. I am quite proud that I was actually awake last night when the announcement appeared.

I noticed Jono Lange changed the topic in #launchpad on irc.freenode.net somewhere near midnight my local time. Almost immediately after, I found Karl Fogel's email to our Launchpad list announcing the open sourcing. I'm generally in bed that late; however, I was trying to get a merge proposal submitted before I went to bed, and then, I had some hacking to do on a personal project I'm working on. I am glad circumstances contributed to my being awake when the moment of open sourcing came.

I would really encourage any free/open source developer to look closely at Launchpad for project hosting (or just code hosting, bug tracking, mailing lists, etc. or any combination thereof). The code is freely available, and you'll find a group of developers at Canonical who are excited about seeing Launchpad succeed as both a great collaboration platform and a free software project itself.

Link | Posted by deryck on July 21, 2009 | 0 comments

An if-substring-in-string Django Template Construction

Here's a quick tip for Django template hackers. It's a known fact of Django templates that the syntax is purposefully limited. I've been living with the need for an if-substring-in-string construction. Of course, I could write a custom template tag, but work is quite busy. So on a whim and a 10 minute break I tried this yesterday, and it worked well for me. Take a look and let me know what you think.

First, the problem.

Bookmark Formatting

I have a custom app for pulling in my Delicious bookmarks and formatting them as link posts here on this site. I include the HTML I want in the original bookmark and have a bit of template code to insert preview images generated by ShrinkTheWeb. When I link a YouTube video, I do a quick cut-n-paste of the video to embed the player, and in these cases, I don't want to include the preview image. In Python, this would be super simple:


if 'http://www.youtube.com/' not in link_url:
    show_thumb()

However, Django templates don't have a similiar syntax.

A Solution Using {% with %}

So here's what I did:


{% with link_url|slice:":23" as short_url %}
  {% ifnotequal short_url "http://www.youtube.com/" %}
    My ShrinkTheWeb image goes here.
  {% endifnotequal %}
    Other HTML common to all links goes here.
{% endwith %}

What do others think? A decent solution? There are some issues; if I want to use multiple video sites, for example. At that point, I would be better to use link categories or a custom tag. But for a 10 minute fix, I think it's quite nice.

Link | Posted by deryck on July 3, 2009 | 4 comments

When JavaScript Attacks, errrr, Hacks

I've been doing a lot of JavaScript coding in my recent work on Launchpad. I mean, a lot! We're pushing to get every aspect of a bug page editable within the page itself, hopefully making it easier to manage bugs without being directed to another web page. Everyone on the Launchpad bugs team is working on some part of this. I haven't previously done any JavaScript coding like this, and now I'm sitting with a 1400 line JavaScript file that has grown unwieldy and needs to be tamed. I'm starting on that refactor this morning and thinking on the things I've learned as this file has grown seemingly with a mind of its own.

I should note some of the conditions that led to this. I wrote that I haven't done JavaScript like this before, but it's not as if I lack experience with js. I've done a lot of JavaScript coding both in previous jobs and for fun, everything from minor usability improvments to extensive page functionality in JavaScript. I've taught conference tutorials on AJAX and was even working on a book on Google's use of JavaScript in it's apps. (Yes, I'm a failed tech book author at this point, but the point is still valid, I think.) But all the work I've done previously either started in JavaScript and added server components as needed, or started with the server-side and added JavaScript in targeted areas. This work we're doing on Launchpad bugs has an existing, sophisticated server component -- the bug tracker -- and now needs an extensive JavaScript application built on top of that. Adding complexity is that the JavaScript component is being built piece-by-piece in small branches, rather than with a cohesive architecture. And by several developers at once.

It's this part about building an extensive JavaScript application in pieces that is really the new part for me, and I've learned some things I'll carry foward in terms of how to build a nice JavaScript module in small bites.

Global Module vars

Sticking variables into the global namespace of a module (so multiple functions have access to the variables) is now my sure sign that I need to refactor. From here on, I'll create an object rather than doing this.

This seems obvious but we're using YUI3 where each module is akin to an object itself, so it wasn't that clear to me. I would avoid module-level globals, even inside the module pattern itself, and create distinct objects the moment I begin to need state across objects or functions.

Closures

Again, YUI's module pattern and the way our Launchpad API is designed encourage callbacks via anonymous function closures, especially when dealing with XMLHttpRequest. And really this is a fine thing, and a common pattern when doing async js coding. But it's easy to let the closures get out of hand, which makes the code harder to read and maintain and makes debugging a bit harder, too. So I'm trying to use closures only as I have to.

Custom Events

Given the previous point, I think it's good to fire custom events to signal when to do some work. A custom event when an XHR has completed, or a custom event when it's time to update the DOM. A custom event when some state is initialized, and so on. Custom events are my new mantra going forward.

Perhaps I'll look back after this refactor and feel I've abused this pattern as well, but I think it will be cleaner and will be easier to test.

Patterns for Reuse

And finally, the next time I get into some extended bit of JavaScript work, I'm going to think about the patterns I'll be using and about the overall architecture earlier. Even though I'm sure I'll still be doing small branches that add small bits of functionality, I'll try to look ahead more to where this code might be reused across Launchpad, where this pattern of functionality or interaction might be repeated, and where the code I'm working in is likely to go over the next two cycles.

Link | Posted by deryck on June 26, 2009 | 0 comments

The Early Morning Internets

Most everyone I work with knows this, but friends and family may not -- so just in case you haven't heard -- my work schedule (which means the time I am available online) has changed since I joined Canonical. I am now up very early to better match European time zones, where the other members of the Launchpad bugs team are located. How early, you ask?

I wake at 4:30 am, and I'm at work by 5:00.

A pause while that sinks in on all my musician friends.

Work hours are now 5:00am-2:00pm, but in practice I knock off closer to 2:30 or 3:00. I try to avoid being online after that. I usually spend the afternoons playing with kids, cleaning the house or yard, or other such family/home activities. I usually come back in the evenings for an hour or two of work before I go to bed, but I rarely jump on IM or IRC in the evenings -- evenings are for quite work. Note the usually in the previous sentence. This is not a work requirement -- have I mentioned Canonical really is the best employer! -- and in the summer I'm finding it harder to find time in the evenings with the kids out of school and staying up later. Usually, the girls collapse by 7:00-7:30 on school nights, so I enjoy coming back to the laptop for an hour or two to unwind. Sometimes this is work-related, and sometimes it's just for fun hacking (which may even be work-related still, believe it or not!)

So all of this is to say, if you want to or need to catch me online via IM or IRC, make it happen from 5:00am-2:00pm CST. For you west-coasters I may never see you online again, so ping me out a day early if I need to stay around to catch up with you. :)

While the schedule is different for me in terms of my time online, it really is the perfect schedule for me. I'm focused early, getting a lot of work done, and enjoying working on Launchpad a whole lot. And then there's still time in the day for doing the things a husband and father likes to do.

Link | Posted by deryck on June 24, 2009 | 0 comments

For older posts, see the writing archives in the sidebar above.