Archive for May 2008

MySQL Key error when inserting new row

Posted by: JDS

Well, the title of this article should probably be generalized to "I'm using NucleusCMS. I tried to add and article in the normal way, but got a MySQL error 'duplicate entry "0" for key 1'."

When trying to add an article to my little-kid blog, I got this error:

…Duplicate entry ‘0’ for key 1 …

Where the elipses are the specific INSERT statement and MySQL error number. Not relevant, here, because this was not caused by NucleusCMS or MySQL.

I discovered that my MySQL server instance had been recently upgraded by my ISP. I think this is the source of the problem, but I am not certain. At any rate, the real problem was that the auto incrementing ID for the content table, "prefix_nucleus_item.inumber", had been changed to not be auto incrementing. WTF? Anyway, the solution was easy:


ALTER TABLE prefix_nucleus_item CHANGE inumber inumber int(11) NOT NULL AUTO_INCREMENT DEFAULT 0;
 

Alternatively, this can be accomplished with something like PHPMyAdmin. Or by creating a PHP script with this one liner in it (a real pain but the only solution available for some ISP situations). But you do need direct access to your MySQL tables in one way or another.

ImageMagick One Liners and Notes

Posted by: JDS

Quick one-liner, primarily of the unsharp mask tool.

First of all, see this excellent article: http://redskiesatnight.com/2005/04/06/sharpening-using-image-magick/

convert -resize 480 -rotate -90 -unsharp 1.5x1.2+1.0+0.10 IMG_8722.JPG the-three-boys.png

NOTE: "-rotate" is optional! duh.