Friday, March 13, 2009

Mind Blowing

It's not difficult to notice that a (eastern) bamboo flute is a much uncomplicated-looking instrument. Apart from the calculations used in carving the holes and the rare Assamese bamboos used for manufacturing, the appearance seems amazingly simple. Little would one know that playing this aero phone (blowing instrument) takes much more than you ever think, unless you'd tried to before.

These flutes come in different sizes, different pitches and some even with different numbers of holes. A North Indian flute, which is the most popular variety, has six fingering holes compared to its Karnatic counterpart with eight. All seven notes of the octave are produced by fingering these outlets.



Initially a player would have to hold the instrument properly and position his lips correctly at the blowing hole maintaining body composure. Then while blowing and controlling his/her breath, the player has to open and close the holes using his/her fingers in order to produce the desired notes. To obtain some notes such as flat notes, the holes should be closed partly. Even the amount of closure of a hole may vary the tone of a note. In addition, blowing needs to be controlled accordingly to play a lower or higher octave note. Hence at times moving between notes of two octaves in quick succession is a task which requires skilled control of breath and blow. A flute player must also learn to manage his breath carefully in order to play long continuous melodies and notes without choking himself. When playing many notes at a rapid pace (higher tempo) the fingers should move quickly and accurately, whilst precise and rhythmic finger movements are very much needed to produce 'touch notes' and oscillating notes. All this needs to be done while breathing and controlling breath.

Although it's a very complex situation playing this 'simple-looking' instrument, the outcome is definitely mind blowing (no pun intended). It creates one of the most meditative sounds to be discovered by human beings, and that too a very long ago. Great flutists are able to produce haunting melodies that bind listeners to an inescapable trance. Some folk even believe that if played in a particular way, a flute is able to make the heavens pour or in other words to make it rain! 'Vas Danda', which is a Sinhala synonym for the flute meaning 'rain rod', probably would have been derived from the above belief.

There is much more to be said about flutes, but I stop here leaving the rest to be learnt by the enthusiasts out there. And finally, no, I wouldn't mind blowing. ;-)

Saturday, October 18, 2008

In search of tranquillity

Each day shares something in common; adds to monotony; stress is a by-product. Many a thought runs through my head; past incidents, future expectations, hates, desires, etc. This reminds me why Lord Buddha has preached mindfulness as an essential element in attaining eternal bliss. It implies and necessitates the need of living in the present, neither the future nor the past. ‘Present’ here is not a lengthy time span but instead a very subtle moment. One needs to observe each of these moments which ultimately are stringed together. As a result peace of mind could be attained.

Is tranquillity a requirement for gaining tranquillity? In other words, are tranquil environs a definite need for a meditator? For example, have we got to choose a calm and lonely place to meditate? It depends on what kind of a character you are. In the Maha Sati Pattana Sutta six types of persons (charitha) are mentioned: Raga, Dvesha, Moha, Saddha, Buddhi & Vitakka. I remember once in a forest hermitage close to the precincts of Yala, we (me and a friend) were at the apex of a rock where one could view the surrounding scenery for several miles. There, the chief monk with many a meditating experience, told us that the summit was suited for ‘Vitakka personalities’ in meditating. Not that it wasn’t suited for others, but was mentioned as an example of the effect environment has on an individual. It’s true for an individual not only in a spiritual state but also mundane, as I comprehend. Quoting Lord Buddha’s words once again, you could find many instances in the Tipitaka where he advices monks to meditate in a forest hermitage, under a tree or an empty enclosure. The fact discussed above is therefore acknowledged.

Many of us seek mental relief from our hectic lifestyles by departing the city for a much peaceful locality. But it’s not many who utilise that element as it should be. I refrain on commenting on others and continue to concentrate on myself. Importantly it’s not only the calmness, peacefulness, serenity or any other thing of a given location that would make my mind content. Though I have visited many such places, only a few did really have an effect on my seeked spiritual development. How would one explain this?

