]> The LambCutlet Disorganisation » 2005 » May

The LambCutlet Disorganisation

Day 11 in 香港 (Hong Kong): A mister, a Lord and a Godmother…

Posted by Jonathan at 22:38:08 UTC on the 31st of May, 2005

17th of February — Rise and shine at 08:30 HKT as it’s day-trip to Macau… or so I thought. :D

  • Just as I pretty much got myself ready, uncle called at 09:00 HKT letting me know that he would not being able to visit Macau with me as he was unable to get time off due to work commitments, though will arrange for 卓兒 (Cheuk Yi) to accompany me this Saturday instead
  • Figuring I’d be free for the day, I gave Mr. Sandy McAlistair at the Hong Kong County Club a call for an ad hoc meet up having got his contact number from Mr.Eric Ho just a couple days ago. On chatting with him, it was arranged that we could met up that day for lunch at 13:00 HKT at the Hong Kong County Club, which is on the southern side of 香港島 (Hong Kong Island)
  • Errands first though as rather than let the washing pile up for another 7 days, I packed my bag full of things I wanted washing and headed out of the hotel & across the road to the laundry. It was only HK$20 or there abouts for the priviledge on a sub-7kg load, plus the lady whom served me was charming and I figured I might as well do my bit to help the local economy!
  • With stomach rumbling meaning I really should go get some brunch, I really fancied some 餛飩麵 (wonton with noodles in broth) and actually asked the nice lady at the laundry if she had any recommendations nearby. She pointed me to one just off 窩打老道 (Waterloo Road) on 梭椏道 (Soares Avenue), so I headed that way to get fed and while away some time before the laundry was ready for collecting in a hour or so. Can’t beat that for an efficient & helpful service!
  • Wasn’t too difficult to find the restaurant in question as it had a huge neon sign erected outside in the typical fashion you see locally and headed inside requesting just a seat for myself. On sitting down, it was quite a straightforward task to order the noodles and hot lemon tea then a short wait before the food and drink arrived. Did have a little chuckle to myself when the 餛飩麵 (wonton with noodles in broth) arrived complete with a fried egg on top, it was before noon afterall and technically still breakfast, ergo a bit of East meets West in the way only 香港 (Hong Kong) knows how
  • The food went down very well, being tasty and as it turned out, a bargin as when I settled the bill, it only came to a total of HK$18! With that done and dusted though, I headed back outside to do a bit of shopping in the supermarket to gather some supplies, such as bottled water before heading back up to the laundry to pick up my cleaned clothes
  • Laundry collected and time closing in on 11:30 HKT, I just made a quick dash back to the hotel to drop the shopping and cleaned laundry off, plus repack my bag with the things I would need later, finally back outside to catch the Nos. 7 bus, cross the habour via the scenic route on the Star Ferry to 灣仔 (Wan Chai) and short walk to 銅鑼灣 (Causeway Bay) for minibus to take me to 深水灣 (Deep Water Bay) where the Hong Kong Country Club lives
  • Unfortunately, the quick dash inside meant I temporarily managed to leave my brain as well as on sighting what I thought was the Nos. 7 across the road, making a dash for it, hopping aboard, swipping my 八達通 (Octopus Card) and heading to the upper deck for a seat, just a short 5 minutes into the journey I realised I had actually boarded the Nos. 7B which would have been fine if I was going the other way and heading to 樂富 (Lok Fu) to see my relatives!
  • Bleeting a Homeresque “DOH!” and quickly fumbling through my map of public transport routes, I figured I won’t gallantly dive off the bus from the upper deck but rather stay on it and go all the way to the terminus at 紅磡碼頭 (Hung Hom Ferry). After 30 minutes or so completely unintended tour of 九龍 (Kowloon), I reached the terminus. A quick check for when the next ferry to 灣仔 (Wan Chai) was turned out to be a rather protracted 20 minute frequency as opposed to the 12 minutes had I been at 尖沙嘴 (Tsim Sha Tsui) as originally planned. Also, the trip across the habour would also take about twice as long, all in all not time I really had to spare since it had just gone 12:20 HKT
  • So what does one do when one is in a rush to get to somewhere in 香港 (Hong Kong)? Simple… get a damn taxi and taxi your way there! Thankfully there was a taxi rank right nearby so it was just a case of getting into the first one at the queue and telling the nice driver where I wanted to go. Phew!
  • The punctuality gods must have been smiling upon me as despite my complete utter fuck-up, I managed to arrive at the Hong Kong Country Club at 12:55 HKT! The fare was a cheap HK$50 in all though I accidently handed over a HK$500 bill and not a HK$50 one. You see, the HK$50 bills I’m used to as a lad were violet and only just a few months ago changed to green, so both schemes of bills are legal tender. The HK$500 bills were are are still brown, though very annoyingly for reasons best known to themselves, the Bank of China HK$500 is brown tinted with purple, so old HK$50 and new HK$500 are very hard to tell apart, aside from the “obvious” extra digit. The joys of having 3 issuing banks each with their own designs!
  • Alas, the taxi driver was very honest with the fact I probably didn’t intend to give him a HK$450 tip, so he called me back just as I was walking off and we sorted out the correct monies for the journey, with me thanking him and decided to tip him an extra HK$10 for his troubles
  • Third time lucky in getting my poor brain into gear and in I headed into the front entrance of the Hong Kong Country Club and just as I asked the reception desk for Mr. MacAlister, out he came greeting me and that he’s delayed just a few minutes and would I mind just waiting a couple minutes. So as I waited, I had a gander at the many things on display in the lobby and couldn’t help but note the rather surprising number of life-members whom were “Peers of the Realm“, then on the opposite side was a huge Chinese vase complete with one of the prettiest peach blossoms I had seen to date during these Chinese New Year festivities
  • Sandy soon re-emerged and invited me down to the main restaurant for lunch as arranged and on the way down met up with his wife Lydia, whom was hosting a birthday party for one of the patrons. I was surprised they had hardly changed in the last 15 years, though Sandy did quip older and grayer!. Likewise, both he and Lydia were very surprised quite how much I take after both my father and late mother. I should hope so! was my reply with a loud chuckle!
  • Once sat down at the table, it was quite strange to catch up. Sandy and my father were colleagues collectively running the Royal Hong Kong Police Officer’s Club back in the old colonial days and both were proud in keeping a very tight ship. Lydia and my mother also got on well, with mother enjoying doting on the MacAlister’s two daughters Cruzanne and Ellie, which during my chat was told the eldest is now doing her A-Levels and the two sisters were joined by a third a few years after my family left 香港 (Hong Kong), though I’m unable to recall her name
  • Turns out both the elder girls went to the same secondary school as I did, namely South Island School and like myself found that school to be most enjoyable. Indeed, 香港 (Hong Kong) spoils you thoroughly and was something Sandy pondered about as the family would have to get used to the slower pace of life in his native New Zealand, in Auckland where they were to completely move to literally in the same weekend as I was to finish my trip in 香港 (Hong Kong). The elder girls had already moved on ahead to carry on with their studies, which was a bit of a pity as I was not able to meet them though as I explained my own future plans, was told if I happen to be in that part of the world I was more than welcome to drop by and say hello, as one does!
  • We carried on chatting about how our respective families have been doing the last 15 years, the various events of past or future, how the SARS epidemic in 香港 (Hong Kong) was something one wouldn’t forget in a lifetime in a hurry, adapting to living in a completely different country even if one may be a native, jobs and employment, the rise of 中國 (China) and so on
  • Then after an hour or so, with lunch more or less finished, Sandy had to re-attend work. The downsides of being a club manager is that however exclusive the club may be, your whole family lives on-site and more or less you are working as long as you are awake. One of the reasons why my own father downshifted a gear job wise and be the Assistant Manager of the Police Officer’s Club for the fact that I’d grow up in a better enviroment staying put at the flat we were at in Happy Valley. I made sure we had exchanged contact details and said goodbye to Lydia, then Sandy walked back with me to reception saying it was lovely to meet me again after all this time and that I have a safe journey and I thanked him for his hospitality. By this time, the heavens had decided to open and a stroke of luck that I’d been carry my umbrela all the time, so out I headed to see if I could catch a minibus back to 銅鑼灣 (Causeway Bay)
  • Pretty much as I crossed the road to head up 寿山村道 (Shouson Hill Road), a route I used to walk many a times whilst I was at South Island School though admittedly the other way, I spotted a bus by the bus stop marked with the destination: 赤柱 (Stanley). So an impulsive descision to quickly jump on the CityBus Nos. 973 and have a little wonder down that way! ;)
  • After about 30 minutes or so of bus ride via some very twisty roads such as you get in 香港 (Hong Kong), I arrived in one piece at 赤柱 (Stanley)! Thankfully the rain had gone away for now and luck would have it that I just happened to catch yet another lion dance troop strutting their stuff between the market stalls to spread good fortune
  • However, the market at 赤柱 (Stanley) is a “bit” of a tourist trap so caveat emptor! I was personally more interested in the scenic things so headed towards the beach to get my bearings. It wasn’t long before I found the first place I wanted to be, 赤柱天后廟 (Tin Hau Temple of Stanley) and inside I went
  • Further inside was 天后 (Tin Hau) herself and her name literally means “Heavenly Empress” and is a 道教 (Daoist) Goddess of the Sea who protects fishermen and sailors, where both communities featured in 赤柱 (Stanley) and indeed 香港 (Hong Kong) overall. Even though sea farers are much less common in modern 香港 (Hong Kong), 天后 (Tin Hau) is still venerated as she is seen as a compassionate, motherly protector
  • Moving alone the beaten track, I ventured upon a small shrine as the mist rolled over the peninsula by the name of 北帝廟 (Pak Tai Shrine) and it was really rather small! Nearby were some steps to the sea and once down on to the rock outcrop there were literally quite fantastic views of 赤柱 (Stanley) even if I say so myself :D
  • Random trivia time! 赤柱 actually means “Red Pillar” and the place got it’s name from the local big tall cotton trees which are often covered in bright red blossoms. The English name however, came from the place being named after Lord Edward Smith Stanley, 14th Earl of Derby, three times Prime Minister and the longest serving leader to date of the Tory Party. Lastly, I am also supposed to be related to him, though exactly how close a relation is something for another day when my father or myself get round to doing the whole genealogy thing
  • Time was now 15:40 HKT and a quick check with my map suggested I still had time for one more stop. After about a 20 minute walk, there I was in front of the huge statue overlooking 赤柱 (Stanley) that is 觀音 (Kwun Yam), where in East Asian Buddhism she is venerated as Goddess of Infinite Compassion and Mercy and as an Immortal in 道教 (Daoism). As for the final random factoid, with 觀音 (Kwun Yam) being a mother-goddess and patron of all mothers and seamen; since I was a poorly child when I was still a baby, my late mother saw it best that she’d be made my godmother for protection
  • Having had a busy day, it was time to wait for a CityBus Nos. 973 to get back to 九龍 (Kowloon) via 香港子 (Aberdeen), 薄扶林 (Pok Fu Lam) and finally through the West Cross Harbour tunnel then terminating at 尖沙嘴 (Tsim Sha Tsui). An enjoyable hour and a bit ride, made more amusing with four English ladies whom were as far as I can tell Personal Assistants out on a shopping trip as their bosses were in meetings and getting rather over excited with all the shops and rather proud of their purchases! :D
  • I alighted the bus in 尖沙嘴 (Tsim Sha Tsui) around about 18:00 HKT and uncle must have been reading my mind! I was thinking about where to go eat and it was literally then I got a phone call from him inviting me for another home cooked meal with the family at 19:00 HKT. With that news, I quickened my step to the nearest MTR station dicing through the rush-hour crowds on 加連威老道 (Granville Road) and made my way up to 樂富 (Lok Fu)
  • Arrived at my uncle’s a little bit late though was pleased to get fed and watered without needing to put any thought as to where I may find some food, plus was good to have a good natter with the rest of the family as to what we all got up to and figure out some possible things to do in the final half of my stay. Eventually made my way back to the hotel around 22:00 HKT to get washed and hit the comfy old bed and get some kip

