Archive for the ‘Development’ category

Using the CLR on SQL Server 2005 with 4GB Ram or More

July 14th, 2008

For most people using SQL Server CLR is not an issue however when you have more that 4GB or more of memory, the CLR does not just work.

Enter the –g startup switch, You can read more about the SQL Server 2005 startup options to get the fine detail. In order to make the required changes follow these steps

1.) Launch SQL Server Configuration Manger

image

2.) Under Sql Server 2005 Services choose the instance of SQL Server that you are targeting for the change and right click on it and select Properties.

3.) Move to the Advanced Tab and locate the Startup Parameters

image

4.) Add the –g option to the end by first closing the previous parameter with a ‘;’ then –g, not adding the ‘;’ to the end of the previous parameter will cause SQL server to fail on restart

image

5.) Click Apply /OK and restart the service. When the service restarts you should now have SQL CLR on your machine. A simple Hello World CLR stored proc should do tell you if your in business or not.

 

Deploying SMO client runtime

June 30th, 2008

How do you deploy SQL Server Management Objects (SMO) runtime?   Follow this 3 step process for success.

STEP 1:  

STEP 2:  

STEP 3:

The links above point to the X86 framework however at the time of writing the was the latest and had links to the various processor architectures that are supported by Microsoft

I guess the next logical step is to find out what the differences will be between SQL Server 2005 and SQL Server 2008 seeing as its release is imminent. That being said my total time invested in Microsoft’s latest database technology has been zero.

While I am deviating. Am I the only one not really concerned with SQL Server 2008’s launch?

Technorati Tags: ,,

Vista UAC Visual Studio and Run As Administrator Gotcha’s

June 24th, 2008

Today one of my colleagues was working on piece of code that would turn a given mapped drive to full UNC path. The code to do implement the functionality is very simple and can be done in a variety of ways ranging from Win32 API to WMI (via System.Management) Below is a snippet of the code that was used.

   1: public static string GetUNCPath(string originalPath)
   2: {
   3:     string returnVal = originalPath;
   4:     foreach (DriveInfo drive in System.IO.DriveInfo.GetDrives())
   5:     {
   6:         if (Path.GetPathRoot(originalPath).ToLower().StartsWith(drive.RootDirectory.FullName.ToLower()))
   7:         {
   8:             if (drive.DriveType == DriveType.Network)
   9:             {
  10:                 System.Management.ManagementObjectSearcher searcher = new System.Management.ManagementObjectSearcher(
  11:                     @"\\.\root\cimv2", "Select * From Win32_LogicalDisk Where DriveType = 4");
  12:  
  13:                 foreach (System.Management.ManagementObject obj in searcher.Get())
  14:                 {
  15:                     if (obj["DeviceID"].ToString().ToLower().StartsWith(drive.Name.ToLower().Substring(0, 2)))
  16:                     {
  17:                         returnVal = Path.Combine(obj["ProviderName"].ToString(),
  18:                             originalPath.ToLower().Replace(drive.Name.ToLower(), string.Empty));
  19:                         break;
  20:                     }
  21:                 }
  22:             }
  23:             else if (drive.DriveType == DriveType.Fixed)
  24:             {
  25:                 Console.WriteLine("The drive is not a network drive");
  26:             }
  27:             break;
  28:         }
  29:     }
  30:     return returnVal;
  31: }

 

This code can easily be tested using , a great tool that is pretty much a must have for any developer.  I have attached the code file that can be used with snippet compiler all that you will need to do is to change the mapped path that is passed into the method and  a reference to System.Management.dll in Snippet Compiler. You can then run the code with UAC turned on with Run As Administrator or just a normal use to see the difference.

When running this code on Windows Vista with UAC turned on and Visual Studio 2005 or 2008 in administrator mode will provide different results. While getting different results is the correct behavior, unless you are fully aware of the various areas that running applications in a secondary login has  impact on the notion of running your application in a different user context can cause a lot of wasted hours.

As a general rule when debugging code or running code on a machine that has UAC enabled my advice would be to spend a quick second to check if UAC has a part to play in the puzzle.

How do you estimate your projects

June 15th, 2008

Estimating time for a work item is at times a fine art, more often than not its based on a combination of Prior Experience and gut feel.

Simon is soon going to be setting free our that we have used extremely successfully for over 18 months.

When its available I would suggest that you give it a try. In the mean time Dilbert will supply some laughs

 Estimation

Plug-in, Add-in and Extension’s – The Managed Addin Framework

June 15th, 2008

The use of plug-ins or add-ins are a common way of extending any application, most people do not even know when they are using an extension.

I am currently using an add-in framework in a project that I am working on and It has proven its self invaluable. The framework I speak of here is baked right into the .net Framework from 3.5, The Managed Add-in Framework being fairly new and has a few glaring issues that need to be addressed like the naming conventions and directory structure that must be adhered to avoid making the entire framework come crashing down.

In order to use the framework easily you will need to download the which is the latest release at the time of writing, please check the or .

While there are annoyances with the state of its development, some of the features you get from using it out of the box are nice. The ability to launch add-ins either cross process or cross domain is great.

The add-in framework uses Adapters on either site of the add-in contract or isolation boundary as proxies. This is some of the magic that also enables efficient version control of the add-ins without the changing or breaking the add-ins.

 

image

For Additional information I would strongly recommend checking out these two videos

also further reading relating to the or MAF look here.

Velocity – Distributed Caching the Microsoft Implementation

June 9th, 2008

The is pimping the following.

Project “Velocity” is a distributed in-memory application cache platform for developing scalable, available, and high-performance applications. “Velocity” fuses memory across multiple computers to give a single unified cache view to applications.

And after listening to the latest   it has me a interested.

I am currently working through the process of evaluating various Distributed Caching Options for the next version of an enterprise app that we are building, Velocity will go on the watch list.

This is something that has been seriously missing for most .net developers. The feature set is still being developed to include Cache as mentioned on the Hanselman Podcast. The current CTP brings the following.

  • Caches any serializable CLR object and provides access through simple cache APIs.
  • Supports enterprise scale: tens to hundreds of computers.
  • Configurable to run as a service accessed over the network or run embedded with the application.
  • Supports common cache configurations.
  • Supports dynamic scaling by adding new nodes.
  • Configurable number of backup copies to provide high availability.
  • Automatic load balancing.
  • Integration with administration and monitoring tools such as ETW, System Center, etc.
  • Provides tight integration with ASP.NET to be able to cache ASP.NET session data in the cache without having to write it to source databases. It can also be used as a cache for application data to be able to cache application data across the entire Web farm.
  • Follows the cache-aside architecture (also known as Explicit Caching) for V1. That is, you must decide explicitly which objects to put/remove in your applications and “Velocity” does not synchronize with any source database automatically.
  • Support for multiple client languages (for example, PHP, C#, C++, etc.).

 

 

Dare has a Also check out the and download and play with the bits.

 

BizTalk Express Anyone

June 3rd, 2008

biztalkexpressSmall My good friend says that and while they are at it make sure they throw all the tools into VS.net

I do agree with him on the fact that BizTalk need to be set free to see the general adoption, However rather than having it fully integrated into the Visual Studio IDE we need something more in the vein of SQL Express. Eventually BizTalk Express will be one of the tools every developer will have in their toolkit.

The interesting aspect will be what parts of BizTalk will they integrate into Visual Studio.

UPDATE: Seeing as we now have a christened the product here is a fancy Logo, maybe even bumper stickers 

BizTalkExpress

UPDATE: style fix