Page to Unicode Thaana 1.0

Here's a nifty little tool I made a few years ago that automatically and intelligently picks out the bits of text that use a non-Unicode Thaana font on any web page and converts it to Unicode. That probably doesn't make much sense to most of you but read on - there's a section for general web users and one for developers.

General users


Take the website of Haveeru Daily as an example. It uses a now-archaic method of displaying Thaana. Browsers cannot and will not substitute an alternative workable font if your computer does not have the exact Thaana fonts it requires and will display as non-sensical English text. But then take Miadhu Daily, which relies on something called Unicode. Browsers can and will load up the site perfectly readable as long as you have any one of the many Unicode Thaana fonts on your system. And in many situations, like at public libraries or on some phones and devices like the Kindle, Unicode-based Thaana web pages will load up just fine as there usually is some Thaana-supporting Unicode font on it while those that use the more archaic method will fail.

I came across this problem a few years ago while at the university lab one day and there was some interesting events taking place in the Maldives which I wanted to read about. Haveeru had the most news articles and was the most up-to-date but I couldn't read any of it as the Thaana fonts were not on the system and I was not allowed to install the fonts. So I wrote some quick code, specifically a bookmarklet, that converted the text on the site on-the-fly to use Unicode.

Anyway, if you find yourself in a similar situation, here is what you could do. Right click the PUT bookmarklet link below and choose to bookmark the link. When on a page, just click the PUT bookmark and the page should convert to Unicode and display Thaana.

Page to Unicode Thaana bookmarklet v1.0

Demo

Haveeru before


Haveeru after


Developers


Here's a slightly different version of the above script that can be used on web pages that do not use Unicode Thaana to offer the pages in Unicode without requiring any change to the content management system, editor etc that you have in place already. Add the script to your non-Unicode Thaana based web pages where appropriate and your visitors will get a Unicode-based web page as long they have Javascript enabled.

Usage
I would recommend that it be added towards the end of your page HTML, right before the closing BODY tag.



Download:
- put-1.0.min.js (minified, for production use)
- put-1.0.js (full source)

Enjoy :-)

Thaana on Android: Font installation

I have owned a Google Nexus One device since it came out early this year and I love it for the great hardware specifications of the phone and the customizability of Android. As usual, one of the first things I did when I got it was to explore Thaana usage on the Android OS. I have been meaning to do a write up since, so after almost a year here it is finally! This post addresses getting Thaana to display by installing a Thaana font.

Overview


With a healthy ecosystem of phones and tablets running Android now available, the free and open-source Android mobile operating system seem to be getting more and more popular across the world and in Maldives. Its official app-store hosts a large number of applications, a lot of which are free, and there are a number of third-party app-stores with more relaxed rules around as well. There is a healthy and growing developer community that's taking advantage of the open code to add new features and hack in interesting modifications - like the Nexus One does not officially have a FM radio or support HD video but developers have added code hacks for both into a custom ROM!

As awesome as Android is, unfortunately, all versions of the official Android OS (including the latest version 2.2 (Froyo) release) has limited support for international scripts, which is bad news for Thaana. Android can display Thaana characters as it supports Unicode fonts but it looks all jumbled up when diplayed as Android lacks support for bi-directional text rendering, both in the OS and the included web browser. The lack of BiDi support means Thaana input is also impossible as Thaana is a right-to-left script.

The next version of Android, version 2.3 (Gingerbread), is scheduled to have BiDi support and better support for international scripts, so hopefully that fixes things although it still wouldn't officially support Thaana.

The only easy way currently, as far as I am aware of, of viewing Thaana on Android correctly is by using Opera Mobile browser with Thaana fonts installed in Android. Now, none of the Android-based devices on the market seem to ship with a Thaana-supporting Unicode font preinstalled and Android does not currently provide a mechanism for user installation of fonts which means the process of installing a Thaana font is a little bit convoluted.

Installing Thaana fonts


