Thursday, December 11, 2003

J2SE: J2SE 1.5 Early Access on Dec15th?

Rick Ross mentioned J2SE 1.5 Early Access may be available by Dec 15th (Atmost by 22nd) on JavaLobby news posts here.

Here is the snippet of the news post:

On a completely separate note, we have been receiving a good deal of email lately asking for details on the upcoming early access release of the preliminary J2SE 1.5 binaries. I spoke today with the product line manager at Sun directly responsible for this, and she confirmed that they are pushing as hard as they can to get the release out the door for Javalobby members. The latest word is that the target date is December 15, but that in no case will it be later than December 22 when Sun begins its holiday break. The purpose of this early access release is for Javalobby members to help provide valuable testing and uncover and remaining bugs in the J2SE 1.5 code, so please keep in mind that this is PRE-RELEASE code and that you cannot expect it to be perfect. I'm excited that Sun is making this opportunity available exclusively to Javalobby members, so I hope you'll make the most of it and help improve Java in the process.

Note to Rick: Javalobby news emails are ending up in bulk folder for Yahoo users. You might want to do something about it. I read the news 2 days late while checking out bulk folder.

Wednesday, December 10, 2003

Java Desktop System is here

Java Desktop System is available for purchase at SUN's site. for $50. Check out the cool Looking Glass Demo by Jonathan Schwartz.

Star Office PC

Also SUN made Solaris x86 Free. Download it here.

Friday, December 05, 2003

Location Services Based Blog. First post with my Motorola i88s.

Current Location is:

This is blog entry is powered by Autodesk Location Services.

Thursday, December 04, 2003

This is my first post using Blogger API.
Currently there are several serious limitations to use the API.
1. Auto Publish not working though publish is set to true.
2. No mechanism to set title for a Post.
Later tonight plannning on writing my own version of J2ME API for Blogger.

SUN: No to Eclipse

This week sun dropped out of Eclipse negotiation and decided not to merge NetBeans community with Eclipse. I think this is a smart decision. Everyone who criticize SUN got to remember that its IBM that started the 'second' community instead of joining NetBeans. The very name of Eclipse suggests the purpose of its existance.
Though I am a everyday user of Eclipse, extended roadmap for NetBeans4.0 sounds promising. Finally Refactoring will be built into NetBeans.

NetBeans Refactoring

Wednesday, November 19, 2003

SUN: PC+ Monitor + Color Printer Under $300

After huge China deal, SUN seems to be on roll. AOL started started selling PC (With Monitor, Color Printer, Star Office rebranded as AOL Office) for $299.
This could be huge. The only gotcha is that you have to commit to use AOL for a year($23.90 per Month). If this offer becomes successful you find more and more home users using Star Office. I am sure J2SE1.4 is preinstalled on these machines (Though not mentioned anywhere).
Find the offer from AOL here:
Star Office PC
An interview with Java Desktop System team is published at OS News.

Wednesday, November 12, 2003

J2ME: MIDP2.0 phone from Motorola

Motorola i730 is available in us markets. Key features:
J2ME Support : MIDP 2.0 (JSR 118),Mobile Media(JSR 135), WMA (JSR 120)
OEM Support: Motorola LWT, Look And Feel, Polyphonic MIDI, WAV, AU, Vibrator, Lighting, Motion JPEG, Still image capture, Location API, Phonebook, Datebook, External display, Call Receive and Initiation, Recent calls, File I/O, Serial port, Crypto, Digital Camer, Java Menu MIDlet icon, RF enabling, Alpha blending, Secure file connection, Voicenote, 3D
Heap Size: 1.15 MB
Midlet Storage: >2MB (installed MIDlet space), >2MB (file storage), Recommended Maximum jar file size is 500KB. Now serious business applications and Games are possible on i730.
Max Sockets: TCP: 16,HTTP: 8,UDP: 24 (21 according to developer guide and 24 according to Device specs).
65K Color Display: Vibrant display with enhanced clarity allows you to customize your screen with downloadable wallpapers, adjustable color palettes, and choice of three font sizes.
Concurrency: Supports execution of upto 3 MIDlets at the same time. (Ofcourse only one MIDlet can be in foreground).

