December 2004 - Posts

Another Year, another bit of code done

We are 18 minutes into 2005 here in New Zealand...20 minutes before midnight I finally got my MetaWeblog API code working with Beta 2.3 of CommunityServer::Blogs.

So the future is safe for blogging from itty-bitty devices (although I wish they'd implement metaWeblog.newMediaObject). Since DotNetJunkies is going to upgrade to CS::Blogs when it's released, it might finally be possible for me to create a post with categories from a Pocket PC (the MetaWeblog API code I'm working on at the moment supports categories, but unfortunately DotNetJunkies doesn't like them from that source any more than from the SimpleBlogService.asmx web service. My guess is that it's category id-related).

So anyway, here I am now 25 minutes into the new year and I'm still talking about software.Sigh.
Some people might conceivably argue that I should get a life. Or at least a cardboard cutout of one.

All things considered I will at least fix myself another kir royal. Good night ladies and gentlemen.

Gmail Atom feed from C#

This morning I came across a tip Jonas Galvez posted a few months ago entitled Proxy your Gmail feed with Python.
I thought (as you do) “That looks like fun” and decided to knock out a C# version.
So here it is, wrapped up in a nice cuddly method but without any error checking, asynchronous processing or other fanciness (it was just an idle fiddle after all...I'll look at doing something with it later):

private static XmlDocument GetGmailFeed(string userName, string password)
{

    HttpWebRequest req =
    (HttpWebRequest)WebRequest.Create(https://gmail.google.com/gmail/feed/atom);
    req.Method = "GET";
    req.Credentials = new NetworkCredential(userName,password);
    XmlDocument response =
new XmlDocument();

    HttpWebResponse resp;

    resp = (HttpWebResponse)req.GetResponse();

    if(resp.StatusCode==HttpStatusCode.OK)
    {

       XmlTextReader reader =
new XmlTextReader(resp.GetResponseStream());
       response.Load(reader);
       reader.Close();

    }

    resp.Close();
    return response;

}

Of course, Most aggregators will happily consume the feed for you if you can provide them with your credentials, but where's the fun in that?

On the awkwardness of timing...

So here am I putting the finishing touches on MetaWeblog API support for an extended version of my Pocket PC blogging application, and now I find out that Charles Cook created a Compact Framework version of his XML-RPC library back in September.
Still, given that I'm only performing a small number of operations, where both the original message and the response fit within a limited set of patterns, the roll-your-own-XML-with-XmlTextWriter approach I've used is probably reasonable for the size of the task, especially since the timetable is determined by nobody other than myself.
And I must admit that I'm quite enjoying doing a bit of old-school raw(-ish) XML over HTTP coding again...it reminds me of my first experience with XML over HTTP back in the glory days of 2000 when men were real men and small furry creatures from Alpha Centauri were real small furry creatures from Alpha Centauri (my apologies to the estate of the late, brilliant Douglas Adams)...and when I had another timing issue, since I needed to do this from the back-end of an ASP application before Microsoft released the production version of ServerXMLHTTP - which resulted in me doing some quick boning-up on Windows sockets so I could write a COM component to do the job.
But I digress. Quite a lot, in fact.
My tests so far have been mostly from a desktop app using the subset of XML features that are supported by the .NETCF - I find it's useful to concentrate on the API at this stage without the distractions of Pocket PC deployment and UI issues. It also makes it a bit easier to try various things out. But so far everything's going very well, and I hope to have a significant upgrade ready for anyone who's still interested before I have to go back to work (I mean where they pay me for being where I don't want to be and doing what I don't want to do).

On comment spam: I have just discovered that Texas is the Root of all Evil

When I first started getting comment spam of a commercial (i.e. obviously commissioned to pervert page rankings in Google) nature, the vast majority of it came from China. This pattern continued for some considerable time, but I have lately noticed a switch.

While it is difficult to be certain about this (since US states do not have their own domain suffixes. Yet), I can't help noticing that in many of the masses of links for disreputable businesses that have been sent in comments to this blog lately, the word “Texas” features prominently. So as far as I can tell Texas is now the home of commercial comment spam.

I could not help also noticing that some of this Texan comment spam appears to promote that odd, infantilised and commercialised pseudo-Christianity to which some people in the US are strangely susceptible (whether as a result of a dietary deficiency or having been dropped on their heads as babies, I do not know).

So, given that spam is undeniably a manifestation of Evil, religion hawked by spammers is obviously the work of the Anti-Christ.
This leads ineluctably to the conclusion that Texas is the home of the Anti-Christ.

Who would've guessed?

Command line compilation in .NETCF v2.0

Following a post on Jono's blog pointing to Visual Studio 2005 beta documentation on new features in .NETCF v2.0 (and another from Peter Foot pointing to the first, which acted as a reminder to check it out), I went and had a look around (as one does).
One thing I was pleased to see is that MS appear to have made good on a promise (well, assurance I suppose) made in the early days of the Compact Framework that they would eventually provide support for the .NETCF in the SDK.
You can find the details (along with a handy batch file example that seems to have (quote?) encoding issues) here.

Some of you will be thinking "Goody, now I can create automated batch builds of my Enterprise .NETCF applications! The Senior Vice President In Charge of Junior Vice Presidents in Charge of Asking People To Make Coffee will be impressed!".
Yeah, whatever.
To me the great significance of this is that it helps to keep the base of Windows Mobile developers broad and lowers a significant barrier to entry, since there are many talented developers out there who will not be able to afford Visual Studio 2005 Professional (and can't currently afford VS .NET 2003 Professional) - the sort of people for whom the old Embedded Visual Tools hit the ideal price point.

I don't want to read to much into prerelease documentation (which I may be doing already), but I also find the following statement encouraging: 
         “The executable file, which can be copied to the device or emulator, will be built in the current directory“

...which suggests at least the possibility that the emulator will be included in the SDK (admittedly they could just be referring to a batch build scenario for people who have Visual Studio).
Still, if the release version of the SDK includes debugger support for .NETCF (it doesn't at the moment), there are some very interesting possibilities for third parties (that's you and me, folks) to have some fun writing (or trying to) IDEs in the latter part of next year (or earlier with the betas of course if we have any sense).

Finally a chance to get some work done...

I've got two weeks off starting on the 13th. Since I'm not going anywhere (I was, but unfortunate circumstances intervened) I'll be able to put in some quality time on my personal projects: completing (or seriously advancing) my work on Pocket PC blogging tools, familiarising myself with the Avalon CTP and hopefully having some fun therewith (my eventual goal there is Space Invaders: I know some people don't think that's an appropriate use of the technology but guess what they can kiss), working on my web presence, posting my CV in XAML format (actually I might do that before I go on leave), and  doing some work on the use of RSS for a somewhat-smart-client-based alerts system. Also delving into WSE2 (Aiieee, the angle brackets! The angle brackets! They are coming for me!).

That and learning to play “Man Of The World” properly. There's such beautiful guitar work by Peter Green on that song. It's amazing how much feeling can be conveyed in a few relatively simple chords (and the other bits).