Flushing the Linux System Cache
Jul 27th, 2010Found this interesting page on the Linux memory management site which details how to clear the system cache in Linux. This was handy for us as we were testing file download performance off various VPS configurations and we wanted to be sure the file we were downloading was getting read off the disk, so we could more accurately measure the usual performance.
Basically you can just do: echo 3 > /proc/sys/vm/drop_caches and it will ‘free pagecache, dentries and inodes’. This worked a treat; we were able to download a file, then download it again (observing that the second download was much, much faster because it was coming out of the system cache), then run that echo and download again and observe that the speeds were back to the first download.
Comments: 0 --
FTP resume off by default in Debian proftpd
Apr 26th, 2010If you apt-get install proftpd on Debian it seems that support for resuming an FTP transfer is off by default.
For some reason the setting that controls this isn’t exposed in the default proftpd.conf, but basically it’s just a case of adding the AllowStoreRestart option to your proftpd.conf (ie, ‘AllowStoreRestart on’), then restarting proftpd via /etc/init.d/proftpd restart, and you’re away.
Comments: 0 --
Just went to drop some new ebooks on my iPhone and got the following message:
Stanza can only share books with your iPhone or iPod if you have the Apple “Bonjour” software installed. Would you like to launch your browser to the install page for Bonjour?
Argh!
I quickly realised it was probably because of the recent version 9.1 update for iTunes that I installed, overwriting or otherwise breaking Bonjour somehow.
Fortunately the workaround for a fix is simple – just redownload the latest Stanza installer and reinstall. It’ll install a working version of Bonjour and you’re away.
Comments: 0 --
Thunderbird ‘Write Error or Disk Full’ Dialog Error
Mar 26th, 2010Just had a bit of a weird problem with Thunderbird v3.0.3 throwing an error dialog with the following text:
An error occurred while sending mail. The mail server responded: qq write error or disk full (#4.3.0). Please check the message and try again.
Or in image form:
This of course looks like a server error, so I panicked and harassed our Ops guys, thinking the mail server was running out of space. Some simple testing indicated this wasn’t the problem – I was able to send through our mail server’s web interface (Zimbra) and others were able to receive mail with no problems, so it was clearly a problem at my end.
I restarted Thunderbird with no effect, and rebooted with no effect.
The solution was to right click my ‘Sent’ mail folder and hit ‘Rebuild Index’. I guess the index got corrupted somehow and it couldn’t write to the Sent mail folder, triggering that (wrong) error message.
Comments: 0 --
Updated newspost v2.1.1-4 Source Package
Feb 18th, 2010I’ve been uploading stacks of files to Usenet over on AusGamers lately to try and make it easier for gamers to get them, doing it all on Linux using newspost. I’ve been struggling with an issue for a few months – an error which stops a posting session in its tracks.
WARNING: unexpected server response: 240 post WARNING: unexpected server response: 240 post Socket error: Broken pipe
Fortunately newspost is awesome and with some careful checking I’ve been able to resume broken uploads by manually posting parts of files, but uploading large files (like the 10gb LOTRO client I uploaded over the weekend) is a total pain in the ass, as it means I’m constantly spending time restarting it (and it’s not uploading).
Well, I finally decided to try and fix it, but Googled the error first, and of course someone already had. Debian have a patch available which fixes this error. The official newspost site hasn’t been updated since 2003, so if you’re like me and just want a source tarball, I’ve patched the original source with it and made it available right here.
Comments: 0 --
Recursively add missing files to SVN
Dec 22nd, 2009Nats showed me this awesome little trick a while back – if you’ve just added a stack of new files to a directory and need to easily add them all into SVN from the command line (for example, if you’ve just unpacked a new WordPress install and there are new files in it that you need to add), you can use the following command:
svn add `svn st $DIR | grep -E '^\?' | cut -b 8-`
Comments: 0 --
How to Download Trailers from Apple.com
Dec 17th, 2009If you are like me, you find streaming trailers from Apple is a pain in the ass. I still prefer having the trailer locally and playing it locally, even if it means a bit of screwing around. Here’s a quick way to download trailers:
1. Install the Firefox web browser
2. Install the Greasemonkey add-on for Firefox
3. Install wget for Windows (most Linux distros will have it installed already)
4. Add the Apple Trailer Download script to your greasemonkey distribution.
5. Enable greasemonkey
6. Go to an Apple trailer page, like The Slammin’ Salmon page
7. Note in the bottom right you’ll get a little window with a bunch of links to the various versions – looks like this:

Right click, copy link location for the version you want
8. Open a command prompt and fire up wget thusly:
wget -U QuickTime [url of trailer]
You need to specify the -U parameter (User-Agent) as Apple rejects any requests for trailers that are not from QuickTime.
10. Realise that this method violates the Apple.com Terms of Use and stop doing it.
Comments: 0 --
Really Simple wget Tutorial
Nov 30th, 2009wget is a simple command line-based tool that allows you to download files from the command line. It is a very powerful tool for downloading with a lot of options, but it can also be really helpful in diagnosing common downloading problems.
Unfortunately, as it is a command line tool, it can be daunting for users to use. This post is intended as a really simple reference for people who have been asked to download something via wget and want some step-by-step instructions to follow:
STEP 1: Download wget
a) Go to the wget for Windows page by Bart Puype and look for the wget download link and download it to your computer – preferably to your desktop. If you choose to download it elsewhere, you’ll need to know where you downloaded it to for the next step.
The download link looks like this:

