Featured Posts

Web Presense Solution I've officially started up my independent web development side-business. I am hoping to bring quite a few small businesses into the present with a simple, cost-effective package that provides them with...

Readmore

MS SQL date / time conversion I often find myself turning to MSDN to get the possible conversion options on MS SQL's date data type, so I finally became un-lazy and created a little script to use in the future to quickly list all possibilities...

Readmore

jQuery Delay Happy Note: I was contacted by the jQuery team and my code is being added to the core functionality; that really made my day!  You will want to remove the current code from your site if you plan on upgrading...

Readmore

ASP Search Stemmer Class The original stemmer class was developed by Martin Porter to bring words back to their word stems. For example "abilities" would stem to "able", "smelling" to "smell", "I'm awesome" to "damn straight",...

Readmore

  • Prev
  • Next

Vista – Windows installer service could not be accessed

Posted on : 06-12-2009 | By : chelfers | In : Computers, Windows Fixes

2

*facepalm*

What a mini nightmare this turned out to be, but after an hour of unsuccessful googled fixes we have a winner! Here is a brief list of what I tried and then the one that worked and made the most sense; sorry I don't have post-backs to where the information came from, and I do not take credit for any of these fixes.

Attempt 1

  • Boot into safemode ( f8 when restarting the computer )
  • Click Start, then click run ( or hit windows key + r ), then type cmd and click ok
  • Type in the following:

    • %windir%/system32/msiexec.exe /unregister
    • %windir%/syswow64/msiexec.exe /unregister
    • %windir%/system32/msiexec /regserver
    • %windir%/system32/msiexec /regserver
  • Reboot and try your install again

Attempt 2 - Little more advanced, please don't screw up your system

  • Click Start, then click run ( or hit windows key + r ), then type regedit and click ok
  • Navigate to [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\MSIServer\Enum]
  • The view pane should look like this:

    "0"="Root\\LEGACY_MSISERVER\\0000"
    "Count"=dword:00000001
    "NextInstance"=dword:00000001
  • If it looks similar right click Enum entry in the left pane tree and select delete
  • Reboot and try your install again

Attempt 3 - Little bit more advanced, be careful!

  • Click Start, then click run ( or hit windows key + r ), then type regedit and click ok
  • Navigate to [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\MSIServer]
  • Look for the key name DisplayName and make sure that the value is set as C:\WINDOWS\SysWOW64\msiexec.exe /V
  • If you change it reboot

Attempt 4 - this worked for me

- Click Start, then click run ( or hit windows key + r ), then type regedit and click ok
- Navigate to [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\MSIServer]
- Look for the key name WOW64, double click it and change the "Value data" to 0
- Reboot

In attempt 4, the WOW64 key value of 1 tells the installer to only deal with 32-bit installers and error on the rest, by changing this to 0 the system is now open to install 64-bit apps ( hopefully ) with less headaches.

Hope this helps someone!

CSS Arrows / Pointer Tutorial

Posted on : 02-12-2009 | By : chelfers | In : CSS, HTML, Web

2

Arrows, pointers, triangles, whatever you wish to call this technique you will end up making a pure CSS arrow; graphics are forbidden!

The process is actually extremely simple, the basic idea is that you you set a nice fat border then remove the side you wish the arrow to point to.

Example Code

.right-arrow {

border: 8px solid white;
border-width: 8px 0 8px 8px;
border-color: white red;
font-size: 0; /* needed for IE browsers, if this isn't set to 0 you will end up with a trapezoid */
line-height: 0;

}

<div class="right-arrow"></div>

Output

So that works fairly nice, but we want to actually do something useful with the arrow like pointing to a link; using a div just complicates the job as we now have to deal with floating. If we change the first example's tag from div to span and remove the font-size property, or set a width to it you will notice we get a trapezoid shape. Let's try and get this fix0red!

Example Code

.right-arrow {

border: 8px solid white;
border-width: 8px 0 8px 8px;
border-color: white red;
font-size: 0; /* needed for IE browsers, if this isn't set to 0 you will end up with a trapezoid */
line-height: 0;
display: inline-block;

}

<span class="right-arrow"></span> <a href="http://twitter.com/blindsignals">follow me on twitter</a>!

Output

follow me on twitter!

The possibilities are fairly large with this technique and it almost certainly shuts out any previous requirement of an image to get the same functionality. With positioning properties we can move our arrow anywhere within a block element to make beautiful pointers on menu items, we can make pointing list items, link pointers, and even faux element wrapping!

Go and make peace with your GIFs and PNGs, they are going to hate you after this.

MS SQL date / time conversion

Posted on : 25-09-2009 | By : chelfers | In : SQL, Web

0

I often find myself turning to MSDN to get the possible conversion options on MS SQL's date data type, so I finally became un-lazy and created a little script to use in the future to quickly list all possibilities with nice example data and name references.

