Windows 2008 R2 Upgrade Hanging at 62

I was in server hell this weekend, as I was trying to upgrade a machine from 2008 to 2008 R2.

I had more problems than I could even write on this page, but most were unrelated to the actual upgrade itself.

The one thing I wanted to put here was regarding the fact that the update seemed to hang at 62% in the final step.

At one point I walked away and came back like an hour later to find it still at 62%.  I swore a bunch of times and left the computer running while I went back to my laptop to try researching the issue.

I found that there is a known issue in Windows 7 upgrade that causes it to lockup at 62%.  I figured I had something like that happening to me, but thankfully I didn’t pull the plug too early because sometime during the next 30 min or so, it moved to 63%, and soon it was done.

So, if you are upgrading to R2 and you are stuck at 62%, or 63% (63% took a long time too), don’t pull the plug.  Let it sit for another hour. 

Sending Faxes Online

Since we recently dropped AT&T in favor of a $6/month plan from Callcentric.com, I haven’t been able to use my fax machine.

It’s not really suprising, even though it’s SUPPOSED to work, it’s sone of those things where, the fax machine is trying to do digital to analog, and then the VOIP provider is doing analog to digital and this second conversion has an accepted amount of packet loss as part of the equation.

If that amount is above the tolerance level of the 2 communicating fax machines, then it doesn’t work.

So when I needed to send a fax the other day I again when looking for a simple online solution for a 1 time user like myself and I think I found it:  http://faxzero.com/.

