How to make a simple motor (in Dhivehi)

Here is a science experiment worksheet, in Dhivehi, detailing how to make a simple electric motor at home with materials easily available anywhere in the Maldives. I had started preparing it to accompany the talk I gave at Jamaluddin School but sadly, due to my schedule of late and the fact that I'm terrible at Dhivehi, I could not finish it on time and thus was not able distribute it to the students as I had intended. I'm putting it up for anyone who might be interested...

- Dowload howtomakeasimplemotor-dhivehi.pdf

Ovvalhu(gondi): an African game?!

I was watching a presentation tonight titled "African fractals, in buildings and braids" (on TEDTalks) and was totally absorbed in it when an African game board shown in it caught my eye - the board looked eerily similar to something I knew: an Ovvalhugondi. I had always been under the impression that "Ovvalhu" was a distinctly Maldivian game but just like many other supposed Maldivian games of the likes of "Koraa" and "Baibalaa", I wondered if Ovvalhu too was just another foreign game that had been absorbed into our culture. Anyway, I was compelled to look up more about the mentioned African origin game called "Mancala".

Finding out more about Mancala was a much easier task than I thought. Rather than it being an obscure game played in a lone part of Africa that had little mention in any literature, Mancala was literally something of a global phenomenon that had many a mention of it, played all over the world and had dozens of online shops selling the boards. There even were online versions of the game! Mancala or Manqala in Arabic, basically refers to a class of games that all have similar game play - the objective always being to capture more "stones" than the opponent. There are a number of variants (see Wikipedia's list), as adopted by different countries or areas, that differ in the finer details of how its played. Apparent differences obviously include the number of pits in the board and the number of "stones" used in play.

I might be wrong (very wrong, infact) but from what I read I suspect that Ovvalhu takes after the version played in South India or possibly the version played in Ghana. Ovvalhu may not be our national game but Ghana's Mancala variant called "Oware" is supposed to be their national game. I found it amusing that the names sounded similar but that might just be mere coincidence(?!). A similarity that certainly is not a coincidence is that Maldivians also used to play Ovvalhugondi with "Laagulha" (picture), ie. the seed of "Kashikumburu", which is what Oware is supposedly played with (in the Caribbean atleast).

What was even more interesting, to me, was to learn that Mancala (or atleast some variants of it) had been analysed using combinatorial game theory. The game of Awari was tackled by two Dutch scientists who generated the entire state-space for the game - mounting upto almost 9 billion positions - and cracked the perfect play for the game (here's their paper). Perfect play is a game theory term for a strategy or set of moves that guarantees a certain outcome in a game - a win or a draw at the least - if the game allows so, mathematically. I have no interest in Ovvalhu but I find such computational challenges almost erotic. I'm very much tempted to attempt analyzing Ovvalhu for a perfect play as well, so I've added it to my list of future boredom-killer projects.

Anyway, though it is pretty conclusive that Ovvalhu is not a Dhivehi game, I think it is interesting to learn that it certainly is one with an exciting history and background!

Guide to using Thaana on the WWW

Developing Dhivehi web pages is pretty easy and there are quite a few methods to do it. However, information on how to go about it seems to be lacking, leaving newbies stumped. Here is a general overview on the various methods for displaying Thaana on the WWW and should contain enough information to help anyone, designer or programmer, get started.

1. CSS: rtl + bidi-override

This method is applicable only to non-Unicode text. It works on all modern browsers but requires for the user to have atleast one of the fonts specified in the page - otherwise the text would be displayed as a mostly meaningless jumble of English letters.

This is the least-effort route to getting any non-Unicode Thaana text (such as those written using MS Word 97/2000, Accent Express, MLS or Faseyha Thaana) on to the web. The websites of Haveeru and Miadhu currently take this approach.

Usage:
To use this method, apply the following CSS to any HTML elements that contain Thaana text. You may use inline style attributes or CSS class/ids to achieve this. You may change the font names to suit your needs but make sure you list several popular fonts and that the fonts specified are all non-Unicode fonts. You could, of course, also add further CSS styling (font size, font color, line height etc) but the following are the required minimum.
font-family: A_Ilham, A_Randhoo, A_Faruma, A_Waheed;
direction: rtl;
unicode-bidi: bidi-override;

Demo:
View example



2. Unicode Dhivehi

This method is applicable to text in Unicode. It works well on all modern browsers but requires for the user to have atleast one Unicode Thaana font - and unlike method (1) the system defaults to a Thaana font it does have if it cannot find any of the fonts named in the page.

This is the best method for any new and modern Thaana-based website. It is used in the online Radheef, Jazeera Daily and Haama Daily.

Usage:
To use this method, first add the following to the page's HTML HEAD section.


Next, apply the following CSS to any HTML elements that contain Thaana text. You may use inline style attributes or CSS class/ids to achieve this. You may change the font names to suit your needs but make sure that the fonts specified are all Unicode fonts. You could, of course, also add further CSS styling (font size, font color, line height etc) but the following are the required minimum.
font-family: Faruma, "MV Elaaf Normal";
direction: rtl;
text-align: right;

Demo:
View example



3. Image

This approach basically renders the Dhivehi text as an image. This is perhaps the most obvious and was the only method available early on. However, this method is still a pretty lucrative solution especially given that many computers just don't have the required fonts available. Using an image for the text rids the requirement on the client browser/computer to have the proper fonts available.

The basic approach of rendering the text into an image using Photoshop, MS Word etc is pretty tedious as the process is entirely manual. However, there is a more sophisticated approach that renders the text into Dhivehi on-the-fly on the web server side (perhaps coupled with caching to reduce load). A server-side scripting language such as PHP can be used to render text into an image using any font of choice by the designer/programmer. The rendered images (typically PNGs) are of very small size and hence have a negligible effect on the page load time in most cases.

Refer to the imagettftext function for details on how to do it in PHP.



4. Flash

This method uses text loaded in Macromedia Flash with the required font(s) being embedded in the Flash clip. ActionScript and/or Flash variables are used to load the text into text areas in the Flash file. This method has the advantage that it works whether the client computer/browser has Dhivehi font available or not but then again it does require the client to have Flash installed and enabled. If you are only seeking to have nice one-line headline sort of text in Dhivehi then you might consider using sIFR.

Refer to Font Embedding help page at Adobe LiveDocs for details on font embedding in Flash.



5. WEFT

Web Embedding Fonts Tools is a Internet Explorer only solution offered by Microsoft. It involves using the Windows-only WEFT utility to create font "objects" that can then be placed on web pages. This method is not recommended unless the target only involves use of Internet Explorer.

Refer to Microsoft WEFT page for more information.



6. TrueDoc

TrueDoc is a solution offered by Bitstream Inc. It is a solution similar to Microsoft's WEFT in that TrueDoc solutions create a embeddable font resource called a Portable Font Resource. Any font (ie. Dhivehi font) can be loaded once users install a custom font "viewer" (called the Character Shape Player by the company). This solution is NOT free and requires the purchase of special software from BitStream to produce the custom embeddable font packages.

Refer to the TrueDoc site for more information.



Good luck ;-)

Update (24-Nov-2008): Method 1 and 2 rewritten for clarity and demos added.

Web Operating Systems: a personal review...

There are Web OSes springing up on the internet left and right these days. The web operating system, in its broadest definition, includes everything from complete browser based operating-system-like environments to terminal access-like services. I've been keeping a keen eye on the developments, partly because I think it will become one the next big raves on the internet and partly because I find such a services quite useful.

The currently active Web OS services all have free sign up available or at least demo versions for try-outs. Here are a few I've jumped through:

Oos

I quite liked the looks of Oos although I must say it is very very basic and very much incomplete for the moment. However, their interface loads fast, is clean and uncluttered. They've gone to lengths to copy the Windows looks and styles though and may not settle with die-hard users of other OSes.
- Oos homepage


EyeOS

EyeOS is an open source project towards the development of a web operating system and has the source available for download, allowing you to install it on your own site or intranet. The basic package has office, PIM and some utilities bundled in the download. They have a separate website EyeApps where further "applications" for EyeOS can be found.
- EyeOS homepage


YouOS

This is one of the more famous of the current bunch of WebOSes despite not being the best. There are a few applications available on it - a text editor, an instant messenger, notes app and a couple more utilities. The interface isn't too pleasing and the menu systems aren't that user friendly either. That said, it is quite usable though if all you want is the very basics.
YouOS homepage


AstraNOS

AstraNOS failed to impress me a single bit. The interface was ugly and cluttered and lacked any decent feature. Their approach seems to be more towards amalgamating existing independent web services and applications and provide links for those services. Seems like just another WebOS attempt which totally fails to hit any mark, in my humble opinion.
- AstraNOS homepage


Desktoptwo

DesktopTwo is definitely one of the better web OSes around. There is a number of simpler web-based applications (e.g. an instant messenger, mail application, address book, mp3 player) available in addition to the full OpenOffice package and Acrobat Reader applications which seem to be instantiated separately via VNC connections. The interface uses Adobe Flash and is quite pretty and usable. They also offer 1GB of storage space for free to get started.
- Desktoptwo homepage


Fenestela

This WebOS is totally based on the Windows looks - Windows XP to be more exact. There are a few applications such as a HTML editor, a text editor and some utilities available already. This is a commercial product, although I can't really see why anyone would want to purchase this... Ahem.
- Fenestela homepage


Glide

Glide is definitely one of the better and more feature rich WebOSes around. A text editor, music player, email, calendar, contacts and even a photo editor application are available. They also provide 2 GB of free storage space. I'd use this as soon as I get over my disgust for their appalling interface!
- Glide homepage


CorneliOS

An open source project that seems to be producing a quite impressive platform. It is a multi-user web OS software that is available for download and comes complete with user management, access control as well as a content management system. It maintains separate user directories and individual desktop environments. It is quite feature rich with office applications, calender, development applications and has a number of settings for controlling the operations and looks of the desktop environment.
- CorneliOS homepage


Goowy

Goowy is far from being gooey and sports a pretty and very nifty interface. At the moment is has instant messenger, email, calendar, contacts and files management features available. Sadly, it is missing an office package which I reckon should be essential to any web OS. They have a feature called minis, which are basically widgets/gadgets that perform little utility tasks or as information displays. Goowy makes itself less lucrative thanks to the lack of the office package and may well be gooey for now feature-wise.
- Goowy homepage


SSOE

One of the worst Web OSes I've come across! It's done in all Adobe Flash, extremely slow and buggy. Nuff said.
- SSOE homepage


DesktopOnDemand

DoD takes a different approach to a web OS in that theirs is not browser based but rather provides a remote terminal access to a hosted OS environment - one based on Linux and Gnome. Personally, I think this is the best approach to go for creating a Web OS as browser based OSes can be notoriously slow and makes the mistake of relying on the stateless (and inherently vulnerable) HTTP protocol for communications.

The DoD approach provides access to the OS via any NX client and has the option of using a browser based Java plugin as well. They provide 1 GB of free storage and the data can be accessed without entering the OS by using their web based file manager. NX technology uses compression on its data communications and achieves surprising performance. The DoD desktop was as fast as, if not faster than, using any of the browser based web OSes listed above, atleast on my broadband connection. DoD also benefits from NX's use of SSH encryption for data communications making it a very safe way to browse. It won't leave any discernible logs, can't be sniffed/tapped easily and you can store data and browse/chat without leaving any traces behind on the computers that are used to access it. These are great plus points when considering using a practical web OS that is can be accessed from anywhere and is safe.

There is a useful set of applications available as well: office apps, GIMP, instant messenger, browser, video/music player etc. This is my favourite for now and I reckon many others will like this one - especially the Linux fans!
- DesktopOnDemand homepage


CosmoPOD

CosmoPOD takes the same approach as DesktopOnDemand by providing remote terminal access to a KDE-based Linux desktop. CosmoPOD provides a lot more applications bundled in with their service: there is the complete OpenOffice package, IRC/IM clients, mail/newsgroup readers, project/money management software, web development package, a programming IDE, raster/vector graphics editors and a bunch of the usual KDE utilities as well. This alone makes this one of the most desirable web/online OS services around!

CosmoPOD also provides 1 GB free storage and an online browser based file manager that can be accessed without using the NX client.

Sad thing is the free offering is annoyingly slow and also shows advertising banners on the desktop. They do offer the option of switching to a premium service that gives fast access, more applications and control.
- CosmoPOD homepage

Enjoy :-)

