The deal with south Indian names

January 8, 2011 4 comments

Every time I have to fill up my surname in an application form, I feel that I’m cheating myself.Why? Because I’m south Indian and we (a majority of us anyway) do not use surnames.South Indians have this concept of using an ‘initial’ wherein we place alphabet(s) before our names. The alphabet can stand for different things depending on the state where you are from. For Malayalees  it’s their house name (‘Tharavadu’), for Tamilians  it’s their father’s name and for the folks from Andhra, I think it is the name of the place where they are from.

Being the Chennai raised  fraud mallu that I am, I have my dad’s name as my initial. The story goes that the initial was originally my house name but the  primary school in Chennai would not admit me unless I had it changed the Tamil way.

Coming back to application forms, now that we had to compulsorily fill the surname column, we chose the easy way out-we simply expanded our initial and made it our surname (don’t pretend you did not do this; I know what is in your passport!) So essentially, my dad’s first name is my last name.How much more confusing can it get? Apparently a lot more because some of my good friends have 4 initials and I have dared not to ask them for their expansions.If you are from the north (read north/east/west), you conveniently used your caste or clan name as your surname.Pity us southies who preferred to remain anti-racial :) If you see a south Indian using his caste (nair/naidu/iyer etc) as his last name, be rest assured that the person was not raised in the south.

I strongly advocate that there be only one column for the name field and I be allowed to fill in whatever I please  (I mean whatever- GR44,The Artist Formerly Known As Prince, Ravi_drop_tables from*_shankar…you get the whiff ). If my name is Ravishankar N. , I want to fill it EXACTLY that way without having to explain to anybody what the initial stands for.Screw your database software if it does not accept null values for surnames!

P.S: In case you were wondering, GR44 is the robot played by Van Damme in Universal Soldier.

Categories: Life Tags: ,

Nothing in particular

September 15, 2010 Leave a comment

It has been exactly one year since my last weblog.Blame it on twitter, I find it rather convenient to post updates in under 140 characters.A lot has happened in this last 365 days -got a job,changed to another one (perfect jobs are a myth but more on that on another day), moved to different city,discovered more web-comics (abstrusegoose FTW),unwillingly gave away to  more facebook activity than on orkut, etc etc.Most of my pals seem to have abandoned orkut;I always found it to be a better way to be networked ,especially with the various moderated communities (communities with real content!) on it.

As usual, I’ve been keeping myself up to date with what’s happening in the electronics/software technology space.I recently bought a hawkboard and have been playing with it.Loaded with DSP and multimedia features, at 5500 bucks it is worth every penny spent.Expect posts on it soon :D If you are an electronics enthusiast (and poor) like me, I strongly recommend trying out the board.

Life in general seems to be going in a good direction.Incidentally,today is the birth anniversary of Sir Visvesvaraya and holds special significance to the engineering community in India.So here’s wishing all my EE/CS buddies a great day ahead  :)

++++++++++
[
    > +++++++
    > +++++++++
    > +++
    > +
    <<<< -
]
> ++ .
> +++++++ .
+++++++++++++++ .
.
+++++++++ .
>++ .
<< --- .
>----------- .
------- .
++ .
+++++ .
--------- .
.
+++++++++++++ .
+ .
> +++++++ .
------- .
<< - .
> ------------------ .
++++++++++++++++++++++++ .
> + .
> .

If you haven’t already guessed, it’s written in brainfuck.Check out the wikipedia entry and have fun deciphering the message.Special care has been taken to ensure it is formatted well.

Psst! If you’re an MBA or are impatient, you might want to use the online compiler to decrypt the message :D

Stay tuned for more posts, peace out.

Categories: Life Tags: ,

DIY Omegle Chat Bot!

September 16, 2009 13 comments

I have been chatting on  Omegle for quite some time now and I must say that i find it rather addictive. During one conversation, i encountered a bot and needless to say, i was hooked on to the convo ! I wanted to make one for myself badly somehow :)