SELECT
CONVERT( varchar, getdate(), 100 ) AS '100 default',
CONVERT( varchar, getdate(), 101 ) AS '101 USA',
CONVERT( varchar, getdate(), 102 ) AS '102 ANSI',
CONVERT( varchar, getdate(), 103 ) AS '103 British/French',
CONVERT( varchar, getdate(), 104 ) AS '104 German',
CONVERT( varchar, getdate(), 105 ) AS '105 Italian',
CONVERT( varchar, getdate(), 106 ) AS '106',
CONVERT( varchar, getdate(), 107 ) AS '107',
CONVERT( varchar, getdate(), 108 ) AS '108',
CONVERT( varchar, getdate(), 109 ) AS '109 default with ms',
CONVERT( varchar, getdate(), 110 ) AS '110 USA',
CONVERT( varchar, getdate(), 111 ) AS '111 Japanese',
CONVERT( varchar, getdate(), 112 ) AS '112 ISO',
CONVERT( varchar, getdate(), 113 ) AS '113 Europe default with ms',
CONVERT( varchar, getdate(), 114 ) AS '114',
CONVERT( varchar, getdate(), 120 ) AS '120 ODBC canonical',
CONVERT( varchar, getdate(), 121 ) AS '121 ODBC canonical (with ms)',
CONVERT( varchar, getdate(), 126 ) AS '126 ISO8601',
CONVERT( varchar, getdate(), 130 ) AS '130 Hijri',
CONVERT( varchar, getdate(), 131 ) AS '131 Hijri'

Pretty dang simple if you ask me; once you find the format you want take a look at the column name and reference it back to the code.

Enjoy!

ASP Search Stemmer Class

Posted on : 02-08-2009 | By : chelfers | In : ASP, Web

0

The original stemmer class was developed by Martin Porter to bring words back to their word stems. For example "abilities" would stem to "able", "smelling" to "smell", "I'm awesome" to "damn straight", etc.

I couldn't find a Classic ASP version of this so I ported a port ( I'm not even sure if that's legal! ).

example usage

set Search = new Stemmer      tmp_string = Search.Stem( "abilities" )      response.write tmp_string set Search = nothing

This should produce an echo of "able". Below is a dictionary list of words you can test the class out with, let me know if you find any bugs or issues.

Download ASP Stemmer 1.0.0
Download Dictionary File

How to check for legit credit card numbers

Posted on : 30-07-2009 | By : chelfers | In : ASP, Web

0

I think the title says it all; I've seen many implementations for checking credit card numbers and in my opinion there is really only one that you need and actually works.

Sadly, still in use today by many code examples that I've run across is the good old

if ( first_digit = 4 ) then "visa" elseif ( first_digit = 5 ) then "mastercard" elseif ( first_digit = 3 ) then "amex" elseif ( first_digit = 6 ) then "discover" else "invalid card" end if

/facepalm

This isn't entirely bad ( yes it is, I'm just trying to be nice ), most likely those first digits will always be associated with the cards mentioned above, the problem is the numbers that follow.

"But I found one that checks and second and third numbers!"

Awesome, one tiny step closer to almost not really getting anywhere!

Obviously I'm leading up to the one and only Luhn algorithm which is basically a simple checksum formula used to validate a few different sequences of numbers, for example credit card account numbers.

Straight from Wikipedia here is what is going on with the algorithm

The formula verifies a number against its included check digit, which is usually appended to a partial account number to generate the full account number. This account number must pass the following test:

1. Counting from the check digit, which is the rightmost, and moving left, double the value of every second digit.
2. Sum the digits of the products together with the undoubled digits from the original number.
3. If the total ends in 0 (put another way, if the total modulo 10 is congruent to 0), then the number is valid according to the Luhn formula; else it is not valid.

As an illustration, if the account number is 49927398716, it will be validated as follows:

1. Double every second digit, from the rightmost: (1×2) = 2, (8×2) = 16, (3×2) = 6, (2×2) = 4, (9×2) = 18
2. Sum all the individual digits (digits in parentheses are the products from Step 1): 6 + (2) + 7 + (1+6) + 9 + (6) + 7 + (4) + 9 + (1+8) + 4 = 70
3. Take the sum modulo 10: 70 mod 10 = 0; the account number is valid.

Below is an ASP version I've ported, enjoy.

ACCOUNT = "4500000000000001" alt = false sum = 0     for i = len( ACCOUNT ) to 1 step - 1             digit = mid( ACCOUNT, i, 1 )                     if ( alt = true ) then                 digit = digit * 2                     if ( digit > 9 ) then digit = digit - 9 end if             end if         sum = ( sum + digit ) mod 10                                                 if ( alt = true ) then alt = false else alt = true     next if ( sum = 0 ) then   'legit else   'did not pass the test end if