Archive for September, 2011

Is it too late to implement

While working on one of the project I was unable to find any open source Java implementation to generate website thumbnails. At that time I have decided to write my own code to do the same. As this was not possible purely with Java only I get back to C/C++ implementation and found CutyCapt C++ webkit based image rendering utility developed using QT Library. Though it was written in C++ only that’s what I wanted. I decided to write my own Java wrapper on top of CutyCapt to extend its functionality in Java.

I found pretty useful Java bindings for QT Library called QT-Jambi and created my prototype using it. But just before I am writing this post I decided to give name to it as I already had prototype ready with me based on qt-jambi library in Java and is working fine.

Before giving a name to this project I decided to make another broaden search about similar projects available in the community. I was surprise to see that what exactly I was thinking to make including extensions and rich functionality along with simple utility was already available.

Damn . . .

So what should I do now? I should scrap my efforts on this project? As I don’t want to reinvent the wheel again.

But wait let me rethink on it and I may able to provide more functionality than existing projects. After publishing my code on one of the source code hosting services I will post my prototype on my blog.

One of the cause or solution for mysql errorNo 1005 : Can’t create table

This may seem minor issue for MYSQL Guru but in on one of the J2EE application I came across an unusual error (at least for me) while creating one of the child table having foreign key constraint. The error was “Can’t create table address (errno: 150)”. For eager seeker like me who don’t want to read whole story can directly jump to last two paragraph for solution/cause of the problem.

Below are the table definitions I was using for creating person and address entities :

CREATE TABLE `person` (
`name` VARCHAR(45) NOT NULL,

CREATE TABLE `address` (
`personid` INTEGER NOT NULL,
`street` VARCHAR(45) NOT NULL,
`city` VARCHAR(45) NOT NULL,
`country` VARCHAR(45) NOT NULL,
CONSTRAINT `address_person_fk` FOREIGN KEY (`personid`) REFERENCES `person` (`id`)

In MYSQL documentation error description was this “Table creation failed becoz of foreign key” and “All foreign key it refers to should be of same type” about the error.

I was more confused after reading error details and unable to spot my mistake. Finally a careful look to my address table I was able to correct my mistake. The problem was data type mismatch in my address table. I have used INTEGER data type in address table in foreign key relationship but it should be UNSIGNED INTEGER to be compatible with parent person table.

So one of the solution for mysql errorNo 1005 : Can’t create table is to make foreign key relationship between two same data type only. Hope this will save someone’s time, thanks for reading.

%d bloggers like this: