Skip to Content Skip to Search Go to Top Navigation Go to Side Menu
Search on Site

"Technology" Category

Running FMS 3 on Gentoo Linux

Thursday, April 24, 2008

I’ve been trying to install Macromedia Adobe Flash Media Server 3 on my local development box and have run into some problems.

To help out anyone else trying to do the same thing, here’s how I did it.

First you need to install nspr

  1. emerge -uDv dev-libs/nspr

Add a user/group for it to run under:

  1. groupadd fms
  2. useradd -g fms -d /dev/null -s /bin/bash fms

Then download and extract the media server as per usual. Before installing it, you need to fiddle the install script so that it will install on your “unsupported” platform. Open installFMS in your favourite text editor and find the line that reads

  1. DISTRO=`check_distro`

Change it to something appropriate like

  1. DISTRO=redhat-RHEL4-i686

Then start the installation script as normal. Tell it that you don’t want it to run as a daemon (as it requires the Red Hat only chkconfig command) and that you don’t want it to start the server when done.

After you’ve installed the server, you’ll need to make the bundled libasneu.so.1 library available for use:

  1. ln -s /opt/fms/libasneu.so.1 /lib/libasneu.so.1

For some reason the install messed up the configuration files, adding things like the administrative user name twice. Check conf/fms.ini to make sure this hasn’t happened to you.

The installer creates init scripts at /etc/init.d but in order to use them you first need to create a file called .autostart in the installation directory:

  1. touch .autostart

You should then be able to start and stop the server normally:

  1. /etc/init.d/fms start
  2. /etc/init.d/fms stop

And use rc-update to have the server start on boot:

  1. rc-update add fms default

Good luck.

Popularity: 69% [?]

Prototype String.toQueryParams() weirdness

Tuesday, April 15, 2008

I just came across this while using Prototype:

  1. "section=blo%g&id=45".toQueryParams();

To save you the trouble of running it yourself, I’ll tell you what happens - the unescaped percent symbol causes a URI malformed error to be thrown.

Very odd. The Prototype documentation for toQueryParams says:

Parses a URI-like query string and returns an object composed of parameter/value pairs.

Since it’s a URI-like query string and not an actual query string (by which I mean one that’s been through the browser address bar and as such subject to whatever text munging the browser does), my example above should be a legal use case.

After a little digging around in prototype.js, it seems that the problem is caused by the JavaScript function decodeURIComponent() not enjoying being given a string that contains an unescaped percent symbol. Usually percent symbols are used in conjunction with a number to represent a non-alphanumeric character in a URL - %20 for space, etc, but in the above it’s a literal percent symbol.

My first attempt to fix it changed lines 98 and 100 of string.js in the Prototype source to use the built in escape function:

  1. var key = decodeURIComponent(pair.shift());
  2. if (value != undefined) value = decodeURIComponent(value);
  3.  
  4. to
  5.  
  6. var key = decodeURIComponent(escape(pair.shift()));
  7. if (value != undefined) value = decodeURIComponent(escape(value));

This worked for my use case but caused Prototype to fail a different unit test. Changing them to the following worked out okay:

  1. var key = unescape(decodeURIComponent(escape(pair.shift())));
  2. if (value != undefined) value = unescape(decodeURIComponent(escape(value)));

