Saturday, December 20, 2008

My first Pav Bhaji

A have been cooking regularly now. It is a great feeling to cook and more than that cook good food. Fortunately, i can cook good food. That may be because my mom is a good cook and I love food.

Wednesday, December 17, 2008

A December Snowy Morning

Its December and it has started snowing. The train is passing through the snow covered tracks. Small shrubs trying to peep out through the snow covered blanket. Its the first snow this winter and the first snow I have ever experienced. I am familiar with heavy rains and always wondered how it would feel being under a snowfall. It is a vast difference. Snow is so soft that you hardly realize that its falling. So light to feel. (There may be hailstorms and blizzards too, but I don't want to spoil my party so soon :P). And when it covers all the ground, it looks very pure and quiet. That can be attributed to the color white as a symbol of peace and purity.
I am gazing outside window as soft white cotton flakes fall from the invisible clouds. Such a serene feeling. But as soon as they touch my window they disappear and instead small droplets of water trickle through the window glass. I can see cars covered with snow rushing past traffic lights. People under their umbrella and snow coats walking pass the rail station. It is such a calm environment and you would want to bury yourself deep into thoughts admiring this beautiful phenomenon of nature.
The train continues to speed on. Soon I will reach New York City to start another exciting day at work and will have to leave behind my admiration for this heavenly phenomenon for some other time.


Thursday, September 4, 2008

Google Chrome: The Bigger Picture

I am back to blogging and what better to restart with other than Google's new Web Browser, Google Chrome . Touted as a competitor to IE 8 and firefox, but its more than that. You can obtain a first hand information about why this browser was built from these videos posted by the Google Engineers themselves. An Open Source product with a new dedicated JavaScript engine called V8, chrome is potrayed as a browser for "running the application" and not for displaying pages. Google developers are correct when they say that Internet and related web apps have come a long way but there hasn't been a significant change in the browser. 



And be careful when Google says "browser for applications". It throws open a new realm of discussion. So now Google has a browser, web based apps for Spread sheets, Powerpoint Viewer(an option for Gmail users) and Google docs are already there. Picasaweb is a hit with its recently released new features. Blogger,  Google Maps, Google Notebook, Google Reader are a few more popular products not forgetting the search engine itself. Also an array of google products are available at Google Labs

So what does all these signify. Did Google want to get into the browser race as it didn't have one? I think no. It has a bigger vision. With data speeds speculated to cross across 7.67 Gb/s in near future, Google may be aiming for a complete web based environment for computers. Imagine your computer just running the "web browser"(I guess there will be a better term for that soon) and all your applications inside it. Something similar to Sun's caption, the Network is the Computer. Will you need the Operating System anymore? Hmm, a tough one. But may be Google is looking forward in that direction. How am I able to reach such conclusions? Yes, there is more than specualation. 
1.) If you carefully hear the engineers explaining the design of Chrome, you will learn that each tab has its own sand box and doesn't interfere with the other. So if one tab fails other will continue.  They are thinking applications.
2.) Google Chrome is built on a completely new JavaScript engine V8. May be this could be the foundation for a another platform on which the browser may run.
3.) Who would give a Task Manager in a browser with all the statistics that a nerd would need?(Check this option by pressing Shift + Esc)
4.) Mozilla, whose major income is from Google, its equations would definitely change if Google touts this as a browser.
5.) Google Chrome doesn't exceed the expectations of a Google product. A Google product has always been different. Chrome as a browser doesn't do that. Now change your perspective and see Chrome as a "Browser for Applications". It will exceed your expectations.
 
Having said all these, only time can verify it. If Google is able to achieve the "browser for apps" sometime soon, its going to change the perspectives in the way computers will be looked at.

Here are the list of features I liked about the Chrome

Hits
* Relatively less memory usage & seems light weight.
* in built java script inspector.
* no useless wastage of spaces.

Misses
* Bad Pop-Up blocker management.
* Cntrl + F search may sometimes skip the embedded Text Area (not in cases of gmail and blogger, Happens with the proprietry platform I work on)
* Need Microsoft Visual Studio 2005 to build for the latest windows version(Linux/Mac versions soon).

But there are no Misses if you see it as a "Browser for apps". Its an ideal stepping stone. And since Chrome is built on an open source project called Chromium , it could be an innovative and visionary development team who could do it before Google does it.

What next? Get Microsoft Visual Studio 2005 and start exploring Google Chrome.
Related posts soon. Keep watching

Wednesday, September 3, 2008

The journey has been...

