Friday, December 26, 2008

Cygwin - An Intro

Cygwin is not something new for most of you but this blog post is meant for those students/developers who hate using(or at least installing) Linux/Unix on their system (because they have to partition their hard disk) but they have to install it just because they want to use gcc and g++
Because, I have seen many students in my department and in others too, who try to install Linux on their hard disk and in the process either corrupt it or delete some Windows partition accidently, so I hope this entry could be of some help to them.

Though, you always have the option of using Dev C++ or Visual C++, and Dev C++ also claims to be using gcc/g++. (Don't know abt Visual C++)
However, what do you do if you want to use gcc/g++/gdb/make on command line with some command line options like -o, -c, -I, or -shared. What if you want to create a shared library (or a DLL) using gcc on windows ?
One way out(the only way i know of :p) is to use Cygwin, which is nothing but a Unix-like environment for Windows. There are many packages that you can download & install along with the normal base packages to make it function just like Unix. 

I came across it when I started with JNI (Java Native Interface) (a way for Java code to interact with non-Java code....a topic big enough to span another blog entry :-)....see the tutorial for JNI here)
Because, I needed a GNU C/C++ compiler to register with an IDE (in my case NetBeans), so I downloaded Cygwin as per instructions in the tutorial and installed it, though with some problems. But, it was really good to have unix-like functionality on windows system, to be able to execute unix commands from my command line. Now, I do not need Dev C++ to compile my c/c++ programs on windows.
My advice to all budding programmers/students that they must try Cygwin at least once. Try installing it and even if you fumble, there is a lot to help you...try reading setup over the problem and you will be home surely.
More precise and accurate information about how to download and install Cygwin can be found here. A must try even if you are biased towards Java (like me) :-)

Thursday, November 13, 2008

Golden rules for Overriding

This blog entry sums up "all-you-ever-need-to-know" about Overridding Methods in Java. So just follow these simple rules and you will be home. :-)

Golden Rules:
  • The overridden method must have same number and type of arguments(i.e. the same signature) as in the original method of the superclass. Very simple to understand, so go ahead. :-)
  • Methods marked as final or static cannot be overridden. Although, a superclass and subclass can have static methods with same signatures, but that doesn't mean that you have overridden the method of superclass, rather these are inherently separate methods.
  • The overriding method CAN have less restrictive access modifier than the overridden method.
For Example, the following code would compile successfully
>   class base
>   {
>        protected void test()
>          System.out.println(" Base");
>       }
>   }
>  class derived extends base
>  {
>          public void test()
>      {
         System.out.println(" Derived ");
>      }
>  }
  • The overriding method CANNOT have more restrictive access modifier than that of the original method of the superclass.
SuperClass Signature - protected void test(){ ... }
SubClass Signature     - private void test(){ ... }
This won't work. 
  • The overriding method CAN throw any unchecked exception regardless of the overridden method.
> class base
> {
> void hello()
> {
> System.out.println("base");
> }
>  }
> class derived extends base
> {
> void hello() throws RuntimeException
> {
> System.out.println("derived");
> throw new RuntimeException("My Exception from Derived");
> }
> }

  • The overriding method CANNOT throw any broader or new checked exceptions as compared to those thrown by overridden method. However, the overriding method CAN throw any narrower or fewer exceptions.
For Example, this is allowed:
SuperClass Signature - void disp() throws Exception { ... }
SubClass Signature     - void disp() throws RuntimeException { ... }

while this isn't:
SuperClass Signature - void disp() throws ArithmeticException { ... }
SubClass Signature     - void disp() throws RuntimeException { ... }
  • You can override only those methods that you can inherit. So, beware of code which seem to override private methods. 
  • The overridding method return type must be same as that of overridding method or it can be subclass of the original return type. 
> public class overriding
> {
> public static void main(String[] args)
> {
> derived d = new derived();
> derived e = d.print();
> e.print();
> }
> }
> class base
> {
> public base print()
> {
> System.out.println(" Inside Base ");
> return new base();
> }
> }
> class derived extends base
> {
>          @Override
> public derived print()
> {
> System.out.println(" Inside derived ");
> return new derived();
> }
> }

Here, the print() method is overridden though it doesn't look like that. This is known as Covariant-return type and it will work with code written for Java5 platform and above.

For any comments, suggestions or corrections, please leave your comments. :-)

Saturday, November 8, 2008