As for what I’m going to do the next day, I’ll tell you once I’ve had some well deserved rest! ;)

Filed under: Personal, Holiday

My sturdy old Pentium-3 dually for sale!

Posted by Jonathan at 18:59:18 UTC on the 26th of May, 2005

Righty ho, my desktop computer which has served me very well for the last 4 years and a bit is up for grabs. Some components are barely a year old and the whole thing is pretty much as maxed out as it can possibly be (at time of purchase), as the specification shows:

Now I’d ideally want all this to go to one buyer to save me the hassle of eBaying this off in many small lots. Please be sensible with the offers as the memory on it’s own is still £280-ish (US$440-ish) new so use that as a guide. The computer is rock solid and works just peachily with any operating system you wish to through at it, from Windows (NT4, 2000, XP, 2003 Server) to Linux (Debian, Knoppix, Gentoo, RedHat, SuSE, et cetera) to *BSD to even BeOS, QNX, Solaris for x86, ad infinitum.

I’ll accept payments via PayPal only and you as the buyer will also have to foot the shipping. It’ll be 2 boxes, one for the monitor and the other for the computer and weight for each I guesstimate at 25kg (55 lbs.).

If you are interested, then please follow the instructions I’m about to give you carefully. Copy the following line into your clipboard:

Re: Pentium-3 700E 440BX dually please! - via LambCutlet.org

