Vote trip

I set off to London to vote after finishing off the day at university today. Thanks to Reading being only a jump from London my trip to the polling station took a only little over an hour long, despite having to travel by foot -> bus -> train -> Underground -> foot to get there. Anyway, I decided to capture the trip...

















I am voting for change

Thanks to the recent arrangements to have a polling station here in the UK, I too now have the opportunity to have my say in the Maldivian Presidential Elections - for the very first time in my life. And for me, deciding on who to vote for in this round is a very very trivial matter - I am voting for change.

As a matter of fact, I've known I would not vote for Gayyoom ever since the two years I spent working at the President's Office (PO) six years ago. Being fresh out of school, much of the environment at PO - the cult-like demands for "loyalty" and regular "office meetings" where employees are made to sing songs praising the man (with lyrics written specifically for the occasion) - came on as a total shocker to me. By the time I left PO, having witnessed the various practices and policies enforced and encouraged, I was totally disillusioned by Gayyoom and Maldivian politics.

I am voting for change because I want to see an end to the growing national debt, care-free spending and wasteful expenditures and because I can't bear to see the growing disparity between the rich and the poor, the elite and the unprivileged and Male' and the atolls. I am voting for change because I've had it with the gangs, the drugs and the violence and because I want everyone to be able to live in peace with the rule of law upheld. I am voting for change because I believe in democratic values and because I support a free press. I am voting for change because I question the sincerity and the competence of Gayyoom to do these things and because 30 years of rule is 20 years longer than I can accept.

I am voting for change because I staunchly champion the celebration of diversity - of people and their thought - which I believe this country desperately needs and which I believe the Watah Edhey Gothah coalition represents. There, ofcourse, is no guarantee that this "change" will be any better but I'd rather give them the benefit of the doubt...

Javascript Thaana Keyboard version 4.0

Here is an update to my Javascript Thaana Keyboard (JTK). This 4.0 release packs in a bunch of new features, making JTK much more powerful and more flexible than any of the earlier releases.

Keyboard support:

Most notable on this new release is the introduction of support for the various different types of Thaana keyboard in use. JTK now supports the following keyboard layouts:

Phonetic (Segha version): This keyboard is perhaps the most popular Thaana keyboard layout. JTK identifies this keyboard as "phonetic".

Phonetic (Hassan Hameed version): This keyboard is similar to above but notably differs in its mapping of alifu, abafili, aabaafili, gaafu and the sukun. JTK identifies this keyboard as 'phonetic-hh'.

Typewriter: This is the standardized Thaana layout used on typewriters. JTK identifies this keyboard as 'typewriter'.

Browser support:

JTK 4.0 adds support for IE5.5, which has a very significant market share still. Hence JTK should now work perfectly well on Microsoft Internet Explorer 5.5+, Mozilla Firefox 1+, Opera 9+, Apple Safari 2+ and Google Chrome 0.1+.

Basic usage:

The basic usage allows for fast and easy integration of JTK on your Thaana web pages.

1. Link the file in the HEAD section of the page:

2. For any element accepting input (i.e. INPUTs, TEXTAREAs, content-editable DIVs), assign them the special class name "thaanaKeyboardInput". JTK will automatically handle text entry to any element with that class name. You can assign further classes to the elements without ill-effect, if needed.

3. There are two ways to set the keyboard used for an element.
defaultKeyboard method: This method allows setting a default keyboard to be used on all elements handled by JTK. To do this, add the following to the HEAD section of your web page but make sure it is added after the code inserted from step 1 above.

thaanaKeyboardState method: This method allows per element control on the type of keyboard used by an element handled by JTK. To do this, add a form element (can be a radio, checkbox, select, hidden or text field) with its name set to the text entry element id suffixed with the string "_thaanaKeyboardState". The value of these fields should specify either 'off', 'phonetic', 'phonetic-hh' or 'typewriter', indicating the status and the keyboard in use.

So, if you had a text entry field with the id "fullname" then the keyboard could be specified using a hidden field as follows:



