Turn TextArea Resize off on Google Chrome

Very simple… To turn this off just go:

textarea {resize: none}

Easily Edit Grub files in Ubuntu

sudo apt-get install startupmanager

System > Administration > StartUp-Manager gives you a GUI for editing the Grub configuration

Open gedit or other program on remote computer using ssh in Ubuntu/Linux

Login to server using “ssh -X” … ( not with a made up ip address though :o) )

ssh -X

Open the application on the remote computer. For example

DISPLAY=:0.0 gedit junk.txt


Upgrade to MVC 2 causes Unable to cast object of type ‘System.Web.UI.Triplet’ to type ‘System.Object[]’ relating to AntiForgeryToken

This has something to do with the way that MVC 1 and MVC 2 generate anti forgery tokens. It seems they might do things differently.

The solution is to clear your browser cookies.

James Crowley has a bit of information on it (first link in resources below!)




Getting the ResourceManager from a strongly typed resource file

I had a little bit of difficulty messing around getting the ResourceManager the class generated when making a resource file (resx). I wanted to get the value of something using a string and do it by accessing the ResourceManager property and calling the GetString() method myself. This is what i used to get the resource manager

Note you will need to make the resource file public if referencing as resource file in another assembly.

// Get the ResourceManager on the type
var resourceManager = (ResourceManager)ResourceType.GetProperty(
    System.Reflection.BindingFlags.Public |
System.Reflection.BindingFlags.Static).GetValue(ResourceType, null);

// Get information on the getstring method
return resourceManager.GetString(_resourceKey, CultureInfo.CurrentCulture);

MVC 2 Strongly Typed Helper Method

Some quick information about generating a strongly types helper method in MVC 2: Covers:

  • An Expression as a method argument
  • Getting a valid name for the form field
  • Getting type information about the property specified on the view.

An Expression as a method argument

The Below gives a basic example of a strongly types helper method definition

public static MvcHtmlString MyHelperFor<TModel, TProperty>(
            this HtmlHelper<TModel> htmlHelper,
            Expression<Func<TModel, TProperty>> expression)


Getting a valid name for the form field

Say we put this into the view

<%= Html.EnumDropDownFor(Model => Model.ContactDetails.Phone.Type) %>

We can generate a form field name like this:

var fullPropertyPath =

This would result in fullPropertyPath being “ContactDetails.Phone.Type”. We can then use this as the name attribute on the form field we render.

Getting type information about the property specified on the view.

We can also get meta data about the type that the …Phone.Type property get’s/sets using ModelMetadata class’s FromLambdaExpression method like this:

var modelMetadata = ModelMetadata.FromLambdaExpression<TModel, TProperty>(
    expression, htmlHelper.ViewData);

var propertyType = modelMetadata.ModelType;

Custom Server and Client Side Required Validator in MVC 2 using jQuery.validate

This post has been moved here.