Monday, July 11, 2011

Reseting of Root Password in Linux !

Just follow the simple steps given below in case you have forgotten your root password and need to reset the same :


1. At grub boot screen (after restart) , Select the Kernel.
2. Press the e key to edit the entry .
3. Select second line (the line with the word kernel).
4. Append the letter S or Single or 1(depending on the system) to the end of the (kernel) line.
5. Press ENTER key.
6. Now press the b key to boot the Linux kernel into single user mode.
7. you will be promted a root shell.
8. type passwd root to change the root password.

Monday, June 20, 2011

Installing phpMyAdmin in Ubuntu 10.04

PhpMyAdmin is a nice database management and administration tool,and its easy to install too. The steps are given below :

Type the following line in the Terminal:

apt-get install phpmyadmin

After the installation is over type the following command to open up this file:

gksudo gedit /etc/apache2/apache2.conf

Add the following line of code inside apache2.conf file :

Include /etc/phpmyadmin/apache.conf




Now restart the Apache by typing in the following command:

sudo /etc/init.d/apache2 restart



Now open up the given page in your browser:


 http://localhost/phpmyadmin/


Now you should be able to see the phpMyAdmin landing page !




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 :-)