Sunday, June 24, 2007

Skipping through alert boxes-the hard way

have you faced the problem of having to skip through a zillion alert boxes or information boxes? These are message boxes that provide information. They are closed when you press the "Ok" button. The option to close all or ok all is not available. The option such as yes to all or no to all is available only for copy-paste operations.

The fact that you have to go through a large number of alert boxes is a clear indication of the poor quality of code or the complexity of the application. Anyway, the next time you have to skip through these zillion alert boxes just follow the method shown in the video shown below.



This is the hard way of doing this. A better method would be to close the application from the task manager and modifying the code.

Beware:if the return key is kept pressed even after the alert boxes are skipped it can cause unwanted operations to occur in some cases.

Wednesday, June 20, 2007

Rediffmail greasemonkey version 0.1

To use this greasymonkey script, u need to have installed the greasemonkey on your firefox browser. The script is for the new rediffmail which has the largest inbox in the world. It is the preliminary version and has just two features-
  1. Removes the banner ads from the free versions inbox.
  2. Provides google talk on rediffmail homepage and inbox.
The following screen shot shows the inbox without the right side banner ads. The Google talk is on the left side bar. To be able to use google talk you need to be logged into gmail. rediffmail greasemonkey
The main page of the rediffmail has been modified to remove the sponsored links and the advertisement at the left top corner has been replaced by gtalk.
rediff gtalk greasemonkey

To install the grease monkey just click on Nagarjunvs rediffmail version 0.1 in firefox and a dialog box will appaer which can be followed to install the greasy monkey.

Tuesday, June 19, 2007

Eclipse Monkey-get ur program written by a monkey

Eclipse is a highly extensible IDE(Integrated Development Environment) and much much more. The eclipse monkey from project dash is a great addition to eclipse. To put it in a single sentence the eclipse monkey is the eclipse equivalent of greasemonkey. Eclipse monkey provides javascript extensions for "eclipse", which is best suited for small additions.

A example of what eclipse monkey can do is the "comment" script- it simply adds "//"in front of the selected lines of code. The repetitive tasks that may be specific to a project can be done by these monkeys.

Some features that are needed by eclipse monkey are-
  1. A script manager-Now "Scripts are installed in the Monkey menu by placing them in "*.em" files in a top-level "monkey" folder of any project (obviously, scripts are un-installed by renaming or moving them). The complete set of scripts is the union of the scripts in all the top-level monkey folders in the workspace."However, it would be better to have a script manager that lists the various scripts that are present. The projects for which the scripts are needed are to be included or excluded using the script manager.
  2. Undo script action--even for scripts run during past sessions.
  3. Running multiple scripts in combination-a sort of piping.For example-a script to find all lines with "system.out.println" should pipe its output to the script that will comment these lines. Separate monkeys should work together without the need for writing new scripts.
Enough of feature requests. It would be better if we wrote monkeys to get all these features.

Saturday, June 16, 2007

Forn loop- executing the for loop n times

The for loop is a useful control statement.But if you want to execute the for loop "n" number of times, just nesting it will work fine. The following java program will do that job well.


classforn {public static void main(String args[]){int i,j,n=Integer.parseInt(args[0]);
for(i=0;i<n;i++)
{ for(j=0;j<5;j++){
System.out.println(j); }

}

}
}

The output for

C:\javaprogs>java forn 3
would be
0
1
2
3
4
0
1
2
3
4
0
1
2
3
4
The problem arises when the for loop has to be executed different number of times during the "n" executions.Hope that makes sense. The number of times the for loop has to be executed has to be stored in a array of size n. So the modified program to execute the for loop as per the value stored in the array would be-


classforn {public static void main(String args[]){int i,j,n=Integer.parseInt(args[0]);
for(i=0;i<n;i++){
for(j=0;j<(Integer.parseInt(args[i+1]));j++){

System.out.println(j); }

}

}
}

The output for

C:\javaprogs>java forn 3 2 4 3
would be
0
1
0
1
2
3
0
1
2

The point is "Do we need a forn loop" or can this be done better using a "while" or "until". The extra overhead in storing the array and checking individual conditions can be avoided. If anybody has program that cant be solved using the while or until and requires a forn loop pls let me know.

Thursday, June 14, 2007

