Dancer – A perl web framework

October 29, 2012

Dancer is a very lightweight yet powerful web framework written in perl. Its objective is to be simple and minimal. Over a period of ten years I have developed lot of desktop applications in perl/tk. Its about 3 lakh lines. Now is the time to giveup desktop based applications and move on to web based. I have been evaluating many cms and frameworks. Most of them are heavy and gives you less flexibility. What I wanted was simple one which let’s me decide what I should do. Catalyst framework seems to be good but I found it to be to heavy both to learning and to develop. When I found dancer, I was quite satisfied. I have deployed few small applications with it and have no major issues.

What I liked about dancer was its route handling. You can simply map routes to subroutines and take care of all business logic and processing in the subs/modules you write. Few of the important features are

1. Good route handling
2. Template support like template-toolkit
3. Plugin architecture with lot of plugins already available
4. Session managment
5. Support to Plack/PSGI

Here is a simple piece of hello world

#!/usr/bin/perl
use Dancer;

get '/hello/:name' => sub {
return "Why, hello there " . param('name');
};

dance;

You can run this code like

perl mydancerapp.pl

And then pointing browser to localhost:3000/raman will return ‘Why, hello there raman’.

Dancer is under heavy development. Version 2.0 will be released soon.

You can see more details at perldancer.org


Hard Disk Temperature -hddtemp

October 9, 2012

Recently I came across hddtemp a very useful tool to check hard disk temperature. It is available in debian repository. It uses SMART  capability of the hard disk to get temperature information. Here is the output from my system

# hddtemp /dev/sda
/dev/sda: WDC WD5000AADS-00S9B0: 38°C

It has daemon mode also for continuous monitoring.


Being an Indian Railwayman – Part I

June 10, 2012

I have completed 25 years as Railwayman  an Indian government servant. It was on Nov 11 1986, I joined Railways. The last 25 years has given me immense work satisfaction. I am really fortunate to be working in Railway Hospital, Perambur. Unlike most other government offices, my hospital is highly professional. There is great deal of professional independence, spirit of innovation. People don’t step on others toe. Of course like most other government offices, there is decline here also. But still we are better.

Railway is a really complex monster. No one can understand the system in less than 2 years and that too only when you work inside,I bet on that. It is complex because it has everything  railway coach manufacturing, civil engg, communication, electrification, security and health care. We are one of biggest health care providers in the world. The medical department of railways provides health care to nearly 70 lakh people a fact not recognized by outside world.

Commonly people think government service is uninteresting, not rewarding, lazy and whatever other negative things they can think about. No, it is not. Indeed it is a challenge, highly rewarding – not in monetary terms -but in job satisfaction.

There are problems in the system, but the system moves on. It is slow, but moves on. It has short comings but it moves on. It is shaky but will never fall. It is dull but will never fail. Best thing about the system is no individual can bring it down overnight, in the same vein no individual can improve it overnight.

As an insider I have observed that there are subgroups of employees – not based on specialty – but on the attitude, innovation, dedication etc. Among railway employees there are two main classifications – field and administration.  Common public mostly come in contact with field staff like station masters, ticket collectors. Rarely they need to interact with administrative staff. The sub-group I am talking about is waste workers(WW), average workers(AW) and excellent workers(EW). In my opinion the ratio of WW:AW:EW is 60:30:10 among administration and 40:40:20 among field staff. Well it is just an observation, not a scientifically studied one.

Since the WW is very high, everybody thinks so badly about government employees. However please do understand the small percent of excellent workers make good.  You won’t believe it looking from outside. A simple case I can point out is my doctors , nurses and pharmacists. A doctor can easily manage over 100 out-patients a day apart from regular IP cases or Pharmacist clearing 200 prescriptions a day is not uncommon. I can see the difference, whenever there is a rush is any private organisations – say in school during admission, or shopkeeper during rush hour and so many other places. The 10% and 20% EW of ours can beat any private sector guy – why guy, a gang even- easily and wins hands down.

Indeed it is the EW which keeps the railways going, the reason why Indian Railway can carry a daily load equivalent to population of Australia. They are terribly innovative, have sharp trouble shooting skill, adept in management – both men and machine.

The constraints are many mainly imposed by WW – inefficiency, lack of team spirit, laziness, union pressures, political pressure ….. an infinite list. So it is challenge, every day, every hour and indeed every minute. As they say when going gets tough, tough gets going. These constraints are what makes job satisfactory. I don’t see anything interesting when the atmosphere is conducive. – You order something and the thing is done- what is the challenge here? Anybody can work in such places. But government is full of challenge, even small thing needs a push.

Criticizing government servants is favorite pass time among Indians and railways being biggest employer – more than 14 lakhs – takes a big hit. Yes, I agree- every body has the right and we being public servant should take it in the right sense. But what is remedy to the ills? If you watch English Language Media it looks like RTI and implementation will solve all the problem. They are discussing about a Right, but their thinking is wrong. A simple fact – a train running from New Delhi and reaching Chennai involves 3000 human beings – yes whopping 3000 – will show the enormity of the problem.

