Friday, October 23, 2009

diwali without pollution

its been long since i blogged coz of the so call hectic work :-) huhh itz human to _create_ excuses. the same time last weekend, i was having high blood pressure, guess why., diwali crackers were bursting my mind from all the possible directions. oh god, our ears can't bear this amout of dB.
for 3 continous days it was just bursting till 11pm. though it is the case, i slept at my normal time of 10 pm :-) the next morning when i stepped out, it is full of polluted air. but we can't help it. people letting out their childishness atleast three days in a year - its good in one way. i am just thinking if there isn't a way to celebrate without noise and sound pollution. our neighbour aunty had lit her house all around with oil lamps... awesome sight. it was so pleasing you know. the house itself had got a facelift. i was just appreciating this aunty and she jumped to road with a bomb and it literally rendered my ear out of service for a moment!!

i think pleasant lighting is the way i like to celebrate diwali.. may be next diwali i would lit my home..

Tuesday, August 4, 2009

bash back to olden days

for some reason i don't like coloured text in tty. Linux, by defaut sets weird colour for any display in tty. For example tar files will be listed ( as part of ls output) as red... weird.. but i would love to see it in old unix style.
here is how you could do it.

a) copy /etc/DIR_COLORS to /home/urloginName/.dir_colours
b) change "COLOR tty" to "COLOR none"

Tuesday, May 26, 2009