STEP 2: Open a command prompt
wget is a command line utility, which means you can’t just double click on it and have it work. You need to open a command prompt and run it from there.
a) Hit the following key combination: Windows Key and R (that is, hold down the Windows key and hit “R”). A small “run” dialog will open in the bottom left of your screen.

b) In the run dialog, type cmd.exe and then hit the “OK” button:

c) After doing this, a black window will open on your screen looking something like the below:

STEP 3: Find and test wget
By default, your “run” command will have you sitting at your user profile directory. If you followed the instructions above, you downloaded wget.exe into your Desktop directory. Now you need to run the following commands, which you should be able to just type directly (without the quotes):
a) Type “cd desktop” and hit enter to change into the directory in which wget.exe is residing (if you did not download to your Desktop, you’ll need to figure out where you did download it to, and manually change to that directory).
b) To check if wget is working, type: “wget” and hit enter. It should look like the below:

If it does not, then something is wrong and you probably need to start again!
STEP 4: Get your download URL ready
If you’ve gotten this far, wget is correctly installed and ready to be used. All you need now is a URL to download.
A URL is the thing that you are clicking on that starts the actual file download process. When you click on a file download URL, you’ll get that little “save as” dialog in your browser which you then use to tell your browser where to put the file.
a) Instead of left-clicking on the URL you want to test to start the download, right-click on it. You will get a menu that looks like this (in Internet Explorer):

Select “copy shortcut”. Note if you are using a different browser like Firefox the text might be different (Firefox is “Copy Link Shortcut” for example).
STEP 5: Use wget to download a file
Now we have everything we need!
a) Click back to your command prompt window, which should be sitting there ready and waiting.
b) Type “wget” – but don’t hit enter!
c) Hit the space bar, so you have a space after the wget command.
d) In the top left of the command prompt window, there’s a little “C:\” icon. Click that and go through the menu that results until you find the ‘Edit’ submenu, then hit ‘Paste’:

e) If you have copied the link correctly, it should get pasted into the command line prompt, so you should end up with a something on the command line that looks like: “wget http://your.url.here.com/filename.zip”
f) Hit enter! The download will start and information will start spewing to the command prompt showing how fast it is downloading and how long it has left. If you get errors then you might not have pasted the right URL or there might be some other problem.
Comments: 1 --
Extended Link Properties for Firefox v3.x
Nov 24th, 2009Ever looked at a link to a file online and wanted to find out how big the file is? Sure, if you’re hardcore you can fire up a command prompt and just do “wget –spider –debug [url]” or whatever, but surely you should just be able to right click on it and go to Properties and get a file size, just like in Windows, right?!
Well, the Extended Link Properties add-on fore Firefox is what I’ve always used to do exactly that. Unfortunately it hasn’t been updated for a billion years and doesn’t work in newer versions of Firefox.
I’ve been using the Nightly Tester Tools to force compatibility (because it’s just a version requirement) but I finally got bored with it constantly breaking every new Firefox version. I’ve dissected the add-on and re-built it into a new XPI which I have dubbed ‘Extended Link Properties v1.2.4′.
Anyone wanting to download it can do so here (md5sum: 03e3e278c2d8b921401cf1a8b68efc45), though you’ll need to manually install it at the moment by downloading the .xpi file, then in Firefox simply go to the File Menu then hit Open File and browse to the XPI. You’ll get the usual notice.
I have emailed Torisugari, the original developer of the add-on, to see if he’s still around. I’ll try and get it on the official extension site at some point if he replies.
Update: Torisugari has replied and pointed out the file is tri-licensed already under MPL/GPL/LGPL. He also points out that this extension will only useful up to version 3.5.x of Firefox – after that the Firefox developers have decided to remove support for the Properties dialog. If you use Properties and/or Extended Link Properties, you should head over and add your voice to that bug report.
As a result of that I’ve changed the v1.2.4 build of ELP that I put together to only support up to v3.5.x of Firefox.
Comments: 0 --
Unpacking / extracting a .rpm file
Nov 4th, 2009I have never figured out the RPM package management system. It’s mostly because I haven’t tried hard, but it still makes me feel like a moron.
Every now and then I stumble across a package that, for whatever reason, is only distributed in .rpm form. Right now I wanted to install nano on godaddy.com’s shared hosting (because I’m also too lazy to learn vi), and the easiest way I could think of was to nab the .rpm and just rip out the nano binary.
Turns out this is really easy from a Linux shell:
# rpm2cpio [rpm filename] | cpio -idv
Another victory for laziness! It spewed out a bunch of stuff, I nabbed the nano binary, threw it on my godaddy shared hosting using wget via ssh, and now I have a fully functional and awesome editor (no matter what anyone tells you).
Comments: 1 --
