Category Archives: Techie

local.live.com Snowdon Mashup

I don’t like the term “mashup” but I wrote a quick “mashup” to show the route I took up Snowdon on sunday (I didn’t go all the way). Try it out. The javascript needs some cleaning but it works for now. Note: I haven’t tested in in IE.

To tie this in with a handheld GPS (which I plan to get for christmas) would be really cool. You could download the Longitudes and Latitudes that you have walked and add them to the Javascript config and presto you can see an aerial view of your trip.

Snowdon Mashup

Update: It does seem to work in IE6 but as Andy pointed out below – I haven’t tested in Safari but I havn’t done any Javascript naughtiness so it should be fine.

Another update: It doesn’t work in Safari – Not because of anything I have done – Local.live.com doesn’t work in Safari – phew

Yet another update: I’ve updated the Javascript, it’s much neater and half the size. It works in IE (the menu is out of position though), Firefox and Opera.

C# XML encoding woes

I have a simple XML document fragment with a euro symbol in it:
[code lang=”xml”]

Lorem ipsˆum dolor sit amet,

[/code]

which I want to load into an XML document.

[code lang=”cpp”]
System.Xml.XmlDocument doc=new System.Xml.XmlDocument();
doc.LoadXml(xml);
[/code]

I then output the XML of that doc to see that all is well – alas it is not, It has decided to re-enocde my beautiful numeric entities.
[code lang=”xml”]

Lorem ips€um dolor sit amet,

[/code]

I cannot find a way around this. It still works well, but god damnit . I want my bloody entity references back you bastards. Can anyone please help me. I have tried XMLTextReader and XML streams and all sorts of other google groups induced madness.

Update:

I managed to figure out a way to re-encode the data after it has been loaded into xml (after it has been xslt transformed or just as a string)-
[code lang=”cpp”]
System.Xml.XmlDocument docOut=new System.Xml.XmlDocument();
docOut.LoadXml(xml);
string text = docOut.OuterXml.ToString();

System.Text.StringBuilder sb = new System.Text.StringBuilder(text.Length);
foreach (char c in text)
{
if (c > 0x0080)
{
sb.Append(“&#”);
sb.Append((int)c);
sb.Append(‘;’);
}
else
{
sb.Append(c);
}
}
Log.logError(” sb.ToString(); = “+sb.ToString()+”\n”);

System.IO.StreamWriter sw = System.IO.File.CreateText(outXMLFile);
sw.Write(sb.ToString());
sw.Flush();
sw.Close();

//docOut.Save(outXMLFile);
[/code]

I’m not too sure but there might be a way to override the OuterXML property of the XMLDocument class. I hope so. For now it works and I am chuffed -now to get back to what weekends are really for, laundry and cleaning drinking 🙂

Dev crazy

In an attempt to vary the type of programming I am doing, out of office I have been working on quite a few cool projects. Outlined a few below – unfortunately none are for download yet as they are still in progress.

KarovaDev Firefox extension
As Karova‘s main product is a hosted e-commerce solution, we naturally have to integrate with quite a few payment service providers. It can be a chore to test our stores with these payment service providers, having to enter dummy or real credit card details everytime. I hate monkey work so I wrote a firefox extension for the Karova developers to help in the testing of Karova stores. It’s pretty sweet, You can edit all the default data passed for each payment service providers, specify the domains or virtual directories (if installed on localhost) to test against. The final test page scans all the user’s cookies and chooses the ones that match the supplied domains etc. You can then choose your site and test to your heart’s content- saving hours of monkey work.
Screenshot of KarovaDev firefox extension
It was nice to work on a beefy extension again. It re-affirmed to me how good the Gecko/ XUL platform is.
Philroche Blog Tool
Most of the C# work I do in wrk is web applications running on IIS. I do some command line apps that run as scheduled tasks but I don’t have cause to develop any GUI apps. Microsoft released Visual Studio 2005 express so I downloaded it and gave WinForms a shot… easy peasy to get a nice GUI designed and built. I decided to write a simple RSS aggregator to see how easy it would be.
Philroche Blog tool view feed
I haven’t written the RSS parser yet but I have the tree view and the Mozilla ActiveX control working well. I could have used the built in webbrowser (IE) component but then why would I want to do that.
Philroche Blog tool make post
I wanted to see if I could integrate with the wordpress API too to make blog posts so I turned to Xstandard (the lite version). Xstandard also have a .NET component that you can use. It is really neat and you can bet your house on the markup being valid.

Visual studio 2005 express is excellent and free too (as in beer). Also checkout SQL server 2005 express which I have used on a very beefy project already and it is ace – also free (as in beer).

Mod_Python
Since having a fairly new Dell machine donated to me by my Dad I have been feverishly using Ubuntu. I have Apache and mod_python running and have a nice little app running. Mod_python as a development platform is sweet as it is not as contstrained as TurboGears or Ruby on Rails. It is very hard to debug though.

So all in all I am getting some nice variety in my dev work, I find it can sometimes get stale if you’re doing the same thing day-in day-out, especially if it involves legacy asp sites. Is there anything you guys would recommend trying out as an antidote to work work while still being dev work (if you know what I mean). I do want to look at mono and PyGTK.

Skype mania

I love Skype and use it for most of my calls. I have a Skype-in number “+44121 288 5321” and I have Skype voicemail too. I recently got my dad set up so we can have free calls.

I was wandering around Sainsburys the other day and was very surprised to see a leaflet allowing you to top-up your Skype-out credit.

Sainsburys Skype-out top up

Then today I was wandering around Asda and saw 2 usb skype phones and a a skype starter package. Skype have one hell of a marketing machine – We can learn alot from the way Skype is growing.

Asda skype starter package

XGL madness

I managed to get (with some help) XGL working on the iBook and it runs quite well considering the graphics cards in those machines. All the key bindings were screwed though (it being a mac keyboard – an australian one at that) and it misunderstood the size of my screen so all my apps were going under the gnome toolbar. I’ve disabled it for now but it is possible.

Archive date grep V1.0

Archive date grep is a python script that allows you to archive (choosing zip or tar) all files within a directory structure which have been modifies since a user defined date. The archive maintains the original directory structure which makes it ideal for releasing websites. You can downlaod the script as a zip archive[zip 2 KB] or as a tar archive [tar 8 KB]. This script is alot better than the original SimpleZipDateGrep that I had on the site. Enjoy 🙂