Archive for October, 2006

You are now browsing the archive for October in 2006.

Reverse Blog Name and Post Title in WordPress Title

I thought that it’d look a bit nicer with “Some Post Title — Timblog” as the HTML document’s title instead of “Timblog — Some Post Title”. As a reflex, I went to the WordPress Codex and checked for the functions’ syntax. They had example code for reversing the blog’s name (”Timblog”) and the post’s title (”Some Post Title”):

wp_title(' ');
if(wp_title(' ', false)) { echo '--'; }
bloginfo('name');

However, you should use the trinary operator (A ? B : C) whenever you can, because it’s so cool. I’d prefer this code:

wp_title(' ');
echo ( wp_title( ' ', false ) ? '--' : '' );
bloginfo( 'name' );

Haiku #28: No Hex

Logical system
The initial ecstasy
Prior frustration

I confess that I was indeed excited about counting my haikus in hexadecimal. It does seem logical, but it probably just confuses people (including myself). I spent some minutes converting the already written haikus to decimal. Those posts’ URLs will still contain the hexadecimal count, though. Changing URLs is never good.

Several, Tabbed Home Pages in Firefox

What about Firefox automatically opening all of your favourite sites in tabs when you start it? I found out that this is possible even without any extensions just a few days ago. In the “Edit” -> “Preferences” menu, choose the “General” tab and change the value in the “Home Page” field.

Screenshot of the General tab under Preferences, Edit

Instead of putting only one URL there, put several, separated with pipes (”|”). This will open them all in different tabs. I accidentaly found this out when I clicked the “Use Current Pages”, which incidentally happens to say “pages” and not “page”.

Haiku #27: Instrumental

Long instrumental
No matter how beautiful
Music needs lyrics

I don’t know what it is with 10-minute songs that contain long instrumental parts. Every group seems to have one, too. Why them? I’d much rather miss out on the commercial MTV musicians’ lyrics than on Edenbridge’s, Nightwish’s and Tristania’s.

HBH Logical 2: The Stairs of Death

This is the second of Hellbound Hackers’ logical challenges, The Stairs of Death:

Three people are standing on some stairs. They are each wearing a hat. They are only allowed to face forwards, so they cannot see the color of their own hat, only the color of the hat of the one or two people in front of them (depending in which position they are). The hats they are wearing have been chosen from a pile of two red hats and two blue hats. All three men will be shot in one minute unless one of them shouts out (correctly!) the colour of their own hat. Who shouts out and how do they know the color of their hat? (Work out the answer for the most difficult situation!

Stairs of Death diagram

In my diagram, which I find more attractive than the HellboundHackers.org diagram, the three persons are called Mrs. Pink, Ms. Green and Mr. Yellow. There are lots of possible combinations of hats, but since no-one can see Pink’s hat, we need only investigate four combinations (assuming that there is a solution). These are:

Ms. Green Mr. Yellow
Red Red
Blue Blue
Red Blue
Blue Red

The first two combinations have a very simple solution. Mrs. Pink will see the two hats which are of the same colour, and, knowing that there are only two of each colour, shout the other colour.

Stairs of Death diagram Stairs of Death diagram

If Ms. Green’s and Mr. Yellow’s hats are of different colour, however, Mrs. Pink cannot deduce her own hat’s colour, which means that she remains silent. Ms. Green realizes that this is the situation, and since she there are no other hat combinations where Mrs. Pink would have been quiet, she knows that she and Mr. Yellow have different hat colours. This means that if Mr. Yellow has a blue hat, Ms. Green has a red hat, and vice versa.

Stairs of Death diagram Stairs of Death diagram

Just remember that you’ll have to write your own solution — I doubt that copying mine will give you any points.

Personalized Google with Calendar Broken in Localized Google

I just tried making my own customized Google homepage with Google Personalized Homepage (also known as Google IG, but no-one knows what IG stands for). It looks nice, and the AJAX interface is very handy. However, the Google Calendar gadget didn’t load any events and didn’t display my agenda.

Google IG screenshot, but the calendar gadget does not work

While playing around a bit trying to change the language, I went to google.com/ig (the universal version) instead of google.se/ig (the Swedish version). Guess what — the calendar gadget worked perfectly.

Google IG screenshot, and the calendar gadget is working

Apparently, the Google Calendar IG gadget doesn’t work in the localized versions of Google. I haven’t tried this with other local Google versions, but if this is the issue, it is a serious one since Google seems to do whatever they can in order to redirect their users to their respective localized Google domains.

Haiku #26: Firefox Pride

Firefox users
You make a webmaster proud
I love statistics

I was looking through the statistics gathered by Goole Analytics for Timblog, and I was happy to see that Firefox has the largest market share: 48% against Internet Explorer’s 45%. Unfortunately, Windows still has 90% against Linux’s 5%.

Haiku #25: Powers of Ten

Ten thousand million
They adapt to the stupid
Use powers of ten

I just read an article in Los Angeles Times about the creation of element 118. It describes that californium-249 was bombarded with “40,000,000,000,000,000,000″ calcium-48 ions. What’s so wrong with writing “4*1019“? As if people stupid enough not to understand a power of ten would read this article anyway.

WordPress Plugin: CurMusic

CurMusic adds two additional fields to every post, “artist” and “song”. You can use them to show your readers what you were listening to when you wrote the post. The information is shown by adding a PHP function to the theme. The style of the artist/song string can be customized through the option page.

Download and Install

  • Download CurMusic 1.0.
  • Unzip the file, upload it to your plugin directory (/wp-content/plugins/) and activate the plugin in the “Plugins” tab.
  • Edit your theme (Presentation -> Theme Editor) and add this where you want the music announcement to be: <?php echo_curmusic(); ?>. Note that you should know the difference between HTML and PHP before doing this. If you don’t, feel free to ask in a comment.

Todo

  • Music statistics
  • Mass-management of songs and artists
  • Overview of songs and artists

Changelog

  • 2006-10-17, version 1.0:

    • Initial release

“Jerome’s Keywords: Related Posts” died

I just cleaned up among my post tags (managed with the WordPress plugin Jerome’s Keywords), changing from plural to singular, upper-case to lower-case and things like that. However, another plugin that I’m using, Jerome’s Keywords: Related Posts, went crazy. It had been giving very relevant posts earlier, but now it suddenly ceased proposing related posts at all for some posts and went down to two related posts for others. Too bad I’m too lazy to look through the source.

Update: It works fine now. I’ve got no idea about what caused the problem.

« Later PostsEarlier Posts »
FireStats iconAnvänder FireStats