Friday, October 29, 2010

BARCAMP in Zaloni,Guwhati



The first ever BarCamp of North-East was organized by Zaloni Inc.   in the Development Center in Guwahati,Assam. It was a very enriching experience,numerous sessions were held . 








Ben Sharma,Founder of Zaloni
Me and Faruk presenting OSGi
question time :-)
From the origins in Palo Alto, BarCamp is an unconference, meant for knowledge sharing and learning.BarCamp is an international network of user-generated conferences (or unconferences). They are open, participatory workshop-events, whose content is provided by participants.
The first BarCamps focused on early-stage web applications, and were related to open source technologies, social protocols, and open data formats. The format has also been used for a variety of other topics, including public transit, health care, and political organizing.BarCamp makes their organizational process freely available. In addition to the BarCamp-branded network, it is also a model for user-generated conferences in other fields and for more specialized applications.




over a lazy cup of coffee
The focus of BarCamp Guwahati was emerging open source technologies.Barcamp Guwahati invited technologists, programmers, developers, designers, and Geeks to a day long of unadulterated geeky Barcamp fun.
after the presentation ..
We had a fair share  of joinees and got a lot of response and appreciation .I personally had taken a session on OSGi , along with Faruk Ali Ahmed who is a software engineer. It was a day long event and a very intresting one too.The open house quiz held in between the sessions were very refreshing. A bright day spent along-with bright minds.


Hoping to witness and be a part of many such thought provoking events :-)

Thursday, October 28, 2010

Difference between HTTP and HTTPS

HTTP and HTTPS

The main difference between http:// and https:// is It's all about keeping you secure HTTP stands for HyperText Transport Protocol, which is just a fancy way of saying it's a protocol (a language, in a manner of speaking) for information to be passed back and forth between web servers and clients.
The important thing is the letter S which makes the difference between HTTP and HTTPS.
The S (big surprise) stands for "Secure". If you visit a website or webpage, and look at the address in the web browser, it will likely begin with the following: http://. This means that the website is talking to your browser using the regular 'unsecure' language. In other words, it is possible for someone to "eavesdrop" on your computer's conversation with the website. If you fill out a form on the website, someone might see the information you send to that site. This is why you never ever enter your credit card number in an http website!
But if the web address begins with https://, that basically means your computer is talking to the website in a secure code that no one can eavesdrop on.
You understand why this is so important, right? If a website ever asks you to enter your credit card information, you should automatically look to see if the web address begins with https://. If it doesn't, there's no way you're going to enter sensitive information like a credit card number!

Thursday, September 2, 2010

Java Threads : Using Callable

                      Threads , the first thing which comes to mind is the Runnable Interface. Callable is an interface introduced in Java 5 to take care of this specific requirement. Callable is similar to Runnable, but it returns a value.  A Future interface holds the result of asynchronous computation and it is used in conjunction with Callable. FutureTask is a wrapper class which implements both Future and Runnable interfaces and it provides a convenient way to convert a Callable into both a Future and a Runnable.

Lets see an example which implements the same:


Make a StringGenerator Class:

import java.util.concurrent.Callable;
import static java.lang.Math.random;

public class StringGenerator implements Callable {

    public String call() throws Exception {
        String [] allStrings =
                {"Wine", "Movies", "Party", "Books", "Shopping",
                "Flowers", "Food", "Music", "Cars","Jewelery"};
        int index = (int)(random()*100)/10;

        //Let's wait for sometime
        Thread.sleep(2000);
        return allStrings[index];
    }
}


Next make a StringGeneratorTest class:

import java.util.ArrayList;
import java.util.concurrent.Callable;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.Future;
import java.util.concurrent.FutureTask;


public class StringGeneratorTest {

