April 2008

Review Board presentation at LugRadio Live 2008

This year’s LugRadio Live USA conference was a blast. There were some great talks, interesting booths, and fun swag.

The Review Board presentation went pretty well. I think in my next presentation I’ll demo more often instead of just at the end, but all in all people seemed to find it interesting. The presentation focused on what Review Board is, how it works, and how it could benefit open source. With luck, it will encourage projects to begin using a real code review system, making life easier for all involved.

For those that missed it, the slides and the presentation video are now available. Enjoy!

Django Development with Djblets: Unrooting your URLs

Typically, Django sites are designed with the assumption that they’ll have a domain or subdomain to themselves. Often times this is fine, but if you’re developing a web application designed for redistribution, sometimes you can’t make that assumption.

During development of Review Board, many of our users wanted the ability to install Review Board into a subdirectory of one of their domains, rather than a subdomain.

There’s a few rules that are important when making your site relocatable:

  • Always use MEDIA_URL when referring to your media directory, so that people can customize where they put their media files.
  • Don’t hard-code URLs in templates. Use the {% url %} tag or get_absolute_url() when possible.

These solve some of the issues, but doesn’t address relocating a Django site to a subdirectory.

Djblets fills in this gap by providing a special URL handler designed to act as a prefix for all your projects’ URLs. To make use of this, you need to modify your settings.py file as follows:

settings.py

TEMPLATE_CONTEXT_PROCESSORS = (
    ...
    'djblets.util.context_processors.siteRoot',
)

SITE_ROOT_URLCONF = 'yourproject.urls'
ROOT_URLCONF = 'djblets.util.rooturl'

SITE_ROOT = '/'

SITE_ROOT specifies where the site is located. By default, this should be “/”, but this can be changed to point to any path. For example, “/myproject/”. Note that it should always have a leading and a trailing slash.

The custom template context processor (djblets.util.context_processors.siteRoot) will make SITE_ROOT accessible to templates.

SITE_ROOT should be used in templates when you need to refer to URLs that aren’t designed to respect SITE_ROOT (such as User.get_absolute_url). Your own custom applications should always respect SITE_ROOT whenever providing a URL.

ROOT_URLCONF is typically what you would set to point to your project’s URL. However, in this case, you’ll be pointing it to djblets.util.rooturl. This in turn will forward all URLs to your project’s handler, defined in SITE_ROOT_URLCONF.

This is all you need to have a fully relocatable Django site!

To sum up:

  1. Add djblets.util.context_processors.siteRoot to your TEMPLATE_CONTEXT_PROCESSORS.
  2. Set SITE_ROOT_URLCONF to your project’s URL handler.
  3. Set ROOT_URLCONF to ‘djblets.util.rooturl’
  4. Prefix any URLs with SITE_ROOT in your templates, unless the URL would already take SITE_ROOT into account.

This is functionality that will hopefully make its way into Django at some point. For now, you have an easy way of unrooting your Django project.

Workstation 6.5 Beta 1 – Now with 100% more Unity!

I talked a little while ago about working outside the box with Unity. At that time I gave a sneak peak into what I’ve been working here at VMware the past few months. Well, now everyone can see.

We just announced VMware Workstation 6.5 beta 1, the first public beta for Workstation 6.5. Among many other awesome features is Unity, a feature we introduced in our Fusion product (for MacOS X) which allows you to run your applications from your virtual machine on your desktop without needing to be confined to a big box representing the VM’s monitor.

Unity is available in both our Linux and Windows releases of Workstation 6.5 beta 1, and there’s currently support for Windows guests (Windows 2000 and up). However, it’s a beta so you can expect some problems. To help people get started, here’s a rundown on what you can expect from Unity in beta 1.

Features Overview:

  • Shaped windows
  • Guest mouse cursors
  • Proper window types for most windows (Menu, Dialog, Tooltip, etc.)
  • Special effects with Compiz
  • Virtual desktops
  • Copy and paste between host and guest
  • Start menu integration
  • Window borders and badges

Seamless window integration