I now stay in US. Its nearly 8 weeks since I left Mumbai and more 2 months since I wrote my last blog(that too a movie review :D). Finally, a computer science graduate from the Mumbai University and now a Software Developer at Arvato Systems in New York City. Last 8 weeks have transformed my life. They say here Life comes at you Fast. And I am feeling the pace. From the fast paced crowd of Mumbai, to the more sophisticated and fashionable but equally paced crowd of New York. From the bumpy streets of Mumbai to the wider and more cleaner Streets of New York(Although people here do not condsider New York clean, but they haven't seen Mumbai ;)) From the Mumbai trains to the New York Subways, the transformation has been fast. Have quickly adapted to the cooler Summers of New York from the Hot & Humid weather of Mumbai. Such transformation use cases are plenty and I can go on and go.

But its the same Kunal, its the same Java, its the same NetBeans(now Eclipse too), the same Windows/Linux/Mac, the same Google,Microsoft,Sun. I still talk with System.out.println and constructors. I still look for more and new IDE keyboard shortcuts. For and While loops still form the basic indegrients of my code. Windows is still hated by developers and I still use it. I work with a passionate and a diverse(read people from different cultures and linguistic background) team of developers but we speak the same language which the computer understands. Debugging is still bugging and coding is still exciting. Caffinee(Coffee) is the favorite drink though addictive. Technology still makes breaking news everyday and we have Google Chrome.

In spite of such a crazy transformation of personal and social life, some things cease to change. And they are those things which command the change. And the world has really gone flat.

So, The journey has been...(I can't find a suitable word)

Friday, July 4, 2008

Jaane Tu.. Ya Jaane Na - Movie Review

Well the film had something in it. First the music took me to the cinema hall to watch the film on the first day itself. A youthful film full of energy and freshness.

Imran Khan (Jai) and Genelia (Aditi) are the best of buddies but fail to realize that they were meant for each other. After clearing this 'misunderstanding' with the parents and friends they look for their soul mates. Aditi helps Jai find his mate while she starts seeing a family friend's son. After a bunch of events they start realizing that they are meant for each other and end up together. Nothing new in this story. But having said that the film is executed superbly. Even if you could predict whats next, you would wonder how it will be executed. And each time the expectations rose more.The climax was fun filled. I could sense the audience enjoying themselves and left the cinema hall satisfied.

Each character had its own importance and the faces looked fresh. No stereotyped character! A clean entertaining film and with an excellent music.

Worth a Watch.

Sunday, June 15, 2008

On my way to Baroda

I am on my way to Baroda(I wish, I could link it to google maps right now), my other hometown. I was born here. Though i visit Baroda (A 7 hour train journey from Mumbai) atleast biannually, the journey this time is making me have mixed feelings. I am experiencing the typical indian train journey. Clattering of the tea vendors, passengers around me chatting, eating... its fun travelling in a second class compartment. The view outside the window is equally exciting. The long spans of country side farms and on concrete structure in sight. So whats new this time? You may ask me all this may be routine for me. Yes this is not the first time i am experiencing this. But I am experiencing it from a different dimension. I am leaving for the US in a three weeks time. I dont know when I'll be back to take such a journey to Baroda again. I am going to get lost in my quest to realise my dreams. In my opinion there comes a time in everyone's life where one chooses a path which will act as a catalyst to achieve one's ambition. I don't know how it will execute, but I am sure things will surely work out well.
The train is breezing through the fields. Within few hours it will reach the destination.
And if your thinking that second class coaches of Indian Railways have Internet connection, wait a minute. I am using my cell phone to post this blog. Indian Railways have a long way to go :-).

Friday, June 6, 2008

NetBeans Community Docs Spotight - Kunal Modi

NetBeans Community Docs Coordinator has put a Spotlight on my Contributions.
Check out http://nb-community-docs.blogspot.com/2008/06/netbeans-community-docs-spotight-kunal.html

Saturday, May 24, 2008

Search trends for NetBeans IDE crosses Eclipse IDE at Google Trends.

The popularity of NetBeans has increased many fold since the release of NetBeans6.0.
Today at google trends I discovered the same. I compared the results for "NetBeans IDE" and "Eclipse IDE" at google trends

(You can view the results here , to know more about google trends click here).
I wasn't surprised to see that "NetBeans IDE" was more searched than "Eclipse IDE" over the recent months. The trends truly reflect the hard work put by the NetBeans team, Sun Microsystems and an active and growing NetBeans Community. NetBeans has now become developers favorite choice for development. I am sure that this trend will continue to grow in coming months.

Note: I have purposely included the word IDE for trend results because google trends is not able to distinguish between the natural phenomenon "eclipse" and the Java IDE "Eclipse". Including "IDE" in both the keywords makes it more or less a fair comparison.
Also, this is an unadulterated interpretation of a NetBeans user and a student.

Happy NetBeaning!

Tuesday, May 20, 2008

Steve Jobs Stanford Commencement Speech 2005

This is one of my favourite videos.. truly inspiring... worth a watch


The whole speech in text is as follows:-
You've got to find what you love,' Jobs says

This is the text of the Commencement address by Steve Jobs, CEO of Apple Computer and of Pixar Animation Studios, delivered on June 12, 2005.


I am honored to be with you today at your commencement from one of the finest universities in the world. I never graduated from college. Truth be told, this is the closest I've ever gotten to a college graduation. Today I want to tell you three stories from my life. That's it. No big deal. Just three stories.

The first story is about connecting the dots.

I dropped out of Reed College after the first 6 months, but then stayed around as a drop-in for another 18 months or so before I really quit. So why did I drop out?

It started before I was born. My biological mother was a young, unwed college graduate student, and she decided to put me up for adoption. She felt very strongly that I should be adopted by college graduates, so everything was all set for me to be adopted at birth by a lawyer and his wife. Except that when I popped out they decided at the last minute that they really wanted a girl. So my parents, who were on a waiting list, got a call in the middle of the night asking: "We have an unexpected baby boy; do you want him?" They said: "Of course." My biological mother later found out that my mother had never graduated from college and that my father had never graduated from high school. She refused to sign the final adoption papers. She only relented a few months later when my parents promised that I would someday go to college.

And 17 years later I did go to college. But I naively chose a college that was almost as expensive as Stanford, and all of my working-class parents' savings were being spent on my college tuition. After six months, I couldn't see the value in it. I had no idea what I wanted to do with my life and no idea how college was going to help me figure it out. And here I was spending all of the money my parents had saved their entire life. So I decided to drop out and trust that it would all work out OK. It was pretty scary at the time, but looking back it was one of the best decisions I ever made. The minute I dropped out I could stop taking the required classes that didn't interest me, and begin dropping in on the ones that looked interesting.

It wasn't all romantic. I didn't have a dorm room, so I slept on the floor in friends' rooms, I returned coke bottles for the 5¢ deposits to buy food with, and I would walk the 7 miles across town every Sunday night to get one good meal a week at the Hare Krishna temple. I loved it. And much of what I stumbled into by following my curiosity and intuition turned out to be priceless later on. Let me give you one example:

Reed College at that time offered perhaps the best calligraphy instruction in the country. Throughout the campus every poster, every label on every drawer, was beautifully hand calligraphed. Because I had dropped out and didn't have to take the normal classes, I decided to take a calligraphy class to learn how to do this. I learned about serif and san serif typefaces, about varying the amount of space between different letter combinations, about what makes great typography great. It was beautiful, historical, artistically subtle in a way that science can't capture, and I found it fascinating.

None of this had even a hope of any practical application in my life. But ten years later, when we were designing the first Macintosh computer, it all came back to me. And we designed it all into the Mac. It was the first computer with beautiful typography. If I had never dropped in on that single course in college, the Mac would have never had multiple typefaces or proportionally spaced fonts. And since Windows just copied the Mac, its likely that no personal computer would have them. If I had never dropped out, I would have never dropped in on this calligraphy class, and personal computers might not have the wonderful typography that they do. Of course it was impossible to connect the dots looking forward when I was in college. But it was very, very clear looking backwards ten years later.

Again, you can't connect the dots looking forward; you can only connect them looking backwards. So you have to trust that the dots will somehow connect in your future. You have to trust in something — your gut, destiny, life, karma, whatever. This approach has never let me down, and it has made all the difference in my life.

My second story is about love and loss.

I was lucky — I found what I loved to do early in life. Woz and I started Apple in my parents garage when I was 20. We worked hard, and in 10 years Apple had grown from just the two of us in a garage into a $2 billion company with over 4000 employees. We had just released our finest creation — the Macintosh — a year earlier, and I had just turned 30. And then I got fired. How can you get fired from a company you started? Well, as Apple grew we hired someone who I thought was very talented to run the company with me, and for the first year or so things went well. But then our visions of the future began to diverge and eventually we had a falling out. When we did, our Board of Directors sided with him. So at 30 I was out. And very publicly out. What had been the focus of my entire adult life was gone, and it was devastating.

I really didn't know what to do for a few months. I felt that I had let the previous generation of entrepreneurs down - that I had dropped the baton as it was being passed to me. I met with David Packard and Bob Noyce and tried to apologize for screwing up so badly. I was a very public failure, and I even thought about running away from the valley. But something slowly began to dawn on me — I still loved what I did. The turn of events at Apple had not changed that one bit. I had been rejected, but I was still in love. And so I decided to start over.

I didn't see it then, but it turned out that getting fired from Apple was the best thing that could have ever happened to me. The heaviness of being successful was replaced by the lightness of being a beginner again, less sure about everything. It freed me to enter one of the most creative periods of my life.

During the next five years, I started a company named NeXT, another company named Pixar, and fell in love with an amazing woman who would become my wife. Pixar went on to create the worlds first computer animated feature film, Toy Story, and is now the most successful animation studio in the world. In a remarkable turn of events, Apple bought NeXT, I returned to Apple, and the technology we developed at NeXT is at the heart of Apple's current renaissance. And Laurene and I have a wonderful family together.

I'm pretty sure none of this would have happened if I hadn't been fired from Apple. It was awful tasting medicine, but I guess the patient needed it. Sometimes life hits you in the head with a brick. Don't lose faith. I'm convinced that the only thing that kept me going was that I loved what I did. You've got to find what you love. And that is as true for your work as it is for your lovers. Your work is going to fill a large part of your life, and the only way to be truly satisfied is to do what you believe is great work. And the only way to do great work is to love what you do. If you haven't found it yet, keep looking. Don't settle. As with all matters of the heart, you'll know when you find it. And, like any great relationship, it just gets better and better as the years roll on. So keep looking until you find it. Don't settle.

My third story is about death.

When I was 17, I read a quote that went something like: "If you live each day as if it was your last, someday you'll most certainly be right." It made an impression on me, and since then, for the past 33 years, I have looked in the mirror every morning and asked myself: "If today were the last day of my life, would I want to do what I am about to do today?" And whenever the answer has been "No" for too many days in a row, I know I need to change something.

Remembering that I'll be dead soon is the most important tool I've ever encountered to help me make the big choices in life. Because almost everything — all external expectations, all pride, all fear of embarrassment or failure - these things just fall away in the face of death, leaving only what is truly important. Remembering that you are going to die is the best way I know to avoid the trap of thinking you have something to lose. You are already naked. There is no reason not to follow your heart.

About a year ago I was diagnosed with cancer. I had a scan at 7:30 in the morning, and it clearly showed a tumor on my pancreas. I didn't even know what a pancreas was. The doctors told me this was almost certainly a type of cancer that is incurable, and that I should expect to live no longer than three to six months. My doctor advised me to go home and get my affairs in order, which is doctor's code for prepare to die. It means to try to tell your kids everything you thought you'd have the next 10 years to tell them in just a few months. It means to make sure everything is buttoned up so that it will be as easy as possible for your family. It means to say your goodbyes.

I lived with that diagnosis all day. Later that evening I had a biopsy, where they stuck an endoscope down my throat, through my stomach and into my intestines, put a needle into my pancreas and got a few cells from the tumor. I was sedated, but my wife, who was there, told me that when they viewed the cells under a microscope the doctors started crying because it turned out to be a very rare form of pancreatic cancer that is curable with surgery. I had the surgery and I'm fine now.

This was the closest I've been to facing death, and I hope its the closest I get for a few more decades. Having lived through it, I can now say this to you with a bit more certainty than when death was a useful but purely intellectual concept:

No one wants to die. Even people who want to go to heaven don't want to die to get there. And yet death is the destination we all share. No one has ever escaped it. And that is as it should be, because Death is very likely the single best invention of Life. It is Life's change agent. It clears out the old to make way for the new. Right now the new is you, but someday not too long from now, you will gradually become the old and be cleared away. Sorry to be so dramatic, but it is quite true.

Your time is limited, so don't waste it living someone else's life. Don't be trapped by dogma — which is living with the results of other people's thinking. Don't let the noise of others' opinions drown out your own inner voice. And most important, have the courage to follow your heart and intuition. They somehow already know what you truly want to become. Everything else is secondary.

When I was young, there was an amazing publication called The Whole Earth Catalog, which was one of the bibles of my generation. It was created by a fellow named Stewart Brand not far from here in Menlo Park, and he brought it to life with his poetic touch. This was in the late 1960's, before personal computers and desktop publishing, so it was all made with typewriters, scissors, and polaroid cameras. It was sort of like Google in paperback form, 35 years before Google came along: it was idealistic, and overflowing with neat tools and great notions.

Stewart and his team put out several issues of The Whole Earth Catalog, and then when it had run its course, they put out a final issue. It was the mid-1970s, and I was your age. On the back cover of their final issue was a photograph of an early morning country road, the kind you might find yourself hitchhiking on if you were so adventurous. Beneath it were the words: "Stay Hungry. Stay Foolish." It was their farewell message as they signed off. Stay Hungry. Stay Foolish. And I have always wished that for myself. And now, as you graduate to begin anew, I wish that for you.

Stay Hungry. Stay Foolish.

Thank you all very much.

Sunday, May 11, 2008

NetBeans6.1 Review

Each time a new NetBeans Release is out, it exceeds your expectations. NetBeans6.1 has only reaffirmed that. The NetBeans Java Editor is the most loved feature. The ease with which the NetBeans editor allows you to program not only increases your productivity but helps you know more about the Java programming language. The hints that appear aside the line auto generates the code for importing classes, defining fields and variables and also auto generates the for and while loops for you and I can go and on.

The NetBeans6.1 editor enhancements too have been significant. The Bean Information for a class now gets generated at a click of the button.


It not only gives the auto generated code but also gives the designer view to edit the beans info.


But one cool feature I would like to talk is about the screen shot of the Top-Component(Windows seen inside NetBeans are called Top-Components) on Drag. Whenever a Top-Component is dragged a screen shot gets attached to it automatically.

This is cool because NetBeans is able to generate a compressed image of the Top-Component,. This can be leveraged to take a screen shot of the editor content while writing a tutorial.

Not to forget the Documentation support that NetBeans provides. The documentation has aided better understanding of existing modules as well as helped in writing new modules for NetBeans.

In accordance with this I present below a short tutorial on how add custom action to the NetBeans Java Editor.

  • Introduction: It happens many a times that you get stuck in your small code and you try debugging using the System.out.println() statements. Though NetBeans provides an excellent debugging support and a profiler, you would be discouraged to use that if the magnitude of your code is not that large. As students, we tend to use System.out.println() as our first choice. This tutorial will help you create a custom action for the Java Editor which will insert the System.out.println() statement for the selected variable automatically.
  • Lets Start
    • Pre-Requirements:- Familiarity with NetBeans IDE
    • Creating a New Module
      1. Create a module called "InsertPrintln" and keep the code name base as "org.modules.sack.insertprinltn". A detailed explaination on how to create a new module can be found on my previous posts.
    • Create the Action
      1. Right click the package node and choose New and select Action from the pop-up menu.
      2. Select Conditionally Enabled Action. Select EditorCookie from the drop down menu. Click Next.
      3. Select the category as Other. Check only Editor Context Menu Item box and select "text/x-java". Select the position after the "generate-code-HERE-" option. Click Next.
      4. Enter "InsertPrintln" as the class name and Insert "System.out.println" as the Display name. Keep other settings as default and click finish. The "InsertPrinln" class gets created.
    • Code Content
      1. All we need to do now is to add the logic for our action in the performAction(Node[] activatedNodes) function of the "InsertPrintln" class.
      2. First of all add the following module dependencies to your module.
        1. Editor Library
        2. Editor Library 2
        3. Editor Indentation
      3. To add the dependencies, right click the Libraries node of the project. Select "add module dependency" and add the above dependencies. Once you have added all verify it. To verify roght click the project node, select properties and then select libraries. You should find the list similar to the list shown below.
      4. Now add the following code to the performAction(Node[] activatedNodes) function in "InsertPrintln" class. Your performAction(Node[] activatedNodes) should look as follows:protected void performAction(Node[] activatedNodes) { EditorCookie editorCookie = activatedNodes[0].getLookup().lookup(EditorCookie.class);
        editor = EditorRegistry.lastFocusedComponent();

        selectedText = editor.getSelectedText();



        document = (StyledDocument)editor.getDocument();

        int currentLine;
        int nextLineOffset;
        if(selectedText!=null){

        try {

        stringToBeInserted = "System.out.println(\""+selectedText+" =\"+" +selectedText + ");\n";
        currentLine = NbDocument.findLineNumber(document, editor.getCaretPosition());
        nextLineOffset = NbDocument.findLineOffset(document, currentLine + 1);
        document.insertString(nextLineOffset, stringToBeInserted, null);
        BaseDocument bd = (BaseDocument) editor.getDocument();

        Reformat.get(bd).lock();
        bd.getFormatter().reformat(bd, 0, bd.getLength()-1);

        Reformat.get(bd).unlock();

        } catch (BadLocationException ex) {
        Exceptions.printStackTrace(ex);
        }
        }
        }
      5. Resolve the import references and make the following fields: private JTextComponent editor;
        private StyledDocument document;
        private String selectedText;
        private String stringToBeInserted;
      6. Your module is ready to run.
      7. To run, right click the project node and select "Run".
      8. The target platform opens up. Open any Java file in the Editor.
      9. Select a variable you wish to print using System.out.println. Right click and choose "Insert System.out.println".
      10. The statement automatically gets inserted on the next line.
    • Code Explaination
      1. The code is straight forward. At first, using the Editor Registry we derive the last focused component(which returns the editor component we want to work with).
      2. After obtaining the document from the editor and the selected text, we frame the string to be inserted. NbDocument helps us to find the appropriate line number and also helps us to derive the offset for the next line. Using the document.insertString() function we insert our line of code in the document.
      3. Finally we Reformat the document to maintain the indentation.
    • Use this as a plugin?
      1. You can use this as a plugin. Just right click on the project node and select "Create NBM". A .nbm file get created and the link is displayed in the output window.
      2. To install this plugin, go to Tools-> Plugins
      3. Go to downloaded plugins tab and browse for your .nbm file.
      4. Click install and complete the installation procedure.
      5. Your plugin is now ready to use.
Any suggestions/corrections/clarifications/comments are welcome.
Happy NetBeaning!

Wednesday, May 7, 2008

Open projects programmatically in NetBeans

Recently I was working on a NetBeans IDE module and had to open a NetBeans project programmatically. I looked up in the Projects API to find out. The exploring of the API was a fruitful one and I would like to share it with you.

There are two API which are related to the NetBeans Projects.
1.) Project API
2.) Project UI API

