A chemistry table of everything

Wow, I never realised that the start of the year could be so busy! Anyway, while I look for new interesting things to post, here is something that I made a while ago – a table of “everything” for chemistry measures, detailing their relations to the mole.

Update: Find this useful? Maybe you’d like part two of our series: a diagram of organic reaction pathways.

The instructions are on the A4 document, but you basically just follow the symbols of one colour around the semi-triangular table, counting the thick lines as “equals” and the thin ones as “multiply”. So, if we want to find out the relationship between mass (m) and moles (n), we just look at pink, and following it around get m = M × n. Similarly, for the ideal gas law, we look at light blue, and get V × P = n × R × T. Simple, eh?

Find it confusing? Have a suggestion? Then post a comment, and I’ll see what I can come up with (though it’s a while since I gave up chemistry)!

Note: this table is primarily intended as a revision tool for High School chemistry students, particularly those studying the Victoria, Australian VCE Chemistry 3/4 syllabus.

Creating a customised Windows PE 3.0 image

Microsoft Windows PE 3.0 is a stripped-down version of Windows 7 based on the 7100 kernel. Capable of running Windows-32 applications, Windows PE can be used for deploying, servicing and repairing Windows installations, as well as running other tools, such as Norton Ghost. Windows PE 3.0 is created using the Windows Automated Installation Kit (AIK) for Windows 7, a free application suite available on the Microsoft website. The Windows AIK for Windows 7 must be installed on a machine running Windows Vista or Windows 7.

Writing a guide for this sort of product is a bit odd for me, however I have been working on making a Ghost-based pre-installed environment recently and was asked to create an article as to what I did.


Useful PHP debugging functions

While we all wish that we could program in PHP without making any mistakes, sometimes we do encounter bugs that prevent our scripts from running correctly. When this happens, we have to debug, however, especially when programs get very big, trying to figure out the source of the errors can get very confusing. Nevertheless, PHP provides some useful functions to help in the debugging process. Some the ones I find particularly useful are detailed below.

  • print_f(): this function just prints out the value of the argument. However, unlike a simple echo it will display the contents of non-scalar variables such as arrays and objects.
  • var_dump(): similar to print_f(), however this function will display more detailed information about the variable passed, such as its length and data type.
  • debug_backtrace(): generates complete information about the function stack at the time of the debug_backtrace() call.
  • error_reporting(): temporarily sets a custom level of error reporting at runtime. Many hosts have error reporting set to 0, which is a good thing to do in live environments, but if you are using such a host for development, it is better to set the error level to E_ALL, so you can actually see what is going wrong instead of having scripts fail silently.

Of course, there are many other functions within PHP that can help you debug specific problems, such as mysql_error() for problematic database queries, however the above are four general functions that I have found can help in most cases.

Functions for the TI-89

Nothing to do with web development, but a while ago I wrote some Maths functions in BASIC for my TI-89, a calculator that has been in my cupboard gathering dust for the past year or so. However, I recently dug it out, and discovered all of my old code still on it. So, all the functions I wrote are now available for download through the Lab.

They are all fully documented, both in a NoteFolio document for reading on-calculator, as well as in a standard text file. Some of the functions are slightly experimental, and reading what they do before using them is advised.

These functions will be most beneficial to people taking the Victoria, Australia VCE Mathematical Methods course (as that it what they were written for). However, there are also some general-purpose utility functions in there that would make life easier for anyone using or writing BASIC for the TI-89 series of calculators.

Disclaimer: while some diligence has been followed in ensuring that the functions are correct, and return the right answers (after all, I used them myself), I cannot be held responsible for any erroneous calculations that may result following the use of such functions.

MySQL Querier - quick DB management

A long time ago (e.g. a couple of years) I wrote a very small one-page PHP script for myself to use to quickly manage my MySQL databases through direct SQL queries, phpMyAdmin being to slow in some occasions. Now, I’ve put the source up in the Lab, so anyone can use it.