    public static void main(String[] args) {

        //Create an array to store the future objects.
        ArrayList> results = new ArrayList>();
        for (int i=0; i<10; i++){
            //Create the instance of the Callable task
                        Callable stringGenerator = new StringGenerator();

            //create the object of FutureTask
            FutureTask task =
                                new FutureTask(stringGenerator);

            //Add to the list
            results.add(task);

            //Create a thread object using the task object created
            Thread t = new Thread(task);

            //Start the thread as usual
            t.start();

        }

        //Compute the results now.
        StringBuilder resultStr = new StringBuilder();

        long start = System.currentTimeMillis();

        for(Future result: results){
            try {
                //The blocking get call
                resultStr.append(result.get());
                resultStr.append(" ");

            } catch (InterruptedException e) {
                e.printStackTrace();
            } catch (ExecutionException e) {
                e.printStackTrace();
            }
        }

        long end = System.currentTimeMillis();

        System.out.println("The returned string is:\n"+resultStr);
        System.out.println("Execution time:"+(end - start));
    }
}

Output:
The returned string is:
Shopping Party Party Flowers Books Wine Wine Flowers Music Cars
Execution time:1002

Explanation:
Create a StringGenerator thread which is supposed to return a random string to the caller. Create a StringGeneratorTest class which spawns ten StringGenerator thread and displays the concatenation of the string returned from all the threads.


Hope this helped !!! Cheers !! :-)

References:

Thursday, August 19, 2010

Removing Exception in thread “main” java.lang.NoClassDefFoundError: org/apache/juli/logging/LogFactory!!

Exception in thread “main” java.lang.NoClassDefFoundError: org/apache/juli/logging/LogFactory
at org.apache.catalina.startup.Bootstrap.(Bootstrap.java:54)
Caused by: java.lang.ClassNotFoundException: org.apache.juli.logging.LogFactory
at java.net.URLClassLoader$1.run(URLClassLoader.java:217)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:205)
at java.lang.ClassLoader.loadClass(ClassLoader.java:323)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:294)
at java.lang.ClassLoader.loadClass(ClassLoader.java:268)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:336)
… 1 more
Could not find the main class: org.apache.catalina.startup.Bootstrap. Program will exit.

Solutions

1. In Eclipse, Open the “Server” tab.
2. Double click on the “Tomcat6″ entry to see the configuration.
3. Then click on the “Open launch configuration” link in the “General information” block.
4. In the dialog, select the “Classpath” tab.
5. Click the “Add external jar” button.
6. Select the file “/usr/share/tomcat6/bin/tomcat-juli.jar”
7. Close the dialog.
8. Start tomcat 6 from Eclipse.

Tuesday, July 20, 2010

Excerpts from The Kite Runner

This is a book which I have read over and over... and still I fall in love with it every time I read it. Here are some excerpts from the same .... 

They danced high above the trees on the west end of the park, over the windmills, floating side by side like a pair of eyes looking down on San Francisco, the city I now call home. And suddenly Hassan's voice whispered in my head: For you, a thousand times over. Hassan the harelipped kite runner.I sat on a park bench near a willow tree. I thought about something Rahim Khan said just before he hung up, almost as an afterthought. There is a way to be good again. I looked up at those twin kites. I thought about Hassan. Thought about Baba. Ali. Kabul. I thought of the life I had lived until the winter of 1975 came along and changed everything. And made me what I am today.


That same night, I wrote my first short story. It took me thirty minutes. It was a dark little tale about a man who found a magic cup and learned that if he wept into the cup, his tears turned into pearls. But even though he had always been poor, he was a happy man and rarely shed a tear. So he found ways to make himself sad so that his tears could make him rich. As the pearls piled up, so did his greed grow. The story ended with the man sitting on a mountain of pearls, knife in hand, weeping helplessly into the cup with his beloved wife's slain body in his arms.


She said, 'I'm so afraid.' And I said, 'why?,' and she said, 'Because I'm so profoundly happy, Dr. Rasul. Happiness like this is frightening.' I asked her why and she said, 'They only let you be this happy if they're preparing to take something from you


