Bronco Solutions

Knowledge Management and Collaboration Platform
Welcome to Bronco Solutions Sign in | Join | Help
in Search

Andrew Renner

  • Testing from Windows Live Writer

    This is my first test post from windows live writer... pretty simple thus far.

     This is a blurry picture...

  • XP_CMDSHELL

    By default this is disabled in 2005.

    To reenable it run the following:

    USE master
    GO
    EXEC sp_configure 'show advanced options', 1
    GO
    RECONFIGURE WITH OVERRIDE
    GO
    EXEC sp_configure 'xp_cmdshell', 1
    GO
    RECONFIGURE WITH OVERRIDE
    GO
    EXEC sp_configure 'show advanced options', 0
    GO

  • ASP.NET Windows Explorer: Serialization Vs. System.IO

    Call it stubbornness or simply curiousity... I was just not happy with a system io approach of loading a treeview with the folders in a specified directory with a file listing on the right.  Even with a load on demand approach where you click a node and it then loads its folders and files seemed fairly slow to me.

    I through a component together that builds a folder object with all folders and files... and can be serialized/deserialized to/from xml.

    Now for the tests:

    I decided to appease myself and see which was really faster...

    System.IO or Serialization

    1) First I timed the component alone to see how long it would take to load the object using system.io

    Results:

    - 8 Folders 25 Files loaded in an average of 546,903 Ticks (100 nanosecond intervals)

    2) Second I timed the component to see how long it would take to load the same object by deserializing the xml file into the object

    Results:

    - 8 Folders 25 Files loaded in an average of 4,531,482 Ticks (100 nanosecond intervals)

    I was quite surprised that the system.io was marginally faster then the deserialization.  I decided to up the ante to a larger folder...

    1) System.IO

    Results:

    - 1320 Folders 8318 Files loaded in an average of 39,064,500 Ticks (100 nanosecond intervals)

    - Converted to seconds (3.90645 seconds)

    2) Deserialization

    Results:

    - 1320 Folders 8318 Files loaded in an average of 6,198,234 Ticks (100 nanosecond intervals)

    - Converted to seconds (0.6198234 seconds)

    CONCLUSION:

    The thing to notice here is the marginal increase in time to load the object when deserializing.  The increase was equivalent to 0.15 seconds... while System.IO was very fast for small folders when the numbers increased the time required to load the object also did exponentially.

  • SQL Server SP1: SSIS Service Failure : Resolution

    After installing SP1 for SQL Server 2005 SSIS Integration Services fails.

    The service did not respond to the start or control request in a timely fashion.

    Below is all the information you will need to fix the issue.

    BE SURE TO INSTALL THE 6 HOTFIX UPDATES IN THE ORDER SPECIFIED

    Links:

    SQL Server 2005 SP1:
    http://www.microsoft.com/downloads/details.aspx?familyid=cb6c71ea-d649-47ff-9176-e7cac58fd4bc&displaylang=en

    Microsoft KB acknowledging issue:
    http://support.microsoft.com/?kbid=918644

    Hotfix Build 2153:
    http://support.microsoft.com/kb/918222/

     

  • SqlDataSource uniqueidentifier Parameter

    UniqueIdentifier parameters by default are coded like this

    <asp:Parameter Name="Original_EventID" Type="Object" />

    The problem is that this cause the following error:

    Implicit conversion from data type sql_variant to uniqueidentifier is not allowed. Use the CONVERT function to run this query.

    To correct this simply remove the Type so it looks like this:

    <asp:Parameter Name="Original_EventID" />

  • ReportingServices: Accessing SubObject Property

    For example: To access the name property of the child class:

    =First(Fields!child.Value.name, "iInvoice_Customer")

    Or the address2 property of the address class

    =First(Fields!address.value.address2, "iInvoice_Customer")

    Or the name property of the object itself

    =" To: " & First(Fields!name.Value, "iInvoice_Customer")

     

    As you can see this customer object contains :

    Name - Property

    Address - Object

    Child - Object

  • Installing Globalscape Secure FTP Server 3.1.5

    Complete guide can be found here:

    http://www.globalscape.com/support/evalguide_srv2.asp

  • CodeRush: iEditable Smart Paste Template

    This template is used to paste properties compatible with the iEditable interface.

    1. Create a new smart paste template
    2. Set the match with property to:

               [code language="VB.NET"]%ws1%%Accessibility%?%SharedModifier1%?%FieldVarPrefix1%%PartialIdentifier1%%mws%%As1%%Type1%(%ws2%?=%ws3%?%IdentifierStringOrNumber%)? %EndOfLineComment%?[/code]

    3. Set the replacement text to the following

      [code language="VB.NET"]

      Public Property %SharedModifier1% %PartialIdentifier1% %As1% %Type1%
        Get
          Return «Marker(60)»%FieldVarPrefix1%%PartialIdentifier1%
        End Get
        Set
          «Cursor»If Not %FieldVarPrefix1%%PartialIdentifier1%.Equals(Value) Then
      If Me.InEdit Then
                   SaveState("%PartialIdentifier1%", %FieldVarPrefix1%%PartialIdentifier1%, value)
      End If
              %FieldVarPrefix1%%PartialIdentifier1% = Value
              OnPropertyChanged("%PartialIdentifier1%")
           End If«BlockAnchor»
        End Set
      End Property [/code]

    4. Set the rest of the properties the same as Property(PrefixedField)

    Example:

    [code language="VB.NET"] 
       Private _id As String
       Private _name As String
       Private _salary As Decimal

       Public Property id() As String
          Get
             Return _id
          End Get
          Set(ByVal value As String)
             If Not _id.Equals(Value) Then
                If Me.InEdit Then
                   SaveState("id", _id, value)
                End If
                _id = Value
                OnPropertyChanged("id")
             End If
          End Set
       End Property
       Public Property name() As String
          Get
             Return _name
          End Get
          Set(ByVal value As String)
             If Not _name.Equals(Value) Then
                If Me.InEdit Then
                   SaveState("name", _name, value)
                End If
                _name = Value
                OnPropertyChanged("name")
             End If
          End Set
       End Property
       Public Property salary() As Decimal
          Get
             Return _salary
          End Get
          Set(ByVal value As Decimal)
             If Not _salary.Equals(Value) Then
                If Me.InEdit Then
                   SaveState("salary", _salary, value)
                End If
                _salary = Value
                OnPropertyChanged("salary")
             End If
          End Set
       End Property

    [/code]

  • Code Snippet: BindingListView Support

    Download the snippet at the end of this post.

    To Install Snippet:

    To use the snippet:

    • Either right click and click Insert Snippet
    • OR type BSBindingView<tab>
      • Replace the class name with your class name i.e. Employees
      • Replace the object name with your object name i.e. Employee

    Additional Requirements:

    • You will need my BroncoSolutions.Components.dll to use the snippet as is
  • Code Snippet: Editable Object

    Download the snippet at the end of this post.

    To Install Snippet:

    To use the snippet:

    • Either right click and click Insert Snippet
    • OR type BSEditable<tab>
      • Replace the class name with your class name i.e. ObjectName

    Additional Requirements:

    • You will need my BroncoSolutions.Components.dll to use the snippet as is
  • Code Snippet: BindingList Support

    Download the snippet at the end of this post.

    To Install Snippet:

    To use the snippet:

    • Either right click and click Insert Snippet
    • OR type BSBinding<tab>
      • Replace the class name with your class name i.e. Employees
      • Replace the object name with your object name i.e. Employee

    Additional Requirements:

    • You will need my BroncoSolutions.Components.dll to use the snippet as is

    The result is the following:

    [code language="VB.NET"]

    Imports System.ComponentModel
    Imports System.Reflection
    Imports BroncoSolutions.Components.Windows.Collections
    #Region " Classname "
    Public Class Classname
       Inherits System.ComponentModel.BindingList(Of ObjectName)

       Private _Sorted As Boolean = False
       Private _SortDirection As ListSortDirection
       Private _SortProperty As PropertyDescriptor

       Protected Overrides Function AddNewCore() As Object
          Dim e As New ObjectName()
          Add(e)
          Return e
       End Function

    #Region "Sorting Support"
       Protected Overrides Sub ApplySortCore(ByVal prop As System.ComponentModel.PropertyDescriptor, _
         ByVal direction As System.ComponentModel.ListSortDirection)

          ' Get list to sort
          Dim items As List(Of ObjectName) = TryCast(Me.Items, List(Of ObjectName))

          ' Apply and set the sort, if items to sort
          If items IsNot Nothing Then

             _SortDirection = direction
             _SortProperty = prop

             Dim pc As PropertyComparer(Of ObjectName) = _
               New PropertyComparer(Of ObjectName)(prop, direction)

             items.Sort(pc)

             _Sorted = True

          Else
             _Sorted = False

          End If

          Me.OnListChanged(New ListChangedEventArgs(ListChangedType.Reset, -1))
       End Sub

       Protected Overrides ReadOnly Property SupportsSortingCore() As Boolean
          Get
             Return True
          End Get
       End Property

       Protected Overrides ReadOnly Property IsSortedCore() As Boolean
          Get
             Return _Sorted
          End Get
       End Property

       Protected Overrides Sub RemoveSortCore()
          _Sorted = False
       End Sub

       Protected Overrides ReadOnly Property SortDirectionCore() As System.ComponentModel.ListSortDirection
          Get
             Return _SortDirection
          End Get
       End Property

       Protected Overrides ReadOnly Property SortPropertyCore() As System.ComponentModel.PropertyDescriptor
          Get
             Return _SortProperty
          End Get
       End Property

       Protected Overrides ReadOnly Property SupportsSearchingCore() As Boolean
          Get
             Return True
          End Get
       End Property

       Protected Overrides Function FindCore(ByVal prop As System.ComponentModel.PropertyDescriptor, ByVal key As Object) As Integer
          Dim items As List(Of ObjectName) = Me.Items

          For Each item As ObjectName In items
             If key = prop.GetValue(item) Then
                Return IndexOf(item)
             End If
          Next

          Return -1
       End Function
    #End Region
    End Class
    #End Region

    [/code]

  • Forward Email to an External Email Address or Blackberry

    This is very handy for forwarding to blackberry or other email addresses.

    1. Active Directory User & Computers
      1. Create a mail enabled Contact
        1. Specify the external SMTP address
      2. Double click the user you wish to setup the forwarder for
        1. Exchange General Tab
          1. Delivery Options
            1. Forward To
              1. Choose the contact you just created

    Note: You can hide the contact from the GAL (Global Address List)

    •    Exchange Advanced Tab
      • Hide From Exchange Address Lists

    Note 2: You can make your contact accessible to everybody(internal/external) or to internal users or specific internal users

    • Exchange General
      • Message Restrictions
        • From Authenticated Users or
        • Everyone
        • Only From/Except From
  • Forward Email to Multiple External Accounts

    This is very handy for forwarding to blackberry or other email addresses.

    1. Active Directory User & Computers
      1. Create one mail enabled Contact for each external address
        1. Specify the external SMTP address for each
      2. Create a mail enabled group (Global Distribution)
        1. Specify the email address for the group (everyone@domain.com)
        2. Add each mail enabled contact to the list
      3. Double click the user you wish to setup the forwarder for
        1. Exchange General Tab
          1. Delivery Options
            1. Forward To
              1. Choose the group you just created

    Note: You can hide the contact from the GAL (Global Address List)

    •    Exchange Advanced Tab
      • Hide From Exchange Address Lists

    Note 2: You can make your distribution groups accessible to everybody(internal/external) or to internal users or specific internal users

    • Exchange General
      • Message Restrictions
        • From Authenticated Users or
        • Everyone
        • Only From/Except From
  • Inserting Identity Value

    Ever have a table where you need to insert a value into an identity field. 

    For example - you may have a lookup table with values 2, 3, 4 - I don't know about you but it annoys me to no end when the 1 value is missing.  You could truncate the table and re-insert all the values... but this is assuming there is no foreign keys...

    Here is a way you can actually insert the Identity ID value:


    [code language="T-SQL"]SET IDENTITY_INSERT membership.maritalstatus ON
    INSERT membership.maritalstatus (MaritalStatusID,[Name]) VALUES(2, 'Married')
    SET IDENTITY_INSERT membership.maritalstatus OFF
    SELECT * FROM membership.maritalstatus[/code]

    If you need to check the identity colum

    [code language="T-SQL"]DBCC CHECKIDENT('membership.maritalstatus')
    [/code]

    If you need to reseed the identity column

    [code language="T-SQL"]
    DBCC CHECKIDENT('membership.maritalstatus', RESEED, 2)
    Insert membership.maritalstatus ([name]) Values ('Married')[/code]
  • Solution Configurations Drop Down Toolbar: Release/Debug

    I had a case today where my solution configurations drop down box in the toolbar disappeared so I could only switch from debug/release in the config menu which is like a 3 step process to get to.

    Here is how to get it back:

    1. Go to menu Tools - Customize… (or right-click on any toolbar and Customize…)
    2. Switch to Commands tab.
    3. Click Rearrange Commands.
    4. Choose toolbar - Standard.
    5. Click Add.
    6. Select Build under Categories.
    7. Select Solution Configurations under Commands.
    8. Click Ok.
    9. Use the Move Up or Move Down buttons to get it where you want it to appear.
More Posts Next page »