Wednesday, 15 December 2010
The DELETE statement conflicted with the REFERENCE constraint "FK_cmsPropertyData_cmsPropertyType" - Umbraco
Friday, 10 December 2010
Reseeding Umbraco
Saturday, 13 November 2010
Wednesday, 11 August 2010
Print this!
Thursday, 1 July 2010
Formsy
Over the last few months I have been working on an open source forms engine I call Formsy.
"Formsy is an XML driven forms engine built with ASP.Net 3.5. Formsy is super easy to use, is completely extensible and generates clean markup for easy styling."
Today I finally launched it on Codeplex.
Formsy came about after my experiences with Umbraco Contour. I had to do some crazy code to get Contour to do things it was really not meant for. It was a real nightmare. Getting Contour to regionalize form labels, validation messages, and validation regular expressions was the least crazy thing we needed to do.
After the Contour experience I realized that I needed some practice with composite controls. So I started to make a little forms engine. Before long, I had all the extra functionality that we required in Contour (eg. custom data storage, custom emails to name just two). At that point I realized that Formsy might be useful to other people. So I set out to add even more functionality.
So here I am 3 days away from my flight overseas launching my Codess-Opess.
I think it's pretty rad.
Saturday, 27 March 2010
Regionalizing validation messages, and regex in Umbraco Contour
public class RenderForm : Umbraco.Forms.UI.Usercontrols.RenderForm
{
protected override void OnPreRender(EventArgs e)
{
base.OnPreRender(e);
// get the form fields
FormStorage fs = new FormStorage();
var form = fs.GetForm(new Guid(this.FormGuid));
var fields = form.AllFields;
foreach (var f in fields)
{
// get this field's validator
var fieldId = f.Id.ToString();
var vals = Page.Validators
.Cast()
.Where(x => x.ControlToValidate == fieldId).ToList();
if (vals.Count > 0)
{
foreach (var baseVal in vals)
{
// get the validator type and assign properties
BaseValidator val = baseVal as RegularExpressionValidator;
if (val != null) // it is RegularExpressionValidator
{
// get regionalized regular expression
string valExpression = GetRegionalizedValidationText(f.Caption, "_regex");
((RegularExpressionValidator)val).ValidationExpression = !string.IsNullOrEmpty(valExpression) ? valExpression : ((RegularExpressionValidator)val).ValidationExpression;
}
else // either a RequiredFieldValidator or another type which you must handle here!
{
// cast to another Validator type you are expecting, then set it's properties
}
// Get the error message
val = baseVal as BaseValidator;
if (val != null)
{
// get regionalized error message
string errorMessage = GetRegionalizedValidationText(f.Caption, "_vmsg");
val.ErrorMessage = !string.IsNullOrEmpty(errorMessage) ? errorMessage : val.ErrorMessage;
}
val.ValidationGroup = form.Name;
}
}
}
}
// Uses's the given string and suffix to get a value from the Umbraco dictionary.
public string GetRegionalizedValidationText(string key, string type)
{
if (key.Contains("#"))
{
string itemName = key.Split('#')[1] + type;
if (umbraco.library.GetDictionaryItem(itemName) != null) // note: item can exist and be ""
return umbraco.library.GetDictionaryItem(itemName);
}
return ""; // key does not contain #, or not found in dictionary
}
}
Monday, 1 March 2010
Flv mime type in IIS
Sunday, 28 February 2010
The page cannot be found on Windows Server in a .Net MVC site
Did you forget your wildcard mapping?
Wednesday, 10 February 2010
Publishing PDF's from Visual Studio 2008
Here's how to fix it.
In the Solution Explorer, right-click the file and select Properties.
In the Properties window change Build Action to "Content"
Change Copy to Output Directory to "Copy always".
Done!
*Hint you can select multiple files but you cannot select a folder.
Wednesday, 3 February 2010
Freeing up space on Windows Server
Then I noticed a system file c:\hiberfil.sys which was 3GB.
Well it turns out that Windows Server 2008 still allocates space for a hibernate file. Who would want to hibernate their Live server?
Anyway, this is how to gain an exta 3GB...
C:\Users\Administrator>powercfg.exe /hibernate off
That's it!