Anakin’s Father

I was watching Star Wars: Revenge of the Sith the other night and I came to a startling conclusion. It is my suspicion that Palpatine is Anakin’s father. It all comes together:

  1. Anakin was “spawned by the midichlorians”.
  2. Palpatine can use the Dark Side to influence the midichlorians to “create life”.
  3. Profit.

*In an earlier post at darryn.net, I wrote that my girlfriend came up with this theory. She has since corrected me. Her theory was that Darth Plagueis was Anakin’s father. So this one is my theory.

Applet to bypass Character Map for common symbols

I am an Australian who is currently working in Europe, and I brought my non-European laptop with me. This has caused a problem for me: I do not have a euro (€) key on my keyboard, and as it is a laptop I cannot use Alt combinations to enter this symbol. This means that if I want to use a euro symbol I have to open Character Map and copy it, or copy it from an existing document. This started pissing me off, so I decided to do something about it.

I have written a small system tray applet whose primary function is to copy the euro symbol into the clipboard with a single click. It did not take long to create and I learned a little bit along the way. The applet implements a system-wide hotkey to copy the euro symbol (Alt-4). Then I had an idea, at my old office I had, printed out, a small table with the keystroke codes for several different symbols, which I stuck to my monitor. Why not replicate this functionality in the applet? So I added support for:

  • € – euro
  • £ – UK pound
  • é – e acute
  • © – copyright
  • ® – registered trademark
  • ™ – trademark
  • ° – degrees
  • … – ellipsis (note that this is a single character, and is the ‘right way’ to do it)

The applet (called Pinkjoint.Euro) is written in C# and requires .net Framework 1.1, and has only been (vaguely) tested on Windows XP. Maybe it will work on other flavours of Windows, perhaps you can tell me in the comments below.

Pinkjoint.Euro can be downloaded here. It runs in the System tray and has no configuration options or installer. Just extract the file to a folder of your choice and run. You can drag it to your startup folder if you want to always have it available (and who wouldn’t).

Exporting all posts from a .Text (dottext) blog via RSS

I recently started moving my personal blog from .Text (dottext) to WordPress. WordPress has the ability to import from many other blogging systems, but .Text is not one of them. Luckily WordPress is able to import an RSS file. The only problem: .Text has a hard limit of the 10 most recent posts in the RSS feed. There is the option to change this number in the admin interface, but it does not work. I knew that what I needed was an RSS feed of all of my posts from the last 6 years, all at once. So I dug out the code.

It turns out that it was not very difficult to solve this problem, some minor changes and we have an unlimited* number of posts in the feed at the same time. As an extra bonus I turned off the aggbug, which is appended to every post in the RSS feed and is used to provide statistics to .Text. Below I have shown the 2 lines of code that have to be changed in order to get your super feed.

from Entries.cs

121: return GetConditionalEntries(99999999,PostType…etc);

from RssWriter.cs

42: this.UseAggBugs = false;

I appreciate that many of you are likely to be as lazy as me, so here are the pre-compiled DLL’s.

Method:

  1. Backup everything including database and DLL files
  2. Extract the 2 DLL files that you downloaded above and place them in the bin folder of your .Text folder on your webserver
  3. Open your RSS feed in your browser and save it as RSS.xml
  4. Overwrite the new DLL’s with the backed up originals
  5. Profit!

Disclaimer: Although I can’t imagine what would go wrong, something might. I am not responsible for any Bad Things that happen as a result of following the advice in this post including, but not limited to: explosions, fires and massive data loss. If any Good Things happen, then I am responsible. If you are afraid of my pre-compiled DLL’s, just compile your own.

If you need the .Text source code, it can be downloaded from the GDN workspace here.

In a future post I will cover exporting comments from .Text and importing them into WordPress.

*there is a limit, it is 99,999,999 posts. I figure you probably have less than that, but if you need more then just change the 99999999 in Entries.cs to a number of your choice.

Getting friendly URLs to work for WordPress on IIS

Friendly URLs make a site a lot easier for both humans and search engines to understand. For example, this post can be accessed by two URLs, a friendly URL and traditional URL.

The friendly URL:
https://www.pinkjoint.com/archives/software/blog-systems/getting-friendly-urls-to-work-for-wordpress-on-iis/

The traditional URL:
https://www.pinkjoint.com/?p=8

You are probably wondering why such a long URL would be considered friendly; after all who would want to type out all of that? You would be right on that point, but that is not what we mean by ‘friendly’. What makes this URL friendly is that it is made of words, so the URL gives you an idea of the subject matter. So ‘friendly’ = easier to understand.

So what does this have to do with WordPress or IIS?

WordPress is a blog publishing system written in PHP and using a MySQL database. PHP sites are more commonly run on Apache, and that Apache is likely running on a server using the Linux operating system. Apache can run on Windows, and the Windows web server (Internet Information Services or IIS) can be made to serve PHP pages.

Since WordPress is most likely to be run on an Apache server, the developers have made it capable of taking advantage of some of Apache’s features. One of these is mod_rewrite, which can rewrite a URL on the fly, using the URL as a query string and passing it to a php file for interpretation. So you could consider mod_rewrite as being able to process virtual URLs. mod_rewrite gets its configuration information from a file called .htaccess.

When you first setup WordPress on an IIS server it is by default configured to use traditional URLs, which work fine. After a bit of a look around you will find the Permalinks page, which is inside Options in Site Admin. It gives a few examples and allows you to enter your own URL structure. So you enter a structure, such as /index.php/archives/%category%/%postname%/, and test it out. You get a blank page. Perhaps you did something wrong? You try a few combinations, and even the examples give you the same result: a blank page. This is because IIS does not have mod_rewrite, or .htaccess files, and there is an undocumented step that needs to be taken before your beautifully crafted friendly URLs will work. You need to make a change to the php.ini file that is in the root directory of your WordPress installation.

First, if you have a php.ini file already, BACK IT UP. You will need the following two lines added to the file:

cgi.fix_pathinfo = 1
cgi.force_redirect = 0

If you don’t feel like copying and pasting all of that, here’s one I made earlier. Just save it as php.ini and upload to the root of your WordPress installation. Like magic, your friendly URLs will just work.