Botching the Trivial

As a developer, I’m used to screwing things up. It comes with the job, and that’s why we have beta testers, QA, and code reviewers. You get used to it, and usually it ends up not being too big a deal.

What’s really embarrassing is when the screwup is literally staring you in the face and makes it into a major release. This was the case with the VMware Workstation and Player application icons in Workstation 6.0.

During development of Workstation 6.0, I felt the icon set needed a refresh. We try to fit in well with the GNOME desktop, and our icons just didn’t match. They weren’t bad, but they could have been better. I spent a lot of my free time creating a new set of icons for the application in the Tango style. This included application icons.

Our previous application icons were beveled and out of place in a Tango-themed desktop, so I replaced those as well. The result was really nice. After getting people to look at them, I committed them and wrote scripts to install all our fancy new icons with the product.

But something wasn’t quite right. I knew it but didn’t really think about it until after the release. There was something about the icons in the panel and menus. They looked fine on my development system toward the end of the Workstation 6 development cycle, but didn’t look right when I next installed a build on that system. I guess I shrugged it off as just being something screwy with my setup, but when I installed Workstation 6 on my laptop, the icons still looked wrong.

They were blurry. I made nice crisp icons! Where did these blurry ones come from? I figured it had to do with my panel size and that it scaled the 24×24 ones down to 22×22. That must be it, I thought.

It wasn’t until a couple of days ago when I finally decided to look into this thoroughly. What I saw made me so sad. The .desktop files for the applications contained:

Icon=/usr/share/icons/hicolor/48x48/apps/vmware-workstation.png

Yes. I never updated the old .desktop file generation code to use an icontheme name. It was still using the really old code querying the 48×48 icon we used to ship.

I suddenly realized why it used to look fine on my box. When I first tested these icons, I hand-modified my .desktop file to test the icons. It wasn’t until I installed a new build that I got the shipped .desktop file.

As you can imagine, I felt like an idiot. I decided to fix this quietly without making my idiocy too obvious to everyone else. (Don’t tell anyone, please. They think I’m smart.)

Just to give a sense, here’s a before and after shot.

Before
Broken WS6 icons

After
Fixed WS6 icons

Ah, much better. We have pretty icons again! Of course, had I fixed one single line of code and looked at a generated .desktop file once before release, that wouldn’t have happened.

But everyone makes at least one stupid mistake in a release, right?

Botching the Trivial Read More »

Django Development with Djblets: Custom Tag Helpers

I’m planning to cover all of what Django can do, but for now, let’s start simple with something most Django developers spend way too much time creating: Custom tags.

Django’s nice enough to provide a @register.simple_tag decorator for creating very basic tags that don’t take a context but do take parameters. This is great, but what if you want more? Many Django applications use the same boilerplate time and time again to create their tags, but we make it much easier.

Introducing @basictag and @blocktag.

@basictag

Ever wanted to use Django’s @register.simple_tag but needed access to the context? I’ve found far too many cases where this would be useful, but Django doesn’t make this easy. Your tag code would end up looking like this:

class MyTagNode(template.Node):
    def __init__(self, arg1, arg2):
        self.arg1 = arg1
        self.arg2 = arg2

    def render(self, context):
        arg1 = Variable(self.arg1).resolve(context)
        arg2 = Variable(self.arg2).resolve(context)

        return context['user']

@register.tag
def mytag(parser, token):
    bits = token.split_contents()
    return MyTagNode(bits[1], bits[2])

Do this a few times and it’s bound to drive you nuts. How about this instead?

from djblets.util.decorators import basictag

@register.tag
@basictag(takes_context=True)
def mytag(context, arg1, arg2):
    return context['user']

Far less code and increased readability. Hooray!

@blocktag

@blocktag aims to do the same thing @basictag does but for block tags. A block tag is a tag that contains nested content, like @spaceless or @for. This usually requires even more boilerplate than the above code fragment, except with the added complexity of having to grab the contents of the block.

We’ve condensed it down to this:

from djblets.util.decorators import blocktag

@register.tag
@blocktag
def blinkblock(context, nodelist, arg1, arg2):
    return "<blink>%s</blink>" % nodelist.render(context)

