Monday, December 29, 2008

Scheduling Jobs in SQL Server Express - SQLTeam.com

Scheduling Jobs in SQL Server Express - SQLTeam.com
As we all know SQL Server 2005 Express is a very powerful free edition of SQL Server 2005. However it does not contain SQL Server Agent service. Because of this scheduling jobs is not possible. So if we want to do this we have to install a free or commercial 3rd party product. This usually isn't allowed due to the security policies of many hosting companies and thus presents a problem. Maybe we want to schedule daily backups, database reindexing, statistics updating, etc. This is why I wanted to have a solution based only on SQL Server 2005 Express and not dependent on the hosting company. And of course there is one based on our old friend the Service Broker.

Friday, December 26, 2008

CodeProject: GD library wrapper

CodeProject: GD library wrapper
GD library wrapper (for ASP developers with PHP vs ASP examples).
Download source - 998 Kb



Response.ContentType = "image/png";
var gdImage = Server.CreateObject("GDLibrary.gdImage");
gdImage.Create(230, 20);
gdImage.ColorAllocate(0, 10, 10);
var TextColor = gdImage.ColorAllocate(233, 114, 191);
gdImage.Chars(gdImage.FontGetLarge(), 5, 5,
"My first Program with GD", TextColor);
Response.BinaryWrite(gdImage.ToPngStream().Read);


CodeProject: Implement Phonetic ("Sounds-like") Name Searches with Double Metaphone

CodeProject: Implement Phonetic ("Sounds-like") Name Searches with Double Metaphone
Presents a C# implementation of Double Metaphone, for use with any of the .NET languages.

Double Metaphone Part I: Introduction & C++ Implementation
Double Metaphone Part II: Visual Basic and Relational Database Solutions
Double Metaphone Part III: VBScript and ASP & Database Solutions
Double Metaphone Part IV: SQL Server and Advanced Database Topics
Double Metaphone Part V: .NET Implementation
Double Metaphone Part VI: Other Methods & Additional Resources

Double Metaphone Algorithmus in TSQL

Double Metaphone Sounds Great (SQL Magazine)
Convert the C++ Double Metaphone algorithm to T-SQL

26094.zip

Longest common substring - Code Snippets - Wikibooks

Longest common substring - Code Snippets - Wikibooks


Public Function LongestCommonSubstring(ByVal s1 As String, ByVal s2 As String) As Integer
Dim num(s1.Length - 1, s2.Length - 1) As Integer '2D array
Dim letter1 As Char = Nothing
Dim letter2 As Char = Nothing
Dim len As Integer = 0
Dim ans As Integer = 0
For i As Integer = 0 To s1.Length - 1
For j As Integer = 0 To s2.Length - 1
letter1 = s1.Chars(i)
letter2 = s2.Chars(j)
If Not letter1.Equals(letter2) Then
num(i, j) = 0
Else
If i.Equals(0) Or j.Equals(0) Then
num(i, j) = 1
Else
num(i, j) = 1 + num(i - 1, j - 1)
End If
If num(i, j) > len Then
len = num(i, j)
ans = num(i, j)
End If
End If
Next j
Next i
Return ans
End Function

Levenshtein distance - Code Snippets - Wikibooks

Levenshtein distance - Code Snippets - Wikibooks

VBA (with Damerau extension)
This VBA version uses recursion and a maximum allowed distance. The analysis to identify quasi-duplicated strings or spelling mistakes can be narrowed down to a corridor in the result matrix. The Damerau extension has also been added to the Levenshtein algorithm.


Function damerau_levenshtein(s1 As String, s2 As String, Optional limit As Variant, Optional result As Variant) As Integer
'This function returns the Levenshtein distance capped by the limit parameter.
'Usage : e.g. damerau_levenshtein("Thibault","Gorisse") to get the exact distance
' or damerau_levenshtein("correctly written words","corectly writen words",4) to identify similar spellings

Dim diagonal As Integer
Dim horizontal As Integer
Dim vertical As Integer
Dim swap As Integer
Dim final As Integer

'set a maximum limit if not set
If IsMissing(limit) Then
limit = Len(s1) + Len(s2)
End If

'create the result matrix to store intermediary results
If IsMissing(result) Then
Dim i, j As Integer ' pointeur
ReDim result(Len(s1), Len(s2)) As Integer
End If

'Start of the strings analysis
If result(Len(s1), Len(s2)) <>= limit Then
final = limit
Else
If Len(s1) = 0 Or Len(s2) = 0 Then
'End of recursivity
final = Len(s1) + Len(s2)
Else

'Core of levenshtein algorithm
If Mid(s1, 1, 1) = Mid(s2, 1, 1) Then
final = damerau_levenshtein(Mid(s1, 2), Mid(s2, 2), limit, result)
Else

