WordPress URL rewriting

When reviewing Google Analytics this morning I noticed a 404 page view for: https://simeonpilgrim.com/404/blog/2007/07/17/curse-of-the-azure-bonds/

with the refer on the end of the URL, going to the referring web site their is a link to this none existing page but the content was for this page: https://simeonpilgrim.com/blog/2005/08/04/curse-of-the-azure-bonds/

After a bit of reading I found mod_rewrite (Linux hosting) was the tool to fix the problem.

I downloaded the /blog/.htaccess file and used the above mentioned manual to decode the meaning and start hacking me a new file.

Much wasted time latter, I worked out that WordPad was messing with the Unix new-line markers, and changing to Visual Studio was met with success (or lack of server failure).

So what I needed to add was the following line to my Wordpress default .htaccess

RewriteRule ^2007/07/17/curse-of-the-azure-bonds/$ 2005/08/04/curse-of-the-azure-bonds/ [R=permanent,L]

giving me this file

# BEGIN WordPress <IfModule mod_rewrite.c> RewriteEngine On RewriteBase /blog/ RewriteRule ^2007/07/17/curse-of-the-azure-bonds/$ 2005/08/04/curse-of-the-azure-bonds/ [R=permanent,L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /blog/index.php [L] </IfModule> # END WordPress

And magically the link now redirects to the correct page.

You can find these pages in Google Analytics by:

  • selecting Content

  • selecting Top Content or **Content by Title
    **

    URL rewriting: Steps 1- 2
    URL rewriting: Steps 1- 2

  • entering /404/ in the Find URL search box

    URL rewriting: Step 3
    URL rewriting: Step 3

Happy Fixing…

MDCrack

After some vanity Googling today, I noticed MDCrack, a project that I helped with back in ~2001 has been resurrected by the lead developer Gregory Duchemin.  Well it was resurrected in 2006, but I’ve been busy….

Makes me want to restart tinkering with the MD2/MD4/MD5 hashes, and build my dream cracker.

Another point to note was that Gregory was right, the idea of pre-computed hash tables, now known as rainbow tables were/are a good idea. Back when I had a 2GB hard drive, they didn’t seem like an effective idea, compared to a network of machines, ala Distributed.Net

Mintshot

I’ve been watching mintshot.co.nz this morning, interesting idea. I have watched a lot of adds, and have ~3,000 mint dollars. Most thing seem to be selling for m$12,000, so I’m guessing I need to watch for a few weeks to get a little action. Only on the Internet can you be paid to watch adds.

There are a few guessing games, that look game-able, so I’ll have to read the code a little more to see… hmm cheating my way to prizes….

House Update - Joists all done

Harvey and I got the last sole plate, foundation board, and joists in place yesterday (Canterbury’s A&P Show Day).

All joists replaced
All joists replaced

The room has a very close to finished feeling. We then started inspecting the rest of the house, to check for further work required in the near term. And there is some, but only a little. The other task we started and will continue tomorrow is clearing the rubble from under the house and lowering the dirt level so we can lay a polythene ground sheeting.

So while the room that started it all is nearing completion, there are new tasks spawned that need doing before the floor can go back down…

House Update

Saturday was spent working on the house again.  The end result was 1.4 m wall section replaced (foundation board and wall base board) and three joists in place (plus a 4”x 2” at the end of these).

All this can been seen in this photo:

Photo of floor - with more joists
Photo of floor - with more joists

The wall being on the top-left and the extra board being on the bottom-right, with the three joists being those in the middle of the picture.

Work left is:

  • two joists at the bottom-left on picture
  • the missing joist from the top-right of picture
  • 1.3 m of wall
  • an internal wall joist (saving the easy parts till last)

Then a floor can go down, but before that, a PVC layer will be rolled out and sealed with vast amounts of tape. Roll on the weekend. or was that the weak-end to this post….

Windows Live Writer leaves Beta

Windows Live Write leaves Beta and moves into the bundle-ware stage. This was announced two days ago on the Windows Live Writer blog, but like previous releases, the http://writer.live.com/ URL just redirected you to some crap http://get.live.com/wl/coming_soon page. Luckily the Windows Live Writer blog has a Send Feedback link, so I did just that to tell how crap they are! and promptly gave up on the update.

Today I read that the installer in has a “new” workflow, so tried it out and the URLs all work just fine now. I agree with Kevin that the new installer is pants. In fact it’s like Microsoft wants to reinvent the control panel and have made their own just for Live (tm) software.

So I’m not using version 12 of Windows Live Writer, and I’ll see how it goes, but on the whole I’m not impressed with the change to the installation model..

Super Paper Mario

Shannon, the great game pimp, has leant me Super Paper Mario. Once I got past the talk-a-thon at the start, the game has been great fun.  I love the 2D/3D of the game, swapping state all the time to look for more treasure.

I’m also really pleased that the game has four save slots, not three, like all previous games. This will allow Michaela to play also.

