30 June 2006

A Sister

My father was dissapointed when I was born. He had expected me to be a baby girl! It was in 1970s, my father knew I would be the last child for he knew he would not be able bring up more than two kids comfortably. My father could not have a daughter. He always mentions it: wish I had a daughter!

Neither me nor my elder brother has a sister. We in the family have been very happy but a sister would have added a lot of leg pulling! I shall always regret for not having a sis. I realise that there is lot of pleasure in fullfilling wishes of a sister. I have yarned to see that blissfull smile on my own sisters face.

But may be in next life. You are blessed if you have a sister.

~rAGU

28 June 2006

Drawing Custom Cursor in Java Swing

Use ArtCursors software Trail version to draw an image and put that in say multimedia\test.gif in your Eclipse project folder.
Use the code:
----------------------------------------------------------------
Toolkit CursorTk = Toolkit.getDefaultToolkit();
CursorImage = CursorTk.getImage(".\\multimedia\\test.gif");
int Width = CursorImage.getWidth(null);
if (Width >= 0)
{
System.out.println("Image Loaded");
} else {
System.out.println("Image Loading Failed");
}

Cursor TunnelCursor = CursorTk.createCustomCursor(CursorImage,new Point(0,0),"cursor");

Object.setCursor(TunnelCursor);
------------------------------------------------
Object is a your Farme/Panel object.

I will post a complete code that does all these in a while....

~rAGU

Aisle Seat?

"Aisle (Ill) seat or the window sir?”, asked the man at the counter. I stood like a student in front of an English teacher. I gathered my senses. Asked him, "What does it mean?"! He invested all is patience in telling me that in an airplane there is seat next to window and the other one next to passenger way.

Which one sir?
Does not matter!

I got the boarding pass. It was not my first flight. Neither was it the second one! But the executives' look at me was elegant. It was as if a dog was trying to fly to London.

Language unfortunately is taken as a measure of status in some parts of the world. Our own languages continue to be lower class languages.

The other day I over heard a kid say, "We speak English at home, maid who cleans our house speaks Telugu". Thankfully Allasani Peddana is not with us. Long live revolution. Inglish(!) still rules India.~r

27 June 2006

25 June 2006

My Height

I am 0.00000175 Kms heigh! If you wonder why this has to be in Kms: to make it funny. Measures have changed, especially in India. I shall write about all units that I have come across. This would be a good reading for those who want to know, how things were measured in India.

I am 5' 9'' high. Guys in US and UK would agree, others may not I am 175 cm high for them. That is units play an important role in percieving the magnitude. I do not how Harappans measured things but let us start with a time that is worth considering.

In ancient India distance was measured in Yojanas. You may find details elsewhere but the people in Karnataka measured distance in "Rahadaari" till recently. Length of things were meaured in 'Genu' the distance between tip of thumb to tip of small finger in our hands. 'Mola'distance between elbow to tip of the middle finger in our hands. 'Maaru' stretch of two hands.'Hejje' span of legs on a normal walk.

Measure of distance between places have changed but the distance has not!

Holly Cow

Why is cow holly for Hindus?

Conventions

Every civilisation has conventions to make desicion making easy and to make consequences of decisions pleasant.

To be continued

Happiness and Compromise

(Skip to Para 4 for actual content if you are not used to O Henry’s short stories!)

My Blog writings, which are little more sacred than The Vedas themselves, as no one reads them, are getting more philosophical day after day, night after night, for those who prefer to live in nights. They use a word 'night life', which, an evangelist from their clan told me, is a close cousin of 'life after death'. Friends, this is not the topic of our discussion. Did I say discussion? I would expect those who have been forced to this 'discussion', will forgive me as, It’s my habit to take readers for granted. I sometimes test reader’s concentration by intentionally deviating from the topic. But readers have assured me that I did them no harm, by not reading it!

So it was about getting philosophical. Churning abstract concepts is what philosophy is. I would take an excuse of my ignorance, in the history and fundamentals of philosophy, to not to elaborate any further in showing my complete ignorance! You would soon get to know that this write up indeed discusses some things like happiness and compromises, as if Bertrand Russell and other British saints only lived a worthless life, failing to explain properly, what they wanted to explain. That is no sin, I shall declare, as even they did their bit towards showing their ignorance in what Indian philosophers had done in the same field when days and years were considered not worth counting!