Many Public Classes in 1 Java File !!

There is a popular misconception among the beginners that we can have multiple public classes in one java source file.
But the rule is that "we can have atmost one public class and any number of non-public classes in one .java source file". The public class must contain the main method, from where the execution begins. As i see it, this is so that JVM could access and call the main method from outside the class. 

However, there is one exception to this rule. I wrote this blog entry because i came to know about the exception :)
The exception comes when we deal with inner classes. You can have as-many-as-you-want public inner classes in your class. But, it is not desirable as it results in difficult-to-manage code and of decreases its re-usability. 

For example, the following code would compile and run successfully.
>  class tryme
>  {
>     public static class A
>   {
>   public void print()
>   {   System.out.println(" Print inside A ");   }
>   }
>   public static class B
>   {
>   public void display()
>   {   System.out.println(" Display inside B ");   }
>   }
>  }
>  public class test
>  {
>   public static void main(String[] args)
>   {
>   tryme.A ob = new tryme.A();
>   ob.print();
>   tryme.B ob2 = new tryme.B();
>   ob2.display();
>     }
>  }

Of course, the file must be named It compiles and produces the following output.
> Print inside A
> Display inside B

Another way of using public inner classes is by importing them in your program like
import packagename.tryme.*;
and then use classes A and B as they you like.

But, the recommended style of programming discourages use of more than one public class in one java file. Also, such behaviour is not supported on all compilers. Infact, for maximum optimization (by compiler) it is recommended that you should write one class per java file.

Comments and corrections are welcome. :)

Monday, November 3, 2008

Static Imports in Java

Java as a language, continues to evolve and amaze developers and students alike with new innovative concepts and features. Java 5 is a major release which includes various additions like Generics, Autoboxing, Enumerations, Enhanced for-loop, Static Imports, Var-args, Serialization, Covariant return types, Annotations etc. to name a few.

Discussing each one of them would span multiple blog entries. So let's start with Static Imports as of now. Hopefully, I will devote an entry to each one of these in the coming days. :-)

Before I begin with my explanation of Static Imports, I would like to ask you something..........
Are you sick and tired of using fully-qualified static members of some other class (can be a library class too) in your program such as Math.PI whenever you want to use 3.141592653589793.... or Math.sqrt() when you need to find out square root of any number ??

Of course, these are simple examples which are short and easy to remember, so they might not seem a headache. But things can get quite complex and it can turn out to be burdensome to repeat a long fully-qualified name time and again in your code. 
Static Imports come to your rescue. :-)

With the help of Static imports, you can very well use the static members of any other class (to which you have access) like the members of your class i.e. there is no need to fully qualify the name using package name and class name 

Normally an import statement would look like 
import packageName.className.memberName;

A static import would just add the word "static" after import 
import static packageName.className.memberName;

An example would make it more clear....

>  import static java.lang.Math.*;
>  public class tryme
>  {
>    public static void main(String[] args)
>    {
>      System.out.println("Square root of PI is "+sqrt(PI));
>    }
>  }

The advantage lies in the fact that you dont have to type Math.PI....a simple PI would work....
I agree that its a small feature and not as important as other features that Java 5 has introduced or enhanced, but then as they say "Boond boond se hi gaadha badhta hain"

Limitations :
It applies to only static members, not to instance variables 
It can make code un-readable and difficult to debug, if used unnecessarily and in excess

Mostly it is used to discourage the technique of declaring constants in interfaces and then implementing those interfaces by your class. An interface is a part of public API and it defines services that your class should provide, and so it is not recommended to make constants a part of your public API. Instead, it is always preferable to use Static Imports.

Thursday, October 30, 2008

equals() & hashcode() relation in Java

I assume that you have an idea about equals() and hashCode() methods present in Object class. What you may not know, is that a relation(or perhaps a contract) exists between them.

Remember the following points:
  • If you override equals(), then you must override hashCode()
  • equals() & hashCode() must be evaluated based on same fields
  • If two objects are equal using equals() then they must have same hashCode() value, but vice-versa need not be true.
Since hashCode() value of an object determines how it will be stored and located when it is used with collections like HashMap & HashSet, so it becomes necessary that equal objects must have same hashCode() value. 
So, implementing hashCode() when your program deals with collections become really important for reasons such as efficiency and correctness.

