Skip to main content

Posts

Showing posts from September, 2008

One I learnt the hard way ...

Don't use a 32-bit int to represent a phone number.

When I first started writing code for telecommunications applications, I used int all over the place in my TSQL. I soon clicked that this was not such a good idea (prior to any chaos being caused), and went around swapping out my ints for varchars. Unfortunately I didn't get them all ...

In NZ, the longest mobile phone numbers we have had for quite some time have been 10 digits, starting with 02 - so like 0275555555 would have been a long-ish one. As I have noted due to recent 'issues' arising with one of my real-time systems, we have recently moved (in NZ) to include 11 digit mobile numbers. Which pushes my dodgy code into exception (largest signed 32-bit int being 2147483647).

Great, so that kept me very busy for a couple of hours yesterday, extracting the remaining phone number ints out of my TSQL. Sometimes we learn lessons the hard way I guess ;-)

WPF: use IValueConverter to implement dynamic binding to an XML data source ...

Here are some swift details on how to use IValueConverter to implement dynamic binding to an XML data source.Add the XML source to your XAML page/window as a resource. Also add your URL converter that gives you customises your input. You could use XLINQ here to get some nice thingie going. I'm using it for manipulation of a static application map:<Page.Resources><XmlDataProvider x:Key="ApplicationMap" Source="ApplicationMap.xml"/> <src:PageURLConverter x:Key="pageURLConverter"/></Page.Resources>Make yourself a Frame and use the XML source and the converter to build the URL that the Frame will hold:<Frame Name="frameContent" Source="{Binding XPath=@PageLink, Converter={StaticResource pageURLConverter}}"NavigationUIVisibility="Hidden"Focusable="False"></Frame>The converter looks like this:public class PageURLConverter : IValueConverter{public object Convert(object value, Type ta…

SQL Server 2008 and Spatial Data ...

DId a bit of a talk at the most recent Code Camp event in Auckland City. My talk centred around spatial data, and how it is used in the telecommunications industry.

I've been doing a bit of research in relation to this matter recently and found that Microsoft have finally published a nice big section of MSDN stuff dedicated to how to use the spatial data components of SQL 2008. Looking forward to getting stuck into that!

http://msdn.microsoft.com/en-us/library/bb933876.aspx