Latest Publications

Deleting files older than a specific date or age

I needed to delete a chunk of cookies today – but I didn’t want to delete them all.

Thankfully there is a handy command that is within Windows versions after XP such as Server 2003 and Vista that will enable to clean up without too many problems.

The forfiles command will allow you to set a specific date for a file so that you don’t delete recent cookies:

forfiles /S /p "C:\Users\John\cookies" /D -150 /c "cmd /c del @path"

If you wanted to be super cool and delete multiple user cookie folders you could do something like this:

for /D %D in (C:\Users\*) DO forfiles /S /p "%D\cookies" /D -150 /c "cmd /c del @path"

This will enumerate all of the user folders in the C:\Users folder and then clean up the cookies folders inside.

If you wanted to – you can change the amount of days from 150 days to any other amount you like by changing /D -150 to any other number of days (or even use a specific date).

Block Facebook Adverts in Firefox

Anyone using Facebook will know that it’s quite annoying losing a good chunk of screen real estate to the adverts on the right hand side.

Of course, many others think so and there is a nice extension that will block various adverts around the internet including Facebook’s own.

Now, I’m not going to get into the morality of blocking adverts on websites here – I’m simply showing you how to do it. If the internet goes bust, it isn’t my fault.

  1. Open Firefox
  2. Click ‘Tools’ > Add-ons
  3. Click ‘Get Add-ons’
  4. Type adblock plus into the search box
  5. Click on the Adblock Plus extension and then click Add to Firefox…
    Firefox Add-ons Window
  6. Click Install Now
  7. Click Restart Firefox

Firefox should restart – so now we can use a subscription to block the adverts. If the Welcom to Adblock Plus window doesn’t open, click on Tools > Add-ons > Adblock Plus > Preferences. Click on Filters > Add filters subscription.

Welcome to Adblock Plus Window

  1. Select the Easylist USA option and click on subscribe.
  2. Click OK

That’s it! Now that you have the ad filtering installed – Facebook should now be advert free in the right-hand side of the page.

Hurrah!

How to download BBC iPlayer programmes

I’ve found the BBC iPlayer client very frustrating to use. Even though the client is cross-platform thanks to Adobe Air – it’s slow and sometimes doesn’t allow you to download a programme when you should be able to.

Also, it doesn’t work properly on 64-bit platforms such as Ubuntu (which is what I use), so the process becomes even more difficult.

So, after getting quite fed up with iPlayer still not quite delivering – I had a scoot around the internet and found a very useful program which will download those videos very nicely.

get_iplayer boasts that it can download BBC TV, radio and ITV onto your computer. Not only this, but it can also be scheduled to download your favourite programmes just like a PVR. So it’s like Sky+ or TiVo, but better. But bear in mind the disclaimer:

Of course, to respect the content providers’ wishes and fair-use legislation, you should keep the recorded content for no longer than 30 days (in the UK), not attempt to obtain it from outside of the UK and not redistribute it. get_iplayer is not intended for use in making illegal copies of copyrighted content. Please respect the rights of the content owners when recording. get_iplayer will attempt to remove its recorded content which is more than 30 days old.

Getting Started
First thing’s first, we need to install it. I’ll assume that you’re using Ubuntu Linux for this, but you can install this on Linux, Mac or Windows.

First of all, download the get_iplayer package from the download page. You’ll also need the flvstreamer package to download the high quality videos.

Once downloaded and installed, you’ll be all set to start downloading. The first thing to do is get an up to date list of programmes. Running

get_iplayer

On its own will refresh the BBC feed and list all the programmes curently available. There may be a lot so you might want to search by the title of the programme:

get_iplayer "Top Gear"

will list all of the BBC iPlayer programmes matching the phrase “Top Gear”

Now you decide that you want to download all of the “Top Gear” series, you can download them with:

get_iplayer "Top Gear" --get

This will download all the available episodes of Top Gear as a .mov file. Using additional parameters, you can also download in various formats such as HD .mp4 files.

Alternatively, if you’ve got the link to a program and you want to download it without any fuss – then you just need the URL or the ID of the programme to download it instantly:

get_iplayer --get --pid http://www.bbc.co.uk/iplayer/episode/b007vl20/Will_Smith_Presents_The_Tao_of_Bergerac_Episode_3/

This will download the radio show The Tao of Bergerac onto  your computer without the need for searching for the programme through the get_iplayer command line tools.

There is loads more you can do, such as using get_iplayer as a PVR. The documentation covers the different commands well, and is definitely worth having a squint through. Just remember to watch how much you’re downloading if you have capped bandwidth from you internet provider.

If you feel like something a bit more graphical, the is also a get_iplayer PVR Manager available to try.

Happy downloading!

SCP and filename spaces

An issue that pops up for me occasionally is that scp doesn’t much like copying filenames that contain spaces. When you use the scp command, even in quotes – the result is that scp treats each space as a separate file.

Thankfully, there is a way to easily fix this. You need to enclose the filename in two sets of quotes. I’m guessing that one is for scp itself, and the other is for the target machine to resolve:

scp user@remote-pc:"'/home/user/my long filename'" ./

Notice that the path is wrapped in single quotes, and then the single quotes wrapped in double quotes. This seems to resolve the issue nicely, and still works with directories as well.

Reset your MediaWiki Sysop Password

When you’re stuck without sysop access to MediaWiki because you cannot remember the sysop details then there’s a handy maintenance script that’s available (if you’ve used the package manager) to reset the sysop username and password.

On Ubuntu server you can run the following command:
php /usr/share/mediawiki/maintenance/changePassword.php --user=sysop --password=password
The script will immediately reset your sysop username and password with what you have entered above.

Now you can log in without any problems!

Edit files with Notepad++ From Anywhere on your Network

Notepad++ is a very handy tool. It rocks.

What is annoying is that if you have it installed on a server, then you have to run NPP before opening the intended file that you want to edit.

Well, no more! Using the power of Group Policy Preferences (which also rocks).

First of all, install NPP onto your server but install it into a shared folder that you can access.

Next, open up Group Policy Management and edit the group policy that your user account is in (or those that you want to enable).

Open up User Configuration > Preferences > Windows Settings > Registry.

Crete a new registry setting:

Hive: HKEY_CURRENT_USER
Key Path: Software\Classes\*\Shell\Open in Notepad++\command
Default: ticked
Value type: REG_SZ
Value data: "\\server\share\notepad++.exe" "%1"

Then log onto a computer and right click on all of those files! Yey!