Category Archives: Snippets

.htaccess redirect to a new domain

I post this little snippet because isn’t easy for me to found it. Here is. [plain]RewriteEngine on RewriteCond %{HTTP_HOST} ^([^.:]+\.)*oldwebsite\.com\.?(:[0-9]*)?$ [NC] RewriteRule ^(.*)$ http://www.preferredwebsite.net/$1 [R=301,L][/plain] Thanks Wikipedia!

Posted in Snippets | Tagged , , | Leave a comment

Flash CS4 Crashes on Windows

UPDATE: I had the same problem in Windows XP, apparently it’s a problem in some updated library. I installed the new Windows 7 and I found problems when publish to SWF (the Flash closes). The solution, install the last update.

Posted in Snippets | Tagged , , | Leave a comment

MySQL Date time Regex

This regex validates only MySQL Datetime format. [js]^[0-9]{4}-(((0[13578]|(10|12))-(0[1-9]|[1-2][0-9]|3[0-1]))|(02-(0[1-9]|[1-2][0-9]))|((0[469]|11)-(0[1-9]|[1-2][0-9]|30)))(T|\s)(([0-1][0-9])|(2[0-3])):([0-5][0-9]):([0-5][0-9])$[/js] Matches 2009-01-01 23:59:59; 2009-03-31 14:59:59; 0000-01-01 00:00:00 Don’t matches 2009/03/31 24:30:00; 2009-30-01 10:30:00AM; 0000-00-00 00:00:00 With time as optional [js]([0-9]{4}-(((0[13578]|(10|12))-(0[1-9]|[1-2][0-9]|3[0-1]))|(02-(0[1-9]|[1-2][0-9]))|((0[469]|11)-(0[1-9]|[1-2][0-9]|30)))(T|\s)(([0-1][0-9])|(2[0-3])):([0-5][0-9]):([0-5][0-9]))|[0-9]{4}-(((0[13578]|(10|12))-(0[1-9]|[1-2][0-9]|3[0-1]))|(02-(0[1-9]|[1-2][0-9]))|((0[469]|11)-(0[1-9]|[1-2][0-9]|30)))[/js] Matches 2009-01-01; 2009-03-31 14:59:59 Don’t matches 24:30:00 You can do a quick … Continue reading

Posted in Development, Snippets | Tagged | Leave a comment