Thursday, 23 September 2010

MySQL: Changing the order of a table column

In an ideal purely standard SQL world, one should never have to care about the order of a table's columns. But we're not in an ideal world, and sometime we want to change the position of a table column. Here's how to do it:

ALTER TABLE mytable MODIFY column_move <WHATEVER TYPE IT IS>  AFTER another_column

Note that you need to MODIFY the column with its exact type not to loose any data. Copy/Pasting is your friend here. You can also use BEFORE instead of after.

Saturday, 18 September 2010

Version names brainstorming

Recently we had a brainstorming session in the office to find ubuntu-style version names for our product. Here's my list of suggestions:

Anemic Antelope
Blistering Barnacle
Crying Crocodile
Dubious Donkey
Emotive Elephant
Fiddling Fugu
Grumpy Giraffe
Hairy Haddock
Introvert Impala
Jolly Jellyfish
Kitschy Kitten
Lubricious Lama
Mystical Magpie
Nyctalopic Nautilus
Operatic Oppossum
Persistant Pinguin
Quantitative Quahog
Refreshing Rodent
Suspicious Salamander
Tickling Tiger
Ultramarine Unicorn
Voluptuous Vixen
Witty Wapiti
Xenomorphic Xenopus
Yummy Yeti
Zooming Zebu

Sometime, software engineering requires a bit of poetry :)

Tuesday, 14 September 2010

Perl: How to release a developer only version to CPAN

If you're about to release a new module and have some beta testers, it's probably a good idea to release a developer only version first and then switch it to a final version number after your beta testers (that includes you :) ) are happy with it.

To do that, simply appends the release candidate number at the end of your version number. To release the first dev RC version of version 0.07, simply do:

our $VERSION = '0.07_01';

In your main package.

The CPAN will detect it and make your release a dev release only.

Monday, 13 September 2010

LaTeX: Hyphenate single long words in narrow tabular columns

Consider the following LaTeX code:

    \begin{tabular}{ | p{2cm} | l | l | p{5cm} |}
    Incredibilidable & foo & bar & baz \\

When you render it, the first column overflows on the second one because 'Incredibilidable' is considered to be the first word of a paragraph, and LaTeX does not hyphenate first words of paragraphs. So here's what you get: 
And this doesn't look nice.

To fix this, we're going to tell LaTeX our word is no longer the first of the paragraph. To do that, we insert a zero length horizontal space before it:

  \hspace{0pt}Incredibilidable & foo & bar & baz \\

The rendering now turns into:

Et voila!