Next, you need to install the Thaana font. Chopey has already posted a guide on how to do it manually and Gaanagaa has posted a Windows-based software to do automatically for you. I favour a different approach which relies on using a special Zip file to update your Android with the Thaana fonts in a manner similar to how Android devices update themselves with new releases. This method is, in my opinion, a lot easier and you do not need anything other than a rooted phone and the zip file I have prepared to do it. I have packaged the free FreeSerif font which includes beautiful Thaana glyphs as well as a large number of other characters from other writing systems.

Using my Thaana fonts update for Android
1. Make sure your device is rooted. You will need a rooted device to install any font via any method, including this one. There are a number of guides and free software available on the web for various Android phones (try xda-developers.com or modaco.com or samdroid.net) to help you do just that.

2. Put update_thaanafonts(jaa)_signed.zip to the root of the SD card in your device. You can do this by downloading the file straight from the web on to the SD card of your device OR download the file to your computer first and copy it to your device using a cable or Bluetooth.

3. Power off your phone and boot into recovery mode. The specifics of how you do this depends on which recovery tool was installed during rooting of your phone but involves pressing some combination of keys at the same time to start your device in recovery mode. Try the methods listed here if you aren't sure.

4. Select the update from Zip option in your recovery tool and select the update_thaanafonts(jaa)_signed.zip file from the list and OK it.

5. The update should progress and will ask you to reboot once completed.

6. Congratulations you now have a Thaana font installed! To make any practical use of it, you will need to install the Opera Mobile browser application available for free on the Android Market.



Enjoy :-)

Use a VPN to bypass ISP issues and restrictions

So apparently Dhiraagu has been under some sort of attack since day before yesterday and that is the reason Dhiraagu Internet subscribers are getting patchy Internet connectivity. I am not sure what kind of attack it is under but I presume it is of the DoS variety aimed at driving down their QoS levels. From the looks of it, the attack seems to be being targetted at, or atleast affecting, the Internet proxy/filters and DNS servers at Dhiraagu. Anyway, if you are as frustrated as me with patchy Internet then here's a quick fix solution: install and use a VPN.

A Virtual Private Network working over the Internet connects one computer to another via a private virtual "tunnel" and routes data between the computers. A VPN will allow you to browse the Internet via the remote computer's Internet connection so you aren't affected by (some) issues affecting your ISP and bypasses restrictions imposed by your ISP. As opposed to using a remote proxy server, a VPN can route all your Internet traffic via the virtual tunnel allowing you to bypass all local restrictions entirely. Use of a VPN, on laptops and mobile phones, is highly recommended if you frequently connect to Wifi hotspots at restaurants, airports etc to keep your data secure from being snooped.

Free VPN Services


There are many VPN service providers, including those that offer free services. A list of VPN providers is available at start-vpn.com. Here are a few I've used and tried.

Ivacy
Ivacy has both free and paid services. I quite like their volume-based paid plan which currently gives 1 GB for 0.67$ and a wide range of geographical locations for an end-point. The geographical location allows you to access services such as BBC iPlayer and Hulu which are region restricted. They even have a Ivacy Firefox extension that integrates into Firefox, which is handy if you use the browser.

Ultrasurf
Ultrasurf is extremely easy to use and their client, a 1.1 MB download, runs straight without requiring any installation.

UltraVPN
UltraVPN offers OpenVPN-based VPN access with a free registration process. They have a cross-platform open-source client allowing you to use it on Windows and Mac OS.

PacketiX VPN
PacketiX VPN is free and offers several nifty featues. Their Secure Internet Test Service gives access to a secure VPN for web usage and, for the more geek minded, their VPN Online Test Environment allows you to create a virtual VPN hub that connects together several of your devices.

ProjectLoki
ProjectLoki offers a public VPN server, connected through their free 1.1 MB client software, which you can use as a guest. Their paid services include more data transfer. They also offer special VPN server software that you can run and have your computer(s) connect to.

Happy New Year btw :-)

Two years with magnetic implants

The 22nd of this December marked the completion of two years since I had magnets implanted into the middle and ring fingers of my left hand in the hopes of developing a new type of human-machine interface while at University. The research was finally published in our paper "A Novel Human-Machine Interface using Subdermal Magnetic Implants" in the Proc. IEEE International Conference on Cybernetic Intelligent Systems in September this year.

