Saturday, August 26, 2006

A few new articles, a few updates

Over the last couple of weeks, external pressures have caused me to cut back on the Microsoft Money FAQ website and support in the newsgroups. I don't expect this to change for a while.

However, I did manage to squeeze in a few new articles. One article turned into two and another one was on my to-do list, ever since I was asked about viewing data in high contrast by a partially blind person.

So, there is now a very short article showing what the 'patterns for chart views' option does (FAQ Article 432). Along with this are two articles on the sanitize.exe program (FAQ Article 430 - what the tool does, and FAQ Article 431 - how to do it).

I've made some updates to a couple of other articles - this I do on a pretty regular basis, if only to rephrase parts of an article, add newer information (which I do quite a bit for the Premium Bonds (UK) article) or change something based on user feedback.

As always, updates are listed on the recently updated page, along with an RSS feed at

Tuesday, August 15, 2006

How it works: IP address filtering

When I started this site, I thought i'd occasionally post some code samples on how I actually do things on the site, just in case others needed the information.

I haven't done very many of these, and so here is the next one.

The issue I see is that for some IP addresses, I need to perform certain tasks (such as blocking them, showing the site without advertising, enabling me to administer the site etc).

Each of these tasks has an XML file dedicated to it, which is read at least once each page request. These operation needs to be lightning fast, and initially, it wasn't. A typical XML file will look like this:

<?xml version="1.0" encoding="utf-8"?>


<url ip=""></url>

<url ip=""></url>


After getting some help, I learnt using an XPath query seemed to be the best solution.

I created a generic function to parse the XML for me, and return a boolean value if a match was found. This function is below

Public Shared Function parseXMLIP(ByVal XPathString As String, ByVal XMLfile As String, ByVal cachename As String) As Boolean
Dim parseResult As Boolean = False
Dim xpdocument As XPathDocument

If HttpContext.Current.Application.Item(cachename) Is Nothing Then
xpdocument = New XPathDocument(HttpContext.Current.Server.MapPath(XMLfile))
HttpContext.Current.Application.Add(cachename, xpdocument)
xpdocument = DirectCast(HttpContext.Current.Application.Item(cachename), XPathDocument)
End If

Dim Navigator As XPathNavigator = xpdocument.CreateNavigator()
Dim Iterator As XPathNodeIterator = Navigator.Select(XPathString)

If Iterator.Count > 0 Then
parseResult = True
End If
Catch ex As Exception
End Try
Return parseResult
End Function

Because I have the individual operations and the generic function, I pass certain parameters to the function so I don't have it in triplicate :-)

Dim showData as boolean
showData = myFunctions.parseXMLIP("//block[@ip='" & ipaddr & "']", "~/App_Data/ipblock.xml", "ipBlockListXML")

And that's all there is to it. Maintenance is a matter of adding, changing or deleting a line in the XML file and uploading it to the site (and deleting the cached version).

Friday, August 04, 2006

Website Problems and Performance

Over the last couple of weeks, I've noticed that some of the performance of the website has been going downhill. In addition, a number of errors have been cropping up when people view the FAQ List or individual category pages. The former appears to be down to a database issue where the page impressions are stored. I think I have managed to solve that this morning by building new indexes on the impression table (the impression table is getting rather large, as I see a lot more hits than I did a year ago). The latter seemed to be a problem with the Atlas implementation. I'm currently redesigning the FAQ list page and the category page (they are interlinked) because the FAQ list page is getting rather big. I was intending on using the Atlas Control Toolkit for this, and more specifically the Collapsible Panel. For the time being, I've removed the updates I was gradually feeding into the FAQ page, so that it is more stable again. Problems were being seen where the language being sent from the user browser wasn't liked by the Atlas extension (e.g. sending "en_us" instead of "en_US"). Hopefully things will settle down and work a bit better now.