Wednesday, March 19, 2008

Automated (Hacking out) subscription to Google Alerts

Recently I have been trying to write a "automated email notification" software program to subscribe to email notifications from Google Alerts. A quick look at the news groups for Google API show up that there is not API to do a subscription programatically .... time to get the hand dirty digging through the web interface :)


A quick look at the source yields the following information

  • action="/alerts/create?hl=en&gl=" method="POST"
This means url encoding will not work and that we will need to do a http post instead. Fortunately this is quite easy to do in C#. The next step is to figure out the parameters being passed.

Search terms name="q"
size="20" maxlength="256"

Type name="t"
value="1" News
value="4" Blogs
value="2" Web
value="7" Comprehensive
value="9" Video
value="8" Groups

Frequency name="f"
value="1" once a day
value="0" as-it-happens
value="6" once a week

Email name="e"
size="20" maxlength="256"

As such, an example of the parameters for the Search term "Google" in News as-it-happens being emailed to myemail@email.com will be as follows after URL encoding:
  • q=help&t=1&f=0&e=myemail%40email.com
Hard coding this will yield the following code:

public string TestGoogleAlertSubscription()
{
System.Net.WebRequest req = System.Net.WebRequest.Create(@"http://www.google.com/alerts/create");
req.ContentType = "application/x-www-form-urlencoded";
req.Method = "POST";

byte[] bytes = System.Text.Encoding.ASCII.GetBytes("q=help&t=1&f=0&e=myemail%40email.com");
req.ContentLength = bytes.Length;

System.IO.Stream os = req.GetRequestStream();
os.Write(bytes, 0, bytes.Length);
os.Close();

System.Net.WebResponse resp = req.GetResponse();
if (resp == null) return null;

System.IO.StreamReader sr = new System.IO.StreamReader(resp.GetResponseStream());
return sr.ReadToEnd().Trim();
}
Running this VS2005 using debug mode yields the following response showing a successful subscription.

Checking the inbox will show the verification email.

Its been a while

Its been a while since I last made an entry to this blog. Too much work and other stuff going on in my life over the past 1/2 a year..... Almost forgot about this blog, until someone left a comment and I got an email notification. :P

That spurred me on to update this as perhaps its too much of a coincident that what I am working on recently is related to email notifications. :) Stay tuned for more information.....

Thursday, September 27, 2007

CoScriptor

Another nicely done tool from IBM......

While its concept is nothing new (think Web Marco tools like iMarco, Selenium etc), it adds in a few really nice touches.

  1. Collaboration + Tagging => You can share and use script from others together with a standard tagging system. What really separates it is the private database that let you define/customise "variables"
  2. Firefox integration => No need to startup a separate/additional program
  3. Stored in easy to read text => the "source code" literally reads like a use case ..... can't wait to see its future integration with Rational tools. This flexible parser is probably the coolest touch.
  4. Step run and running of script => Amazing done, with highlighting and direct script/web interface editing possible to accommodate any deviations. While Selenium does this too, CoScriptor is much narrower in its scope and hence able to do this more intuitively.
Firefox users should really give this a spin.

Friday, September 14, 2007

Technology..... using it to save or waste

Technology is a double edge sword. As new technology makes it possible to create innovations like cost effective solar panels to support and sustain us, we get closer using technology for achieving a more renewable and sustainable planet. Unfortunately, for every step forward, it is human nature to stray.

Russia recently tested a vacuum bomb ..... from this article it says that this new and bigger bomb is made possible via nanotechnology.

The bomb is smaller than the MOAB, employing nanotechnology to double the heat from a blast, according to the Russian military officer.
I have always though of advances and applications in nanotech as positive advancements form mankind (e.g. nanofilters for water filtration to remove the need for chemical treatment, reduce petroleum usage, etc) ..... I guess this adds a new twist to it

Thursday, September 13, 2007

lists, sets and everything nice

Lists and sets, 2 very simple concepts but at the core of many many computer programs.

I simply love the idea behind listphile