Now head to my contact form, fill in your name and E-Mail, then paste the clipboard text as the Subject. In the message you wish to send to me, will obviously be your bid in how much you are willing to offer. Failure to do the above correctly will bring Internet shame upon yourself for failing to follow basic instructions properly and likihood of me to completely ignore your bid! The closing date for this sale will be 00:00 UTC Sunday, 5th of June 2005. Happy bidding! :D

Filed under: Meta

WordPress & non-absolute URIs fix

Posted by Jonathan at 22:07:09 UTC on the 25th of May, 2005

This little hack are for other WordPress users like myself whom enjoy cruft free linking as per RFC2396 and use:


<a href="/path/to/somewhere/">local link</a>

… or indeed:


<a href="//somedomain.tld/path/to/elsewhere/">external link</a>

… with abandon. Trouble is for users whom come to read your site via Atom feeds of whatever, such links will break. However, fear no more… as this the hack to fix this up is quite trivial.

Hunt down ./wp-includes/functions-formatting.php and find the function convert_chars(), looking for this:


	// Just a little XHTML help
	$content = str_replace('<br>', '<br />', $content);
	$content = str_replace('<hr>', '<hr />', $content);
	
	return $content;
}

… and replace with:


	// Just a little XHTML help
	$content = str_replace('<br>', '<br />', $content);
	$content = str_replace('<hr>', '<hr />', $content);
	
	// Sort out those absolute path & network location URIs
	$absolutist_uri_scheme = 'http'.(($_SERVER['HTTPS']=='on')?'s':'');
	$moral_relativism = array('/href=\"\/\//',
				'/href=\"\//');
	$total_absolutism = array('href="'.$absolutist_uri_scheme.'://',
				'href="'.$absolutist_uri_scheme.'://'.$_SERVER['HTTP_HOST'].'/');
	$content = preg_replace($moral_relativism, $total_absolutism, $content);
	
	return $content;
}