Granted the unescape(…(escape(…)) is a little clumsy, but it seems to get the job done.

Adding the following unit test to string.html allows to test for the above:

  1. this.assertHashEqual({‘key1′: ‘va%lue1′}, ‘key1=va%lue1′.toQueryParams(), ‘rogue percent symbol test’);

I’ve created some test pages which demonstrate the problem.

There is also a patch file available. Apply it to /src/string.js in your Prototype source tree.

Update

I’ve also filed a bug.

Popularity: 100% [?]

Code

Friday, April 11, 2008

I haven’t posted here for a while, mainly due to the time sink that is Facebook, but I have been writing code in my spare time, honest.  I thought I’d have a little skim through what’s on my machine and share a few choice nuggets.

Recently I’ve been trying to get into programming applications for Mac OS X - I use it on a day to day basis so thought it would be best to get involved.  I’ve put some new things on the Stuff page for your perusal.  They are:

Backgrounderer

A little app to download desktop wallpapers from veer.com. If you wish to build from source, you’ll need to install RegexKit first.

Mail RSS Exporter

An application that exports your RSS feeds from Apple Mail and stores them in either OPML format or Safari Bookmarks.

TouchMe

A program to run AppleScripts on a computer on your local network from your iPhone or iPod Touch - I use this to control a Mac mini attached to a projector.  The projector is not always switched on so Front Row was insufficient.  It also allows you to force quit applications that have hung.

SimpleHTTPd

A Cocoa native web server packaged as a framework so you can use it in your own projects.  Based on Jurgen Schwiezer’s SimpleHTTPServer.

All of the above require OS X 10.5 Leopard as coming from a Java/PHP background I have a strange fetish for garbage collectors and consequently find manual memory management tedious.

They are all BSD licensed and source is included with each program so go crazy.

I’ll get round to posting about each one in more depth in the near future.

Popularity: 97% [?]

Button, button, who’s got the button?

Thursday, July 26, 2007

From an article on the Wall Street Journal about Steve Job’s button phobia.

When the company introduced the iPod in late 2001, the most common calls to Apple’s technical support lines for a time were about how to turn the device, which lacked a clearly defined power button, off and on, says a former Apple executive.

Wow, I’d forgotten all about that. Years ago Will left his iPod at our house for a week or two and I had such trouble trying to figure out how to turn the damn thing on.

Popularity: 98% [?]

Apache2 and OS X

Friday, July 20, 2007

This is more a note to myself than anyone else, but to compile Apache2 on OS X, use the following configure:

  1. ./configure –with-included-apr –enable-so –enable-mods-shared=most

When Apache starts whinging about “dlname not found, assuming libtool archive” and shit, and refuses to produce .so modules instead kicking out a bunch of .a and .la files in their place, it means you’ve fucked up somewhere along the line, probably because this isn’t the first time you’ve tried to run the configure script.

Delete the entire Apache source directory and start again. If you are lucky you’ll even get a nice copy of libexpat.0.dylib at the end of it all.

Popularity: 98% [?]

Orwellian

Tuesday, June 26, 2007
The BBC … has always taken a platform agnostic approach to its internet services.

And then a little later:

It is not possible to put an exact timeframe on when BBC iPlayer will be available for Mac users.

–bad, indeed.

The corporation’s governing body asked the BBC to ensure that the iPlayer could run on different systems - such as Apple Macs - within “a reasonable time frame”, initially twenty-four months.

Twenty four months for porting to Mac OS X is reasonable?! I dread to think about the poor old Linux users out there.

The BBC has previously said it cannot commit to a two-year time frame as many decisions would have to be made by third parties.

i.e. Either Microsoft decide to port their DRM software or someone else will have to decide to write some.

A statement from the BBC read: “Our ability to deliver this open approach will be influenced by the availability of alternative DRM systems on the market.

i.e. Microsoft have no plans to port their DRM software to any other operating system so the BBC will have to find some other system to use and so far haven’t so we’ll just have to wait.

What a load of rubbish. I’ve always been a strong supporter of the BBC but this is utterly unacceptable.

http://news.bbc.co.uk/1/hi/technology/6236612.stm

Popularity: 96% [?]

Glastonbury tickets

Sunday, April 1, 2007

Alex is currently wondering if the Glastonbury ticket website is run off of a beige box in the corner of someone’s flat with a cat chewing on the network cable.

Honestly, what with all the pre-registering bollocks it’s not like they were unaware of the demand. Why can’t they design a server infrastructure that can handle enough requests?

Popularity: 97% [?]

svn:externals and different usernames

Wednesday, January 3, 2007

How to use a different username with svn:externals.

Genius. Well, almost. Close enough.

Popularity: 96% [?]

Pink Zune

Tuesday, November 28, 2006

Me: Oh look, they’ve released a pink Zune. Would you like one for Christmas?

Her: I’d rather stick my head on a pike.

Although on closer reading of the article, it seems that the pink Zunes are a very rare limited edition and they are not marked as such. Consequently the guy who bought it thought he was getting a white one, didn’t like the pink, saw an opportunity and promptly put it on eBay.

Honestly, that’s a stroke of genius only matched by releasing a brown Zune in the first place.

You can just see little Jimmy’s parents in some electronics shop going:

Parent: Oh look, there’s one of those Zune things Jimmy wants. Excuse me, Mr Shop Assistant, we’d like to buy a Zune.

Shop Assistant: Wonderful, here you go.

Parent: Excellent, he’s going to be so pleased.

Of course, the parents left it to the last minute and the black/white Zunes sold out a long time ago - something the shop assistant neglects to mention lest it should damage his chances of making a commission and/or missing his sales target.

Little Jimmy then spends the next six months being bullied at school for having a poo coloured Zune before it’s finally stolen and destroyed by muggers on the bus who can’t bear to suffer it’s existence any longer. Little Jimmy is secretly thankful.

Popularity: 96% [?]

Vista

Friday, November 24, 2006

I downloaded the release version of Vista today via my work MSDN account and my first impressions were:

Hmm. I can’t quite focus on the text on this screen. Either my hangover is really, really bad or I need to get my eyes tested.

Oh, wait, it’s just ClearType.

Aside from that, I’m amazed at how complicated they’ve made everything. For example, when downloading files through IE7, you now have a “Downloads” folder in your home directory. Can you get to this via the start menu? No. Is it a sub-folder of your Documents folder? No. What’s wrong with just putting them on the Desktop? Isn’t it what it’s there for - files you are currently working on and/or might not want to keep?

The Windows Explorer seems to have become a maze of semi-coherent short cuts and file system abstractions - see the address bar for what I mean. Even the Control Panel has succumbed to this mess. It seems they’ve sat around a table and gone “What are the most popular things people do with the Control Panel” and made shortcuts to them all, rather than organising the different areas in a logical manner in the first place.

And then there’s the whole off button thing.

Never mind the hundreds of pop ups “This program wants to do this” “Do you know this program?” “Do you want to let this program do this?” “Are you sure you want to let this program do this?”. And the really obnoxious one that greys out your entire screen and puts the dialogue box right in the middle. “LOOK AT ME”, it screams. “FUCK OFF”, I think.

And what happened to the File/Edit/etc menus? It took me a good twenty minutes to work out how to show hidden files and folders. In the end I had to ask Google for the answer.

Ugh. Maybe I’m just getting old, but does it really have to be this way?.

Popularity: 100% [?]

Magic bullet

Friday, November 17, 2006

Biometric passports cloned. It seems all it takes is 174 quids worth of hardware and 48 hours of a programmer’s time to write the software.

Given the government’s track record for IT, is anyone really surprised by this?

Popularity: 67% [?]

Beta software

Tuesday, November 14, 2006

John Gruber has a go at shonky software hiding behind the “Beta” label (so hot right now).

Too bloody right.

Popularity: 55% [?]

eBay infrastructure

Wednesday, November 1, 2006

There’s an article on eWeek.com about the storage requirements of eBay.com. It’s mostly large number willy waving, but this quote from the third page caught my eye:

eBay’s application servers, according to Strong:

* use monolithic two-tier architecture
* boast 3.3 million line C++ ISAPI DLL (150MB binary)
* have hundreds of developers, all working on the same code
* are hitting compiler limits on number of methods per class.

Now, I could be wrong, but the last three points don’t really strike me as much to be proud of, not to mention possibly inaccurate in the case of the first two.

In other news, this morning I did something that some people might find a little odd. I cleaned my bike.

Truly, I am entering into the realm of the unwell.

Popularity: 34% [?]

ClassLoader

Monday, October 30, 2006

I have a sort of love hate relationship with OO support in PHP. On one hand it looks like a dirty hack due to a combination of the duck typing, lack of function overloading, no proper namespaces and the way everyone talks about object methods when the code itself calls them functions. On the other hand it just feels right (although I’m told this kind of wooly thinking is my degree showing) and if you are putting anything together where scripts run to more than a hundred lines or so it’s really the only way to do it and keep it all manageable. One of the major problems I have with the whole thing is that there is no standardised way to store your class definitions and consequently no way to import them in a neat and tidy way. I personally favour having each class and interface in it’s own file, named thus:

DatabaseConnection.class.php
SQLQuery.class.php
JSONableItem.interface.php
etc..

This way you can identify what is in each file just by reading the name and you can order them in directories like so:

ajax
JSONableItem.interface.php
database
DatabaseConnection.class.php
SQLQuery.class.php
etc..

Even giving you a sort of memetic namespace of

ajax.JSONableItem
database.DatabaseConnection
database.SQLQuery
etc..

Which encourages code re-use by making it very easy to transfer classes between projects. This brings me on to the next problem in that there is no standardised way of importing these classes into your script files. I normally have one file that imports all the class definitions into the project, somewhere high up on the bootstrap page but this means that every single class in the project is being loaded for each request to the server that is answered by PHP - not exactly ideal. I found a little class on the Pure PHP website called Include_once which is based on an interesting little idea - keep a list of imported files and only import a requested file if it is not in the list. Inspired by this I’ve written a little utility class rather unimaginatively named ClassLoader which does the above but via a sort of namespace that allows for nice structuring of class definition files in the file system and also the importing of whole folders of class files (packages). An example of it’s use is as follows:

  1. ClassLoader::import(‘database.DatabaseConnection’);
  2. ClassLoader::import(‘database.SQLQuery’);

or even

  1. ClassLoader::import(‘database.*’);

There are also a couple of other fun methods

  1. ClassLoader::getClassesLoaded()

tells you how many classes have been loaded and

  1. ClassLoader::getLoadAttempts()

tells you how many times ClassLoader has been asked to load class definition files. The reason that these may be different is because you can use ClassLoader to include class definition files at the top of other class definition files much in the same way you’d use the import statement in Java. So for a trite example, with the following file structure:

classes
  pretend
    InterfaceA.interface.php
    ClassA.abstract.php
    ClassB.class.php
    ClassC.class.php
  util
    ClassLoader.class.php
index.php

InterfaceA.interface.php

  1. interface InterfaceA {
  2. public function someMethod();
  3. }

ClassA.abstract.php

  1. ClassLoader::import(‘pretend.InterfaceA’);
  2.  
  3. abstract class ClassA implements InterfaceA {
  4.  
  5. }

ClassB.class.php

  1. ClassLoader::import(‘pretend.ClassA’);
  2.  
  3. class ClassB extends ClassA {
  4.   public function someMethod() {
  5.  
  6.   }
  7. }

ClassC.class.php

  1. ClassLoader::import(‘pretend.ClassB’);
  2.  
  3. class ClassC extends ClassB {
  4.  
  5. }

index.php

  1. require(‘classes/util/ClassLoader.class.php’);
  2.  
  3. ClassLoader::import(‘pretend.ClassC’);
  4.  
  5. $foo = new ClassC();

Neat. Of course, you don’t have to follow my file naming convention, feel free to do whatever you want, as long as the file has the name of the contained class before the first ‘.’ and the last four characters are ‘.php’ Configuration of the class is pretty simple - just change the static member variable ClassLoader::$classPath to suit your set up. Just make sure it’s readable by PHP. So, for example:

  1. require(‘classes/util/ClassLoader.class.php’);
  2. ClassLoader::$classPath = $_SERVER[‘DOCUMENT_ROOT’] . ‘/includes/myclasses/’;

or

  1. require(‘classes/util/ClassLoader.class.php’);
  2. ClassLoader::$classPath = ‘/usr/local/share/php5/myclasses/’;

or similar. Given the above, there’s a really tiny part of me that says I should start using proper stuff like J2EE or something. I try not to listen to it.

Popularity: 40% [?]

Colourblind

Thursday, August 31, 2006

I’ve just been reading this presentation paper on colourblindness while trying to be a back seat designer as the actual designer in the office chooses colours for buttons.

An amusing statistic from the paper is that 8% of caucasians have difficulty distinguishing between red and green. From the perspective of a web designer, it’s more worthwhile designing for their needs than the entire macintosh user base (even after accounting for the 8% of red/green colourblind mac users).

Popularity: 25% [?]

Web 2.0 phones home

Thursday, August 24, 2006

Just picked up a Sony Ericsson K800i. It’s a bona fide Web 2.0 (tm) telephone complete with rounded corners, drop shadows, an RSS reader and photo blogging tools.

I briefly had this phone on a contract with 3, but their network is so restrictive that I had to send it back - for example, you can’t access any websites that haven’t been “specially formatted for 3 Mobiles” (e.g. vetted to make sure they aren’t selling any mobile content) and you can’t use the built in email client unless you a) pay through the nose and b) have some huge pre-specified smart phone. No thanks.

