Monthly Archives: February 2007

Perl CGI and taint

I’ve just emerged from an hour or so of debugging a Perl CGI script. I was trying to use the BioPerl module Bio::Factory::EMBOSS in CGI. My minimal test CGI script, cgi.pl, looked like this:

#!/usr/bin/perl -Tw
use strict;
use CGI;
use Bio::Factory::EMBOSS;

my $f = new Bio::Factory::EMBOSS;
my $cgi = new CGI;

print $cgi->header,
      $cgi->start_html,
      $cgi->end_html;

Apache doesn’t like it:
Read the rest. . .

An OpenOffice tip

I get very aggravated when my software tries to second-guess my intentions. An example of this is when OpenOffice tries to autoformat my lists. I type “3.1” plus some text, when I hit “Enter” for a newline my numbering changes to “3”, with “4” on the next line. Really annoying.

Of course, you can turn this off (along with many other options). Head up to Tools->AutoCorrect and uncheck “Apply numbering – symbol:”. Thanks to Steve’s BPCA blog for the tip.

Scripting or compiled?

I spent some of my weekend searching the web for C++ tutorials. It was an interesting exercise, because I now have the impression that people who write tutorials for compiled languages think rather differently to people who write about scripting languages.

Scripting tutorials seem to begin by defining an interesting task, then explaining how to do it. When I first wanted to use Perl to fetch and parse data from the web, I used an excellent tutorial entitled “Scoring a Web Page with Perl and LWP”, no longer online so far as I can tell. Similarly, the BioPerl tutorials get straight into the business of parsing and manipulating biological data files. This is my preferred approach – I think the best tutorials show you how to do something useful, interesting and real-world straight away.

On the other hand, many of the tutorials that I’ve read for C, C++ or Java seem to concentrate solely on the structure and syntax of the language. They begin with “Hello World” then take you through variables, loops, control structures, pointers and functions. At some stage they get to objects which are always explained using a variety of analogies (cars, animals, computer parts). And then – they stop. You can go through a 12 or 20-part tutorial, understand it fully and still be unable to code anything more useful than “Hello World” at the end of it.

I wonder why this is? Is it because to do anything useful with these languages, you need in-depth knowledge of their libraries, which is beyond a simple tutorial? Or are “scripting people” more practical and interested in getting the job done quickly? Or perhaps languages like C/C++ are traditionally more suited to mathematical operations, preferred by engineers and physical scientists, whereas biological scientists do more text processing and so prefer the “quick and dirty” script? Or is it just a feature of web tutorials – perhaps I need a book.

I’m interested in how other computational biologists learned their programming skills, what languages they use/prefer, how they came to choose those languages.

Emacs tips

It seems there’s a WordPress blog for almost everything. My latest discovery is minor emacs wizardry, which is full of great tips for getting the most out of Emacs. It will appeal especially to people who use Emacs as their sole application (which, if you didn’t know, is entirely possible).

My first “AJAX for bioinformatics” page

So you’ve heard about this wondrous thing called AJAX. You’re dimly aware that it can generate interactive, user-friendly and dynamic websites without the usual cycle of reloading the page after submitting a request to the server. You know that Google Maps and Flickr are two excellent examples. You’re keen to explore the possibilities for your bioinformatics web applications. What you need is a “minimal example”. Where do you start?

That’s the situation that I was in last weekend and here’s what I did.
Read the rest…

Handy WordPress tool

Ever wanted to insert an equation into your WordPress.com blog post? Well now you can. The comments that accompany this announcement are quite amusing; it’s divided WordPress users into those who say “wow, cool!” and those that say “what the hell is this and why would I want it?” Like I said – so you can put equations in your posts. Doesn’t everyone need to do that?

I assume the feature uses something like mimeTeX, which enlightened bloggers have employed for quite some time.

W3Schools

Some years ago when I was first trying to learn web programming, I discovered a resource called W3Schools. This one comes under the “I can’t believe it’s free” category. They have an amazing amount of material covering all aspects of client-side and server-side scripting. The site is cleanly-designed, very functional and features clear explanations with code, cut-paste examples and dynamic demos. I can’t recommend it enough.

I’m currently using it to learn the basics of AJAX. I know, I’m years behind the times, but I’m excited by the possibilities for dynamic bioinformatics websites. Type in a gene UID, get a bunch of data back from an NCBI XML file, that sort of thing.

OpenOffice 2.1 on Ubuntu Dapper

If you want the latest and greatest OpenOffice (currently 2.1.0.6) on your Ubuntu system, the instructions are here. They worked perfectly for me. The key is not to panic when the system tells you that ubuntu-desktop will be removed; it’s a meta package, you won’t lose your desktop.

Basically you download and extract the OO tarball, find the folder of RPMs, use alien to convert them to deb packages and install using dpkg. It’s pretty straightforward and the latest OO looks great.