Categories
World Wide Web

Service integration using YubNub

I have never been so excited by 'simple' ideas since the time I saw RSS way back in Aug, 2004.

When I had first seen YubNub, I knew that this idea was here to stay. But then it was quite in its early days and so was not quite usable other than like the Yahoo open shortcuts that I blogged about here.

Today, I happened to revisit that site again. Whew! What a wonder! It has pipes, multiple parameters, string utilities, conditional constructs etc. So a mere combination of commands and you can be working wonders!

To give you an example, suppose you have a server, you can host a set of JSP's (or any other dynamic page) that takes parameterized input and process it and pipe it between sites. This is how you can create personal agents that extract info from one place, automatically blog about it, add sites to bookmarks… the possibilities are unlimited.

An other advantage of this is you just have to remember commands to get your things done. No need of URL's or even short URL's for that matter.

An example is:

garfield -year {rand -min 1979 -max 2005} -month {rand -min 1 -max 12}

will show you the garfield comic for a month randomly. (This is a command I created to check the site out).

Try running it here.
(In order to be convinced by the power of the command, try running this command 3-4 times and see the results).

And if you have a Googlenym, then you can use YubNub to publish your site/page.

Ex: This is mine:

gfl threepointsomething

Try running it here.

An interesting observation is the movement from the GUI back to the command line way of working. The sheer expression power of the command line is unmatched compared to the GUI and that is what is making this click.

And if you are interested there are a host of utilities like Konfabulator widgets, FF integration, FF extension etc that you can use… and enjoy!

And if you are not impressed, it is nothing to do with YubNub; perhaps my explanation was not good and you should go and check it out yourself. 🙂

And these are the YubNub commands that I wrote:

garfield
diggspy

Want to experiment more with this.

Categories
World Wide Web

Sudoku – Take 1

While the Bulls and Cows experiment is still incomplete, this weekend I found myself trying out another interesting thing. This time it was Sudoku.

I started off writing a simple problem solver, which, given a problem gives the solution. But my intentions were different. I wanted to write a problem generator that is able to generate problems.

This is not easy as it sounds. The problem solver that I wrote was using the simple backtracking algorithm (I just want to get things working – computers today are good enough to solve these problems in negligible time).

The problem generator is more interesting because of the following constraints:

* The problem generated should have a unique solution.
* The set of givens (i.e. the digits that are present in the problem) should be a minimal set – this means that there should not be a smaller set of givens that can also generate the same unique solution.

The algorithm that I used is this:
* Fill up the first row of the matrix using random numbers.
* Generate a complete solution using this row.
* Now start off a loop analyzing which of these numbers are required and which ones are not. A number is considered as required if removing that number will result in the solution seizing from being a unique solution.

I don't know if this algorithm is right, but I expect it to guarantee that the problem generated satisfies the constraints given above.

The experiment went well and this is what I found:
“The number of givens is between 22 and 26 with a matrix of size 9×9”. Of course, as mentioned in the Wikipedia article on Sudoku, the number of givens has little or no bearing on the difficulty level. That is something that I need to analyze.

Here's the source code in C(Requires Linux/Unix because of use of system function).

Categories
World Wide Web

Firefox extensions – my picks

Recently I have developed a craze for Firefox extensions. Although I knew about the extensibility of Firefox, I was not aware of the different extensions that helped me use the browser JUST the way I wanted to.

I use Firefox 1.5 and although some extensions don't have extensions compatible with this version, some hacks can be done to make 1.0 extension work in 1.5.

Here is the list of extensions that I recommend (alphabetical order):

* Fasterfox 1.0.1: http://fasterfox.mozdev.org/
This extension speeds up the loading of pages.

* FoxyTunes 1.1.5.4: http://www.foxytunes.org/firefox/
Use this extension to control virtually any player from within Firefox.

* Gmail Delete Button 3.3: http://www.arantius.com/article/arantius/gmail+delete+button/
This extension adds a (much expected) Delete button in the Gmail interface.

* IE Tab 1.0.7: http://ietab.mozdev.org/
Open pages that REQUIRE IE from within Firefox at the click of a button.

* Image Zoom 0.2.2: http://imagezoom.yellowgorilla.net/
Helps you zoom in/out images (this feature is otherwise not available in Firefox).

* Live HTTP Headers 0.11: http://livehttpheaders.mozdev.org/
Very useful for HTTP users to find out the exact HTTP headers of all incoming/outgoing requests.

* MR Tech Local Install 4.0: http://www.mrtech.com/extensions/
This has a lot of features, one of them worth mentioning is the Firefox restart option, that can be used to restart Firefox when you install themes/plugins.

* RSS Panel 1.18: http://www.xs4all.nl/~jlpoutre/BoT/Javascript/RSSpanel/
If there is an RSS embedded in a page, this extension displays a panel containing the titles of the RSS feeds and also allows you to open the RSS link.