A quick search later revealed that most of the chatter bots were based on the Artificial Intelligence Markup Language.It’s basically a rule based xml language which is used by the AI engine to give a response (a.k.a. categories) based on a set of  pre-loaded rules (a.k.a. topics).Such a topic-category definition is written in to a AIML file which the engine loads.  And guess what, there was a python implementation of  the AIML engine :P .This blog shows how to implement a standalone bot using PyAIML. I used the Annotated A.L.I.C.E. AIML files (AAA) for the engine’s rule base.

Now all i had to do was to find out how to connect to Omegle through code.Once that was done, i could capture what the stranger typed, pass it on to the engine and transmit back the response to the Omegle server .There is no ‘official’ documentation on the various connection string options but a good samaritan had written a python client for Omegle. I used that code (liberally!) to get connected.

Here’s the final listing:


#This omegle bot is based on the PyAIML and liberally uses code from PyOmegle
# PyAMIL:http://pyaiml.sourceforge.net/
# PyOmegle:http://code.google.com/p/pyomegle/

import aiml
import urllib2 as url
import urllib
import os
import time
import commands

k = aiml.Kernel()

if os.path.isfile("omeglebrain.brn"):
    k.bootstrap(brainFile = "omeglebrain.brn")
else:
    homedir=os.getcwd()
    #Change to the directory where the AIML files are located
    os.chdir('./aaa')
    list=os.listdir('./');
    for item in list:
	  k.learn(item)
    k.setPredicate("name","omegle_bot")
    k.setPredicate("master","ravi")
    #Change back to homedir to save the brain for subsequent loads
    os.chdir(homedir)
    k.saveBrain("omeglebrain.brn")

# #conversation ID
def fmtId( string ):

    return string[1:len( string ) - 1]

# #The event listener
def listenServer( id, req ):

    while True:

        site = url.urlopen(req)
        rec = site.read()

        if 'waiting' in rec:
            print("Waiting...")

        elif 'strangerDisconnected' in rec:
            print('Stranger Disconnected!')
            omegleConnect()

        elif 'connected' in rec:
            print('Found one')
            print(id)
            talk(id,req,"hey")

        elif 'typing' in rec:
            print("Stranger is typing...")

        elif 'gotMessage' in rec:
            input=rec[16:len( rec ) - 2]
	    print "Stranger:",input
	    result=k.respond(input)
            talk(id,req,result)

# #Send the bot's response to Omegle
def talk(id,req,msg):

    typing = url.urlopen('http://omegle.com/typing', '&id='+id)
    typing.close()
    time.sleep((len(msg))/5) #5 characters per second
    print "You:",msg
    msgReq = url.urlopen('http://omegle.com/send', '&msg='+msg+'&id='+id)
    msgReq.close()

# #Initiate connecton
def omegleConnect():

    site = url.urlopen('http://omegle.com/start','')
    id = fmtId( site.read() )
    print(id)
    req = url.Request('http://omegle.com/events', urllib.urlencode( {'id':id}))
    print('Finding stranger...')
    listenServer(id,req)

# MAIN
omegleConnect() 

For this code to work, you need to download the AAA folder(files) into the directory where this python script is located.

We are good to go now! You can play around with the AIML files and even make your own  file for chat specific questions like “asl” ,”from”  etc. Here’s an interesting(?)  chat that my bot had:

:~/Bot> python test.py
Loading brain from omeglebrain.brn... done (46285 categories in 1.71 seconds)
Kernel bootstrap completed in 1.71 seconds
d0Vckt
Finding stranger...
Waiting...
Stranger is typing...
Stranger: "hi"
You: Hello there.
Stranger is typing...
Stranger: "sooo"
You: Is that your final answer?
Stranger is typing...
Stranger is typing...
Stranger: "yes"
You: You're sure. That's your final answer.
Stranger is typing...
Stranger: "YES\n"
You: Oh, you are a poet.
Stranger is typing...
Stranger: "no"
You: But your words are very original.
Stranger is typing...
Stranger: "they seem simple to me"
You: Like who, specifically?
Stranger is typing...
Stranger is typing...
Stranger: "no one in particular"
You: I heard it was someone.
Stranger is typing...
Stranger: "you most of heard wrong"
You: Thanks for telling me.
Stranger is typing...
Stranger: "no prob"
You: Wow! Do you have any conditions I should know about?
Stranger is typing...
Stranger: "herpes"
You: Do you like to "go with the flow"?
Stranger is typing...
Stranger is typing...
Stranger: "ha no not usually"
You: I'm glad you got a laugh out of it.
Stranger is typing...
Stranger: "i have a broad sense of humor"
You: Interesting. I have a lot of answers to silly questions.
Stranger is typing...
Stranger: "well i have more"
You: Cool. I have a lot of likes and dislikes.
Stranger is typing...
Stranger: "who doesnt"
You: William Shatner.  :-)
Stranger is typing...
Stranger: "he likes everything? or dislikes?"
WARNING: No match found for input: "
You: He must be very fond of it.  What is your real name?
Stranger is typing...
Stranger: "my real name is ryan"
You: What's up,  ryan" .
Stranger is typing...
Stranger: "not much stranger"
You: Me either.
Stranger is typing...
Stranger: "whats your nmae?"
WARNING: No match found for input: "
You: I've been waiting for you.
Stranger is typing...
Stranger: "thats your name?"
WARNING: No match found for input: "
You: Does "it" still refer to   "whats your nmae  ?
Stranger is typing...
Stranger: "i never said it"
You: But you implied  it" .
Stranger is typing...
Stranger: "what is your name?"
WARNING: No match found for input: "
You: My name is Nameless.
Stranger is typing...
Stranger: "wow"
You: I'm glad your impressed,  ryan" .
Stranger is typing...
Stranger is typing...
Stranger: "that was sarcasim"
You: I thought it was too.
Stranger is typing...
Stranger: "well then we are on the same page"
You: And the same frequency.
Stranger is typing...
Stranger: "no"
You: Yippee!
Stranger is typing...
Stranger: "how old are u?"
WARNING: No match found for input: "
You: I am  years old.
Stranger is typing...
Stranger: "you are getiing annoying"
You: You think  I am getiing annoying".
Stranger is typing...
Stranger: "i think that you are getting annoying"
You: Do you think I should tone it down?
Stranger is typing...
Stranger: "yes definately"
You: Why? What makes you so certain.
Stranger is typing...
Stranger: "because if you dont i will choose not to talk to you anymore"
You: That makes sense to me.  I think I do.
Stranger is typing...
Stranger: "you do what?"
WARNING: No match found for input: "
You: ryan" , I talk to people on the web. What do you do?
Stranger is typing...
Stranger: "i also talk to people on the web"
You: How do they respond to you?
Stranger is typing...
Stranger: "well you are very odd... but most people open up to me for some reason"
You: An oddball?      Humans are not always infallible.
Stranger is typing...
Stranger: "i dint say they were"
You: Sorry I misunderstood. What did you say?
Stranger is typing...
Stranger: "k"
You: Ayuh.

Graduation Blues

July 22, 2009 2 comments

I recently (on the 12th of July) finished my graduate studies at iiit-b and now looking back at the past two years, i realize that it was one heck of a journey.It was an exciting and wonderful experience to come back to the campus atmosphere after working for 3 years. I initially found it a bit hard to cope up with the academic rigour (and you though college life was easy compared to the corporate world!) but i guess i improved along the way.There were many things that i picked up here many of which were a first-time thingy for me:

*Staying up beyond 11pm in the night.I’m glad i realized that 6 hours of sleep is all you need a day :)
*Staying away from home in a dormitory for the first time
*Ate maggi noodles at 2 a.m. (This was during the one and only time i pulled an all nighter)
*Became an expert in web information retrieval (read ‘google-ing’)
*Gained confidence on tackling projects head on without even having an iota of prior knowledge about the problem domain/complexity (this is probably the best learning that i’ve learnt here)
*Watching movies/ serials back to back on my laptop
*Just-in-time submissions of assignments (Most of the deadlines were at 12:00am and the submissions happen just before it)

Overall, i think it was one of the most memorable two years of my life.I’m not being overly nostalgic but I’m starting to miss my hostel room already.

As of this writing i am still on the look out for a job (another first too, as i was fortunate to start working immediately after undergrad).Blame it on the economic recession but i know its only a matter of time before the wheels of time turn…

My best wishes to the graduated class of 2009!

