Cowboy Programming Game Development and General Hacking by the Old West

January 27, 2008

Blogroll and Categories not working in WordPress 2.3.2

Filed under: Wordpress — Mick West @ 11:29 am

I had a problem with the “Links” widget not showing up in the sidebar in WordPress, and categories not showing up in admin. I originally thought it was a problem with upgrading to 2.3.2, but eventually tracked it down to what seems like a problem with MySQL (I’m using 4.1.22).

The solution for me was to delete the file /tmp/#sql_5de0_0.MYD (or a file with a similar looking name, and probably zero size)

Note though that vanishing categories and links seems to be a symptom of several problems – including no deactivating (or upgrading) plugins while/after upgrading to 2.3.X. Check this threads for additional details:
http://wordpress.org/support/topic/135564?replies=95

I think my problem was something to do with character sets, given that I have a few blogs (some I just host for other people), and the blogs that worked were in utf8 and the blogs that did not were in latin1, so another solution might be to convert your blog to utf8. This is a much more complex procedure than deleting a spurious temporary file.

To track this down, I first enabled debugging in wp-config.php, by adding the line:

define(‘WP_DEBUG’, true);

Then when you view your blog (turn off caching first), instead of just blankness where the links should be, you will now see an error, and also the query that cause that error. In my case it looked like this:

SELECT t. * , tt. *
FROM wp_terms AS t
INNER JOIN wp_term_taxonomy AS tt ON t.term_id = tt.term_id
WHERE tt.taxonomy
IN (
'link_category'
)
AND tt.count >0
ORDER BY t.term_id ASC
LIMIT 0 , 30
MySQL said:
#1 - Can't create/write to file '/tmp/#sql_5de0_0.MYD' (Errcode: 17)

I verified that it’s not a problem with WordPress by trying the same query in phpMyAdmin. With my working blogs the query succeeded, and with the non-working blogs it failed, with the same error.

So, I looked in /tmp/ and the file #sql_5de0_0.MYD was there, and of zero length. So, I just deleted it, and everything immediately started working perfectly again.

I suspect that the file was simply left over from when my server crashed under a particularly heavy load a few weeks ago.

This may be related to this problem:

 http://bugs.mysql.com/bug.php?id=11824

This error can also happen on windows installations due to an anti-virus program such as McAfee. You should add the folder where you find the file to MacAfee’s exclusion list.

January 4, 2008

Visualizing and Diagrams

Filed under: Game Development — Mick West @ 5:29 pm

For an article I’m writing, I wanted to do a simple diagram that would illustrate the swaps needed to sort a one dimensional array using various sort algorithms. My idea is to visually show the complexity difference between an insertion sort, and a bin sort. Specifically the O(n^2) vs. O(n + K) complexity.

Now, I have Adobe Photoshop and Illustrator, so should be able to do something reasonable using those tools. I boot up Illustrator, and I do a first attempt in about ten minutes.

insertion_sort_1.gif

Not terrible, but not really clear what is going on, and the lines are all kind of wobbly. The array is crappy looking as well. This is just something I did using the pencil tool, basically drawing the lines in freehand and adding arrowheads.

My feeling here is that I want to be able to generate the diagram algorithmically, the same way I did for the “Random Scattering” article – draw it on screen, and generate XML that can be loaded into illustrator for final (post) editing. But I also worry I’m missing something obvious, so I resolve to spend at least half an hour or so looking for ways to make something nice in Illustrator.

First – How do I get a nice row of boxes? Let’s start with one box: Use the box tool to draw one, and edit the W and H manually to 30 pts. Hmm, then I discover the grid tool, and I immediately think that my copy of Illustrator CS2 is chock full of bugs and I can’t figure out how to draw anything in it without everything exploding, but eventually figure out all was working fine, I was just drawing with an invisible brush. ha! So I figure some stuff out an after 15 minutes or so come up with:

insertion_sort_2.gif

Pretty nice and clean, with good clear curves, but missing rather a lot of lines. Yup, I got bored after drawing a few lines. You see for an insertion sort to work, there will be N*N compares and approx N*ln(N) swaps, which would be 20*3 =60 lines if I just draw the swaps, and drawing in all N*N (400) compares would be a bit redundant. [Actually it’s not N*N, it’s N*(N-1)/2, so only 190, but still]

But what I really want is to generate the diagram automatically. I’d also want nice arrow heads. One thing that really bugs me about Illustrator is whenever I’ve tried to do arrow heads, it just put them so the MIDDLE of the arrowhead is at the end of the line, when what I want is for the tip of the arrow head to be at the end of the line. So if I just add Filter/(Illustrator Filters) Add Arrowheads/ Arrowhead 3, it comes out like this:

insertion_sort_3.gif

