MySQL substring start is one based

To my surprise, MySQL SUBSTRING functions start position is one based. A start position of ‘0’ will return an empty string.

If you would like to get the first 100 characters of a column named ‘my_column’ you will need to use SUBSTRING(‘my_column’, 1, 100). Using SUBSTRING(‘my_column’, 0, 100). will return an empty string.

Postgres and Microsoft SQL server also seem to be one based, but, have different behaviour when a ‘0’ is passed for the start position.

mysql setup for phabricator

Create phabricator user to be used in phabricator config
Grant the above user CREATE TABLESPACE permission so he can create DB
Grant all permissions on the phabricator tables to the above user (daemons/upgrade scripts require different permissions – the permission list from the doc wasn’t enough, so I granted all permission to the user)

CREATE USER 'phabricator'@'%' IDENTIFIED BY '{password}';
GRANT CREATE TABLESPACE ON `phabricator\_%` TO 'phabricator'@'%';
GRANT ALL ON `phabricator\_%`.* TO 'phabricator'@'%';

Bella donna

Bella donna won’t be tamed

Belluci, however, is unconcerned about what her children might think of her movies. ”If you are scared about what people think or what you represent or what your image can be, then you are not free any more in your choices. That can be dangerous for your art. I think it is important to feel free in your passion. I am a woman, I am a mother but when you are an actor, you have to still be wild.”

Monica Bellucci is truly the work of God (or my imagination ;)). When she says something like that, I cannot but only love her more. Her roles in various films backs up her words. I would have loved to hear that when she said that. Then, I would have known if it were scripted or did she think deeply before coming up with those words – any pauses between the words and so on.

Monica doesn’t strike me to be a crazy person – married for 11 years and with two kids – my guess is that she truly believes in what she says.

At 47, all I can say is: Go bella!

DNS Zone File Serial

Today, I came across this error while checking a DNS Zone file for error (I was trying to script the syntax check of a zone file before deploying it onto our production servers):

dns_rdata_fromtext: near ‘201005051010’: out of range
zone loading from master file failed: out of range

And, it immediately occurred to me that it was an integer overflow. The system that I was running named-checkzone had a 32bit OS on it and the serial number ‘201005051010’ is bigger than the biggest unsigned 32 bit integer.As our production servers run on a 64bit OS, named-checkzone returned no error for the same zone file there. I was curious and had a look into the RFC here and it turns out there is no real restriction on the integer size for a serial number (contrary to a few articles on the web).

The immediate solution was to do what the RFC recommends: use a 10 digit number for serial of this format YYYYMMDD + a 2 digit revision number instead of the format that we were using(this YYYYMMDDHHMM). That made a lot of sense to me and since we had access to all the slave Name Servers, we could have easily changed the serials to the 10 digit format but, since it was not really up to me and I was too tired to argue about it, I gave up and decided to wait until we get a 64-bit OS before I continued with the script writing.


From to through
The blog has found itself a new address.

I finally did it! Had the domain registered for 6 months, now finally manged to put some content into it (never mind that the content has mostly been imported from my blogger account). I am planning to update the blog regularly and am thinking of mainly posting tech related news here.

The installation was not smooth sailing, not at all. My host Mochahost has WordPress V1.4 preinstalled and this caused endless troubles when I tried to import the data from my blogger account. Thankfully, I downloaded the latest version of wordpress which makes importing a lot more easier. I tried to get a 3 column layout for my blog, tried a few different themes and settled for the one that I am using now (this turned out to be tricky and I had to reinstall WordPress itself).

Now that everything seems fine, let me just hope that the hours I put in for doing all that doesn’t go in vain.
and yes, welcome all!