Stripping non-numeric characters from a string in C#

Posted: May 13th, 2011 | Author: | Tags: , , , | No Comments »

 

string output = Regex.Replace("String 2 Parse 4 Non Numerics", "[^0-9]", string.Empty)

In this case the variable “output” will hold the value “24″


Regular Expression to Strip HTML from String

Posted: July 12th, 2010 | Author: | Tags: , , | No Comments »

I used this in a simple reguar expression to strip html

/<(?:.|\s)*?>/g

An example of using this in a javascript function is as such…

function stripHtml(html)
{
    return html.replace(/<(?:.|\s)*?>/g, "");
}

Javascript options hash

Posted: July 9th, 2010 | Author: | Tags: , | No Comments »
1
2
3
4
5
6
7
8
9
10
11
12
13
14
function sample(options){
    var settings = $.extend({
        option1: null,
	option2: null,
	option3: null,
	option4: null
    },options||{}); //If no options, pass empty object
 
    // using settings within function
    console.log(settings.option1);
};
 
// calling the function
sample({option1: 'some value'});

Executing Bulk MySQL Script from Terminal

Posted: May 15th, 2010 | Author: | Tags: , | No Comments »

Because nothing works better for big fat nasty sql backups.

1
mysql -uusername -ppassword dbname < name-of-data.sql

Resetting UUID on VirtualBox VDIs

Posted: May 12th, 2010 | Author: | Tags: , , | No Comments »
VBoxManage internalcommands sethduuid /Volumes/External/VPC/bases/virtual_machine.vdi

Take that VirtualBox Virtual Hard Disk Manger… with all your not letting me add copies of my base virtual machines.