Mozilla search plugin for Coop Search

Making search plugin's for firefox are easy one page deals. Just follow the instructions at Mycroft and a search plugin can be made available for download.The screen shot shows the plugin for coop search.

coop search plugin
I tested it and it works fine.For the sake of record the final XML file was as given below --

<SearchPlugin xmlns="http://www.mozilla.org/2006/browser/search/" xmlns:os="http://a9.com/-/spec/opensearch/1.1/">
<os:ShortName>Coop Search</os:ShortName>
<os:Description>Coop Search - Searching custom search engines</os:Description>
<os:InputEncoding>ISO-8859-1</os:InputEncoding>
<os:Image width="16" height="16">data:image/x-icon;base64,/9j/4AAQSkZJRgABAQEAYABgAAD/2wBDAAgGBgcGBQgHBwcJCQgKDBQNDAsLDBkSEw8UHRofHh0aHBwgJC4nICIsIxwcKDcpLDAxNDQ0Hyc5PTgyPC4zNDL/2wBDAQkJCQwLDBgNDRgyIRwhMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjL/wAARCAAQABADASIAAhEBAxEB/8QAHwAAAQUBAQEBAQEAAAAAAAAAAAECAwQFBgcICQoL/8QAtRAAAgEDAwIEAwUFBAQAAAF9AQIDAAQRBRIhMUEGE1FhByJxFDKBkaEII0KxwRVS0fAkM2JyggkKFhcYGRolJicoKSo0NTY3ODk6Q0RFRkdISUpTVFVWV1hZWmNkZWZnaGlqc3R1dnd4eXqDhIWGh4iJipKTlJWWl5iZmqKjpKWmp6ipqrKztLW2t7i5usLDxMXGx8jJytLT1NXW19jZ2uHi4+Tl5ufo6erx8vP09fb3+Pn6/8QAHwEAAwEBAQEBAQEBAQAAAAAAAAECAwQFBgcICQoL/8QAtREAAgECBAQDBAcFBAQAAQJ3AAECAxEEBSExBhJBUQdhcRMiMoEIFEKRobHBCSMzUvAVYnLRChYkNOEl8RcYGRomJygpKjU2Nzg5OkNERUZHSElKU1RVVldYWVpjZGVmZ2hpanN0dXZ3eHl6goOEhYaHiImKkpOUlZaXmJmaoqOkpaanqKmqsrO0tba3uLm6wsPExcbHyMnK0tPU1dbX2Nna4uPk5ebn6Onq8vP09fb3+Pn6/9oADAMBAAIRAxEAPwDy/WP+Eu/tzUPs39t/Z/tMnleX5u3buOMY4xjpis6H+0v7QsvL+1/ZdsGdu7ZjaufbHWoPKuf7U2fY1+z+dj/j2XG3d649O9dk2saBo1/pUd4EMMVnYy3FonhyzmEoaCJ3HnOwclskliMgseuKwzDDywajFK7fMvha+G3a/fTY68BL6n96293bvvdO5//Z</os:Image>
<UpdateInterval>7</UpdateInterval>
<UpdateUrl>http://mycroft.mozdev.org/update.php/id0/coopsearch.src</UpdateUrl>
<IconUpdateUrl>http://mycroft.mozdev.org/update.php/id0/coopsearch.jpeg</IconUpdateUrl>
<SearchForm>http://www.google.com/coop/cse?cx=006220872262304550041%3Ahpoa4qugio0</SearchForm>
<os:Url type="text/html" method="GET" template="http://www.google.com/cse?sourceid=Mozilla-search&amp;cx=006220872262304550041%3Ahpoa4qugio0&q={searchTerms}">
</os:Url>
</SearchPlugin>

Enzymeware-for calculating Vmax and Km

As i am putting up a record of all stuff, i decided to put in a post or two about the downloads on my yahoo pages.Enzymeware was made in the 4th sem holidays, if i remember correctly. You can see what it does by downloading enzymeware.

It is a collection of 3 graphical methods namely, Michaelis Menten plot, Line weaver plot and Cornish Bowden method. Error messages are displayed in case wrong values are entered for optical density or substrate concentration.
It is also a relic from the days of visual basic 6.0. In all probability it will be useful only if more graphical support is added to it. Some more parameters can also be added to it.