jump to navigation

Dont Preach Linux. Just Mention it ! October 9, 2008

Posted by razasayed in general.
Tags:
add a comment

Im a big fan of GNU/Linux , but if there is one thing that is a huge turn off for me , is seeing some people preach Linux, as if its a religion . These people bash those who use Windows . They allege Windows users to be “Sheep” and refer to Microsoft as “M$” or “Windoze”, which i think more often than not is plain bragging.

But i think this reflects bad on the Linux community , and by forcing people to convert to Linux we might end up intimidating them and hurting their sentiments which might result in them rejecting or even hating it.  I think , a person who has been using Windows all the time will switch over to an entirely new OS, not if it is forced upon him, or if he is ridiculed for using the system he uses, but only if he is truly convinced that the new operating system would work for him .

Here is a nice blog post , i came across which highlights this issue : http://dogbuntu.wordpress.com/2008/07/27/dont-preach-linux-just-mention-it/

So, lets invite people to Linux , instead of ridiculing them for using Windows . We dont need religious zealots , to each one his own…..Free as in freedom 😉 .

Code::Blocks, a good C/C++ IDE for Linux October 2, 2008

Posted by razasayed in programming.
Tags: ,
3 comments

Just some time back my brother who was using a Linux machine, asked me how he could do C/C++ development on that platform . Most colleges here in Mumbai teach students how to use the Borlands Turbo C++ IDE, a.k.a TC which i think by now is pretty outdated and can well be classified as an antique piece of software . Also, its a Windows only program , and when it comes to C/C++ programming on “Windows” most students never look beyond “toy” programs like prime numbers, factorial, matrix operations etc and use Microsoft Visual Studio for doing GUI stuff.

I think Linux is a good platform for budding C/C++ developers to hack on , where C/C++ are still the main “programming” languages used by developers , in addition to “scripting” languages like Python , PHP etc..

While there are numerous alternatives for C/C++ programming on Linux as far as IDE’s are concerned , for example, Eclipse , Anjuta , KDevelop etc, Code::Blocks according to me appears to be a really easy to use and lightweight IDE . Also just like Eclipse, Code::Blocks is also plugin based, and supports a lot of cool features we expect out of IDE’s like integrated debugger ,syntax highlighting, code completion , class browsers etc..

To install Code::Blocks on my bros machine running Ubuntu i performed the following procedure :

Step 1) Code:Blocks requires the wxWidgets , a cross-platform C++ GUI toolkit to be installed, so first install that by issuing the following command at the terminal :


sudo apt-get install libwxgtk2.8-0

Step 2) Download the Code::Blocks binary for Ubuntu from http://www.codeblocks.org/downloads/binaries

Step 3) Unzip the archive. Now , you will get a set of deb files.

Step 4) Finally, run the following command to install :


sudo dpkg -i *.deb

Thats it . You should now see the icon for Code::Blocks in your Programming Menu.

Note : I was facing some issues while trying to build gtk+ programs in Code::Blocks v8.02 , inspite of having the libgtk1.2-dev package installed .  However, the problems were resolved once i installed the libgtk2.0-dev package .

Happy Hacking ! 🙂

Google Chrome Released September 3, 2008

Posted by razasayed in general.
Tags: ,
2 comments

https://i1.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 🙂 .

A beautiful prayer August 24, 2008

Posted by razasayed in general.
add a comment

Where the mind is without fear
and the head is held high;

Where knowledge is free;
Where the world has not been broken up into fragments
By narrow domestic walls;

Where words come out
from the depth of truth;

Where tireless striving stretches its arms
towards perfection;

Where the clear stream of reason has not lost its way
Into the dreary desert sand of dead habit;

Where the mind is led forward by thee
Into ever-widening thought and action

Into that heaven of freedom,
My Father
Let my country awake.

— From Rabindranath Tagore’s “Geetanjali”

The Zen Of Python August 22, 2008

Posted by razasayed in programming.
Tags:
add a comment

