PHP code to add st, nd, rd or th to a number
Pete Donnell — Wed, 02/03/2010 - 11:42
This one's short and sweet: while working on a PHP application I needed to format some numbers as text so that, for example, '1' became '1st', '13' became '13th', '22' became '22nd' and so on. There isn't a built-in PHP function to do this (as far as I know) and none of the code snippets I came across online were very neat, so I ended up writing my own function. Since it's something that I imagine gets used a lot, I thought I'd put it up here.
Review of Trine, a physics-based PC game
Pete Donnell — Fri, 12/25/2009 - 17:50
As the lack of recent updates might suggest, things have been quite busy work-wise recently! Since I've been working a lot, and since it's Christmas, I thought I'd write something a bit different for this article. While I haven't had much free time lately, I've spent a bit of it playing a game by the name of Trine. It's promoted as a physics based platform/puzzle game, so there is a vague science angle to tie in with the rest of the site!
Overall I found Trine a lot of fun, with beautiful graphics, great voice acting and some really fun levels. However, it's a little let down by some minor bugs and glitches in the physics. Personally I enjoyed it a great deal, but hardcore gamers might find it a little too short and on the easy side.
The Netgear WGR614v9 wireless cable router: replacing Virgin Media firmware with standard Netgear firmware
Pete Donnell — Tue, 09/08/2009 - 21:18
A friend was having some trouble with the Netgear wireless router he was given by Virgin Media, which I fixed by replacing the Virgin-supplied firmware with the latest Netgear firmware. Doing this required a bit of digging around, so I thought I'd write a quick guide to sum up the information I found online.
Setting up Ajaxterm on Ubuntu 8.10
Pete Donnell — Sun, 08/16/2009 - 16:39
Like many people, I rely heavily on ssh to maintain and configure computers remotely. However, doing so usually requires making an outbound ssh connection from the computer you're working on, which isn't always convenient. For example, if you're using someone else's computer, the chances are they're using Windows and don't have an ssh client program installed. PuTTY goes a long way to mitigating this problem, but it can't help you if the place you're connecting from has a firewall that blocks outgoing ssh traffic, or if your ssh server is configured to require RSA key authentication.
This is where Ajaxterm and Anyterm come in useful. Essentially, they are apache modules that provide a webpage containing an ssh terminal. So long as you have access to the internet, you can then go to this webpage in a browser and use it to log in to your system using ssh.
Writing a thesis using LaTeX
Pete Donnell — Sat, 08/15/2009 - 16:56
If you're a science postgrad student, the chances are you've heard of LaTeX. It's very commonly used to write scientific papers, largely because it's very good for typesetting equations. A lot of science postgrads also write their theses using LaTeX, but very few of them seem to be given any training in how to use it. I know I didn't get any while writing mine!
There are plenty of decent LaTeX tutorials out there, so I am not going to attempt to write a better one here. However, a real life example can often make things clearer, no matter how many tutorials you've read. Partly for this reason, and partly in an attempt to make my PhD research more widely available, I've decided to put my PhD thesis online, along with the images and LaTeX code used to generate it.
Nautilus and autofs
Pete Donnell — Sat, 07/25/2009 - 18:16
For the last few months I've been using Ubuntu 8.04 on a laptop for work, and a couple of days ago while working from home I hit an issue that I couldn't find mentioned anywhere. When opening Nautilus (the default GNOME file manager), it wouldn't display the contents of my home directory. When I'd been working onsite this problem hadn't occurred, and I hadn't changed any settings, so I was a bit nonplussed, especially as every other directory I tried displayed instantly. At first I thought the problem might be to do with bookmarks in Nautilus, or the tracker desktop search application (see this discussion) but that turned out not to be the case.
The problem turned out to be to do with Nautilus' handling of autofs and symlinks.
Getting PHP and SQLite running on IIS 6
Pete Donnell — Thu, 07/16/2009 - 11:29
Recently I developed a web application for a client using PHP and SQLite. As you might expect, I did the development on a Linux system, and all seemed well. When the time came to move to the client's production system, which runs IIS 6 on Windows Server 2003, I naïvely assumed that it would be a simple transition - after all, PHP has been supported on Windows for quite some time. Unfortunately, this turned out not to be the case.
Journal Impact Factors - a good free tool
Joe Parker — Wed, 07/08/2009 - 20:13
Recently, I've taken on more consulting work outside my own immediate area. http://www.eigenfactor.org, a free impact factor tool, has been incredibly handy. Here's why.
Getting to grips (well on some level, at least) with a new system is a bit exciting and not a little empowering, too - like the first time you really understood crystalization as a kid (remember those copper sulphate crystals in the jar?)
The problem is that journals always fall into four categories in my book;
- Top level ones like Science, Nature, PLoS and PNAS,
- Reviews and stuff that are usually a good place to start,
- Key articles in specialist journals, and
- Crapola which you don't need to bother with (to start with, at least).
The trouble is, while 1, 2, and 4 pretty much find themselves, working out which journals to look in for the specialist stuff when you start in a new field is pretty hard. For instance, the Journal of General Virology, Journal of Virology, and Virology all deal, obviously, with viruses and their biology... but which is the more authoritative?
This site contains a collection of tutorials, howtos, code snippets and so on, focusing on science and open source related areas of computing. The site is maintained by the staff of Kitson Consulting and occasional guest writers. Kitson Consulting is a UK based company specialising in science and IT.
