Educating the world

Our blog has over 10,000 readers a month

MantisBT Database Tweaker

March 27th, 2012

I’ve been using Mantis for a couple of years. I run a small company and so have to be extremely flexible. As a result I need to tweak the database to do tasks that are not available using the Mantis front end.

The trouble with editing the bugs and bugnotes is that for each change you make an email notification gets sent to all the people “interested” in the bug. But if I’m correcting spelling mistakes or updating forgotten time tracking information then I don’t want them to be bombarded with emails. They barely read the normal ones!

In order to help with tweaking the MantisBT database I’ve written an interactive Python application.

The trouble with editing the database is that once you’ve done it, it’s not easy to un-doit. The MantisBT Database Tweaker asks you if you’re sure with a helpful message. If you say yes then the SQL command will be applied to the database. MantisBT Database Tweaker will also write out the SQL to put the data back into the database.

Quite often my customers will send me an email because they don’t have access to the Mantis server, so I have to cut and paste their text into a bugnote and then change the owner of the bugnote so that it doesn’t look like it came from me!

2012-04-18 MantisBT Database Tweaker v2.0

Older versions
2012-03-24 MantisBT Database Tweaker v1.0

You can download the MantisBT Database Tweaker from my Open Source Projects page. If you have any suggestions then please use the commenting section below.

Joy

March 25th, 2012

From the film First Knight.

Arthur to Lancelot:

A man who fears nothing is a man who loves nothing; and if you love nothing, what joy is there in your life?

Is tnetennba a real word?

March 23rd, 2012

Language is constantly changing. New words are being created everyday and old words fall from the language through lack of use.

A word that has popped up in the last couple of years is tnetennba. It was born on 2 July 2010 during an episode of The IT Crowd, a Channel 4 produced comedy about working in an I.T. department. Maurice Moss is a gifted yet strange computer technician and gets accepted on to the game show Countdown. You can see the birth here:

http://www.channel4.com/programmes/the-it-crowd/video/series-4/episode-2/tnetennba

[ If you just want the money shot then here you go:
http://www.youtube.com/watch?v=49UakIHb1yI ]

No definition is given in the game show as to what a tnetennba meant but when Maurice was asked to give it in a sentence he said:

Good morning, that’s a nice tnetennba

At the time the word was made up for television and I’m sure in the program they just randomly selected letters during the filming and the sequence tnetennba just came out on that particular take. The moment it was spoken everything started to change.

People started to search for it on-line, talk about it in forums and ask about it on question sites like Yahoo. It was becoming a word. Let’s have a look at what a word is. According to Dictionary.com word is defined as:

a unit of language, consisting of one or more spoken sounds or their written representation, that functions as a principal carrier of meaning. Words are composed of one or more morphemes and are either the smallest units susceptible of independent use or consist of two or three such units combined under certain linking conditions, as with the loss of primary accent that distinguishes a black bird from black bird. Words are usually separated by spaces in writing, and are distinguished phonologically, as by accent, in many languages.

The first part of the definition applies in that it is a spoken sound but the second part does not. It is not a principle carrier of meaning. Or is it?

All this interest in a made up string of characters has produced an interesting side effect. It produces a steady flow of web traffic created by people trying to learn more about this word. For example, we have the campaign to get tnetennba into the dictionary which contains one sentence and a shed load of adverts. People are naming themselves after the word tnetennba. There’s twitter accounts, Facebook accounts and pretty much all of them are trying to sell you T-shirts with tnetennba written on it using some kind of Countdown inspired theme (I think Channel 4 missed a trick with this one).

Even the phrase “Good morning, that’s a nice tnetennba” is used as tag lines on blogs or signature lines on forum posts.

Tnetennba doesn’t have it’s own Wikipedia page yet but it is featured in the Countdown (game show) page. It is, however, in the urban dictionary.

The general consensus is that the word Tnetennba means: a word embedded in a web site in order to increase traffic. The word is, what it is. Perfect.

All the other sites tell you that tnetennba is not a word. This, as far as I know, this is the only site which says that it is a word, it just hasn’t made it into a dictionary yet. The same was true of muggle, gaydar, mini-me and meatspace but they all made it in because they were in common usage.

Mightly Optical Illusions

March 14th, 2012

I know a couple of you like the illusions I post so here is another site I’ve found.

You can make this yourself
http://www.moillusions.com/2010/05/video-impossible-slopes-illusion.html

Male or female
http://www.moillusions.com/2009/05/illusion-of-sex-change.html

Mind the gap
http://www.moillusions.com/2012/02/elevator-optical-illusion-in-london.html

You shouldn’t stare at this too long!
http://www.moillusions.com/2012/02/kaleidoscopic-motion-illusion.html

I thought I’d just have a quick look at the rest of the site and I’ve been sitting here for over an hour and haven’t scratched the surface! If you are bored at work this is definitely the site for you!!

http://www.moillusions.com/

It is worth noting that when you access the site via the main page you only see a cut down version of the page. A lot of them have more than one photo. Maybe that’s another illusion &#59;)

Searching for backslashes in MySQL with PHP

March 5th, 2012

Came across an interesting problem over the weekend. I had a MySQL database table that contains a column of MS-DOS directory paths. I was writing a PHP program to search this column and it took a few minutes to work out how many delimiting backslashes I needed. It was a bit fiddly and ought to be the type of thing you can just look up so here it is!

My table:

+----+-------------------+
| id | folder            |
+----+-------------------+
|  1 | \series\Black\004 |
|  2 | \series\White\012 |
+----+-------------------+

The best way to show this is by doing it wrong and explaining why.

SELECT id, folder FROM folder
WHERE folder LIKE “%\White\%";

This won’t work because “\W” will be converted into a single character which won’t be a “W” any more and “\%” will be converted in to a single character that won’t be a “%” any more. We need to delimit the text to preserve the backslashes so the command can be submitted.

If we add another set of backslashes to form the following then we cam drop into the next level - the SQL engine parser.

SELECT id, folder FROM folder
WHERE folder LIKE “%\\White\\%";

The SQL engine parser reads the statement as “%\White\%” and so we have the same problem we had with the command line stage.

So lets add another set of backslashes to the statement.

SELECT id, folder FROM folder
WHERE folder LIKE “%\\\White\\\%";

Still not enough backslashes. This time we’ll get “\” followed by a single character “\W", which still won’t match.

So to get to our quarry we must add another set of backslashes.

SELECT id, folder FROM folder
WHERE folder LIKE “%\\\\White\\\\%";

The backslashes survive all the way through the command line, through the search engine to allow us to search for a single backslash in a string.

Now comes the fun bit. I needed to embed this SQL line into a PHP command, so I need to delimit all the backslashes i.e. double them all up.

$sql = “SELECT id, folder FROM folder
WHERE folder LIKE \"%\\\\\\\\White\\\\\\\\%\"";

..and don’t forget we need an extra set of backslashes to protect the quotation marks around the search filter.