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 openCobol.org


Sample Hello World COBOL program
IDENTIFICATION DIVISION.
PROGRAM-ID. HELLOW.
ENVIRONMENT DIVISION.
DATA DIVISION.
PROCEDURE DIVISION.
DISPLAY "HELLO WORLD".
STOP RUN.

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

#define __USE_STRING_INLINES 1
#include
#include
#include
#include
#include

#define COB_SOURCE_FILE "HELLOW.cob"
#define COB_PACKAGE_VERSION "0.33"
#define COB_PATCH_LEVEL 0

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

int HELLOW (void);

/* functions */
int
HELLOW ()
{
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;
}

module.next = cob_current_module;
cob_current_module = &module;

if (unlikely(initialized == 0))
{
if (!cob_initialized) {
cob_fatal_error (COB_FERROR_INITIALIZED);
}
cob_check_version (COB_SOURCE_FILE, COB_PACKAGE_VERSION, COB_PATCH_LEVEL);
if (module.next)
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;

/* PROCEDURE DIVISION */

/* HELLOW: */
l_2:;
/* 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
#include
main()
{
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 https://developer.mozilla.org/en/Building_an_Extension.
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 - http://www.borngeek.com/firefox/toolbar-tutorial/

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 uninstall.sh as sudo. Choose theme and icon theme. And you are back to xubuntu regular.

Saturday, November 22, 2008

Angel

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.


Mine


Original

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