Sunday, December 17, 2006

Open Source - 2500 years old war

Something around 2500 yrs back ancient Egyptians used to keep their mathematical knowledge secret, known only as priests. But then Greek got some of this knowledge and try to develop it openly through publication on papyrus - the ancient world's equivalent of the Internet.

I was looking at some of the open source licensing ways(and story as well) , yep, they are cool.

GPL is the most common amongst all and it says OPEN EVERYTHING. OPEN in open source means "OPEN AND FREE".

In GPL : Software - is free, copied must be free,must provide source, modified and derived work must be open(this is somewhat panic for local application dev.er's).

Other common licencing is LGPL(Lower GPL), which according to GNU should be used under specific circumstances. There may be a special need to encourage the widest possible use of a certain library, so that it becomes a de-facto standard.To achieve this, non-free programs must be allowed to use the library(which is against the honour of GPL) and hence LGPL.

Whereas in BSD, Redistributions of source code must retain the copyright notice.The best part of BSD is application that develops on the top of BSD software can be sold. Most of our Kernels comes under this category, like Unix kernel or Darwin(Mac Kernel).

Market is flooded with Software Licences. All the gaint software when goes in the market as open source, the company made a new Licencing way for them. First time it not happened with Java! Open JDK belongs to many of the licenses. It basically uses GPL, LGPL and ClassPath Exception(one more intersting license).

Despite of the fact that there are so many licenses in the market, open source codes are not safe and they are used in many illegal ways. Becasue these licenses dont have the capabilty to put a check on the submodule part or the logic part.

Friday, December 08, 2006

Welcome Mustang !!

So today is the party time for Mustang. Looking at some of the cool features of Mustang :

~ API for System Tray: Our new AWT package contains two new classes SystemTray and TrayIcon. More or less provide everything that you can do with system tray.


~ Password Acceptation from Console: A new class - java.io.Console has been introduced to define console IO operation. One of the good features - you can take password from console.


~ Mix JavaScript with Java: This is one of the demanding features that developer want to of AJAX in market.

~ Support of Web Service: Awesome support for writing XML webservice client application.

In the rest, there are many more:

Tuesday, November 28, 2006

MyGame

Today I was thinking of all the games I used to play in my school time. And side by side I was also looking at the advancement of Game Programming. More or less all the Game which I used to play on paper and pencil are now automated and I can play on Computer with screen, mouse and keyboard.

I can remember one of the my favourite game that not seems to automated (I guess). The game is something like this:

We call it "Army Man" Game or "Tank" Game. On top and bottom of a paper, we have 3-3 army men like



1-------------------------------------------2---------------------------------3
.-------------------------------------------.---------------------------------.












.--------------------------------------------.---------------------------------.
1--------------------------------------------2---------------------------------3


You can force any armyman at anytime to move, but it should be one at a time. He will fire a bullet, that we used to do by sliding the pencil. And then you need to put a dot on the end of his path,that is, the path covered by pencil. Now its the time of other side army man to fire the bullet. Sameway you can dot his path. Both need to do this till one of them intersect the path of other. This game is looking very simple, but actualy its not. You need to put your head, when to go defensive and when to go aggresive. Also when both the teams are going straightway, you can go aggesive but if you missed, other will kill you.

Game finished, Rub the paper and start again. Best time to play this game was our Geography class :D

CAN WE AUTOMATE THIS GAME !

Monday, November 27, 2006

Java Code and Version Dependency

If you are a person who plays with different versions of Java, according to your business need, client need or your interest. Be careful for java version dependency. Ok, let me show you an example, this is the code I was trying in morning:

class StringTest {

public static void main(String[] args)
throws Exception
{
String s[] = new String[10];
String news = s[-1].valueOf('a');
}
}

Nothing great in this code, but will this code give an exception or not ? s[-1] is ofcourse a negative index array value but mind it method "valueOf" is a static method and hence not depending on the instance of the class. The result is quite interesting:

jdk 1.1 - running perfect.
jdk 1.2 - throwing an error.
jdk 1.3 - running perfect.
jdk 1.4 - throwing an error.
jdk 1.5 - throwing an error.

Thanks to my office system , which has all the java versions. Hmm, result is quite interesting.

I start searching the problem in "Google" and I got an awesome article, again on Javaworld.com which practically not solved my problem but at least relaxed me (Click on the main title to go on Javaworld.com page). Lots of things to read off, I can't write whole in blog :)

Thursday, November 23, 2006

java -ddoc option

One customization :


There is now more than lakh's of project developed in Java, that went for a maintenance, enhancement and servicing. The common problem in which most of the company stuck of is with the chain of ongoing and incoming employee. For a new engineer its difficult to understand the code written by someone else. And the worst happens when they don't have any supporting document to understand the code.

I am here proposing a java -ddoc option which generated a HTML(XML) format design document of the work flow of the code along with the output of the code.


It tells user about the class variables, share variables, method flow and Native API's(if any). Being Java an Open Java, engineers can understand the internal functionality and can perfectly understand the requirement of the written code.

Wednesday, November 22, 2006

Java is Slow ?

Are you feel anything bad about Java ?
Ya, its damn slow.

This is a inherited sentence from someone, not a self-checked statement. Our teachers used to say so, and so our seniors and so we.

Today, I was compiling some of the native API's where the function body is actually a CPP or C code. Just came across a paper " .P.Lewis and Ulrich Neumann Computer Graphics and Immersive Technology Lab University of Southern California " regarding the performance of Java against C++. There are many things to surprise of.

Let me discuss few of them:

1. Java performace is comparible to CPP and in some cases better than CPP. Not only this its improving ... !
Operation Units C Smalltalk Java
Polynomial 10th degree msec. 1.1 27.7 9.0
Neville Interpolation msec. 0.9 11.0 0.8
LUP matrix inversion sec. 3.9 22.9 1.0


2. Java performance at the time to be somewhere in the middle of C compiler performance - faster than the worst C compilers, slower than the best.more recent java(1.4) and gcc(3.2), using full optimization.This time java is faster than C the majority of the tests, by a factor of more than 2 in some cases...


And in theories YES, many reasons:

http://www.idiom.com/~zilla/Computer/javaCbenchmark.html

It's most Adaptable, not the most Powerful, who survives ! :)

Thursday, November 09, 2006

Garbage Collector ... Wow !!

Garbage collector is one of the most toughest code that is written under JVM. Highly optimized but not yet fully optimized code !

Most of the time we think as an application developer on Java, that GC is something which is not under our control and handled by JVM only and this is one of the place where we are really killing our application. Java HotSpot (JVM) gives 'n' number options to optimize GC according to the application need and to be frank this 'n' is 63. Some of the optimization is now deprecated in Mustang(jdk1.6) .

We can have several questions like how we can optimize our code!

Let me tell one perfect analogy that I saw someday back on JavaWorld for GC. Here it goes :

You are owner of a city, small city say 'JavaVelle' :) and in your city all the ppl are software eng'er. They are using too much of Computer and Car . Being small city there is only one main road in your city. Now, Dumping of computers and Cars is becoming too much and now you as an owner of the city want some garbage ppl to come and collector the garbage.

