Saturday, December 19, 2009

Call a js function using a string variable having the function name

Hope the following coding snippet helps to know how :

<script>
testFCall();
function testFCall()
{
setTimeout('testCall(109)',0);
}

function testCall(val)
{
alert('val : '+val);
}
<script>




Friday, October 2, 2009

Run os commands from java + print error messages

private void runProcess() throws Exception
{
try
{
Runtime rt = Runtime.getRuntime();
Process process = rt.exec("cmd /c cp C:\\work\\dev\\test.txt C:\\work\\dev\\test1.txt");
BufferedReader input = new BufferedReader(new InputStreamReader(process.getInputStream()));

String line = null;

while ((line = input.readLine()) != null)
{
System.out.println(line);
}

int exitVal = process.waitFor();
if (exitVal != 0)
{
input = new BufferedReader(new InputStreamReader(process.getErrorStream()));
line = null;

while ((line = input.readLine()) != null)
{
System.out.println(line);
}
}
}
catch (Exception e)
{
System.out.println(e.toString());
e.printStackTrace();
}
}

Tuesday, June 23, 2009

cvs command to see the status in a single line

We can use the command - 'cvs status'. But it is too verbose. You may not need all those details all the time.
To see the status in a single line do - cvs -q -n update
Courtesy :
http://stackoverflow.com/questions/211819/is-there-a-way-to-get-a-short-cvs-status-from-command-line


Friday, June 19, 2009

Nebeans debugger msg : delete method not implemented

When I apply code changes using netbeans debugger, i get this message :
The virtual machine does not support this operation: delete method not implemented
and I am not able to apply my code changes.

The problem was :
I had another file where i had added a method and had not compiled. so not able to apply code changes. (debugger does not allow adding new methods. If you add or remove a method [or any other type of class member] you have to compile the code before using debugger).

Monday, June 15, 2009

Form submit in FireFox and IE

I am using FireFox 3 and IE 7 for my development.

For form submit, FF uses post as the default method. IE sends params as post only if specified in the <form> tag.


Sunday, April 26, 2009

Installing Ubuntu

I got an Ubuntu DVD sent to me right from Ubuntu.

Since I had a half forgetten 'experience' of installing linux in the past, I assumed I should be 'very careful' while installing linux since I thought I should not make wrong choices.

So started 'planning' before installing. I studied from internet regarding
1. the partitions that I need to make
2. size and filesystems for partitions etc.

All my preparations went waste I should say.

Installing ubuntu was incredibly easier. All you have to do is just to make your system boot with the Ubuntu CD. Thats it. Ubuntu takes care of the installation. All you have to do is just watch the screen for a few mins and give your (very few) decisions then and there. It was easier than installing Ms Windows. Writing this post with Ubuntu - firefox.

Thank you Ubuntu Teams.

Will write more on my experience with Ubuntu - the 'linux for human beings'.