20 February 2014

Slow LAN speeds between Windows 7 machine and Server 2003

I upgraded a few machines from Windows XP to Windows 7 recently, and all has been well for several weeks. Yesterday, two machines (relatively old Dell desktops) started exhibiting extremely slow connections to our Windows 2003 server. However, connections to other Windows 7 machines were a-okay. All machines are gigabit cabled.

Luckily, a coworker had found a solution to this months ago, so I wanted to make note of it here:

From the command line with admin privileges:

netsh int tcp set heauristics disabled
netsh int tcp set global autotuninglevel=disabled

... then reset the network adapter.

09 January 2014

VBA Name Parser

There are plenty of simple name parsers out there, but I needed one that would handle titles, suffixes, prepositions / particles (I'm no grammar expert), etc. This is what I hacked together for a VBA function in Excel:

(Things could be cleaned up more if VBA had better array functions built in, specifically pop and shift...)

Pass in "n" the name to be parsed and "piece," which is an integer 1 thru 5 for:
1: title
2: first name
3: middle name(s)
4: last name
5: suffix


Function Namify(n, piece) as String
    Dim Pieces() As String
    Pieces = Split(n)
    
    Dim Letters() As String
    
    Dim Length As Integer
    Length = UBound(Pieces) + 1
    
    Namify = ""
    If Length < 1 Then Exit Function
    
    If piece = 1 And IsTitle(Pieces(0)) Then
        Namify = Pieces(0)
    ElseIf piece = 5 And IsSuffix(Pieces(Length - 1)) Then
        Namify = Pieces(Length - 1)
    ElseIf Length = 1 Then
        If piece = 2 Then Namify = Pieces(0)
    ElseIf Length = 2 Then
    
        If IsTitle(Pieces(0)) Then
            If piece = 4 Then Namify = Pieces(1)
            Exit Function
        ElseIf IsParticle(Pieces(0)) Then
            If piece = 4 Then Namify = Pieces(0) & " " & Pieces(1)
            Exit Function
        End If
        
        'look for joined abbreviations
        Letters = Split(Pieces(0), ".")
        If UBound(Letters) > 1 Then
        
            If piece = 2 Or piece = 3 Then
                Namify = Letters(piece - 2) & "."
            ElseIf piece = 4 Then
                Namify = Pieces(1)
            End If
            
        'first name
        ElseIf piece = 2 Then
            Namify = Pieces(0)
        ElseIf piece = 4 And Not IsSuffix(Pieces(1)) Then
            Namify = Pieces(1)
        ElseIf piece = 5 And IsSuffix(Pieces(1)) Then
            Namify = Pieces(1)
        End If
        
    ElseIf Length = 3 Then
    
        If IsTitle(Pieces(0)) Then
            
            Namify = Namify(Pieces(1) & " " & Pieces(2), piece)
            
        ElseIf IsSuffix(Pieces(2)) Then
        
            If piece = 5 Then
                Namify = Pieces(2)
            Else
                Namify = Namify(Pieces(0) & " " & Pieces(1), piece)
            End If
            
        ElseIf IsParticle(Pieces(1)) Then
            
            If piece = 2 Then
                Namify = Pieces(0)
            ElseIf piece = 4 Then
                Namify = Pieces(1) & " " & Pieces(2)
            End If
            
        ElseIf piece < 5 And piece > 1 Then
        
            Namify = Pieces(piece - 2)
        
        End If
        
    ElseIf Length = 4 Then
    
        If IsTitle(Pieces(0)) Then
        
            Namify = Namify(Pieces(1) & " " & Pieces(2) & " " & Pieces(3), piece)
        
        ElseIf IsSuffix(Pieces(3)) Then
            
            If piece = 5 Then
                Namify = Pieces(3)
            Else
                Namify = Namify(Pieces(0) & " " & Pieces(1) & " " & Pieces(2), piece)
            End If
            
        Else
        
            If piece = 2 Then
                Namify = Pieces(0)
            ElseIf piece = 3 Then
                If IsParticle(Pieces(2)) Then
                    If Not IsParticle(Pieces(1)) Then
                        Namify = Pieces(1)
                    End If
                ElseIf Not IsParticle(Pieces(1)) Then
                    Namify = Pieces(1) & " " & Pieces(2)
                End If
            ElseIf piece = 4 Then
                If IsParticle(Pieces(1)) Then
                    Namify = Pieces(1) & " " & Pieces(2) & " " & Pieces(3)
                ElseIf IsParticle(Pieces(2)) Then
                    Namify = Pieces(2) & " " & Pieces(3)
                Else
                    Namify = Pieces(3)
                End If
            End If
        
        End If
        
    ElseIf Length = 5 Then
        
        If IsTitle(Pieces(0)) Then
            Namify = Namify(Pieces(1) & " " & Pieces(2) & " " & Pieces(3) & " " & Pieces(4), piece)
        ElseIf IsSuffix(Pieces(4)) Then
            Namify = Namify(Pieces(0) & " " & Pieces(1) & " " & Pieces(2) & " " & Pieces(3), piece)
        Else
            If piece = 2 Then
                Namify = Pieces(0)
            ElseIf piece = 3 Then
                Namify = Pieces(1) & " " & Pieces(2)
                If Not IsParticle(Pieces(3)) Then
                    Namify = Namify & " " & Pieces(3)
                End If
            ElseIf piece = 4 Then
                If IsParticle(Pieces(3)) Then
                    Namify = Pieces(3) & " " & Pieces(4)
                Else
                    Namify = Pieces(4)
                End If
            End If
        End If
    
    ElseIf Length = 6 Then
        
        If IsTitle(Pieces(0)) Then
            Namify = Namify(Pieces(1) & " " & Pieces(2) & " " & Pieces(3) & " " & Pieces(4) & " " & Pieces(5), piece)
        ElseIf IsSuffix(Pieces(5)) Then
            Namify = Namify(Pieces(0) & " " & Pieces(1) & " " & Pieces(2) & " " & Pieces(3) & " " & Pieces(4), piece)
        End If
    End If
    
    ' clean up hanging commas
    If Right(Namify, 1) = "," Then
        Namify = Mid(Namify, 1, Len(Namify) - 1)
    End If
    
End Function

Function IsTitle(t As String) As Boolean
    Dim Titles As Variant
    Titles = Array("Mr", "Mr.", "Ms", "Ms.", "Mrs", "Mrs.", "Dr", "Dr.", "Sir", "Miss")
    IsTitle = (UBound(Filter(Titles, t)) > -1)
End Function

Function IsSuffix(s As String) As Boolean
    Dim Suffixes As Variant
    Suffixes = Array("II", "III", "IV", "V", "Jr", "Jr.", "Sr", "Sr.", "PhD", "Ph.D", "MD", "M.D.", "PE", "P.E.", "Ctech", "P.Eng.")
    IsSuffix = (UBound(Filter(Suffixes, s)) > -1)
End Function

Function IsParticle(p As String) As Boolean
    Dim Particles As Variant
    Particles = Array("de", "De", "le", "Le", "la", "La", "du", "Du", "von", "Von", "van", "Van", "O")
    IsParticle = (UBound(Filter(Particles, p)) > -1)
End Function

12 April 2013

NCARB Ad Compaign

I was flipping through a copy of Dwell the other day, and I came across this advertisement from NCARB:


NCARB is the National Council of Architectural Registration Boards, which is the organization that forces architects to undergo at least seven different wallet-drains, I mean exams, in order to become an architect. I think it's safe to say this group should have their finger on the pulse of the industry.

And this is why I found the ad disgraceful and a confirmation of why I deviated from the profession (into structural engineering). First statement: "change the WORLD your WAY," a great summary of how many architects see themselves: as self-prophesied global impact changers. Okay, fine, we all know architects are egomaniacs. We kinda love them for that. Let's continue...

"The demanding academic schedule. The years of internship. The rigorous exam. All to earn a license and call yourself an architect. No one said it would be easy. If you're going to change the world, would you want it any other way?"

So if I knew little about the profession, I would surmise that architects are most proud of 1. Having a really laborious education, 2. Having a really long internship, 3. Taking a hard exam, and the best one, 4. Simply being able to call yourself an "architect."

I'm sure NCARB had good intentions for this kind of campaign, but I think their aiming is quite off. Architects are proud of being expert collaborators, cutting-edge technical experts, deep carers for both the built and natural environments, and creators of buildings that -- yes -- change the world around you. But most of my (licensed) architect friends could pretty much care less what people call them.

Just for a counter-example, I find this short article, despite it being a sponsored advertisement, a far better motivator for one to consider becoming an architect:
http://www.archdaily.com/358419/clients-want-to-know-how-to-get-your-dream-home/

Here's more on the NCARB campaign:
http://www.ncarb.org/becoming-an-architect/change-the-world

My soon-to-be-wife, an architect, got a raise after becoming licensed. How much? 2.5%. While she loved the company, she also has the mathematical skills to figure that that raise would take her years to pay back the cost of the exams. To be fair, you need a license to make it into any top-tier position at a firm. Period. So it has that value -- heaven forbid that be part of an ad campaign. But no, we're left advertising to the world that we aspire to simply being able to call ourselves "architects." Comon, NCARB, do better.