Then I noticed that T-Mobile are currently being foolish enough to offer unlimited (okay, 2GB) mobile Internet access for a mere seven pounds fifty a month, even with 3G phones. Bwahaha. I will show them the error of their ways.

Now all I need to do is actually call someone with it.

Popularity: 25% [?]

Time machine

Tuesday, August 8, 2006

Is it just me, or does anyone else think that the Time Machine UI is just a tad excessive?

It’s a neat idea though, sort of like having a single user Subversion repository for your whole computer.

Popularity: 24% [?]

Hypersonic ringtones

Tuesday, June 13, 2006

<a href=”http://www.theregister.co.uk/2006/06/12/ringtone_adults_cannot_hear/”>http://www.theregister.co.uk/2006/06/12/ringtone_adults_cannot_hear/</a>

At last, a viable excuse not to answer the phone - I’m too old.

Popularity: 26% [?]

What’s in a name?

Tuesday, May 30, 2006

For the upcoming rewrite of Coffee & Feeds (aka The Great Refactoring) I’ve been farming out all the visible effects wizardry to the excellent Script.aculo.us, which is a JavaScript effects library based on the likewise wonderful Prototype.

Prototype itself adds a whole bunch of useful stuff to the JavaScript language turning it into a more agile beast at the cost of a few little niggles.

