One of Taka's clients needed some fairly specialized software but didn't have the budget for a complete system from scratch. After a little bit of research, Taka found some software sold by a third party that would get them 95% of the way done. Better still, the vendor had an "open source" option to that allowed them to add-on and modify the source code for an extra licensing fee.

Now this may come as a complete shock to you, but things didn't quite go as planned. The reason the vendor was so eager to sell it as "open source" was because their software was written entirely in VBScript/ASP. And things just went downhill from there. GUID were used to track certain events and were stored in the database as VARCHARs (as opposed to UNIQUEIDENTIFIER). Not too bad on its own, but their GUID were filled with "Z"s ...

'***       Hexadecimal Generator       ****
Function GenerateHex(Length)

  Dim i, hex

  'Randomize the system timer
  Randomize Timer()

  'Loop to make hex value
  For i = 1 to Length

    'Set Length equal to radom decimal value form 0 to 15
    Length = CInt(Rnd * 1000) Mod 16

    'Convert Int to Hex
    Select Case Length
      Case 1
        hex = "1"
      Case 2
        hex = "2"
      Case 3
        hex = "3"
      Case 4
        hex = "4"
      Case 5
        hex = "5"
      Case 6
        hex = "6"
      Case 7
        hex = "7"
      Case 8
        hex = "8"
      Case 9
        hex = "9"
      Case 10
        hex = "A"
      Case 11
        hex = "B"
      Case 12
        hex = "C"
      Case 13
        hex = "D"
      Case 14
        hex = "E"
      Case 15
        hex = "F"
      Case Else
        hex = "Z"
    End Select

    'add hex to the function output
    GenerateHex = GenerateHex & hex
End Function

[Advertisement] BuildMaster allows you to create a self-service release management platform that allows different teams to manage their applications. Explore how!