The querier directly passes on MySQL queries that you enter into it, and in the case of SELECT requests returns the result in tables. That’s all to it, but if you quickly need to change something it can come in very handy.

It’s very simple to use, and quite secure. Feel free to modify it as you wish.

Notes on WYSIWYG

I’ve been having quite a few discussions recently on the merits and disadvantages of using WYSIWYG editors, like Dreamweaver and iWeb, and even direct PSD to HTML converters such as SiteGrinder, for the creation of websites. Is it possible to create valid, accessible, and cleanly marked-up pages with such tools? These applications all too often create tag soups consisting primarily of tables and absolutely positioned elements, that browsers struggle to render and search engines fail to comprehend. However, in the hands of a skilled designer, can these problems be overcome?

A note on the definition of WYSIWYG: a web WYSIWYG editor is a program that automatically generates HTML / CSS code based on a visual design. Photoshop by itself is not a WYSIWYG editor, because it does not generate HTML – it only aids in the design process.


URL rewriting using PATH_INFO

There are many reasons to rewrite a website’s URLs – for SEO purposes, better organisation or simply so that the URLs look nicer. The most popular way to do this on Apache servers (and on all servers it has been ported to) is to use mod_rewrite, a server configuration option that uses regular expressions to rewrite URLs dynamically. However, mod_rewrite isn’t always available – you could be using a different server such as Lighttpd, or may simply not have rights to create .htaccess files on a shared host. For such situations, an alternative is needed, and one such alternative is the use of the PATH_INFO server variable.

The PATH_INFO method works by appending more information after the script name when constucting a request. For example, a site may have a page /index.php, which can be requesed over HTTP. However, if a request is made to /index.php/foo/bar instead, the webserver will still understand that to want /index.php, but the extra information remains in the path, and can be retrieve in PHP using the $_SERVER['PATH_INFO'] (or, if that doesn’t work, $_SERVER['REQUEST_URI']) superglobal index. So, for example, if the URL structure was set up so that the page at /index.php/page retrieved page.php, index.php could have the following code:

    $page = pop(explode("/", $_SERVER['PATH_INFO']));

That’s all there is to it, however if needed the method could be extended to include multiple variables, etc., or use the retrieved path info to fetch data from a database. While this method isn’t as elegant or nice-looking as a server-rewrite solution like mod_rewrite, it is still better than nothing, and is portable between all environments.

Three simple reasons why tables for layout are bad

Using tables for layout is bad, as is repeated over and over again. However, it is often hard to find definitive explainations on the disadvantages of coding in that manner. Well, here are three really simple reasons why, in my opinion, tables are not a good thing to use for the structure of web pages.


On SPAM and the Akismet service

This blog has been spammed alot recently, mostly mindless crudely-crafted mass solicitations, and I was hard-pressed to find a good solution. Even my CAPTCHA was not working that well. However, after setting up my blog system to use the Akismet service, all spam has been completely stopped.

Akismet is a service developed by Automattic, the creators of WordPress, originally as a plug-in for their blog and content management system. Basically, it is a small web-based API that takes various details about a comment, such as its origin and content, and then returns a recommendation as to whether the comment is spam or not. Lucky for us non-Wordpress users, Automattic have decided to make the API open for anyone to use. All you need is a account, and a method to interface with the Akismet system.


Authenticating NTLM with MS Exchange

A little while ago I discovered a script that emulated the NTLM challenge-resonse sequence in PHP – perfect for the intranet-based messenging system I was developing. Unfortunately, it didn’t actually authenticate users with the AD.

Now, it is rather hard to get a Apache server to connect directly to the domain controller, however @prajalpa on twitter came up with an excellent easily-accessable alternative – using the domain’s Exchange email server to authenticate instead. The challenge-response method is the same in this case, but only a simple socket has to be opened to connect, and the challenges can be sent in plain-text. A great article on NTLM over Exchange SMTP can be found at

@prajalpa’s script can be found here:, modified from the original article I found at I finally got it to work in the version below.