Tuesday, February 22, 2011

XMLSerializer Error? XmlSerializerPreCompiler to the rescue

Recently came over 2 roadblocks for my code and worked it around:
1. Created an XML file with same child nodes to multiple parent nodes and tried XSD on .NET framework 1.1 and it burp, so i XSD it on framework 2.0 and created C# class, guess what it works when deployed on Win2K machine with Framework1.1 only!
2. Another major issue I ended spending many hours at:
So I compiled this assembly and deployed on Win 2K machine, the code didnt worka nd logged this error File or assembly name abcdef.dll, or one of its dependencies, was not found.
Thanks to Chris Sells's XmlSerializerPrecompiler tool, i was able to figure that SysNode class was created as a 2 dimension array SysNode[][] by .NET XSD compiler, all i had to do was manually edit it to SysNode[] and it worked! Here's a link to The XmlSerializerPreCompiler tools

Wednesday, February 16, 2011

Mount Windows on Linux

usr@linuxmachine:~$ sudo mount -t smbfs //IP/ubuntu mnt -o username=username@domainname

Monday, February 7, 2011

Restoring SQL for mirroring

If the path of the mirror database differs from the path of the principal database (for instance, their drive letters differ), creating the mirror database requires that the restore operation include a MOVE clause.

Important note Important

If the path names of the principal and mirror databases differ, you cannot add a file. This is because on receiving the log for the add file operation, the mirror server instance attempts to place the new file in the location used by the principal database.

For example, the following command restores a backup of a principal database residing in C:\Program Files\Microsoft SQL Server\MSSQL.n\MSSQL\Data\ to a different location, D:\Program Files\Microsoft SQL Server\MSSQL.n\MSSQL\Data\, where the mirror database is to reside.

RESTORE DATABASE AdventureWorks2008R2    FROM DISK='C:\AdventureWorks2008R2.bak'    WITH NORECOVERY,        MOVE 'AdventureWorks2008R2_Data' TO           'D:\Program Files\Microsoft SQL Server\MSSQL.n\MSSQL\Data\AdventureWorks2008R2_Data.mdf',        MOVE 'AdventureWorks2008R2_Log' TO          'D:\Program Files\Microsoft SQL Server\MSSQL.n\MSSQL\Data\AdventureWorks2008R2_Log.ldf'; GO


The above path is for reference only, check the correct path on the mirror database and repeat the process for full backup and transactional backup.