Validate ACH Routing Numbers for EFT and Electronic Checks

I was looking for a way to validate the routing numbers for an eCommerce system I am working on and found a nice VB sample here.

I converted the logic to C# and optimized it for better performance and use.

Hopefully some others out there will find use:

   ///
    /// Validates the routing number.
    ///
    private bool ValidateRoutingNumber(int routingNumber)
    {
        //The check equation for a number a1a2a3a4a5a6a7a8a9 is 3a1 + 7a2 + a3 + 3a4 + 7a5 + a6 + 3a7 + 7 a8 + a9 mod 10 = 0

        //rewrote for higher efficiency

        //must be 9 digits
        if(routingNumber < 100000000)
           return false;
       if(routingNumber > 999999999)
            return false;
        //build array for quick comparison
        //left to right using fun with math.

        int[] routingNumberAsArray =
        {
           routingNumber / 100000000,
            (routingNumber % 100000000) / 10000000,
            (routingNumber % 10000000) / 1000000,
            (routingNumber % 1000000) / 100000,
            (routingNumber % 100000) / 10000,
            (routingNumber % 10000) / 1000,
            (routingNumber % 1000) / 100,
            (routingNumber % 100) / 10,
            (routingNumber % 10) / 1
        };

        //calculate the route sum using the formula above. 3 7 1.
        int routeSum =
            3 * routingNumberAsArray[0] +
            7 * routingNumberAsArray[1] +
            routingNumberAsArray[2] +
            3 * routingNumberAsArray[3] +
            7 *+routingNumberAsArray[4] +
            routingNumberAsArray[5] +
            3* routingNumberAsArray [6] +
            7 * routingNumberAsArray [7] +
            routingNumberAsArray [8] ;
        return routeSum % 10 ==0;
    }

Intellisense – Crap Option, found the darn fix

So, the Intellisense option that was driving me nuts has a resolution. I was looking at my toolbar and I saw a strange icon glowing. I hovered over it and what did I see? “Toggle between suggestion and standard completion mode”.

What a completely useless and crappy feature. It has been driving me absolutely nuts for days. Expletives flying, etc.

Anyway, I must have turned it on looking for a key command. CTRL + ALT + SPACE activates, in case you want to turn something on that makes you want to stab yourself in the eye. Go ahead, makes for an interesting day. Reminiscent of the old IDE days where you basically had notepad to code in, but much worse.

Crap feature that is, well, crap.

Happy Coding!

Visual Studio 2010 – Intellisense nonsense

I started getting really annoyed with the Intellisense in VS 2010. It doesn’t automatically highlight the best match for what I am typing. It seems to loosely highlight it, but hitting enter or . doesn’t act upon it.

Well, I figured out how to make it work, but requires a small change in workflow. Hit TAB. Start typing, and when the box highlights AROUND, because it doesn’t seem to select it, hit the TAB key.

Easy solution to an annoying feature. I switch between 2008 and 2010 so much I can’t remember if 2010 has always been this way, or I pissed it off.

Annoying Intellisense irritating me

Happy Coding!