The Mixed Blessings of Non-Relational Databases

by Si Email

I came across this interesting paper by Ian Thomas Varley while reading the Hbase documentation which discusses the pro's and con's of relational and non-relational databases (SQL and no-SQL). Its not a new article (2009) but an interesting read if you're new to the topic:

No Relation: The Mixed Blessings of Non-Relational Databases

Shaving my hair for cancer

by Si Email

I started growing my hair in December 2010, mostly because we were on holiday and I didn't feel like cutting it, but when I got back home I head about the CANSA shavathon happening on the 5th of March. This is definitely a good cause and so I decided to keep my hear uncut until the shaveathon which was this last Saturday.

This is what I looked like before...

Linda and I showing my uncut hair

SyntaxHighligher for b2evolution

by Si Email

I was looking at the available syntax highlighters for b2evolution and the plugins that don't require installing additional software are not great. But thanks to Alex Gorbatchev there is a great JavaScript highlighter that requires no additional software installation on the host server.

Integrating it with b2evolution was very simple and only involved creating a plugin that adds the css and javascript links into the page header. I did try to use the autoloader but couldn't get it to work so instead opted for statically including the files. You can configure which brushes to include as well as which theme to use via the plugin admin page.

You can download the source from here: http://isimon.co.za/pub/b2_syntaxhighlighter_plugin.zip

Follow these steps to install the plugin:

  • Download the source from the link above.
  • Unzip it into the plugins/ folder in the root of your b2evolution installation.
  • Download SyntaxHighlighter from http://alexgorbatchev.com/SyntaxHighlighter/download
  • Unzip it and copy the scripts/ and styles/ folders into the plugins/syntaxhighlight_plugin/ folder.
  • Log in to you b2 evolution installation and install the plugin (for info on how to do that see the b2evolution manual).
  • Go to the plugin configuration page and select the theme (defult theme is Defult) and the brushes to load (by default only the Java brush is loaded).

Once installed you can include code in your posts enclosed in <pre> tags and it will be automatically highlighted by SynatxHighlighter. For example, writing this in you post:

<pre class="brush: java">
public static void main(String[] args) {
System.out.println("SyntaxHighlighter in b2evolution");
}
</pre>

results in the following highlighted block:

public static void main(String[] args) {
    System.out.println("SyntaxHighlighter in b2evolution");
}

This plugin has been tested on b2evolution 3.3.1

Convert column index to spreadsheet column name

by Si Email

Here's a simple Java method I wrote last week to convert an integer column index into the letter format that spreadsheet programs use. For example:

  • column 0 = A
  • column 25 = Z
  • column 26 = AA
  • etc


I needed it while I was writing an Excel report for iDART that required formulas.

/**
 * Converts a numeric column index to a letter column index 
 * i.e. 0 = A, 27 = AB
 * 
 * @param columnIndex
 *            the numeric index of the column
 * @param zeroBased
 *            a boolean indicating whether the columnIndex is
 *            measured from zero or from one
 * @return String representing the column in letter notation
 */
public static String columnIndexToLetterNotation(int columnIndex, boolean zeroBased) {
	if (!zeroBased && columnIndex > 0){
		columnIndex--;
	}
	
	int base = 26;
	StringBuffer b = new StringBuffer();
	do {
		int digit = columnIndex % base + 65;
		b.append(Character.valueOf((char) digit));
		columnIndex = (columnIndex / base) - 1;
	} while (columnIndex >= 0);
	return b.reverse().toString();
}

A lot to learn

by Si Email

I've been writing software for some 8 years now but I think I need to go back to school. Having studied Electrical Engineering I missed out on all the algorithms courses and the like that computer science students usually take. I've decided its time to catch up. Unfortunately I'm working full time so I guess I'll have to squeeze in the reading after hours...

1 2 3 4 5 6 7 >>