Another cool innovative feature is Airplane Mode where you can turn off network connection and use programs, games, voice record, and datebook. Phone will display “Airplane Mode” while in use and display “Service Restricted Airplane Mode On”. The nice thing about i88S and i730 from Motorola is that you can query your location from your phone(using J2ME) without paying a single cent.

Compared to this my Motorola i88s looks so dumb and ugly. I wish I can exchange my phone :-)
i730 Handset

Wednesday, October 29, 2003

M$: Another entry to hall of shame

Image is self explanatory:

Saturday, October 04, 2003

Directories are Java source file package names

After reading this blog by Gregg Wonderly and some of the comments posted at the blog I decided to write this blog entry.
For a long time I used to think directories are not Java source file package names because Chapter 7 of Java language specification said so. Also many a times(For any product that you work on for long time) maintaining directories as Java source file package names is a pain. Imagine you are developing a product called javamagic. You are working for a oraganization which has several suborganizations and with several products for each sub organization. If your java source files must be in a directory tree mirroring the package name, your source directory would typically look something like this:

Having this structure is pain and sounds dumb because you know com/javaswamy/jone/javamagic is always constant and there is absolutely no need to maintian this filesystem hierarchy as you know what you are working on. If possible a simple hierarchy like this would be what everyone likes to have:

This is easy to navigate and presents developer view of the code.

Now lets get back to reality. Though Java Language Specification doesn't impose the restiction of Directories are Java source file package names, JavaDoc does. JavaDoc tool faq states "If your classes do not all belong to the unnamed package, you must put them in directories named after the packages.". So if you need to generate javadocs for your project and use JavaDoc tool to generate the documentation, Directories are Java source file package names.

Like many other java programmers, I would love to see JavaDoc team solve these problems that exist since JDK1.1 days:
1. Directories are Java source file package names.
2. Deprecation warning is suppressed if the compilation unit containing the deprecation is being compiled at the same time as the compilation unit using the deprecated class or member.

Wednesday, October 01, 2003

Office: 1.1 released announced first major update to OpenOffice. 1.1 is now final and English version is available for download on Windows, Solaris and Linux. I have been using 1.0.x versions and 1.1 RC's for a while. With every update OpenOffice is getting better and better and better compatability with M$ Office. OpenOffice is now the only office suite on my home machine.
The two new major features for me in 1.1 update are export to PDF format from Writer and export to Macromedia Flash format (.swf) from Impress. Support for export to PDF got better with every update.
Checkout my blog archive for the month 2003_09 exported to PDF from Writer:Kumar Mettu's Blog.pdf. The only data lost from saved html file is Hyperlinks.
Here is a simple presentation exported to Macromedia Flash format (.swf):

Check out XML Essentials book online.

Tuesday, September 30, 2003

J2ME: Get Weather Forecasts Free

Weather on Demand is one of the most common applications of SMS. Few of weather service examples are:

1. Weather alerts from Verizon .
2. Weather Network and TELUS Mobility's On Demand Weather service and
3.'s Radar on Mobile Phones.
With a simple MIDlet you can get Weather forcasts free on your phone. US government provides free weather forecasts here. Note that the weather forecasts are not as high quality as commercial services. The simple MIDlet here displays weather at SF(modify the URL to point to your city):

