Sunday, October 16, 2005

I was playing around with the Yahoo Search API on the weekend and was very impressed with the wide range of services they offer up to developers.

I started looking around for a WSDL to use when I read that unlike MSN and Google, Yahoo does not use a web service, they use a method called Representational State Transfer or REST for short. "What the hell is REST? This is going to take forever!", I thought to myself. Well good thing REST is fairly easy to understand and pretty much any language can use it.

REST is defined in this Wiki entry as "any simple web-based interface that uses XML and HTTP without the extra abstractions of MEP-based approaches like the web services SOAP protocol." "What the hell does that mean?" you are probably thinking to yourself right now. Well to put it in simple terms, when you submit a URI like this http://api.search.yahoo.com/WebSearchService/V1/webSearch?query=steven+rockarts you can break your "restRequestuest" down into different parts.

Really you are saying, I want to use http://api.search.yahoo.com (the Yahoo Search API), /WebSearchService/V1/ (the web search service version 1) and webSearch?query=steven+rockarts (I want the resource you have for the web search part of the API that relates to the query Steven Rockarts (gratuitous plug)). That URL actually won't work because there needs to be an appId present try this:

http://api.search.yahoo.com/WebSearchService/V1/webSearch?query=steven+rockarts&appid=MY_ID

The Yahoo Search engine receives this request from you and says here is all the information I have for the query steven rockarts and i'm going to give it back to you in XML format.

So if you read the definition again it all should make sense. You are sending a GET via HTTP to Yahoo and they are sending you back XML. You can also use POST if you need to upload some data to the REST resource you are trying to access.

So now that you understand the dry boring part, here is some code that makes use of the Yahoo Search API. This example uses the Yahoo Search API and C#. (I have also provided the equivalent code in VB.NET).

Yahoo Search API C# Code:

YahooSearchConsole.zip (3.84 KB)

static void Main(string[] args)
{
            //Create a New Web Request to the API
            WebRequest restRequest;
            restRequest = WebRequest.Create("http://api.search.yahoo.com/WebSearchService/V1/webSearch?query=steven+rockarts&appid=MY_ID");
            restRequest.Method = "GET";

            //Submit synchronous HTTP restRequestuest to Web server
            WebResponse rsp = restRequest.GetResponse();

            //WebResponse provides stream-based access
            Stream str = rsp.GetResponseStream();
            StreamReader reader = new StreamReader(str);
            Console.WriteLine(reader.ReadToEnd());

            reader.Close();
            rsp.Close();
            Console.ReadLine();
}

Yahoo Search API VB.NET Code:

YahooSearchConsoleVB.zip (2.95 KB)

Sub Main()

'Create a New Web Request to the API
Dim restRequest As WebRequest
restRequest = WebRequest.Create("http://api.search.yahoo.com/WebSearchService/V1/webSearch?query=steven+rockarts&appid=MY_ID")
restRequest.Method = "GET"

'Submit synchronous HTTP restRequestuest to Web server
Dim rsp As WebResponse = restRequest.GetResponse

'WebResponse provides stream-based access
Dim str As Stream = rsp.GetResponseStream
Dim reader As New StreamReader(str)
Console.WriteLine(reader.ReadToEnd())

reader.Close()
rsp.Close()

Console.ReadLine()

End Sub

Sunday, October 16, 2005 8:08:44 PM (GMT Standard Time, UTC+00:00)  #    Comments [0]  | 

Sunday, October 16, 2005 7:19:56 PM (GMT Standard Time, UTC+00:00)  #    Comments [5]  | 
Friday, October 14, 2005

I haven't posted anything worth reading in the last little while because I have been a little lazy. So here is what I did this past week. 

Last week I quit my job because I got a new one. I think I spent the whole weekend filling out forms, or maybe it just seemed like it.

Tuesday night I went to the local .NET user group meeting. Dickson Wong presented on Visual Studio Tools for Office. It was a pretty interesting presentation because the content was a cool idea.

Download the slides and demo code from here:

http://edmonton.dotnetwizards.org/files/ProgrammingVSTO.ppt

http://edmonton.dotnetwizards.org/files/VSTODemo.zip

Our user group is probably going to enter the user group competition this year. But in order to be on the team you have to present an idea based on this year's theme "imagine a world where technology enables us to live healthier lives".

According to the document "a higher score will be given to the solution that improves developer's lives." Somehow I don't think a presentation where I say "get out from behind the computer and go for a run" is going to be very effective. Or maybe it will be if I come up with an application that forces developers to develop and run at the same time.

