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!

Monday, April 02, 2007

... Loving Kindness ...

This is an effort to express the meditation of 'loving kindness' (maithree bhavana) in a poetic form :

Love to others
begin with me
well & happy
may I be

Yes, my parents
Mom and Dad
be well & happy
I'm so glad

All my siblings
brother & sis
wish you all
a mind at peace

All my friends
and my peers
be well & happy
no more tears

All you people
dear to me
and you all
not dear to me
they who think
indifferently
may you all be
well & happy

Country men,
and neighbours
be well & happy
no more fears

All those beings
that we see
all those beings
we do not see
take my merits
with all glee
well & happy
may all be

Close to me or,
far from me
well & happy
may you be

North or South
East or West
Top or Bottom
wherever you rest,

Loving kindness,
Compassion we gain
eternal bliss
may you attain...

Sunday, December 17, 2006

To translate or not?

Gaalla, Kaali, Galle, all three terms refer to the same location which is of course the city of Galle in its Sinhala, Tamil and English representations respectively. Hence it’s a proper noun. Now wonder if someone was to tell you; whatever the language may be, we should use only one of the above mentioned 3 terms! What would you think? Keep on thinking, but let me continue…

The origin of this scenario is due to a couple of view points which I’ve come across in the recent past while dealing with people who are engaged in content translation. The issue seems to be more aggravated when it comes to translating Technical terms such as ones used in the field of Computing or IT. Basically there are folks who say that we should translate each English term into Sinhala (or Tamil), while some others say that we need not do so and should continue using the English terms in our language which are now common. Examples are mouse, computer, bus or their subtle variations (in Sinhala) such as mavusaya, computer eka, bus eka, etc. There is a subgroup of this sect saying we should only translate the pronouns while the proper nouns aren’t to be touched!

I do agree with the latter to a certain extent, since a main objective of translating is to increase the normal person’s understanding and grasp of the term that is hindered by the unfamiliar language. Just imagine having to figure out what does mooshikaya (a term used for ‘mouse’) or daththa sanghithawa (a term used for ‘database’) really mean? But then the more sensitive arguments creep in. Isn’t this harmful to our language? Aren’t we compromising the unique identity of our language? (Consider Sinhala as an example) My answer is; yes, to a certain extent we do. The thing to remember here is that our language has evolved throughout centuries with many lexical additions to it; examples are sapaththu, kussiya, almaariya, etc. Note that I’m certainly not promoting something similar to the immature ‘FM channel vocabularies’ which are a garble beyond tolerance!

There are many practical problems when dealing with one-to-one translations where you need to invent certain new words, since the other language hasn’t got anything similar that could be used as an alternative. This situation itself is a bit tricky if you consider some inventions done so far. Two examples are Guwan Viduliya (Radio) and Roopavahiniya (Television). Neither is a radio similar to an airborne current nor does a TV let pictures flow of it, since it emits sounds as well. Let that be as it is since its common usage now which any person understands. This could also be referred to as a kind of ‘normalization’ where a term becomes common and comes into general use after some time, although resistance is to be expected when it’s introduced initially.

If this trend is to be followed in future, I suggest setting up a common entity or mechanism in order to regulate and/or moderate these newly invented terms, as otherwise it would add to more confusion with each inventor trying to promote their own as the correct term. For example, I can mention about a half-a-dozen Sinhala terms used for the word ‘Database’. I'd bet it wasn't the same at that time when the term 'Roopavahiniya' was introduced.

What I find to be most interesting out of these perspectives is that ‘proper nouns shouldn’t be translated’. Ok, so I’m alright with that theory yet again to a certain extent only. As I’ve mentioned at the start of this article, a name of a location is a proper noun as well, but many of them are already ‘translated’ (there exists representations in other languages).

The reformists suggest that only one name be used for such locations. How are we to find the most appropriate name in that case? As an example, Galle may be called Gaalla in all three languages since it’s used by the majority. But for instance, can the same be applied to Jaffna as Yaalpaanam. Wouldn’t history have to be traced in that case? One may argue that it should be called Dambakolapatuna or something since that’s the oldest known name, although it’s in Sinhala. It would be the same for places like Trincomalee, Mannar, etc. Aren’t we inviting more trouble if we had to adopt this strategy? This applies to any other language or place in the world, not only Sri Lanka and the Sinhala/Tamil languages. We may perceive names such as Colombo, Batticaloa, Negombo to be English whereas the origin of these date back to the colonial era and languages used at that time, which were not necessarily English.