I want to tear myself from this place, from this reality, rise up like a cloud and float away, melt into this humid summer night and dissolve somewhere far, over the hills. But I am here, my legs blocks of concrete, my lungs empty of air, my throat burning. There will be no floating away.

It was only a smile, nothing more. It didn't make everything all right. It didn't make ANYTHING all right. Only a smile. A tiny thing. A leaf in the woods, shaking in the wake of a startled bird's flight. But I'll take it. With open arms. Because when spring comes, it melts the snow one flake at a time, and maybe I just witnessed the first flake melting. - Amir

Quiet is peace. Tranquility. Quiet is turning down the volume knob on life. Silence is pushing the off button. Shutting it down. All of it

There is only one sin. and that is theft... when you tell a lie, you steal someones right to the truth...Theft was the one unforgivable sin, the common denominator of all sins. When you kill a man, you steal a life. You steal his wife's right to a husband, rob his children of a father. When you tell a lie, you steal someone's right to the truth. When you cheat, you steal the right to fairness. There is no act more wretched than stealing.

Children aren't coloring books. You don't get to fill them with your favorite colors.

some stories don't need telling


Hope you liked it :-)

Monday, July 12, 2010

Humor with computers!!!!

Sometimes while I work , I really get irritated especially if there is an issue which refuses to resolve fast.The other day I came across some good humor related with computers .I have mentioned them below so that you guys can aslo have a hearty laugh

1>Q: What is the difference between Windows 95 and Windows 98? A: 3 years

2>“As soon as we started programming, we found to our surprise that it wasn’t as easy to get programs right as we had thought. Debugging had to be discovered. I can remember the exact instant when I realized that a large part of my life from then on was going to be spent in finding mistakes in my own programs.”
Maurice Wilkes discovers debugging, 1949.

3>
“Before software can be reusable it first has to be usable.”
Ralph Johnson

4>
“The evolution of languages: FORTRAN is a non-typed language. C is a weakly typed language. Ada is a strongly typed language. C++ is a strongly hyped language.”
Ron Sercely

5>
“If debugging is the process of removing bugs, then programming must be the process of putting them in.”
Edsger Dijkstra

6>
“I’ve finally learned what ‘upward compatible’ means. It means we get to keep all our old mistakes.”
(Dennie van Tassel)


7>
“There are two ways of constructing a software design. One way is to make it so simple that there are obviously no deficiencies. And the other way is to make it so complicated that there are no obvious deficiencies.”
(C.A.R. Hoare)

8>
“Keyboard not found. Press <> to RESUME. “
Source unknown (appears in many common BIOSes as a real error message)

9>
“The trouble with programmers is that you can never tell what a programmer is doing until it’s too late.”
(Seymour Cray)

10>“A great lathe operator commands several times the wage of an average lathe operator, but a great writer of software code is worth 10,000 times the price of an average software writer.”
(Bill Gates)

Hope this brought across a smile :)!

Thursday, June 17, 2010

Rmoving Restrictions on package like sun.*, java.*

The java.*, javax.* and org.* packages documented in the Java Platform Standard Edition API Specification make up the official, supported, public interface. If a Java program directly calls only API in these packages, it will operate on all Java-compatible platforms, regardless of the underlying OS platform.
The sun.* packages are not part of the supported, public interface.
A Java program that directly calls into sun.* packages is not guaranteed to work on all Java-compatible platforms. In fact, such a program is not guaranteed to work even in future versions on the same platform.


Due to the same a project give access restriction errors at the compile time ...
Access restriction: Class is not accessible due to restriction on required library";
may be shown while developing Java projects in Eclipse IDE.

Solution: follow the following steps to solve the same

1.(Your Project) Properties -> Java Compiler -> Errors/Warnings


This was all about eclipse when you deploy the same using Felix
you can either pass the VM argument as:

-Dorg.osgi.framework.bootdelegation=sun.*,com.sun.*