Listphile is a powerful tool for organizing and collaborating around structured information. Call it a database tool, if you will (but please don't scare anyone away).

Listphile was borne of curiosity, and the belief that we learn more effectively when we have a framework for collaboration and knowledge sharing.

Simple, yet opens up a whole new world for developing mashups. I have a couple of prototypes written in .Net that does something similar => get a list of stuff and simply make it consumable via RSS. Originally i wanted to use it together with in Mashup with Google sets to create basic catalogues that are ready for use in rapid prototyping (Think of it as sample Northwind database on RSS crack :P). But Listphile did it and added in a dash of collaboration, really cool.

The potential for growth in this is immense, imagine a nice list of blogs, eating places etc, before mashing it up with geotags, they can be used by dropdown boxes to query it live instead of either coding it in the html pages or generating it off a stored database. I have always personally felt that there should be a repository for generic list information for things like countries, cities, last names etc. The other aspect that this can really take off is in the area of metadata. One of the problem with metadata as Cory Doctorow mentions
People are stupid - Even when there's a positive benefit to creating good metadata, people steadfastly refuse to exercise care and diligence in their metadata creation.

Take eBay: every seller there has a damned good reason for double-checking their listings for typos and misspellings. Try searching for "plam" on eBay. Right now, that turns up nine typoed listings for "Plam Pilots." Misspelled listings don't show up in correctly-spelled searches and hence garner fewer bids and lower sale-prices. You can almost always get a bargain on a Plam Pilot at eBay.

Constrain the metadata to a collaborative list that is managed by a community will certainly be the first step to better metadata and eventually a more semantic web.


Sunday, September 9, 2007

Is it time for 64 bit computing?

Lately I have been looking around for a new computer (Funded not by me of course :P). Looking at getting some 64bit cpu power and picking a suitable OS. After listening to this Hanselman minutes podcast, I sort of decided that going 64bit Vista is a good idea, especially since I intend to be running VPCs off it.

Monday, August 27, 2007

NOSO

Came across this site recently.

NOSO is a real-world platform for temporary disengagement from social networking environments. The NOSO experience offers a unique opportunity to create NO Connections by scheduling NO Events with other NO Friends.
With all the craze over social networks and such, this site remind me of a subtle point of meeting people .... its not always about connections.

Flying penguins on SIA

It not often that Singapore gets positive limelight in IT news (Yup I am refering to Odex...) but this article certainly sounds like something which will make IT people take a second look.

To make flying more enjoyable for its passengers, Singapore Airlines Ltd. is adding bigger screens, more in-flight movies and a PC, running Red Hat Inc.'s distribution of the Linux operating system, in every seat on its newest planes.
That by itself is nothing really special, but the following is what I guess really makes it stand out.
KrisWorld can also be used as a PC and includes Sun Microsystems Inc.'s StarOffice application suite, which offers a word processor, spreadsheet, and a presentation program. Every seat is fitted with a USB (Universal Serial Bus) port that lets passengers access documents carried on a thumb drive or portable hard disk.

Monday, August 20, 2007

Event Driven Architecure

Event Driven Architecture (EDA)

is a software architecture pattern promoting the production, detection, consumption of, and reaction to events. - Wikipedia
This area has recently caught my interest. Previously when I was still at Cornet Technologies, the framework which I had developed had an "aspect of delivering data" which seemed to be a mismatch with the SOA approach that it was based off. After looking through this glossary, EDA seems like a natural fit to it. Guess I will be looking more into this area in the coming weeks.

Friday, August 17, 2007

Firefox dictionaries

I realised that after my move over to Australia that my Firefox installation had lost its built-in spell checker. At first I thought that it was the result of certain new plug-ins I had installed, but after look round a bit, found out that it was because of a missing dictionary.

In short what happened was I after getting to Australia, I changed my operating system time zone setting, which also change the dictionary that was being use.

The solution is simple, right click on any text area which you would normally expect the spellcheck to be active -> languages -> Add dictionaries.


After that, simply click on the dictionary you need to install it.