Moving blog from Live Spaces to WordPress

Since I have today moved my blog from Spaces to WordPress, I wanted to publish some notes about that process.

What I have used to export Live Spaces

There is a Python script called Live Spaces Mover and hosted on Google Code. Its author has also personal site  where he writes about using his script and describes a receipt.

I have downloaded Python runtime 2.6.4 (Its not working with 3.0) and Beautiful Soup 3.0.6 into the same directory as Live Spaces Mover script.

Despites authors manual, I have tested script first without setting date and time format on my Live Space to full form ("%m/%d/%Y %I:%M:%S”), but reading the blog failed.

After setting to full format, everything worked. I started script according the receipt on authors page with following parameters:

python -s -t "%m/%d/%Y %I:%M:%S %p"

Script was for a some time reading my blog posts and after Importing XML file that produced into WordPress (in options select WordPress exported type source) I have my posts on this new location.

Reading comments from all SQL server tables columns

I needed a script for gather all comments into one table. I have created this one:

Script creates new table AllComments which contains two columns (column, comment).

Sample output:


And script producing this

DROP TABLE AllComments;
create table AllComments
([column] varchar(100), [comment] varchar(200))
declare Tbl_Cursor cursor for
select, from sys.objects o
join sys.schemas s on s.schema_id = o.schema_id
where type='U';
declare @tbl_name as varchar(50);
declare @tbl_schema as varchar(50);
open tbl_cursor;
fetch next from tbl_cursor
  into @tbl_name, @tbl_schema;
while @@FETCH_STATUS=0
	declare Desc_Cursor cursor for
	select, cast(value as varchar)
	from sys.all_columns c
	left join fn_listextendedproperty(
	'MS_Description','schema', @tbl_schema, 'table',
	 @tbl_name, 'column', default) p
	( collate Latin1_General_CI_AI = p.objname
		or p.objname is null)
	where c.object_id = OBJECT_ID(@tbl_schema + '.' +@tbl_name)
		declare @desc_col as varchar(50);
		declare @desc_value as varchar(50);
		open Desc_Cursor;
		fetch next from desc_cursor
		  into @desc_col, @desc_value;
		while @@FETCH_STATUS=0
		  INSERT INTO [AllComments]
           (@tbl_schema + '.' +@tbl_name + '.'+ @desc_col,@desc_value);
	  	  fetch next from desc_cursor
		    into @desc_col, @desc_value;
	close desc_cursor;
	deallocate desc_cursor;
    print @tbl_schema + '.' + @tbl_name;
    fetch next from tbl_cursor
      into @tbl_name, @tbl_schema;
close tbl_cursor;
deallocate tbl_cursor;

List of schemas and tables on SQL server

I needed to show all tables and schemas in actual database so I have created following script.


declare Tbl_Cursor cursor for
select, from sys.objects o 
join sys.schemas s on s.schema_id = o.schema_id
where type='U';
declare @tbl_name as varchar(50);
declare @tbl_schema as varchar(50);
open tbl_cursor;
fetch next from tbl_cursor 
  into @tbl_name, @tbl_schema;
while @@FETCH_STATUS=0
    print @tbl_schema + '.' + @tbl_name
    fetch next from tbl_cursor
      into @tbl_name, @tbl_schema;
close tbl_cursor;
deallocate tbl_cursor;


Running Oblivion on EEE PC 1000H with NOCD patch

Fantastic Oblivion is working also on my EEE PC 1000H netbook. Not very fast, but I wanted just to test my netbook’s performance.

I did some upgrade to my netbook configuration which is now Intel Atom 270, 2 GB RAM, 7200 RPM Seagate 500 GB and Intel GMA 950.


What do we need

1. Oblivion Installation DVD image (since we dont have DVD drive in netbook) and mounting software. I am using Damon Tools Lite for mounting images.

2. Oldblivion installation files. Oldblivion is project to run Oblivion on old CPU and Graphic cards like Intel GMA 950. It makes some in memory patching to Oblivion exe file and converts Pixel and Vertex shaders from 2 to 1.1

3. Since Oldblivion patches exe file, you should not install notsupported Oblivion patches. Oldblivion works with 1.1 Oblivion patch. For this patch, there is also NOCD patch that works with Oldblivion and I tested them together with success.

Note: Before I installed 1.1 update I experienced a problem that Oblivion starts its menu, but it was not possible to Start new game.

4.  Continue as in attached .txt file in Oldblivion: Copy attached Oblivion.ini to Documents&Settings\[User]\My Documents\My Games\Oblivion. Now configure Oldblivion with attached config.exe to low details. And finally start Oldblivion.exe.

And result


Create Word documents with OpenOffice Writer with C# and .NET

For creating Open Office documents, it is possible to use UNO project with CLI binding for .NET environment and C# language. In following text, reader can find simple example of this approach.


UNO, which stands for Universal Network Objects is component model for OpenOffice. For development with UNO there is an SDK, that allows developers develop with common objects for OpenOffice package.

How to create MS Word 95 .doc file using OpenOffice Writer

First, you need to have OpenOffice with OpenOffice SDK of the same version. I have tested following sample with OpenOffice 3.1.

When you are creating .NET project, you have add references to assemblies from UNO-CLI project. These are on Windows installed in:

C:\Program Files\OpenOffice.org_3.1_SDK\sdk\cli

These assemblies are compiled against .NET 2.0 and therefore you should have your project target set to .NET 2 Framework.

XComponentContext oStrap = uno.util.Bootstrap.bootstrap();
XMultiServiceFactory oServMan = (XMultiServiceFactory)oStrap.getServiceManager();
XComponentLoader oDesk = (XComponentLoader)oServMan.createInstance("");
string url = @"private:factory/swriter";
PropertyValue[] propVals = new PropertyValue[0];
XComponent oDoc = oDesk.loadComponentFromURL(url, "_blank", 0, propVals);

string docText = "This will be my first paragraph.\n\r";
docText += "This will be my second paragraph.\n\r";

string fileName = @"C:\test.doc";
fileName = "file:///" + fileName.Replace(@"\", "/");

PropertyValue[] savePropVals = new PropertyValue[1];
savePropVals[0] = new PropertyValue("FilterName", 0, new uno.Any("MS Word 97"), PropertyState.DIRECT_VALUE);
((XStorable)oDoc).storeAsURL(fileName, savePropVals);
oDoc = null;

Thanks to Mark Alexander Bain for source example here


UNO (Universal Network Objects) Project

OpenOffice UNO SDK download

How to register PowerShell SQL server snapin in Windows preinstalled PowerShell

When you have installed Sql server, you probably noticed that your PoweShell is not able to run common SQL scriptlets and you have to start it to run them from SQL server Management Studio or with SQLPS.exe command. But it is easy to enable running SQL commands from regular PowerShell shell.

Checking whether SQL server snapin is working

When you see following result to Get-Help SQLserver, your snapin is either not registered correctly or not added to interactive console as a snapin.

PS C:\Users\Martin> Get-Help SQLServer

Name                              Category  Synopsis
—-                              ——–  ——–
Get-WSManInstance                 Cmdlet    Displays management information for a resource instance specified by a R…
Get-Help                          Cmdlet    Displays information about Windows PowerShell commands and concepts.

To see all registered snapins, you can type:

get-PSSnapin –registered

Name        : SqlServerCmdletSnapin100
PSVersion   : 2.0
Description : This is a PowerShell snap-in that includes various SQL Server cmdlets.

Name        : SqlServerProviderSnapin100
PSVersion   : 2.0
Description : SQL Server Provider

You should see these two items registered SqlServerCmdletSnapin100 and SqlServerProviderSnapin100.

When you dont have your snapins registered, type following commands:

PS C:\Users\Martin> set-alias installutil $env:windir\\framework\v2.0.50727\installutil

PS C:\Users\Martin> installutil -i “c:\Program Files\Microsoft SQL Server\100\Tools\Binn\Microsoft.SqlServer.Management.


PS C:\Users\Martin> installutil -i “c:\Program Files\Microsoft SQL Server\100\Tools\Binn\Microsoft.SqlServer.Management.

Note: path of your




could be different on your Sql server installation. (On 2008 RTM its C:\Program Files\Microsoft SQL Server\100\Tools\Binn\Redist\)

On my Sql server 2008 R2 machine, these snapins were correctly registered, so I skipped previous step.

After registration your snapins, you should add them to your interactive powershell console. To do this, you should type:

PS C:\Users\Martin> Add-PSSnapin SqlServerCmdletSnapin100
PS C:\Users\Martin> Add-PSSnapin SqlServerProviderSnapin100

After this step, you should have no problem to get any of sql server scriptlets running, we can test with help again:

PS C:\Users\Martin> Get-Help SQLServer


    SQLSERVER, SQL, SQLPolicy, SQLRegistration

    Access SQL Server instances and their databases.


Adding sql server snapin to your PowerShell at shell start

Instead of adding two snapins manually all the time, you can let powershell to start them in profile scriptlet.

Profile scriptlet is something that (if exists) is started for all users or specifically only for you.

All Users – this scriptlet should be in %windir%\system32\WindowsPowerShell\v1.0\profile.ps1

Only you – C:\Documents and Settings\%username%\My Documents\WindowsPowerShell\profile.ps1 or its equivalent.

On my Windows 7, profile.ps1 is located in (You should create new one if it does not exist)


My profile.ps1 file looks like this:

Add-PSSnapin SqlServerCmdletSnapin100
Add-PSSnapin SqlServerProviderSnapin100
“Welcome to PowerShell with SQL server snapin”

Before you restart shell, you should also allow running unsigned scripts (like is profile.ps1). To do this, type following:

set-executionpolicy unrestricted

And now, you can restart PowerShell session and Snapin should work correctly. You can use this even in PowerShell ISE (Integrated Script Environment)

Note: After creating profile.ps1 file, you can get Following error when starting SQLPS.EXE (or Management Studio PowerShell)

The term ‘Add-PSSnapin’ is not recognized as the name of a cmdlet, function, sc
ript file, or operable program. Check the spelling of the name, or if a path wa
s included, verify that the path is correct and try again.

This error appears because of SQLPS is a limited PowerShell host that does not implement Add-PSSnapin. It should be used only for sql server management and when you need to use more snapins or scriptlets, use regular PowerShell host instead.