We will start with the Project API first because it was here where I found my answer. In order to understand well let up simulate the "Open Projects" Action in NetBeans IDE. At the end of this tutorial we should be able to have a Global button in the toolbar to open project(similar to the Open Project(cntrl + shift + O) Action). The process will help us understand how NetBeans Projects are Opened in the Window.

  • We will create a new Module called "OpenProject".
    • To create a module refer to my previous post where I have explained in detail on how to create a new Module.
  • In order to simulate the "Open Project" button, let us now create an Action.
    • Right click the project node and select Action.
    • We will make an "Alwaya Enabled" action. So click next.
    • Keep the category as "File". We will just have a button in the Globar Toolbar. So check Global Toolbar Button and keep the category as Edit(Edit because we don't want to create a misunderstanding by keeping it in File category as there already exists the Open Project button in the File toolbar). Click Next.
    • Give class name as "MyOpenProject", action name as "MyOpenProject" and a url to a 16X16 gif/png icon file. Click Finish.
  • A class called "MyOpenAction" will be automatically generated and the action will be registered in the XML layer.
  • Since we will be using the Project API dependency, we need to add it to the module dependency library. To do so
    • Right Click the project node.
    • Go to properties
    • Go to Libraries
    • Select Add. One after the other add the following dependencies
      • Project API
      • Project UI API
      • File System API
    • The dependencies should look as follows.
  • Now we are set to write the performAction function. It will look like this.
      • public void performAction() {
        try {
        JFileChooser projectChooser = new JFileChooser();
        projectChooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
        projectChooser.showOpenDialog(null);


        File projectToBeOpenedFile = projectChooser.getSelectedFile(); FileObject projectToBeOpened = FileUtil.toFileObject(projectToBeOpenedFile);

        Project project = ProjectManager.getDefault().findProject(projectToBeOpened);
        Project[] array = new Project[1];
        array[0] = project;
        OpenProjects.getDefault().open(array, false);

        } catch (IOException ex) {
        Exceptions.printStackTrace(ex);
        }
        }
  • Let us go through the code quickly.
    • JFileChooser projectChooser = new JFileChooser(); projectChooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY); projectChooser.showOpenDialog(null);
    • This part of the code is a nomal JFileChosser where we restrict our selection to directories only.
    • File projectToBeOpenedFile = projectChooser.getSelectedFile(); FileObject projectToBeOpened = FileUtil.toFileObject(projectToBeOpenedFile); The projectChooser now returns the java.io.File object of the selected project. This object is then converted to the NetBeans FileSystem by using the FileUtil class of the FileSystem API. This conversion returns a FileObject which the NetBeans equivalent of a file representation.
    • Now comes the crucial part of the code. Project project = ProjectManager.getDefault().findProject(projectToBeOpened); Project[] array = new Project[1]; array[0] = project; OpenProjects.getDefault().open(array, false);
    • We use the default instance of the ProjectManager class and use its findProject(org.openide.filesystems.fileobject) to find the project folder. This method returns a org.netbeans.api.project.Project. NetBeans uses this as an identifier for all of its projects. Now that we have the Project handle with us, we need to open it inside the NetBeans window. We can do this using the OpenProjects class(which belongs to the Project UI API). We get its default instance and use its open(Project[] projects,boolean openSubprojects) to open the project folder. But we notice here that the first argument takes an array of Project. So we create a Project array called array of size 1. We assign array[0] = project and pass array as the first parameter. The boolean value here asks if the user want to wants to open subprojects or not. We pass false here. So only the main project will be opened.
  • Now Run the module. You will be able to see your custom icon displaying "MyOpenProject".
  • Click it and a File Chooser Will appear.
  • Select a project to open.
  • The project appears in the Project window.
