Monthly Archives: September 2008

MySQL Pop Quiz #28

Don’t forget to send in your suggestions for new quizzes!
This quiz originated on FreeNode#mysql, where someone asked how to count the number of newline-separated “fields” in a TEXT column. For the purposes of the quiz, I’ve changed the idea slightly but you should be able to appreciate the usefulness of this method for any x-separated […]

New Website Design

Working on a new website design completely based around Wordpress is a daunting task. Wordpress themes are not like normal web pages, so you have to upload them into a wordpress environment to preview them. Uploading each file efter making a small change is a little annoying so I have decided to install […]

WordPress 2.6.2 em pt_PT já disponível

Como provavelmente já se terão apercebido pelos vossos paineis, foi lançado o WordPress 2.6.2. Agora está também disponível a versão 2.6.2 pt_PT (sem alterações na tradução)
As correcções centram-se sobretudo em dois patches de segurança para resolver falhas do PHP na geração de números aleatórios (que afecta a força da criptografia das passwords) e no […]

MySQL Pop Quiz #29

Yet another quiz inspired by Freenode#mysql IRC discussions. If you haven’t been around on the channel lately, you should have a peek. Lots of interesting discussions going on!
mysql> SELECT c1, c2 FROM t WHERE c2 LIKE ‘a%’;
+——+——+
| c1 | c2 |
+——+——+
| a | abc |
+——+——+
Is the following […]

Javascript version of MySQL’s/SQL’s IN function

Update: I had to change the name of the function from in to inn. String.prototype.in was causing some problems in some browser… actually.. all of them except Firefox. I’ve since changed to String.prototype.inn and tested this function in Firefox 2, Safari windows, Opera 9.24, and Internet Explorer 7.
I’ve always thought that the IN […]

PHP array_merge is Slow

…or I’m doing something stupid, in which case I hope someone would enlighten me.
We grab a number of data from two different MySQL servers, get them back as arrays ($ar1 and $ar2) and then we concatenate the two arrays. $ar1 consists of 30 to 200 elements, sometimes more. $ar2 typically contains 30 elements.
The PHP way […]