I’ve been on the hunt for a new Linux Distribution for a while – Ubuntu 11.10 – while impressive – is too much for my seven year old laptop. I’m a bit disgusted really that with 704MB of available RAM that it doesn’t really work as snappily as a plain TTY
But, to be fair to Ubuntu I am running it on my work PC now as of yesterday and while there are some obvious annoyances (e.g. no panels in Unity, sometimes losing applications from the task switcher) it’s certainly a promising start. They tell me 12.04 is going to be well polished – ps. Good luck Thomi with the new job!
I’ve tried Linux Mint and again, the standard of this distribution is exceptional, but again the seven-year-old super-laptop grimaces a little too much under the weight.
This blog post is about installing Debian Testing from a USB key. I hunted around for how to do it and the answer wasn’t immediately apparent. There are tutorials that help you out by getting you to zcat a boot.img.gz onto your USB key, then copy the Debian ISO etc but this didn’t work for me. I think this was because the method was outdated and not compatible with the latest ISO.
By the way – don’t be put off by the term “testing” when it comes to Debian. The stable release may seem to be the likely choice and it is very stable – it hardly changes and is deliberately out of date. Only security updates are applied to it. This is suitable for a server environment, or for your mum if having slightly out of date applications isn’t an issue and you don’t want things changing on her. If you want a more up to date distribution that keeps pace with the latest applications, go for Debian Testing. If you want the bleeding edge latest developer release, go for Debian Unstable. You probably don’t want this though.
Anyway, back to the installation – fortunately the solution is very simple. Over here they say that the latest Debian ISO’s can be directly dd’d to a USB drive. This means that you can simply:
- Download the Debian Testing ISO (I chose the netinst ISO which will bootstrap me onto the network during the install process and then drag the rest off the internet as required)
- Plug in your USB key to your linux box
- Unmount it if it got automatically mounted (e.g. right click it on the desktop and choose unmount)
- Install it onto your USB key with the following command: dd if=/path/to/debian-testing-i386-netinst.iso of=/dev/sdd bs=1M
- When that has finished, boot your computer from your USB key and the Debian installer will lead you through the installation process (I’m at 87% currently)
Note that the of=/dev/sdd in bold above has to be the correct name of your USB key. You can find this out by plugging in your key and using the command “sudo fdisk -l” which will list all disk devices plugged into your computer. Look for the one that has just appeared and is the correct size.
Also note that when you issue the dd command that all information on your USB key will be overwritten. If you don’t know, the dd command can be used to take a file (generally) and write the contents of that file to a physical media (e.g. a hard drive, or a USB key) in such a way that it overwrites the entire filesystem on that device.
If you’re a night owl like me the first thing you do when you crank up your laptop at night is to bust down the brightness down to minimum to save yourself some eyestrain. After coming across a page showing The Best Of Linux Software I saw mention of a program called redshift. Redshift makes your screen redder by adjusting the gamma curves, and thus making your screen easier to see.
bob@bob-laptop:~$ sudo apt-get install redshift libnotify-bin
(libnotify is not required to run redshift, but is used by the script below).
The ocular science behind this is straightforward – to quote Wikipedia:
In biological night vision, molecules of rhodopsin in the rods of the eye undergo a change in shape as they absorb light. Rhodopsin is the chemical that allows night-vision, and is extremely sensitive to light. Exposed to a spectrum of light, the pigment immediately bleaches, and it takes about 30 minutes to regenerate fully, but most of the adaptation occurs within the first five or ten minutes in the dark. Rhodopsin in the human rods is less sensitive to the longer red wavelengths of light, so many people use red light to help preserve night vision as it only slowly depletes the eye’s rhodopsin stores in the rods and instead is viewed by the cones.
Anyway, the utility is simple enough to use, but requires that it be launched from the command line. I don’t mind that at all, but I don’t want the hassle of having to do that. Instead what I ended up doing was writing a wrapper script for redshift that I placed on my Gnome panel which would effectively toggle redshift on and off when I click the icon. Here’s the script:
#!/bin/bash
# Redshift toggle script
# @author: Bob Brown, gurubob@gmail.com
# @blog: http://www.guru.net.nz/
#
# Required packages: redshift libnotify-bin
# Lat/Long for Dunedin, New Zealand
LAT=-45.8
LONG=170.5
NOTIFYIMAGE=/usr/share/icons/Humanity/actions/22/object-inverse.svg
RUNNING=$( ps aux|grep redshift|grep -v grep|grep -v redshift.sh|wc -l )
if [ $RUNNING -gt 0 ]; then
notify-send -i $NOTIFYIMAGE "Stopping Redshift" "Redshift is shutting down"
killall redshift
else
notify-send -i $NOTIFYIMAGE "Starting Redshift" "Redshift has been started with your location as per $0"
/usr/bin/redshift -l $LAT:$LONG &
fi
You can see the script is straightforward and requires a little configuration – redshift requires your latitude and longitude as it adjusts the redshift of your screen based on the time of day, swinging between maximum redness at midnight and no redness during daylight hours (the website claims this, but I have not yet seen it as I’ve been running redshift for about an hour so far and it’s 12:13am). You can use this interactive map to find your latitude and longitude.
The shift to red is dramatic at first, especially going from the cool blue-white of maximum screen output but after a few minutes I find myself hardly noticing it at all. It will be interesting to see whether redshift finds a permanent place on my laptop.
By the way, there is a GTK front-end for redshift too and it works just as well. It allows you to toggle the application by right clicking the red lightbulb icon in the notification area of the gnome panel. Simply install it like so:
bob@bob-laptop:~$ sudo apt-get install gtk-redshift
and then place it into your startup applications in Gnome:
- System, Preferences, Startup Applications
- Click Add
- Enter “Redshift” for the name
- Enter /usr/bin/gtk-redshift -l YOURLAT:YOURLONG for the command (my command is /usr/bin/gtk-redshift -l -45:170, roughly)
- Click Add
Presumably now redshift will start when you log in.
The Cc and Bcc field sizes in Gmail are too small to work with if you’re sending to more than about 20 email addresses. The following bookmarklet will increase their height when used:
javascript:(function(){var%20e=window.frames[3].document.getElementsByTagName('textarea');%20for(i=0;i<e.length;i++){%20if(e[i].name=='cc'%20or%20e[i].name=='bcc')%20{%20e[i].style.height='150px';%20}%20};})();
To install (in Firefox).
- Right click on your Bookmarks toolbar and choose “New Bookmark”
- Enter a name for the Bookmark, e.g. “Big Cc Field”
- Into the location, paste the above code
- Save the bookmark
Now when at Gmail and you can see the Cc or Bcc fields you can click the new Bookmark link to make them bigger.
To find out more about Bookmarklets, check out the Bookmarklet page on Wikipedia.
You’re most probably familiar with the Web 2.0 reflection technique. This technique is used to make products appear as if they’re on a shiny surface. Apple most probably have it in use in their current campaign on the Apple website.
I was thinking about this technique as it can be quite fiddly to put together. Normally you would use Photoshop or The Gimp or Inkscape to apply a gradient to an existing image, and then save that image as a seperate one, making sure you keep your original should you need it.
I then realised that by using a combination of CSS background images, background-position and opacity you could reproduce this effect purely with HTML and CSS. I’m yet to wrap up the finer points but here’s the idea.
- Include your image on the page with an <img …/> tag as per usual.
- Underneath the image, include a number of 1px high empty <div> tags.
- On each div tag, set the background-image to be the same as the image referenced in step 1, set the background-position such that the 1px high div is displaying the correct row from the image, and set the opacity such that it fades out a little more on each subsequent div.
This image illustrates the effect up close:

My concerns at this point are:
- What effect will this technique have on older browsers?
- How will this break across browsers? (I’m assuming it won’t be perfect)
- The extra HTML for one image is maybe acceptable, but many images on a page would significant slow down load time for the sake of some shine
- What effect – if any – will this have on SEO?
I’m considering writing a jQuery plugin that you could use to apply this technique. You can see the technique in actual use on this page. View the source code to see how it’s done.
You might have noticed that I’ve migrated this blog to WordPress – the main reason for doing so was to give me the ability to easily add pages to the blog so that I could keep my web dev tutorials in one place.
I’ve also just added the introduction to classes tutorial so go and check it out.