So, he is all the time coming with a big truck and collecting all the garbage and then putting it out of the city. But his truck is so big that when his truck is on road other ppl cant move here and there, and hence creating a congestion and not only that the biggest problem is Police and Ambulance type of critical process cant stop because of Garbage Truck.

This is the true scenario with GC. When JVM is running the GC to collect the Kachara (Garbage) it stop all the current running process. But some process which are real time or some which has too many client to serve cant stop like that. Sun provides a smart solution in Jdk 1.4 and smartest in Tiger release(JDK 1.5). It really based on some hopeless assumptions, like New object will die early, but it holds good. We are not going to discuss the whole process but as an application developer on Java, We can optimize the GC according to our own need. How ???


If you have a single-processor client machine and are having problems with pause times in your application, try the incremental garbage collector. This might help with perceived performance, even though it may decrease real application performance somewhat. Remember that perceived performance is usually more important than real performance for client applications. If the incremental garbage collector doesn't help (or doesn't help enough), and you have plenty of RAM, try the concurrent garbage collector.

If you have a single-processor server machine with lots of memory and experience trouble with application pause times, try the concurrent garbage collector.

If you have a multiprocessor machine, especially with four or more processors, try one of the parallel garbage collection algorithms. These should significantly decrease pause times. If you have lots of memory (gigabytes), use the scavenging collector; otherwise, use the copying collector.

