Welcome to maniacmartin, the personal site of Martin Smith.
I'm listening to The Gap Band – You Dropped A Bomb on Me

I'm cycling the length of the UK (1000 miles) for charity. Sponsor me now!


    20 October 2007

    Hyperlinking to Piracy Sites is against UK law?

    Filed under: Blog, E-petitions — martin @ 5:15 pm

    Slashdot and The Guardian recently reported about the arrest of the owner of tv-links.co.uk and the sites subsequent closing down. TV Links was a site which linked to videos on other sites (like Youtube and Veoh) where users could see TV series. The arrest was made by officers from Gloucestershire County Council trading standards in conjunction with investigators from Fact and Gloucestershire Police.

    The biggest use of TV links that I know of was people watching sci-fi series that had been released in North America, but that the industry wouldn’t make available to UK viewers. So these series-followers had no legal route to get the series in the UK when it was released in America. Maybe the industry should look at why people are using TV links and provide a legal route for them to get the programmes, without making them wait weeks after it’s been aired in America. No-one wants to wait to see programmes that have been aired.

    The big concern to me is the americanization of our country. It seems it is now illegal to link to a site which could be used for piracy. In effect this makes merely distributing information on how to copy copyright material illegal. Websites like BBC seem to have covered themselves by not linking to any of the sites in question when reporting news stories about piracy, but is there any difference in telling people they can get movies from The Pirate Bay, than telling them they can get movies from The Pirate Bay? An interesting question would be whether telling someone they can buy pirate DVDs at a certain place at Hemswell market also counts as “facilitation of copyright infringement”.

    18 October 2007

    Fixing File Uploads after upgrading to PHP5

    Filed under: Computer — martin @ 1:21 pm

    As some of you may know, I upgraded from PHP4 to PHP5 recently. And it went smoothly - or so I thought. Now, it seems I overlooked the fact that the reference $HTTP_POST_FILES has been phased out. This has been replaced with $_FILES. This is great, since Zen Cart, custom scripts, old phpBB installations and other old php scripts where users can upload a fail now fail spectacularly as they access an empty array.

    First I wanted to write a perl script which I fed a list of files, but with 10GB of websites, this would take ages (and given a list , the number of arguments exceeded perls limit). So instead I ran this command from /var/www/vhosts
    find . -name '*.php' -exec perl -p -i -e 's/\$HTTP_POST_FILES/\$_FILES/g' {} \;
    find . -name '*.inc' -exec perl -p -i -e 's/\$HTTP_POST_FILES/\$_FILES/g' {} \;

    to spawn a new perl instance per file, without checking jpegs and stuff.

    11 October 2007

    Cycling from Rasen to Oxford

    Filed under: Blog — martin @ 10:33 am

    First, let me apologise for neglecting my trusty readers. But I’m back, back my magical journey.

    On the Sunday at the start of freshers’ week I cycled from Middle Rasen to St John’s College, Oxford in 15 hours 59 minutes, including all stops. Unfortunately due to a dark start at 5.09am, I couldn’t set up my odometer to accurately measure the distance, but I’ll attach a map to show you. Note that I didn’t go as the crow flies (120 miles), but saught out backroads, so the distance is a bit more.

    It was a nice cycle, because I wisely chose to carry virtually nothing and get my mum to bring it all in the car the following day. I wouldn’t say it was overly exerting, but I didn’t quite realise how hilly central England is, living in Lincolnshire and all. By two-thirds of the way there’s definitely only one possible speed.

    Donov blogged this first. Here’s what he had to say:

    Martin is INSANE
    Mon, 01 Oct 2007
    yesterday martin completed a 150 MILE cycle rids from his house in middle rasen to OXFORD, this journey took him 17 hours in total and has made me think that he is insane.


    View Larger Map

    4 October 2007

    Wildcard Parsing in Linux Shells

    Filed under: Computer — martin @ 10:11 pm

    I have just discovered a quirk in linux shells.

    When you issue a command with a wildcard, bash will replace the wildcard with a list of matching files. So when you type mogrify -resize 640x *.jpg
    on a folder containing beach.jpg, pc.jpg and college.jpg, the shell will rewrite that as
    mogrify -resize 640x beach.jpg college.jpg pc.jpg

    and mogrify is given the options -resize 640x beach.jpg college.jpg pc.jpg (filenames in alphabetical order)

    Now let us consider a folder with the following files: -r foo.bar foofolder barfolder
    where foofolder and barfolder are folders. Issuing a rm *, might, at first glance just delete the files and not the folders. But alas this is expanded to
    rm -r foo.bar foofolder barfolder
    and rm recieves these options -r foo.bar foofolder barfolder
    In fact, only the -r file will survive.

    OK, you say, but who has files beginning with hyphens? Well, it could happen. And some commands, like tar, dont need a hyphen at the beginning of their arguments.

    martin@xenon:~/tests$ ls
    folder -r
    martin@xenon:~/tests$ rm *
    martin@xenon:~/tests$ ls
    -r