With the press of a button, the applications in your virtual machine will pop out and appear on your desktop, intermixed with all your native applications. These windows can stack in any order along with your native windows and will maximize, minimize, and close as you’d expect any normal window to. They’ll appear just like they would in the guest, aside from any borders or badges you have set to help identify the guest windows (more on that in a minute).

We do our best to set the window types on these windows to best reflect their type in the guest. This means that a tooltip from the guest will look and act like a tooltip in the host, as will a dialog, menu, etc. This is important for supporting the special effects provided by a window manager.

Special effects

If your window manager has any special effects set for the windows, they’ll apply to guest windows. For example, users of Compiz will be glad to know that their wobbly windows will work for such applications as Office 2008 or Minesweeper, and your guest menus will still burst into flames when they appear.

There are a few cases where the effect isn’t as strong as with native windows. Due to the way we receive window updates and events, the display of a window will often update before we receive open, close or minimize events. We plan to make this work better for some event types in the next beta, but for now, I recommend choosing special effects that modify a window in-place (fire, fade-in, etc.) instead of one that zooms a window to a location for opening/closing windows.

Wobbly Windows

Virtual desktops

Windows may not natively have virtual desktop support, but Linux does, so we felt it was important to make virtual desktops with Unity just work. You can place your guest applications across your virtual desktops. Maximize Office on one desktop, play a game of Solitaire on another, and reserve a third for your Internet Explorer debugging session.

Unity with Virtual Desktops

Copy and paste

Copy and paste is an important part of any user’s daily work. We currently have support for copying and pasting text between host and guest. You can’t yet copy and paste images or other data, though.

Start menu integration

Helper’s Head

A desktop environment isn’t useful without the ability to get to your programs. We provide a little tool called Unity Helper that runs automatically and provides start menu integration. Simply move your mouse to the top-left corner of your primary monitor and the menu will pop down, providing a start button for each of your VMs in Unity. Click the button and your start menu’s contents will appear.

The start button will match the color of the Unity badges and borders that are set to help you quickly identify your VM.

This functionality is pretty new so there are some kinks to work out. For example, if you don’t have a top panel or your top panel is larger than 24 pixels, you might notice the window in a wrong location. This is a bug that will be fixed in beta 2. We’re also hoping to add more options for the location of this window.

Applications Menu

Another useful tip is that you can use Unity Helper to launch applications in a guest via the panel or command line. Simply run:

 $ vmware-unity-helper --run /path/to/vm.vmx c:\path\to\program.exe arguments

This only works if your VM is currently powered on and in Unity or if the VM is not open anywhere. It’s not a supported feature at this point.

Borders and badges

In order to help identify a window belonging to a particular VM, we have color-coded badges and borders on the Unity windows. The border goes around the window and fades from corner to corner, and the badge is a little VMware logo sitting on your titlebar. Both are purely decorative and optional. You can turn them on or off in VM Settings or change the color. The color will also match the start button.

Badges and Borders

Known bugs (and workarounds)

As with any beta, there are of course bugs that you may hit. Pay special attention to the first item on the list.

  • Start menu problems after a crash. If there’s a crash, sometimes the start menu integration won’t work the next session. The trick is to exit Workstation (leave the VM running in the background), delete /tmp/vmware-$USER/unity-helper-ipc-*, and bring Workstation back up.
  • Occasionally Unity may crash. This is a known bug when a guest window changes its type when we don’t expect it. If you hit this, don’t worry! Your VM is still running in the background. Just re-launch Workstation or Player and go back into Unity mode.
  • Graphics glitches. Sometimes you’ll notice the background appearing when you close or minimize a window. We hope to fix this up for the next beta.
  • Multiple monitors are not supported in beta 1.
  • Drag and drop is not supported in beta 1.
  • Due to a recent regression just before beta 1, there are graphical glitches for applications not on the current desktop.
  • Some applications behave badly. Photoshop and Flash (the creation program, not the plugin) (ab)use windows all over the place, and so you’ll see windows where you wouldn’t expect them. Sometimes they don’t even get proper updates, making the UI unusable. We’re looking into solutions for this.

There’s more, but those are the main ones I can think of that people may hit.

Give it a try and feel free to report bugs in the user forums.

Scroll to Top