If Mid(s1, 1, 1) = Mid(s2, 2, 1) And Mid(s1, 2, 1) = Mid(s2, 1, 1) Then
'Damerau extension counting swapped letters
swap = damerau_levenshtein(Mid(s1, 3), Mid(s2, 3), limit - 1, result)
final = 1 + swap
Else
'The function minimum is implemented via the limit parameter.
'The diagonal search usually reaches the limit the quickest.
diagonal = damerau_levenshtein(Mid(s1, 2), Mid(s2, 2), limit - 1, result)
horizontal = damerau_levenshtein(Mid(s1, 2), s2, diagonal, result)
vertical = damerau_levenshtein(s1, Mid(s2, 2), horizontal, result)
final = 1 + vertical
End If
End If

End If
End If
Else
'retrieve intermediate result
final = result(Len(s1), Len(s2)) - 1
End If

'returns the distance capped by the limit
If final < limit Then
damerau_levenshtein = final
'store intermediate result
result(Len(s1), Len(s2)) = final + 1
Else
damerau_levenshtein = limit
End If

End Function

Monday, December 22, 2008

Google’s Top 10 Hidden Treasures | MakeUseOf.com

Google’s Top 10 Hidden Treasures MakeUseOf.com

about:internets
about:stats
about:memory
about:network
about:histograms
about:dns
about:cache
about:plugins
about:version

Wednesday, December 17, 2008

PGP / GnuPG/ Open PGP Message Encryption in JavaScript

PGP / GnuPG/ Open PGP Message Encryption in JavaScript

JavaScript RC4 Encryption

RC4 Encryption in JavaScript : RC4 Encryption

JavaScript SHA256 (jssha256)

jssha256: SHA256 in JavaScript

JavaScript AES

jsaes: AES in JavaScript

JavaScript AES

JavaScript AES Advanced Encryption Standard in Counter Mode

JavaScript SHA-1

JavaScript SHA-1 Cryptographic Hash Algorithm

JavaScript TEA (Tiny Encryption Algorithm)

JavaScript - Block TEA Tiny Encryption Algorithm

DHTML routines and functions

DHTML snippets from webtoolkit.info

AJAX file upload
How to upload files using AJAX, without reloading the page? Read about the cross browser method to upload files using AJAX in only 1Kb of code.
Read more...

Scrollable HTML table
Scrollable HTML table JavaScript code can be used to convert tables in ordinary HTML into scrollable ones. No additional coding is necessary.
Read more...

Javascript context menu
Javascript context menu is very lightweight, OOP based and item-specific. You can attach this context menu to multiple containers. Read more...

Sortable HTML table
Sortable HTML table JavaScript code can be used to convert tables in ordinary HTML into sortable ones. This script is unobtrusive. No additional coding is necessary.
Read more...

Javascript drag and drop
Javascript drag and drop will enable you to drag elements on your page. You can attach this drag and drop handler to any relative or absolute positioned element.
Read more...

Javascript custom cursor
Cross hair mouse cursor. Learn ho to add a fancy custom cursor to your website using Javascript.
Read more...

Javascript pie menu
Javascript pie menu allows you to build an configurable context pie menu.
Read more...

Unselectable text
A method to have unselectable text in a browser. Script makes text in an HTML page unselectable by visitors.
Read more...

  

Javascript routines and functions

Javascript routines and functions from webtoolkit.info

Javascript trim
Javascript trim is a string function. It will trim all leading and trailing occurrences of whitespace characters.
Read more...

Javascript string replace
Javascript string replace is a very useful function. Javascript has a built-in string replace function but it uses regular expressions.
Read more...

Javascript sprintf
Javascript sprintf implementation. This Javascript function returns a string formatted by the usual printf/sprintf conventions. Read more...

Javascript url decode, encode
You can use this Javascript to encode / decode url parameters. Script is fully compatible with UTF-8 encoding. Read more...

Javascript MD5
This Javascript is used to calculate MD5 hash of a string. MD5 is a widely-used cryptographic hash function with a 128-bit hash value.
Read more...

Javascript SHA-1
This Javascript is used to calculate SHA-1 hash of a string. The Secure Hash Algorithm is one of the many cryptographic hash functions. Read more...

Javascript SHA-256
SHA-256 Javascript implementation is used to process variable length message into a fixed-length output using the SHA256 algorithm.
Read more...

Javascript CRC32
CRC32 function generates the cyclic redundancy checksum polynomial of 32-bit lengths of the string.
Read more...

Javascript base64 encoding
This base64 Javascript is used to encode / decode data using base64 encoding. This Javascript is fully compatible with UTF-8 encoding. Read more...

Javascript UTF-8
Use this Javascript to encode decode UTF-8 data. UTF-8 is a variable-length character encoding for Unicode.
Read more...

Javascript pad
Pad is a string manipulation function. Javascript pad implementation pads a string to a certain length with another string.
Read more...

Javascript cookies
Javascript cookies object with methods to save, read and erase them. Using these methods you can manipulate cookies on your site.
Read more...

Javascript UTF-8

Javascript UTF-8

Javascript base64 encoding

Javascript base64 encoding

Javascript CRC32

Javascript CRC32

Javascript MD5

Javascript MD5

Javascript url decode, encode

Javascript url decode, encode

Javascript sprintf

Javascript sprintf

Javascript trim

Javascript trim