Adding wix support for VS.NET

 the .xsd files in the wix\doc directory to C:\Program Files\Microsoft Visual Studio 8\Xml\Schemas directory.<div style="clear: both; padding-bottom: 0.25em;"></div>

Validate if checkbox is checked using really easy validation

/ Needs Really easy validation.js script & prototype.js /

function validateIfChecked(v, e) {
var cbId = e.getAttribute(‘usecheckbox’);
if (cbId != ‘undefined’) {
if ($(cbId).checked) {
var validationType = getValidationType(e);
return !Validation.get(‘IsEmpty’).test(v) && Validation.get(validationType).test(v)
}
else {
$(e).value = ‘’;
return true;
}
}
return true;
}

function getValidationType(e) {
var classes = e.className.split(‘ ’);
for (i = 0; i < classes.length; i++) {
if (classes[i].indexOf(‘validate-checkbox-’ >= 0))
return classes[i].replace(‘validate-checkbox-’, ‘’);
}
return ‘validate-number’; // default;
}

Validation.add(‘validate-checkbox-required’, ‘Please provide a valid value when checked’, validateIfChecked);
Validation.add(‘validate-checkbox-validate-number’, ‘Please provide a valid value when checked’, validateIfChecked);
Validation.add(‘validate-checkbox-validate-digits’, ‘Please provide a valid value when checked’, validateIfChecked);
Validation.add(‘validate-checkbox-validate-alpha’, ‘Please provide a valid value when checked’, validateIfChecked);
Validation.add(‘validate-checkbox-validate-alphanum’, ‘Please provide a valid value when checked’, validateIfChecked);
Validation.add(‘validate-checkbox-validate-date’, ‘Please provide a valid value when checked’, validateIfChecked);
Validation.add(‘validate-checkbox-validate-email’, ‘Please provide a valid value when checked’, validateIfChecked);
Validation.add(‘validate-checkbox-validate-url’, ‘Please provide a valid value when checked’, validateIfChecked);
Validation.add(‘validate-checkbox-validate-currency-dollar’, ‘Please provide a valid value when checked’, validateIfChecked);

Realy Easy Validation


Nhibernate Generics Lazy Loaded Collections

Child objects not saved when added to a lazy loaded collection that is not initialized. See this post for more info.


JavaScript Prototype notes

Prototype adds to the array class, amoung other things, which can break other javascript files, like fValidate.

prototypify – running prototype code with legacy code – provides a work around and more explaination.

really easy field validation with prototype – is a validation script based on prototype.


Ajax javascript issues.

Javascript functions injected into the DOM using innerHTML will not work. So using something like:
<br />mydiv.innerHTML = [html result from ajax method call];<br />&hellip;<br /><div id=&ldquo;mydiv&rdquo;><br /></div><br />
make sure the [html result from ajax method call] doesn’t contain javascript, other then events (onclick, onblur, etc.).


Powershell Text Replace

Search a text file line by line, replacing text using regex’s.
<br />cat &lsquo;file.txt&rsquo; | foreach { $_ -replace &lsquo;find-text&rsquo;, &lsquo;replace-text&rsquo; }<br />


Ngen the powershell dll’s for faster startup

In the Trenches » Some PowerShell scripts…: “Ngen the dlls and try it again. I think you’ll find it faster.

cd $pshome
dir *.dll | %{ ngen.exe $_.fullname}

If ngen is not in your path, use:
C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\ngen.exe

Jeffrey Snover
Windows PowerShell Architect”


Brutalist Framework