or you can add

Dorg.osgi.framework.bootdelegation=sun.*,com.sun.*

in the config.properties file in the conf folder of the Felix Framework





References:

1 http://java.sun.com/products/jdk/faq/faq-sun-packages.html
2 http://lkamal.blogspot.com/2008/09/eclipse-access-restriction-on-library.html
3 http://blog.springsource.com/2009/01/19/exposing-the-boot-classpath-in-osgi/





Friday, June 4, 2010

eqinox to felix - an experience

The other day I had created a few OSGi bundles in Eclipse and deployed the same in the Equinox framework of Eclipse..

These same bundles when I deployed in Felix.. it gave an error stating it was not able to find the classes .. esp those which were exposing the services.Next I added the following bundles in the manifest of each of the bundles:

- javax.naming
- javax.naming.event
- javax.naming.spi


And VOILA !!! it worked .... :-)

Monday, May 31, 2010

a hope ...

a little footprint in the shore...
a small step towards the unknown..
a apprehensive journey... to know more and more..
a hope ...
a vision.. a belief.. more importantly... WE...
bring to me my faults let me learn ..
keep pushing me more and more..
lets the boundaries fade... lets believe in the impossible.....


DREAM !! Be-live and make it happen !!

Thursday, May 27, 2010

Happy Eclipse working-IDE Shortcuts

Since long I have been using Eclipse , now I realize the necessity of using shortcuts.
Not only does it save time at the same time enriches the coding experience .
I have mentioned them here below :




Navigational Shortcuts


F10


Main menu:


Shift F10 -----------------
Context menu
Ctrl F10
-----------------View menu

Workspace navigation:


F12 -----------------
Activate editor
Ctrl+Shift+W----------
Switch editor
Ctrl F6---------------
Next editor
Ctrl Shift F6-----------
Prev editor
Ctrl F7---------------
Next workspace
Ctrl Shift F7-----------
Prev workspace
Ctrl F8
----------------Next perspective
Ctrl Shift F8 -----------
Prev perspective
Alt Left----------------
Back
Alt Right -------------
Forward

Files:


Alt Shift S -----------------
Show in…
Ctrl Shift R-----------------
Jump to file
Ctrl N ----------------------
New file
Ctrl S ----------------------
Save file
Ctrl Shift S -----------------
Save all files
Ctrl F4---------------------
Close file
Ctrl Shift F4-----------------
Close all files

Find:


Ctrl L -----------------
Goto line
Ctrl F -----------------
Find
Ctrl J-----------------
Incremental find
Ctrl Shift J -------------
Incremental find prev
Ctrl K -----------------
Find next
Ctrl Shift K -------------
Find prev
Ctrl H ------------------
Search workspace
Ctrl (dot)---------------
Navigate next
Ctrl (comma) ------------
Navigate prev

Java navigation:


F3---------------------
Goto declaration
Ctrl Shift U --------------
Find references in file
Ctrl Shift G---------------
Find references in workspace
Ctrl G ------------------
Find declarations in workspace
Ctrl Shift P---------------
Navigate to matching bracket/brace
Ctrl T--------------------
Popup type hierarchy
Ctrl Shift T ----------------
Open Type
Ctrl O--------------------
Outline of current source
Ctrl F3-------------------
Outline of current cursor position
Ctrl Shift Arrow ------------
Jump beetween methods up or down
F2 ----------------------
Show Javadoc
F4 ----------------------
Show hierarchy
Ctrl Alt H -----------------
Open call hierarchy


General editing:


Alt Arrow -----------------
Move line(s) up or down
Alt Shift Up ---------------
Expand selection to enclosing element
Alt Shift Right -------------
Expand selection to next element
Alt Shift Left---------------
Expand selection to previous element
Alt Shift Down--------------
Restore previous selection
Ctrl Alt Arrow---------------
Duplicate line(s) up or down
Shift Enter -----------------
Insert line below
Ctrl Shift Enter -------------
Insert line above
Ctrl D ---------------------
Delete line
Ctrl Shift Q -----------------
Toggle Quick Diff
Ctrl Shift Y -----------------
Convert to lowercase
Ctrl Shift X -----------------
Convert to uppercase