Britishers have left a system which is stable but terribly backward looking, dominated by McCaulaian Clerks. Here procedure is more important than product. Everything should be fine on paper – not necessary to be so in field or actual usage. If you read any government proposal – be it a 6th plan or 7th plan or budget or anything else, no one can find fault – they are all paper tigers. But actual implementation leaves lot to be desired.

Today what is required is not RTI, but administrative reforms, a good recruitment policy based on merit. In government ,administrative reforms is the crying need. Let me show this by an example. In railways gazetted officers are eligible for briefcase for carrying official papers etc. There are certain conditions like

Amount : Rs.1500 for Group B, Rs.3000 for a Group A and so on

Eligibility: Once in every 2 years.

Upto this everything is fine  paper tiger. Nobody can find fault with it. Now comes the crux of issue – the procedure. Here it is

a) Officer applies – says that he/she is in such and such grade, and he finds it difficult to carry papers without a brief case, when he last received a briefcase etc.

b) This application is forward to Head of Department by his immediate boss through his immediate boss and so on.

c) The HOD approves. Just to remind you this position is sufficiently high – an average salary of more than 1.25 lakhs per month apart from lot of other perks. He/she spends time in approving a routine purchase of Rs.1500/-.

d)Once approval has been received, an indent -i.e. purchase request is sent to purchase department.

e) Purchase department will verify the claims. If the officer had already received a briefcase, old one should be surrendered. That should be sent to scrap disposal dept who will issue a certificate.

f) The purchase department will have firms who have been shortlisted for this purpose. They prepare a cheque for the stated amount in favour of the firm and hand it over to the officer.

g) The officer concerned visits the firm and selects the model he/she needs. Hands over the cheque and obtains the bill.

h)The bill should be handed over to the purchase department for verification.

Whopping number of steps – a minimum 3 months process. Apart from time consider the cost of the system. At least 10 persons handle this. So the manpower cost itself will come to Rs.1500/.

Now look at the alternative system. You know every officer is eligible once in two years. Simply pay an amount Rs.1500/.3000 in his salary every 2nd year and ask him to get whatever he wants.

How simple it is, isn’t. Well that is why I say what we need is Administrative reform first and not RTI. In the absence of good administrative procedures RTI doesn’t help. There are thousands of such unnecessary procedures delaying the work.

Today the obsession with RTI has deflected focus form actual functioning .

I feel  Shri.Kejriwal and Ms.Kiran Bedi are doing great disservice to the nation by painting whole civil service black – thereby driving honest and efficient youngsters away from civil service. I request honest and efficient young Indians to consider government service if you want to see a better India. The ideal model would be Shri E.Sreedharan .

.


Tamil Epigraphy – Tamil numbers

January 15, 2012

தமிழ் கல்வெட்டியல்