Personally, I prefer accepting these names as they are, instead of referring to Germany as Deutschland compared to Germaniya in Sinhala! It also adds variety and uniqueness to a language, culture or society. Best is to strike a balance, with neither extreme reached.

Wednesday, November 08, 2006

Discovering Kuruwita

Kuruwita is a moderate sized town situated just about 10 km before reaching Ratnapura, if you’re travelling from Colombo. ‘Kuru Ganga’, which is the main tributary of the ‘Kalu Ganga’, with its origins at the Adams peak (Sri-pada) flows through this town; hence its name.

Many people consider Kuruwita as a route to Sri-pada (through Eratna) during the pilgrimage season or for its close proximity to the beautiful ‘Bopath Ella’ falls. It was same even with me until about 1½ years ago when I started discovering what a ‘package’ Kuruwita offers to a visitor.

Batadomba lena cave, Diva guhawa, Delgamuwa temple, Bopath falls and Dodan falls could be identified as main attractions in and around Kuruwita while all these locations could be reached during a days visit.

Let’s start off at Batadombalena which became an important archeological site after evidence related to pre-historic human activities were discovered. To reach the location, you should turn off at Ekneligoda on the Kuruwita - Erathna road and travel along the Siripagama road for about 3 - 4 kms. Get off at the Batadomba-lena junction and climb the hill on the left, trekking through the forest path for about 1 km. It’s worth to note that Siripagama is another route for pilgrims during the Sripada season. Batadomba lena consists of a few caves including a main cave which excavation is carried out from time to time. A visitor may be lucky to witness a little shower of water falling in front of the cave from the top if it’s a wet season. The road through the forest to the cave is a wonderful experience itself since it runs along a stream for a considerable distance.



Next stop is Divaguhawa. Come back to Ekneligoda and continue towards Eratna until you reach the Batathota junction. Take the road to the left for about 1 mile to reach the location which is now a temple known as ‘Batatota len viharaya’. This cave is big and spacious with some ancient constructions & drawings dating back to the Kandyan era. People believe this to be the cave which the Buddha visited on his journey to Sri-pada, although many wouldn’t agree with it. Adam's peak is clearly visible to this cave and it attracts a huge number of devotees during the Sri-pada season. If you are keen enough you may descend a bit further down from this main cave to the ‘Isthripura’ caves as well.

Back to Kuruwita and head towards avissawella for about ½ km. Go down the road in front of the Kuruwita post office for about 1 km to reach the ‘Delgamuwa Raja Maha Viharaya’. This temple is situated on an elevated land in close proximity to the Kuru ganga. The temple is said to have enshrined the sacred tooth relic of the Buddha during the kandyan era. The tooth relic was hidden within a huge quern made out of rock. This quern is to be seen even today.

I then reached the Higgashena bazaar and turned right to reach my next destination, ‘Bopath Ella’ falls. ‘Bopath’ means ‘Bo’ leaf in Sinhalese, which gives the falls its name since it cascades forming a similar shape. This is by far the most popular tourist attraction around Kuruwita and attracts many visitors during the weekend. Special care should be taken when bathing here as many have drowned in the recent past.



One might find it worthwhile to travel for about another 2 kilometers from Bopath Ella towards the Devipahala area, where the much unknown ‘Dodan Ella’ falls is situated. The fall is created by a tributary of the Kuru ganga which joins it near Bopath Ella. The topmost part of the fall descends to a deep pool where the water isn’t spilled over, but instead emerges underneath the rock and continues to cascade through to the second stage. This indeed is a strange and rare formation. A visitor has to descend down the waterfall along its edge to reach the bottom of the falls since no other path is available. Again prompt care should be taken when descending or climbing back up. The vicinity of the falls isn’t spacious as Bopath Ella but one could have a nice cool bath if interested.



Kuruwita offers more scenic and interesting places to visit apart from what I’ve mentioned here. Once the tour has completed, it’s just a maximum 2 hour drive back if you’re a visitor from Colombo.


Note: It’s very important that visitors behave responsibly while not causing damage to the environment at these places of visit.



Image sources:
http://www.srilankanwaterfalls.net
http://www.frontlineonnet.com/fl2112/stories/20040618003109700.htm