Tags: dot net

Currency Field Validator for Sitecore CMS

This StandardValidator extension will determine whether or not a given field value passes for currency. In order to do so, it must meet the following requirements:

  1. It must pass decimal.TryParse()
  2. It must not have more than 2 digits past the decimal point

Obviously, this does not fit all international systems—however, in my case, it works for my project (which does not require localization). The code could easily be customized to accommodate additional formats. Read More →

bulkRename v1.1

A while back (in 2008), I wrote a simple system utility with VB.NET which leverages the power of regular expressions to rename files in bulk according to a pattern. I’ve had to use it several times recently after placing it on a metaphorical shelf to gather dust, and it got me thinking: Maybe other people can benefit from this utility. That’s what software is supposed to be all about, right? Read More →

Replacing MS Word’s quotation marks in VB.NET

When dealing with text pasted from Microsoft Word, the presence of “special” (read: non-ASCII) quotation marks and apostrophes can be quite troublesome. Here’s a simple way to convert them to “standard” (read: ASCII) quotation marks and apostrophes…

VB.NET Code:

myString = Regex.Replace(myString, "\u201C|\u201D", """")
myString = Regex.Replace(myString, "\u2018|\u2019", "'")

Obviously, this doesn’t handle all of Word’s annoying special characters; but it should get you off on the right foot.

Files as Resources in .NET projects

Have you ever found that sleek application you wrote slowly becoming scattered over time with the use of external files? Say you want to create a simple GUI application that can be distributed as just an executable file. What if you want to use a *.chm help file? This article will show how to embed that file in your executable via the .NET concept of Resources. Read More →

LDAP authentication with VB.NET

LDAP, or Lightweight Directory Access Protocol, is a convenient, central repository for a system’s personnel information. LDAP (and other Active Directory services) are widely-used by organizations big and small to consolidate user credentials and identification data. For instance: a reporting services application, a webmail client, and a database administration suite can all read from the same Directory, with no need for replicating user information. John Doe only has to remember one password for all systems. When he changes it, those changes cascade across the board. Read More →