To give an analogy to this hashing process, imagine a sequence of buckets to be your hashtable. Now, to retrieve an element, we do
1. Locate the right bucket using hashCode() value
2. Search the bucket for the element using equals()

Now, if two equals objects (which would be present in one bucket) have different hashcodes, you would never be able to retrieve them back correctly, because you are not looking in the right bucket. 

Although, it is legal to have same hashCode() value for different (read unequal) objects, but it will hurt the efficiency as it would make it a bit slow to locate the correct bucket.

Also, if two objects have different hashCode() values, then they must not be equal using equals() i.e.
if x.hashCode() != y.hashCode() then x.equals(y) == false.

This also helps in clearing a popular misconception about hashcodes that they identify an element uniquely. They can be used as an object ID but they are not necessary unique.

Still interested in more details, read this article to get more insight. :-)

Monday, September 8, 2008

Google's Chrome - A Review

If you are here or if you are an aware IT professional/student, then there is no way that you haven't heard of Google's Chrome

For those, who still do not know what Chrome is, it is an open-source web browser that has been built from scratch by Google. Another feather in their cap, this browser promises a lot in its beta version that has been released for Windows Vista/XP SP 2 so far. The Mac and Linux versions of Chrome are under development and will be released soon.

Chrome offers you a world of rich features to play with. The major features are
  • OmniBar - The URL box in Chrome is called OmniBox as it shows you pages based on your web history, your bookmarks, popular searches, results of Google Suggest as you type words in the URL box. OmniBox can also be used to add a bookmark quickly. Thus, there is just "one box for Everything". Can be annoying sometimes, but if you do not delete your browsing history often, it tends to settle down the dust and offers you exactly what you want.
  • Incognito Mode - By default, Chrome saves all your web history on the local system and uses it for several purposes. The web history could be seen later also by anyone using your system. So, if you do not want your browser to keep a record of what you are surfing, then you can open a new window in Incognito Mode and the browser would not save any cookie related to that page. Looks useful, but there should be an option to configure Chrome to change this default behaviour of saving web history because some users might just not want to save all work they do because they work on systems that many people share.
  • Crash Control - Google claims Chrome to be more stable and safer than a lot others as a crash that occurs due to one tab would not effect other tabs of the same window. Traditionally, a browser creates a new thread when a user creates a new tab in a window. Chrome differs from the ordinary by creating a new process per tab. This means that separate data structures, more memory usage for each tab you open but that also means no dependence between various processes (or tabs). Google claims that it won't affect speed as much as we think it will because Chrome is based on WebKit, an open source rendering engine which uses memory efficiently. My experience with Chrome begs to differ with what Google has to offer. On my system, Chrome has CRASHED twice within a week of its usage and the fact that I was not running heavy web applications at that time is really scary. Also, I missed the restore session option that I have with Firefox.
  • Speedy - It is definitely faster than its counterparts like FF and IE. Firstly, it does not takes much time to open up and also the browsing experience for users with a slow net connection(like me) has improved with Chrome. Thanks to the new Javascript Engine V8, that Google has developed for the browser.
  • Chrome Task Manager - I do not know if such a facility exists with Firefox 3 or IE 8 beta version but it surely helps you to understand which tab is going "sad". It really treats each tab and plugins within a window as a separate process and shows the amount of memory used by each one of them.

Several things that don't work for me includes crash control and inability to scroll up when i use the scroller of my laptop. However, scrolling down works very fine. It gets a bit frustating not being able to scroll up and using the keyboard to achieve the effect.

The best thing that I like about Chrome is the comic book that they have released. The comic book proves the saying that "A picture is worth a thousand words". Its not only simple and easy to gather concepts but also entertaining, even for a layman like me, who is unaware of functioning of a web browser.

One thing that I fail to understand about Google chrome is that inspite of being Open Source, it is released for Windows first(something that can never be open source) and the Mac & Linux versions are still in the making...

It would have been definitely better, had Google released it for all OS's at the same time.
Perhaps the product was such that, Google could not hold it any longer after working so hard to develop it. They were desperate to release it and see the feedback and wild reactions. Still they wil miss out the feedback from the real open source community, which i believe do not use much of windows :-)

But one thing is for sure, Chrome is here to stay, no matter how many times it crashes....I won't stop using it :-)
And if you still haven't tried it yet, go here and download it right now. Happy Chroming !!

Wednesday, August 27, 2008

Tech Talks @ DU