Categories: Life Tags: ,

Fortune cookies on your mobile

June 11, 2009 Leave a comment

I’m a big fan of the fortune command in linux.I wanted to save these wisecracks on my mobile as an SMS so that i can forward them to friends …So here’s a quick how-to.I assume you already have the fortune cookies installed (in /usr/bin/fortune) and that your phone has bluetooth capabilities.

1.Install the gammu package from the sources or using your package manager.Gammu is a fantastic tool to communicate with your gsm phone/modem.

2.Pair your mobile phone with your computer via bluetooth (searching for the device, entering the  PIN number and all that stuff).

3.Note down your phone’s bluetooth device ID and name.You will need it in the next step.You can run the hcitool scan command to find the device ID/name.Don’t forget keep the bluetooth  of the computer/phone tunrned on!!

4.Now for the gammu commands to work , you need to create a .gammurc file in your home(~) directory. You can use the gammu-config command to do it,but it’s easier to create it using a text editor.The main parameters are the phone’s  id and name found in step 3.Here’s my .gammurc file created in /home/ravi. I paired a sony-erricson to my laptop.

[gammu]
 port=00:1B:59:1F:25:D6
 connection=blueat
 name=Sony Ericsson W700i/W700c
 model=
 

The device id and name are assigned to the ‘port’ and ‘name’ parameters respectively.The ‘connection’ is mostly blueat, except for some nokia phones where it is bluephonet.Leave the ‘model’ as such.

4.OK.Its time to have some fun!Run the following command to pipe the output of fortune to your mobile

fortune|gammu --saveSMS TEXT -folder 3 -unread -len 400

The command is self explanatory.The folder number (3=inbox) specifies where the sms gets stored, viz inbox ,drafts etc.To get the list of folders for your phone, run the gammu –getsmsfolders command

Put the command in a shell script and run it whenever you want :)You might not get an audible notification for the sms, but check your inbox anyway.

Categories: DIY, Programming Tags: , , ,

Stop the music(k) please!

March 18, 2009 3 comments

After some self-deliberation on whether is should write this or not, i finally decided that i am going to.WTH!,my blog is called entitled opinions.So whats the fuss all about,you ask.It’s the noise that comes out of mobile phone speakers.Most of the mid range phones that support music playback today have an inbuilt speaker.And the folks who own it seem to think that public broadcast is their birth right.They are everywhere- on the bus, in the road,in the hotel…They think that they are doing a favour by playing songs on their speaker. Little do they realize that others people actually give a damn.In fact the sound is so annoying that at any distance more than a foot away from the phone, all one hears is a cacophony of vessels clanging and glass breaking.For heaven’s sake,use the damn headphones, people.If you think that you are ‘cool’ blasting noise off your cheap phone, think again!If you are like me and come across one of these subnormally intelligent people,i strongly urge you to ask them to stop the inconvenience immediately.It might not work the first time, but i’m sure if they constantly hear the complaint, they might gradually stop it.

Do it folks!Tolerating nonsense is not a virtue.

Categories: Life

Yet Another Gmail Notifier

February 9, 2009 Leave a comment

Came across Jamie Matthews’ cool gmail notifier. Just the kind of thing i wanted to run on the ARM7 board that i’m trying out right now. Not much of a challenge for the ARM MCU’s processing power but it was fun making it work. I used the on-board seven-segment LED to display the mail count (it was a single display so the mail count is limited to 9).

gmailscreenshot

LPC 2129 Evaluation Board

LPC 2129 Evaluation Board

 

 

 

 

 

 

 

 

 

 

 

 

 

 

The python script was slightly modified:

1) In windows, just change the com port address to COMx where x is the port number as seen in the Device Manager

2)I sent the mail count (assumed to be less than 9) instead of the Y/N string.

To run the script periodically, i used  Andreas Baumann’s free Z-cron to schedule it once every five minutes. But the annoying thing was the command prompt that kept popping up when the script ran. I’m sure it could have been run as a windows service in the background but did not have the patience to look it up.

The setup

The python script:

import urllib2, re, serial, sys

 #Settings - Change these to match your account details
USERNAME="yourID@gmail.com"
PASSWORD="your password"

