Digiwar - the Yeep-blog

April 27th, 2006

Small update on FeedME

The plug-in redesign is as good as done. It’s not useful right now, a lot of stuff is still hardcoded, but the basics are there. If I ever decide to make this plug-in thing work I should be able to do so without too much effort.

I also had to deal with some bugs in the Google Reader. Hey, it’s beta and the API is not officially release, so this was to be expected. Wasn’t fun though.
Google Reader seemed to give me lot’s of duplicate articles when I requested the articles for a particular feed. I don’t know what caused it, but, for instance, the Channel9 feed gave me over 2500 articles. After some examination I noticed that a lot of then were duplicate. I’ve seen some articles reappear 44 times. So I filled a bug report for this in the Google Reader group and implemented a little check when downloading feeds. FeedME now checks if an article with that feed ID has already been downloaded and if it is, it won’t be added to the article list.
Ofcourse I still see duplicates, but far less. The unread article count went from 2500+ to around 150. And the duplicates I see now can simply be marked as read so they won’t reappear. If you mark articles with the same feed ID as read, you’ve effectively marked all of them as read. And sometimes that’s not what you want and it will make wonder where your unread articles went to. I speak from experience…

So what’s still to come?
First the new website. I’m working on this, but it takes some time.
An installer. Yes, I want you to be able to simply double click something and have FeedME installed. Right now it’s just a zip file which you need to extract and copy somewhere manually.
And finally support for labels. FeedME already uses labels and shows them by pretending they’re folders. But you cannot add, remove or edit labels just yet. This needs to be possible as well.
After that, it’s beta 1 baby!



[Last played: Devil Driver - The fury of our maker’s hand]

April 19th, 2006

Google Reader SID, how to get it

When I announced I was going to write my own Google Reader front-end, I also mentioned I might put the Google Reader API specs on this website. I haven’t done this so far, so this might be a good time to start.
I’m not going to put up a page with it just yet, but I am going to document some of the things as blog entries.
One of these things is how to get the Google SID of the logged on user.

Before I can cover the obtaining itself, I must first tell you how Google Reader knows if you are logged in or not. While others, like NewsGator, might use a username and password combination in the API calls, Google Reader works through cookies. At least, far as for as I know it does, there might be another way, but I don’t know it. One of the things I’ve seen people say is to just add the username and password in the URL when doing an API call, much like you would when accessing FTP from your browser. However, one of the security updates for IE included removing the ‘@’ as valid input when entering an URL in IE. This makes it impossible to add the username/password to the URL. FeedME uses the WinInet functions from Windows and these might not share the same URL cracker that IE does, but I just want to be sure I don’t shoot myself in the foot when Windows Vista comes out and they also secured the WinInet DLL there.
So cookies it is. Since I use WinInet it’s actually pretty easy. It shares the cookies with IE, so if you’ve logged into Google from IE, FeedME can use that cookie. If I used the .NET HttpWebRequest class (and its related classes) I wouldn’t share the cookies, but there is a work-around. Why don’t I use the standard .NET classes? Read this and you’ll understand.

Okay, so if you have the right cookie, you’re logged in, if you son’t, FeedME sends you to the login page using the embedded browser and allows you to log in from there. FeedME doesn’t even know your username and password!
But being logged in isn’t enough, some of the stuff I want to do, like download your list of feeds requires me to know your user ID, or as I’ve begun to call it, your Google SID. And that’s where I ran into a problem.

At first I would just ask for your reading-list, which basically is all the articles from all the feeds you are subscribed to. This call was based on the cookie and didn’t need to Google SID. In one of the XML nodes that came with that list, even if it was empty, was a string with the Google SID in it. So I parsed it and I was done. However, now the XML changed and now I need to find a new way.

My first try was to see if maybe the Google SID moved somewhere else, but the only place I could see it was in the ID of the list. I think the ID can change very easily, so I don’t want to be dependent on that.
The only other place I saw the Google SID was in the labels and states of articles. You see, every article can have labels and states. These are just text strings that have a special meaning within the Google Reader. These labels or states have your Google SID in them. So I can parse then and be done, but I figured that maybe sometimes you don’t have a single article on your reading list.
To test this I created a new Google account and lo’-and-behold, no articles and no Google SID. Damn!

But the webbased Google Reader interface appears to know my Google SID. So into the javascript I went.
Unfortunatly the Javascript from Google is compressed. And rightly so! I read somewhere it saves them bandwidth in the order of several GB per day. But the compression made the javascript indecipherable, so another dead end. Time to Google!