There's a lot happening at Department of Computer Science, University of Delhi, when you talk about interesting tech-seminars taking place.
Recently, we had a talk on "Open Source : How we already use it" by Aadhar Mittal, our new Sun Campus Ambassador. It was an introduction to Open Source, much needed for the new batch. He started by giving some insights on Open Source and gave examples from daily life that how we already make use of so much Open Source Software(OSS) without knowing about it. He talked about advantages of OSS and told how big companies like Sun mint money from their OSS. It was an eye opener for the first years since it was their first talk. I'm sure he's going to blog about it pretty soon and put up some nice pics....:-)

Now, the big one. Today, we also had a great lecture by Prof. Christelle Schraff, Pace University, New York on "Towards 'More' Correct Software". She talked about various phases of SDLC giving emphasis on testing. She also gave a short demo on JUnit (she used it in Eclipse) but the same can be done with NetBeans too. She also talked about Java Assertions and showed us the Rational Functional Testing Tool but it was too slow on her machine. She talked in brief about formal methods like theorem proving and about some of her open source projects. It was definitely an interesting seminar with the students getting lucky enough to get a chance to meet and interact with professors of her status.

Sunday, August 17, 2008

Java Interview Questions

Based on my exposure and experience with the language, I have listed some important Java(Core) questions that I think can be asked in any interview related to Java. I'm not listing the answers with them over here, but that does not mean that I do not know them :))
The only reason for not writing answers here, is that it would unnecessarily increase the length of the entry, but if you have doubts in any question, you can ask me in the comments section or can mail me.


Ques. 1 What makes Java Portable?
(The answer can spark discussion of things like Bytecode, VM so be clear with your concepts)

Ques. 2 List some features of Java that are not present in C++
(List 5-6 main features that makes the language more powerful)

Ques. 3 Is Java Slow as compared to C/C++?
(Google over it if you do not know or ask me)

Ques. 4 Differentiate between JDK. JRE and JVM.
(Ok, read this link and you are through) :-)

Ques. 5 How are interfaces different from Abstract Classes.
(Pretty simple one)

Ques. 6 List major OOPS principles and tell how each can be implemented using Java.
(simple & still Frequently asked)

Ques. 7 Parameter passing in Java.
(may be this can can be indirectly asked by giving a piece of code)

Ques. 8 How many classes can you have in 1 .java file?? How many of them can be public ? Why so ?
(if you do not know this, its high time you clear your basic concepts)

Ques. 9 Is Java a compiled language or interpreted language ??
(Ans: It is both compiled & interpreted. You need to explain in detail the conversion(compilation) of .java file into .class file(s) using javac and then execution(interpretation) of the .class file by the JVM)

Ques. 10 Talk about Garbage Collection in Java.
(very frequently asked)

Ques. 11 Can we force Garbage collector to run in Java ??
(ans is no, we can only give it a hint, not a command.... Google to know more)

Ques. 12 Is Java purely object-oriented ??
(perhaps this would help)

Ques. 13 Can we call C++ code in Java ??
(can be done using Java Native Interface (JNI), if you need to know more, Google is your best friend)

Ques. 14 Tell 3 uses of final keyword.
(typically textbook based question)

Ques. 15 Why an abstract class cannot be final ?
(don't tell me you don't know this :p)

Ques. 16 Which version of Java have you worked on ? What are the different versions of Java ? How they differ from each other ??
(Tough one if you don't know it. At least remember 2 or 3 main points of differences between Java 4, 5 & 6 such as with Java 5 new features such as Auto-boxing, variable arguments, co-variant returns (in overriding) but you also need to know what they mean. Explaining them here would require another blog post)

Ques. 17 Tell how many different types of variables are possible in Java.
(Tricky! Talk about Local Variables, Instance Variables & Class Variables)

Ques. 18 What are immutable objects? Give an example of immutable object in Java.
(Hint: Eg is String objects are you have to find it your way)

Ques. 19 What is Serialization ? How it can be implemented in Java.
(If you can answer this in an interview, they would seriously consider you as not many ppl can answer this so read about it & talk about the concept first and then talk abt Serializable interface)

Ques. 20 Discussion restrictions placed on method overloading & method overriding and compare the two.
(another textbook based.......but consult a good textbook :p)

Will keep on posting new questions that I feel every Java developer (rather every aspiring student) must know, whether he wants to clear his interview or not !!

Waiting for Comments :-)