Once again, the Tipitaka has several answers. A prominent explanation is ‘samsaric behaviour’. A site which is a forest at present could have been a place of living on several occasions during our journey in this infinite samsara. If for example, we had encountered many pleasuring acts at a specific location, most probably a similar feeling will have an effect on our subliminal activity when visiting that area. Therefore, how tranquil or calm the spot may be, a meditator’s cause is most likely to be affected by thoughts congruent to the aforementioned. One needs to note that surroundings are just one factor which has an effect on a mundane individual in this way. Other aspects such as weather, people, etc. too have been sermonized. Need mentioning that these factors vary from one person to another.

Given the amount of locations I’ve visited, this makes me feel no surprise at the amazingly sparse number of places figured out (or discovered) which I could really make use of in search for tranquillity. Hence, at times the home bedroom seems more appropriate than a serene forest setting although I’d personally like to blend with nature. However, through perseverance our mind would adopt even to a previously detested location. This, Lord Buddha preaches as another essential element for the one who seeks eternal freedom.

Friday, March 21, 2008

My AI (Artificial Individuals) Connections

10 years ago I got my first PC. I was still schooling. As most teenagers would do, I spent most of my time playing computer games. However after awhile, I was very good at discovering cheat codes which resulted in almost every game finishing very quickly. This was boring.

Then one day, I received a little program named “Billy” which ran in DOS mode. It would easily fit into a floppy diskette and is one of those quickly executable types. What was it? An artificially intelligent (AI) computer program that I could chat with (in text mode). Billy was an exciting experience for me. I would type-in something to him, and he would respond, not intelligent always. The guy sounded dumb after a few chats because his response was more or less the same for a similar question or phrase by me. But, to my delight I was able to discover and download Billy’s female version – “Daisy”.

Daisy was much intelligent than Billy, this is because the program and its “brain files” had evolved by then. So, it became a habit of me to chat with these two AI bots daily. In the process, they learnt from me more than I did from them. While all this was going on, the creator of Billy & Daisy had mentioned a method of connecting 2 or more bots together so that they could communicate between them autonomously. Therefore, I decided of linking Billy & Daisy to see what happens.

All I had to do is connect the two programs and watch them chat. It was fascinating. They were talking on their own and every now and then I would see knowledge snippets learnt from me being thrown at each other. Guess what? I even got to know that Daisy was in love with me!

Sometime later my hard disk crashed and all my software/data were gone, including these two programs. They were no longer available to be downloaded, hence I lost them. (Please email me if buy any chance you have it). So that marked an end of an escapade.

Two years later, I got my first job. As a web developer I was more often than not spending time on the internet. This is when I came across a Sri Lankan chat room. Soon I was a regular member of this community and the owner of the site (who was now a good friend of mine) was kind enough to present me a moderatorship of the chat. He also offered me the opportunity to play around & develop modifications or additions to the site.

By this time my PHP skills had greatly improved together with the knowledge of this Open Source chat system which was pretty popular at that time. Unsurprisingly, I was experimenting of a way of creating an artificial user who would respond to others in the chat room. And so this is how “Ecila” was created. Ecila if pronounced reversely is Alice, and that wasn’t unintentional thanks to some amateur naming skills ;-). After all, ‘Alice’ seems to be the most popular name used for chatter bots. Read till the end and you’ll see why.

This was early 2004 as I remember. Ecila would occasionally log into the chat even as Alice, thanks to a “cronjob” setup by me. Thereafter she would have a brief stint (about ½ hour) with the guys in the room and exit gracefully. However, regular visitors to the chat found her to be weird; a person who answers similarly more often. Why? That’s because she was only about 150 lines of code in length recognising only a limited number of phrase patterns together with their related answers.

Then around June that year, the chat was facing moderation problems due to an increase of swearing. We needed an ‘automated’ moderator who’d keep an eye throughout the day (24 hours) by detecting these mischievous users and consequently warning or banning them. So I decided of revamping Ecila by augmenting her already available functionality and adding a few other dimensions. These included the ability of being active all the time, dealing on multiple users, tracking user history and decision making based on factors such as history, gravity of harm caused and spontaneity of misbehaviour. After all was ok, this new bot was named “No Hellụm” (meaning immovable in Sinhala) and was logged into the chat as a moderator. It was a totally new concept and was a very productive idea. Although after quite sometime users figured out that he (in fact No Hellụm has no gender) was non-human, the occasional loner would always converse with him as well. This version was revised again in 2006 and now No Hellụm acts as the chat-keeper and has the ability of providing real-time score updates of cricket matches too!