4. Make sure that the text direction for the Thaana fields is set to "rtl". This can be easily achieved using CSS, by adding a class definition for the "thaanaKeyboardInput" class or by any other method of your choice. Adding the following to your CSS definition should suffice for most uses:
.thaanaKeyboardInput {
    font-family: faruma, 'mv iyyu nala', 'mv elaaf normal';
    direction: rtl;
}

If the above instructions are followed correctly, the JTK Thaana functionality would be in effect soon as the page has loaded!

Advanced Usage: The JTK object, methods and properties

To facilitate advanced integration functionality for developers looking to have (finer) control over its behavior, JTK now makes itself available as a public object named "thaanaKeyboard".

The following properties and methods exposed by the "thaanaKeyboard" object:

defaultKeyboard: [property] The Thaana keyboard layout type to default to when JTK enabled elements do not have a keyboard specified.
Valid values are: 'off' to keep Thaana disabled, 'phonetic' to use the standard phonetic layout, 'phonetic-hh' to use the phonetic layout by Dr. Hassan Hameed and 'typewriter' to use the typewriter layout.

setHandlerById ( id, action ): [method] Sets the state of the JTK handler for a page element.
The id argument should be a string containing the id of any content-editable element. The action argument should specify either "enable" or "disable" depending on whether input handling for Thaana should be enabled or disabled, respectively.

setHandlerByClass ( class, action ): [method] Sets the state of the JTK handler for a set of page elements.
The class argument should be a string containing the class name of any content-editable element (i.e input, textarea etc). The action argument should specify either "enable" or "disable" depending on whether input handling for Thaana should be enabled or disabled, respectively.

License:

JTK 4.0 is released under the MIT License, allowing its use in both personal and commercial applications as long as the copyright and license permission notice remains intact.

Demo:

Check out the demonstration and testing page here.

Download:

- original full source version (10.0 KB)
- packed version (2.33 KB) [recommended]

As always, drop a line here if you use it and/or have problems or suggestions. Enjoy. :-)

Update (31-Oct-2008): This version is now superseded by release v4.1.

MySQL and Unicode Thaana

Anyone developing custom code for a Thaana application or website will undoubtedly run into many interesting challenges and issues. Judging by how often I get emails asking for help with getting MySQL to play nice when using Unicode Thaana, I'd say it's one of the very first issues many (newbie?) web developers face.

Here are some of the basics that one should keep in mind when attempting to use Unicode Thaana and MySQL.

Charset
It is very important that the correct character set be used when using Unicode Thaana for MySQL to correctly recognize the text. If you are going nuts over your code returning "???" or junk characters after trying to store Thaana text into a MySQL database, then it most certainly is because of an incorrect charset being used.

I recommend issuing the following SQL commands upon successfully establishing a connection with the MySQL server.
SET NAMES utf8;
SET CHARACTER SET utf8;

Read up the MySQL reference page on connection charsets and collations for more details.

Collation
MySQL does not have special language specific collation rules for Thaana - and there is no need for such far as I am aware. I recommend using the "utf8_unicode_ci" collation when creating tables and fields in MySQL.

Refer to the MySQL reference page Unicode character sets for more details.

Happy databasing :-)

Dhiraagu e-Directory data for download (2008-10-06)

Here is the data from Dhiraagu e-Directory that I had mentioned in my previous post "Phone usage (Maumoon, Political Parties, Government and Businesses)". The data was acquired yesterday and contains all of 338,371 entries (made up of 305,198 mobile numbers, 24423 landline numbers and 8750 island/resort numbers) that was listed on the e-Directory service. It is interesting to note that the total entries now is 114,018 more than the March 2007 data I published earlier. This increase comes from an almost doubling of mobile numbers registered (the March 2007 showed 194,025 mobile numbers)!

Anyway, here's the data. As before, it's presented as a Tab-Separated Values (a.k.a CSV) format file racking up 16.8MB uncompressed. I've Zipped down the file to 5.1MB for easier downloading. The file can be opened in Excel, OpenOffice or imported into Access or any other database.

- Download edirectory-2008-10-06.zip