Command-line switch

-XX:+UseParNewGC Parallel copying
-XX:+UseParallelGC Parallel scavenging
-Xincgc Incremental [none] Mark-compact [default]
-XX:+UseConMarkSweepGC

If you just want to check a demo, make a program with Lot of GC work. And then try these commands.

Example :
Test.java
javac Test.java
java -XX:+UseParNewGC Test

javac Test.java
java -XX:+UseParallelGC Test

javac Test.java
java -Xincgc Test

For web application developer, we need to make change in Web Container. I havn't try this but will do soon :)

Really want to go in detail, please check the Title Link.

Wednesday, October 11, 2006

Yes... I can believe on this

2.5 yrs back, when I was in 3rd year of my B Tech, I saw a dream... A dream to work with Sun That time I liked this company becasue anywhere if its come Open Source you will heard of Sun. Even today the reason is same.

Knowledge belongs to the world, we cant sell and buy it.

Wednesday, September 20, 2006

Sun going to add Non-Java Support to JCP

Interoperability is the first 'HARD' term I heard when I started my Java Course some 2 years back. It simple means how Java is showing it's behavior when it come across some non-Java component. We can say something like cross language, cross platform.

Dealing with other language is really a tough job, especially for Java because if its platform independency. In all of the problem we have a good news, Sun has proposed a new JSR(Java Specification Request) to make changes to the JCP. This JSP, JSR 306 also proposes more fundamental changes to the process, including allowing non-Java implementations of a JSR's specification; the ability to create liaison relationships with other standards organizations; easing the migration of pre-existing technology toward an agreed-upon standard; and the availability of a TCK (Technology Compatibility Kit) and associated licensing information upon completion of a JSR.
"This makes sense if you look at the emergence of concepts like Web services and service-oriented architecture," Kluyt(Chair of JCP) said. "Enterprises face very mixed environments where they have to make different architectures work together."

Saturday, September 16, 2006

J2ME ready for next generation ..

I worked on J2ME for 2-3 months. And believe me no one is going to appreciate this language in 2-3 months. A very bad navigation, bad GUI and the biggest headache is what J2ME Sun Simulator is showing the output is nothing like that when application was putting in real Nokia device.

And my next 2 months I used FlashLite. Again believe me a awesome smooth navigation, too easy for GUI creation and really easy to program.

That time I was thinking why 85-90 percent of the mobile applications are deployed in Java and only one reason I got "All the mobiles are java enabled" and for making mobile Flash enabled we need to spend Rs. 500 (10$) :-).

But gradually I get to know J2ME is a cool platform for mobile application and I need to work more to say that it’s better than FlashLite.

Monday, August 14, 2006

Java - Cool Apps, Hot Games ...

Something on the business side of the consumer market, Ricoh recently launched a series of office printers with Java embedded. The Java-powered printers let corporations build custom applications, or integrate their existing applications, to create more efficient business processes easily and quickly. One such application involves the use of a Java card, requiring the person who sends a print job to swipe his card at the printer before anything is actually printed out. The intent is to avoid having sensitive information get into the wrong hands if the person who sent the print job does not get to the printer in time, or simply forgets which printer the job was sent to. Swiping the Java card ensures that the print job is held up (yet still queued) until the person arrives to physically grab it.

Java enabled this application with unique, and very useful, functionality. The broad range of technologies offered by the Java platform, such as the Java card, makes it possible to integrate devices with new and existing applications in an environment that is already familiar to most developers.

Shortly, after being famous from last 3 years in the consumer market Sun launched a site java.com. On an average 15 million unique visitors a month. Site aimed to younger audience and game freakers with a sense of open source.