கடந்த சில வாரங்களாக திரு.இராமசந்திரன் அவர்களிடம் கல்வெட்டியல் பயின்று வருகின்றேன். இந்த வகுப்பு ரீச் (http://conserveheritage.org/) மூலம் நடத்தப்படுகின்றது. நான் கற்றவற்றை என் பதிவின் மூலம் பகிர்ந்து கொள்ள முனைகிறேன்.
1.எண்கள்

தற்காலத்தில் நாம் எண்களை இந்தோ-அரேபிய முறையில் எழுதுகிறாம். ஆணால் 19ம் நூற்றாண்டு வரை தமிழில் எண்களை எழுதிய முறை வேறு. மொத்தம் 13 வகையான குறியீடுகளை கொண்டு எண்கள் (முழு) குறிக்கப்பட்டன. அவையாவன:

தற்கால எண் தமிழ் முறை யுனிகோட் குறியீடு
1 &#3047
2 &#3048
3 &#3049
4 &#3050
5 &#3051
6 &#3052
7 &#3053
8 &#3054
9 &#3055
10 &#3056
100 &#3057
1000 &#3058

பூஜ்யத்திற்கு என்று தனி குறியீடு எதுவும் இல்லை. பிறகு எண்களை எப்படி எழுதுவது? சில எடுத்துக்காட்டுகள் மூலம் காண்போம்.

5= -ஐந்து

15= ௰௫ -பத்து + ஐந்து

25=௨௰௫ -இரண்டு பத்து + ஐந்து

இம் முறை கிட்டத்தட்ட சொல்லால் எழுதுவது போல் உள்ளது. பத்தின் அடுக்குகளாக (10,100,1000) வரும் போது அதற்குரிய குறியாக மாற்ற வேண்டும்
கணித பாடத்தில் வரும் இருபடி சமன்பாடு (Quadratic Equation – ax^2+bx+c) நினைவூட்டிக்கொண்டால் எளிதாக இருக்கும்.

தற்கால முறைக்கு பழகியநாம் பழைய முறையில் மாற்ற கிழ் கண்ட படிகளை கையாளலாம்

1.எண்களை முதலில் பத்தின் அடுக்காக மாற்றிக்கொள்ள வேண்டும்.

2356 = 2×1000+3×100+5×10+6

2050 = 2×1000+0×100+5×10+0

2150 = 2×1000+1×100+5×10+0

2.ஒவ்வொரு எண்ணுக்கு பதிலாக அதற்குறிய குறியை குறிக்கவும்.

2356 = x + x + x +

கெழு/குணகம்(co-efficient) பூஜ்யமாணால் அதை விட்டு விட வேண்டும்

2050 = x + – - + x + -

கெழு/குணகம்(co-efficient) ஒன்றானால் பத்தின் அடுக்குகள் (10,100,1000) மட்டும் குறித்தால் போதும்.

2356 = x + x + x +

3.பிறகு சேர்த்து எழுதவும்

2356 = ௨௲௩௱௫௰௬

2050 = ௨௲ ௫ ௰

2356 = ௨௲ ௩ ௱௫௰௬

9999 வரை எளிதாக எழுதிவிடலாம். ஆயிரத்திற்க்கு மேல் எண்களை ஆயிரத்தின் அடுக்குகளாக எழுத வேண்டும்.

ஓர் எடுத்துக்காட்டின் மூலம் காண்போம்

12356= ௰௨௲௩௱௫௰௬

12356 = (12 x1000) + 3×100 + 5×10 +6

= ((10+2)x1000) + 3×100 + 5×10 +6

= ௰௨௲௩௱௫௰௬

எளிதாக மாற்ற ஓர் சிறிய மென்பொருளை எழுதியுள்ளேன். அதை பெற இங்கே சொடுக்கவும்


Indian Inscriptions and Eclipses lecture by Prof.Subbarayappa

December 28, 2011

I was fortunate to attend the Prof.K.V.Sarma Endowment lecture  by Prof.B.V.Subbarayappa in Orient Research Institute ,Univerity of Madras.  The topic was ‘Indian Inscriptions and Eclipses’. It was well formatted and excellently delivered lecture.

A study was conducted under TIFR Achaeo Astro project about  eclipses in Indian inscription  was done. The highlights from his talk

1. Rig veda mentions about eclipse

2.Panchavimsa brahmanas mentions eclipse

3.Ramayana mentions

4.Mahabarata has reference to two eclipses in the same month  – one solar and one lunar

Aryabhatta deals with eclipses, however it was Varahamihira who gives full explanation about eclipses.

Generally there was not superstitious ideas in Indian Astronomical texts about eclipses, on the contrary it was call Punya Kala and donations were done.

Earliest inscription is a pallava copper plate grant belonging to 440CE.

An inscription(copper plate) date Kalachuri era 880 (1128 CE)  is very interesting. Astronmer Padmanabha was granted a village by King Ratnadeva for correctly predicting the occurrence of eclipse.

Several astronomers over a period of 6 centuries have written about astronomy and eclipse. Surprisingly all the texts deal the subject in the same methodology, indicating specific schools for training in astronomy (these astronomers were from different parts of our country)

They study was conducted on about 22000 inscriptions – about 12000 sanskrit, rest Kannada and Telugu. Tamil inscriptions about 33000 are not yet studied. The study reveals

1.  Reference starts from Gupta period

2.  1400 inscriptions refer to eclipses

3. 81 duplicates/triplicate (i.e two inscriptions refer to same eclipse but by different donor/place)

4. One eclipse in 1054 CE is mentioned in 5 inscriptions (again different donor/place)

5. 1324 Unique eclipses – 736 lunar rest solar

6. 195 difficult to get exact date

7. 830 exactly matches with date arrived at using modern calculation

8. 246 of them could not get exact date due to various reason

In his opinion no other culture has kept recording for such a long period.

But surprisingly the supernova occurred during 1054CE is not mentioned in any inscription or text. Chineese and Arabs have recorded it.

On the whole it was a fantastic lecture.


Nedungunam – Yoga Ramar Temple

December 23, 2011

Recently I had a chance to visit Sethupattu (Chetpet) in Vandavasi-Polur belt. I had time for only one temple visit. I chose to visit Nedungunam where a rare temple of Rama is located.   How did I know about this temple ?  Whenever I am visiting any place I normally go through this excellent blog – Raju’s Temples Visits to know about nearby temples. The details of Nedungunam temple can be seen here.

The temple is magnificent with two gopuras. It should be Vijayanagar or Post Vijaynagar period one, I am not very sure. When I visited around (5pm) it was empty. The Sanctum Sanctorum was closed. Fortunately the main deity can be seen through the grill door.s It is really rare with Rama sitting in meditative posture. Here are some pictures

View from road


Chennai Kutralam?

November 27, 2011

For the last few days it is raining in Chennai. After long time I am seeing waterfallsl in Tirusulam hills.

 

Chennai Kutralam?


Follow

Get every new post delivered to your Inbox.

Join 38 other followers