There are tons of place out there that offer fax services online (http://fax.1888usa.com/), and many that offer some kind of free version, but they usually fall into 2 categories: 1) you can send a free fax, but it’s limited to 1-3 pages (I needed to send 4 pages) or 2) you can pay a monthly subscription to get the “pro” version.

FaxZero has the free version (lmiit 3 pages) but they also have a $2 option that you can use to send up to 15 pages (and no ad cover letter).

Perfect!  I uploaded my PDF, paid 2 bucks, got a confirmation message in my inbox.  Just what I wanted.

Customizing Style of RadGrid Edit Items

A developer wanted to customize his “edit” form with a telerik rad grid, and we found it less than simple to change the textboxes and other edit controls to make them more narrow, and/or other customizations.

 

I did some research and came across a few different technique for doing this that I am going to share with everyone.

 

Template Columns

The first option, which is the one he used because it is the easiest, is to convert your columns to “template columns.”  Converting columns changes:

 

<telerik:GridBoundColumn DataField=”EmployeeEmail” DataType=”System.Int32″ HeaderText=”EmployeeEmail”

SortExpression=”EmployeeEmail” UniqueName=”EmployeeEmail” />

 

To this:

 

<telerik:GridTemplateColumn DataField=”EmployeeEmail”

    HeaderText=”EmployeeEmail” SortExpression=”EmployeeEmail”

    UniqueName=”EmployeeEmail”>

    <EditItemTemplate>

        <asp:TextBox ID=”EmployeeEmailTextBox” runat=”server”

            Text=’<%# Bind(“EmployeeEmail”) %>‘></asp:TextBox>

    </EditItemTemplate>

    <ItemTemplate>

        <asp:Label ID=”EmployeeEmailLabel” runat=”server”

            Text=’<%# Eval(“EmployeeEmail”) %>‘></asp:Label>

    </ItemTemplate>

</telerik:GridTemplateColumn>

 

 

As you can see, this gives you control over the actual textbox item that will be displayed when you are in edit mode.

 

But using template columns can also be a bit of a pain, because you losing some of the simplicity that you had before when you simply allowed the rad grid to deal with the details of the display/edit cell items.  This also complicates things when you try to do anything in the ItemDataBound or ItemCreated events on the rad grid.  You can’t just grab the column, you have to dig deeper, looking for the contained child controls to find your actual edit control.

 

ItemDataBound

 

    Protected Sub RadGrid1_ItemDataBound(ByVal sender As Object, ByVal e As Telerik.Web.UI.GridItemEventArgs) Handles RadGrid1.ItemDataBound

        If TypeOf e.Item Is GridEditableItem And e.Item.IsInEditMode Then

            Dim editItem As GridEditableItem = e.Item

            If TypeOf editItem.Item(“EmployeeId”).Controls(0) Is TextBox Then

                CType(editItem.Item(“EmployeeId”).Controls(0), TextBox).Width = 30

            End If

        End If

    End Sub

 

 

In this example, I am setting the width of the EmployeeId textbox to only 30px.

 

 

CreateColumnEditor

 

    Protected Sub RadGrid1_CreateColumnEditor(ByVal sender As Object, ByVal e As Telerik.Web.UI.GridCreateColumnEditorEventArgs) Handles RadGrid1.CreateColumnEditor

        If TypeOf e.ColumnEditor Is GridTextBoxColumnEditor Then

            If e.Column.UniqueName = “FirstName” Then

                CType(e.ColumnEditor, GridTextBoxColumnEditor).TextBoxStyle.Width = 30

                CType(e.ColumnEditor, GridTextBoxColumnEditor).TextBoxControl.Style.Add(“text-align”, “right”)

            End If

        End If

    End Sub

 

 

I believe this event is fired when the grid is creating the edit columns.  You hook into this event, and then modify the textboxstyle in order to change the look of the edit control.

 

 

Defined Column Editor

 

You can achieve the same results as in CreateColumnEditor without writing any code if you drop a GridTextBoxColumnEditor on your page (outside of the RadGrid) like so:

 

<telerik:GridTextBoxColumnEditor ID=”GridTextBoxColumnEditor1″ runat=”server”>

    <TextBoxStyle Width=”50px” />

</telerik:GridTextBoxColumnEditor>

 

And then in your column you specify the ID of the editor you want to use, like this:

 

<telerik:GridBoundColumn DataField=”UserId” DataType=”System.Int32″ HeaderText=”UserId” ColumnEditorID=”GridTextBoxColumnEditor1

    SortExpression=”UserId” UniqueName=”UserId”>

</telerik:GridBoundColumn>

 

 

 

 

CSLA and the watch window

One of my biggest complaints about using CSLA has been the issue of Visual Studio’s failure to work correctly in the watch window with CSLA objects. 

I wrote a post a while back about my issues:

So for example I have a simple list called “projects” which is of type ProjectList containing ProjectListItems.

If I put “projects” in the watch window, for Value I get:

“Count = {System.TypeLoadException}”

If I put “projects(0)” in the watch window, I get:

{“The generic type ‘System.Collections.ObjectModel.Collection`1’ was used with the wrong number of generic arguments in assembly ‘mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089’.” : “System.Collections.ObjectModel.Collection`1”}

Rocky’s response was:

This is a known issue. I’ve actually talked to the VS debugger team about this, and they didn’t have a satisfactory answer – and certainly not a solution. This issue has existed since 2005 when generics were introduced into .NET.

Well, after doing some digging I think I have come across a few work arounds.

If I were to use the Watch Window and put:

projects.Count

it would throw an error.  But if I put:

projects.Count.ToString

then I get the correct result.

Also when picking a specific item:

projects.Item(2)

I get the same exception.  However, if I use:

CType(projects.Item(2),Object)

I get the object as expected!

I hope this helps out others as this is really important when debugging an application.

 

CSLA Validation AmbiguousMatchException

Ran into this error today:

failed in property IsDeleted —> System.Reflection.AmbiguousMatchException: Ambiguous match found. at System.RuntimeType.GetPropertyImpl

I knew that we happened to have a property on our class called IsDeleted that shadowed a property in the CSLA base class, but I didn’t think it should be running into this problem.

After tracking down some reference info here http://msdn.microsoft.com/en-us/library/zy0d4103.aspx I found otu that the issue isn’t that we are shadowing, it’s that we are shadowing while at the same time changing the type. 

The documentation seems to indicate that both situations should fail, but in my tests, the only time I got the exception was when my shadowing property had a different type.  In this case, we were using a Nullable(of boolean) while the CSLA element was just a plain old Boolean.

I guess we are going to rename our property to make things easy on ourselves, but seeing as how this is codegenerated, it’s a little more of a pain than you might think.  But, oh well.

Here is some code that produces the error.  If you change the 2nd property type to a string it works ok.

imports Microsoft.VisualBasic
imports System
Imports System.Collections.Generic

public module MyModule
    sub Main
        dim target as new baseclass
        
        dim p as system.Reflection.PropertyInfo  = target.GetType().GetProperty("Prop")
        
        wl( p.GetValue(target, nothing))

        
        RL()
    end sub

    #region "Helper methods"

    sub WL(text as object)
        Console.WriteLine(text)
    end sub

    sub WL(text as object, paramarray args as object())
        Console.WriteLine(text.ToString(), args)
    end sub
        
    sub RL()
        Console.ReadLine()
    end sub
    
    sub Break()
        System.Diagnostics.Debugger.Break()
    end sub

    #end region

end module

public class BaseBaseClass
    public readonly property Prop as string
    get
    return "BaseBaseClass"
    end get
    end property
end class

public class BaseClass
inherits BaseBaseClass

    public readonly property Prop as integer
    get
    return 123
    end get
    end property

end class