Another example of embedded Java is the use of Java within the latest BMW cars to offer location services, interactive services, and multimedia functionality. The Java software is called "iDrive," which lets drivers control the car's audio and navigations systems, as well as the climate within the car's cabin. What's more, Java helped cut BMW's development costs significantly, and has provided them with a dynamic platform that can be updated with new services and features even after the car leaves the dealership.

Overall, I can say its rocking in consumer's market !

Friday, June 30, 2006

JVM - Heart of Java

We all know that Java Virtual Machine is a virtual machine means a software that executes Java ByteCode. It is the one who provides Java and WORA (Write once, run anywhere) architecture.

Starting with J2SE 5.0, changes to the JVM specification have been developed under the Java Community Process, JCP as JSR 924.

It's a matter of month, Sun going to make Java open source. The hottest debatable issue is of JVM, becasue experts have the opinion that for each problem statement developers will change the JVM according to their convience. Let's see Sun is going to do something for it. This particular concern is relatively big since there already a number of competing Java VM's and few of which are fully compatible.

Some of the open source implementations of JVM like Kaffee and Waba are comparable to closed source implementations of Sun's Java HotSpot, Blackdown and BEA systems. Anyway the current issue for Sun is to retain the Java, Platform indepedent which may be at stake after making Open Java.

Talking about the secure execution of remote code, Java follow "sandbox" mechanism, which is desgined to protect the user from misbehaving or malicoius code. Publisher can apply for a certificate with which to digitally sign applets as "safe", giving them permission to break out the sandbox and access to sys local file.

Thursday, June 29, 2006

Bad One ...

Week back, I cleared my Sun Java Certification. Score was bad enough to be mentioned here. 2-3 days I spent in thinking the reason for my bad performance !

There are many :) !
Abhishek, who also went with me for the exam also not able to score a good one, told me that enough of delay is one of the biggest factor for the bad performance. Agreed !

I was preparing for it from last 3-4 month and I guess 1 month back I was on the peak of the excitement for the exam and that was the best time to deliver it.

Anyway nothing to sorrow, but of course have to learn from my stupid decisions.

Thought to start preparation for SCWCD, but its better to have a rest ! Transferring to mumbai, I don't think so I will get chance for preparation but I will do my best for it !

Saturday, June 17, 2006

Add dynamic Java code to your application

Got a very nice article of Dynamic Java Programing:

Write code that can respond to changes at runtime
SummaryDid you ever wish your Java code could be dynamic like JavaServer Pages? That it could be modified and recompiled at runtime, with your application updating itself on the fly? This article shows you how to make your code dynamic. As such, some of your source code will be deployed, instead of compiled binary code. Any changes to the source code will cause it to be recompiled and the class to be reloaded. Your application will then run on the new class, and users will see the change immediately. This article covers not only runtime source compilation and class reloading, but also a design that separates the dynamic code from its caller. The caller holds a static reference to the dynamic code, and no matter how the dynamic code reloads at runtime, the caller can always access the up-to-date class without updating the reference. In this way, dynamic code changes are transparent to the client.

JavaServer Pages (JSP) is a more flexible technology than servlets because it can respond to dynamic changes at runtime. Can you imagine a common Java class that has this dynamic capability too? It would be interesting if you could modify the implementation of a service without redeploying it and update your application on the fly.
The article explains how to write dynamic Java code. It discusses runtime source code compilation, class reloading, and the use of the Proxy design pattern to make modifications to a dynamic class transparent to its caller.

For whole doc: http://www.javaworld.com/javaworld/jw-06-2006/jw-0612-dynamic.html

Have fun with Java !

Wednesday, May 31, 2006

JAVA - Write Once Run Anywhere?