Remarks: Yet a lot of Project related information can be obtained using these APIs. This tutorial just gives a basic start to explore these APIs further. Any remarks/suggestions/comments are welcome.

Monday, March 31, 2008

NetBeans6.1: Editor ScreenShot on Drag

NetBeans6.1 has quite a lot of small and big but significant features. I have come across a few yet. I ll try them and blog about them as and when I meet them :)
Today i saw something unusual as i dragged my editor tab.
As soon as i dragged the editor window, a screen shot of the editor window got attached with the dragged icon. I switched back NetBeans6.0 to confirm if i had missed it in NetBeans6.0. But yeah this is the new feature of NetBeans6.1. The screen shot is the most recent version of your file.
So how do you do it? Simple, click the editor tab and drag!


Looks that NetBeans6.1 has some inbuilt feature which can take screen shots and append it to the tab icon on Drag. Need to investigate the sources. If screen shots become possible from inside NetBeans then writing tutorials and blogging becomes very easy.

Also the same applies for all the TopComponents present in your NetBeans window(Project tab, files tab, output tab etc.)

Friday, March 21, 2008

Google Maps: Virtually Real!!

These days I am on a job hunt. Looking for a job in US. I posted my resume on a few sites. I got a response from a recruiting agency. I was curious about where that agency is located. And i turned to my favorite maps.google.com for help. I put in the address and searched. As usual it showed me the map and the location. But soon my eyes caught the "Street View" option besides traffic. I just clicked it and to my surprise i was seeing the actual 3D view of the street as if i am navigating the street. You can turn left, right, 360, walk further, see the cars. Its so virtually real. My next destination was Googleplex, Mountain View, CA. And you can see the google campus from ground zero. Amazing.. But wait!! They haven't done it for all cities yet. San Francisco is the first one i guess. Though this feature may have been there for sometime now, but i am truly amazed and my jaws fell when i saw it for the first time today.
Some places you can try:-
Ghirardeli (Chocolates) - Ghirardelli Square, 900 North Point St, San Francisco, San Francisco, California, United States
Golden Gate Bridge(as if you are walking the bridge sans the traffic and breeze:( ) - Golden Gate Bridge, San Francisco, San Francisco, California, United States
Ferry Building(the famous American Express building) - 1 Ferry Bldg, San Francisco, CA



Monday, March 10, 2008

Significant Contributors at CFF

Anil, Shantaram and myself won the Significant Contributors Award at Code For Freedom contest organised by Sun Microsystems. We won an i-Pod shuffle , a certi and a Sun Microsystems T-shirt(coolest of all). It was indeed a nice achievement, rather the biggest for any of us till now. We see this as the stepping stone for a longer journey into the exciting world of coding. There's lot to be done still. Creativity has no boundaries, be it in any field.
However this achievement has really boosted our confidence and time will reveal what's in store for us.

Sun Tech Days, Hyderabad '08

Here are few snaps of the recently concluded Sun Tech Days, Hyderabad '08

Friday, March 7, 2008

Euphoria Performance!! Is it over or a beginning?

We performed at Euphoria'08. Just two months back we were in a dilemma whether we'll put up a performance or not. And on 6th March, BEC1 lit up the stage with a thrilling performance sending a very strong message. Our theme revolved around Indian Students leaving India and becoming NRIs(Non-returning Indians). This can be closely related to Swades (SRK movie).

However, the only difference was that we were not performing but we were feeling it. Many of my batchmates are leaving for US(including me) to pursue MS. Most of them have secured an I-20. Within few months they'll land on the US soils. And statistics show, very few come back after their studies. Most settle down with a good(well paid compared to their counterparts in India) job and family.

Our performance at Euphoria made me have a 2nd thought. Is the scenario same today? Will I return? Will my classmates return? I somehow get the feeling "yes". I feel this from my heart, but can't justify it. Its just an intuition. It is answer to one of those questions which can't be proved using a mathematical formula or theory. It is a matter of belonging. You feel good when your at home.

I don't have justifications. May be because the medium is different. I am feeling it from my heart and expressing through words.

What do you feel? Is it the End or the Beginning ?

Sunday, March 2, 2008

Fantasy Dalal Street



Shantaram and myself are out with Fantasy Dalal Street. You can trade with real stocks, real prices and fake money. You are alloted a huge sum of Rs. 50,00,000 to invest in BSE 30 scripts. All you need is to go to http://fds-euphoria.co.nr/ , Register and start trading. Right now its only open for our college students as a part of College's Cultural Events but soon we'll be launching an enhanced version of the game.

Shantaram and myself were very excited by the world of virtual Stock trading. So we decided why not venture in it and start FDS. It gives you the experience to deal with real prices and stocks without any real money on stake. And apart from that the bottom line lied in undestanding the deeper concept of JSP/Servlets. Sun Tech Days has been a great boost. You'll surely have a next version based on the latest technology by Sun, may be using Visual Pack for NetBeans with implementations of Ajax. So keep watching.

I have so much to blog about!!

Suddenly I have lots of topics to blog about.
1.) Sun Tech Days
2.) Our Class's Sports trophy(finally)
3.) Fantasy Dalal Street
4.) Significant Contributor award by Sun Microsystems, India.
and so many small instances which have affected my life.