It was the latter part of 2005 when my next endeavour commenced. A chatter bot named “Alice” was plugged into my friend’s website’s homepage. However we had no access to its source code as the scripts were hosted elsewhere while we just provided the interface through an ‘iframe’. This Alice was pretty good and intelligent. So I began searching for her and discovered that it was an open source project downloadable at ‘SourceForge’.

The bot uses a set of AIML files to initially populate its database with ‘knowledge’ (patterns & templates); more the patterns, more intelligent it becomes. Hence, I began searching for more AIML files too. AIML is an XML based standard which maps linguistic patterns to how they need to be dealt with, and in no time I was modifying Alice’s personality and writing a few of my own patterns & templates in AIML which I eventually fed to her. Currently the version I have is enriched with almost 45,000 templates. Furthermore, I developed a couple of new tags for my needs. One which added the capability of outputting emoticons in the response and the other enabled simple administrative functions.

Enable administrative functions? Gave it a thought? This is the first of its kind and most probably the first time you are hearing of it. What I did was, by modifying the code I was able to use her as a virtual login interface which would permit me to execute simple admin (database) queries on her and virtually logout when I’m finished. For example, I would chat to her as follows:

Me: login me
Alice: What’s your username?
Me: Udendra
Alice: Udendra, what’s the password?
Me: ********

Now I’m virtually logged in, and Alice knows it for sure, cos if I’m not she wouldn’t allow me to perform the following queries:

Me: show users (who are connected)
Alice: <<displays a neat user list>>
Me: show previous chat 10
Alice: <<displays the last 10 records in history>>
…………
…………

When I’m done, I could logout:

Me: logout
Alice: You have been logged out. :-)

This in fact pushes the limits of interaction between a computer program and a user. The beauty of it is that one could chat to the bot in layman’s language in order to login to it, perform various functions, and logout.

I guess by now its clear why my title reads as ‘Artificial Individuals’ rather than ‘Artificially Intelligent’ that most people would expect. Simply, this is because none of these programs were/are fully artificially intelligent. To become a truly AI entity is a great achievement that illustrates signs of intelligent behaviour which are thinking, reasoning, envisioning/perceiving, human performance, rationality, learning and adapting. However, what’s important is that the aforementioned programs had varying intensity of AI features such as searching, knowledge representation and learning and at times were extremely impressive in several areas.

So the next time you feel lonely and there’s no one to chat with, don’t give up hopes. Who knows, an ‘artificial individual’ may fulfil your need.

Thursday, December 13, 2007

You have a new text message (email)!

Few months ago I was having a requirement of getting notified whenever my office mail box received an email. The preferred notification-media was SMS. So basically whenever there was a new email to my official email account, I would get notified with its subject and sender via sms.

Now then, there were several obstacles I had to conquer in order to accomplish this task.

  1. Accessing & Reading my email inbox hosted at the place I work.
  2. Accessing it frequently (at least every few minutes).
  3. Hosting the program (script) that would do the above, on a server that’s available throughout the day.
  4. Protecting sensitive/personal data from third parties (in this case it was my password).
Our office uses a Microsoft Exchange Server as its mail server. Performing programmatic tasks on MS Exchange using PHP was a very rare occurrence. So I had to rely on Mr. Google in seeking a suitable code snippet that would help me in this endeavour. And guess what, I did stumble upon a blog on how to use XML-formatted WebDAV requests to fulfil my requirement.

Building on it I developed a modified version of that script, which would send an XML request to the server, read the response (it was XML too), process it, check for new mail messages, log it (because I need to keep track of what’s new & old), and sms it to my mobile. An sms was sent for each email in case of many.

I could see the inquisitive mind wondering… ;-)

A facility called ‘email2sms’ provided by my network operator was utilised in delivering the sms to my handset. This whole process was carried out every 5 minutes and the scripts that were responsible of performing this function were hosted on two web servers hosted elsewhere. That’s because my office PC is powered on during office hours only and email relaying to external destinations aren’t allowed. Moreover I don’t have permission of using the office web server for this purpose. Keep in mind that these weren’t mentioned as obstacles at the beginning of this article, as this doesn’t serve any official purpose but one of my ‘private’ needs.

