Archive for the ‘MySQL’ Tag

Ubuntu JeOS

Am I the only one who get’s a little funny feeling inside whenever I find some really smart software or combinations thereof.

I just found JeOS which is a boiled down server version of Ubuntu streamlined to use in virtual environments! I tried it out and it was amazing, installed with a full LAMP-server (Linux, Apache2, MySQL 5.0 and PHP5) the end disc usage in my VMWare configuration was 720 Mb and it could run on as low as 128 Mb of RAM! That’s some really neat software!!

Handy MySQL expression for finding phone numbers

We have a database where the phone number field apparently have been used for other information like notes. So how do I find there? As a Perl programmer I instantly think of regular expressions and to my joy the MySQL 5.0 we are running supports regular expressions!

Here is a nifty script to find what doesnt look like phone numbers in a table of MySQL 5.0:

select `phone` as apparently_not from `db`.`table` where `phone` not regexp[. +-0123456789.]{5,}and length(`phone`) > 0

This expression matches any series of 5 or more characters with numbers, plus, minus and space in them. It is crude but it will catch most phone numbers and since it is inverted show those that do not look like phone numbers. Also this expression excludes empty values.

Obviously you must changed “phone”, “db” and “table” to reflect the field, databasename and table of your database.