So now I’m in the middle of playing two games (Super Paper Mario, and Need For Speed: Carbon) while having Zelda - Wind Waker queued up also.

Too much fun, not enough time…..

DiffMerge 3.1 Released

Eric Sink has announced the SourceGear release of DiffMerge 3.1. Killer feature for me is the correct TortoiseSVN merge command is now documented in the help, copied here for your pleasure:

/m /r=%merged /t1=%yname /t2=%bname /t3=%tname /c=%mname %mine %base %theirs

Fantastic. I’d still love to see all four views at once (theirs,base,mine,merged), but this help makes the product very useable now for conflict mergers.

Code Camp Puzzle Reviewed

So the puzzle for the code camp was to decode the Morse Code message:

Message Received - Decode Required

The following transmission was received from General Gates:
.-.-…-..-.-.——.–…..-…–.—.-.——…——–.-..—.–…-.—.-..–.-.-…..-.—.-..—–.-.–.-….-..-………
You must decode this to find the hidden message. Unfortunately, the message was damaged in transmission and all the spaces between the words were lost. However, we do know that only the following letters are in the message:

A .- B -... C -.-. D -.. E . F ..-. G --. H ....
I .. J .--- K -.- L .-.. M --N -. O --- P .--.
Q --.- R .-. S ... T - U ..- V ...- W .-- X -..-
Y -.-- Z --..

We are also certain that the message only contains words in the standard military dictionary, located here. The are only 10 words in the message, five letter T’s and four letter E’s.

We received six solutions, one was from a non-attendee, and another was “lost” in the Ether, while the DNUG mailing list server was inactive over the weekend. So we had four solutions on the day of the draw.

The most abstract solution was a genetic algorithm submitted by Tim Schurr. It built 100 partial text’s, then for 100 iterations it does light mutation and replaces each solution when the new evaluates better. Then each 100th iteration the solutions are ranked and the top 50% are heavily mutated, over top of the bottom. around 100,000 generations were required to solve the puzzle. It was the only solution to use a GUI over the console, with progress bar and every thing. If the solution was not found, then the best 30 solutions were shown. Giving an output like this:

ALL TROOPS LAY -.-.----- BOOT CAMP FOR A TECHNOLOGY REFRESH
ALL TROOPS REPORT MOST TOOL OWE IT .---.-..- TECHNOLOGY REFRESH
ALL TROOPS REPORT TONE ATOM KIT MADE -.---.-..- TECHNOLOGY REFRESH
ALL TROOPS REPORT TONE ATOM CAT KNEE -.---.-..- TECHNOLOGY REFRESH

Very cool.

The next solution of note worthiness was Simon Green’s. Simon built a console application, but he pimped it out with multi-coloured fonts *Bling*. Simon’s solution built a tree of all the words that could be formed at each step along the Morse code. It then built a tree of possible solutions, which are then iterated over with via a massive LINQ expression using a set of Cursor like objects. He explained it to me many times, and I’m still not sure I’m doing it justice. As part of the same solution he had a classic backtracking search that could be interrupted and you then could manually select through the options at each word, this mode could then resume searching. All and all a very complete solution. Simon went on to win the Zune via the magic of a name draw.

Liam Clarke-Hutchinson’s solution was done in F#, which I’ve not used, but reading the code it seems to do stuff. I can follow code, but getting a bigger picture is beyond me right now, but anyhow, it solves the problem. And I will have to learn how it does it, latter.

Andrew Sewell’s solution was a C# 2.0 solution. Andrew builds a dictionary of all input words, and stores the matching Morse code result for the word. He then does back tracking via recursive object creations to iterate across each word in the dictionary cloning the current object for each match. He handles the multiple solutions by collecting solutions in a container.

Andrew McMillan’s solution also builds a dictionary of text/encoded objects with the ‘T’ and ‘E’ constraints marked in each object. It then backtracks via recursion matching each word in the dictionary. Unfortunately, his email was delayed in the Ether, so was not in the draw. I’m feeling pretty stink about this as we had such a low submission count that he stood a chance of winning.

My solution, builds a Radix Tree (a n-tree (and in this case a binary-tree)) of the Morse code for each word in the input dictionary. Each text word was added to the tree where it was “formed” in Morse code. I then used IEnumerable<>’s to to step down the tree following the code at the current location returning all words attached to each node traversed in the tree. I then had a higher level IEnumerable<> that did the recursion applying the letter and word count constraints. This meant that I could loop across the solutions as they were found.

All code is now hosted in a github repo codecamp-2007-puzzle. I will post the other solutions as permission is granted.

Code Camp Christchurch Wrap-up links

I have been Googling for Code Camp related posts:

I’ve found a few new blogs to subscribe to, that are not on the .Net User Group opml. Christopher Fairbairn and Andrew Tokeley

Here are the speakers related posts that I found:

Speakers with blogs, but not posts yet:

Nathan Marcer - Windows Server 2008

I’m sure the plan is to round up the slides and demo code, and email attendees.