Sunday, 22 July 2007

Image Alignment Example (improved)

This one is similar to the previous post, only now we have images stacked vertically (using two different classes) and with captions underneath the images:

If you want to copy/use/test this example, remember to save the file with a .xhtml extension; you may find the browser has problems rendering it if you save the file with, for example an .htm or an .html extension.

Friday, 20 July 2007

Image Alignment example

Here's some sample code for using css and xhtml to align an image to the left or right within a paragraph:

Friday, 13 July 2007

Starting Firefox with the Profile Manager

If you need to create a "test" user for firefox (for example, if you're testing user settings or want to test out an add-on but not damage your normal profile:

Run firefox from the commandline:

firefox -ProfileManager

You can then create a test user.

Monday, 2 July 2007

Quick Perl template for Line and String Manipulation

We've got to tamper with some flat files (ultimately turning them into valid xml) - here's some quick notes (in the form of a *very* simple perl script) on the steps involved in:

- taking a filename as an argument (argv[0])
- opening the file
- keeping tabs on the line you're working on within the file (we use $. for this)
- getting access to the contents of each line within perl (we use $_ for this)

With this in mind, I can now use some extra arguments in the loop to start cutting up the data any which way. But here's a basic perl template for showing the line number and the string of text for each file in perl:

you would run this using something like:

./the-name-of-your-file.pl the-name-of-the-textfile.txt