Crawlicious

tools for web business

May 13, 2011
by eric
0 comments

error on rename

Error On Rename

I was trying testing a migration script for mysql yesterday and I would make a change, then run the script, then drop the tables and constraints and then make a change to the script again and repeat.  As soon as I got the foreign key constraints in place I suddenly got this error message when trying to clean up.

mysql> alter table registrationtoken_registrationtoken  drop column licensescope_id ;
ERROR 1025 (HY000): Error on rename of './mydb/#sql-389f_804' to './mydb/registrationtoken_registrationtoken' (errno: 150)

So then I tried removing the FK first and then I started getting this similar message.

mysql> alter table registrationtoken_registrationtoken drop foreign key licensescope_id_refs_id_1e76779c ;
ERROR 1025 (HY000): Error on rename of './mydb/registrationtoken_registrationtoken' to './mydb/#sql2-389f-807' (errno: 152)

After poking around and then leaving the problem alone for a while I discovered this useful command for the InnoDB databases engine.

mysql> show innodb status;

This was most helpful in guiding me to the problem, which had to do with having changed the name of the FK earlier and not updating my script (i.e. misspelled foreign key). Mysql is awesome, but can have some useless errors. Glad I was able to find the show innodb status command to shed more light on ‘error on rename’.

May 11, 2011
by eric
0 comments

finding and deleting files

For the last 12 years, whenever I needed to find and delete files on the unix / linux filesystem, I did this.


find . -name "*.xyz" | xargs rm -f

Today my friend showed me a very nice shortcut, and I think that it deserves it’s own blog post.


find . -name "*.xyz" -delete

Amazing!  I had no idea that find knew how to delete files.  Boy that makes me wish that I had read the man page more thoroughly :-)   Can I get my extra keystrokes and reaching for the | back?

 

Eric

May 6, 2011
by eric
0 comments

cannot start xterm

I just installed debian on my laptop (for the millionth time in my life).  Gdm3 runs fine.  I log in to the nice gnome desktop.  I can start a gnome-terminal.  But from the terminal I cannot start any x stuff.  Xeyes, xterm, xclock, synergy… anything.  This is something that I have experienced for a long time, and today I decided that I was going to figure it out.

Here is the main error that I got.

—————–

No protocol specified
xterm Xt error: Can’t open display: :0.0

—————–

The problem it turns out, is that in my .bashrc file I am setting XAUTHORITY=/home/myuser/.Xauthority

that is a BAD idea!

 

When gdm3 starts, it gives me the XAUTHORITY variable and I am just trashing it once my .bashrc file is sourced.

 

When I commented out that line, viola!  It worked fine!  I have no idea how long I have had that entry in the .bashrc file.  But boy am I glad that I figured this out.