Showing posts with label dot net. Show all posts
Showing posts with label dot net. Show all posts

Sunday, August 05, 2007

diggTraitor - Identify Fans NOT Digging You!

Based on the Digg API, diggTraitor is windows-based desktop tool to 'Identify the unDiggly Fans'. It's a fun tool developed by me, to just explore the digg API and look at a funny side of it. Sort out fans who do not Digg your 'most vaunted' stories! It's version is 0.5. I am planning for version 1.0 to have some 'Traitor Ping' functionality to directly let them know that the user isn't happy about not digging a 'diggable' story.

Talking more about diggTraitor [sounds like 'dictator'] - I have developed it in C# on .NET framework 2.0 so, one would need .NET framework 2.0 to run this application.

Write in for comments, bugs or help. If someone needs to take a look at the source-code, feel free to drop a comment or an e-mail [my e-mail address: pag.floyd@gmail.com]

You can download diggTraitor from: [mihd link] [rapidshare link] 24.5 KB
If you are not able to download, please inform me.
Some screenshots of diggTraitor v0.5:



Happy Digging!


Read more...



Post to del.icio.us

Friday, August 03, 2007

.NET Library for Digg API - Making it work!

While looking for a .NET library for Digg API, I found two (the reader may suggest more, if any, in the comments). One goes by the name 'Baileysoft.Rss.DiggAPI' which has recently been added at codeproject by thund3rstruck and comes with a good tutorial and the api code - all of it to be found here. Nothing much to say about it as the tutorial is well-written and the author promises to add more functionality soon [not all Digg API calls have been implemented].

The other that I found is here which is fairly old and in all probability, it's development has been discontinued. It goes by the name 'DiggTools'. It's development was part of 'Google Code' and the web-page hasn't been updated since quite a while both at the original site and the Google page of the project. The download page [for an Aug. 9th 2006 release] says, "This version implements roughly 90% of the known Digg.com API. It is considered beta quality with newer versions expected shortly."

Since it's old, 'DiggTools' doesn't use an appkey that's required now. That wouldn't have been a problem if the download had the source code, but there was only a DiggTools.dll at the download location. Since, it implements quite a few API calls, I decided to bring it into running condition again. There is an API's google group which proved to be of some help and also, thund3rstruck's DiggAPI. In addition, DiggTools library is licensed under LGPL, so I am not making available the modified code - instead, here are the instructions to make it run for those who want to use it.


  • First, we only have the dll file so, download Reflector to decompile DiggApi.dll to C# code. It does it fairly efficiently and we get all the code files.

  • Now, open DiggTools solution in VS (assuming), open StoryFactor.cs - right click on references & add System.dll in it.

  • Add, using System.Net; at the top.

  • Add "+ &appkey=http%3A%2F%2Fwww.unique.com&type=xml" to end of following four lines:

    • string str = "http://services.digg.com/stories" + filter + this.parseSearchOptions(theOptions);

    • string filename = "http://services.digg.com/story/" + Convert.ToString(storyID) + "/activity?period=" + time;

    • string filename = "http://services.digg.com/stories/" + Convert.ToString(storyID);

    • string filename = "http://services.digg.com/stories?count=1";

  • As you know you can add any unique app key. Also, one may define a global variable for the appkey to avoid this tedious task.

  • Now, find this method: GetStories(string filter, SearchOptions theOptions) and inside the body of the first try{} statement inside the method, replace everything with the following code:

HttpWebRequest webRequest = (HttpWebRequest)WebRequest.Create(str);
webRequest.UserAgent = ".NET Framework digg Test Client";
webRequest.Credentials = System.Net.CredentialCache.DefaultCredentials;
webRequest.Accept = "text/xml"; HttpWebResponse webResponse = (HttpWebResponse)webRequest.GetResponse();
System.IO.Stream responseStream = webResponse.GetResponseStream();
this.theXmlDocument.Load(responseStream);

  • Also, search for "min_date" & "max_date" and replace it with "min_submit_date" & "max_submit_date" in the same file.

  • Now, you are good to go. Build -> Goto 'bin' folder -> Fetch 'DiggTools.dll' -> Use it in your app!
Happy Coding!

P.S. Write in for comments, suggestions, brickbats!


Read more...



Post to del.icio.us