If you’ve built block tags in the past, you’ll appreciate how simple that was.

Django Development with Djblets: Custom Tag Helpers Read More »

Django Development with Djblets

Django is an awesome development platform for web applications. With such features as database abstraction, template/view/url separation, built-in authentication with interchangeable backends, it’s made web development much more enjoyable.

We use Django in Review Board with much success. Over time, as we’ve come to develop new features, we realized that much of our codebase was useful outside of Review Board and, bit by bit, moved pieces into a library we call Djblets.

What does Djblets do?

A bit of everything, really. Any time we have useful functionality that isn’t tied to Review Board, we put it here.

Djblet’s feature list currently consists of:

  • Authentication improvements, making it easy to register and login in one step, seamlessly, handle password recovery, and more.
  • Flexible datagrids for displaying data in a paginated list with user-specific column customization, ordering and sorting.
  • Decorators to drastically simplify creation of simple and block template tags.
  • Caching functions for calling a function and caching the result if the data isn’t already in the cache, and a special URL pattern matcher that prevents caching of any contained URLs.
  • Unit testing utility classes.

And of course more little things here and there.

Downloading Djblets

Djblets is not a released app, but it’s pretty stable and well tested. You can check out a copy from our SVN repository, or automatically include it in your own repository through an svn:externals entry.

Djblets is licensed under the MIT license, making it usable in most projects.

Using Djblets

Over time I’ll be writing articles on using the many features of Djblets. See the other posts in the series, or dig around the Djblets source code.

Django Development with Djblets Read More »

Dear Lazyweb: Shadows and Shaped Windows

I’ve been trying for a couple of days to figure out why a shaped window in Compiz doesn’t have a shadow. After looking through the Emerald and GTK+ decorators’ code, it seems that they only apply a shadow if the window has a titlebar decoration. This seems quite silly and limiting. Does anybody know of a way around this, or why we’re limited in such a way? Is this something that could be fixed?

Love,

Christian

Dear Lazyweb: Shadows and Shaped Windows Read More »

Review Board: The Past 5 Months

It’s been about 5 months since I last gave a Review Board status update. Way too long, given how much has changed. So once again, let’s start off with a few stats.

  • Total bugs open: 25
  • Total bugs fixed: 186
  • Feature requests open: 43
  • Companies known to be using Review Board: at least 23

Review Board has matured in recent months and has a very nice feature set. More and more we’re seeing and hearing about companies using it in one or more teams. I was even lucky enough to talk about it in the official Django Book.

Development shows no sign of stalling. Our feature request list is a mile long, and our personal TODO lists are longer still. We’ve implemented so many new features and fixed so many bugs that I can’t even list them all, but let’s take a look at the highlights.

New Top-Level Features

  • iPhone support. Basic read-only iPhone support was added. It’s more of a proof of concept and to make sure our codebase handles different UIs on top of it, but if your Review Board server is accessible from your iPhone, point Safari to /iphone/ for some fun.
  • Status Reports. Basic support for status reports have been added. While we don’t have a fleshed out UI in place, the /reports/ URL will give you simple reports showing which review requests you’ve reviewed, and other bits of information. This can even be presented in Wiki format!

Revision Control Systems Integration

  • Mercurial support. One of our contributors has written support for doing review requests against Mercurial repositories. This supports local and remote repositories.
  • Git support. Basic Git support was written as well. It only works with local Git repositories (as it has to have access to .git directories).

Diff Viewer

  • Improved diff parser. We no longer require third party tools in order to parse diff files. We can do it ourselves faster and with greater flexibility. This has given us some speed advantages, reduced the hacks needed, and improved diff compatibility.
  • Interdiffs. Review Board can now display the differences between two revisions of a diff. This makes it much easier to review several iterations of large changes spanning many files.
  • Fixed diff line numbers. Line numbers in the diff viewer used to be artificial. They were essentially table row numbers. Now line numbers on the left-hand side of the diff viewer represent the actual line numbers in the original file, and line numbers on the right represent the new file.
  • “Review” link. Added a “Review” link on the diff viewer and screenshot page for bringing up the Review dialog. Previously users had to click a link on the diff viewer regardless of whether they were leaving a comment on the diff.