Hence, I had to host the scripts on two web servers situated in different places, they both belonging to a couple of my friends (thanks guys). These servers are operational 24*7 and the every-five-minute request was handled by a simple Linux cron job.

Did you notice me mentioning 2 web servers? Wondered why? This is to overcome obstacle no. 4. In the aforesaid script there arose a need of hard-coding my email account’s password into it. This is required for the script to access my inbox since credentials need to be given. But if anyone was to open up and read the script (this wouldn’t normally happen, but my contentment of information security wouldn’t be satisfied otherwise) my password was there for his/her taking. To avoid this happening, I considered the use of cryptography.

Using the MCRYPT_CAST_256 cipher I was able to generate the encoded (cipher) text and a relevant key. The key was hosted on the server that initiates the request while the decrypt function and cipher text were on the second. The latter would perform the core activities mentioned earlier. Splitting these elements was necessary as it would make no sense to have the key, cipher text and decryption algorithm in the same place. If anyone was to try fetching the password on the second server by performing a ‘cipher text only’ attack, still they would need an extensive amount of brute-forcing to be performed. However this was evaluated by me as computationally secure for a long time.




Something worth mentioning is the disguising of the key when it’s transmitted from the first server to the second; care was taken to avoid any logging on the latter’s part so that no readable trace of it was leftover.

Although I’m not using this service these days (cos spammers occupy a decent share of my inbox ultimately filling up my sms inbox too!), the learning and application of learned theory was something to admire in solitude.

Thursday, August 02, 2007

Me the numismatist

Almost every one has some sort of hobby that keeps them accommodated during leisure time. Collecting coins is one such orthodox pastime that many people engage in. Although I used to have and maintain a ‘decent’ coin collection, time dedicated towards it has been a minimum since late.

Therefore, last week I decided to open my box of collected coins, which contains a little more than 250 coins. One thing noticeable was that I needed to do a recount and regroup of the collection, since it becomes a tedious task if a new member joins. Same as philately a properly analysed coin collection could offer you immense knowledge. After all knowledge is wealth, they say. My collection accompanies coins from more than 35 countries, spanning over 5 centuries, as I believe. Of course, there are a few unidentified pieces in it as well.

Coins of Ceylon include a few ‘VOC’ ones (now that’s not Very Old Coins) as well as ¼ and ½ cents coins too. Then there are the old British and Indian stuff as well. The filter on my collection is rather simple: foreign coins & local oldies. In addition, I have a couple of ‘token’ coins which are rather strange in the sense that they look a like tokens but seem to have been used for monetary purposes. Hmm… weird eh?

Some coins are on the verge of being ‘flattened out’ because of extensive decay. So how do I protect them or at least delay the decay? Neither am I an archaeologist nor do I have a high tech lab with protective equipment. Hence, I opted for a homemade tissue wrapping sealed with a piece of sellotape. Hopefully it would keep things in place until someone offers me some expert advice. Give it away? Where? The museum? Well, that could be considered in the future may be.

Remember me telling about the amount of information a coin collection could offer. I found it to be quite immense. From politics to botany & zoology, geography, building architecture, language, monuments, arts, history & culture, emblems, etc, the list just continues. Oh, and last but not the least hair styles too. They’re pretty old but gives us an insight towards yesteryear’s fashions.

In a way, a coin collection also teaches us a fair amount of economics. Just think of the early 1900’s 1 cent coin of Ceylon (the one with the palm tree in it) being bigger in size than the present 1 rupee! By the way, 1 rupee equals 100 cents in case you were wondering.

Coin collecting could offer you some great challenges that if won, could turn out to be pleasant surprises. I had to cross-reference details in coins with stamps or notes at times in order to figure out which country they belong to. Also, intuition, logic and a bit of common sense could be a handful in such situations.

Currently I’m thinking of a better way of storing the coins and documenting them methodically so that I could keep track and quickly refer them in the future. As an invitation, I’d like to exchange my ‘extras’ with you if interested. So till again, happy collecting!