jump to navigation

Google Chrome Released September 3, 2008

Posted by razasayed in general.
Tags: ,
2 comments

https://i0.wp.com/www.google.com/chrome/intl/en/images/logo_sm.jpg

I recently downloaded and checked out Google Chrome , the open source browser developed by Google , and i must say that its a pretty innovative browser design . However the browser is still in its early stage in tune with Googles philosophy of “Launch early and iterate” , so i wont be shifting to Chrome from Firefox just as yet 😉 . The first thing we notice in Chrome is its minimalist design much like the Google homepage . Google says it doesnt want the browser to get in the way of the users browsing experience, but rather help them get to the content they want as easily and efficiently as possible.

The Windows version has been released and they are going to soon come up with the Linux and Mac flavors too. Now, why another browser when there are already established ones in the market like Microsoft IE , Apple Safari , and Mozilla Firefox (this ones my personal favorite 🙂 ) ?

Well, according to Google, the current browsers were made considering the Web as it used to be , not how it is now . Nowadays , the Web (a.k.a Web 2.0) is more about applications than just websites , and hence keeping this in mind they have designed a browser from scratch considering the Web as it is now and where it is heading.

In current browsers, all tabs are loaded into a single process, so if something goes wrong in one tab the entire browser crashes . Also, if we open and close many tabs then things like Memory fragmentation happen which slows down the entire browser .

Google says it has solved this problem by making use of a technique found in many modern day operating systems . Chrome makes use of a multi-process architecture where each tab is a separate process, so things like fragmentation and problems in one tab bringing down the whole browser dont happen . Chrome also makes use of a more powerful JavaScript engine, V8, to power the next generation of web applications that aren’t even possible in today’s browsers.

Also, another first in Google Chrome is the Task Manager, which is similar to the Task Manager in operating systems . The Chrome Task Manager shows you exactly how much memory is being used by each website you have open .  So, if you find some resource hogging webpage then you can kill it without affecting the other pages you have opened . Now this ones really clever, isnt it ?.

Another interesting feature is the ‘Incognito Mode‘ . Webpages that you open and files downloaded while you are incognito won’t be logged in your browsing and download histories; all new cookies are deleted after you close the incognito window .  Now this should delight all those naughty people out there who more often than not have forgotten to cover their tracks by clearing their browsing history and saved cookies…lol  😉

If you want to check out all the major engineering decisions that went behind developing Google Chrome then check out their comic-book .

Google Chrome is completely open source , it makes use of components from various open source projects like Apples WebKit and Mozilla Firefox , and hence wants others to be able to make use of its technology and improve it further . Chromium is the open source project behind Google Chrome . If you are interested in hacking chromium check out http://code.google.com/chromium/ .

Now having talked about whats there in Chrome  , i would now like to suggest a few things i found missing and would love to see in future versions :

1. Support for extensions . This is one of the place where Firefox really rocks and i think if Chrome is to have the cult like following enjoyed by Firefox then this one is a must have .

2. Smart location bar , something like the ‘Awesome Bar’ of Firefox .

3. Bookmark Tagging . This would allow tags as shortcuts in the address bar .

Alright, so heres wishing the Chrome project all the very best 🙂 .

How to write your own IM program/GTalk client in Java August 7, 2008

Posted by razasayed in programming.
Tags: , , ,
64 comments

Here i will show you how you can write your own simple gtalk client using an open source java library called “Smack“. Smack is a cross-platform Open Source XMPP (Jabber) client library for instant messaging and presence , and as you will see it actually makes writing your own client to connect to any jabber service a breeze 🙂 . The library is extremely versatile but to keep things simple, here we develop a program to exchange messages with a buddy of yours in GTalk.

But before we start, what the heck is XMPP and Jabber ? . If you already know this you can skip to the next part.

You see there are many, many IM clients around. Companies such as Microsoft, and Yahoo provide IM services based on proprietary messaging protocols, and also provide popular client software (Microsofts MSN Messenger and Yahoos Yahoo Messenger) using these protocols. Many third-party clients also work with these protocols. However, these protocols remain proprietary and closed, which tends to make them difficult to work with for a developer.

Jabber is an open, XML-based “standard” for instant messaging and is an open source alternative to the proprietary messaging protocols . Jabber uses XMPP (Extensible Messaging and Presence Protocol), which is an “XML based protocol” , for transferring messages. Since the Jabber messages are transmitted in XML form it makes it easy for developers to work with them. Googles instant messaging service uses the Jabber protocol .

OK, now lets get our hands dirty with some code, shall we ? 🙂 . Alright, here we go .

Step 1) To start with download the Smack API

Step 2) Create a folder for your project. Create a lib subfolder . Unzip the downloaded zip file and copy the following files to the lib subfolder : smack.jar, smackx.jar,smackx-debug.jar.If you want you can also copy these files to any other location of your choice and then add the location of these files to the classpath.

Step 3) Now we write the actual code for implementing our gtalk client. To do that first create a file MyGTalkClient.java in your main folder, or anywhere else if you have added the location of the jar files to your classpath.

Step 3.1) The first step is connecting to the GTalk service  The code below does that :


ConnectionConfiguration config = new ConnectionConfiguration("talk.google.com",5222,"gmail.com");
XMPPConnection connection = new XMPPConnection(config);
connection.connect(); /* Connect to the XMPP server  */
connection.login("username","password"); /* Login to the IM service */

“talk.google.com” is the host. 5222 is the port number and “gmail.com” is the service name.

Step 3.2) To send a message to a buddy we use the Chat class as follows :

Chat chat = connection.getChatManager().createChat("friend@gmail.com",new MyGtalkClient());
chat.sendMessage("Hi"); /* Send the message  */

The first argument to createChat method is obviously the email id of your buddy in GTalk . The second argument is an instance of a class that implements the org.jivesoftware.smack.MessageListener interface . This listener interface receives incoming messages and calls its processMessage method to process the message.

Step 3.3) Now, the next step is making sure that we receive the messages that our friend sends . To do that we implement the processMessage method of the MessageListener interface as follows :


public void processMessage(Chat chat,Message message) /*Callback method from MessageListener interface . It is called when a message is received */
{
        System.out.println("Received message: " + message.getBody());
}

Step 3.4) After you are done chatting with your friend you can disconnect from the server as follows :


connection.disconnect() ; //Disconnect 

There we are . A simple bare-bones Jabber client to connect to the GTalk service is ready ! .The final code looks like this .

Step 4) If you have not added the locations of the jar files to the classpath , you can compile and run your chat client as follows :


javac -cp lib\smack.jar;lib\smackx.jar;lib\smackx-debug.jar MyGTalkClient.java

java -cp lib\smack.jar;lib\smackx.jar;lib\smackx-debug.jar;. MyGTalkClient
(Note the ;. at the end of the classpath)

Thats all there is to it ! . From here on you can explore the API, and try to come up with really cool ideas for using instant messaging and presence in your applications.

Happy Hacking !! 🙂