Cool Kit

I often upgrade or migrate PCs (e.g. I’ll be upgrading to Windows 7 soon from Vista) and transferring all the data about (even over a 1Gb link) can be slow. I also have hard disks laying about that I need to reformat, work on etc. and I’ve tried hot-swap containers but they never worked very well since you had to screw the HDD into the tray and were very noisy.

So when I found the Sharkoon QuickPort and the Sharkoon DriveLink I had to buy them:

QuickPort

The QuickPort (right) is an external desktop device that accepts either 2.5" or 3.5" ‘raw’ SATA hard disks. (And yes my desktop does have that many wires floating about on it).

The cool thing about QuickPort is that this has an eSATA connector which means it’s exactly the same throughput as a normal SATA drive would be if it were plugged into your PC.

I plugged both a new 2.5" 500GB Seagate Momentus and a 3.5" 2TB WD EcoGreen drive in, and was able to get over 100MB/sec transfer speed on both using DiskMark. I copied a 1.3Gb file in 12 seconds as a test. Try that with your external drive and it’s USB2 connector.

If you have the QuickPort Pro (like mine) it also adds a couple of desktop USB ports and an integrated SD/MMC card reader too.

DriveLink

I also have some older 2.5" and 3.5" IDE (PATA) drives I needed to work on, one for an old IBM Thinkpad that has no CDROM or floppy and does not support boot from USB-connected drives. I can now pre-install an OS onto it’s 2.5" HDD from my main workstation, and then swap it into the laptop. That would make a nice little Ubuntu test box. The only way to load new software is to install the disk onto another machine and set up the boot loader, or at least some CDROM drivers for my external CDROM drive.

This is where the DriveLink (left) comes in. It has a 2.5" and 3.5" PATA connectors, and also a SATA connector. So it can connect to almost any type of HDD. Better still, it has two USB plugs (one black, for data and one red, for HDD power), so it can even power the drive.

This is especially useful as it means DriveLink does not need an external power supply for the drives, and can be used to quickly back up or image a laptop. Alas as it’s USB2 it’s not as fast as my QuickPort.

Serializing Generics

Lets say I want a generic list of something in XML:

e.g.

Public Property AccountNumbers As List(of String)

when we serialize this, the serializer helpfully defaults to the Type of the generic (in this case, string), so we would get the XML:

<AccountNumbers>
  <string>1234</string>
  <string>5678</string>
</AccountNumbers>

Which works but isn’t very reader friendly. If we want to change the <string> to something else, we decorate the property with the XmlArrayItem attribute:

<System.Xml.Serialization.XmlArrayItem("Account")> _
Public Property AccountNumbers As List(of String)

And so we get the nicely formatted result:

<AccountNumbers>
  <Account>1234</Account>
  <Account>5678</Account>
</AccountNumbers>

SQL server linked server to itself

I had a problem – I wanted to put archive data into separate databases on the same SQL Server 2005 system. When I did this though, I had to map all the accounts I had previously created on the main database into each of my annual archive databases. The meant that a lot of synchronising of accounts and logins across each of the archives, and creating new ones whenever a new archive was created.

I knew that the SQL Server 2005 linked servers system allowed one server to log into a different server using a single login, but I could not see a way to do this when the server was local. Then I realised that I could create a linked server called “localhost” thus:

— add linked server using alias to self!
sp_addlinkedserver @server=’localhost’, @srvproduct=’SQL Server’;
— create a login map to a single account
sp_addlinkedsrvlogin
@rmtsrvname=’localhost’,
@useself=’FALSE’,
@rmtuser = ‘MyArchiveUser’,
@rmtpassword = ‘myarchivepassword’;

SQL Server thinks this that ‘localhost’ is a “remote” server and allows me to use it as if it were. I could then make my archives available as views in the live database as follows:

CREATE VIEW ArchiveTable AS
SELECT * FROM localhost.ArchiveDatabase.dbo.ArchiveTable;

Really pretty simple once I’d figured out how to fool SQL!