Friday, August 21, 2009

Learning GWT

I need to understand an application for which I need to know about GWT, Ajax. I will start reading about this from today.

Monday, August 17, 2009

get IP address in C under Linux

Today my work was to write a C code that gives the IP address of the system. For 2 hours, I searched on the internet to find if they are any predefined functions to do this. I didnot find anything useful. Then my friend Srikanth Parupati helped me solve my problem. He taught me to run shell commands from a C program. 'ifconfig' can be used at shell to get the info of the system and 'grep','cut' commands can be used on the ifconfig output to extract the IP address. If we want a C program to give out the IP, simply call this command from C using 'system'
Thanks Srikanth.

Friday, August 14, 2009

Started learning Linux

I started learning to operate a linux machine. I learnt many new things in the last few days.
I am very excited to work on a linux environment. I learnt about ssh,WinSCP and many linux commands. Also, the system I work on has no GUI. So, everything need to be accessed from the shell. I was surprised to know that we can download files from the internet through the shell.

Tuesday, August 11, 2009

Tourist: Whose skeleton is that?
Guide: An old king's skeleton.
Tourist: Who's that smaller skeleton next to it?
Guide: That was same king's skeleton when he was a child.

Calling batch file within another batch file

Say we want to call bat1.bat within bat2.bat. We can just call bat1 within bat2.
But the problem is that the control doesnot comeback once it calls bat2. The statements after bat2 within bat1 are not run at cmd. To overcome this we need to use the "call" command while calling bat2.

Friday, August 7, 2009

C functions - Windows Vs Linux

On a Windows machine,
we use,
"itoa(str,num,radix)", for converting an integer "num" to a string "str".
"atoi(str)", for converting a string "str" to integer.

But on a linux machine, these functions donot work when we use "gcc" for compilation. The equivalent functions are,
itoa --> sprintf(str,"%d",num);
Here, the second argument should be the format specifier of the number to be converted.

atoi --> sscanf(str,"%d",$num);
Here the second argument is the format specifier of the number to be converted into and
the third argument should be the address of the number variable.

C basics in Linux

I am learning the very basics of C programming in Linux. I will post some of them.

Compiling a C program,
"gcc -o try try.c"

Here, try.c is the actual C program. -o options is used for renaming the the executable file. If you dont use -o option, then by default a.out will be the name of the executable.

Running a C program,
"./try"

Thursday, August 6, 2009

Happy to meet my school friends

Today my school friends contacted me through orkut. I was very happy to see them and more happy that they still remember me. I normally have very few friends but these days I am meeting more and more people.

Tuesday, August 4, 2009

Interesting problem I encountered with JNI

I was trying to call C functions from java. Initially, I was sucessful in calling C function through java program. I thought everything was working well. But the problem is with the java code after calling the C function. I will present the summary of the problem

class testingC{
psvm(String args[]){
//declaration of native method and loading the library
testingC tc=new testingC();
//calling C function
tc.testingcores();
System.out.println("back to java program");
//creating file object
File f=new File("chandana.txt");
System.out.println("file created is:"+f);
}
}


When I run this program, I get the output
back to java program

when I don't call the C function, i.e I comment out tc.testingcores(),I get the output

back to java program
file created is chandana.txt.

I was very surprized to observe this. Why is the java code after calling the C function not working properly? The reason might be very simple. I don't know. I am trying to find out.

Sunday, August 2, 2009

My phone not working

My phone stopped working. I don't know the reason. Have to contact AT&T people regarding that.