One of those niggles is it’s method of implementing inheritance which is teh_uglier. Enter Base which also implements inheritance but with much cleaner syntax. Justin Palmer’s blog, who is writing a book on Prototype ‘fesses up to using Base and Prototype together. Then the author of Prototype steps in and gives us the tantalising titbit that Base will eventually make it’s way into version 2 of Prototype.

This is great, but none of this solves the immediate problems of someone trying to write a robust, readable JavaScript application with inheritance right now. So you try to Google on Base and Prototype to get an idea of the problems you will face in combining them, however they are such generic terms that it proves difficult.

For the uninitiated, base is a common term used in OO related discussions, generally referring to an ancestor class higher up the inheritance chain and in terms of JavaScript, a prototype is a property of an object that is used to add custom properties to all objects of that type. So if you are looking for discussions about Base and Prototype, you are likely to come up with discussions about base and prototype. Kapish?

No matter how hard it is to remember the URL (where do the dots go?), at least script.aculo.us is not likely to get confused for something else. Even though I thought it said scriptalicious for ages.

Ugh.

Okay, yes, JSThing is also a stupid name, but I couldn’t think of anything better at the time, okay?

Popularity: 21% [?]

Beethoven or Beatles?

Monday, May 29, 2006

One of these is Beethoven’s ‘Moonlight Sonata’ and the other is the Beatles ‘A Hard Days Night’ (with the drum track removed). Can you guess which one is which?

And who says pop music is overly simplistic? Oh.

Popularity: 29% [?]