Thursday, November 5, 2009

Things I need to do part-time

I think there a lot of things in everybody's life ( especially a programmer's life) that cannot be done in a single day,few days or even a couple of weeks,but which can be accomplished if persistently done over a period of time.Some of these tasks may go to completion and some may not.But,for what it is worth,every project - especially one taken up by own will - gives a certain learning experience.And that experience,is priceless.
So,in this vein,I will jot down some of the tasks that I need to pursue part-time,while at job,at night or at week-ends or in some idle time.And I think this list is gonna get bigger by the day.So here it is :

List of Things to be done
----- -- -------- --- -- ------

  1. Programming a Game

Wednesday, November 4, 2009

CS,Algos,Programming demystified...

The crux of the matter about programming,Algos and Computer Science is this...

  1. Try to analyse every problem step-by-step.I know it can be frustrating at times,but then,if u avoid it,u r just delaying this event.
  2. Try to articulate your thinking process in a programming language of your choice.Take a prog. Lang. that helps you most in putting down the thought-patterns.
  3. Then repeat it all over again....

In these steps,for a particular task at hand,there will come a time when you will start getting more than 1 way to do things... I think that a good enuf "break" or interrupt to get out of this loop.

I would like to put here an Excerpt from a ebook "Introduction to Media Computation A Multimedia Cookbook in Python",in which CS was described.I think it deserves to be bookmarked or archived.So here's how they have defined CS :

Computer Science Idea: Computer science is the study of recipes

They’re a special kind of recipe—one that can be executed by a computational device, but that point is only of importance to computer scientists. The important point overall is that a computer science recipe defines exactly what’s to be done.

Tuesday, August 25, 2009

How to make a Firefox search plugin

For each of us,who extensively prowl the web for more information in a browser, the mozilla search bar is more than handy. Using it we can easily query a keyword, with probable-query drop-down list, getting the results in a new Tab. But many a times a time comes when we feel the necessity to go beyond the available list of search engines that come by default with Firefox. At that time,we normally have only 1 option - To find more search engine from Firefox search add-ons. But, this is useful only if you are lucky enough to get the required site engine as add-on. But, more than often , this is not the case.Apart from the most popular search engines,normally we don't find search engines for our sites. I came across a similar situation today when I wanted to add search add-on for the a Google code search site.

So, I had to make a custom plugin :) .

I googled for it and found that the following site gave a way to 'encapsulate the googling-of-site ' so to speak . I wanted more. So, I searched the plugin addition mechanism in Mozilla itself to get an idea of the format used. With this experience and some tweaking and hacking, I found the following steps gave me a working search add-on :

1. Open a new file in a text editor.

2. Add the following lines of code initially :
<searchplugin xmlns="http://www.mozilla.org/2006/browser/search/" os="http://a9.com/-/spec/opensearch/1.1/">
<os:shortname>Google Code</os:ShortName>
<os:description>Google Code Search Engine</os:Description>
<os:InputEncoding>UTF-8</os:InputEncoding>

- Here, the 1st line is sort of a way to show that the document conforms to the standards.It is same for almost any plugin.You can copy-paste it.
-
shortname is what appears in the toolbar drop down menu
- description is what it literally means - a short description. It is not very important.
- InputEncoding is what character-set is being used. Default value is UTF-8.


3. Thereafter an optional favicon can be added.The code for that is enclosed within these tags :

<os:Image width="16" height="16">
</os:Image>
4. After that add the URL for site of the search-engine :

<SearchForm>http://code.google.com/ </SearchForm>
5. Next is the most important Url field, in which the query pattern has to be specified.The common attributes are :
- method is either GET or POST . related to http request cycle. Use GET as default value as most sites support this method.
- type is the datatype that is being sent. Mostly it is text.
- template specifies the exact URL template that is sent to the search-engine to retrieve your query.
This can have many variations :
i. Normally, the queries are values supplied as values of form variables.e.g. for google scholar it would be
<os:Url type="text/html" method="GET" template="http://scholar.google.com/scholar">
<os:Param name="q" value="{searchTerms}"/>
ii. But,sometimes the query is very obscure and can be found only with proper documentation or with a lot of trial-and-error.e.g. The value for deeperweb search plugin the field would be

<os:Url type="text/html" method="GET" template="http://www.deeperweb.com/results.php?cx=!004415538554621685521%3Avgwa9iznfuo&cof=FORID%3A11%3BNB%3A1&ie=UTF-8&src=p2&q={searchTerms}">
</os:Url>
iii. For,the present example,the most suitable method was the following

<os:Url type="text/html" method="GET" template="http://code.google.com/search/#q={searchTerms}">
</os:Url>
Another common type of query involves a different query protocol called json and is of the following form :

<os:Url type="application/x-suggestions+json" method="GET" template="search query template">
</os:Url>

In all the above examples, the query that is supplied in the firefox search field goes to the
{searchTerms} part.

6. The plugin is completed with the following line :

</SearchPlugin>

..... & EurekA!

Some of the plugins I have developed are :

public static void main()

/*

Hi every1!

I think I am finally going to start blogging after all...

Indeed,I was in this dilemma of whether to wait till eternity for finding when I will be 'knowledgeable-enough' to start writing a 'meaningful' blog or to just start off like many others to write anecdotes of personal history,taste,... & what not!

Anyways,as you might have guessed by now.... I am going to Blog after all! . Though I am still in considerable confusion about the outcome of doing so.

In this Blog,I will try to share the results of my technical endeavors,coding nightmares,rendezvous with new paradigms,expeditions into unexplored language territories and their aesthetic appeal at times.... in short all things geeky! I will try to be as clear and detailed as possible and update the posts in case something of relevance needs to be added/altered. In any case,any suggestions regarding improving the blog are always welcome.

*/

{ LEt thE j0urnEy bEg!N }