Reviews

  • Show commented screenshots on reviews. Portions of a screenshot that the user has commented on will appear in the review body, much like diff fragments do. This greatly improves the review process when it comes to screenshots.
  • Updated diffs create a new draft. Newly updated diffs used to instantly appear and send out an e-mail, which was annoying if you realized you needed to change and re-upload the diff again. Now updating the diff just creates a draft, if one doesn’t already exist. The diff won’t show up or spam users until you’re ready for it to.
  • Auto-completion for reviewers. The reviewer lists now have support for auto-completion of group names and usernames. As you’re typing, a list of choices based on the current text will appear. Navigating with the arrow keys or hitting Tab will auto-complete the selected entry.
  • Default reviewers. Administrators can now specify default reviewers for file paths (as defined by a regular expression). This allows certain groups to “own” files or paths and to be included on the reviewers list any time a diff touching those is uploaded.
  • Improved page banners. The draft banner at the top of the review request page has been improved and is now more clear. No longer do you have to save a draft and then publish it. It’s now one single button on the banner. We also added “discarded” and “submitted” banners.
  • Alpha-numeric bug numbers. Not all bug trackers use numeric-only bug identifiers. We now support alpha-numeric bug numbers.

Dashboard and Review Request Lists

  • Starred review requests and groups. Users can now “star” a review request they wish to keep track of in their dashboard. They’ll be placed on the CC list and see changes in the dashboard. Users can also star a group in order to add it to their “Watched Groups” list in the dashboard.
  • Toggle display of submitted review requests. The “All Review Requests” page can now filter out submitted review requests via a toggleable “Show/Hide Review Requests” link.
  • Customizable columns. The various lists pages and the dashboard now support customizable columns. There are non-default columns that can be added to the view to show extra data, and existing columns can be removed. If you prefer all dates to be relative or absolute, just add the right columns. Furthermore, columns can be reordered simply by dragging them into the desired order.
  • New dashboard column types:
    • New Updates. This column shows a speech bubble icon when new discussions have taken place on a review request since the user last visited it.
    • Ship It. This column makes it easy to see if anybody has marked the review request as “Ship It!”
    • Absolute/relative timestamps. Users wishing to see only relative or absolute timestamps in the dashboard can add the Last Updated/Posted Absolute or Relative timestamp columns.
    • Number of Reviews. Sometimes it’s handy to see how many reviews have been made to a review request. This column provides that number.
    • Starred. Allows users to star/unstar a review request or group. This is like adding yourself to a CC list.

post-review

  • Upload diffs from a revision range. --revision-range has been added to allow for uploading diffs from a range of revisions on the server. This is currently only implemented for SVN.
  • Specify a default summary. --summary has been added to provide a default summary for the review request.
  • Open a browser after uploading. --open has been added to open a browser to the new review request.

Distribution/Installation

  • make install. It’s now trivial to create a Review Board tarball or to install it on your system. We integrate with autoconf/automake to generate the Makefiles and sample/default configuration files. This brings us a giant step closer to putting out releases.

What’s Next?

We have several things in the works. A couple of the major highlights would be a search interface and support for 3rd party extensions to Review Board. Stay tuned!

Review Board: The Past 5 Months Read More »

Working outside the box with Unity

A Brief History of Boxes

In the days of old, working on your computer meant working inside a limited contained box. You could run programs but only one at a time, because running two at the same time would require two computers. This was the status quo for years. It’s just how computers worked.

Then a new technology changed everything. Multitasking. Now you could buy one computer and your operating system would allow you to run multiple programs at once. No longer were you tied to one box at a time. You could have one for your word processor, one for your spreadsheet, and one for solitaire. It was a spectacular invention, one that we quickly took for granted. Relatively few computer users today even know what it’s like to use a computer without this ability.

As time went on, new operating systems began to develop substantial user bases. The competition between them grew, and most applications were tied to a particular operating system. You were limited to one operating system at a time, and if you wanted to run two at once you would need two computers.

