November 2010 (1)
August 2010 (1)
July 2010 (1)
June 2010 (3)
July 2009 (3)
June 2009 (1)
May 2009 (1)
February 2009 (1)
January 2009 (1)
November 2008 (3)
October 2008 (4)
September 2008 (9)
August 2008 (6)
July 2008 (3)
June 2008 (3)
January 2008 (1)
November 2007 (2)
October 2007 (6)
September 2007 (5)
August 2007 (22)
July 2007 (6)
June 2007 (1)
May 2007 (3)
April 2007 (27)
March 2007 (8)
February 2007 (6)
September 2006 (2)
August 2006 (4)
July 2006 (9)
June 2006 (17)
May 2006 (20)
April 2006 (12)
March 2006 (9)
February 2006 (4)
January 2006 (3)
December 2005 (2)
November 2005 (4)
October 2005 (5)
September 2005 (37)
August 2005 (83)
July 2005 (6)

Active Directory / LDAP (0)
ASP.Net (19)
Blackberry Development (4)
c# (34)
c++ (3)
Code Camp (1)
Excel (1)
Exchange (3)
Front Page 2003 (6)
FTP User Editor (4)
HTML / CSS / DHTML (8)
IIS (146)
IIS - Log Parser (7)
IIS / FTP (12)
IIS / Tools / Administration (42)
IIS / Tools / Authentication (6)
IIS / Tools / Compression (8)
IIS / Tools / Crash & Hang (12)
IIS / Tools / ISAPI Filters (17)
IIS / Tools / Log Files (17)
IIS / Tools / Scripts (28)
IIS / Tools / Security (9)
IIS / Tools / SSL (6)
IIS 7 (3)
Internet Information Server (1)
Me (Chris Crowe) (6)
MIME Types (1)
Misc (72)
Oulook Express (2)
Silverlight (1)
SQL Server (27)
SQL Server CTE (1)
Vista (15)
Vista Gadgets (8)
Visual Studio (11)
Voice over BroadBand (1)
Windows (33)
Windows Powershell (3)
Windows Sharepoint Services (0)
Windows Sharepoint Services (15)
Windows Vista (14)
Wine Cellar (1)
WMI (8)

Archive

September 2007 (5)

Error: CLSID {3FA7DEB3-6438-101B-ACC1-00AA00423326} failed with error 80040154.

I was dealing with a MAPI application in C# and when I tried to call the following code I got a nasty error message:

MAPI.Session session = new MAPI.Session();

The actual error message I received was

Error: Retrieving the COM class factory for component with CLSID {3FA7DEB3-6438-101B-ACC1-00AA00423326} failed due to the following error: 80040154.

My development environment is:

  • Windows Vista Ultimate x64
  • Microsoft Visual Studio 2005

I found that my application Platform Target was set to Any CPU, changing this to X86 resolved the error.

image


This is a test using Windows Live Writer using the SubText provider

Hi, this is just a test of using the Windows Live Writer editor using the SubText provider which was automatically detected during the configuration of my blog within Windows Live Writer.

So far I am liking this a lot - it is a lot nicer to use than the standard web editor. This tool includes nice features such as a spelling checker and it is very easy to insert images as you can see from below.

Note: This is not a picture that I took!

1919062-63dd7df2a148ef90

I like this a lot - why did it take me so long to start to use it!

see http://get.live.com/betas/writer_betas and for plug-ins see http://gallery.live.com/results.aspx?c=0&bt=9&pl=8&st=5

Note: This tool is still in Beta

Operating system
Microsoft Windows XP SP2 or Windows Vista

Note: I read on Peter Jones blog that it does not work with Windows 2003 Server.


Microsoft SQL Server 2005 - CTE Example of a simple hierarchy

I have a simple table here which shows a list of devices and each device can have a parent device except for the top item which has a <NULL> value for the ParentID column.

Using SQL 2005 CTE (Common Table Expression) to render this full hierarchy we could use a simple query such as this:

What this CTE is doing is allowing us to run a hierarchical query.

We first off find the root of our tree, which in this case is referenced by a NULL value in the ParentID column.

SELECT ParentID, ID,0, [DeviceType], cast(DeviceType as nvarchar(1024))
FROM DeviceType
WHERE ParentID IS null

This technically returns the same details as row #1 in the above graphic.

What the UNION ALL does is executes a query with a join against the CTE virtual table.

So we technically are sort of doing this:

Create Virtual Table with the following fields:

  • ParentID
  • ID,
  • Level,
  • DevieType,
  • Sort

This line inserts one row into the virtual table, the ID in this case will be 1 because that was the ID in our DeviceType table of the record with the ParentID of Null.

SELECT ParentID, ID,0, [DeviceType], cast(DeviceType as nvarchar(1024))
FROM DeviceType
WHERE ParentID IS null

Now we run the following query on the virtual table until every row is processed in the virtual table.

Note: This select is really like an insert into the virtual table. each row returned in the select is appended to our virtual table.