Yes, you get to know why I put the question mark in the last! Open Source Java and Jonathan, Sun CEO has to answer this question. If its all about setting Java free, Java has to lose its charm, charm as an WORA (Write Once Run Anywhere), charm as being the most compatible, platform independent language.
Clingan's view: For example, this comment about removing Swing from a server build of Java comment enough seems innocent enough, but would it be the start of a trend? Would we end up seeing specific builds of Java for specific problem sets? Would it stay together as a full Write Once Run Anywhere platform (WORA)? I supposed this could be addressed under a license."
Not only this what about Python and Ruby using the JVM, do they need to drag along the Sun run-time? Many product and ideas become obsolete because of this move.
I like Java as a programming language because it provides everything what your business demands but from tomorrow .. !! 10 percent of the time companies spent on their development and 90 percent time companies spent in seeing their rivals! Is IBM going to put a new Idea ? What Sun's next move? What about Motorola?
From tomorrow, you don't have one link to download JDK, you see thousands of link from where you can download Java ! After downloading ... ooo no no .. this is not what I want, this download don't have AWT, I need that one !! :)
Open source, freedom, a new path for mankind - every term is fine, but it's not like Sun lose its technology like Ruby !! Hell lot of work for Jonathan and new Software officer Green.
Lets see the next move >>>
View Xavier Cho response:
"We could just release Sun's JVM under GPL/CDDL duel license as 'reference implementation' without ever worrying about defragmentation, or having negative effect with WORA ideal.
Nothing prevents putting GPL'ed Java under JCP's control as long as Sun doesn't abandon the "Java" trademark. In this way, no one could call their forked version "Java" unless they also pass TCK, or extend and modify core libraries except by way of JSR/JCP.
Currently, Mono has already gained sufficient momentum to be recognized as a preferred platform for writing Linux (mostly GNOME desktop though) applications, while Java's presence in desktop Linux is almost negligible. the only reason that such a dangerous attempt to copycat everything MS does gained such momentum is the fact it is covered under GPL. Once Sun's JVM is released under GPL, we can fight back in the rapidly growing Linux desktop world again, since we have both JCP/GPL while Mono people doesn't have anything to say where MS's leading them to."
Jon Walker, CTO of Versora view:
Jon Walker, CTO of Versora, had a good summary of the situation a few weeks ago, in a blog entry title "Sun Called To Open Source Java" he wrote"
"Sun, often through Jonathan Schwartz' blog, makes a lot of bold claims. Scott McNealy recently threw out an offer to HP to merge their Unix (HP-UX) with Sun's - an offer HP execs called laughable.
It seems only apropos then that Sun would be called out by ex-employees to open source the Java platform. Of course, it is not only ex-employees that are asking for the open sourcing of Java. The open source community has called for the same.
I like Java as a programming language but I believe it is already beginning to lose mindshare to other open source technologies like Ruby. With mindshare goes most of the new programmers. Microsoft is also chipping away at it with C#. Sun needs to make a radical move like this to help Java continue to thrive as it has. Otherwise I predict a significant decrease in the number of new projects that use Java as a core technology in the near future."

Wednesday, May 24, 2006

Open Source,No Doubts said Sun CEO

Happy Birthday to Java, Yes today is the Java 11th foundation day. On 24th May 1995 Java official declared by Sun. See what going on in Sun:

A biggy step taken by Sun Microsystems CEO Jonathan Schwartz - The Java programming language, the pillar of business computing, will become open source.

"It's not a question of whether, but a question of how" Jonathan said last week at the JavaOne Conference. He added " Open Source Java would attract more developers, a win for the large Java community in its competition with Microsoft and .NET environment. Also, each time Sun asserts ownership of Java, some of the Java community(including IBM) , get restless.

In reply with the question "Who will manage open source Java code", he replied " Yes, Sun will be picky about who watches its baby. Apache Software Foundation, an early host of Java-related open source projects, is a natural home. But they won't tolerate corporate medding. or even JCP (Java Community Process) itself.

That was really a deadly step taken by Sun. Yesterday Sun is the leader of the technology and from tomorrow Sun is the competitor of its own development.

For more: see the hyperlink associated with the topic.

I will continue on this :) to my next blog.

Saturday, May 20, 2006

AJAX - An idea can change the way !

Asynchronous JavaScript with XML - The term was originally coined by James Jesses Garrett of Adaptive Path to describe the shift in development from Webpage-based Web applications to data-based applications.