Wednesday night I read a book on Poker to prepare for the upcoming poker tournament next week. Check-Raise, Check-Raise.

Tonight I have a hockey game. Hopefully it will be more of a challenge than the last 17-2 game. I feel good today and have been watching nothing but hockey for the last week so I should have a good game.

Friday, October 14, 2005 5:49:24 PM (GMT Standard Time, UTC+00:00)  #    Comments [1]  | 
Tuesday, October 11, 2005

Just now I tried to download a free eBook from Adobe and well see for yourself: http://ebookstore.adobe.com/store/default.asp

Well it has since been fixed but it was hacked by someone from Turkey.

Tuesday, October 11, 2005 5:45:53 PM (GMT Standard Time, UTC+00:00)  #    Comments [1]  | 
Sunday, October 09, 2005

Catherine's soccer team is having a Poker tournament to raise funds for her soccer team. Come out and have some fun. I will be there!

Details in the PDF file below:

MicrosoftWord-PokerTournamentPoster_doc.pdf (38.05 KB)

Sunday, October 09, 2005 8:42:59 PM (GMT Standard Time, UTC+00:00)  #    Comments [3]  | 
Saturday, October 08, 2005

Computer Nerd Daisy

Saturday, October 08, 2005 5:27:17 PM (GMT Standard Time, UTC+00:00)  #    Comments [1]  | 

My new winter hockey team had our first game last night and I must say we have a pretty explosive offence. We won 17-2. I think that the team we played was in the wrong division and will probably get moved down.

In other hockey news, Brian is winning my hockey pool. He is 9 points ahead of the 2nd place person. To see it all, login with the username/password combination stevenrpool/letsgooilers

 

Saturday, October 08, 2005 2:49:50 PM (GMT Standard Time, UTC+00:00)  #    Comments [2]  | 

Today I received my CVS one time use video camera that I bought off of eBay. It is a neat little camera, it was cool to actually hold one instead of just looking at pictures.

Basically it is a little camera that a drug store in the US (like London Drugs) put out to allow customers to record 1 20 minute long video and after they had filled it up the customer could bring it in and get their movie put on a dvd.

People in the hacking community saw this and their eyes lit up hehe. After a little while they found a way to get the movie off of the camera themselves without having to take it into the store. Now they have a cheap reuseable camera!

So sometime soon, I am going to try the hack up on the Make magazine website myself.

Saturday, October 08, 2005 2:33:30 PM (GMT Standard Time, UTC+00:00)  #    Comments [2]  | 
Tuesday, October 04, 2005

I can't believe Sony released version 2.01 of their firmware just to take away the ability to run homebrew code on the 2.0 firmware.

This is like asking a client that you have made some software for what their favorite feature is, then patching that feature because you never intended for them to be as productive as they are with it. It just doesn't make sense!

Tuesday, October 04, 2005 2:54:18 AM (GMT Standard Time, UTC+00:00)  #    Comments [0]  | 
Monday, October 03, 2005

Well, my DevHelper idea was a good one for about 1 week. The same idea has already implemented by Rollyo (it looks like they couldn't think of a good name either).

Rollyo uses the Yahoo! Search engine, mine uses MSN Search. I think I can make mine better, this is great motivation!

We'll see what I can do this weekend.

Monday, October 03, 2005 4:07:40 PM (GMT Standard Time, UTC+00:00)  #    Comments [0]  | 
Sunday, October 02, 2005

I have decided to make a free fun hockey pool over at www.officepools.com 

The rules:

1 - Anyone can enter.

2 - Your have to pick your players using my webpage located at:

The pool was closed on October 5th so I took the page down.

3 - Your picks must be submitted no later than October 4th 2005

4 - Forwards are awarded 1 point in the hockey pool for each point they get on the ice.

5 - Defencemen are awarded 1 point in the hockey pool for each point they get on the ice.

6 - Enforcers are awarded 1 point in the hockey pool for each penalty minute they get on the ice.

7 - Goalies are awarded 2 points in the hockey pool if they score a goal or an assist, they are also awarded a point in the hockey pool for each win they get and 2 points in the hockey pool for each shutout they get.

8 - Rookies are awarded 1 point in the hockey pool for each point they get on the ice.

You will be able to see the standings using the username: stevenrpool and the password: letsgooilers

Good Luck!!!

Fun | Hockey | Personal
Sunday, October 02, 2005 10:08:15 PM (GMT Standard Time, UTC+00:00)  #    Comments [1]  | 

Theme design by Jelle Druyts

Pick a theme: