December 28, 2006

Scripting in Java

The latest version of java brings a number of new features and enhancements that will improve the development of software in java platform. One new feature is the Scripting support that the new JDK will provide and this article is just the basics of it.

Most developers know scripting languages like Perl,PHP,Python,Ruby and some are crazy about it because they are simple,flexible and highly productive. Java now comes with built-in support for scripting languages. This has been encoprated through Java Specification Request (JSR) 223, which defines a framework and provide the necessary API required to access and control the scripting environment, create web content with scripting and embed scripting technology in java based applications.

So the start with, we have a script engine that helps us in executing the script and our first step would be to import some packages. The classes and interfaces required are defined in the package javax.script. The main class is ScriptEngineManager which is the script engine that executes the scripts. So we have it instantiate it as our second step. So the simple steps for incoprating scripting will be:

1) Create an instance of ScriptEngineManager.
2) Get the required scripting engine.
3) Execute the script using the scripting engine.

The first two steps are as follows:

ScriptEngineManager sem = new ScriptEngineManager();
ScriptEngine engine = sem.getEngineByName("JavaScript");

So now you have the engine to run java scripts. To execute a script we have to use the eval API which is in ScriptEngine.
To execute (evaluate) a script we have:

engine.eval("script to run");

One thing to remeber is eval method return an Object and we have many overloaded versions of eval. These are not the only features, we can invoke procedures using the Invocable interface. To invoke a procedure we use invokeFunction or invokeMethod methods.

So that's all about scripting for now. For reference check the tutorials provided in java site and also check the javadocs.

December 27, 2006

Bill Gates' High School Speech!!!

A few months ago I read an article about Bill Gates' speech to high school kids about rules of life in Deccan Chronicle . I also cut out the article and had it with me (even though i am against his business ideas) till the last days in VIT hostel. Here is the extract of the great speech:

RULE 1: Life is not fair - get used to it.

RULE 2: The world won't care about your self-esteem. The world will expect you to accomplish something BEFORE you feel good about yourself.
RULE 3: You will NOT make 40 thousand dollars a year right out of high school. You won't be a vice president with car phone, until you earn both.

RULE 4: If you think your teacher is tough, wait till you get a boss. He doesn't have tenure.
RULE 5: Flipping burgers is not beneath your dignity. Your grandparents had a different word for burger flipping they called it Opportunity.

RULE 6: If you mess up,it's not your parents' fault, so don't whine about your mistakes, learn from them.

RULE 7: Before you were born, your parents weren't as boring as they are now. They got that way from paying your bills, cleaning your clothes and listening to you talk about how cool you are. So before you save the rain forest from the parasites of your parent's generation, try delousing the closet in your own room.

RULE 8: Your school may have done away with winners and losers,but life has not. In some schools they have abolished failing grades and they'll give you as many times as you want to get the right answer. This doesn't bear the slightest resemblance to ANYTHING in real life.

RULE 9: Life is not divided into semesters. You don't get summers off and very few employers are interested in helping you find yourself. Do that on your own time.

RULE 10: Television is NOT real life. In real life people actually have to leave the coffee shop and go to jobs.

RULE 11: Be nice to nerds. Chances are you'll end up working for one.

But all this is a rumor! Bill Gates never delivered this speech! Recently my friend send my this link that says it all. But the trouble is this was published in a newspaper!!! Many of you would agree that Deccan Chronicle is gossip paper but see how media have diverted from its real goal. The goal to spread the right information!

December 19, 2006

First day in Office!