Very clear with the words, AJAX is not a programming language, its simple a development technique for creating interactive web application.

The AJAX technique makes web pages more responsive by exchanging data with a server behind the scenes, instead of reloading an entire web page each time a user makes a change.
With AJAX, web applications can be faster, more interactive, and more user friendly.
Ya, while talking of AJAX how come someone leave without taking the name of Google which makes the AJAX megahit. Google hottest applications are using AJAX like Google Gmail, Google Map, Google Chart. Not only this how come others be so slow in race. Flickr whole development in AJAX.

But the real problem comes when techology grows and what is with AJAX ?
Ummm ... JavaScript naaaaaa !! Programming in JavaScript is a real pain. But but but ... company like Google is using this technology, how come it be painful. Yes, Google is going to provide developers with a simpler way to create Ajax applications. The Google Web Toolkit (GWT) released this week is a framework that converts a standard Java application into Ajax that will work in all browsers.

Google don't want to continue this hot technology with Java Script. Google developers itself had to spend more than a month to run Google Map in Apple's Safari.

GWT works with any standard Java IDE (define) to convert a full-blown Java application to JavaScript, while paring down the application and removing classes and functions not allowed in the more restricted browser environment. JavaScript applications, for instance, don't have access to the computer's file system, while Java does.

A lot of Java developers don't know JavaScript, so GWT will be a real help in building Ajax applications, said Dick Wall, principal software engineer for New Energy Associates, a division of Siemens. Wall is also a member of the Java Posse and the group has been discussing GWT a lot on its Podcasts from Sun's JavaOne conference this week

People look to Google as an Ajax community leader because of its success with Maps, Calendar and Gmail, so anything they do will warrant a lot of attention and hopefully encourage more Ajax development.

Some patches are still left to fix like to run it on native Mac OS. But we all will see GWT soon in market. Lets see , Is this technology is going to make a difference !

Open Source, I am talking about solution!

If I ask any tech. freak that tell me the most readily available thing today! No doubt the answer goes in favour of codes!

Except Microsoft Operating System, I don't think any piece of code left that is not available on net, of course free. Linux revolution and an idea "My Source, Your Source - Open Source" changed the whole business demands.
A recent survey found 52% of companies are replacing Windows servers with Linux servers. But the biggest thing business has to learn from open source is not about Linux or Firefox, but about the forces that produced them. Ultimately these will affect a lot more than what software you use.

Yes, Sun is going to organize 1800 free seminars this year. So for those in attendance tomorrow, thank you for joining us - at what's become the world's largest free and open source software developer conference. Believe me, there's a huge tent waiting for you - I just walked the main hall, and you could fit a few Space Shuttles in the place.

Don't tell me that you will not buy this software even they cost some bugs: http://java-source.net/

But this is the beginning of Story, the great battle begins in between all the open-source software. Till you think for a idea, somebody already deployed it and really market is flooded with these ideas.

I remembered the last line of the movie Antitrust: "Human knowledge belongs to the world". Can we make a difference?

Friday, May 19, 2006

The power of Java ...

The power of Java - with this the conference of JavaOne began on 16th May. It talks of Java and only Java from mobile to biggy servers.

Sun believes on the simple funda of Darwin, as Darwin said, it's not the strongest organisms that win, it's the most adaptable.

Asking Jonathan of Sun, how Sun monetizes Java, he replied "you want to know how I feel about Java, my view is it's changing the world - standardizing the plugs and rail gauges and containers used by global internet players. Its momentum, in my view, is unstoppable. What's that worth to Sun? Give it your best shot. When I do, I say most of our revenue is derived from Java. Just like most of Verizon's revenue comes from handsets. Even though the economics of the handset look baffling (but I dare you to recommend to Verizon that they stop selling them). Those that believe free software or service yields lower revenue don't understand the economics or dynamics of the software industry. Think Google or Yahoo!, not Maytag."

The 2006 JavaOne Conference gives attendees unmatched opportunities for learning and making professional connections. This year's conference includes approximately 300 learning sessions. The general sessions feature an impressive roster of industry luminaries discussing the latest developments in their Java technology-based initiatives.