Friday, August 15, 2008

Java is Pass By Value !!

Although most books on Java(except a few good ones) will beg to differ and say that "In Java, primitives are passed by value and objects by references"
But, this is not true. Or you can say that it is 50% true.
Because, even Objects when passed as parameters to a method are passed by value !!
Hard to Digest !!
But it is TRUE. This is not to say that changes are not reflected back when objects are passed to a method.

Actually what happens when you try and pass an object as a parameter is that the bit representation of the actual parameter(lets say the address of the actual object on the heap) is COPIED to the formal parameter. So at this time both references are pointing to the same object on the heap and thus any changes made to it are reflected back in the calling code.
A proficient C programmer is not akin to this concept as it works in C exactly the same way.

Try out the following program to understand how parameter passing works in Java.

class myClass
int val;

myClass(int x)
val = x;
void display()
System.out.println(" Value is "+val);

class test
static void modifyValue(myClass o)
o = new myClass(20);

public static void main(String[] args)
myClass ob = new myClass(10);

The output is
Value is 10
Value is 20
Value is 10

Third line says that the value of object ob has not changed after passing it to a method and making changes there.
This happened because objects ob and o are different entities and changing o (the reference) bit pattern (the address) by creating a new object won't affect ob in any way.

The bottom line on pass-by-value : Java is actually pass-by-value for all variables running within a single VM(virtual machine).

Exception to this rule is perhaps :
1. Parmeter passing in RMI (Remote Method Invocation)

Comments & Corrections are Welcome. :-)

Sunday, July 20, 2008

Drupal & Joomla to your Rescue !!

Have you ever felt that the process of making a web site tedious, time-consuming and lengthy process and spent more time than is actually needed ??

Or have you ever felt the need to build an interactive website really fast, may be for a semester project ??

If yes, then Content Management Systems (CMS) like Drupal & Joomla! are exactly what you need. This is not to say that only in these CMS would work only in these situations. They can be used by experts as well as novices to build rich-featured, reliable, easily administered websites by providing them an extremely flexible and highly configurable environment to operate in.

Let's see what is a CMS ?
CMS stands for Content Management System. It can be seen as a software package that can be used by individual or community of users to easily publish, manage and organize a wide variety of content on your website.
CMS eases the process of building websites by being flexible in nature and providing the developer with high degree of configuration and customization.
Also using CMS, one need not be proficient in scripting languages like PHP, however basic knowledge would help.

Well known CMS like Drupal & Joomla! basically need Apache Web Server, MySQL database, and PHP to work on, so you basically need LAMP(Linux, Apache, MySQL, PHP) stack whereas with Windows, you need a WAMP(Windows, Apache, MySQL, PHP) server. You can download the WAMP server here.

So before you start using any one of them, make sure that your web server is properly installed.
For windows, you need to perform the following steps:
  • Install the WAMP server on your local machine.
  • Download Drupal or Joomla! dump from their respective sites and depending on whether you use localhost or remote web server, you need to unzip files from the dump to a correct location.
For localhost development, all that is needed is to copy paste Drupal's or Joomla's files to a folder on your WAMP server i.e. make a folder in www in your WAMP server and place all the files there. Then run in a web browser, http://localhost/name_of_folder and follow the installation instructions

For remote web server, an extra step is that you need to FTP these files to the server using any FTP client like FileZilla and then follow the installation instructions.

Drupal eases your installation task by providing you with a videocast on how to install and configure your CMS, that is really really useful for novices like me. :-)
Joomla! also provides you with detailed installation instructions that helps you with any issue that you might get into.

Having being used both of them, i can say that Drupal is much more extensive in terms of features and functionality that it provides to the developer. May be because it is in existence for a longer time than Joomla!. But, it also makes Drupal user-interface more overwhelming (not complicated though) and sometimes frustating for the newbie. But one should devote some more time in understanding the basics, its architecture and workflow.

This is not to say that Joomla! is not good. On the other hand, i would recommend students to begin with Joomla! and then slowly graduate to Drupal But still i found it pretty easy to set permissions in Drupal than in Joomla!. There are several tutorials on both of them and I'm not really an expert to compare the two. The bottom-line is that both are useful and extensible in their own right.