Developing apps for mobiles with Adobe Flash Lite

Writing (simple) programs and games for mobile phones has gotten a whole lot easier thanks to Adobe/Macromedia's Flash Lite technology. It basically extends their flagship Flash presentation engine to the realm of mobile handsets by providing a player, similar to that which is installed on desktop PCs, to many of the mobile phones. The product effectively paves the way for the many animators, web developers and even beginners to easily develop rich programs for mobiles without having to delve into C or Java and presents a more lucrative solution than MIDP or BREW for creating device-independent light applications.

Anyone familiar with the standard Flash development techniques can quickly develop/port to Flash Lite and get it working. Transparent internet access, XML/HTML support and ActionScript are all supported - allowing for quite sophisticated applications to be built with ease. Flash Lite is included in the recent Adobe Flash CS3 release or can be added to Flash Professional 8 by downloading the free Flash Lite authoring update from the Adobe website. Many of the popular phones are supported and developers can download/update development profiles for different phones.

The possibilities for applications are numerous - games, data access front-ends etc and might be a great way for businesses to provide interactive information or services to customers with probably a lower development cost!

- Adobe Flash Lite product page
- Adobe Mobile & Devices Developer Center


Quick n dirty implementation of a Reverse Number lookup application in Flash Lite for Nokia phones running S60