Now that I am qualified as any other writer should be. We can talk about happiness. I am not so happy about it, you see. If I were, why would I sit down to write this? Fun aside; we have some serious business today. (As if we had nothing until today!)

Happiness is, many a times a byproduct of compromise. Assume that, you do not want to compromise. You would be left with little or no happiness. Compromise, put in another way is
the cost of happiness. This is outrageously costly, isn’t it? How do we define happiness then? I do not do what many people have tried unsuccessfully. I would rather try something new and let others try after I fail! Is compromise a bad guy altogether? Definitely, not. It is a good thing if used in its own place and time. Significant question is compromising on what? This can make a major difference. Petty things in life can always be compromised, as they should be. Lo, we will be happy. Foundations of our personality should never be compromised (I do not use the highly abused words principle and integrity). As many of us do not know, what the foundation of our personality is, we will end up compromising on those things as well. That would lead to unhappiness, contrary to our expectation. Happiness is, many a times the byproduct of compromise. Sometimes it is not!

~r

24 June 2006

How much actually is mine, in what I think is mine?

My village, my country, my what not? Are they really mine? Even if they are, how much? We would like to be associated with all that is good. Good things do not need association. Association needs good things. (This opinion will be rfined, little later)

I remember, I grew up thinking, only the parts that are prosperous are actually my part of my native place. I explained all my friends how green the road side trees were to the right of my village. How thick the forest was. Even, how close the greatest things were. I never associated dry and less privileged villages and places with myself or my place. My palce always meant only good part of what is supposed to be my palce!

If I would like to be objective, I must agree that I belong to place where there is both misery and prosperity. I always believed it to prosperous. It is not. I know it, but I never admitted.

How much actually is mine, in all I think is mine? A little less in good things and a little more in not so good things. We could contribute if we associate ourselves with 'not so good' things. To put it in a more interesting way; Things that are already good, need less association than others associations that are 'not so good'.

~r

23 June 2006

Beyond Policies

Everybody in an organisation adheres to to its policies. My question is, is nobody supposed to be above it? Life has to be managed by lively components. Not by lifeless abstractions, which we call policies, principles, rule and law.

16 June 2006

Kick in the Ass you know :)

You might wonder what has caught this boy. Definitly not the north American culture! But I felt good at this: an anecdote.

I got into a small plane in Vancuver to fly to Saskatoon. I was supposed to join Msc the next day. A man in his forties had arrived already at the seat. We exchanged remaks as any other American to any other stranger would. But we continued as well with the weather, as it should. He told me a lot about his town and that now he lives away. Canadians are out going. He told me he was a technical engineer in the Canadian Railways.

My father is sick. He is very old you know, he told me, "I may not see him again". He explained where the mountains were high and where the lands were flat. Where are you from? You speak a little british acsent, from Newziland? was question a little later. I thought his acsent knowladge should be quite poorer but what he told me made me aware that I had picked up a little "How a ye", Im fane, british stuff from few of my colegues. I said I was from India. Woh ya these British did there bit there as well was his reply!

"Best of luck" he said, in a typical acsent. I did my bit.
"Have a nice time with your father"

Yeah he said, "Kick in the Ass you know!".
I wish he will see his father again. I found a good son in him. He should get to see his father again for long time to come. Sentiments aside. It feels good.
In a very colloquial way, Kick in the Ass you know!

~r

13 June 2006

Subtle Facts and Decisions

Most of the decisions, collective or otherwise, are taken based on certain perspectives, to atain an expected result.

To be continued.
~rAGU

07 June 2006

ಸಾ೦ಬಾರು

ಹಳೇ ಅಡುಗೆಭಟ್ಟ ತೆರೆದ ಹೊಸ ಬಾರು
ಇಟ್ಟ ಹೆಸರು ಸಾ೦ಬಾರು.

ರಾಗು ಕಟ್ಟಿನಕೆರೆ.

ಕನ್ನಡದಲ್ಲಿ ಪ್ರೋಗ್ರಾಮು ಬರೆಯಿರಿ.