SELECT dt.ParentID, dt.ID, level+1, dt.DeviceType, cast(Sort + '|'+dt.Devicetype as nvarchar(1024))
FROM DeviceType dt INNER JOIN hierarchy h ON dt.ParentID = h.ID

So the first time it is run we see that h.ID would be equal to 1 which was the ID of the record with ParentID of Null. If there was any records matching this select statement they are added to the virtual table and this continues until all of the virtual table rows have been processed.

At the end of it we have a Virtual table that we can then do what we want with such as join it to another table or just return the data, in our case we run this sql statement.

select ID, ParentID, DeviceType, LEVEL, Sort
from Hierarchy
order by sort

But what happens if I have an record and want to find the parent hierarchy for it?

The following query will allow us to return the parent hierarchy for the item Virtual Server Hosts which has an ID of 10.

Note: There are problems with the results of this query!

Can you see the problem with the results?

We have correctly returned the parents starting from the Virtual Server Hosts and walked up the tree until we get to the root node. But if you look at the Level field it is not actually containing the correct value as the Virtual Server Hosts fields should be at level 3 and not at level 0.

Why is this?

Well we can't determine at what level the Virtual Server Hosts is at when we start creating the virtual table so we just hard code it to 0. 

The problem also is that if you wanted to render this out to say a web browser using the following hierarchy we would have to navigate through our records backwards.

  • Object
    • Server
      • Virtual Servers
        • Virtual Server Hosts

How to fix this!

What we can do in this case is run a second CTE joined to the first CTE because each CTE is just like a virtual table. When the first CTE has completed processing we are basically left with a table with records in it like below.

Our second CTE now just references the records in the first CTE as if it was a standard table.

As you can see in the query in the above graphic our second CTE starts by looking for a record which has the ParentID being set to NULL.

This will return our real parent as the first record to be inserted into our second virtual table. 

Now we run the following query on the second virtual table until every row is processed in the virtual table. Like the first virtual table, the select appends records to our virtual table and these records get processed until all records have been processed.

SELECT h.ParentID, h.ID, hr.LEVEL+1, h.DeviceType, cast(hr.Sort + '|'+h.sort as nvarchar(1024))
FROM Hierarchy h INNER JOIN HierarchyReverse hr ON h.ParentID = hr.ID

We have changed the join in the second CTE to join from the ParentID --> ItemID, which is the opposite of the first CTE which joined the ItemID --> ParentID. This allows us to navigate down the tree instead of up the tree.

Confusing? hopefully not....

What we end up with is this:

Now you may be wondering what this Sort column is and why we have it at all?

The reason is that we need to have something that is sortable, using the DeviceType is not since it would corrupt our hierarchy by giving us A-Z, the same goes for level, 0-9

What we do is we create a field that contains the hierarchy so far and then add the DeviceType to the end of it. This makes a sortable field that will not corrupt our hierarchy but give us A-Z sorting within each level of the hierarchy.

Notice the problem with this?

Well I have made a decision that all of my hierarchies of DeviceType will not exceed 1024 characters by casting the values with the statement : NVARCHAR(1024)

Well we could use a NVARCHAR(MAX) and the problem is resolved, but this is dependant on your knowledge of the application.

Hopefully this has shown you and me how the CTE's work while they are running - well it looks like that to me and it makes me understand it a bit easier as they can be hard to picture sometimes.

 


Silverlight V1.00 has been released

Today Microsoft shipped the Silverlight 1.0 release for Mac and Windows.  Silverlight 1.0 is focused on enabling rich media scenarios in a browser. Some of its features include:

  • Built-in codec support for playing VC-1 and WMV video, and MP3 and WMA audio within a browser.  The VC-1 codec is a big step forward for incorporating media within a web experience - since it supports very efficiently playing high-quality, high definition video in the browser.  It is a standards-based media format that is implemented in all HD-DVD and Blueray DVD players, and is supported by hundreds of millions of mobile devices, XBOX 360s, PlayStation 3s, and Windows Media Centers (enabling you to encode content once and run it on all of these devices + Silverlight unmodified).  It enables you to use a huge library of existing video content and provides access to the broad ecosystem of existing Windows Media tools, components, vendors and hardware. 
  • Silverlight supports the ability to progressively download and play media content from any web-server.  You can point Silverlight at any URL containing video/audio media content, and it will download it and enable you to play it within the browser.  No special server software is required, and Silverlight can work with any web-server (including Apache on Linux).  We'll also be releasing an IIS 7.0 media pack that enables rich bandwidth throttling features that you can enable on your web-server for free.
  • Silverlight also optionally supports built-in media streaming.  This enables you to use a streaming server like Windows Media Server on the backend to efficiently stream video/audio (note: Windows Media Server is a free product that runs on Windows Server).  Streaming brings some significant benefits in that: 1) it can improve the end-user's experience when they seek around in a large video stream, and 2) it can dramatically lower your bandwidth costs. 

  • Silverlight enables you to create rich UI and animations, and blend vector graphics with HTML to create compelling content experiences.  It supports a Javascript programming model to develop these.  One benefit of this is that it makes it really easy to integrate these experiences within AJAX web-pages (since you can write Javascript code to update both the HTML and XAML elements together). 

  • Silverlight makes it easy to build rich video player interactive experiences.  You can blend together its media capabilities with the vector graphic support to create any type of media playing experience you want.  Silverlight includes the ability to "go full screen" to create a completely immersive experience, as well as to overlay menus/content/controls/text directly on top of running video content (allowing you to enable DVD like experiences).  Silverlight also provides the ability to resize running video on the fly without requiring the video stream to be stopped or restarted.

