Yoooder.com Just another WordPress weblog

28Mar/080

.NET: Referencing a 2.0 DLL from a 1.1 DLL

*NOTE* This only works if your executable is running under the 2.0 Framework!

At work we are writing a .NET 2.0 application that has its roots back in 1.1.  Some ancillary applications were also written in 1.1, and shared some common libraries; so when it came time for this application to be upgraded to 2.0 some libraries had to be left behind for compatibility reasons.

One such library has the task of loading data from databases, and was designed to read from MS Access, SQL Server, or MSDE; however in the ongoing development of our application we are scraping the MS Access use in favor of SQL Compact Edition.  For those familiar with SQL CE, you'll know it's not compatible with the 1.1 framework--so we were faced with the issue of either duplicating the functionality of the 1.1 DLL in a 2.0 DLL, so that old applications could be left alone, or with doing massive work to overhaul the old applications and try to bring them all up to 2.0...  neither option was terribly appealing (although the first option was obviously preferable).

Our project architect put the task to me, and had a plan of attack that he figured would let us make the 1.1 DLL talk to the SQL CE database via a 2.0 DLL proxy--however you'll know that 1.1 projects cannot reference 2.0 projects.  Here's where a little trickery comes in...

For a quick recap we have: A Framework 2.0 application, which calls a 1.1 Library to retrieve data.  We need: A Framework 2.0 application to call the 1.1 Library to call a 2.0 Library to retrieve the data from SQL CE.

To achieve this we added an interface to the 1.1 Library, and implemented that interface in the new 2.0 library which uses the interface to fetch the needed data from the database.  The 1.1 library uses reflection to late-load the 2.0 library and instantiates it by its interface.

So the workflow is:

  • 2.0 Application makes a call to the 1.1 Library
    •  1.1 Library uses an Assembly.Load() call to late-load the new 2.0 Library and casts it to the 1.1's interface definition.
    • 1.1 Library then can call the Interface member, which...
      • Talk through the 2.0 framework to our SQL CE database.
Tagged as: , , No Comments
26Mar/080

ThinkPad T61p: Converting drives from Compatibility-mode to AHCI

I formatted my T61 for the purpose of squeezing Vista down to a reasonable size, and so that I could ensure that I could get XP to install as C:\ (because (1) I will use it more, and (2) Vista will always show itself as residing on C:, even if it is really isn't).

To install XP I had to convert my SATA controller to run under Compatibility-mode, which allows XP to recognize the drive without a 3rd party driver during installation. After installing XP, Vista, and Ubuntu Gutsy Gibbon on the drive in this mode I flipped the BIOS switch back to AHCI, and both versions of Windows crashed hard.

Here's the path to recovery:

  1. Go to Lenovo\IBM's site and lookup the driver-download page for your machine, this page is under Support.
  2. Find "Intel Storage Matrix" on the driver page and download it. Then run this file, which will extract other files.
  3. Open a command prompt, and go to C:\Drivers\Win\IMSM\Prepare (created by the above step). Then run "Install.cmd" which will install the Intel drivers.
  4. Reboot, flip the BIOS switch to AHCI, and you should be all set.

This works for both XP and Vista; although Ubuntu was happy without any work :-)

21Mar/080

screen – a terminal encapsulator

My title might not be quite accurate, however screen is a great little utility that has a lot of leverage.  My main use for it is to start an application and allowing it to run on my remote machine while I disconnect my ssh connection.  Basically, just ssh into your remote machine and install screen.  Then start the program with the 'screen' command.  Now start your task, maybe a torrent with btdownloadcurses.  Whenever you want to disconnect and leave the program to run press Ctrl-a d (Control and 'a' key, then 'd')  to detach.  Whenever you want to reattach to that session restart screen with the -r command, so 'screen -r' and voila you're back!

Filed under: Uncategorized No Comments
20Mar/080

dmidecode

This is more a Post-it note to myself to remember one of my facorite new commands: dmidecode

dmidecode will output lots of details about your motherboard and the devices connected to it, including BIOS information as well as some upgradability info (usually).

Filed under: Uncategorized No Comments