Heres a list of 19 aphorisms which serve as guiding principles for any python hacker . In the python community, a solution or piece of code conforming to these principles is said to be “pythonic”.

  • Beautiful is better than ugly.
  • Explicit is better than implicit.
  • Simple is better than complex.
  • Complex is better than complicated.
  • Flat is better than nested.
  • Sparse is better than dense.
  • Readability counts.
  • Special cases aren’t special enough to break the rules.
  • Although practicality beats purity.
  • Errors should never pass silently.
  • Unless explicitly silenced.
  • In the face of ambiguity, refuse the temptation to guess.
  • There should be one– and preferably only one –obvious way to do it.
  • Although that way may not be obvious at first unless you’re Dutch.
  • Now is better than never.
  • Although never is often better than *right* now.
  • If the implementation is hard to explain, it’s a bad idea.
  • If the implementation is easy to explain, it may be a good idea.
  • Namespaces are one honking great idea — let’s do more of those!

These principles are also distributed with python (ofcourse its “batteries-included” 😉 ), hidden like an easter-egg . Just type the following at the python interpreter prompt to view it.

import this

Linus uses Fedora August 18, 2008

Posted by razasayed in general.
Tags:
add a comment

I recently came across an interesting interview of Linus Torvalds, where he says that the distro he uses is Fedora Core 9 . Being a person who has a very specialized area of work i.e. the Linux kernel, he says he doesnt care much about distros as long as they are easy to install and use, so that he can focus on his core line of work instead of bothering with the rest of the details.

He also added that as far as user friendliness goes there are others also like Ubuntu, and now Debian also, but the reason he uses Fedora is purely historic as it had good support for PowerPC back when he was using one.

You can check out the interview at http://www.simple-talk.com/opinion/geek-of-the-week/linus-torvalds,-geek-of-the-week/.

Hope u enjoy reading it 🙂

PageRank Vs. BrowseRank . The algorithm wars August 12, 2008

Posted by razasayed in general.
Tags: , ,
2 comments

I talked about Yahoo! revamping its search service in my previous post.Now can Microsoft be far behind ?. Well, according to Microsoft, the formula behind Googles success in the search area is their “PageRank” algorithm . The PageRank algorithm rates the relevance of a page based on the number of pages that link to it, and how many pages link to those pages so on and so forth….

Microsoft says it has come up with a better algorithm which it calls “BrowseRank” . Now instead of relying on the number of links between pages , this algorithm determines a page relevance by the actual number of hits it receives by users . So, the more visits of the page made by the users and the longer time periods spent by the users on the page, the more likely the page is important. So BrowseRank brings a human touch to the assessment of a pages relevance.

Now, whether Google or Microsoft or Yahoo! will have the final word in search technology only time will tell, but so far Google no doubt leads with Yahoo! at number two and Microsoft at number three 😛

You can read more about this algo war here

Yahoo! India creates ‘Glue’ August 11, 2008

Posted by razasayed in general.
Tags:
2 comments

Well, heres something that caught my eye lately . Yahoo! India RnD has come up with a brand new avatar of their search codenamed ‘Glue‘. Launched only in India as a test market, it combines traditional search with visual and relevant data from the web collated from multiple sources in a very intuitive manner.

Intuitive because it has smart algorithms which figure out what you’re looking for – so if you search for ‘Sachin Tendulkar’, you are thrown up his player profile from Cricinfo, stats etc. Search for ‘Maldives’ and you’ll see photos from the honeymoon destination, a map and other relevant data. Similarly, an entry for ‘Infosys’ gives you stock quotes, company info and such. Very clever. Interesting to see how much different search providers are ramping up their technology to compete with “The Great Google” in the search business.

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

Posted by razasayed in programming.
Tags: , , ,
63 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 !! 🙂

Isn’t RoR scalable ? August 5, 2008

Posted by razasayed in programming.
Tags:
add a comment

A recent piece of news doing the rounds is that Twitter , the microblogging service provider is moving away from Rails framework, due to outage problems,and planning to start from scratch with PHP or Java . However, Evan Williams the co-founder and CPO of Twitter has denied this .