I came across an interesting but cryptic MySQL error message today that took me a while to figure out.
After creating a bunch of InnoDB tables on this particular server, I tried to create some indexes and insert some data. Both types of operations failed with an error message that looked like this:
ERROR 1025 (HY000): Error on rename of './dbname/tablname' to './dbname/#sql2-12bb-9474d' (errno: -1)
After some looking around I came across this amusing bug report, which explained that this message could be due to the innodb_force_recovery setting being set to a non-zero value.
Sure enough, running SHOW VARIABLES LIKE 'innodb_force_recovery'; revealed that it was set to '4' instead of '0'. I now have a sys-admin to kill.
Google Analytics
Friday, May 08, 2009
Thursday, February 05, 2009
406 Not Acceptable error using jQuery AJAX
I was scratching my head over a problem today where a jQuery ajax request was failing on one particular web server with a '406 Not Acceptable' error. It had been tested on many other servers without any trouble, but this seemingly normal Apache server wasn't having a bar of it.
It turned out the problem was that I was submitting the ajax request using the POST method but not actually sending any post data. For example:
Changing it to a GET sorted out the problem.
It turned out the problem was that I was submitting the ajax request using the POST method but not actually sending any post data. For example:
$.ajax({
type: "POST",
url: "index.php?action=foo",
success: function(msg){
// ...
}
});
Changing it to a GET sorted out the problem.
Monday, August 18, 2008
Linux featured in DOA: Dead or Alive movie
Because it's such a classic, I like to re-watch DOA: Dead or Alive every now and again. Based on the video game DOA 3 on Xbox, it vaguely follows the story line of the game. With a rich universe, impassioned drama and superb acting I have no idea why it only got 4.9/10 on IMDB ;)
On the weekend I was enjoying my third or fourth viewing of this theatrical masterpiece when I decided to pause during one of those 'computer code flows down the screen' scenes. To my surprise, this is what I found:
For those playing at home, you can find this code in
There are some slight differences with the original code though. Random words and tokens are missing. For example, the copyright message has been mostly stripped, random words are missing from the description comment and tabs are displaying as boxes.
Having Alpha source scrolling down the screen didn't really make sense in the context of the scene, but I guess if they're going to just put 'whatever' up there, it's a nice Easter Egg for the nerds to unearth.
On the weekend I was enjoying my third or fourth viewing of this theatrical masterpiece when I decided to pause during one of those 'computer code flows down the screen' scenes. To my surprise, this is what I found:
For those playing at home, you can find this code in
arch/alpha/kernel/err_impl.h from a 2.6 series Linux kernel.There are some slight differences with the original code though. Random words and tokens are missing. For example, the copyright message has been mostly stripped, random words are missing from the description comment and tabs are displaying as boxes.
Having Alpha source scrolling down the screen didn't really make sense in the context of the scene, but I guess if they're going to just put 'whatever' up there, it's a nice Easter Egg for the nerds to unearth.
Thursday, August 07, 2008
Getting UTF-8 working in Irssi through Screen over SSH
I keep getting asked about this, so I will put it here for reference.
You can usually do it in 4 easy steps:
You will need to quit irssi, exit the screen session and log out of the shell completely, then load it all back up again.
Now you too can impress your friends by using stylish words and phrases such as touché,
בְּרֵאשִׁית, בָּרָא אֱלֹהִים, אֵת הַשָּׁמַיִם, וְאֵת הָאָרֶץ
and
起
初
神
創
造
天
地
。
You can usually do it in 4 easy steps:
- Terminal emulator environment
Ensure your terminal emulator is using UTF-8 encoding. If you're using iTerm on OS X, you can find this in Bookmarks -> Manage Profiles -> Terminal Profiles -> Default. - Shell environment
Configure your shell to use the UTF-8 version of your locale. For example, edit your~/.bashrcfile and change or add this line:export LANG="en_AU.UTF-8" - Screen configuration
In your~/.screenrc,file, add this line:encoding UTF-8 - Irssi configuration
In your~/.irssi/configfile in thesettings -> "fe-common/core"section, add the option:term_charset = "utf-8";
You will need to quit irssi, exit the screen session and log out of the shell completely, then load it all back up again.
Now you too can impress your friends by using stylish words and phrases such as touché,
בְּרֵאשִׁית, בָּרָא אֱלֹהִים, אֵת הַשָּׁמַיִם, וְאֵת הָאָרֶץ
and
起
初
神
創
造
天
地
。
Thursday, May 01, 2008
Random words on command
Today I needed to generate SQL queries to populate a database table with some test data. I was making a Facebook-style search & narrow thing where, as you type, the list of options narrow based on your search string. I wanted to test the efficiency of my implementation, so I figured it would make testing easier if I used real words for the list items.
It seems a lot of people have needed to do this, so it wasn't long before I found a fairly good solution for my purposes. Here's the magic line:
I really have no idea why this works as I'm no Perl Monger. I also found that I didn't have any words at
I only needed 500 records and calling this 500 times didn't take too long. Much more and you'd probably have to modify your approach though.
It seems a lot of people have needed to do this, so it wasn't long before I found a fairly good solution for my purposes. Here's the magic line:
perl -nle '$word = $_ if rand($.) < 1; END { print $word }' /usr/share/dict/wordsI really have no idea why this works as I'm no Perl Monger. I also found that I didn't have any words at
/usr/share/dict/words, since I was on an Ubuntu server install. I needed to sudo aptitude install wbritish. Incidentally, it worked on my OS X 10.5 machine too. Unix is handy.I only needed 500 records and calling this 500 times didn't take too long. Much more and you'd probably have to modify your approach though.
Thursday, June 29, 2006
Storing system time in UTC in Windows XP
A friend of mine came across an article describing how to store the system time as UTC in Windows XP.
This is helpful for me because I have several machines that dual boot between Linux and Windows XP, and one that dual boots between OS X and Windows XP. Linux and OS X like to store the time as UTC, while Windows likes to store your local time (e.g. UTC+10). Most Linux distros provide an easy-ish way of storing local time instead of UTC, allowing you to boot into Windows without experiencing a time warp. However, OS X doesn't (to my knowledge) allow this -- which is probably a good thing.
The magic key is at:
It's a DWORD that needs to be set to 1 (I had to create it). Of course, you need to reboot afterwards.
There have been reports of side-effects, but so far it seems OK for me.
This is helpful for me because I have several machines that dual boot between Linux and Windows XP, and one that dual boots between OS X and Windows XP. Linux and OS X like to store the time as UTC, while Windows likes to store your local time (e.g. UTC+10). Most Linux distros provide an easy-ish way of storing local time instead of UTC, allowing you to boot into Windows without experiencing a time warp. However, OS X doesn't (to my knowledge) allow this -- which is probably a good thing.
The magic key is at:
HKLM\SYSTEM\CurrentControlSet\Control\TimeZoneInformation\RealTimeIsUniversalIt's a DWORD that needs to be set to 1 (I had to create it). Of course, you need to reboot afterwards.
There have been reports of side-effects, but so far it seems OK for me.
Monday, March 20, 2006
Join Our LUG!
If any of you have listened to episode 18 of the LUG roundup you may have heard some crazy song about my local LUG at the end of it. There were some requests for the songwriter to put up the lyrics, so I figured that since I know the guy pretty well, I'd ask him for a copy ;)
"Join Our LUG"
It's sung to the tune of "Be Our Guest" from Disney's Beauty and the Beast or The Simpsons' popular re-interpretation sung by Mr Burns: "See My Vest".
Some use Windows XP,
Others, OS Ten,
The OS we are pushing for,
Is superior to them...
Join our LUG, join our LUG,
We're from Sydney, we get mugged,
Have a flame-fest on the SLUG list,
See whose patience is the longest.
Stibbons, Jaq, Rob and Mark,
ctd, our underage clerke.
Bruce and Ken and Grant and Jan and,
Pia, jdub: "Awesome, awesome!"
Installfests here, codefests there,
Monthly meetings are fun, I swear!
Erik, Lindsay, Matt and
All the rest!
LCA again,
Two-thousand and seven,
Join our LUG, join our LUG,
Join our LUG!
Distro wars, Fedora bores,
Most of us are Debian whores.
But Ubuntu on the desktop
Is the best!
So let's put out the word,
Linux ain't just for nerds,
Join our LUG, join our LUG,
(Oh please now won't you join it!)
Oh please, won't you join our LUG!
Here's a link to the original recording. ctd also wanted the backing music (which I did not create, but found somewhere =)).
A big thanks to MotherLUG for coming up with the competition idea and, of course, for all the great LUG roundups. Also thanks to purserj for the LA Updates and putting the mechanics into place for all of it to happen!
Finally, apologies for getting such a poorly sung song stuck in people's heads!
"Join Our LUG"
It's sung to the tune of "Be Our Guest" from Disney's Beauty and the Beast or The Simpsons' popular re-interpretation sung by Mr Burns: "See My Vest".
Some use Windows XP,
Others, OS Ten,
The OS we are pushing for,
Is superior to them...
Join our LUG, join our LUG,
We're from Sydney, we get mugged,
Have a flame-fest on the SLUG list,
See whose patience is the longest.
Stibbons, Jaq, Rob and Mark,
ctd, our underage clerke.
Bruce and Ken and Grant and Jan and,
Pia, jdub: "Awesome, awesome!"
Installfests here, codefests there,
Monthly meetings are fun, I swear!
Erik, Lindsay, Matt and
All the rest!
LCA again,
Two-thousand and seven,
Join our LUG, join our LUG,
Join our LUG!
Distro wars, Fedora bores,
Most of us are Debian whores.
But Ubuntu on the desktop
Is the best!
So let's put out the word,
Linux ain't just for nerds,
Join our LUG, join our LUG,
(Oh please now won't you join it!)
Oh please, won't you join our LUG!
Here's a link to the original recording. ctd also wanted the backing music (which I did not create, but found somewhere =)).
A big thanks to MotherLUG for coming up with the competition idea and, of course, for all the great LUG roundups. Also thanks to purserj for the LA Updates and putting the mechanics into place for all of it to happen!
Finally, apologies for getting such a poorly sung song stuck in people's heads!
Subscribe to:
Comments (Atom)