Hacking Ubuntu on a Chromebook

In a few weeks time I’m going to be doing a bit of traveling for work and then a small holiday. As I will be hoping on and off planes and trains, I’m not really keen on taking my primary laptop as it is bulky and not really designed for travel.

After tossing up the pros and cons of tablets, netbooks, and ultrabooks I have bought a Acer C7 Google Chromebook and have managed to get Ubuntu 12.04 running inside a chroot environment. The whole process of getting Ubuntu installed has been much simpler than I was expecting.

For under $300 I now have basically a full lightweight system for travel on which I can watch videos, play music, edit documents, edit photos, and browse the web. While the basic Chrome OS operating system claims all these features, the reality is, it is extremely limited in what it is actually able to do.
Read more

Replacing titles with captions in WordPress gallery image links

Recently I have installed a colorbox plugin onto this blog for image galleries.

This plugin overrides the default behaviour of an image gallery and replaces individual image pages with a simple in-page pop up of the image. It works quite nicely, however, one problem I have had is that it extracts the title attribute from the former page links rather than the caption of the image that it is displaying.

I have spent the last few days trying to figure out a way to get the behaviour I want out of the plugin. However, this has been much more difficult that expected, the code that generates the galleries in WordPress is buried deep in the code and isn’t as straight-forward as replacing title=getTitle with title=getCaption. Trying to edit the behaviour of the jquery on the colorbox plugin isn’t an option either as it is heavily optimised. And updating every database row to replace the title with the caption also isn’t very practical.

Instead the simple hack below will achieve what I want. It isn’t pretty and I am still looking for a better solution, but in the meantime after the page has been rendered the jquery quickly looks for galleries and replaces the titles in any links with the alt text from the image. This means that when an image loads in the colorbox it displays with a caption.

<script type="text/javascript">
jQuery(document).ready(function($) {
 $('.gallery img').each(function() { 
  $(this).parent().attr('title',$(this).attr('alt')); 
 });
});
</script>

Bumblebee, Optimus, Hybrid Graphics, and Ubuntu

For the last year or so I have been struggling with my laptop overheating under Ubuntu. Upon upgrading to the latest beta of Ubuntu 12.10 I have managed to completely solve the heating problem and as a result increased my battery life by more than an hour.

Two different problems have caused the heating problem. The first, a power-regression bug on i7 processors was resolved in Ubuntu 12.04 with an updated kernel.

The second is caused by the Nvidia Optimus Hybrid Graphics card in my laptop not being properly controlled by Ubuntu. Problems with Hybrid Graphics under linux are well documented and there are quite a few different “solutions” available, however, I have been unable to get any to work until now.

A few months back I installed the Bumblebee project, and despite the packages successfully installing, the hybrid graphics card never worked and battery life remained terrible.

Upon upgrading to the latest Ubuntu beta I noticed a problem in the logs during the install of one of the bumblebee packages: bbswitch-dkms

The package would “successfully” install, however, the terminal output would show that the kernel module was never built.

The problem lies in missing kernel header packages. While the Ubuntu Wiki pages do not detail any requirement for the installation of kernel headers other sites do, however, these other sites only focus on the kernel headers for the currently installed kernel. And, if you update the kernel without new headers, it is possible that the kernel module will no longer work and the overheating problem will return.

This is how I setup my system so that I would always have the latest official Ubuntu kernel and headers with bumblebee working:

1. Install the linux-headers-generic package:
sudo apt-get install linux-headers-generic

2. Setup the Bumblebee PPA:
sudo add-apt-repository ppa:bumblebee/stable

3. Update the package information:
sudo apt-get update

4. Install the bbswitch-dkms package:
sudo apt-get install bbswitch-dkms

Before moving on make sure that the output from the above command shows that the module was successfully installed.

5. Install the rest of Bumblebee:
sudo apt-get install bumblebee bumblebee-nvidia

6. Restart and then test if Bumblebee is working:
a) glxgears
b) optirun glxgears

The second command runs the opengl test using the Optimus graphics card and the output in terminal of the FPS should be much greater than the previous command. Bumblebee should now be successfully installed and you should notice a large decrease in CPU heat and an increase in battery life.

In my opinion during the install of the bbswitch-dkms package a check should be made for the required kernel headers to build the kernel module, if the packages aren’t found a proper error and suggested solution, such as the installation of the headers package should be suggested. A silent fail that keeps the rest of the installation running only provides the end user that false hope that things are working fine.

Recovering from Grub Rescue after upgrading to Ubuntu 11.04

Over the weekend I upgraded one of my computers to the new beta of Ubuntu. Upon restarting the computer I got dumped into grub-rescue with the message missing-xputs. Part of the cause of this was having Adobe CS3 installed in my dual boot with Windows 7.

When you install Adobe products a little DRM program called FlexNet gets installed into your boot sector which is also where grub resides. When grub is upgraded along with Ubuntu it flicks a warning about the FlexNet being in the sector but then continues to install. However, when you restart grub will not run and will be unable to boot your system into either Ubuntu or Windows.

Read more

Photos: Queen Elizabeth and Queen Mary 2 in Sydney

On Tuesday both the Queen Elizabeth and Queen Mary 2 super cruise ships were in Sydney. I went down to the harbour to get some photos after work.

Both ships are absolutely huge. But what I was surprised by is that they were not as big as I was expecting. I think these days man’s quest for bigger, stronger, faster, further is almost complete so we are so used to seeing big things that they don’t take your breathe away as much as in the past. Having said that these ships dwarf everything else.

Read more

Getting USB Browser Mice to work in Vista

I have had this issue with a number of mice and a number of different computers now. Some older USB mice will not work when you plug them into Windows Vista. What happens is a dialog appears saying installing software and then fails saying unknown device.

The fix for this as I just found out this morning is quite simple:

  • Click on start
  • Right click on computer
  • Select properties
  • On the left side of the dialog that comes up select device manager
  • Scroll down the list of devices to the known device
  • Right click and select Update Driver Software
  • Select chose from a list of drivers
  • Select Human Interface Device
  • Select HID compliant mouse
  • Click okay and the mouse should now work

Simple. And Windows had the drivers to make it work all along! Sometimes Windows does some really simple things wrong and as a result is just so frustrating. It is a mouse it should just work!