Monday, April 03, 2006

Saturday, March 25, 2006

TagyuLib - Tagyu .NET Client Library


I have finished writing a .NET client library for Tagyu's REST Web-Service. Tagyu is a hosted service that uses human intelligence to suggest tags and categories relevant to a block of text.

TagyuLib (that’s my creative name for the .NET API) supports everything that the REST API of Tagyu allows you to do as of now. So it supports both classification queries and related-tags queries. It also allows you to pass your username/password to Tagyu through HTTP basic authentication scheme. If you're wondering what am I talking about here, you should really be reading Tagyu REST web service documentation first.

I have created a project at GotDotNet CodeGallery to share the source code of TagyuLib and it would be great to see people participate.

I hope some people would find TagyuLib useful and I would love to hear from them. But right now it is 2:15 AM and I need to get some sleep.

Update on March 25, 2006

Here is the class diagram and some sample code to get you started.

Class Diagram



Sample Code


Determining tags and category

You need to instantiate a new TagyuService object and simply call its GetClassification method passing-in your text. GetClassification will return you a ClassificationSuggestion object and you can loop through the items in its Tags property to do whatever you want. You can also get the category for your text from the Category property of the ClassificationSuggestion object that you got back.


string inputText = Console.ReadLine();

TagyuService ts = new TagyuService();

ClassificationSuggestion s = ts.GetClassification(inputText);

Console.WriteLine("Suggested Tags are: ");

foreach (Tag tg in s.Tags) {
Console.WriteLine(tg.Value);
}

Console.WriteLine("Suggested Category is: {0}", s.Category);



Determing related tags

That's equally simple. All you need to do is instantiate a new TagyuService object and call its GetRelatedTags method passing in the tag for which you wish to see related tags. GetRelatedTags returns a RelatedSuggestion object and you can loop through the items in its Tags property.


Console.WriteLine("Enter a Tag");

string inputTag = Console.ReadLine();

TagyuService ts = new TagyuService();

RelatedSuggestion r = ts.GetRelatedTags(inputTag);

Console.WriteLine("Related tags are: ");

foreach (Tag tg in r.Tags) {
Console.WriteLine(tg.Value);
}



Using your Tagyu username and password

As of now, unregistered users can make one request per minute from a single IP address to Tagyu and requests beyond this limit result in an error. So if this bothers you, you should create an account at Tagyu. You can pass your username and password to Tagyu through TagyuLib simply by setting these properties on the TagyuService object before invoking GetClassification and GetRelatedTags methods. Here's how:


string inputText = Console.ReadLine();

TagyuService ts = new TagyuService();

ts.Username = "[YOUR-USERNAME]";
ts.Password = "[YOUR-PASSWORD]";

ClassificationSuggestion s = ts.GetClassification(inputText);

Console.WriteLine("Suggested Tags are: ");

foreach (Tag tg in s.Tags) {
Console.WriteLine(tg.Value);
}

Console.WriteLine("Suggested Category is: {0}", s.Category);



Download

This way please!

Requirements


Bugs/Issues/Feedback

I'd love to hear from people who've used TagyuLib. Please share your feedback, issues and any bugs you encounter here.

Contributing

Join the project and get started.

Changelog

  • March 25, 2006
    • Initial version

  • April 02, 2006
    • Merged SuggestedTag and RelatedTag classes into one.
    • Renamed Suggestions to ClassificationSuggestion.
    • Renamed Related to RelatedSuggestion.
    • Added an overload for GetRelatedTags that takes a Tag object as argument.

Saturday, March 18, 2006

Multimon Quake3

OK imagine this: You have 24 monitors in front of you - covering every inch of your field of view, and a 12 node Linux cluster. And you are using this setup to play Quake3 with a gyro-mouse (basically a mouse that you can move in air). Add surround sound to the setting, and you’ll have the most awesome gaming experience of your life. They’re doing this at Virginia Tech.



Here's a video from YouTube:




I like playing Quake3 and this blew my mind!

Via

Thursday, March 16, 2006

So you <3 Sudoku?

Sudoku (Japanese: 数独, sūdoku), also known as Number Place, is a logic-based placement puzzle. The aim of the canonical puzzle is to enter a numerical digit from 1 through 9 in each cell of a 9×9 grid made up of 3×3 subgrids (called "regions"), starting with various digits given in some cells (the "givens"). Each row, column, and region must contain only one instance of each numeral. Completing the puzzle requires patience and logical ability.


Though Sudoku is fun even when played alone, it's actually a lot more enjoyable if you're competing with someone. IronSudoku.com is an online version of the game with a social flavor to it. The website basically allows people to chat with each other while playing. A new puzzle is posted at the website every day so you have 24 hours to solve it. I'm surely looking forward to solving some.

The interface of the game at IronSudoku is very clean and user-friendly and if you know the rules of the game, you can get started right away.