Enjoy!

Phone usage (Maumoon, Political Parties, Government and Businesses)

I got curious today after reading an amusing blog post about an unsolicited SMS message someone had supposedly received from a mobile phone number registered to the current President of the Maldives Maumoon Abdul Gayoom. Now, this is a time of intense political competition between the various candidates camps and an originating number on a SMS is pretty easy to spoof, so I'm not sure if it really did originate from the said number. But that's not what really struck me...

What got my attention was the fact that there now was a publicly listed mobile phone number registered to Maumoon. I've never before seen a mobile number registered to him listed on the Dhiraagu e-Directory and a quick search through various old snapshots of e-Directory data that I had confirmed that there indeed had been none - atleast none up until early June which was the last e-Directory snapshot I had. Anyway, I grabbed a fresh snapshot of the e-Directory and spent a little while running some interesting queries on the data.

Here is some of what I found:

Numbers listed on e-Directory:
Mobile305198
Landline (Male')24423
Landline (Islands/Resorts)8750
Phones/Customer on Avg2.9


Political parties:
Dhivehi Rayyithunge Party92
Maldivian Democratic Party11
Social Liberal Party6
Adhaalath Party6
Islamic Democratic Party6
Jumhooree Party2
Peoples Party2


Registrants (Top 5):
Dhivehi Raajjeyge Gulhun Pvt. Ltd.833
Maldives Police Services200
State Electric Company Ltd.191
Indira Gandhi Memorial Hospital167
Maldives Customs Service164


Most common names (Top 5):
Mohamed Rasheed1273
Ibrahim Rasheed1250
Ahmed Rasheed1089
Ahmed Mohamed1088
Mohamed Ali1087


Government (Top 5):
Maldives Police Services200
Indira Gandhi Memorial Hospital167
Maldives Customs Service164
Min. of Defence & National Security141
President's Office139


Ministries (Top 5):
Min. of Defence & National Security141
Min. of Atolls Development114
Min. of Health76
Min. of Finance & Treasury76
Min. of Environment Energy and Water67


Businesses (Top 5):
Villa Shipping & Trading Co. Pvt. Ltd.163
Universal Entp. Pvt. Ltd.156
One And Only Reethirah149
One & Only Kanuhura125
Kurumba Village124


And finally...

Maumoon Abdul Gayoom
Mobile16
Landlines3


Note: The information presented was obtained using the entries on the Dhiraagu e-Directory (as available today).

Thaana conversions class for PHP 5 - v0.3

Here is a minor update to my previously released Thaana Conversions class for PHP. This new version adds the function convertUtf8ToEntities() which I had forgotten to include in the previous public release.

The Thaana Conversions class for PHP provides a number of useful functions for the conversion and transliteration of text between various Thaana representation formats.

Functions listing:
- convertUtf8ToUnicodeIntegers()
- convertUtf8ToAscii()
- convertUtf8ToEntities()
- convertEntitiesToUnicodeIntegers()
- convertEntitiesToUtf8
- convertEntitiesToAscii()
- convertUnicodeIntegersToUtf8()
- convertUnicodeIntegersToEntities()
- convertUnicodeIntegersToAscii()
- convertAsciiToUtf8()
- convertAsciiToUnicodeEntities()
- convertAsciiToUnicodeIntegers()


Requires:
PHP 5

License:
Open Source MIT License

Usage:
<?php
// Load the class
require 'thaana_conversions.obj.php';

// Initialize the Thaana object
$thaana = new Thaana_Conversions();

// Example: Converting Thaana expressed as HTML entities to ASCII
echo $thaana->convertEntitiesToAscii('&#1931;&#1960;&#1928;&#1964;&#1920;&#1960;');

// Example: Converting ASCII Thaana to UTF-8
echo $thaana->convertAsciiToUtf8('rWacje');
?>


Download:
- Thaana_Conversions.zip (v0.3, 4KB)

Drop me a line if you run into trouble with any of the functionality or have comments/queries. Enjoy :-)

Update (29-Jan-2009): This version is now superseded by the v0.4 release.