Sohail Mirza, standing in for Peter.

Archive for the ‘Helpful Hints’ Category

Helpful Hints: Create an APT proxy in 3 easy steps using apt-cacher-ng


This Helpful Hints tutorial will require a number of basic and intermediate skills.  In order to complete this tutorial you should be comfortable doing the following:

If you’re not certain how to perform some of these actions, you may find tutorials for them readily available online.

Why an APT proxy?

If you’re like me, you might have a number of Ubuntu machines at home.  If this is the case, you know it can be a pain to quickly update them all since the same updates need to be downloaded to each computer.  If there are a lot of updates to be downloaded, this can take a while on a slower Internet connection.

If this sounds like your situation, then you can speed things up by setting up an APT proxy on your network at home. APT is the tool your Ubuntu system uses to retrieve updates and manage the installation of programs. An APT proxy will basically allow you to designate one of the machines on your network as the update server — the one machine where all the others will get their system updates from.  The idea is that the proxy will only have to download updates once, and these are then distributed to all the other Ubuntu machines on the network.

To accomplish this we can very easily setup apt-cacher-ng, a proxy tool readily available from the Ubuntu repositories.  I did play around with apt-proxy first, but found that less straightforward to use.

Taking it step-by-step

So here are the three easy steps, assuming all the computers involved are running Ubuntu (the computers can be running any version of Ubuntu, even differing versions):

  1. On the machine which will be running the APT proxy, install apt-cacher-ng. Just click the link in the last sentence, or type the following into a terminal window:

    sudo apt-get install apt-cacher-ng

  2. Now that your proxy is ready to go — yup, it was that simple — we need to instruct all the computers in your home or office to go to that proxy computer for APT updates, and not to the public update sites on the Internet. This is fairly straightforward to do as well.

    As the super-user, you’ll need to edit (or create, if it doesn’t exist) the file at /etc/apt/apt.conf.d/02proxy, and add the following to the first line in that file:

    Acquire::http { Proxy "http://ProxyComputerIPAddress:3142"; };

    In this line you’ll need to replace “ProxyComputerIPAddress” with the proxy computer’s address on your network. It’s address may look similar to an IP address like

    You’ll need to perform this step on every computer, including the one running the APT proxy. On the computer running the proxy you can use the IP address, which is just a way for the computer to refer to itself; every computer can refer itself with the this IP address.

  3. Now that every computer will be going through the proxy, things should magically just work! At this point you can launch the Update Manager, and check to see if there are pending updates.

Wrapping up…

That’s it folks, it’s that easy to setup an APT proxy. The result is that all Ubuntu updates should be cloned to your proxy server once, and that will now be the source of updates for all the computers on your network.

Post to the comments and let us know how it works for you.


Written by Sohail Mirza

August 20, 2011 at 12:46 am

Helpful Hints: Downloading trailers from iTunes Movie Trailers

This guide works with iTunes Movie Trailers as of Jan. 14th, 2010.

What you’ll need to get things working is:

  1. The Greasemonkey Firefox addon.
  2. The HeaderControl Firefox addon.
  3. My iTunes Movie Trailers Download script.
Screen capture of iTunes Movie Trailers download page for the new Karate Kid

Yes, Karate Kid, I want to download you... even though Jackie Chan != Mr. Miyagi

Installing Greasemonkey

Thank goodness for Firefox documentation:  just use the easy-to-follow guide on installing extensions, but install Greasemonkey instead.

Instructions for installing Firefox Extensions

What could be better than easy to follow instructions?

Installing and Configuring HeaderControl

HeaderControl is slightly more difficult to install and requires some additional configuring as well.  Not to worry though, I’ve already covered it before.  Please refer to the section titled “Setting up HeaderControl” in my last version of this guide.  Just make sure you’ve got the User Agent string right (“Quicktime/7.6.2“).

Installing the iTunes Trailer Download script

Installing the script is as simple as visiting the script’s webpage and clicking the big green Install button:

Webpage for The Apple Trailer Download Greasemonkey script

Go ahead, cilck that big, green button.

Rock ‘n Roll

Followed all the steps?  Great, now you’re ready to rock and roll.  Go ahead and try it out.

Download links for the Karate Kid trailer

That's money.

Written by Sohail Mirza

January 14, 2010 at 2:03 am

Helpful Hints – Apple Movie Trailers download using Firefox, Greasemonkey, and User Agent hack

You can't stop us Apple!

You can't stop us Apple!

Only a few days ago I was disappointed to find that Apple had once again broken movie trailer downloads for non-iTunes users.  Thanks to the input of a few commentators on this blog, I think I’ve found a new workaround for Firefox/Greasemonkey users.

The workaround uses a combination of the most excellent Apple Trailer Download script by zatic (not my modified version — I’ll get to this in just a bit), and a modification to the User Agent string that Firefox uses to identify itself to websites.

Setting up HeaderControl

First of all, you’ll need to download this great experimental Firefox addon, HeaderControl (Disclaimer: always use caution with beta/experimental software.  I’m not responsible for any harm you may cause your computer).  What we’ll be using HeaderControl for is to enable a modified User Agent string for only the Apple trailer download site.  Some of you may have the popular User Agent Switcher extension installed, which could work as well, but I chose HeaderControl for this workaround because it allows per-domain user-agent switching.  The “per-domain” bit means I don’t have to keep switching the Firefox user agent for the trailers site, and back again.