001 import;
002 import;
004 import;
005 import;
006 import javax.microedition.lcdui.Command;
007 import javax.microedition.lcdui.CommandListener;
008 import javax.microedition.lcdui.Display;
009 import javax.microedition.lcdui.Displayable;
010 import javax.microedition.lcdui.Form;
011 import javax.microedition.midlet.MIDlet;
014 /**
015  * MIDlet to display weather forecast for SF.
016  *
017  @author Kumar Mettu
018  @version 1.0
019  *
020  */
021 public class Weather extends MIDlet implements CommandListener {
023     private Display display;
024     //Exit command.
025     private Command  exitCommand = new Command"Exit", Command.SCREEN, );
026     //SF Weather URL.
027     private static final String SF_URL =
028         "";
030     /**
031      * Weather MIDlet constructor.
032      */
033     public Weather() {
034        display = Display.getDisplay(this);
035     }
037     /**
038      * This will be invoked when we start the MIDlet.
039      * Display the downloaded data. If an error occurs while downloading
040      * the data display the error to user.
041      *
042      */
043     public void startApp() {
044         try {
045             getViaStreamConnection();
046         catch (IOException e) {
047             Form forecast = new Form("Error Downloading");
048             forecast.append(e.getMessage());
049             forecast.addCommandexitCommand );
050             forecast.setCommandListenerthis );
051             display.setCurrent(forecast);       
052        }
053     }
055     /**
056      * Pause, discontinue ....
057      */
058     public void pauseApp() {
060     }
062     /**
063      * Destroy. Cleanup everything.
064      */
065     public void destroyApp(boolean unconditional) {
066     }
068     /**
069      * Download the weather and display it.
070      *
071      @throws IOException when IO Error occurs while downloading
072      *  data from URL.
073      */
074     private void getViaStreamConnection() throws IOException {
075         StreamConnection sc = null;
076         InputStream in = null;
077         StringBuffer b = new StringBuffer();
079         try {
080           sc = (StreamConnection);
081           in = sc.openInputStream();
082           int ch;
083           while ((ch = != -1) {
084              b.append((charch);
085           }
087         finally {
088            if (in != null) {
089               in.close();
090            }
091            if (sc != null) {
092               sc.close();
093            }
094         }
096         Form forecast = new Form("Weather at SF");
097         forecast.append(b.toString());
098         forecast.addCommandexitCommand );
099         forecast.setCommandListenerthis );
100         display.setCurrent(forecast);
101     }
103     /**
104      * Indicates that a command event has occurred on Displayable d.
105      @param c - a Command object identifying the command.
106      @param d - the Displayable on which this event has occurred.
107      */
108     public void commandActionCommand c, Displayable d ){
109         if (c == exitCommand){
110             exit();
111         }
112     }
114   /**
115    * Distroy app when exit button is used.
116    */
117     private void exit(){
118         destroyApp(true);
119         notifyDestroyed();
120     }    
122 }

You can download Weather.jar and Weather.jad directly. Tested on my i88s. Here is the screen snapshot of Motorola i88s simulator:

This can be further extended to support features like:
1. Select the city where you want weather forcast(using kxml)
2. If your phone supports GPS( like my Motorola i88s), you can display weather forecasts for your current location.

Monday, September 29, 2003

M$: MSBuild - M$ version of ANT

Microsoft is coming up with a build tool(MSBuild). MSBuild is the next generation build engine and platform for Visual Studio .NET. Microsoft has a session about the new build system during Microsoft Professional Developers Conference 2003.
From introduction it looks like it will ship with the .NET redistributable and not Visual Studio. Also it appears that MSBuild will be an XML based Ant like tool with XML files to drive the build. Of course a similar build tool exist as Nant.
This is yet another block that has been missing in .NET (compared to J2EE) that Microsoft decided to fill.

Saturday, September 20, 2003

J2SE: Taking screen snapshots in JAVA

As programmers many a times we need take snap shots of our screens. If we can take snap shot in java why use OS specific way to take a snap shot?
Here is a simple code example of taking snapshot in java (Either PNG format or JPEG format):