I am one day late to write this blog, but here is my experience on "First day in office". Basically it was good! The whole day was a mixture of formal and informal events. but there are funny events that happened even before I reached the office. Our report time was at 10.30 am, but my friends and I left the guest house around 9.15 am. As all of us are not familiar with Bangalore city we had hire an auto. The great day was struck with a mishap when the auto refused to move forward after running few kilometers! So we where near "Silkboard". The next auto trip started from front of Silkboard building after some help from some Patni and Wipro employees. And we finally reached Honeywell Campus at Banargatha road sharp 10:30 am! But we where not still inside. Security took away 15 minutes in printing our temporary IDs, and finally reached conferences room on "Pluto" around 10:50. But we had little trouble in entering the office wing since we didn't have our access cards.
The first event was submitting our documents that we where supposed to carry and that took away 2 hours. during this time our snaps where taken for our Access cards. And then the big lunch! After lunch we here supposed to move to new Honeywell campus called Orion. So we picked our shuttle from Pluto to Orion at 3. In mid way we met with a accident when one heavy truck brushed our shuttle (bus). But it was a minor one and we moved on :) . Orion is new campus and the only building is named Alpha. We where to meet our manager in Alpha 003 at 4:00 pm and we did. Alpha 003 room's discussion included our introductions, interests etc and we where out by 6 pm. But the real fun started now. We played Table tennis will 7.30 and left home once we where tired! So my first day in office was good!
And this blog is being written from office and its my second day. i will be assigned to my project today and the meeting is scheduled to be at 5:30!

December 13, 2006

Why Java was GPLed?

Sun's open sourcing of java is not a one night task. It has been on news for quite long now. even had polls to see what developers community thought about it and also under which license it should be given out. Now it's finally open under GPLv2! But what surprised me was the license which they have used.With the conterversy of GPL versions arround I really didn't like the choice of license. But that's not all!! What made Sun to open source java?
A little investigation what is happening arround will give you a picture. Through my hunt I feel the main reason for Sun to open source java was the pressure from the open source community to open it up. The pressure was in the form of open source implementations of the J2SE. One such project is Harmony of Apache Software Foundation. The Harmony project site says "Apache Harmony is a top-level project of the Apache Software Foundation! See below for more information". And the big news is they plan to complete the implementation of Java SE 5 JDK by mid 2007. It can run servers like Tomcat,Maven etc. The license under which its distributed is Apache License.
Now its not just the Apache group that's under hard work! GNU is also comming up with its own implementaion of Java SE! Its called GNU Classpath. but the problem is its behind as we have implementation of 1.4 only. But they warmly welcomes the Sun's open sourcing of java.
So Sun Micorsystem is under pressure by these two open source java implementation because they will become more popular and may even become better than Sun's own implementation. Another reason is, at present no Linux distribution have sun's J2SE.The user have to install a copy by downloading from Sun's site. By making Java open source, you will now get to see the Sun's JDK with many major distributions like Novell,Red Hat,Open Suse, Fedora etc...
So what's the effect of it all on developers? Developers are going to be more involved in Java's development and tune it. One good example is the new Java JDK ie JDK6.So as a developer : KEEP PROGRAMMING ! :)

November 18, 2006

Reaching a milestone!

On October 10th, I setup my personal website at googlepages. My site is registered with the Google Analytics service and I have been tracking my site's performance. Now after a month I have crossed a milestone! My number of visits crossed 100! I am all happy about what I have achieved so far.

Upon reaching this milestone I have updated my site by giving it a new look and new pages. Two new pages series "TechnoPaper" and "GPC Corner" has been added to the site.
"TechnoPaper" column will have some of my technical articles hosted. It will be related to my programming experience and observations. Whereas the "GPC Corner" will be about Google Page Creator. I plan to publish what all I study from building my site. It would be any "Tips and Tricks" pages, but will have some of the things that I am trying out in GPC.

Before concluding let me show my Map Overlay:

November 15, 2006

Loop Variable’s Scope

According to C, C++ the scope of variables in for loop is within the loop. That is, a variable inside the loop will not be accessible once the loop finishes it job! For example:

