A complete guide to using Thickbox in the WordPress admin, despite the ingenious traps laid by the developers of the media manager and Thickbox itself. With this guide in hand, you too can shout out ‘Spaaaartaaaaa’ and kick bad code into a big-ass hole in the ground.
Monthly Archive for February, 2010
Via a @codinghorror retweet, a comprehensive article on the history of driving on the left versus the right side of the road through history and geography revealing first:
In the late 1700s, however, teamsters in France and the United States began hauling farm products in big wagons pulled by several pairs of horses. These wagons had no driver’s seat; instead the driver sat on the left rear horse, so he could keep his right arm free to lash the team.
And secondly:
An official keep-right rule was introduced in Paris in 1794, more or less parallel to Denmark, where driving on the right had been made compulsory in 1793.
First of all, suck it France. We may have made a short-sighted decision, but at least we were first.
But secondly, that was really quite a loss for horseback riders as well as bicycle riders — a mode of transportation that would rise to prominence about a hundred years later in the late 1800’s, and which is to this day remains the easiest way to get around Copenhagen — as both most commonly dismount to the left, which when you drive on the right, is into traffic.
Sweden found itself driving on the left side of the road up until 1963, even though all the countries around it had long since started driving on the right (Denmark for about 180 years). The practical implications in terms of import, compatibility with neighboring countries and so forth made the otherwise ‘right’ choice wrong, which the Swedish government reacted to, despite little apparent backup from their population at the time:
In 1955, the Swedish government held a referendum on the introduction of right-hand driving. Although no less than 82.9% voted “no” to the plebiscite, the Swedish parliament passed a law on the conversion to right-hand driving in 1963. Finally, the change took place on Sunday, the 3rd of September 1967, at 5 o’clock in the morning.
Today I’m pretty sure Swedes agree that despite whatever hassle it may have been at the time, the long-term benefits have been well worth it.
So as in an episode of GI Joe, what have we learned today?
Laziness and short-sighted solutions have a way of sticking around a lot longer than the reasons for which they were chosen. In those cases, dropping idealism for pragmatism can be a net win. And in the end, as Dick Jones said about Bob Morton, it really never is too late to erase that mistake.
With the exception of the two first seasons, it seems like a law onto itself that every season of Lost has to start a bit ‘off’. Not necessarily bad in any easily distinguished manner; merely ‘off’. And I think the same has held true for this, the last season, until now. Episode 3, ‘The Substitute’ was the episode to finally break in the season for us. I would love to find the time when once in the future we sit down and re-watch the show from beginning to end and find out what the deciding factors are. Something tells me there’s a recurrence amongst some of the directors and writers among who that special Lost-ness really thrives.
They may be better craftsmen, but above everything else, it seems, at least for me, that there’s also another thing that usually characterizes those best episodes. Namely that they’re the character portraits. The first two episodes of this last season were mostly plot-driven, catching up on events from the previous season and setting up the events that will drive this season. Getting the pieces lined up. ‘What Kate Does’, episode 2, had its moments, but was still, at least in my opinion, more concerned with plot than character, whereas The Substitute was almost entirely character-driven.
It certainly helps that Terry O’Quinn delivers such a fantastic performance as Locke, but the episode itself was also filled to the brim with narrative glee and one amazing scene after another, all centered around the character of Locke. Yes, there’s the whole alternate timeline to keep things fresh, but it’s still pretty impressive how even after five seasons, the Lost team manages to twist and turn the character in new and fascinating ways.
I could gush over Lost all day, I really could, but if you’ll excuse me, I’ve got some Fringe forums to troll.
While WordPress ships with jQuery, it’s often a few updates behind the latest version. Since jQuery 1.4 is just out, I wanted to use it with K2. That in and of itself is fairly easy, and a simply matter of deregistering the ‘jquery’ script and registering a new one. While looking for a proper solution I came across this rather crude way of going about it quite a lot, and it’s a horribly way of going about this, and will (and has probably) undoubtedly result in old plugins and themes blindly overwriting newer version of jQuery with their own, once new hotness, now old and busted version of jQuery.
Ugh.
This PHP code snippet checks to see if the passed version is later than the one currently registered, and makes sure we’re not in the admin (just to be sure).
If our version is indeed newer than the one currently registered, we go ahead and grab the idol… eh, swap jQuery’s.
/**
* Register a later version of jQuery if it’s later than the one currently in WordPress
*
* @param {String} our_version The version of jQuery we want to upgrade to if needed.
*/
function upgrade_jquery( our_version ) {
// We want to use the latest version of jQuery, but it may break something in
// the admin, so we only load it on the actual site.
global $wp_scripts;
if ( ( version_compare(our_version, $wp_scripts -> registered[jquery] -> ver) == 1 ) && !is_admin() ) :
wp_deregister_script(‘jquery’);
wp_register_script(‘jquery’,
get_bloginfo(‘template_directory’) . ‘/js/jquery.js’,
false, our_version);
endif;
}
add_action( ‘wp_head’, upgrade_jquery( ’1.4.1’ ) );
It sure would be neat if this was built straight into WordPress’ wp_register_script.
So Alessandrini put out a challenge on Twitter:
All those who think no flash on ipad is A-OK please uninstall flash from your current browser, use that for a month then get back to me.
So I’ve gone halfsies and installed FlashBlock for Chrome, which forces me to click whenever I need to see something Flash-based, and I’ll use this entry to report, as the month goes by, what things I would have been unable to do or see due to the lack of Flash. This isn’t meant to prove that everyone will do fine without Flash, nor even that I will. Rather, it will highlight issues to overcome in the near future as well as tell me and you something about my internet habits in relation to Flash.
Or in other words: I walk the walk, but do I talk the talk?
And this timeline of the Lost universe. Which yes, is begrudgingly built in Flash (but the Times are about the only place doing interesting things with Flash, so…)