The hack should be HTTPS aware, for those of you hosting your blog on an SSL enabled site and all those damned morally relative tree-huggin’ hippy links shall get a good kick in the nuts and be blasted with draconian total absolutism, henceforth making Blogosphere™ a much better place for all, where no children will have to endure another 404! ;)

Filed under: Software

Looking ahead…

Posted by Jonathan at 23:00:38 UTC on the 24th of May, 2005

It’s been nearly 2 months since I finished my last job contract and it’s been quite a shock how quickly time has shifted. I’ve managed a lot of ground work in that time, yet I know that it isn’t quite as much as I wanted to get done due to other dependancies which quite frankly have been beyond my control due to other dependancies… Grrr.

June itself is just a short week away afterall and by then it will officially be summer. From there, it’s just a short 3 months till I’ll hopefully be back in 香港 (Hong Kong). What will be keeping me employed so that I won’t live on the streets are still unclear as yet… Teaching English is all fine and dandy if I get accepted to the TEFL course for which I’ve still yet to be interviewed for and that smallish task of actually passing it once on it! Web Technologies freelancer seems another viable path, though the ground work I’ve laid down so far still needs building upon and is something that will take time. Patience is Virtue!

Between now and then though, I’d love to do some more travelling, if only to clear my mind and perhaps have a divine moment of inspiration… The Baltics springs to mind again with Latvia and Estonia looking most appealing. Other than that, European Russia, say somewhere like Санкт-Петербург (Saint Petersburg) would be fantastic. Alternatively, I could head the otherway as I’d love to visit Greenland and Iceland. Which ever way I do go though, the final big jump will be to the other side of the globe to Australia and visit Nykky sometime in mid-July for 2 or 3 weeks.