01 import java.awt.AWTException;
02 import java.awt.Dimension;
03 import java.awt.Rectangle;
04 import java.awt.Robot;
05 import java.awt.Toolkit;
06 import java.awt.image.RenderedImage;
07 import;
08 import;
09 import javax.imageio.ImageIO;
11 /**
12  * A Simple program that saves current screen snapshot.
13  * Supported formats png and jpg.
14  * Usage java ScreenSnapShot <<outputfilename>>
15  *
16  @author Kumar Mettu
17  @version 0.61
18  */
19 public class ScreenSnapShot {
21     public static void main(String[] argsthrows IOException,AWTException {
23         String saveFileName = "default.png";
24         String saveFileFormat = "png";
26         if (args.length > 0)
27             saveFileName = args[0];
29         if (saveFileName.toLowerCase().endsWith(".png")) {
30             saveFileFormat = "png";
31         else if (saveFileName.toLowerCase().endsWith(".jpg"||
32                    saveFileName.toLowerCase().endsWith(".jpeg")) {
33             saveFileFormat = "jpg";
34         else {
35             System.err.println("Only png and jpg formats are supported.");
36             System.exit(1);
37         }
39         // get current sceen size for snapshot.
40         Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
41         Rectangle screenRect = new Rectangle(screenSize);
43         // create current screen snapshot
44         RenderedImage image = (new Robot()).createScreenCapture(screenRect);
46         if (ImageIO.write(image, saveFileFormat, new File(saveFileName))) {
47             System.out.println("Screen snap shot is saved as :" + saveFileName);
48         else {
49             System.out.println("Unable to save snap shot");
50         }
51     }
52 }

This code requires J2SE1.4. There is no real use of this code unless you extend it to make use of it(like taking snapshots at fixed intervals etc...).

Friday, September 19, 2003

General: China to help Europe develop GPS rival

New Scientist reports China has joined a European effort to develop a new global satellite navigation system that would offer a more accurate civilian alternative to the Global Positioning System. The Galileo system will be precise to within a meter, while the civilian GPS service is accurate to around 10 meters. This development adds to the consternation of the U.S. military, which controls the GPS and currently enjoys the option of downgrading the civilian service during military conflicts.

Sunday, September 14, 2003

Microsoft links with Motorola to launch mobile phone

Telegraph | Money | Microsoft links with Motorola to launch mobile phone: "Microsoft's bid to dominate the market for mobile phone operating systems will receive a boost today when the US software giant launches its first phone with a major handset maker."

Untold story:In a related product launch Steve Ballmer, Chief Executive Officer Microsoft Corp announced general availability of the Blue Screen of Death sized down for use in Motorola handset

Friday, September 12, 2003

J2SE: A nice tool to learn API differences

JDiff is a Javadoc doclet which generates an HTML report of all the packages, classes, constructors, methods, and fields which have been removed, added or changed in any way, including their documentation, when two APIs are compared. This is very useful for describing exactly what has changed between two releases of a product. Only the API (Application Programming Interface) of each version is compared. It does not compare what the source code does when executed.

Sample Reports:
Comparing J2SE1.4.0 and J2SE1.4.1
Comparing J2SE1.3.1 and J2SE1.4

Tuesday, September 09, 2003

J2ME: Turning your phone into web Server.

I wrote a simple midlet which turns my Phone into simple web server. To keep the code simple, I removed the additional GPS capabilities. Currently the web server listens to port 8000 and repsonds "Hello, I am Kumar Mettu's Phone. Thanks for Visiting" for all requests that are sent to this tiny web server. Note that this code is tested only on Motorola i88s with Nextel Total Connect Service.

Here is the code for the tiny web server:

001 import;
002 import;
003 import;
005 import;
006 import;
007 import;
008 import javax.microedition.lcdui.Display;
009 import javax.microedition.midlet.MIDlet;
011 /**
012  * MIDlet working as simple personal WebServer.
013  * Currently this serves simple HTTP GET operation.
014  *
015  @author Kumar Mettu
016  @version 0.61
017  */
019 public class WebServer extends MIDlet {
021     private Display display;
023     StreamConnectionNotifier scn = null;
025     /**
026      * Default constructor.
027      */
028     public WebServer() {
029        display = Display.getDisplay(this);
030     }
032     /**
033      * This will be invoked when we start the MIDlet
034      */
035     public void startApp() {
036         try {
037             scn =(StreamConnectionNotifier)"serversocket://:8000");
038             while (true) {
039                 StreamConnection sc = (StreamConnection)scn.acceptAndOpen();
041                 // service the connection in a separate thread
042                 Connection c = new Connection(sc);
043                 c.start();
044             }
047         catch (IOException e) {
048             //Handle Exceptions any other way you like.
049             //No-op
050         }
051     }
053     /**
054      * Pause, discontinue ....
055      */
056     public void pauseApp() {
057         try {
058             if (scn != null)
059                 scn.close();
060         catch(Exception e) {
061         }
063     }
065     /**
066      * Destroy. Cleanup everything.
067      */
068     public void destroyApp(boolean unconditional) {
069         try {
070             if (scn != null)
071                 scn.close();
072         catch(Exception e) {
073         }
074     }
076     /**
077      * Thread to handle client request.
078      */
079     class Connection extends Thread
080     {
082         public Connection(StreamConnection c) {
083             client = c;
084         }
086         /**
087          * Handles client request.
088          */
089         public void run() {
090             InputStream s = null;
091             PrintStream out = null;
092             StringBuffer b = new StringBuffer();
093             try {
095                 s = client.openInputStream();
097                  //Ignore reading request to reduce the amount of data
098                  //transfered to Phone.
099                 /*int ch;
100                 while((ch = != -1) {
101                     b.append((char) ch);
102                 }
103                 System.out.println(b.toString());*/
105                 out = new PrintStream(client.openOutputStream());
106                 String response =
107                              "&lt;HTML&gt;"+
108                              "&lt;HEAD&gt;"+
109                                 "&lt;TITLE>Kumar's Location&lt;/TITLE&gt;"+
110                              "&lt;/HEAD&gt;"+
111                              "&lt;BODY&gt;Hello, I am Kumar Mettu's Phone. "+
112                                      "Thanks for Visiting.&lt;/BODY&gt;"+
113                              "&lt;/HTML&gt;";
114                 out.println("HTTP/1.0 200 OK\n");
115                 out.println(response);
117             }
118             catch (Throwable ioe) {
119                 //Handle Exceptions any other way you like.
120                 //No-op
121             }
122             finally {
123                 try {
124                     if (s != null)
125                         s.close();
126                     if (out != null)
127                         out.close();
128                     if (client != null)
129                         client.close();
130                 }
131                 catch (IOException ioee) {
132           //Handle Exceptions any other way you like.
133           //No-op
134                 }
135             }
136         }
138         private StreamConnection client;
139     }
141 }

I know there is no business value for this web server. But hey turning phone into a web server and viewing it serve web pages to browser is fun :-)

J2ME: My new J2ME-GPS phone

Since my old phone is more than 2 years old, I bought a new Motorola i88s phone which has J2ME and GPS support.
I added some cool J2ME applications which will probably be blogging about in coming days.

Monday, September 08, 2003

Molecular Expressions: Science, Optics and You - Powers Of 10: Interactive Java Tutorial

Molecular Expressions: Science, Optics and You - Powers Of 10: Interactive Java Tutorial: "View the Milky Way at 10 million light years from the Earth. Then move through space towards the Earth in successive orders of magnitude until you reach a tall oak tree just outside the buildings of the National High Magnetic Field Laboratory in Tallahassee, Florida. After that, begin to move from the actual size of a leaf into a microscopic world that reveals leaf cell walls, the cell nucleus, chromatin, DNA and finally, into the subatomic universe of electrons and protons."

Thursday, September 04, 2003

StarOffice makes strong inroads in India

StarOffice makes strong inroads in India: "'In a scenario where enterprises are looking to bring down costs and increase productivity, StarOffice has emerged to be a viable option. In the last few months, StarOffice has gained substantial penetration into the Indian markets across segments like corporations, home users and government,' says K P Unnikrishnan, country head, marketing, Sun Microsystems India."

Wednesday, September 03, 2003

Send your prayer to GOD using SMS

Indians can send an SMS PUJA (prayer) to BPL and have the prayers recited for them at a popular Bombay temple, during the annual Ganesh Chaturthi festival. For just 51 rupees or $1.10, subscribers can avoid the hassle and aggravation of temple queues and text Ganesh instead.

Tuesday, September 02, 2003

Yahoo! News - Sun Mulls Joining Java Eclipse Effort

Yahoo! News - Sun Mulls Joining Java Eclipse Effort: "'Sun believes that Eclipse will hit a wall in terms of performance and compatibility because of distinctions between its NetBeans ... approach and Eclipse's ... approach, but at the moment, Eclipse is the clear leader,' said Stephen O'Grady, an analyst with RedMonk LLC, a market research company based in Bath, Maine."

Monday, September 01, 2003

Dear Mr Fleury stop spamming us

Unfortunately JBossGroup thinks none of the rules that applies to every enterpise applies to them. Its a minimum courtesy to have a link to "remove me" in news letters and marketing junk. Here is the latest mail sent by Marc F to what ever list he maintains:


Just a quick one to cover August.

August was a great month for JBG, our best so far with record sales and
booming business. We will unveil the service partnership program soon.
On an interesting bit of news, JBoss made it #2 on the Computer Reseller
News as 'fastest growing certification in importance for large SI's'.

If you are in Europe and back from holiday, you may want to register for
the Stockholm training on September 8 (that is next week). Also let me
draw you attention to the OCT bootcamp in Amsterdam, you don't want to
miss that one. That is Oct 12.

Finally, there a number of events coming up where you can catch us.
You can catch Scott at the Web Services Edge West on Oct 1 and me in
Paris for the XML day on Oct 7, before the bootcamp on Oct 12, did we
say it was in Amsterdam?

All information is on our website at and



Marc Fleury, Ph.D
JBoss Group, LLC

jboss-news mailing list

The link gives server error:
HTTP Status 500 - No Context configured to process this request

Mark, next time u send your crap to us please provide a remove me link.

After publishing this on my blog, Fleury woke up and sent a mail to jboss-news with the subject "How to unsubscribe + quickie". Here are the full contents of his Email:


Just a quickie to remind you that if you want to unsubscribe from this
list there should be directions at the bottom. We finally fixed the
port issues so you can unsubscribe by clicking below.

We just reconciled the lists and there are 40,000 entires on the list.
That is quite a bit of you that have subscribed to jboss-news. I am
looking forward to this out-reach mass channel as communication is

Another quickie, we finished the services partners contracts and we
to release soon. I also want to remind the europeans that we will be
amsterdam for bootcamp on Oct 11-12, you don't want to miss it,

Let me know if you encounter problems in the unsubscribe for those of
you going offline, we recently fixed a glitch that pointed to 8080
instead of the main port 80. It should work, let me know if it

Kind regards


Marc Fleury, Ph.D
JBoss Group, LLC

jboss-news mailing list

I am just glad I didn't get a reply **** my **** from Marc. May be he is maturing.

Saturday, August 30, 2003

Mumbai blasts - Western Illinois University Link

Students Islamic Movement of India (SIMI) a banned oraganization in India is responsible for Mumbai bomb blasts killing 52 people. The founder of SIMI works at Western Illinois University . Hamas is the most admired oraganization by SIMI.

Wednesday, August 27, 2003

Hubble's Close Encounter with Mars

NASA's Hubble Space Telescope took this close-up of the red planet Mars when it was just 34,648,840 miles (55,760,220 km) away. This color image was assembled from a series of exposures taken between 6:20 p.m. and 7:12 p.m. EDT Aug. 26 with Hubble's Wide Field and Planetary Camera 2. The picture was taken just 11 hours before the planet made its closest approach to Earth in 60,000 years.

Saturday, August 23, 2003

Overture Ad @ Google Ads?

While reading Google Weblog, I noticed that Overture Ad is listed as part of Google Ads.

Probably since M$ started Using Linux To Protect Its Own Web Site the world has changed.

Tuesday, August 19, 2003

Sun to blast off Gemini in 2004

The Register has an interesting article about Gemini.
Sun says Gemini will perform about 3 times better than current 1.0GHz UltraSPARC IIIi chips. The successor to Gemini - Niagara - will arrive in 2005 with a 15X performance boost over current chips.

Monday, August 11, 2003

Re: Where are my free JavaBeans?!

Tuesday, August 05, 2003

Mark your Calendars for Aug 27th

Mars Closest To Earth in 50,000 Years

Never again in our lifetimes will the Red Planet be so spectacular.

This month and next Earth is catching up with Mars, an encounter that will culminate in the closest approach between the two planets in recorded history. The next time Mars may come this close is in 2287. Due to the way Jupiter's gravity tugs on Mars and perturbs its orbit, astronomers can only be certain that Mars has not come this close to Earth in the last 5,000 years but it may be as long as 60,000 years. The encounter will culminate on August 27th when Mars comes to within 34,649,589 miles and will be (next to the moon) the brightest object in the night sky. It will attain a magnitude of -2.9 and will appear 25.11 arc seconds wide. At a modest 75-power magnification Mars will look as large as the full moon to the naked eye. Mars will be easy to spot. At the beginning of August Mars will rise in the east at 10 p.m. and reach its azimuth at about 3 a.m. But by the end of August when the two planets are closest, Mars will rise at nightfall and reach its highest point in the sky at 12:30 a.m. That's pretty convenient when it comes to seeing something that no human has seen in recordedhistory.

So, mark your calendar at the beginning of August to see Mars grow progressively brighter and brighter throughout the month.

I will be getting a new Telescope for better view.

Friday, July 18, 2003

Killing all servers

Every once in a while(while upgrading to new version, testing new versions), we need to kill all the servers(Weblogic AdminServer, nodemanager, managed server). Here is the simple command I use:
ps -e | grep [j]ava | awk '{print $1}' | xargs -l kill

Ofcourse this works fine for dedicated servers where no other java instance is running.

So why is [j]ava used instead of java? If the pattern had been written without the square brackets, it would have matched not only the ps output line for java, but also the ps output line for grep. Note that some platforms ps limit the ouput to the width of the screen, grep does not have any limit on the length of a line except the available memory.

You can find more of these tricks here with grep.

Tuesday, July 08, 2003

Fun: Ascii Matrix

Came thru this ascii-movie. Pretty interesting one.

Friday, June 27, 2003

What Matrix Persona Are You? - Quizilla

I took What Matrix Persona Are You? - Quizilla and here is my result.

You are Tank-
You are Tank, from "The Matrix." Loyal
till the end, you spare no expense in ensuring
the well-being of others.

What Matrix Persona Are You?
brought to you by Quizilla

Google: new Toolbar

The new Google Toolbar2.0 Beta is really cool. Since I started using it I am free from Popup windows. BlogThis is another important feature for user who use Blogger like me. But the integration of a "BlogThis" feature isn't sitting well with some blog software firms according to Internetnews.

Friday, June 20, 2003

J2SE: Dear SecureRandom why do you do Full GC?

The first time you invoke a random number genareation method on SecureRandom it does about 20 Full GC's. Doesn't Sun know better than this?

The following example code:


public class SecureRandomTest{
public static void main(String args[]) {
SecureRandom s = new SecureRandom();
System.out.println("Before First SecureRandom Call");
(new SecureRandom()).nextInt();
System.out.println("Before Second SecureRandom Call");
(new SecureRandom()).nextInt();
System.out.println("After Second SecureRandom Call");

When executed with Verbose GC options (java -verbose:gc SecureRandomTest) produces the following output:
Before First SecureRandom Call
[Full GC 232K->102K(1984K), 0.0095414 secs]
[Full GC 103K->103K(1984K), 0.0083893 secs]
[Full GC 103K->103K(1984K), 0.0084910 secs]
[Full GC 103K->102K(1984K), 0.0096741 secs]
[Full GC 102K->102K(1984K), 0.0083740 secs]
[Full GC 103K->103K(1984K), 0.0083477 secs]
[Full GC 103K->103K(1984K), 0.0082608 secs]
[Full GC 103K->102K(1984K), 0.0084743 secs]
[Full GC 102K->102K(1984K), 0.0085553 secs]
[Full GC 102K->102K(1984K), 0.0083935 secs]
[Full GC 103K->103K(1984K), 0.0083734 secs]
[Full GC 103K->102K(1984K), 0.0082784 secs]
[Full GC 102K->102K(1984K), 0.0085028 secs]
[Full GC 103K->103K(1984K), 0.0083488 secs]
[Full GC 103K->103K(1984K), 0.0083399 secs]
[Full GC 103K->102K(1984K), 0.0084595 secs]
[Full GC 102K->102K(1984K), 0.0084740 secs]
[Full GC 103K->103K(1984K), 0.0083002 secs]
[Full GC 103K->103K(1984K), 0.0084044 secs]
Before Second SecureRandom Call
After Second SecureRandom Call.

Update 1:
Steven Pozarycki at BEA reponded:

I saw your WebLog and your question about SecureRandom and GC. I recently
had the same issue but I was using a JSP with the same SecureRandom class.
Anyway this is a known issue with Sun and they said it will be addressed in
1.3.1_09 (available in a couple of weeks). The Sun Bug number is 4298667
although you can't view it on

I also tried this on 1.4.1_02 and there is no problem, so Sun addressed
this issue there as well.

I hope that helps!

Update 2:
I had a change to test this with Weblogic8.1Sp1 (With J2SE1.4.1_03). This seems to be fixed as mentioned by Steven Pozarycki.

Saturday, May 10, 2003

General: Google Viewer from Google Labs

The Google Viewer displays the pages found as a result of your Google search as a continuous scrolling slide show. You can view your search results without using your keyboard or mouse and you can adjust the speed with which the images move across your screen. Each image of a page's contents is accompanied by a short "snippet" describing that page.

A simple a innovative way to provide search results. Here is the link.

M$: $2 Trillion fine for Microsoft?

As per The Register, Microsoft's latest security lapse with its Passport information service could trigger a $2.2 trillion fine on the company courtesy of the US government.
Microsoft product manager Adam Sohn's comment to the security flaw in the password reset tool of its Passport service which could compromise the information stored on all 200 million users: "You live and learn". Is M$ really serious about security?

The flaw could have been found by anyone who tried to crack Passport seriously. From The Register:
The flaw was discovered close to four minutes after security researcher Muhammad Faisal Rauf Danka set to work on Passport. He was able to access Passport accounts at will by typing "emailpwdreset" into a URL that has the e-mail address of a user account and the address where a reset message can be sent.

Friday, May 09, 2003

J2SE: Joshua Bloch speaks about Tiger release

Ever since I read Joshua Bloch's Effective Java Programming Language Guide, I have been an admirer of his programming style. published an interview with him(Joshua Bloch is Specification Lead for JSR 201).

Draft specs for enumerations, autoboxing, enhanced for loop, static import are available at
Joshua Bloch's sessions at JavaOne 2003.