Looking back, it is amusing to see that I had made a post on this blog on my initial thoughts on the possibility of an interface being developed from magnetic implants around the time I first came up with the idea for it. And looking further back, it is kind of embarassing to see the over-excited mildly juvenile post I had made after attending a lecture by Prof. Kevin Warwick, with whom I ended up publishing my first paper with!

Anyway, here is a very recent X-ray image of my hand showing the current state of the 3mm diameter, 0.7mm thick neodymium disc magnets I have implanted in my fingers.



As the X-ray image shows, the magnet in the middle finger stands perpendicular to the phalanx while the one in the ring finger lies parallel. I had intended both magnets to lie parallel to the bone but an unfortunate injury in the first few days post-implantation upset the magnet in the middle finger and eventually had it settle in the position it is in now. I had anticipated pain and other potential issues from to the increased pressure levied on tissue by the edge of the magnet during gripping due to the position it had moved to. Luckily, except for a few situations involving a lot of pressure applied on the finger pad it has not been an issue at all.

The ring finger implant has remained without incident and is the most sensitive to external magnetic fields. Hopefully, it will continue to be like that in the years to come!

Thaana on Amazon Kindle

I tinkered with the Amazon Kindle ebook reader device a few nights back and explored the use of Thaana on it. Here are my findings.

Overview


The Kindle is an amazing product - the screen is extremely easy on the eyes, the device is light and comfortable to handle and the battery lasts for a few weeks without a charge. The software supports MOBI, PRC, TXT, TPZ, AAX and PDF format books and documents and also includes a web browser.

Kindle 2 devices do not come with any Thaana Unicode fonts bundled in, hence making it impossible to view Thaana documents on a vanilla device. Kindle 3 does come with the impressive Code2000 Unicode font bundled in. This is good news for Thaana support as Code2000 currently contains over 61,000 glyphs from a huge range of writing systems and has supported Thaana for what must be close to a decade. However, the use of Code2000 seems to be limited to the web browser and is not involved in rendering ebooks.

It is possible to use either of the Kindle font hacks (see "Adding a Thaana font" below) to replace the system's ebook reader font to get Thaana to display within the reader component for all of the supported ebook formats. But this turns out to be pointless as neither device has proper support for handling right-to-left scripts like Thaana and hence words and paragraphs are all jumbled up in reverse.

Kindle screenshot: No Thaana characters in a vanilla device
Kindle screenshot: No Thaana characters in a vanilla device

Kindle screenshot: Thaana characters display after hack
Kindle screenshot: Thaana characters display after hack


PDF with font-embedding: The only thing that works!


The only ebook format that worked for Thaana was PDF with font-embedding (PDFs without the fonts embedded fails to render Thaana correctly even when the device was loaded with a Thaana Unicode font). Many of the existing Thaana PDF documents work just fine (see the screenshots below) as most of them have the required Thaana fonts embedded.

Kindle screenshot: PDF with Thaana fonts embedded
Kindle screenshot: PDF with Thaana fonts embedded

Kindle screenshot: Thaana Quran translation PDF
Kindle screenshot: Thaana Quran translation PDF.


Thaana in the browser


Thaana viewing via the WebKit-based web browser in Kindle was flawless in websites using Unicode Thaana (hence Haveeru Daily website is excluded). Code2000 has decent Thaana glyphs and looks very much readable on the device.

Kindle screenshot: Muraasil.com on Kindle
Kindle screenshot: Muraasil.com on Kindle


Unlike desktop systems, there is no native option to switch to a Thaana keyboard but because Javascript works, Thaana entry on websites using my Javascript Thaana Keyboard handler works just fine.

Kindle screenshot: Thaana entry using JTK
Kindle screenshot: Thaana entry using JTK


Adding a Thaana font