I found a lot of info on Google and the cookies, but nothing which helped me. I found someone else who had run into the same problem as me and had resorted to request the Google Reader UI page first and parse that for the Google SID. This was something I already considered, but only as a last alternative.
And I also found a Ruby script by Ben Ferrari, with which to delete all your Google Reader subscriptions. He used the SID value of the Google cookie, but this is encrypted. I thought he might know how to decrypt it, so I read the source. No decryption, but I did notice that he did some API-calls for which he would need the Google SID, but instead of the Google SID he would use a hyphen (’-'). Intrigued by this I tried it and it worked!!

Thank you Ben!!

Ofcourse _now_ I look at the Google Reader blog en see that one of their tips also uses a hyphen instead of a Google SID. Ah well…

[Last played: Lacuna Coil - The Game]

April 18th, 2006

Writing a plug-in architecture in .NET

So I wanted FeedME to be versatile. I want it to be able to use any back-end. So for that to be possible I need to create a plug-in architecture so you can easily write a DLL that provides a new back-end to FeedME. The plug-in architecure is basically just a list of functions FeedME will assume are there and will want to use. The best way to achieve this is by defining interfaces.
So I went on happily defining all kinds of functions in different interfaces. Then I decided that I only wanted singleton classes.
For those that don’t know, a singleton is a type of class that get’s instantiated only once. You keep on using the same instance throughout the lifetime of the process.
You do this by defining a class whose constructor is private and which has a static Create() function. The class also has a static variable that simply contains an instance of it’s own class. So the create function just returns this reference and so everytime you call Create(), you get the same class reference. Ofcourse it can be implemented in some other ways, but I just wanted to explain what a singleton is.

So, I wanted to define a static Create() function in the interface, but you cannot do that.
Allrighty….so then I tried making an abstract class that implements the interface which has a static Create function. And again, not possible. Well it’s possible to create the abstract class, but in order for a derived class to implement it’s own Create() function I need to mark it “virtual” and that’s not allowed on a static function.

*sigh*

So I just made the normal interface and put in the comments/documentation that the class must behave in a singleton manner.
I did define a factory interface with Create() functions, but they are just not static.

That’s what I’m missing right now, some way of enforcing design pattern usage for classes that derive from a base class or who implement an interface. I would like that even more then LINQ.

Another issue I ran into was how to instantiate the class whose name you don’t know. In “old” days you’d create a DLL which had a C function in it that created the class for you. But in .NET you can’t have a stand-alone function, they’re always part of a class. But then I remembered that’s what reflection is for. You can just look in a DLL and see what classes are in there and implement which interface. So all I need to do is enumerate through the classes in the DLL until I find the one that implements the interface I need.
Sounds simple, but I have not yet implemented it, so I don’t know if it truly is that simple. I’ll know soon enough :-)

[Last played: Lacuna Coil - Devoted]

April 18th, 2006

FeedME progress

I’m already working on the 4th alpha version of FeedME. I added a lot of stuff and decided it was time for a overhaul. That’s the downside to creating a program without a full-fledged design. But it makes the programming more fun.
The reason for the overhaul is that I wanted to add more and more stuff, but ran into problems implementing them. So far I’ve been able to find a solution simple and easy enough, so that proofs to me that I designed the program very good in my head up front. But not, with adding folders, it’s become more difficult. So I’ve decided to improve the design instead of trying to break my head in getting it to work well enough. An overhaul is inevitable, so why not do it now?

I also found out that the name “FeedME” has been taken by various people/organizations, including one for another feed reader. So I’ve decided to rename the program. I won’t reveal the name until the website is done however. I’m working on that as well.

If you want to see what I’ve done so far, you can download FeedME Alpha 3 from my website. It will be a few weeks before I get the releasing alpha 4 I think. I want to make it work better and easier to improve first. I also think that Alpha 4 will be the last FeedME release, after that I will release the program with the new name and with an installer to make things easier. I will also announce the program more widely.

My plans for FeedME:
- Make a cool, basic, feed reader.
- Make it expandable so people can add other back-ends (I make it for use with the Google Reader back-end).
- Go after FeedDemon (Allright, so this is a far fetched dream, but what’s the point in doing something without a hard goal to achieve).

Lastly I have 5 articles I still need to post. Or actually, take time to write about. I have them in my “drafts” list, but I still need to do them. I know that writing keeps me in touch with the people “out there” and the more I write the more people will find me through Google, but I’d rather be programming to be honest. But I’ll do my best.

[Last played: Evanescence - Taking Over Me]

April 11th, 2006

Stupid error messages

Here is an interesting error message IIS gave me when I tried to start the default website: Unexpected error 0×8ffe2740 occurred
Ofcourse, what it meant to say was: Port is already in use.
If it had said that directly I would’ve immediatly known what was wrong. Now I had to Google for the answer first.

I hate stupid error messages.

[Last played: Slayer - In the name of God]

|