ವಿಶ್ವಕನ್ನಡದ ಕರ್ತ್ರ ಪವನಜರವರು ಮತ್ತೊಮ್ಮೆ ಕನ್ನಡಕೊ೦ದು ಕೋಡು ಕೊಟ್ಟಿದ್ದಾರೆ. ಕನ್ನಡ ಲೋಗೋ ಪ್ರೋಗ್ರಮಿ೦ಗ್ ಬಾಷೆಯಲ್ಲಿ ಈಗ ಕನ್ನಡದಲ್ಲಿ ಪ್ರೋಗ್ರಮ್ ಬರೆಯಬಹುದು.ದಯವಿಟ್ಟು ಕನ್ನಡದಯೆಲ್ಲಾ ಅಭಿಯ೦ತರುಗಳು ಇದನ್ನು ಉಪಯೋಗಿಸಿ ಪೀಡ್ಬ್ಯಾಕ್ ಕೊಡಬೇಕೆ೦ದು ವಿನ೦ತಿಸುತ್ತೇನೆ.
ಕೆಳಗಿನ ಕೊ೦ಡಿಯಲ್ಲಿ ಹೆಚ್ಚಿನವಿವರಗಳಿವೆ.

http://www.vishvakannada.com/KannadaLogo

ನಾನು ಈಗಾಗಲೇ ಅದನ್ನು ಉಪಯೋಗಿಸುವ ಪ್ರಯತ್ನಮಾದುತ್ತಿದ್ದೇನೆ.
ನಿಮ್ಮವ.
ರಾಗು ಕಟ್ಟಿನಕೆರೆ.

06 June 2006

DNA?


It may sound little crazy. I got a plot that looks like one of the projections of the DNA helix. I did not give much though about it. I superimposed sin(x) and its first order difference, diff(sin(x)) and I have a shape that looks pretty close to the projection of the DNA helical model (or just an overkill!). I am not sure though, there could be some connection. I call upon the mathematicians out there to take this up. The Empire is calling you for its service :) Do somethin :)). Common its not really that! But there is something in there...
You will now this is far from being anywhere near a helix! Still It looks interesting :)

~rAGU

04 June 2006

Mera Joota hai Japani

Globalisation sometimes takes an interesting position in our lives. I was biking back from a grocery shop and suddenly realised that there was an interesting point about things I wore! I started to think about each thing I had or wore and the place they were bought. That gives the topic for this blog write up.

I bought the shirt I wore from a shop in Piccadilly street(I think), London for exactly a pound(GBP). That was the cheapest I could find! The trouser was bought in Leuven, Belgium, where I had to live for few months. I had bought my shoe in Brussels North (Brussels Noord!), Belgium. The socks was from the Saturday market in Eindhoven, The Netherlands. The USB stick I carry is the one I bought in Berlin, Germany in a sale, for 19.99 EUros.(512 MB !)


That was it. I was on bicycle riding from Wal-Mart back to my nest in Canada. You might be feeling sick about all these. This guy after all an Indian, Does he not have a thing, a thing at least, that can be called Indian. I do not know if I can say my heart is Indian. (Mera dil hai Hindustani :)). I have a Hindustan Machine Tools(hmt) watch, which my Appa bought me when I had to enter the college. But it has run out of battery.

Disappointing you may. I wore something very important that is Indian: the underwear I bought in Bengaluru.

~rAGU

03 June 2006

Hapless Language Abilities

I have been meeting a lot of people. Most of them happen to be what media calls, urbanely or even cosmopolitan. What are conspicuous are their language abilities. I have seen them struggling to say what they exactly wanted to say.

To my dismay it is increasingly so! The phrases "you know what I mean", "I mean", "that means", are abundant in their conversation. Most of them either educated in English there by deprived of an opportunity to master their mother tongue or studied in mother tongue but spoke in some other language most of the time.

They neither know their mother tongue properly nor English. It sometimes makes me sick. In spite of having thousands of languages why is our generationX is being pushed to linguistic poverty? Partly responsible though, individuals do not seem to realise that they have been traped in some kind of mess.

As usual, they believe that is not a great thing! What is so big about it by the way! Grapes high in the sky are sour! I have been accused of regionalism whenever I have tried to convince that its important to know one language completely and comprehensively. What we are taught in India is not English. It’s Binglish (Bengali), Kinglish (Kannada), Tinglish (Tamil, Telugu) or Hinglish. Are`t we very proud about whatever [X]inglish we speak?

It looks as if we have chosen to live how society of our time lives. Can’t we make efforts to learn one language properly. I get disheartened whenever a young Bangalorian speaks in Kannada, a mumbaikar speaks in Marathi, or Hindi (Unless he is a UP Bayya). They struggle. Some know that they struggle. Many do not even know that their language is poor. Why people are neglecting it, when most of our life is spent on learning programming languages? (If you are a software engineerJ)

The issue is not just of a language. It’s also about an identity. Those who belong to everything belong to nothing. While it is scientifically accepted that mastering mother language is the key to strengthen language skills, society may not accept it as long as it is seen to be an inconvenience. What an ingenious creations are these languages! They are treasures of societies. Don’t they deserve more regard?
~r

01 June 2006

Using C++ Libraries in C#

Using C++ Libraries in C#
-----------------------------
I am told it’s quite a task! Considering Microsoft claims, "Power of C++ and flexibility of Visual Basic!" I thought there is
something Kala in Daal (fihsy). Now it turns out lot of wrapping that this stuff. Well I would put how I managed to do that
after a few days. Yeas, will let you know if I scrapped it as well. What a day :)

I finally came up with this incomlete stuff:

(This only tells how to call member functions, if you plan using Types or classes, you are in a wrong place)

Using VC++ Dlls in C#
---------------------------
Once you have chosen C# scratch your head before you start. You must if you are a beginner like me. Last thing you should do is to look in to that sacred Microsoft bible: MSDN. Search in Google groups instead.

Assume you have a dll VCDll.dll. Copy the dll to your project folder or to C:\windows\system32, or any other folder tell your .NET IDE that it is in X folder using build->Options.

Once the dreaded dll is in place, suppose that you would like to call a function,
bool KillGates()

You may use it as follows;

[DllImport("VCDll.dll", EntryPoint="?KillGates@CPDIdev@@QAEHXZ")]
//Note you have to use appropriate entry point above is just an example.
static extern bool KillGates(); // Returns TRUE if run successfully

If you wonder where is this "?KillGates@CPDIdev@@QAEHXZ" coming from, that directly comes from Bill Gates' godown. The one you see is an example for the mangled name of the function. You may get the mangled names as follows;

1 Type dumpbin.exe in the command prompt.
2 You will get an error! If you do, not go to step 4.
3 Copy dumpbin.exe in Program Files\Microsoft Visual Studio .NET 2003\Vc7\bin to
C:\Program Files\Microsoft Visual Studio .NET 2003\Common7\IDE
4 Type;
dumpbin.exe /EXPORTS > FunctionNames.txt
5 Use FunctionNames.txt to identify EntryPoint and use it in the DllImport section explained above.

Hold on. Not everything is over. REBUILD you application. Otherwise you will get an error depending on what you have coded!
For e.g., if you specify no or wrong Entrypoint you will get EntryPoinNotFound failed to find KillGates(); in VCDll.dll.

Now you are done. Note VCDll.dll is an example replace the name of your dll there when you write your program.

Not successful?
You ought to be. I could not get it to work! :) What about types? You can not use the types like Class etc directly. I gave up and started using Java ! I am not good in both so I had no roblem in switching.
It is insane guys. Do not try this stuff. If you have source with you recompile it with some changes to make it Managed code. Otherwise hire Osama to kill your dll vender.

Send me an email, I took an oath this dooms day! I will kill anyone who asks me about this problem again.

A friend of mine did a nice work around. He created a dilogbox that displays data using C++ and MFC. He uses the data in his C# program to get the job done. THis is useful if you are using your program for an experiment. Even otherwise you may hide the dilog box and get the job done.

Saskatoon
06/06/06
~rAGU

Intersection of Contents in Two Files

#!/usr/bin/perl
#/*Author : ~rAGU (ragu dot ks at gmail dot com) */
#/*Descripation: A script to find the intersection set of the lines in two text files */
#/* when one of the file is a subset of the other */
#/* finsec.pl */

open (SET, @ARGV[0]);
$isInSubset = 0;
$count = 0;

while ($lineInSet = ) {
chop($lineInSet);
#$lineInSet =~ s/^\s*(.*?)\s*$/$1/;
$count++;
$counts = 0;
open (SUBSET, @ARGV[1]);

while ($lineInSubset = ) {
$counts++;
chop($lineInSubset);
#$lineInSubset =~ s/^\s*(.*?)\s*$/$1/;

if ($lineInSet eq $lineInSubset) {
$isInSubset = 1;
}

} #End subset loop

close (SUBSET);
if ($isInSubset == 0){
#chop($lineInSet);
print "$lineInSet";
}
$isInSubset =0;

} #End of set loop

close (SET);

#/* End of the program */