Sunday, December 07, 2008

OpenCobol Compiler

I was looking for a COBOL compiler to use compile a matrix multiplication program. I found and downloaded openCobol using Synaptic.

I wrote a simple "Hello World" display program but it would not complie for lack of lncurses. I cursed and installed libncurses5-dev. The program compiled and ran just fine.

OpenCobol translates COBOL to C and then compiles C program using Gnome C compiler. COBOL code is compiled using "cobc -x pgmname.cob" and if you want to see how your COBOL program looks in C try "cobc -C pgmname.cob"

Detailed instructions are available in user manual on

Sample Hello World COBOL program

C Program from Cobol program
/* Generated from HELLOW.cob by cobc version 0.33 patch level 0 */


#define COB_PACKAGE_VERSION "0.33"

/* function prototypes */
static int HELLOW_ (const int);

int HELLOW (void);

/* functions */
return HELLOW_ (0);
/* end functions */
static int

HELLOW_ (const int entry)
#include "HELLOW.c.h" /* local variables */
static int initialized = 0;
static cob_field *cob_user_parameters[COB_MAX_FIELD_PARAMS];
static cob_module module = { NULL, NULL, NULL, NULL, cob_user_parameters, 0, '.', '$', ',', 1, 1, 1, 0, 0};
/* perform frame stack */
int frame_index;
struct frame {
int perform_through;
void *return_address;
} frame_stack[255];

/* Start of function code */