Checkout this demo at http://halo3.msn.com/videosHD.aspx

Visit the www.silverlight.net community site to learn more about Silverlight and how to get started with it (and visit the Silverlight video page for free short videos on how to develop with it).  You might also want to watch this new Channel9 video from today with me talking about Silverlight:


Unable to restore backup from WSS 2003 SP2 to another server

We are currently still running WSS 2003 SP2 at work and have not yet migrated. I have had a backup system in place for quite a while now and it was time for me to test the restoring of the backup to another box to make sure I can do it.

I had a test box called CCROWE-TEST that I was going to use to restore my data from the live system which was called NZC-AP-WSS-02

This server was running Windows 2003 Server Standard Edition with SP2 .

I downloaded the Windows SharePoint Services 2003 With SP2 Install from Microsoft.

http://www.microsoft.com/downloads/details.aspx?familyid=B922B28D-806A-427B-A4C5-AB0F1AA0F7F9&displaylang=en

I then planned to install this on the CCROWE-TEST server and then perform a backup of our live server using STSADM.EXE and restore it to the new install.

Sounds pretty simple really and in general I thought it would be.

I dbl click on the stsv2.exe which is the setup file for WSS 2003 SP2, which installs a SQL Server instance with the name of SHAREPOINT and installs the product.

After a few minutes the product is installed and now it is time to make sure my two versions of WSS are the same.

Going into Control Panel and selecting the Microsoft Windows Sharepoint Services 2.0 item I click on the support info link and get shown the following dialog.

I then do this on the live server and they both are the same - both returning 11.0.7960.0

On the new test server I go into the Sharepoint Central Administration web site in IIS and view the version of the default web site which has been configured for me.

As you can see the version is listed as 6.0.2.6568 - exactly the same version as my live server.

In order to use STSADM.EXE you must open a cmd.exe prompt and navigate to the following folder.

C:\Program Files\Common Files\Microsoft Shared\web server extensions\60\BIN

You can the run commands from the STSADM.EXE utility.

Running the utility without any parameters shows you some examples and usage:

Examples:
stsadm.exe -o addpath -url http://server/sites -type wildcardinclusion
stsadm.exe -o adduser
-url http://server/site
-userlogin DOMAIN\name
-useremail someone@example.com
-role reader
-username "Your Name"
-siteadmin
stsadm.exe -o backup -url http://server/site -filename backup.dat -overwrite
stsadm.exe -o createadminvs
-admapcreatenew
-admapidname StsAdminVs
-admapidtype configurableid
-admaplogin DOMAIN\user
-admapidpwd Password
stsadm.exe -o createsite -url http://server/site
-ownerlogin DOMAIN\name
-owneremail someone@example.com
stsadm.exe -o createweb -url http://server/site/web
stsadm.exe -o deletesite -url http://server/site
stsadm.exe -o deleteweb -url http://server/site/web
stsadm.exe -o enumsites -url http://server
stsadm.exe -o enumsubwebs -url http://server/site/web
stsadm.exe -o enumusers -url http://server/site/web
stsadm.exe -o extendvs -url http://server:80
-ownerlogin DOMAIN\name
-owneremail someone@example.com
stsadm.exe -o renameweb -url http://server/site/web1 -newname web2
stsadm.exe -o restore -url http://server/site -filename backup.dat
stsadm.exe -o setconfigdb -databaseserver server
stsadm.exe -o unextendvs -url http://server

I backed up my live server using a command like this

STSADM.EXE -o backup -url http://localhost -filename c:\backup.dat

This created me a file that I then copied to the new server.

When you restore you basically just change the operation from backup to restore.

STSADM.EXE -o restore -url http://localhost -filename c:\backup.dat

But Wait.....

You can not restore a backup over an existing site so I delete the existing site that was created by the installation using this command.

STSADM.EXE -o deletesite -url http://localhost

now I can restore my site so I use the restore command like this

STSADM.EXE -o restore -url http://localhost -filename c:\backup.dat

I receive a message that says:

Your backup is from a different version of Windows SharePoint Services and cannot be restored to a server running the current version.

OK so what have I done wrong, the versions are the same as I identified them?

Well it turns out that there was a patch for SharePoint in January that was for Daily Light Savings and also other things that I did not have installed.

Unfortunately this patch does not get added to the Add/Remove programs area, and it also does not update the version of the product that is installed!

I know most people will be now running WSS 2007, but this may help someone from wasting hours of time and frustration!

Note: I never did find a way to determine the version of the backup or the product!