for (int i=0;i<MAX;i++) {

// do something in the loop

// variable “i” should not be accessible!

But there is another twist in this variable’s scoping. Different compilers should different behaviours in scoping of variables. I will review three compilers here: Borland CPP 3.0, Visual Studio 6.0, GCC 3 and above.

Compiler 1: (Borland C++ 3.0)

This one of the most used compiler by beginners! But I will never recommend it for starting C or C++ as its too old (released in 1989) and have troubles running with latest processors. Now, lets take an example. Consider the loop given below:

for (int i=0;i<MAX;i++) {

printf (“Value of I : %d \n”, i);

printf (“Out of loop! \n The value of i is: %d”, i);

Running this loop will give you list of “i” values and finally once the loop is complete the final value i.e., MAX will be displayed. In short we will be able to access the variable out of its scope! Is this correct? Since I found this behaviour in Borland I did a research with other compilers.

Compiler 2: (Visual Studio 6)

Visual Studio 6 from Microsoft is one of the highly professional IDE available. This IDE too shows the same behaviour. I don’t have access to the latest Microsoft IDE (.Net) so haven’t checked it out. Another important aspect of Microsoft compile is that it doesn’t follow C99 standard complete.

Compile 3: (GCC 3 and Above)

Now some the change! The same code in GCC (GNU Compiler Collection) will give you an error! You will not able to access the variable outside the loop as the scoping rule goes.

Try out the loop in GCC and see how standardized it is. If you don’t use Linux you can GCC based compiler like DEV-C++ for windows platform. For any beginners I would recommend them to study C/C++ using GCC compile and never NEVER use old Borland compilers!

November 03, 2006

Linux under threat

The Linux operating system is one of the biggest revolutions in the history of computing. It has changed the world and still changing. A project by Linus Trovalds, has changed computing world a lot in its 15 years of existence. Linux now drive world’s super computer to mobile phones and many other gadgets. Linux and the open-source software movement have got billions of dollars of investment from IBM, HP, Red Hat, Google. But will this all stop? Is it in endanger not by its rival “Microsoft” but from world’s greatest hacker – Richard Stallman? He the creator of FSF (Free Software foundation) and GNU, the leader of Freedom movement in computing. A Guru, hacker etc…

Now let me take you to year 2005 when Richard Stallman visited our VIT campus on his mission to propagate Freedom. I was excited to see him and attended his speech in which he talked about calling Linux “GNU/Linux” as GNU supported its growth and existence. And from that day on I called it that way, giving respect to GNU. And I do respect GNU. They have started the revolution for free software and Linus just fitted the pieces to form the complete system. This is one instance from my side.

The second one: I was one the first subscribers of the magazine “Linux for you”. A well known Linux magazine in India. One of its initial issues contained an interview with Stallman who said the magazine should have been “GNU/Linux for you” or “GNU for you” as Linux is just a small part of GNU.

Richard Stallman is now waging a new crusade that could end up toppling the revolution he helped create. He aims to impose new restrictions on IBM and any other companies that distribute software using even a single line of Linux code. They would be forbidden from using Linux software to block users from infringing on copyright and intellectual-property rights ("Digital Rights Management"); and they would be barred from suing over alleged patent infringements related to Linux. Now don’t you think that’s breech of freedom? And Torvalds doesn't like GPL that would prohibit companies from using GPLv3 code to create digital rights management (DRM) schemes. Torvalds says he won't adopt the new license and will stick with GPLv2 instead.

The Problem is, Torvalds only controls the "kernel" of the operating system, which is just 5% of the total operating system. Many of the other parts will move to the new license thus causing a big split. This will cause problems for companies like Red Hat, Novell etc.
Another problem is that the two licenses seem to be incompatible. According to Diane Peters, It's not clear yet whether companies can ship products that merge v2 code with v3 code. So what will happen next? The Linux world would be spilt into two… “v2” camp (corporations) and “v3” camp (extremists)!

Extremists say they don't care. "People can go run another operating system," says Bruce Perens, a free-software advocate who supports Stallman. He also says if Torvalds doesn't adopt GPLv3, extremists will create a new operating system using a different kernel. So now we have “forking” of Linux Operating System and this would create many incompatible versions of the OS.The biggest beneficiary of this is the proprietary software giant: Microsoft, which pitches its Windows operating system as "safer" than Linux, and Sun Microsystems, with its open-source version of Solaris system, which doesn't use the GPL.And the looser could be Stallman himself. He is risking loosing the empire he helped built. Loosing would make him an irrelevant person in the community and would be considered a crack who tried bringing down his own empire!

October 13, 2006

Google on Fire

Google's on fire!!! They have released a bundle of web services for the world to work on! And as always, they are of high quality. I started my Docs & Spreadsheet as soon as I read the news in "google news" which said "1 hour ago". So i am not late! Apart form this they have also enhanced the picasa with the online album and released Picasa 2.5 with more features. With this, Google is definitely on fire! Users are definitely wondering what's next?

  • Presentation service?
  • More desktop services?
  • Or something that even my brain is lazy to kick!?

Google have enough services and by integrating we can say it’s a Web OS! And they integrated it well so far. Now google is really tough with its competitors. Yahoo seems to be much dormant in the race, but Microsoft which has lost the search ground and its "msn charm" is trying to get back to business.
Google is quite ahead of Microsoft in number of services, the quality and technology. Gmail used Ajax before anybody, bringing new innovation and revolution in e-mail. The MSN beta and Yahoo beta seem to go the outlook look. But still the service is very poor. Frankly i am a google fan and i use google stuff even though i am aware of the Microsoft and yahoo services. One the best part of google's service is its simple innovations that has brought web to be more personalized and highly user-centric. So to end ... here are some questions for you to plunder!

  • How many of the google services you subscribe to and how many you use?
  • Do you feel google has similar services in different names?
  • Is google entering a monopoly?
  • Will Microsoft recovers their lost grounds?
  • Why is Yahoo entering the race limited (they have come up with much less innovation)?

Google Research Papers

I have found somthing new to me which I would like to share.. Google has released some new services to the world to play with. Definitly this will keep the ahead of the corporate war with microsoft. what i found today is somthing quite interesting in google site itself. They have a whole set of research papers published which they conduct in their company! Check the site out:
they have published some of there research papers.. techno geeks should go through it. Many of these researchs are implemented and is being used as the backbone of google. Public to make use of it but do not have direct access. For example the The Google File System. You can get more details on the file system from wikipedia. For technical details read the PDF that google provides in there site itself!
Happy hacking!

October 11, 2006

Importance of "Self-Googling"

Sun Student Developer Connection eNewsletter of september had one interseting link named "Beware Your Blog". Since I have blog, I checked it out. The link lead me to an Article at University at Buffalo. The authur talks about how important it is to "self-google" and see
how you are listed. In this internet world where people google things from news,images,videos to everything under sky, its important making yourself listed in google.

Try your name! What do you get? I was surprised to see myself listed first. My savannah profile came first followed by my java forum profile. In the article the professor recommends it as a shrewd form of "personal brand management" in the digital age.

Thus it is important to manage your online presence in a positive manner. So, how do you build reputation? Your presence in internet is the answer. Having blogs, personal websites,being active in disucssions,forums make you alive on net. But as any technology hold, "self-googling" has disadvantage! Any person could just as easily start several websites and make it look as though they had accomplished all manner of things. People who treat the internet as a 100% reliable source of information deserve what they get.The truth may be closer to 0%.

So pull up your sleves and built reputation.! but a good one!

October 07, 2006

Coming of Ubuntu

A hard week is over! With the end of my exams.. i am free for todays and to my surpise i got my Ubuntu (GNU/Linux) pack! For me it has come in right time. A day before would have ruined by examinations. he he.. so this weekend its UBUNTU time!!!
But plans don't end here... I am also planning to try out the new init(alization) for GNU/Linux! Its called initNG (Next Generation). Even though its in its primitive stage.. sound interesting when my friend Zaheer mailed me about it. It loads services asynchronusly to reduce the booting time of GNU/Linux distros..
And. . . . final thing on agenda.... will be to prepare for the project review which is on 10th. My WebShell still needs makeups and i plan to keep myself busy with these.

Happy GNUing :) !!!

September 29, 2006

Re blogging!

Its being long I blogged! Reason? very simple... I didn't get time for it. It just like any other school children who would say "I didn't get time!". But, I have been busy. Getting to do my final semester project at Honeywell is no easy thing. I reach my hostel room late in night and no studies after that.. every month our great friends (HTSL executives) come to take a non-stop class..
Ya its good to study new stuff. but its too much !

So the next Q is will i be regular from now on in blogging? NO!


June 28, 2006

What a day...

What a day! Today our 5th semester started off. We are having our class from 7.30 am to 1 pm and for the best we had two hours of Java lab which we some how killed by shit-chat! The class was good part of the day. Actually my friend and I had planned to go out to town in evening... And we did...

Returning back to campus by 5.30, we headed straight to PAT (Placement And Training) centre to get updates of our friends who where appearing HCL Ltd’s interview... and to our surprise we got the news that results are out…! While moving to nearby computing centre my mind ran through the seq of writing exams and did a analysis of what I might get… and I got 8.76 GPA..

Here are my CGPAs for all the four semesters!











June 25, 2006

What Mustang offers...

Sun has released J2SE version 6 Beta 2. It’s code named Mustang. The sun web site states 10 things programmers need to know about Mustang.. Here they are:

1. Web Services : Developers are given good support for writing XML web service client applications. Mustang has new XML parser and XML to Java object-mapping APIs.

2. Scripting: Developers can now mix JavaScript technology with Java technology.

3. Database: Developers will have the JDBC 4.0 to work with! It will also co-bundle the All-Java JDBC database, Java DB.

4. Desktop APIs: Swing gets more features!

5. Monitoring and Management: Mustang has more diagnostic information and co-bundles Jhat tool.

6. Compiler Access: Now developers have access to the compiler API so that they can access javac for in-process compilation to generate dynamic java code.!

7. Pluggable Annotations : Developrs can now define their own annotations!

8. Desktop deployment : some of the features added are new looks and feel, LCD text rendering, and snappier GUI performance.

9. Security : Its one of the core feature that Java has really looked into. This time it is releasing better security features in Digital signatures, Public Key Infrastructure (PKI) and cryptography.

10. The -ilities: Quality, Compatibility, Stability : All the ilities followed to ensure that Java is the best programming platform!!!

June 23, 2006

Hand of God goal

June 22 of 1986, Maradona scored Hand of God goal against England during the quarter-final match of the FIFA world cup in Mexico. In the same match his second goal is named Goal of the century. Maradona used his left hand to score the goal and Argentines won 2-1, and the legacy of this event perhaps best symbolizes the rivalry between the two football teams.

After the match Maradona said "a little with the head of Maradona and a little with the hand of God" which is one of the most famous quotes in sport!

Maradona's site :

June 21, 2006

June 21: Summer solstice in the Northern Hemisphere

Today is summer solstice! It is the day of the year with the longest daylight period and hence the shortest night. This day usually occurs on June 21/June 22 in the northern hemisphere and on December 21/December 22 in the southern hemisphere. This year it has fallen on june 21.
At the time of summer solstice, the earth's is in such a position that one hemisphere is most tilted towards the sun, causing the sun to appear at 23.45 degrees above the celestial equator, thus making its highest path across the sky.

During the summer solstice in nothern hemisphere the sun appears to be directly overhead at midday along an imaginary line on the Northern Hemisphere at latitude 23.45 degree north known as the Tropic of Cancer.Similarly during the summer solstice in southern hemisphere the sun appears to be directly overhead at midday along the imaginary line Tropic of Capricorn.

June 20, 2006

June 19, 2006

A great step down

16th of this month, Bill Gates announced that he will step down from his day-to-day role at Microsoft Corp. in July 2008. Yes! It’s shocking news both good and bad. Ray Ozzie will immediately assume Gates's job of chief software architect and Craig Mundie will become chief research and strategy officer.

The public reason for Gates to step down is to spend more time at the Gates Foundation. The big question is : “ Will Microsoft be able to handle its rivals without the GREAT man?”. Company’s like Google Inc is way ahead of Microsoft in many grounds. What about the new Windows? The next version of windows named “Vista” is yet to be released. Important point is it has been delayed several time. Will Microsoft survive without the great architect? We shall see…

June 18, 2006

Placement Statistics

Here is the placement statistics so far at Vellore Institute of Technology. Our placement season for 2007 batch students started on 12th june with TCS being the first company.

TCS : 525
CTS : 232
Infosys : 108

It took TCS three days to complete (12,13 and 14). CTS and Infosys completed in one day itself. To finish it in one day.. CTS and Infi conducted small interviews... So those who where smart to show their communication skills got through.
The next company in line is Wipro and the IBM. We have to wait and see how many they pick!

June 17, 2006

Relax Relax Relax!

My new policy… Relax! After being placed I have learned to relax. A better word will be “Sleep”. Guess the number of hours I am sleeping. The “No classes” day puts me into a very simple schedule mainly sitting on comp or sleep.. So I am either on net or sleeping! So… My time is slow and steady…

I see others preparing for their interviews or roaming around with question papers!
My next activity is to teach them some things.. I have a class on Linux tonight! And after that I will be back on net.

The Infi people (Infosys) are here to recruit and I will give the statistics at night once the results are published. Till then its happy hunting ghosts on net!

June 16, 2006

Canara bank's great service

I am tired of the service provided by Canara Bank!! They don't have any commitment nor any customer satisfaction program. What I am talking about is their ATM service through out the country. It’s simply the worst.
Canara bank’s great services are:
1. Non functioning ATM (Sorry ATM is closed. Please try later).
2. No security at ATM.
3. Unclean ATM box.

What customers will mostly worry about is the first one. Look what I got when I visited Vellore ATM today (photo).

The manager of Vellore main branch is too cool. He will say it’s not his problem and he doesn’t know about it and other silly things. Anybody will wonder who put him there! And the time I have to wait?? 2 to 3 hours. This has happened not once or twice, but many times. One day the ATM machine goes out 2 or 3 time that too at peek time like 10.00 am to 1.00 pm and 3.30pm to 6.00pm. I am wondering how they and go about with their punch line “serving to grow, growing to serve”.

June 15, 2006

Final Day

Morning turned out to be fast and horrible, but i did manage reach F block in time for the HR...
But for some funny reason... my HR turned out to be technical.. the panel asked me about the projects... made me explain the projects in detail... had to go into it and explain.. I ended up writing small codes too.. but it was over in 30 min!

The afternoon went slowly as i thought of the results... i couldn't sleep. The results where to be anounced at 7.30 and the event was delayed by 1 hour or so... finally the time arrived.. our placement dean along with the placement coordinators came to anounce the result...

And.... yes... My name was called...

June 14, 2006

Technical Interview

Night was long... no questions about it... I managed to wake up at 6.00 and do some study. Started with Java,networking,OS then Software engineering and back to networking. Initially my interview slot was at 5.30pm.. so i was going at slow pace... around 11.00am things changed. The interview was prepond to 2.30. We where supposed to report at the F block (where the interview was going on) at 1.30. Goodness!!! things changed so quickly..
My technical interview had two people. Oae a lady... my guess is .. she is from kerala... so as i entered and wished them .. she asked if i was from kerala... !! but that question had no effect with the interview. They did manage to srew me little but by the end of the interview I could manage and brought the interview to my side. He he!!!
Now It's time for HR... yet another long wait of 3 hours and i came to know that it will be held tomorrow morning... yet another night of tension!

June 13, 2006

Campus Placement

Time has come for me... today was the starting for placements season for 2007 batch of VIT. With the first company being TCS you can guess what was going through all our minds. Auditorium was packed by 9.30, but the function called Pre - Placement Talk started off at 10.00 am.
This time TCS had changed their examination .. they have made it online..
After PPT ( Pre-palcement talk).. we where split into 5 batches for the online test, and I was in batch 3. This was supposed to be followed by the interview but due to large number of students.. they moved to for tomorow!