Posts

Shutting Down a Running COM+ Instance

Image
If you have an instance of object running under COM+ (in the dllhost.exe process space) and you want to shut it down from C#, you can use the code below.  Note that ShutdownApplication only intializes the shutdown of the COM+ applicance, it will return sometimes before the application is finished shuting down.  So you need to check to make sure the applicatio is shut down before continue.  I use this code in my unit testing to kill the instance-- making sure that it is stateless.  Also note that you need to send the package id for the application -- this is the guid you used when installing the application into COM+.  It can be found on the first property page of the application properties in component manager. internal static void ShutDown() { Int32 count = 0; COMAdmin.COMAdminCatalog objAdmin = new COMAdmin.COMAdminCatalog(); // WWB: ShutDown The Application (All Instances) Using teh Package Id objAdmin.ShutdownApplication(Configuration...

Mesh and IE Favorates

Image
I have been playing around with Mesh a bit of late. Mostly good other than on a few of my machines, Mesh refused to install. Either the install itself failed or it just never allowed me to sign in. But, I figured out one use for Mesh this morning that made it all come together: sharing IE Favorites. After installing Mesh, share the following folder on each machine: Xp, 2003: C:\Documents and Settings\%USERNAME%\Favorites\Links Vista, 2008: C:\Users\%USERNAME%\Favorites\Links Make sure when resolving the share location of the folder on subsiquent machines, you browse to the location above. Now your IE links are synced across machines.  

Vista Administrator

In Vista there is an Administrator account, however it is disabled on install. If you join the domain you can login with any domain user you want, however if your domain connection is lost, your computer account or the domain lost then you can only login with the local user you created at install -- which can't be the Administrator. If you forget the the password to this user there is a problem. So to prevent a reinstall you need to enable the Administrator account with this: Net user administrator /active:yes at the command line under elevated permissions (Run As Administrator). The administrator password is blank (which means you don't have to login) by default. {6230289B-5BEE-409e-932A-2F01FA407A92}

Azure Storage - CloudDrive SDK

If you are the CloudDrive Powershell extension in the CTP of Azure Storage SDK, the easiest way to map a drive onto the cloud is to add this line to the MountDrive1.ps1 file: MountDrive -ServiceUrl "http://blob.core.windows.net" -DriveName "BigDrive" -ProviderName "BlobDrive" -Account "accountName" -Key "XXXXXXXXXX" Note that the accountName is the name of your project on the Azure web site, the storage project name. And the Key is the primary key you are given from the Azure web site. Also, the SeriveURL doesn't contain your account name at the beginning. Once you have this line added to the bottom of the file and save, you can run the runme.cmd batch file from the command line and your drive will be mapped. The other two lines look like this: MountDrive -ServiceUrl "http://127.0.0.1:10000" -DriveName "Blob" -ProviderName "BlobDrive" MountDrive -ServiceUrl "http://127.0.0.1:10001" -DriveName ...

varchar(max) and varbinary(max) Questions and Answers

Image
How big of an allocation does max represent in the case of varchar(max) and varbinary(max)? 2 ^ 31 - 1 bytes or just about 2gb. Can I specify a varchar(9000) or varbinary(12000)? No.  If you are going to specify an actual number instead of (max) then your limit is 8000.  The size can be 1 to 8000, or max, there is nothing between 8000 and max. Is a varchar(max) or varbinary(max) column stored in the data row? If the size of the varchar or varbinary item is less than 8000 then it is stored in the data row.  If it is greater than 8000 then the item is moved out of the data row into a special storage location for large objects. Should varchar(max) be used to replace the TEXT column type? Yes.  varchar(max) can handle larger strings than the text type can.  varchar(max) is easier to update than text with standard SQL statements.

Mutual Exclusive CollapsiblePanelExtender

The following piece of code will allow you to have multiple ASP.NET 2.0 Ajax CollapsiblePanelExtender controls on a single page and only one of them will be expanded at a time. You can use this to keep the page length short. You must set the BehaviorId of the CollapsiblePanelExtender, that is what the $find javascript function looks for. Make sure to add all the BehaviorIds to the array in the pageLoad function. <script type= "text/javascript" > // WWB: Handles Mutual Exclusive Expansion. Only One Extender Panel // Can Be Open At A Time var extenders = []; function pageLoad(sender, args) { extenders[0] = $find( "PanelExtender1" ); extenders[1] = $find( "PanelExtender2" ); extenders[2] = $find( "PanelExtender3" ); // WWB: Hook All The Extenders, If extenders[i] is null then // the extenders is not being displayed -- i.e. not visible for (var i=0; i< extenders.length; i++) if (extenders[i] !...

Happier Coding

Dina says I am happier when I code and not just during coding. Some of my friends my age, and yes I am getting older, are moving to management jobs where they don’t code at all. They might be development leads that train and deploy new technologies in bigger companies, or design systems and have others code. Some of the same friends that interviewed at our smaller company and we didn’t hire because they just didn’t seem right (Where I work now you can’t just design or train since the company is so small). These friends fit right in with the bigger companies; in fact they got jobs as developers however aren’t really doing any development at all. I have a hard time calling these jobs management since they don’t have a lot of people under them; I really just want to call them a “Non-Productive” job – which is reflection of my perspective on how I like coding. I wonder if the bigger companies will “wake up” and make them do something, or force them to do development which they were hir...