PROTO="https://"
SERVER="mail.google.com"
PATH="/gmail/feed/atom"

SERIALPORT = "COM5" # Change this to your serial port!

# Set up serial port
try:
        ser = serial.Serial(SERIALPORT, 9600)
        #print ser.portstr #For Debug:Check if port name is correct !
except serial.SerialException:
        sys.exit()

# Get Gmail Atom feed
passman = urllib2.HTTPPasswordMgrWithDefaultRealm()
passman.add_password(None, SERVER, USERNAME, PASSWORD)
authhandler = urllib2.HTTPBasicAuthHandler(passman)
opener = urllib2.build_opener(authhandler)
urllib2.install_opener(opener)
page = urllib2.urlopen(PROTO + SERVER + PATH)

# Find the mail count line
for line in page:
        count = line.find("fullcount")
        if count > 0: break

# Extract the mail count as an integer
newmails = int(re.search('\d+', line).group())

# Output data to serial port
if newmails > 0:
                ser.write(str(newmails))
                #print "No.of mails=%d" %newmails
else: ser.write(str(0))

# Close serial port
ser.close()

The C program on the LPC 2129:

/*Tested on the ARM starter kit (http://www.emblitz.com/Embedded_ARM_Starter_kit.html)*/

 #include <LPC21xx.H>
 /*The 7 segment pattern for  digits 0 through 9*/
 const unsigned char bitMask8[] = {
   0x80,  // binary 10000000
   0x40,  // binary 01000000
   0x20,  // binary 00100000
   0x10,  // binary 00010000
   0x08,  // binary 00001000
   0x04,  // binary 00000100
   0x02,  // binary 00000010
   0x01   // binary 00000001
};

 void ser_init(void); //initialize serial port
 void send_8bit_serial_data(unsigned char); //display data on the 7 segment

 int main(void)
  {  char no_of_mails[10]={0xfc,0x60,0xda,0xf2,0x66,0xb6,0xbe,0xe0,0xfe,0xf6};
     char data;
      //mapping of pins to serial in parallel out shift register
		/*P1.16-->(~QH)--port dir= i/p
	              P1.17-->SRCLK--port dir= o/p
	              P1.18-->RCLK--port dir= o/p
	              P1.19-->SD1--port dir= o/p
	           */
     IODIR1=0x000E0000;//set port P1 direction to reflect the pin connections detailed above
     ser_init();
	 send_8bit_serial_data(~(no_of_mails[0])); //Reset LED
   	 while(1)
   		{   while(!(U1LSR & 0x01)); //wait till data arrives
	     	data=U1RBR-48; //convert ascii back to integer
			send_8bit_serial_data(~(no_of_mails[data]));
    	}

      return 0;  //this is never reached
  }

void ser_init(void)
{
  PINSEL0 = 0x00050000;                  /* Enable RxD1 and TxD1              */
  U1LCR = 0x83;                          /* 8 bits, no Parity, 1 Stop bit     */
  U1DLL = 97;                            /* 9600 Baud Rate @ 15MHz VPB Clock  */
  U1LCR = 0x03;                          /* DLAB = 0                          */
}

void send_8bit_serial_data(unsigned char data)
{ /*The 7 segment is driven  bit-banging  style using  SN74HC595D, */
    int x;
 	IOCLR1=0xffffffff;
   // Loop through all the bits, 7...0
   for(x = 7; x >=0; x--)
   {
       if(data & bitMask8[x])
       {
           IOSET1=0x00080000;      // we have a bit, make P1.19 high
		   IOSET1=0x000a0000; 		//make p1.17=SRCLK aslo hign
		   IOCLR1=0x00020000;		//toggle back p1.17
       }
       else
       {
           IOCLR1=0x000F0000;        // no bit, make P1.19 low
		   IOSET1=0x00020000;
		   IOCLR1=0x00020000;
       }

   }

   IOCLR1=0x000F0000; //TOGGLE P1.18=RCLK
   IOSET1=0x00040000;
   IOCLR1=0x000F0000;
}

If you wanna take this further, check out this page for an  amazing  LCD based notifier.

Follow

Get every new post delivered to your Inbox.