Using a CMS, you can easily make website for your school/college clubs or alumni portal providing features like discussion forums, creating polls and voting on them, giving each user a facility to create and manage their own blog using a blogging API, creating, editing and managing articles, stories, pages as well as commenting on other's posts, uploading files onto the server and much more. It provides a plethora of options to the administrator as well and helps him/her to have total control on the flow, thus making your website secure, reliable and safe.

With Drupal and Joomla! being open-source, they are backed by a huge community of users and developers who continuously keep on developing new innovative modules and themes which can be downloaded as such (free of cost, obviously) and used within your website. Thus, they make your website easily extensible and flexible in nature.

Thus anyone, who is interested in creating websites on-the-go can definitely give these frameworks a try and end up learning quite a lot.

There is so much more to share about these exciting systems, but I think I have already written a pretty long blog, so will continue sometime later...

Saturday, July 12, 2008

GWT - Have you tried it ??

What's GWT ?
Google Web Toolkit is an open source Java development framework that can be used to build web applications using AJAX easily and you do not have to worry about issues like cross-browser compatibility.

GWT Major Features:
  • Real-time debugging
  • Cross-browser compatibility
  • Reusable UI Components
  • Simplified DOM API
  • Completely Open Source
One of GWT's major strength is GWT's Java-to-JavaScript compiler which translates the Java source code into equivalent JavaScript code which can be run in web mode on any web server.
Also, during development you can run and debug your application in hosted mode by running it as Java Bytecode within JVM using GWT's Hosted Web Browser.
To get an overview of the its architecture, please see this

On a downside, there are few issues still unresolved:
  • GWT 1.4 does not support JDK 1.5 version but GWT 1.5 Release Candidate do support it
  • Also, GWT does not support several concepts in Java such as Reflection, Finalization, Assertions, Multithreading & Synchronization, mainly because JavaScript does not provide support for them.
Certain links that i think any novice (to GWT) would find useful
So, what are you waiting for !!
If you haven't tried it yet, download it right now here and have fun making easy to use and interactive good looking web applications.

Sunday, July 6, 2008

Interesting SQL Query

Write a SQL query to compute the Nth Maximum Salary

Lets get started with an easy one.
Write a SQL query to compute the 2nd Maximum Salary

select Max(Salary)
from Employee
where Salary != (select Max(Salary) from Employee);

To see how it works, you need to understand how a nested query is executed:
First the innermost (nested) query is executed and its result is placed in a temporary table, then the outer query is executed which uses that result.

So if you have to find the 3rd Maximum Salary, you could extend the previous query by increasing one more level of nesting. And so on.

A more interesting and simpler way to find Nth maximum salary would be the following correlated subquery

select * from Employee E1 where
(N-1) = (select Count(Distinct(E2.Salary))
from Employee E2
where E2.Salary > E1.Salary );

Let us now see how this correlated query works:
For each tuple of table Employee, the inner query is executed once and
the result is now stored in some temporary form which is used by the
outer query.

Thus, this correlated query takes O(n*n) time (quadratic time) as compared to linear time {O(n+n) = O(n)} of nested queries but it is still better than nesting the query n number of times as that would result in cumbersome code. However, both would take equal time. :-)

The best way to understand the query is to dry run it on some sample data and some value for N

Is Java "Purely" Object-Oriented ??

There are two schools of thought here......obviously disagreeing on the issue.

One, considers Java to be purely Object-oriented language as
Every single program that you can write in Java has to be encapsulated
in a Class (unlike in languages like C++) i.e you cannot write any java
program without having to write a class and since we know that every

class in java implicitly extends Object class, thereby exhibiting characteristics and features of an Object-Oriented Language.

On the other hand, some people refute the previous claim by saying that
Since there are primitive data types in Java such as int, double, char, boolean etc. and we can write a simple program in Java without having to create any object or without having to use other objects or predefined classes, so it can't be called as a completely object-oriented language, especially when we compare it with languages such as Smalltalk, Python, Lisp etc.

As it goes, I'm also a bit confused on the issue but i would like to believe that Java is a
purely object-oriented language.

Any comments, corrections are welcome and required. :-)

Tuesday, July 1, 2008

My Blog Wins Award

My Blog Entry JavaMail for Starters !! is one of those few, which have won themselves quite a fortune in Sun's Student Review Contest on NetBeans and OpenSolaris. You can see the complete result here.

The blog entry was about how to send Email from a Java Application, making use of JavaMail API. The blog was written for the target audience, primarily unfamiliar with such API's and using them with NB.

