# 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
# Wednesday, March 23, 2005

Well the news about VSTS pricing is out and everyone is talking about it. If you want all these whizzy tools that Microsoft have been wooing us with over the last year then it is going to cost you more, a lot more. Plus their “simpler approach to MSDN subscriptions” is completely the reverse of reality. To tell the truth, it feels like I just caught a good friend sleeping with my girlfriend. Part anger, part disappointment and a desire to get them both out of my life.

Most of what needs to be said has already. Of particular note are articles for Scott Hanselman, Mike Gunderloy and Eric Bowen (read the comments). The only thing I’ll add is a response to the comment from Prashant Sridharan that “If you want the other stuff (which you probably aren't using right now anyway, or are probably paying a ton for as it is) we're giving you a very convenient and low cost upgrade to the Suite.” Just two points – MSDN Open Licensing has never been convenient and, as for the cost, we have already spent the money on the tools that supposedly cost a ton: Compuware (a ton), Perforce (cheap), FogBugz (very cheap).

So Scoble, I’ll be interested to see how you round up all the comment in blog-land on this one because, well, markets are conversations and it seems some Microsoft bloggers are censoring their comments sections…

by This posting is provided "AS IS" with no warranties, and confers no rights.
posted on Wednesday, March 23, 2005 10:42:53 PM (GMT Standard Time, UTC+00:00)  #    Comments [0] Trackback
# Saturday, March 19, 2005

After spending an untold number of hours trying to get a Reporting Services Extension to work I thought I should pass on the knowledge to others… Basically, it’s all about security and the rssrvpolicy.config file. This file is a little confusing especially as the default installation uses a weird indent. This article on code access security pretty much covers everything except where to put your new code group definition.

<CodeGroup class="FirstMatchCodeGroup" PermissionSetName="Nothing">
    <
CodeGroup Name="Report_Expressions_Default_Permissions"/>
    
<CodeGroup class="FirstMatchCodeGroup">
        <
IMembershipCondition Zone="MyComputer" />
        <
CodeGroup Name="SharePoint_Server_Strong_Name"/>
 
        <
CodeGroup Name="YOUR_CODE_GROUP_HERE"/>

    </CodeGroup>
</
CodeGroup>

I have removed has much as possible from the file to illustrate where your new definition goes. See the nesting? The outer one says match the first inner one or set permissions to nothing. Then a code group Report_Expressions_Default_Permissions sets up the default expression permissions. The next code group has a membership condition of Zone="MyComputer" with a bunch of full trust Microsoft code groups. Finally, the last one is for SharePoint. Your new code group goes directly after this one at the same level.

Hope that saves someone some time.

by This posting is provided "AS IS" with no warranties, and confers no rights.
posted on Saturday, March 19, 2005 7:23:12 PM (GMT Standard Time, UTC+00:00)  #    Comments [0] Trackback
# Sunday, March 13, 2005
by This posting is provided "AS IS" with no warranties, and confers no rights.
posted on Sunday, March 13, 2005 10:50:42 AM (GMT Standard Time, UTC+00:00)  #    Comments [0] Trackback