if (unlikely(entry < 0)) {
if (!initialized) {
return 0;
initialized = 0;
return 0;
} = cob_current_module;
cob_current_module = &module;

if (unlikely(initialized == 0))
if (!cob_initialized) {
cob_fatal_error (COB_FERROR_INITIALIZED);
if (
cob_set_cancel ((const char *)"HELLOW", (void *)HELLOW, (void *)HELLOW_);
(*(int *) (b_1)) = 0;
(*(int *) (b_2)) = 0;
(*(int *) (b_3)) = 0;
initialized = 1;

/* initialize frame stack */
frame_index = 0;
frame_stack[0].perform_through = -1;

/* initialize number of call params */
(*(int *) (b_3)) = cob_call_params;
cob_save_call_params = cob_call_params;

goto l_2;


/* HELLOW: */
/* HELLOW.cob:6: DISPLAY */
cob_new_display (0, 1, 1, &c_1);
/* HELLOW.cob:7: STOP */
cob_stop_run ((*(int *) (b_1)));
cob_current_module = cob_current_module->next;
return (*(int *) (b_1));

/* end function stuff */

So much for a two line code
printf("Hello world\n");

Saturday, December 06, 2008

First Firefox Extension

Thought of trying out some thing new and I wrote the "Hello World" Firefox extension. Precise instructions and explanation are available at
The profile folder mentioned in the instructions is ~/.mozilla/firefox/*.default/extensions

After creating the id file in extensions folder when you restart you firefox, the addon window notifies that a new add on has been added.

You can uninstall your extension like any other extension. Uninstalling removes the id file from the extensions folder.

EDIT: An excellent tutorial here -

Tuesday, December 02, 2008

Color Pencil Drawing - Sleeping Dogs

This is my first color pencil drawing. I took four hours to do it. Ear of the dog in front looks as if it has been wrung.

Made the preliminary sketch while listening to PG's Great Hackers

Wednesday, November 26, 2008

Mac Theme for Xubuntu

I had used compiz in my previous install of Ubuntu and missed it in Xubuntu. I installed compiz and emerald yesterday. To further enhance aesthetics of my laptop, I wanted to change the wallpaper. I did not know how to do it until yesterday. My search led me to a blog with details on how to make you Xubuntu look like Mac. Link here.

It inspired me and I downloaded the package - Macforlin package here.

The instructions manual is commendable. It is written very well and contains screen shots for ease. There were a couple of Xubuntu specific requirements which I figured out from the www.

Few notes to self for install:
1) Install compiz and emerald
2) Install xserver-xgl to run compiz smoothly. I was unable to figure out the correct xgl package. Thanks to Arun's Blog
3) Install Avant Window Navigator (AWN)
4) Create autostart of awn and compiz
5) Select mac theme and mac icon theme from User Interace on Settings/Settings Manager
6) Use Emerald as Window Manager
7) Install mac theme for Firefox

It looks really pretty and very close to mac OS X. See pics.

For Uninstall:
The Mac4lin directory ought to be in /home/user directory. Run as sudo. Choose theme and icon theme. And you are back to xubuntu regular.

Saturday, November 22, 2008


I did a water color painting recently. It took about ten hours over a period of three months. It did not turn out as good as expected. Need more practice.



Tuesday, November 11, 2008

Drivers - Windows has it

Now dual boot is working fine :)

I'd downloaded missing drivers from lenovo website for ethernet, wireless, sound and video. But the windows plug and play was unable to find them. I was pointing search in WIN2K folder instead of XP [C:\DRIVERS\WIN\ETHERNET\WINXP].

My friend downloaded the correct Ethernet driver and got plug and play wizard to find it. Once on internet, finding and installing remaining drivers was taken over by plug and play wizard.

The lappie was up and running in less than 10 minutes. After this followed, service packs download and so on. Am elated to have it fixed and working seamlessly with Xubuntu.


Saturday, November 08, 2008

Dual Boot - Windows Woes

I've still not found the right drivers to make WindowsXP connect to Internet. All my attempts end up like this -

funny pictures of cats with captions
more animals

Thursday, November 06, 2008

Dual Boot - Xubuntu and Windows

Yay! Fixed wireless issue on new install.

OS wasn't detecting my Thinkpad's wireless card on both Ubuntu 8.04 and Xubuntu 8.04. I was having a hard time but thanks to wonderful Ubuntu community I was able to fix them. I'm still struggling to fix it on Windows :-)

Here is the tip that ticked -

Saturday, October 25, 2008

Hot air ballooning in Seattle

This birthday I did hot air ballooning 3000 ft above Snohomish County of Seattle. The clear sky enhanced the pleasure.

Hot air balloon works on a simple principle that hot air is lighter than surrounding cold air. This difference causes balloon to rise. First manned hot air balloon was invented by the French and in their honor, the organizers always celebrate success of a flight with Champagne.

Here is the link to the ballooning website -

Labor of Love

June 29, 2008. I ran my first ever half marathon!

Well I did not just run but walked, dragged and cribbed. 13 miles did not seem easier when I registered for the run and boy! were they any easier.

My friend and I planned to train for several months in advance and started just in time a week before the run. Training made us confident of running at least 3 miles which is just enough to cross Seattle's 520 bridge (2.3 miles long) on foot. It was the first time ever the bridge was being opened to pedestrians.

But when we had crossed the bridge and taken a piece of rubber tire as memento, we decided to try finishing the run.

Volunteers after every mile greeted and cheered us. There were high school children offering water and glucose, people watering plants giving free shower and another group of people applauding our efforts.

5 1/2 hours of continuous and painstaking walking got me two nice event Tees and the above medal. Later I received bruised toes and strained shin too but I was told those were exclusives :)

A portion of each registration fee went to the Floyd and Dolores Jones Cancer Institute at Virginia Mason Medical Center.


Wednesday, August 27, 2008

Get Last Used Row

Sub get_last_used_row()
' to get the last non-blank row

LastRow1 = Cells(Cells.Rows.Count, "A").End(xlUp).Row
'this is the keyboard equivalent of selecting a range using shift and down arrow
'   Exercise What does "A" signify??

LastRow2 = UsedRange.Rows.Count

MsgBox "LastRow1 " & LastRow1
MsgBox "LastRow2 " & LastRow2

End Sub

Exercise - What is the difference between LastRow1 and LastRow2. Though they might give same results occasionally, the approach to get the last row is different. Find it out!

Tuesday, August 26, 2008


Sub selcells()
' this sub shows how to get a cell value
cellval = Cells(1, "A")
MsgBox cellval
End Sub

Try writing a sub that copies value of A1 into B1 without use of an intermediate variable.

Monday, August 25, 2008

Msgbox Inputbox

Open excel
Do Alt F11
Paste -

Sub pgmhello()

MsgBox "Hello"
' accept name from user
name1 = InputBox("Name Please")

' concatenate hello and user name
MsgBox "Hello" & name1

End Sub

Click green triangular button or PF5

Try it!

Tuesday, May 27, 2008

PDF Converter, Split n Merge

I shy away from cumbersome WORD documents due to poor navigation between pages and delay in loading images and prefer to use PDFs. Google Documents is good but for files under size of mere 500 KB but beyond that it gives up.

I recently discovered an efficient and fast way of converting a file using services of Free PDF Converter. It is a 3 step process - Upload, Press Convert Button, Download. You have the option of uploading multiple files (maximum 5) in zipped format and you can also provide your email id to have the PDF emailed to you. A copy of the PDF is saved on the server which either you can delete immediately after downloading/ receiving the document or will be automatically deleted within 24 hours.

It helped me convert a 5 MB WORD document to a 2 MB PDF in less than 5 minutes. Pretty neat and quick!

PDFs too can be a hassle when it comes to split and merge. And for this exact purpose I dug up a software called PDF SAM. The basic version is free to download and is pretty sleek to use. It has a very simple user interface and a number of split options. Only the file order matters for merging. See the screen shots below.

Monday, May 05, 2008

Half Marathon

My take away from the big climb was information on marathon. My friend and I chose to enrol for 13 miles long half marathon scheduled for 29th June 2008. It provides the unprecedented opportunity to cross the 520 Bridge, the longest floating bridge in the world, on foot.

Am all excited and plan to train for the event. That reminds me that I need to buy new running shoes.

Volunteering while on Visa in US

Last week I decided to do some volunteer work for Seattle's Public Library. Since I'm on work visa, my friend advised me to check if I was legally authorized for volunteering.

I was flustered to know that volunteering could be illegal. But sources on www reveal that the law has been made to ensure Fair Labor Laws and I agree. Besides being unpaid, a job should fulfill several other criteria to be considered volunteer work.

A job can be considered volunteering if
  • it is really volunteer work i.e. nobody will expect any remuneration or compensation for the work.
  • is preferably for a non-charitable organization e.g. museum, church, public libraries.
  • the position has been unpaid in the past and continues to be so.
  • any American would perform the job without pay.
The information is relevant specifically to H1B and H4 Visa holders. Based on this, am ready to submit my application to SPL.

Sources on www that I read to reach conclusion -

Capitol Immigration Law Group LLC

Kevin Keane's advice

Information from Department of Labor

Murthy Law Firm Resource-1

Murthy Law Firm Resource-2

A word of caution from University of Washington

Off topic, stumbled on this interesting DOL's audit report [pdf] on Foreign Labor Programs and LCA procedures.

Friday, May 02, 2008

Harry Potter

Harry Potter - Level III

Monday, April 28, 2008

Why do stories have a happy ending?

Boy meets girl. They fall in love. They get married and live happily ever after. This is a simple example of a story with happy ending.

Why do most of the stories have a happy ending?

I got an optimistic answer on a TV show. The explanation goes like - "A story is not over until it culminates into a happy ending. This means that one should work thru difficult situations until the desired result is achieved."

I strongly feel that the goal should be determined before taking on the task to ensure that one is not settling for something less after beaten up by the hurdles on the way.

Sunday, March 16, 2008

The Big Climb

The annual Big Climb presents its participants a seemingly daunting task to climb 69 flights in 1311 steps and 788 feet in vertical elevation. The event takes place at Seattle's Columbia Center. All the proceeds from the event goes to fight leukemia.

My friend enthusiastically enrolled both of us for this fund raising event & gave me tips on how to pace myself and face the giant task. I knew that I had a Buckley's chance of making it to the top and hence I had prepared myself to content with 40-45 flights. Still, last night at dinner table I gave a highly optimistic climb time of 45 mins.

My friend and I started the climb at 8:47 am, resting every 10th floor. I was enthusiastic and hoping to make it to the top floor. My friend slowed down to keep me company and make sure that I was doing okay. The volunteers were boosting morale of the climbers with free water and free water showers :-)

At 9:15 am, we were at Observatory on the 73rd floor of the tallest building in Seattle. Woo Hoo!!! I climbed 69 floors.

The sense of achievement and self discovery along with satisfaction of working for a cause made the day special.

Saturday, March 01, 2008

One step at a time

I've a list of things that I want to do. Every day I'd think of making a better use of tomorrow. But after every retrospection, I'd be disappointed to see no progress.

Over the past two days, I tried to reason and realized that...

1) I never worked on any target in an organized way...I had no plans but only wishes.
2) I wanted things to change overnight.

I've figured out that the only solution is to take one step at a time, to be in the moment!

I've decided to follow the below plan to get things done.

1) Arrange/ Prioritize
2) Allocate time
3) Assign measurable targets
4) Accomplish

Wednesday, January 23, 2008

List of Files

List of files in a folder

On Windows OS, to get a list of names of files in a folder on my local drive, I can do -

Open a command prompt: run -> cmd
Navigate to the folder by giving the path in quotes:
cd "My Documents\myfolder"
Type command: dir > file_name.txt

This saves detailed summary of the files in the folder in text file called file_name. Details include -
Modified Date and Time,
Name of the file (with extension as .doc, .xls etc)
Total number of files in the folder

This command however, does not work on Network Drives.

EDIT - Thanks to Kirubakaran, I know a shortcut: Using "dir /b > file_name.txt", I can get just the list of file names.

List of files in an archive

A similar report can be generated to obtain list of files in an archive (.zip, .rar).

Open the archive -> ALT+G or (Go To TOOLS -> Generate Report)

I can set the parameters here to print only the File names and the Total Information. I prefer to save the information as .txt instead of HTML (uncheck the option - Use HTML format)

Saturday, January 05, 2008

Learning & Confidence

I often feel superior to my peers and then feel guilty of my boastfulness.
Everyone has different skills and they should be appreciated for that. But I realized what sets me apart from them - my urge to try and learn new things.

The embarrassment at the knowledge of ignorance is bliss. I work towards getting rid of my awkwardness, I learn. This knowledge leads to confidence.

With the umpteen resources available on world wide web, I feel there is no limit to learning.

Let's learn.

Wednesday, January 02, 2008

Summary 2007

2007 has been quite a fulfilling year.

Read -
Atlas Shrugged
Da Vinci Code
Deception Point
Angels and Demons

Learnt to -
Snowboard - Looking forward to this year's season
Drive - Licensed to Drive (only)
Use Auto Hot Keys - I use of couple of these at work since AHK can be used only on Windows OS.
Write Excel Macros - Ever so useful and quick.

Could not finish these books -
Four Hour Work Week
Stumbling on Happiness

Initiated into -
Linux/ Ubuntu - My laptop had a viral death within a month of purchase. I then switched to Ubuntu. My geeky friend installed it on my m/c. It is a fun learning experience.
Blogging - It is just my journal
Roller Skating - It was fun but I was scared of falling :-( - It is an easy way to track the useful articles I keep reading as well as a way to find popular information quickly on any subject.
Google Docs - More fun then attaching the docs. Moreover, you can make changes simultaneously and all these changes are updated real time.
Baking - mmm! Apple Spice Cake, Dark Chocolate Cake, Banana Loaf, Humming Bird Cake, Blueberry Scone, Chocolate Chip Cookies, Peanut Butter Cookies

Still Learning -
Linux Terminal Commands

Watched some of the finest movies (marked with *). This is the longest list of the movies I've ever maintained. Advantages of blogging :-)
Ant Bully, The
Beautiful Mind*
Bee Movie*
Before Sunrise*
Being John Malcovich
Bottle Rocket
Chicken Run*
Christmas Story, the*
Da Vinci Code
Dead Poet's Society*
Departed, The
Eternal Sunshine of Spotless Mind*
Evan Almighty
Flushed Away
Forrest Gump*
Garden State
George of the Jungle
Grind House (Planet Terror, Death Proof)
Happy Feet*
Hot Fuzz*
I am Legend
Ice Age*
Illusionist, The*
Kill Bill 1*
Kill Bill 2*
Lake House
Little Manhattan
Little Miss Sunshine*
Lock, Stock and Two Smoking Barrels*
March of the Penguins, The
Minus Man, The
Mona Lisa Smile*
My cousin Vinnie*
Namesake, The
No Reservations
Oceans 13
Over the Hedge*
Pan's Labyrinth
Prestige, The*
Pursuit of Happiness, The*
Score, The
See Jane Date
Shrek 3
Sixth Sense, The*
Small Soldiers*
Surfs Up
Sweet Home Alabama
Thank You For Smoking
Toy Story
Vanilla Sky
Wallace and Grommit - The curse of Were Rabbit*
Wild Hogs
Zindagi Rocks