Tuesday, June 17, 2008

New Sun Campus Ambassador for Delhi University

I'm feeling extremely happy to announce Aadhar Mittal as the New Sun Campus Ambassador for Department of Computer Science, University of Delhi.
Aadhar Mittal is pursuing Masters of Computer Applications (MCA) from University of Delhi and is immensely talented and hardworking student.
Hope that he carry forward the legacy and do wonders. Wishing him all the best for all his future endeavours.

Also, if you haven't tried Mozilla's FireFox RC 3 till now, go download it here and see why people (read smart, intelligent and trendy people) do not use IE anymore. :-)
I just love the way its Smart Location Bar works. It also helps me manage my bookmarks easily.

Wednesday, May 28, 2008

Back From Sun's Portal....

Though I'm no longer a CA, that does not mean that Sun has stopped shining on me or for that matter, on Delhi University Computer Science Department.

Some of my junior would take over the work and the responsibility from me and carry forward the legacy. And i will also continue to post technical stuff over here. (because, I have started enjoying blogging and have realized various advantages of having a good blog).

Having said that, these days I won't be able to blog much as I'm busy in preparing for my placement. But I will back soon. :-)

Tuesday, February 5, 2008

Diverting Traffic

Well, the good news is now i will be blogging on
My Sun Blog
and you can catch up with me there and get to know all about the latest happenings and emerging trends (read Sun Microsystems Technology) and much more.

Agraj Mangal

Monday, January 21, 2008

SUN shines @ Sankalan 2008

Now thats a biggie for me :-)

Well. the good news is that Ms. Anuradha Sen (my coordinator from SUN) along with Mr. Ajay Ahuja (Learning Services, SUN Microsystems) would be coming to deliver a talk on "Sun Microsystems: Choice, Innovation & Value". This will introduce the participants to Sun Technologies and offerings in terms of products and trainings.
Its great to have their presence with us.
I, as the campus ambassador for Delhi University, would be responsible for managing everything related to it. And am i not happy? (to say the least, i'm excited, anxious, curious, confused, thrilled)...i hope you can see the mixed feelings. :-)
It would be a pleasure to meet such learned ppl and learn from their experience & knowledge. Really waiting for the big day.

Do not miss this opportunity to meet some learned people from the industry and win lots of prizes/certificates/trophies by winning competitions.

For further details on Sankalan 2008, please visit

Sankalan 2008 : Compiling Innovations !!

Hello Friends,

I take pride in introducing to you with our annual technical festival, Sankalan 2008, organized by Department of Computer Science, University of Delhi. It goes like:

We, at the Department of Computer Science, University of Delhi, welcome you to our annual technical festival Sankalan 2008. Sankalan provides a platform for students pursuing IT courses all over India to come together and test their technical and non-technical skills through various events like
  • Technical Quiz
  • Web Designing
  • C++ Programming
  • Debugging Challenge
  • Overnight Project Designing
  • Algorithms etc.
This promotes the enhancement of knowledge through talks and lectures delivered by eminent speakers.
Apart from technical events, there are some non-tech events also like JAM, Turn Court etc are also there to entertain people.
Teams from premier engineering and technological institutes across the country are expected to participate in the festival. Besides, there will be a sizeable gathering comprising of students from various colleges of DU .

Following are the details:

Sankalan 2008......Compiling Innovations
Date : 2 and 3 February 2008
Venue : Conference Centre, University of Delhi, Delhi 110007
Website :
Email- id :
Eligibility : MCA/ Msc Comp Sc/ B.Tech/ M.Tech/ B.Sc(H) Comp Sc/ B.Sc(G) Comp Sc/ BCA

We look forward to your participation and welcome you to the event.
We are also open to suggestions and comments. :)
Hope to see you there.

Tuesday, January 15, 2008

First Visit to Sun's Office, New Delhi

The day before, my mail read "Lets meet tomm at 10 at office" :-) and i was amazed to see 'no' address mentioned. I quickly called up my coordinator and asked her about the plan. And the destination was Munirka.
Now, for those people who do not already know, traveling in Delhi is not an easy job and that too, when you are unaware of the destination :)

So reaching office at 10 was not going to be easy. And i did not wanted to be late in the very first meeting. Always believed in "First impression is the last impression" stuff :p

So i left home at 8.15 and fighting the chilly winter, managed to reach there by 9.20, thanks to my bro (he gave me lift till Moti Bagh)
Well going to Munirka from there, was no big deal and i was getting nervous with each advancing step.

Then followd some pretty good moments of my life. I saw the Sun Microsystems Logo and the board welcoming me at the 5th floor.
Well i reached a lot early before time and my coordinator was not present there (obviously she has more important work to do and is not as free as i m) :-)

But getting a feel of that office was like once-in-a-lifetime experience. Though i sat at reception for a few minutes, my eyes were glued to the interiors(read infrastructure + facilities) of the office and it was really overwhelming to see a cool laptop and an Apple Machine on almost each desk !! Dont know why someone would want to play with two powerful machines at a time.
(even more amazed to know that this is not a development office) Still they need all that stuff...!!
But the staff over there was very friendly. They offered tea/coffee/water 3 or more times to me. and i was beginning to feel happy :-)

Meeting Anuradha Madam (my coordinator) for the first time was a pleasure. She came with another CA (Anwesha) and we had a small meeting, where we discussed about how can we create more awareness in Delhi and about communicating with other CA's.

All in all, it was something i think i will never forget. Its not like that i have not been to other companies before, but none was like this. :)

I hope they will have more meetings in future and i guess i got to meet more people working over there....

Monday, January 14, 2008

Excerpts from my presentation : A first at DU !

So, finally I presented my first technical demo at the campus (Delhi University) today. And yeah, it was fun.
Since, it was the my first tech session, so i started off by talking about Sun Microsystems and the role they are playing in Open Source Arena.
Then i talked about the Campus Ambassador Program (although many already knew about it). Also i talked about various benefits of a product/technology being open source.

The talk was attended by around 100 students from my department and 2 faculty members. Also Mrs. Anuradha Sen took out some time from her hectic schedule and made it a point to attend the talk. Would really like to thank everyone to make it a success.

Madam presenting bouquet to Anuradha Madam
(Reader @ Department) (My coordinator from SUN)

The topic of the talk was "Web Services with Netbeans 6.0". The talk included a detailed description of some cool features of Netbeans 6.0 and its comparative study with IBM's Eclipse.
The particular points i stressed on were:
> What is Netbeans 6.0 ?
> Why Netbeans ?
> Whats New in Netbeans 6.0 ?
> Why Netbeans rocks over Eclipse (spent 2 slides and 10 minutes) :-)

It also talked about the out-of-box support that the IDE provides, especially for Java EE 5.
Then i introduced them to the world of Java EE 5(something completely new to them) by introducing to them, the basics of Web Services.
It includes points like:
> What are Web Services ?
> Why Web Services are required ?
> History of Web Services (talked a bit about the technologies before the advent of WS)
> What earlier distributed systems (DCOM, CORBA, RPC) lacked :
--> Interoperatability
--> Firewall traversal
> Simple Web Service Architecture
> About w3c standards for Web Services
> Advantages :
--> Interoperable
--> Accessible
--> Economical
--> Automatic
--> Available
--> Scalable

It followed with a demo showing them how easy it is to create, deploy and invoke a web service by using (Drag & Drop) in Netbeans.
Also stated the process going behind the scenes and the role Glassfish plays in it.

Glassfish is an open-source implementation of Sun's Application Server. And i also talked about how Tomcat differs from Glassfish.

I showed them the messages that Netbeans & Glassfish displays when we run the project and while deploying and invoking the web service.
What i could not show, was how to decipher those messages as it would have been really advanced for an introductory session.

I also talked about the ease with which you can use almost any application server with Netbeans and why you will never need any other Application Server as long as you have Glassfish.

I did not failed to mentioned that Glassfish is already shipped with the latest version of Netbeans and how it is fully compliant with Java EE 5.

At the end, i gave them the URLs of the various resources that they can lay their hands onto.
Also Anuradha Madam talked a bit about SAI(Sun Academic Initiative) and cleared a few doubts.

I also distributed some freebies (caps and pens) to the students in the question-answer session. And some refreshments were also given to the students after the talk.

Some points to improve upon:
I overshooted the time : took almost 2 hours ;)
I have a tendency to divert from the topic and i did it some times during the presentation.
And if you would like to add on to it, i would really like to hear. :-)

All in all, it was an interactive session with the students, an amazing experience and something that i will always remember, in spite of how many more demos/presentations i give.