Archive for January, 2009

Regex to match all uri’s (http, ftp, mailto)

Very usefull regex for finding and replacing all uri’s in a document… ((mailto\\:|(news|(ht|f)tp(s?))\\://){1}\\S+)

More »

CakePHP not showing new tables when using cake bake

When newly created tables don’t show up when using the console application cake bake then it’s time to clean out the model cache. The model cache is located in /app/tmp/cache/models/

More »

PHP frameworks compared

For my latest project, using PHP/MySQL, I wanted to use a framework to take some of the repetitive from me. I’ve looked at a number of frameworks, and here are some of my findings.

More »

DokuWiki, a worthy tiddlywiki alternative?

I’ve been playing with tiddlywiki a bit lately, and I haven’t been very impressed with it. I’ve been looking at some alternatives, because I do like the wiki way of creating and editing pages very much. And I found DokuWiki to be a very nice wiki. It’s light-weight It doesn’t require a database (pages are [...]

More »

CSS hacks

-property Prepending a property with a non-alphanumeric character like – (or underscore) will cause most browser to ignore that line. Internet Explorer 6 and earlier however do apply the rule. *property The previous issue was fixed in Internet Explorer 7, but properties with an asterix(*) immediatly before its name are applied in IE 7. Examples: [...]

More »

Simple JavaScript execution timer

/** * Simple JavaScript execution timer * http://programming.torensma.net * * Example: * scriptTimer.startTimer(); * alert(‘Hello world!’); * scriptTimer.stopTimer(); * alert(scriptTimer.scriptRunTime); */ var scriptTimer = {     scriptRunTime : 0,     startTime : 0,     stopTime : 0,     startTimer : function(){         time = new Date();     [...]

More »

Extracting a substring from a TEXT field in MySQL

The following SQL snippet extracts the text between <H3> and </H3> in the raw column: SELECT mid(LEFT(raw, locate(”, raw)-1), locate(’<h3>’, raw)+4) FROM table</h3>

More »

Connect PowerShell to MySQL

Using the MySQL.NET connector, it’s possible to connect to a MySQL database using PowerShell. /* replace path with your local /path/to/mysql/connector/MySQL.Data.dll */ [void][system.reflection.Assembly]::LoadFrom(\"d:\\tools\\mysql-connector\\bin\\MySQL.Data.dll\") $myconnection = New-Object MySql.Data.MySqlClient.MySqlConnection $myconnection.ConnectionString = \"server=localhost;user id=test;password=test;database=test;pooling=false\" $myconnection.Open() $mycommand = New-Object MySql.Data.MySqlClient.MySqlCommand $mycommand.Connection = $myconnection $mycommand.CommandText = "SHOW TABLES" $myreader = $mycommand.ExecuteReader() while($myreader.Read()){ $myreader.GetString(0) } This example will display all tables [...]

More »