Java editing:


Alt Shift U -----------------
Remove occurrence annotations
Ctrl 1----------------------
Quick fix (works even when there are no errors
Ctrl Shift M -----------------
Add import
Ctrl Shift F ------------------
Reformat
Ctrl Shift O------------------
Organize Imports
Ctrl / -----------------------
Comment
Ctrl \ -----------------------
UnComment
Ctrl Shift Space--------------
Parameter hints
Ctrl ------------------------
Hyperlink identifier
Ctrl I-----------------------
Correct indentation
Shift Space -----------------
Incremental content assist

Debugger :


F5 ----------------------
Step into
F6 ----------------------
Step over
F7
----------------------Run to return
F8 ----------------------
Resume
F9 ----------------------
Relaunch last
F11 ---------------------
Run/debug last
Ctrl F11------------------
Run
Ctrl Shift B ---------------
Toggle breakpoint
Ctrl D
-------------------Display
Ctrl Q --------------------
Inspect
Ctrl R--------------------
Run to line
Ctrl U --------------------
snippet




Refactoring:


Alt T ----------------------
Refactoring menu
Ctrl Shift Z ------------------
Undo refactor
Ctrl Shift Y------------------
Redo refactor
Alt Shift R ------------------
Rename
Alt Shift V -------------------
Move
Alt Shift I--------------------
Inline
Alt Shift M-------------------
Extract method
Alt Shift L-------------------
Extract local
Alt Shift C------------------
Change method signature

Misc:


F5 ------------------
Refresh
F1 ------------------
Infopop
F2 ------------------
Show resizeable hover


Go try and have fun !!

Tuesday, May 25, 2010

My first OSGi bundle

I have shown below some basic steps in creating an OSGi bundle in Eclipse.

Step 1) First open your Eclipse IDE , right click on your package explorer and choose New---> Other





Step 2)Select Plug-in Project under the Plug-in Development Header.





Step 3) A new Plug-in Project window will open , beside the project name tab write my.first.bundle then click next.




Step 4) A new window appears as :



click Next


Step 5) Select the Hello Osgi Bundle template and click Finish.



Congrats your first bundle has been created

Step 6)Now to run the same... Right click on the bundle , go to Run Configurations



Step 7) Select the Osgi framework and right click on the same and click on new-> run








Once done ,now you should be able to see:

osgi> Persistence bundle starting...
Persistence bundle started.
Hello World!!



This was a basic and simple way to create and deploy a bundle in Eclipse... lots more in the making ...till then
Try this out !!!

Monday, May 24, 2010

A Proud Zalonian

It was a bright sunny day, way lazing around in the sun reading .. when I received a call - " No Number " , there were three people on the other side Mintu,Ben and Bijoy on the other side, who I later learnt were the torchbearers of Zaloni.We had a friendly chat , and that was how it all started.


My first emotions - " Zaloni!! what kind of work should I expect after all, it from Assam, Obviously must be something monotonic " .... errr and boy-o boy I was wrong !! And very happy at the same time. The projects and the platforms that Zaloni offers start out of Assam are commendable,don't go by my word the work speaks for itself.Everything in here the people the work the team spirit is what keeps me going.


Just a simple feeling :Proud to be a part of Zaloni.:-)

a book called kite runner

I had read this book called Kite runner a few months back.... a true masterpiece .. it really captures the plight of the children in Afghanistan.A favorite quote from the same book which moved me into tears:- "There are many children in Afghanistan but no childhood".


The books depicts a friendship between two kids a son of the servant and the other one the master.Another favorite quote from the same book - "... for you a thousand times over"

If you are a book lover seriously don't miss out on this