# Monday, June 13, 2005

Just a quick post to say Happy Birthday to my blog. My first post was a year ago yesterday and was pretty inconsequential but going to Tech-Ed shortly after brought some technical content online. My most Googled posts have to be "Uniqueidentifiers as Primary Key Columns" and "How to trash your system when writing installers". The geekiest toy was "Geekman" and the hardest post to write was "Coder Block". I used to post nearly every day but realised I couldn't keep up the pace and now it's more like once or twice a week at the weekend. Long may it continue.

by This posting is provided "AS IS" with no warranties, and confers no rights.
posted on Monday, June 13, 2005 7:09:37 PM (GMT Daylight Time, UTC+01:00)  #    Comments [0] Trackback
# Sunday, June 05, 2005

Just for fun and to kill some time, here are the flags of the visitors to this website last week. They are ordered by number of hits from that country. I had no idea there was such a diverse collection.

[Apr 2008 edit: sorry, there used to be a picture here but it got to be the top hit in Google image search for a very common term and I can't support the amount of bandwith needed to service all the queries.]

 

by This posting is provided "AS IS" with no warranties, and confers no rights.
posted on Sunday, June 05, 2005 12:28:41 PM (GMT Daylight Time, UTC+01:00)  #    Comments [3] Trackback
What Video Game Character Are You? I am Pacman.I am Pacman.
I am an aggressive sort of personality, out to get what I can, when I can. I prefer to avoid confrontation, but sometimes when it's called for, I can be a powerful character. I tend to be afflicted with munchies constantly. What Video Game Character Are You?
by This posting is provided "AS IS" with no warranties, and confers no rights.
posted on Sunday, June 05, 2005 10:47:14 AM (GMT Daylight Time, UTC+01:00)  #    Comments [0] Trackback
# Saturday, June 04, 2005

It's been a while since I posted last due to our current work schedule. It's hard work preparing a new product version when that release is due to go to a customer before it's GA'd.

Anyway, in this post about "Uniqueidentifiers as primary key columns" I talked about some of the benefits to ditching the traditional IDENTITY columns. I did point out that their use in data warehouse applications is questionable as key sizes become important when dealing with huge amounts of data. Herein lies the problem - we have an application that uses uniqueidentifiers wherever possible but dimension tables still use integer keys. No problem so far but we have recently tried to implement parent-child dimensions within Analysis Services and our folder structure is using uniqueidentifiers as keys.

As you may know, Analysis Server uses a simple arrangement for parent-child dimensions where each member has a key column and a parent key column as per the adjacency list model. To implement this, lets assume two tables Office and Folder where Office is a dimension and Folder is a hierarchy into which we place each office. The two tables look like:

create table Folder (
    folder_id int not null primary key,
    parent_id int not null,
    name nvarchar(50) not null
)

create table Office (
    office_id int not null primary key,
    folder_id int not null,
    name nvarchar(50) not null
)

There is a foreign key between folder_id in the two tables to tie them together. Note, I've used integer primary keys here so creating a parent-child dimension is easy as follows:

create view OfficeTree
as
    select folder_id + (select max(office_id) from Office) as item_id,
           parent_id + (select max(office_id) from Office) as parent_id,
           name
    from Folder
    union all
    select office_id,
           folder_id + (select max(office_id) from Office), 
           name
    from Office

Note, that the Folder keys must be offset to ensure they don't clash with the Office keys. Now if we try and change the folder_id and parent_id fields in Folder to uniqueidentifiers we end up with a problem - the data types are not compatible when creating the view OfficeTree and you get the message "Operand type clash: uniqueidentifier is incompatible with int".

The solution to this problem is of course to either go back to using ints somehow. I was about ready to remove the uniqueidentifiers when Koan Bremner came up with the following solution. The trick is to realize that the references between the two tables are only required when processing the dimension and Analysis Server doesn't care if the IDs change between cycles just as long as the keys joined to fact tables remain constant. So we still need to add an integer key column to the Folder table as below:

create table Folder (
    folder_id uniqueidentifier not null primary key,
    parent_id uniqueidentifier not null,
    alt_id int null,
    name nvarchar(50) not null
)

We allow the column to be null because the keys are only required before we process the dimension and allowing NULLs ensures easy inserts in a replicated environment. To update the column before processing requires a little magic (again from Koan).

declare @counter int
select @counter = isnull(max(alt_id), 0)
from Folder

update Folder
set @counter = alt_id = @counter + 1 -- Ed: Typo fixed (see comments).
where alt_id is null
option (maxdop 1)

The maxdop option ensures a sequential update to the column which forces an incrementing value. Now we can rewrite the view to use the new field. Note that we have to join back to Folder in order to resolve the parent_id field.

create view OfficeTree
as
    select f1.alt_id + (select max(office_id) from Office) as item_id,
           f2.alt_id + (select max(office_id) from Office) as parent_id,
           f1.name
    from Folder f1
    left join Folder f2 on f2.folder_id = f1.parent_id
    union all
    select o1.office_id, 
           f2.alt_id + (select max(office_id) from Office), 
           o1.name
    from Office o1
    left join Folder f2 on f2.folder_id = o1.folder_id
 

 

by This posting is provided "AS IS" with no warranties, and confers no rights.
posted on Saturday, June 04, 2005 1:37:31 PM (GMT Daylight Time, UTC+01:00)  #    Comments [2] Trackback
# Tuesday, May 10, 2005

We have a position open at Exony for a test developer (what Microsoft calls a Software Design Engineer in Test or SDE/T). For some reason most testers in the UK are what I would call QA engineers and do not consider writing code part of the job specification so if you fancy working for a young dynamic company that:

  • Scores highly on the Joel Test
  • Provides you with your own laptop and pays your mobile phone charges
  • Allows for plenty of home work (some office time is a requirement though)
  • Practises agile development with Scrum
  • Uses the latest products and technologies

You should send me a copy of your CV/resume to the e-mail address at the top of this page. You should have the following qualities to be eligible:

  • Ability to work in the United Kingdom (Newbury, Berkshire to be exact)
  • Experience with XUnit (NUnit/JUnit) frameworks
  • Ability to code C# in your sleep
  • Strong troubleshooting, debugging, and analysis skills
  • Good verbal and written communications skills
  • Experience with SQL Server, Windows 2000/2003, ASP.NET and web services
  • A passion for software testing and quality

You will work as part of the development team to understand customer requirements, develop the appropriate test tools, processes and code, identify and analyse bugs, raise quality and drive the product towards shipping.

No calls from recruiters please. I have a number that I am already dealing with and don't have room in my schedule for more.

[Edit: This position has been filled. Thank you to everyone that applied. I will have more positions posted in the near future.]

by This posting is provided "AS IS" with no warranties, and confers no rights.
posted on Tuesday, May 10, 2005 9:35:32 PM (GMT Daylight Time, UTC+01:00)  #    Comments [0] Trackback
# Sunday, May 01, 2005

It's May Day Bank Holiday Weekend so I was going to try and stay away from the blog but after a testing afternoon with the new Team System Beta I thought I'd better share.

Firstly the install. I created a new Virtual PC image of Win2k3 SP1 to install the Team Foundation Server on. What the install guide doesn't tell you is that if you turn a server into a domain controller after installing Internet Services then the web won't work. You only find this out after installing SharePoint Services and following the troubleshooting guide when things don't work. After reinstalling SharePoint, Reporting Services and Internet Services things looked better and the Team Foundation install worked first time which was much better than my Beta 1 experience. However, after install, Analysis Services and Internet Services are hammering the CPU for no reason that I can determine. Installing the Visual Studio client was just as frustrating as the Beta 1 uninstall doesn’t clean up too well. After a couple of failed attempts I found this tool to clean up before installing.

Connection to the Foundation Server worked first time but failed to create a portfolio project complaining that the methodology could not be found. I haven't been able to get any further with this. The non-team bits do pretty much exactly what it says on the tin although the Intellisense is a little aggressive. The performance stuff also works well but the testing tools crashed the development environment every time I tried to run a test. This maybe due to the installation difficulties but I can't tell. Time to put it all back in the box and wait for the release I think.

by This posting is provided "AS IS" with no warranties, and confers no rights.
posted on Sunday, May 01, 2005 8:03:28 PM (GMT Daylight Time, UTC+01:00)  #    Comments [2] Trackback
# Sunday, April 24, 2005

These guys are driving me nuts so I'm afraid I've had to protect my site by forcing you to login before changing anything. If you feel you need access then let me know and I'll give you a password.

by This posting is provided "AS IS" with no warranties, and confers no rights.
posted on Sunday, April 24, 2005 6:55:19 PM (GMT Daylight Time, UTC+01:00)  #    Comments [0] Trackback
# Saturday, April 23, 2005
by This posting is provided "AS IS" with no warranties, and confers no rights.
posted on Saturday, April 23, 2005 1:12:10 PM (GMT Daylight Time, UTC+01:00)  #    Comments [0] Trackback

I removed the old Betas of Visual Studio and Yukon from my home machine this morning and to check everything was still OK I fired up Query Analyser to fire a quick query – “SELECT TOP 5 * FROM sysobjects”. This failed with a syntax error complaining about the TOP 5 part of the clause.

I was about to bite the bullet and reinstall SQL 2000 as well but noticed the database I ran the query in was an old one. A quick switch to the master database and the same query works fine. It turns out the previous database had a compatibility level of 65 so none of the new syntax will work.

One thing did get hosed on the uninstall – SQLDMO which is crucial for Enterprise Manger to run. To fix it execute the following:

regsvr32.exe “C:\Program Files\Microsoft SQL Server\80\Tools\Binn\sqldmo.dll”

by This posting is provided "AS IS" with no warranties, and confers no rights.
posted on Saturday, April 23, 2005 12:58:21 PM (GMT Daylight Time, UTC+01:00)  #    Comments [0] Trackback
# Saturday, April 16, 2005
But can you wait until I’ve finished downloading it
by This posting is provided "AS IS" with no warranties, and confers no rights.
posted on Saturday, April 16, 2005 10:03:15 PM (GMT Daylight Time, UTC+01:00)  #    Comments [0] Trackback

Whilst my computer was performing its usual scan I had a bit of a panic because of the words in the dialog box below.

Ms_antispyware

I think what they intend is to list any detected spy-ware after the “:“ but at a quick glance it looks like something has been found. All they needed to do was add “(None)” after the phrase and I would have avoided a heart attack.

by This posting is provided "AS IS" with no warranties, and confers no rights.
posted on Saturday, April 16, 2005 12:11:17 PM (GMT Daylight Time, UTC+01:00)  #    Comments [0] Trackback
# Sunday, April 10, 2005
Goes the the poor person who used MSN search for “help me i need to get my girlfriend back” and was referred through to my home page…
by This posting is provided "AS IS" with no warranties, and confers no rights.
posted on Sunday, April 10, 2005 8:37:43 AM (GMT Daylight Time, UTC+01:00)  #    Comments [2] Trackback