Thermite: Towards the rapid destruction of hard disk(s)

A friend of mine, a very paranoid and drama-loving fellow, asked me recently for some suggestions on how to rapidly destroy a computer hard disk. He wanted to destroy his hard drive banks "if police came to get him". I don't know what possible reason the police may have for wanting him and his hard drives but being the dramatic fellow he is, I know he'd want to do it purely for the drama alone. Anyway, my solution to him was simple and most importantly, very dramatic: thermite!

A thermite reaction is an exothermic chemical reaction that generates temperatures reaching upto 2500 °C - more than enough to melt the entire hard drive and entirely destroy the magnetic lining of the platters. Thermite consists of aluminium and iron(III) oxide (better known as rust!). The two is to be mixed in a ratio of approximately 8 or 9 parts iron oxide to 3 parts aluminium. The aluminium needs to be powdered and can be obtained by filing/sanding soft drink cans or aluminium tubing. The iron oxide (rust) can be shaved off from a rusting iron rod and should be in powder form as well. I've successfully tried with aluminium filed off aluminium tubing that I had purchased for building an antenna and rust collected from a bunch of iron nails that had been rotting away.

Ignition is the most important part for getting the thermite reaction going and isn't an easy step for the method described above. The easiest way, which I recommended to my friend, was to use a magnesium strip. They aren't available in Male' but can be ordered online or purchased from abroad easily. Alternatively, I suggested, convince a chemistry student at CHSE to get some - they often use it as part of their weekly practicals and throw out a load of half-used strips to the bin anyway!

