December 28, 2006
Scripting in Java
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!!!
RULE 1: Life is not fair - get used to it.
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!
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?
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);
Compiler 2: (Visual Studio 6)
Compile 3: (GCC 3 and Above)
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
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
- 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
October 11, 2006
Importance of "Self-Googling"
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
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!
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!
Semester | CGPA |
I | 8.78 |
II | 8.86 |
III | 8.93 |
IV | 8.83 |
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:
June 23, 2006
Hand of God goal
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 : http://www.diegomaradona.com/ingles/iindex.html
June 21, 2006
June 21: Summer solstice in the Northern Hemisphere
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
Thought for programmers
June 19, 2006
A great step down
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
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!
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
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...
I AM PLACED IN TCS !!!!!!
June 14, 2006
Technical Interview
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
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!