Thursday, April 23, 2009

virtualbox how to adjust the screen size

I had an issue where Virtualbox would start my OS (Win XP in this case) at 800x600 screen resolution. I wanted to increase the size to fill my 22 inch monitor so under the Machine drop down I select "Fullscreen mode", but to my surprise it just centered the 800x600 with a black background to fill the rest of the area for the full screen view. Meh, this is not what I wanted! After much searching I found nothing that anyone had posted to fix the problem. Well stop searching!!!

How to fix:

Login to your VirtBox machine and change the XP display settings, Yep it's just that simple =P

Detailed how to:
1- Start VirtBox
2- Login to XP
3- Right click the desktop
4- Select Properties
5- Select the Settings tab
6- Slide the Screen resolution slider towards the More side
7- Click Apply
8- Click Yes to confirm your settings
9- Click Ok

That's it, enjoy!!!

jQuery CSV validation for user input

I'm using jQuery 1.3.2 with the jQuery Validation plugin 1.5.2 and noticed there was no validation for CSV formatted user input. After looking for a while I did find that I could extend the validation plugin with the additional-methods.js file. It's has some great added validations but still nothing for CSV. So this is to all looking for something for CSV (Comma Separated Values).

Validates for a-z A-Z 0-9

jQuery.validator.addMethod("validcsv", function(value, element) {
return this.optional(element) || /^([a-zA-Z0-9])+(,[a-zA-Z0-9]+)*$/.test(value);
}, "Must be comma separated if entering multiple values: Value1,Value2");


Validates for a-z A-Z

jQuery.validator.addMethod("validcsv", function(value, element) {
return this.optional(element) || /^([a-zA-Z])+(,[a-zA-Z]+)*$/.test(value);
}, "Must be comma separated if entering multiple values: Value1,Value2");


Validates for 0-9

jQuery.validator.addMethod("validcsv", function(value, element) {
return this.optional(element) || /^([0-9])+(,[0-9]+)*$/.test(value);
}, "Must be comma separated if entering multiple values: Value1,Value2");


Alt validation for 0-9

jQuery.validator.addMethod("validcsv", function(value, element) {
return this.optional(element) || /^([\d])+(,[\d]+)*$/.test(value);
}, "Must be comma separated if entering multiple values: Value1,Value2");


Validates for a-z A-Z 0-9 _


jQuery.validator.addMethod("validcsv", function(value, element) {
return this.optional(element) || /^([\w])+(,[\w]+)*$/.test(value);
}, "Must be comma separated if entering multiple values: Value1,Value2");


Now this will validate values for a-z upper and lower case and 0-9 numeric values that are separated by a comma. If you need to modify the Regular Expression to fit your needs please post back with your findings.