While the Hyderabad visit for the Sun Tech Days was a fruitful one, our class's Sports Throphy victory was a nostalgic one. The history that runs behind this win can actually be a script for a new thrilling Movie(:-0). It took the arguably the best sports team in the college to get what it deserved. Yes ! The most coveted trophy at Fr. CRCE is finally ours. Emotions ran high on the sports day. I just came back from Hyderabad and went straight to Wellington Sports club, Khar. As soon as i got off the rickshaw, I saw Sameer getting into the act for the 4X100m Relay. I just patted on his back and crossed the track on the other side to get the acquainted to the situation. I was told that this relay was the decider. The equation was simple if we win some points in the race, we are in the race for the trophy else we are out!!. This meant we had no chance if we lost the relay and TEE came 1st(Worst case scenario).

Whistle Blew!! Sameer was off and accelerating, passed the baton to Rohit who still kept us in the race.. Race was competitive. And suddenly Anirudh fell during the 3rd
lap. Our heart beat hard. Faces Tensed. But Anirudh gathered all the courage and stood up to run again with a bleeding leg. All of us started cheering. Vineet finally completed the last lap. To our dismal, the worst thing happened. TEE stood first and we last. Our jaws fell. Disappointed again! We had lost the sports trophy.

Suddenly shouts of foul fell to my ears. I turned around to see that it was Rohit who was claiming a justified foul that the TEE guy ran in his lane blocking him! This was again confirmed by the referees and other volunteers present to monitor the race. Voila!! Things took a 360 degree turn. TEE disqualified and we now had a healthy lead of 24 points. And the Sports Trophy was ours. A nostalgic moment. This again got strengthened when we won the tug-o-war. "Computers" was the roar that lit up the whole ground. BECA was finally jumping and were on their feet literally. Eyes filled up with joy. Worn out faces finally brightened up. I was fortunate to be present at the defining moment.