Now, once you’ve installed HeaderControl, reboot Firefox and bring up the preferences dialog for HeaderControl.

HeaderControl Options dialog.

HeaderControl Options dialog.

Clicking the “Add” button, go ahead and create a new per-domain configuration for the domain,, and specify the custom user agent string “Quicktime/7.6.2“.  Note that you’ll only need to choose the “Mangle HTTP ‘UserAgent'” option.  You can leave alone the Referer and Language tabs.

Make sure the suffix is "" and that you have the user agent correct.

Make sure the suffix is "" and that you have the user agent correct.

Press “OK” to commit the new per-domain filter, and you’ll be good to go.

Downloading Trailers

For those of you who do not care to download the trailers but  just want to watch the trailers in your browser, you should be good to go.  Go ahead, hit up the trailers site and watch something special.

For those of you who want to download the trailers but don’t know how, you can refer to my original instructions, which should now work again.

Finally, if you’re amongst those who followed the steps in my previous post on the issue of Apple trailer download breakage by installing my modified Apple trailer download Greasemonkey script, then you have one more step to complete:  disable my script and go back to using the original Apple Trailer Download script by zatic.

Disable my "fixed" script.  It's no longer required.

Disable my "fixed" script. It's no longer required.

Once you’ve done this you should find yourself able to download movie trailers from Apple’s site once again.

Written by Sohail Mirza

October 9, 2009 at 12:08 am

Helpful Hints – Tabbing to form fields in Firefox

Ever wish you could press in Firefox and get focus on the first form field of the page, ignoring all the links? Or maybe you want to tab between all form elements with the exception of text fields? Or perhaps you want tabbing behaviour that is some combination of the above?

The developers behind Firefox realized that people would want tab behaviour conforming to their personal keyboard accessibility requirements, and to this end they’ve included a very handy means of getting the behaviour you want.

Enter the accessibility.tabfocus configuration.  This property allows you to specify an integer corresponding to a particular tab focusing behaviour.

From the Mozillazine Knowledgebase, the possible values for this property are:

1 – Give focus to text fields only. (The default in OS X.)
2 – Give focus to all form elements except text fields.
4 – Give focus to links (and linked images) only.

The value for accessibility.tabfocus can also be an integer like 7 (which is the default value). 7 (1+2+4) implies that Firefox will focus all field elements and links as well; its effect is the behaviour of 1, 2, and 4, combined.

You can read up a bit more to understand the different values.

For those who have forgotten how to manipulate the advanced configuration preferences in Firefox, you can do so as follows:

Open a new tab and enter “about:config” into the address bar:

Firefox's about:config disclaimer.

Firefox's about:config disclaimer.

Accept the disclaimer that you may break Firefox if you don’t know what you’re doing.  I’d advise the reader to be careful about what they do beyond this point!

Enter “tabfocus” into the Filter field to find the accessibility.tabfocus property:

The 'accessibility.tabfocus' property on the about:config page.

The 'accessibility.tabfocus' property on the about:config page.

Now just double click the property to be prompted for a new value.

Personally, I would like to tab through all form fields while ignoring links on the page.  To achieve this outcome, I used a value of 3 (1 + 2), a combination of tabbing through text fields and tabbing through other form fields.

I hope this Helpful Hint is of use to those of you who are big on keyboard accessibility.

Written by Sohail Mirza

April 22, 2009 at 1:04 am

Helpful Hints – Downloading HD Trailers from Apple Trailers

Quicktime LogoEver been perusing the Apple Trailers website, checking out the HD trailers, and been annoyed by the process of buffering and watching the streaming video? Wouldn’t it just be better to download the video to your desktop and watch it at your own convenience, without having to buffer the video?

Well, there are a couple of ways to do this.

Read the rest of this entry »

Written by Sohail Mirza

July 15, 2007 at 5:35 pm

Helpful Hints – Running multiple instances of Firefox

Ever wanted to run more than one instance of Firefox? At the same time? It’s quite simple, really!

The advantages of doing this are apparent to those who might be in a multi-user environment using only one account on the PC. Also for web developers who may have a separate Firefox profile for development, and another one for regular browsing, this is a useful ability.

The way to do it is to set up a Firefox shortcut with the link target being:
"C:\Program Files\Mozilla Firefox\firefox.exe" -p -no-remote
You would, of course, want to modify the path to the Firefox executable depending on where you’ve installed it.

In Ubuntu, your application launcher should reference the following:

/usr/bin/firefox -p -no-remote

The keen observer will note that we’re actually providing two different command-line switches to Firefox. The “-no-remote” tells Firefox to launch in a new process, and the “-p” switch tells Firefox to bring up the Profile Manager. Without the profile manager switch, Firefox will simply try to load your default or last used profile, provided you haven’t setup Firefox to bring up the Profile Manager every time you start it.

Written by Sohail Mirza

June 11, 2007 at 10:28 am

Posted in Firefox, Helpful Hints