Finally, the thermite mixture can be placed in a little container and a piece of magnesium strip neatly stuck into it. The container can be placed on top of the hard drive with the magnesium strip accessible and ready for lighting when required! Once ignited, nothing will stop the reaction and extinguishers - be it water, foam or CO2 - will miserably fail too.

Needless to say, the prospects of having his hard disks melted in a fiery fire as cops watch helplessly really excited my friend...

Further info:
- http://www.ilpi.com/genchem/demo/thermite/
- Watch some thermite reactions

Note: Thermite is not fun play - stand well away and avoid using large amounts. Do be careful if you are curious enough to experiment ;-)

The Game of Life

How could life on earth be so diverse? How could earth, the solar system or even the universe be so complex? How could it be so without it all being made, designed exactly that way? Really, how could it?! It's a fair question and makes a lot of people wonder. But there ARE answers - some are definite some not-so-definite. After all, life (and the universe) IS pretty complex. However, the interesting thing with complexity is that, complexity doesn't mean that it is entirely irreducible or that it couldn't have arisen from something less complex.

Introduction
Enter John Conway's "The Game of Life" - one of the simplest examples of emergent complexity. The Game of Life (hereafter abbreviated to TGOL) is a type of cellular automata. Cellular Automata can be defined as a structure (cell) which has a finite set of states and any transitions from one state to another occur according to a set of predetermined rules. TGOL operates in a universe represented by a 2-dimensional grid - where the state of each cell in the grid is boolean; i.e. a cell is either alive or dead. The rules, in TGOL, simply determine the state of a cell at any given moment in time as per the states of the cells surrounding it. That's as much complexity as there is in TGOL (and many other Cellular Automata)!

