Posts

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...

Indoubt Transaction in MSDTC

Image
For days I have been battling with MSDTC (Microsoft Distributed Transaction Server) and transaction that have the status of indoubt.  We are using the .NET System.Transactions.TransactionScope class to wrap many SQL Server calls together in a single transaction, which requires MSDTC to manage the transaction.  The application would run for 30 minutes then hang, timing out, and the table on SQL Server would end up being row locked -- hanging all selects, inserts, updates and deletes.  It took me a while to realize that the Kerbose error in the application log on SQL Server was the reason the MSDTC communication was failing -- by comparing the crash time with the error log.  Then doing some research I realized that all those virtual machines running our web servers that we copied around on our virtual servers had the same SID.  Even though we had renamed them and readded them to the domain, that didn't generate a new SID.  So I used Microsoft's NewS...

DataBind() on Postback

Image
Please junior developers don't Databind() your GridView on Postback.  You only need to databind your GridView once, when the page is first loaded (and anytime the data changes).  However, if you are lazy then you will DataBind on every postback forcing the GridView to go to the data source every postback and making your page slow.  Your junior code: protected void Page_Load( object sender, EventArgs e) {     ERSGridView1.DataBind(); } My code: protected void Page_Load( object sender, EventArgs e) {      if (!Page.IsPostBack)         ERSGridView1.DataBind(); } But, But... Yes DataItem will not be accessible on Postback, so this code will not work: protected void ERSGridView1_SelectedIndexChanged( object sender, EventArgs e) { object myData = ERSGridView1.SelectedRow.DataItem; } You will have to do this: protected void ERSGridView1_SelectedIndexChanged( object sender, EventA...

RaisePostBackEvent and RegisterRequiresRaiseEvent

Image
ASP.NET 2.0 You do not have to call Page.RegisterRequiresRaiseEvent() in order for IPostBackEventHandler.RaisePostBackEvent() event to be called. In fact calling Page.RegisterRequiresRaiseEvent() will interfer with all other controls on the page that need post back events. The only way calling Page.RegisterRequiresRaiseEvent() actually works is if that is the only control on the page. GridView doesn't have to call Page.RegisterRequiresRaiseEvent(). However, implementing just IPostBackEventHandler isn't good enough, you need to implement: IPostBackDataHandler also on your control. If you don't then IPostBackEventHandler.RaisePostBackEvent() will never be called. {6230289B-5BEE-409e-932A-2F01FA407A92}