Monday, October 17, 2016

Regular Expressions

To match a string that contains only those characters (or an empty string), try
"^[a-zA-Z0-9_]*$"
This works for .NET regular expressions, and probably a lot of other languages as well.
Breaking it down:
^ : start of string
[ : beginning of character group
a-z : any lowercase letter
A-Z : any uppercase letter
0-9 : any digit
_ : underscore
] : end of character group
* : zero or more of the given characters
$ : end of string
If you don't want to allow empty strings, use + instead of *.
EDIT As others have pointed out, some regex languages have a shorthand form for [a-zA-Z0-9_]. In the .NET regex language, you can turn on ECMAScript behavior and use \w as a shorthand (yielding ^\w*$ or ^\w+$). Note that in other languages, and by default in .NET, \w is somewhat broader, and will match other sorts of unicode characters as well (thanks to Jan for pointing this out). So if you're really intending to match only those characters, using the explicit (longer) form is probably best.

http://www.analyticsmarket.com/freetools/regex-tester 

Thursday, October 13, 2016

Page size calculation formula

Commit charge:
1. Run Performance Monitor (Perfmon)
2. Go to Data Collector Sets\User Defined
3. Right click on User Defined and select New
4. Select Create Manually and next
4. Check Performance counter
5. Add the following counters:
            Memory\Committed Bytes – Committed Bytes is the amount of committed virtual memory, in bytes.
            Memory\Committed Limit – Amount of virtual memory that can be committed without having to extend the paging file
            Memory\% Committed Bytes In Use – Ratio of Memory\Committed Bytes to the Memory\Commit Limit

Make sure you collect the information over a long period (one week at least), and the server is running at peak usage.

The page file size formula should be:

(Max value of Committed Bytes + additional 20% buffer to accommodate any workload bursts)-RAM size


For example: If the server has 24 GB RAM and the maximum of Committed Bytes is 26 GB, then the recommended page file will be: (26*1.2)-24)  = 7.2 GB