I would really like it if there was a way, let's say, for me to invite some friends of mine to IronSudoku for a competition online. I (organizer) should be able to pick the difficulty level of the puzzle for the event. At the start of the event, the system should start a timer ticking and pick a puzzle of the specified difficulty randomly. Every participant would receive the same Sudoku to solve from the system. And the Chatterbox should allow chatting only between the players in that competition. A visual indication should be given by the system as soon as somebody solves the puzzle. I'm sure this would be a lot of fun!

BTW as of now you have to be a Pro member to add other IronSudoku members as friends.

Monday, February 20, 2006

SMS based payments

TextPayMe is a website that allows you to use your mobile phone to pay other people by sending text messages. I think that’s very cool and I remember discussing the exact same thing with Alpha0 back in November last year. Sadly we never got past doing anything more than merely talking about it but then there was lots of stuff happening at that time and there was hardly any time.

Friday, December 09, 2005

Tagyu::Search v0.03

I have incorporated support for two new features in my Tagyu::Search module and learnt a lot about HTTP in the process.

1. Support for HTTP Basic Authentication

With this in place, it is now possible for Perl code using my module to break the one request per IP barrier imposed on anonymous users by Tagyu. So register yourself at Tagyu right now!

This is what you need to do in your code:

# Instantiate a new Tagyu::Search object.
my $tagyu = Tagyu::Search->new(
username => "[YOUR-USERNAME]",
password => "[YOUR-PASSWORD]"
);

# Invoke the SuggesTags method on the Tagyu::Search object.
my @tags = $tagyu->SuggestTags("[YOUR-TEXT]");

However anonymous searches through Tagyu::Search package are still supported.

2. Introduced two new methods SuggestTagsText and SuggestTagsURL.

SuggestTagsText encodes all the special characters like '=', '+', '&', etc. before passing on the text to the Tagyu Web Service, while SuggestTagsURL considers its argument as a URL and uses the Tagyu Web Service to suggest tags for the text at the specified URL.


Download Tagyu-Search-0.03 and let me know how it works for you. As always, feedback is welcome!

Why is open-source good for learners?

It is widely agreed that the best way to learn about something is to teach it.

By opening up the source of a project, you're actually teaching the people who'd read your code, how you solved the problems that you encountered in your project.

Everybody understands that there’s a lot to learn about programming by reading other people's code, but in fact you would also learn a lot by starting an open-source project, in the same way as you'd learn about a topic by teaching it to someone.

So start hacking an open-source project today even though you might not have attained God status yet in the technologies required for its implementation. Don’t worry about the mistakes you’d make as your ascent towards God status would continue with your hacking.

Wednesday, November 30, 2005

Visited foss.in/2005

I attended the first two days of foss.in conference held at Bangalore. It was held in the Bangalore palace grounds with the magnificent palace in the backdrop.



There were five halls and a ball-room which had sessions running in parallel. Each of the halls was named after a famous open-source personality – Torvalds hall, Stallman hall, Cox hall, etc.



I enjoyed being there and it was very inspiring to know about the work of the speakers.

I attended Rasmus’ talk on cross-site scripting detection and prevention. His talk on deploying large-scale PHP was very useful too because there were some useful general points in it. Starting from an example of writing a simple and scalable webpage hit monitor, he went on to discuss various configurations for setting up replication in MySQL which are highly scalable.

I found the talk by Gopalarathnam Venkatesan on programming the Mozilla platform using XUL very interesting. After attending the half-hour talk, I felt confident enough to dig my hands into XUL.

The talk by Gopal Vijayaraghavan on DotGNU was very informative too. I am very interested in .NET and Gopal was in the news for having ported DotGNU to Simputer within 72 hours and hence my interest in his talk. He mentioned the problems he had faced as a developer and how you end up doing everything that nobody wants to do when you are a lead developer. It was an informative talk.

Glancer is a real cool app which anyone attending foss.in can use to plan his schedules and find people who have similar interests as him. Nirav Mehta talked about the process of building Glancer using OpenLaszlo, the technical issues they faced, etc.

Premshree introduced the audience to Ruby in his presentation while Avik Sengupta wrote a cookbook application from scratch in his presentation by using Ruby on Rails.

I met (in no particular order) Rajaram, Swaroop, Sumeet, Philip, Premshree, Gopal, Suhas and Pradeep. It was quite exciting to meet the people behind the blogs that I had been reading. Often a mere mention of CarryOnCoding.com was enough to help them recognize me instantly. Swaroop even gave me a sneak peek on his yet-to-be-launched website running on TurboGears, a web development framework for Python.

I am strong believer in the merits of open-source and it was truly inspiring to see people dedicate an enormous amount of energy and time into building interesting and often challenging stuff and then sharing the code with everyone by making it open-source.



Visit my moblog for more pictures that I took at the conference.