c++ : undefined reference to `Classname virtual table'

I can't believe that I spent around 6 hours to debug this error code. Though I am just beginning with C++, its too long a time. I greped over the internet and the root cause as mentioned is
"this linker error will occur when a virtual function is not defined". I checked my class definition over and over and made very sure the all the virtual functions are defined in the base class. huhh i did that and this and was running out of options. tried sample programs and all went fine.

Then i took deep breath and was rolling over other files in the codebase and '#pragma interface" seemed to be something new to me. I tried googling it and found something interesting with gcc. Looks like the compiler will cache auxillary information and during the linking time, this cached information is used. In my case, the cached information may not have been the correct one. When we use this pragma, it forces gcc not to do any caching and hence force 'ld' to do the linking dynamically.

and this has done the trick for me.

Wednesday, May 13, 2009

"unterminated character constant" c++

I got this error message recently. I was scratching my head of what this hell is all about as the error line pointed to an unrelated line of code. After digging through I found its because of an unterminated character sequence in the previous function.
eg. cout << "blah .. << endl;

Monday, May 11, 2009

IP to Int conversion tool

most often when we are programming in networking, we might want to convert IP to interger and vice versa. Earlier I used to have a c program to do this task for me. I somehow lost it and now I needed for a quick reference and found this URL serving my purpose.

http://andrey.mikhalchuk.com/2008/01/28/simple-free-online-ip-conversion-tool.html

loop over enum C/C++

i was expecting enum to be treated as integer as using it in my code as,
for ( enumA i=0, i< enumMax ; i++)

Only after compiler scolding me, I realized that post-increment will not work with enum :-)

so here is how we can overcome this,
for ( enumA i=0, i< enumMax ; i = enumA( i+1))

And remember enum is a datatype and so operator overloading over an enum is not possible and hence you can not overload ++ operator also.

Wednesday, April 22, 2009

download photo from orkut album

orkut doesn't allow right click on the photos in the album. So downloading is not possible. But as nothing is 100% perfect, we can workaround it -

left click on the picture and drag it to the address bar. wowww there you go, now the picture is opened in the browser with right click. Now you can right click and download it.

Friday, April 17, 2009

backup clearcase checkedout files

Here is a script which I used to backup my checked out clearcase files.

What the script does is
1. Store the config spec in a temporary file
2. Get all the checkedout files
3. Using sed, prepend drive letter ( i run clearcase client over windows)
4. tar all the checkedout files and config spec. The backup filename contains the date and time, so
that backup date is kind of timestamped.
5. Move the tar file to a network location ( I have mapped B drive to a network location)
6. I have this shell script in the drive, where i have the view mounted and execute it whenever
i feel like backing up my code changes.

I am trying to automate the backup( say automatically backup every night at 10PM, thats when i go to sleep) job using crontab. But I think my cygwin is giving me trouble with this.

--------------------------------------------------------
#!/bin/bash

ct catcs > config_spec
ct lsco -avobs -cview -short > checkout.files_temp
sed -e 's/^/Y:/g' checkout.files_temp > checkout.files
tar -cvf a.tar `cat checkout.files` config_spec checkout.files
mv a.tar B:/Backup/backup_`date +"%Y%m%d%H%M%S"`.tar
rm checkout.files*
rm config_spec

--------------------------------------------------------

Friday, March 20, 2009

su password in ubuntu

ubuntu don't have a root user name. the first user created is automatically the root user.
Here its all around 'sudo'

I was installing 'SSL vpn client' in ubuntu and it asked me to 'su' password.
ubuntu inherently don't assume a super user. so get a 'su' context,
sudo su
(type user password)
passwd
(type new passwrd)

Friday, February 13, 2009

steal your favorite software

ever wondered how keygen works... It use disassembler to look at the assembly code of the software to learn about the algorithm validating the key to activate the software. Reverse engineering is done on this piece of code and keygen software would generate algorithm with would generate a key such that validation passess in the software. simple..

Thursday, January 8, 2009

2009 new year in goa

this new year has been full of fun in Goa with 8 other frnds. We had a 3 night and 4 days tour to Goa with the college friends. Stay was arranged in Park Plaza in Panaji which costed Rs.3000 for a double bed room plus an extra bed for a day. We started from b'lore in train at around 3pm on tuesday and reached madgaon around 6AM and 1hr journey to Panaji. There is direct shuttle to Panaji, if we take bus it would take 2hrs. After refereshing in hotel, we left to Calangute and Baga beach( these are adjacent beaches) and those foreigners kept us roaming in the beach continousily for more than 4hrs :-) giving good eye exercise. Who motivated us more was the golden gal :-) .Then these stupid guys made me have lunch at 5PM... huh this would have been the first time, that i am having a late lunch. food is not that good in the beach though the beach is lined with 100-s of hotels. Since that night is the new year night, we stayed in the beach till 12:30 PM. It was a good to have invited the new year from the beach.

The next day, this stupid Ram wanted pilgrimage journey and arranged for South Goa trip with the help of Goa tourism board where they showed us 2 churches, museum and a temple. that day was full of bus travel. At night, it was Ravi's birthday. He got so much birthday special punches from guys except me. The reason i didn't beat him is that, the momemtum might turn to me :-)

Next day we again moved to Calagute beach to have parasailing and water biking. They got Rs.500 for parasailing and 200 for water biking. They said they will take us for a lumba para sailing, but the lumba was the boat ride. They took us in a boat to around 2kms in the sea and they lifted us for parasailing which lasted only for around a minute :-( . It was a good ride but the duration is disappointing.

The final day, we just relaxed in the parks and did bit of shopping and returneddd

Overall its a good place for honeymoon with good beaches and scenic places. and really a good place for water bearers, i mean drunkers

outlook switches

day before y'day, all of a sudden,I was unable to delete my outllook 'Sent Items' folder. And it gave me an ultimate __Microsoft__ error message "You don't have permission to delete.." huhhh, if i don't have the permission to delete my mails, is it that Bill Gates will come and delete my mails :-) . Sys Admin folks did this that and finally said some background work is been done ( ooops outlook does some background work for more than a day :-), may be it has gone for a heavy lunch in the middle of its work, preventing me to delete my mails). Then they reopened outlook with 'cleanfreebusy' switch. I don't know what it does internally, but it solved my problem. These Microsoft guys are good enought to introduce bugs and have restart as the solution for it, aah even this restart don't work at times. I hunted the net and found few more switches like these, which will help us live with this buggy boy.


Command-Line switch Purpose

------------------- ------------------- ------------------- ------------------- /CleanFreeBusy Cleans and regenerates free/busy information.

/Cleanfinders Removes saved searches from the Exchange Server store.

/CleanReminders Cleans and regenerates reminders.

/CleanViews Restores default views.

/CheckClient Prompt for default manager of e-mail, news, and contacts

/Recycle Starts Outlook using an existing Outlook window,if one exists.

/ResetFolders Restores missing folders for the default delivery location.

/ResetOutlookBar Rebuilds the Outlook Bar.

/Nopreview Turns off the Preview Pane and removes the option from the

View Menu.

/CleanSchedPlus Deletes all Schedule+ data (free/busy, permissions, and .CAL file)

from the server and allows the free/busy information from the

Outlook Calendar to be used and viewed by all Schedule+ 1.0 users.

/Safe Launches Outlook without extensions, preview pane or toolbar

customization