Monday, February 18, 2008

18th Feb

Finally, Our class began practice for dance. It was nice that many unexpected faces showed up and the enthusiasm to work as a unit increased. The theme has been decided. And the theme we have chosen is....(You are welcome on the 6th to see our performance ;)) We worked as a workforce. Each one helping other. Each one correcting other. Each one accepting mistakes and working further. The day marked a starting which will end only after our performance at Euphoria(Our Annual Cultural Fest). I feel to tempted to disclose our plan but i can't.. :) So i cut short this blog here.

Saturday, February 16, 2008

CFF concludes

The recently concluded Code For Freedom Contest gave a nice boost and insight to the technical happenings in NetBeans and Sun Microsystems. I managed to contribute to NetBeans with CFF as the medium. The contest has left a major impact on me. Though the contest has concluded, I would keep on contributing. Some of the works i have listed below.
Documentation on netbeans.org and wiki.netbeans.org
Document title:- PicturesExplorer
Now you can find the link to this document here too.
Feedback here
Document title:- Basic Understanding of NetBeans NodesAPI
Feedback here
Plugins Picasaweb plugin for NetBeans Desc:- The plugin uses the Picasaweb API and retrieves Picasaweb album summary, links to the album and retrieves photographs for each album. These can be viewed inside the NetBeans window. A basic slideshow functionality has been embedded into the plugin.