Just a pity I can’t figure out my niché subject (as yet) so as to make a comfortable living as a professional blogger… :P

Filed under: Meta, Personal

Samsung to demonstrate 40″ (100cm) Organic Light Emitting Diode display

Posted by Jonathan at 23:30:18 UTC on the 19th of May, 2005

Quoting EETimes ad verbatim:

South Korean electronics giant Samsung Electronics Co Ltd. claims to have developed the world’s first 40-inch display panel made from a single sheet of organic light-emitting diode material. The OLED prototype has a wide screen format of 1,280 by 800 pixels and is driven by an active-matrix backplane of amorphous silicon transistors.

Samsung launched an OLED development initiative in 2001, and the 40-inch panel follows Samsung’s development of OLED prototypes at 14.1-inch diagonal size and 21-inch diagonal size in 2004 and January 2005, respectively.

This latest prototype has a maximum screen brightness of 600 candela per meter², a black-and-white contrast ratio is 5,000:1. The ultrathin shape of the panels will allow future TV set designers to create televisions with a total thickness of only 3 cm or less, Samsung said.

Samsung said it plans to exhibit the 40-inch OLED panel at the Society for Information Display conference and exhibition in Boston from May 24 to 27.

Emphasis mine, since even the best LCDs displays (all the rage right now for home televisions) only manage brightnesses of 300 to 500 candela per meter² with contrast ratios of 350:1 to 500:1, the latter explaining why images look washed out as what you think you see is black is actually a grey.

In actual fact, these new OLED displays would be even be able to better the 3000:1 contrast ratios managed by the best Plasma displays yet achieving the similar brightness. All that plus the added benefit of consuming a good deal less power than those power hungry Plasma beasties. Yummy! :D

Filed under: Technology

Eeek… a musical baton!

Posted by Jonathan at 20:50:38 UTC on the 19th of May, 2005

From Tjaard cometh thy musical baton, which apparently started on Livejournal before moving onto the higher planes of Blogosphere. As much as I loath chain-anythings, I’ll give this one an exception. ;)

Total volume of music files on my computer…
I actually have very few music files on my computer since I’m one of these odd people whom still have most of their music on these funny 12″ black disc shaped things. However, I do have quite a few deephousepage.com mixes saved locally which totals exactly 1 577 312 293 bytes. Mostly Larry Heard’s mixes though Dino & Terry, Theo Parish, DJ Pope, Master Kev, et cetera all feature. Non-mixed stuff totals a grand 0 bytes! :P
The last CD I bought was…
CD? Yikes… that’d be quite a while ago, though I’m pretty sure it was “The Horace Silver Quintet - Song For My Father (Cantiga Para Meu Pai)
Song playing right now…
Nuspirit Helsinki featuring Kasio - Take It Back (available on Guidance’s “Hi-Fidelity House: Imprint 3”)
Five songs I listen to a lot/mean a lot to me…
No idea how I’m supposed to pick 5 out from literally hundreds, oh well… here goes:
The fiveseven people where this meme will go on…
A few from my blogroll will suffice:

There we go, makes a change from the last 9 software posts and 2 politics related ones preceeding that! ;)

Filed under: Music, Personal

WordPress “XHTML/XML or Not!” Plugin

Posted by Jonathan at 17:50:15 UTC on the 16th of May, 2005

Yet another plugin for you WordPress application/xhtml+xml XHTML-philes. xhtml-or-not.tar.gz’s sole purpose in life is to spit out whatever data it depending on what MIME-type WordPress is set to output via my hack. After downloading and extracting the archive, putting xhtml-or-not.php in ./wp-content/plugins/ and activating it, the following template tag is available to you:


<?php xhtml_or_not('primary_output', 'secondary_output'[, 'tertiary_output']); ?>

The tag takes a minimum of 2 parameters and the 3rd is optional. When just 2 are set, the “primary_output” is what you wish to output when WordPress in either XHTML or XML mode. “secondary_output” will be when it’s in a non-XML mode. Examples include outputting an XML prologue in header.php:


<?php xhtml_or_not('<?xml version="1.0" encoding="'.get_bloginfo('charset').'"?>'."\n", '') ?>

… or <script> CDATA section/HTML comment in whatever template file:


<script type="text/javascript">
<?php xhtml_or_not('<![CDATA[', '<!--'; ?>
	
/* Some JavaScript */
	
//<?php xhtml_or_not(']]>', '-->'; ?>
</script>

Lastly, the 3 parameter option will send “primary_output” in XHTML mode only, “secondary_output” in other XML modes and “tertiary_output” for other non-XML modes. Few people will probably need this last option, but it’s there and allows you to do something like:


<?php xhtml_or_not('<foo />', '<foo></foo>', '<foo>'; ?>

… or perhaps something more useful! :D Comments, flames and so forth welcome! :P

Filed under: Software

Google AdSense Injector for WordPress

Posted by Jonathan at 21:22:50 UTC on the 11th of May, 2005

Gosh aren’t we lucky today, more than one piece in a day of WordPress stupidity from yours truly! ;) This time however, it is in the form of a plugin and is primarily aimed at those wanting Google AdSense to be WordPress theme aware as they have a theme selector or some such, or are using content negotiation to serve up XHTML as application/xhtml+xml via my method.

For the latter, as you may well be (un-)aware, Google’s AdSense code does not play nicely in such situations so the current work-around is to use an <object> element, which then references an HTML file sent as text/html, and it is this document which contains all the fancy Google AdSense JavaScript.

Just download google-adsense.tar.gz and extract it. Edit google.html and put the relavant JavaScript variables for your account into it, save it and then put this in the directory of your current active theme, say ./wp-content/themes/your-theme/. Next, place the file google-adsense.php into ./wp-content/plugins/ and activate the plugin. To insert an AdSense block, the most basic template tag for it is:


<?php google_adsense(); ?>

In text/html mode (the plugin figures this out automagically), the ./wp-content/themes/your-theme/google.html file is read and just the important AdSense bit is output into your page, something resembling this in fact:


<script type="text/javascript"><!--
google_ad_client = "MY_CLIENT_ID";
google_ad_width = 728;
google_ad_height = 90;
google_ad_format = "728x90_as";
google_ad_type = "text_image";
google_ad_channel ="";
//--></script>
<script type="text/javascript"
  src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>

In application/xhtml+xml mode (anything other than text/html or text/plain to be precise), it will output an <object> which references to ./wp-content/themes/your-theme/google.html, something like so:


<object data="http://domain.tld/wp-content/themes/your-theme/google.html" type="text/html"></object>

Obviously, if you are using more than one theme, then the google.html template needs to be in those themes directories too! The template function also accepts a parameter, which appends a suffix to the template file it’s trying to use. A basic example would be:


<?php google_adsense('leaderboard'); ?>

… and:


<?php google_adsense('skyscraper'); ?>

Instead of looking for [THEME_PATH]/google.html, the above two examples will look for [THEME_PATH]/google-leaderboard.html and [THEME_PATH]/google-skyscraper.html respectively. What CSS to apply to your placed AdSense I’ll leave completely up to you as one man’s meat is another’s cabbage.

So that’s basically it, happy WordPress plugging-ining and Google AdSense (XHTML or otherwise) advert-serving! :D

Filed under: Software

WordPress & “application/xhtml+xml” take 2

Posted by Jonathan at 20:00:05 UTC on the 11th of May, 2005

This time round is a slightly extended version of a WordPress hack from me and now works for the current 1.5.x line to date. The one major new functionality is the ability to force a MIME-type via GET, which some may find handy. The changes are fairly trivial:

In ./wp-blog-header.php, find…


// Sending HTTP headers
	
if ( !empty($error) && '404' == $error ) {
    if ( preg_match('/cgi/', php_sapi_name()) )
        @header('Status: 404 Not Found');
    else
        @header('HTTP/1.x 404 Not Found');
} else if ( empty($feed) ) {
    @header('X-Pingback: '. get_bloginfo('pingback_url'));
    @header('Content-type: ' . get_bloginfo('html_type') . '; charset=' . get_option('blog_charset'));

Replace with…


if(     (strstr($_SERVER['HTTP_ACCEPT'], 'application/xhtml+xml')) ||
    (strstr($_SERVER['HTTP_USER_AGENT'], 'W3C_Validator')) ||
    (strstr($_SERVER['HTTP_USER_AGENT'], 'WDG_Validator')) )    {
    //
    // If any of the conditions match and a mediatype via GET is not set, set the appropiate media type
    $media_type_get = (!isset($_GET['mediatype'])) ? 'xhtml' : $_GET['mediatype'];
}
	
switch ($media_type_get) {
    //
    // For our lovely XHTML
    case 'xhtml':
        $http_media_type = 'application/xhtml+xml';
        break;
    //
    // For generic XML, or fancy mixed mode XML documents
    case 'xml':
    case 'axml':
    case 'xsl':
    case 'xslt':
        $http_media_type = 'application/xml';
        break;
    //
    // This is depreciated and has Unicode handling problems but what the hell
    case 'txml':
        $http_media_type = 'text/xml';
        break;
    //
    // The proposed MIME type for the XSLT2 spec
    case 'xslt2':
        $http_media_type = 'application/xslt+xml';
        break;
    //
    // This is funny for jokes :D
    case 'text':
        $http_media_type = 'text/plain';
        break;
    //
    // Boring old HTML for stupid browsers
    case 'html':
    default:
        $http_media_type = 'text/html';
        break;
}
	
// Sending HTTP headers
	
if ( !empty($error) && '404' == $error ) {
    if ( preg_match('/cgi/', php_sapi_name()) )
        @header('Status: 404 Not Found');
    else
        @header('HTTP/1.x 404 Not Found');
} else if ( empty($feed) ) {
    @header('X-Pingback: '. get_bloginfo('pingback_url'));
    @header('Content-type: ' . get_bloginfo('http_media_type') . '; charset=' . get_option('blog_charset'));

Then in ./wp-includes/template-functions-general.php, find…


    case 'html_type' :
        $output = get_option('html_type');
        break;
    case 'version':
        global $wp_version;
        $output = $wp_version;
        break;

Replace with…


    case 'html_type' :
        $output = get_option('html_type');
        break;
    case 'http_media_type':
        global $http_media_type;
        $output = $http_media_type;
        break;
    case 'version':
        global $wp_version;
        $output = $wp_version;
        break;

Lastly in ./wp-content/themes/your-template/header.php, find…


<meta http-equiv="Content-Type" content="<?php bloginfo('html_type'); ?>; charset=<?php bloginfo('charset'); ?>" />

Replace with…


<meta http-equiv="Content-Type" content="<?php bloginfo('http_media_type'); ?>; charset=<?php bloginfo('charset'); ?>" />

Depending on your theme, you may need to fix up the CSS, as <html>… being the root element and all, is now the canvas!

I’ve prepared a patch for WordPress 1.5.x to enable application/xhtml+xml and some more, which applies all the above changes plus fixing Kubrick as its CSS by default doesn’t quite work in “Draconian Mode™”. You can apply the patch by downoading it to your WordPress directory and issuing a simple:


patch -u -p1 < wordpress15x-xhtmlmime.patch

Happy patching! :D

Filed under: Software

eAccelerator 0.9.3 Release Candidate 1 released!

Posted by Jonathan at 01:00:36 UTC on the 10th of May, 2005

eAccelerator, the official opensource successor to the awesome PHP opcode accelerator, Turck MMCache has released it’s first Release Candidate which contains many fixes for PHP4 & PHP5 users. So help the guys out in futhering speed & stability of the product by installing it on a server, have a good play and report any bugs! :D

Filed under: Software