* ScrapBook 0.18.4: http://amb.vis.ne.jp/mozilla/scrapbook/
Another beauty. This extension makes your Firefox like a grabber.

Other than its use as a grabber, there is another interesting way of using it:
Consider that you want to grab all IEEE papers related to topic XYZ. Usually these papers (the freely available ones) are published in the PDF format. So Google for:

filetype:pdf IEEE XYZ

and then use Scrapbook to grab all PDF's. Voila, all PDF's are now downloaded in a jiffy.

* Scrollbar Anywhere 0.8: http://perso.wanadoo.fr/marc.boullet/ext/extensions-en.html
If you are using a 2 button mouse, then use this extension to scroll the window, by right-clicking in the browsing window and then dragging the mouse.

* SessionSaver .2 0.2.1.030.4: http://adblock.ethereal.net/alchemy.cgi/SessionSaver
My favorite. 🙂 This extension, combined with the MR Tech Restart magically transforms your browsing experience. You can use this extension to restore your session the way you left it. You can also re-open an accidentally closed tab.

* Tab Mix Plus 0.2.5.2: http://tmp.garyr.net
Adds several options to the tabs. PS: Instead of installing different extensions for single tab related features, use this ONE extension for all your TAB needs.

* Viamatic foXpose 0.2: http://viamatic.com/firefox
This extension helps you to see all the open tabs in neat little tiles. You then click on a tile and move to that tab.

* Web Developer 1.0: http://chrispederick.com/work/webdeveloper/
A breeze for web developers. This allows you to work with your Firefox browser to perform various checks – like image properties, form properties and you also get to use it like a dynamic CSS editor (my favorite option).

Some others that are good – this list has those extensions that are really good, but I use them less frequently:

* Answers 1.24: http://www.answers.com
* DownThemAll! 0.9.8.4: http://downthemall.mozdev.org
* FlashGot 0.5.9.99: http://flashgot.net
* Gmail Manager 0.4.1: http://www.longfocus.com/firefox/gmanager
* Super DragAndGo 0.2.4: http://morphis.eu.org/
* Tab Mix Plus 0.2.5.2: http://tmp.garyr.net

And yeah, before I conclude, let me tell you this:

There is an application called MozBackup (http://mozbackup.jasnapaka.com/) that helps you in saving your configuration so that you can restore it in case of crashes, or transfer it to a different system.

Categories
World Wide Web

What’s your ego?

This is mine:



Results (as on Jan 10th):

engine ranking ego points
google.com 1st, 2nd, 5th, 6th, 7th, 13th, 22th, 23th, 25th, 33th, 36th, and 37th 13337
yahoo.com 1st, 2nd, 3rd, 4th, 6th, 7th, 8th, and 13th 7386
msn.com 1st, 2nd, 3rd, 4th, and 7th 5948

I figured in the top 50 list!!! 🙂

Categories
World Wide Web

Yahoo open shortcuts

This is a superb gift from Yahoo for the new year. This allows you to use the Yahoo search box like a command line via Yahoo Open Shortcuts. Although this is quite similar to the Yubnub tool, I found this very interesting.

In fact, with a small tweak, you can use this from the Firefox address bar.

Here's how you do it:

1. Create a bookmark (Bookmarks->Manage Bookmarks… and then New Bookmark…) with the following entries:

Name: Yahoo
Location: http://search.yahoo.com/search?p=%s&ei=UTF-8&fr=sfp&fl=0&x=wrt
Keyword: yahoo

2. Now enter the following in your search bar:

yahoo !set ljupdate http://www.livejournal.com/update.bml

and press enter.

3. You should get the following message:

Open Shortcuts allows you to use custom keywords to directly search or jumpstart a task on any site from the convenience of a Yahoo! Search box. Please confirm that you would like to add the following Open Shortcut:

* !ljupdate http://www.livejournal.com/update.bml

Press “OK”.

4. Next time you want to update your lj, you just enter:

yahoo !ljupdate

and voila!

This is a simple example I have given. You can try out many things similar to this.

For example, I have created shortcuts to open my bookmark archive, search it. In fact, Yahoo has provided shortcuts to open a particular wikipedia article, compose a mail using Yahoo mail etc.

Some problems though:

* It does not work in AJAXian interfaces or even with POST URL's.
* You cannot have atmost one parameter defined.

Anyways, save time in the new year. 🙂

Categories
World Wide Web

Predictions 2006

So what if the predictions don't come true? Afterall, which astrologer has made cent per cent accurate predictions? Here's my attempt at it. These are predictions about companies and technologies in the year 2006.

STATUTORY WARNING: THE VIEWS MENTIONED HERE ARE SOLELY FOR FUN AND NOT TO BE TAKEN SERIOUSLY.

1. Google will get into serious trouble in the middle of the year, which may be a set-back for one or more of their web initiatives. The entire world has its fingers crossed. In a serious turn of events, however, Google emerges the winner with minor bruises.

2. Microsoft makes yet another attempt at thrashing open source. This could be either in the browser industry or with support for open source.

3. Microsoft releases the much awaited Vista. However certain features are not made available saying they are being finalized. It gets decent response.

4. Some major fight occurs in the open source community. This might result in one famous person losing his respect.

5. Yahoo launches 2 very powerful web applications. The response is really enormous initially, but the effect dies down soon for one of the applications. The effect of the other continues for some time.

6. RSS sees a major revolution in some form. It provides special support for blogs, bookmarks and becomes bi-directional.

7. Tagging sees a major revolution. It becomes more organized but maintains its simplicity. It is provided special support from one of the biggies.

8. Semantic web as usual is not able to make a major impact as 'the' technology, but sees application in some new industry verticals and silently continues its influence.

9. IBM, with the release of Workplace makes a major breakthrough in the collaboration space.

10. Apple releases yet another music device with advanced capabilities. The response is superb.

11. And last but not the least, there is some company other than the biggies that will thrive. There is a fight among 2 majors to acquire that company.

Wanna have fun? Make predictions.

Categories
World Wide Web

Bulls and cows – computer simulation results

Context:
My experiments with Javascript – The Bulls and Cows Game
The bulls and cows game

I started off writing the Bulls and Cows game just to pass time when I am bored, but soon it turned out to be an interesting mathematical problem. Also thanks to for the interest shown.

I continued my experiments yesterday. I started off by writing a small function that analyzes the already entered numbers and gives the list of possible numbers that can match all the criteria (in the previously entered numbers) and be a possible solution. This was supposed to be a hint to the user.

I saw that the list of possible solutions diminishes as the user enters more and more numbers (this is quite obvious, but I want to make it clear). In order to assist the user to select the next number, I created a weighted system (explained later) that gives the user the most probable solution.

This finally led to the simulation of an environment, where player 'A' thinks of a number and player 'B' tries to guess it, both player 'A' and 'B' being computer controlled. (Computers are so dumb that a single program can contain both player 'A' and 'B' without them knowing about each other 🙂 )

I ran the simulation for each and every possible number (1 to 9999) and guess what? With some tweaks, the computer is able to find the solution in an average of 6 steps. The maximum steps it requires is 10.

Here is a graph showing the result:

The algorithm that I wrote is as follows:
1. Player 'A' thinks of a number.
2. Player 'B' starts of with number 1234 as the first try and player 'A' responds with the number of bulls and cows in the number. (I haven't tried other numbers, but I guess it will give similar results)
3. Player 'B' tries to find out the set of solutions that can match each of the previous steps.
4. 'B' then finds out how many times each digit occurs in the list of possible solutions. These form the weights of the digits.
5. Using this, 'B' computes a weight for each possible solution as folows:
If 'abcd' is a possible solution and the digits 'a','b','c','d' have weights 'p','q','r','s' respectively, then weight of 'abcd' is 'p'+'q'+'r'+'s', such that 'a','b','c','d' are distinct. If they are not distinct, then each digit is considered only once to compute the weight -> (This is the tweak I had to apply).
6. 'B' then finds the number with the highest weight and uses this as the next step.
7. Repeat Steps 3 – 6 until you get the solution.

I ran this simulation for all the numbers from 1 – 9999 and got the following results:
Algorithm 1 result sheet.
It took me about 20 minutes to run the simulation in my system (an average of about 10 games per second).

I am not sure if this is the best solution, but there are learnings from this:
* It is possible for a computer to find out a solution in an average of 6 steps or less.
* The maximum number of steps required to arrive at a solution is 10 or less.

Please note that the algorithm was not tested (i.e. I am not sure if it works exactly as I have mentioned it here), but the answers it provides and the steps have been authenticated.

Is there any better solution?

Categories
World Wide Web

A successful experiment!

100+ hits in 24 hours!

I should consider my experiments as successful.

I have made minor modifications to the the appearance and usability of the page.

Here's the link: Bulls and Cows game.

Categories
World Wide Web

My experiments with Javascript – The Bulls and Cows Game

I managed to get a Javascript game called “Bulls and Cows” up and running:

Here's the link.

The rules for playing the game are given in the same link. Enjoy!

Categories
World Wide Web

Google blog search experiments

.

I searched for the string:
“web 2.0” (collaboration or ajax or blogging or blog or blogs or wiki or rss)
in Google Blog Search and this is the result I got.

The links in the search results differ only in their '#', which means that they refer to the same page but different positions in the page.

In blogs, is it a good idea to have such links or is a single result enough?