There are two ways of loading a Kindle with a Thaana font, though it is quite pointless for ebook reading purposes due to the reasons above. The rooted device method can be used to replace Code2000 with a font of your liking within the browser but keep in mind that Kindle will use the same font for the glyphs for English, numbers and puncuation and hence the font should be easy on the eye. In my opinion, this rules out most of the existing Thaana fonts, especially the common ones such as Faruma and the MV series of Thaana Unicode fonts. The best font I could find was the opensourced GNU Freefont which has very nice English glyphs and also includes the Thaana glyphs from Mohamed Ishan's Thaana Unicode Akeh font.

Rooted device + font replacement method
This method makes permanent changes to the Kindle and requires that you root your Kindle through a very simple procedure and install an associated custom fonts hack. The details are available here.

User fonts method
This method only works for Kindle 3 devices and does not require rooting the device and makes temporary changes to the Kindle by enabling a hidden user font mode in the device. The changes persist as long as you do not alter the font-face settings on the Kindle. Details on how to do this are available here.

Creating Thaana ebooks


For now, the only method for getting Thaana to work on Kindle devices seem to be via font-embedding in PDF documents. The easiest, and perhaps the most cost effective, method of producing such documents would be to prepare the document using your choice of document editor (like MS Word or OpenOffice) and printing out the document to the virtual printer provided by print-to-PDF software such as the free PDFCreator applications.

How-to for Windows:
1. Download and install the PDFCreator application.
2. Go to the print function in whichever software you are using and select the PDFCreator virual printer.



3. When the PDFCreator print window comes up, click the "Options" button.



4. On the PDFCreator print options window that comes up. Select "PDF" under "Formats" from the left, switch the "Fonts" tab and make sure "Embed all fonts" is ticked. Customise the "Subset font..." option if you would like and click "Save".


5. You only need to set font embedding as above once and the program will use it in future prints. When you are back at the print screen, set the Document title and other details as you please and click "Save".

To ensure that the PDF you saved (or any other PDF that you may have) has the Thaana fonts embedded, load it up your favourite PDF viewer software and check the document properties.



Conclusion?


Thaana on Kindle is very limited for now. The only option to produce and read Thaana ebooks is using the PDF ebook format with the Thaana fonts embedded in the PDF. This does mean that Kindle devices can be used to read Thaana without rooting or any hacks. Thaana usage on the web browser in Kindle matches that of a mobile device or even a desktop or laptop computer.

Toodles.

Total lunar eclipse on 21 Dec: Not visible in Maldives

Shame. The last eclipse for 2010, a total lunar eclipse, to occur on the 21st of December will not be visible in the Maldives. The entire 72 minutes of totality will be visible for North America and parts of it visible to South America, UK, most European countries, East Asia and much of Australia.

The next earliest eclipse visible in the Maldives will be a total lunar eclipse occurring on 15 June 2011 with the penumbral phase beginning at 10:25PM. The next solar eclipse visible in the Maldives isn't due to occur until 2016.

More info on the 21st Dec eclipse:
- Eclipse event page at NASA
- Eclipse path and visibility

Flight from Gan to Hulhule in Google Earth

I took the flight operated by Maldivian on the way back to Male' from a little holiday to Fuvahmulah and Addu atolls last month and logged the flight path using the GPS on my phone. I finally had a moment today to pass the track log to Google Earth and look at it inside the program's great 3D visualization of the globe. And it looks atleast as cool as I had hoped!

The journey was logged from boarding to landing, from the Gan International Airport in Addu Atoll to Hulhule International Airport in Male' Atoll. To log the flight path, I used the free and very capable OruxMaps application for Android on my Google Nexus One phone (which was put in flight mode throughout). The track log was exported from OruxMaps as a GPX format file which can be read easily by Google Earth. The free application TourMaker helped convert the GPX data to KML code for a nice Google Earth "tour" of the path, which then I tweaked by hand a little bit to fit my liking.

Anyway, check out the video of the tour I made below. I am putting up for download, the raw GPX data (which contains latitude/longitude, timestamp, altitude, bearing and speed information) and the Google Earth KMZ files I made (one showing the flight path with altitude and the other a tour).

- Gan to Hulhule flight: GPX GPS log (Zip, 54KB)
- Gan to Hulhule flight: Google Earth tour (Kmz, 40KB)
- Gan to Hulhule flight: Google Earth track (Kmz, 37KB)