Plugin link:- http://plugins.netbeans.org/PluginPortal/faces/PluginDetailPage.jsp?pluginid=5883
Project home :- http://code.google.com/p/picasaweb-plugin-for-netbeans/

Pictures Explorer Plugin for NetBeans
Desc:- For NetBeans users who always have their NetBeans window gazing at them ,it becomes tedious to open another pictures explorer and view your MyPictures Folder in MyDocuments. This plugin exactly does that.
Plugin link :- http://plugins.netbeans.org/PluginPortal/faces/PluginDetailPage.jsp?pluginid=5895
Project Home http://code.google.com/p/pictures-explorer-plugin-for-netbeans/

I am now Googleable :-)

16th Feb

15th Feb missing.. Yeah missed 15th Feb. The first day that i missed :-).



16th Feb was an exciting day. A Saturday and people were now getting serious about the Dance and Drama performance. The foremost dancer's group appealed to the class to help and coordinate to make the dance a success. It was a good gesture. They atlast communicated to the class. I believe its always a good idea to take the whole class with you rather than dictating your own terms. And excatly that happened. People started turning in. A small request saying that it won't cost much to participate for the dance melted many. I too joined in. Lets see what hapeens now onwards. A laughriot is sure, if i make it to the stage :-). The class now looks enthusiatic present a good act for euphoria. Aditya got a script, but things didn't proceed since it was written in Marathi. Its gonna be tedious to decipher the Marathi text. But there's an alternative script too that we are looking at. Again our 'A' batch didn't have any practicals.

The spotlight shifted to the quaterfinal volleyball match which started at 3.30pm. And the opponents(TEC1) brought in the memories of our last year defeat. And definitely, a great match at hands. We started off well and took an early lead in the 1st set. This boosted our confidence and the 1st set was ours. 2 nd set saw a tough fight. It seemed that we tried to play safe and the tally went upto 24 each into a tie breaker. We lost the set and history repeated itself. The ugly thoughts started haunting. The 15 pt last set was now crucial. All were tensed. No one moved. Some terrific points were scored by both the teams. Our team tried hard but the set and match went to the opponents. A dejection spread over the faces of all. We had lost again. In spite being a good team, we are not able to convert the talent and skills into victory. There is something really wrong happening. No one has an answer to it. May be the coming days may throw some light! So keep watching the space.