Then came modern virtualization, which shattered this barrier. Now you could have one or more giant boxes on your computer containing a full operating system, each with different applications running. These boxes could sit side by side. Some people are already taking it for granted. Soon grade school children will be using virtualization without even knowing that there was a world before it.

But up until now, working in a virtualized environment meant working in a big box on your screen. Sure you could have several going at once, but you realistically could only interact with one at a time. These boxes represented screens, and you can only fit so many screens on a single screen at once before you start feeling really cramped.

Shattering the box

Earlier this year, we released VMware Fusion 1.0 for the Macintosh. This was our first virtualization product for the Mac and it has been met with high praise. And jealousy. VMware Fusion managed to change how users thought about virtualization. Thanks to Unity, you were no longer forced into having a big box on your screen. With the click of a button, the applications inside your virtual machine would appear outside of the box, sitting alongside your other applications. The Mac users loved this and Windows and Linux users were left feeling like they missed out.

I can’t recall how many times I’ve been asked if Workstation is going to include Unity in Workstation.

Unity
The answer is yes. Well, eventually.

I’m working on adding Unity support to the Linux codebase, which may in time be part of Workstation or Player. This will allow your Windows and Linux programs to intermingle with the click of a button. As of right now, here are the current state of things:

Unity Today

Unity today works in Linux on my system. It’s known to work in Metacity but hasn’t been thoroughly tested in other window managers yet. The basic things you’d expect all work for the most part. The rest will come later.

What I have working today

So far, the very basic window management works today, for the most part. It’s usable just enough to go “Oh neat” and to play a game of solitaire.

Many things do not work today, though.

  • Virtual desktops do not work. If you move windows to other desktops, you’ll have problems.
  • Multiple monitors might work but probably won’t.
  • Alt-dragging or otherwise moving a window in a way other than by using the titlebar will cause us to get out of sync.
  • If you attempt to drag a window off-screen, the window manager may block it, but the events will still be sent to the guest. This could cause the window to get “stuck.”
  • Minimizing a window using the taskbar may cause visual oddities.
  • Partially obscured windows may look wrong when in Compiz’s Expose mode or similar modes where all windows are displayed at once.
  • There’s no proper start menu integration. Exit Unity mode to launch new applications or press the Windows key or Control-escape while in a guest application to bring up the guest start menu.

These issues are being addressed. In many cases where windows become “stuck,” simply leaving Unity and then going back into it should fix the problem.

Going forward…

There’s a lot we have in the works for Unity, and while I cannot yet talk about it all, the end result should be just awesome. I’m hoping to have a video demoing it at some point.

P.S. For those who notice the borders and VMware logo badges on the Windows windows in the screenshot and find them annoying, you will be able to disable them. The idea is to allow you to easily determine the guest windows from the host windows when the OS and theme are the same.

Working outside the box with Unity Read More »

Everything breaks :(

So.. My Wii stopped reading discs. Just as I came home with Mario Galaxy. It makes some pretty sad clicking noises and then informs me that I should join in on its sadness.

I can’t say I’m at all surprised. I’m pretty good to my electronics. They just don’t return the favor. Let’s take a journey through the past.

  • 11 dead Palm PDAs (one right after the other until I got one that worked).
  • 7 dead harddrives in the past four years (latest 2 months ago).
  • Various fan problems, motherboard problems, display problems and keyboard problems across two different ThinkPads in the past two years.
  • 2 dead motherboards on two desktop computer (both mid-2006).
  • 1 dead LCD (a few months ago).
  • 1 dead DVD player (just a few months ago).
  • 1 dead MP3 player (just gave out one day).
  • 1 dead UPS (earlier this year, just stopped one day).
  • 1 dead car radio (a few months ago, just weeks after buying the car, which has always been in great condition).
  • 1 defective gear shift brake circuit (same car, couple weeks after the radio).
  • 1 dead Wii.

There’s more. I just can’t remember off-hand. Either the quality of everything sucks these days or anything electronic just commits suicide in my presence. I’m not sure which.

Everything breaks :( Read More »

Scroll to Top