I want the arrowhead to point to something, not past it!!!! And what’s not helping is my Illustrator “help” is broken. Hmm, I wonder if I forgot to download it or something. Anyway – you can see why they do this – paths (the line) are arbitrarily wide, and arrowhead taper to a point, so if the arrowhead ended where the path did, then the point of the arrow would become blunt. But then how do I get an arrow where the point ends up at a particular place. It seems like illustrator is useless for this – even just as a basis for automating a diagram, and I should perhaps re-visit some other boxes+arrows software. Like: Smartdraw, which I actually own a copy of (Version 7, and it’s now at version 11). I’ll try the free demo. I should also try Openoffice and InkScape.

swapping.gif

well, that’s the quick and dirty SmartDraw version.

I’m thinking that SVG is the way to go. That’s what I used in the Scatter article. Inkscape is native SVG, so might work out. AI can also import SVG (but SmartDraw, apparently, cannot)

Hmm, Inkscape seems quite reasonably compact in its boxes and arrows. But AI seems to have a problem exporting the SVG created by inkscape – specifically paths with control points seem to just vanish. However, since the export to PDF still works fine, I’m thinking it should be okay.

Here’s a quick test exported from InkScape, which should be fairly easy to generate.

drawing_plainsvg.png

And, Bingo, a few hours later I get the bare bones of the SVG exporting library working, and generate this:

svg_test_40_600.png

That’s just 40 boxes, each one is randomly linked to four boxes ahead of it. I should really make it so it actually sorts some random numbers, and shows all the swaps needed. Use differing colors for the Nth swap.

Here’s the basic swapping:

svg_test25.png

A bit odd – there seems no good reason why some entries would had more swaps than others. Interesting, when you look at the big picture – see how the initial passes, EVEN THOUGH THEY COMPARE MORE SLOTS, have far fewer swaps than the later passes that have half as many comparisons.

svg_test_long.png

Very interesting. This method of swapping whenever we find a pair out of order is having the effect of pumping the low numbers into the second half of the array. Normally I would keep the index of the highest found so far, and only swap the highest one found. That would obviously be better than this method as it would avoid the pumping, and only have one swap per pass. But it’s still quite bad in that it requires N*(N-1)/2 compares.

So I’m sidetracking here, wondering if we could actually use the “always swap” method, but modify it slightly, so instead of swapping our top value I with J, we instead rotate I >> I+1 >> J (hence J >> I). Hmm, the problem swap is never the first one. The key here is to use some of the information we have. We know than in the second swap, we want the value that is currently top remain. Obviously this is just going to approach quicksort, but there might be some interesting optimization’s tailored for specific sized sets of data.

November 1, 2007

What is ntkmlpa.exe?

Filed under: Game Development — Mick West @ 7:32 am

ntkmlpa.exe is a misreading of ntkrnlpa.exe  (NTKRNLPA.EXE), it’s the part of the windows kernel (it’s the named process “NT Kernel & System”). You have misread the letters r and n (rn) as the letter m

There are various problems associated with ntkrnlpa.exe, so I suggest you redo your search with the correct file name and your search terms. It seems like a common problem is some corrupt system file, and doing a system repair might help.

October 29, 2007

Hotfixing Vista

Filed under: Random — Mick West @ 5:07 pm

I got a Blue Screen of Death a few minutes ago, and I’d had another one yesterday. The BSOD is possibly the most annoying thing that can posibly happen, short of total drive failure. Anyway, this time I wrote down the error:

DRIVER_POWER_STATE_FAILURE

With a little digging it seemed this was related to the fact that two days ago I accidentally put my computer to sleep, instead of powering down. This is a known issue, detailed here:

http://support.microsoft.com/kb/941858

Since the fix is apparently a bit tenuous, you have to contact Microsoft to get the hotfix. At first I attempted to do this via their on-line chat, but swiftly gave that up as it managed to crash IE7, and kept telling me it was about to charge me $54.

So I eventually discovered you can just submit an online request for a hotfix, here:

http://support.microsoft.com/kb/935195

So I did, and now I’m waiting. We shall see….

[UPDATE] About three hours later I got an email with a download link and a password. The password is only good for seven days. I installed it, and I’m keeping my fingers crossed. No crashes so far.

MySQL Server Install Problems with Vista

Filed under: Random — Mick West @ 3:07 pm

Oh Vista, how do I dislike thee!

Grr – trying to install MySQl server 5.0 on Windows Vista was rather frustrating, as it simply stopped with “Unable to start service, error 1067”. Especially annoying as I flawlessly installed the thing on my XP laptop in two minutes last night.

You would think someone would have fixed this now, but no, the googlesphere advice seemed to be to re-run the install program as administrator. This failed to work. But I gathered from faint intimations that you had to remove the service for it to be properly re-installed. So, the steps that seemed to work for me were:

  1. Run regedit
  2. Delete the key MySQL from HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services
  3. Reboot (important, otherwise the service does not go away)
  4. Go to C:\Program Files\MySQL\MySQL Server 5.0\bin
  5. Right click on MySQLInstanceConfig.exe, and choose “Run as administrator”
  6. Set it up as you want, and cross your fingers when it comes to starting the service.

Worked for me!

« Newer PostsOlder Posts »

Powered by WordPress