Thursday, February 14, 2008

14th Feb

Today was 14th Feb, the d-day for our SACK submissions. We had already submitted a day before. So the day was quite light and jovial. In college,lectures went off well. Finally the class attendance shot above 50%. The mood looked relaxed in all lectures except in DC, where we had a thorough revision of CN concepts. Also shockingly around 20 students had exhausted their disk quota limits. The other story of the day was also 14th Feb. The love guys/gals had their day too. Each of them had planned something. A calm and loving atmosphere prevailed throughout the day. Again as usual we didn't have, our DWM practicals.
The highlight of the day happened off the campus. I polished my latest NetBeans community document and submitted. Hours after, I received two feedbacks from the Community users. I could not believe when i saw the second feedback. It was by Geertjan. His works have been mentoring us throughout the plugin development process. He is one of those Tech guy we look upto. His plugins have been amazingly creative. And that made my day.

Sunday, February 10, 2008

Developer?

Today, I finally managed to submit two plugins for NetBeans. CFF has been a great platform for students like me to learn something new, to fill up the void that was left by Mumbai University.

The whole sack team has worked religiously over the time. Understood the meaning of open source, technologies, processes and much more.

This process has evolved us. From arbitarily writing small programs as college assignments to writing a plugin, the journey has been long. I have understood more by Action than by words. Concepts such as MVC, testing(which i hated doing ),modules,structuring... are digesting well now.

Finally, The blogger plugin is out!!!!!

So finally, the blogger plugin is out.

Tuesday, February 5, 2008

Final Days at BECA

Final Days at Fr.CRCE have begun. The very thought that all of us are going to part sends shivers down my spine. It was late August 2004, and accidently my birthday when i attended my first day at college. An introvert,reserved guy who would not mingle with anyone unless absolutely necessary. I had a notion that if you don't know a person, you should not mingle with him/her. However, today after nearly 3.5 yrs at college, my belief has reversed. In order to know a person, you have to mingle with him.
And mingle with whom? A class of crazy maniacs!!!! Each one having his own story to tell and if s/he doesn't, we put words in her/his mouth. The journey has been so momentous that i do not want to miss the climax. Its true that our journeys won't end here but from here we won't be travelling together. So i want to capture each day as it comes.Today onwards i ll be posting the happenings at BECA-08. Hope i ll be able to do this regularly :-)

Feb 13:- Our class cricket team had their semi-final match against TEP. I wanted to be there at the Oval, but my attendance forced me to college. The class wore a deserted look. Hardly anyone had come. And that made me more upset, because i knew what i was missing. First two lectures went off with a marginal attendance and voila! We have a free lecture. The hustle bustle started. We tried and got the pracs cancelled and a few preponed. And the stage was get for us to leave for Oval. Ashley, Praneeta, Renu, Shweta left while few decided to leave after the last lecture. I stayed back as i had work in the office. By that time, we had started batting. Soon it was lunch and was about to leave for Oval when I realised that SACK needed to sort out and submit contrbutions. The SACK team had been toiling day and night since a long and again I had to comply with the circumstances. It was just after lunch that i called to know that we were 113 allout.... our lowest in the tournament! That sent jitters across, Soon another update. 50/3 which kindled another hope. I couldn't handled the pressure and so didn't keep track of the scores anymore. But then received a message from Shweta saying "We lost :(". The hopes shattered! Once again we lost. Couldn't imagine the situation of our players. Must have felt so low and hurt. Arguablly the most talented in the lot, had LOST. Dejection must have ruled their faces. I have seen them play as a unit. It meant a lot to all, the team had given it all.
But then its one of those days. We may have not won the Cricket throphy!! (Some guys may be swearing at me, considering am an offield spokesman) Aren't we taking back something more valuable with us? Aren't we taking home memories which are far more valuable than the trophies we might have won? We can count the trophies, but can we count those mesmerizing moments. That sledging, TEC2 class, TEP football, cakes, parties, Supari talao, Yellow Yellow Dirty Fellow, muddy fields, Bharat's free kicks, Alok's run up, Harshal's (Shivaji) bat, sugarcane, broken bats, Shivaji park, bazigar, photograph sessions, cramps, classic cover drives, misfields, overthrows, anthem, ................ i can keep on and on. We have enjoyed every moment. And thats our Achievement!!

Thursday, January 31, 2008

Its Been A Long Time

Its Been a long time since I posted. But Lots of events happened in during
this period. From the boring exam time to the exciting world of Coding. This
This period had all.
Actually i was able to contribute the previous post on http://wiki.netbeans.org/view/PicturesExplorer
It was my first ever tutorial or any kind of Documentation. This small event triggered
great confidence in me. And since then, its been constant work.
It has been work that I am enjoying. Fresh challenges everyday, with them bring more determination to solve them.
Racking your brains to what seems a simple problem, but however you have many Exceptions to handle :-)
This period has seen it all. Yeah, Its truely the exiciting world of Amateur Coding.

By the way i am posting this from my friend Shantaram's(http://shantaram.co.nr/) blogger plugin for NetBeans..Isn't it great.
Now I can code and blog from the same Window.

That's truly exciting!!!