It is quite intuitive to imagine this working at small scales for just a few steps in time but it quickly gets a bit too large a problem to work out in the head. In fact, TGOL can only be executed effectively using the massive computational abilities of a computer but even then, after sometime, the problem gets beyond which a computer can handle. What more, it is near impossible to determine the future state of the cells based on the starting states.

Experiment!
First, the "rules" in The Game of Life as defined by Conway.
- Any dead cell becomes alive if it has exactly 3 live neighbours.
- Any live cell with either 2 or 3 live neighbours stay alive.
- Any other case either kills the cell if it's alive or leaves it dead if it's already dead.

You can "play" TGOL on paper or simulate it on the computer. Being the lazy people we are, I have no doubt most of you would choose the latter option - but if you are any bit curious about TGOL, do try working it out manually first. There are many Life simulation programs available for free on the net - some are run online while some are available for download. Try the Java based Life simulator at http://www.ibiblio.org/lifepatterns/ (click the "Enjoy life" button on the page) for a version that you can run instantly without downloading anything. If you want to download and seriously play with TGOL, check out the open-source Life simulation software called Golly. It is available for Windows, Linux and Mac at http://golly.sourceforge.net/. Alternatively, if you are the programmer sort, you might even venture 10 minutes into making a rough Life simulator yourself (like I first did few years ago) :-P

TGOL simulations can be executed by defining a starting pattern. It can be as complex as you want or as simple as you want. TGOL develops many interesting patterns that people have actually named a lot of them. However, new patterns are found all the time and it seems Life never gets boring! A wonderful place to start on the patterns and their details would be the Life page at http://www.math.com/students/wonders/life/life.html. Try the Glider or Spaceship patterns - they move and were among the first simple-yet-complex emergent entities to be spotted in the TGOL!

Here are 3 steps in the operation of a crude smiley pattern in TGOL:


Complexity
After playing around with different patterns and observing what happens after a few thousand or few hundred thousand generations in the TGOL universe, it becomes apparent that different sorts patterns get created along the way. Some are dynamic (like the Gliders), some are still, some are oscillatory, some go on seemingly expanding and growing, some develop motion to either of the sides. These more complex structures can occur frequently and regularly and even arrange themselves to form even more complex systems and behaviour.

If you are using Golly, look under "Signal Circuitry" for a pattern called "Turing Machine". As anyone whose studied computer science may know, a Turing machine can perform just about any computation. The fact that a Turing machine can be implemented in the TGOL demonstrates the sheer power that a world operated by a few simple rules could posses. More complex patterns are still being discovered within this universe of the TGOL which is dictated by 3 simple rules. The active universe in a TGOL simulation quickly becomes larger than what most computers can currently handle and does limit our ability to further observe the kind of even more complex behaviour TGOL produces.

Like I said at the beginning, The Game of Life is one of the simplest Cellular Automata around. There are many different kinds of cellular automata, each operating with a different number of states and rules. These produce an even richer variety of universes, displaying amazing complexity.

The End
Hopefully this little incursion into emergent complexity was enough to make you think just how likely it is that this "complex" world which we are both puzzled and fascinated by could have arisen from a really really simple set of rules - like the physical/chemical rules that govern everything in the universe.