Blasphemy! Blasphemy!

April 29th, 2009

The Irish economy is struggling like an evolutionary teacher in the Bible Belt. So our government has decided that what’s needed is a law to punish blasphemy. The country is falling apart, and instead of a government working to get us out of the hole they dug we get this shit instead:

“Minister for Justice Dermot Ahern proposes to insert a new section into the Defamation Bill, stating: “A person who publishes or utters blasphemous matter shall be guilty of an offence and shall be liable upon conviction on indictment to a fine not exceeding €100,000.”

“Blasphemous matter” is defined as matter “that is grossly abusive or insulting in relation to matters held sacred by any religion, thereby causing outrage among a substantial number of the adherents of that religion; and he or she intends, by the publication of the matter concerned, to cause such outrage.”

This is crazy. It’s not the Middle Ages. If I want to call a make-believe deity names, then I will. If I want to insult idiots who believe that world is 6,000 years old and that evolution is a lie, then I will. These people are retards – the god they believe in is a retarded superstition.

Feel free to argue your case in a rational manner, it’s your right to free expression to do so. But it’s also my right to insult the ridiculous.

Paul O’Connell – Lions Captain

April 21st, 2009

Paul O’Connell has arrived in London. Rumour has it that tomorrow Ian McGeechan will announce Paul as the man who will lead the British & Ireland Lions in South Africa.

More on RTE and the BBC.

Pirate Bay Founders Guilty of Copyright Infringement

April 17th, 2009

Just announced that the founders of The Pirate Bay have been found guilty of breaking copyright laws.

They’ve been fined €2.7 million and given a year in prison.

No doubt they’ll appeal.

There’s an online news conference at 1pm Swedish Time (GMT+1 / CET).

Ryanairs Latest PR Stunt

April 17th, 2009

Ryanair are running a “survey” to let passengers decide what they will charge extra for on their flights and fat people are not going to be happy.

The survey is designed to help Ryanair decide what it’s next ancillary charge will be. Ryanair is just as famous for charging for extras as it is for its low flight costs. In February it announced that it was considering implementing a charge to use the bathrooms on-board.

The choices on the survey are:

  1. €1 for toilet paper – with O’Leary’s face on it,
  2. €2 “corkage” fee for passengers who bring their own food,
  3. €5 annual subscription to access Ryanair.com,
  4. €3 to smoke in a converted toilet cubicle,
  5. Excess fees for overweight passengers based on body mass index.

At the moment, there are 12,000 votes for excess fees for overweight passengers. The question I want to ask is why?

If you look closer at the questions you’ll notice that the first four options mention a price. If you’re a Ryanair customer you’re going to think that if you pick any of the first four, it’s going to end up costing you extra to fly.

On the flip side, people usually find it hard to recognise that they are medically over-weight. The last option then says to these people “it’s not going to cost me anything, so I’ll vote for that option.”

A persons Body Mass Index, (BMI), can be difficult to judge visually, as it’s linked to weight and height. Most people, when asked, would not consider themselves obese, but according to the BMI many of them would be. (You can check your BMI on the chart below.)

BMI - Check your height against your weight.

BMI - Check your height against your weight.

But even when your BMI is considered to be overweight it’s not necessarily so. The BMI is only considered a rough guide, being overweight can only be confirmed by measuring the amount of body fat. So if you’re young, old, infirm, or an athlete, the BMI is not going to be accurate.

All of which means that there’s actually a larger number of medically overweight individuals flying with Ryainair than you think. So more happy days for Ryanair, less happy days for their customers.

If you wanted to “beat” the survey, which option should you choose? The obvious one is to pick the “€3 to smoke in a converted toilet cubicle”.

Why? Because there are a lot less smokers than non-smokers, smokers are used to not being able to smoke on an aircraft, and least of all, they’ll never be able to bring it in as it would breach the governments smoking in the work place ban.

So throw a spanner in Ryanair’s works and vote for the smoking option.

Plugin Review – Add Twitter RSS

April 16th, 2009

It’s proving to be a great week for my plugin’s. Following on from WordCast PodCast mentioning WP Frame Breaker, Weblog Tools Collection have just posted a review of another one of my plugins – Add Twitter RSS.

If you use Add Twitter RSS, head on over and let them know what you think.

Add as always, feedback and requests for more options are always welcome.

WordCast Pod Cast

April 15th, 2009

My WP Frame Breaker plugin gets a mention on this weeks WordCast PodCast: WordCast 51: Big-Wheeled Sedan. How cool is that?

You can hear more at about the 49:35 mark.

Thanks to the guys at WordCast PodCast for the mention.

WordPress 2.8 – New Widget API

April 14th, 2009

WordPress 2.8 and the new Widget API

WordPress 2.8 is due sometime this month, and one of the major changes is the new Widget API.

Hand in hand comes the new Widget Panel which uses AJAX to update your sidebars. The latest beta has the new Widget Panel included:

WordPress 2.8 Widget Panel

WordPress 2.8 Widget Panel

Still very much a work in progress, the Panel doesn’t fully work yet and there’s a bit of work to be doen on the presentation side.

Multi Widgets

The biggest change is going to be for plugin writers. The new Widget API is designed to make the process of writing widgets, especially multi widgets easier.

As anyone who has ever written a multi-widget will tell you, the documentation is virtually non-existent and what tutorials are available are cryptic.

The Widget API

As 2.8 will be released in the near future, now is the time to start thinking about updating your widgets to take advantage of the new API. As the Widget API isn’t fully documented yet, I decided to have a look at the source files to see what’s involved in writing a widget using the API.

The relevant files are:

  • /wp-includes/widgets.php
  • /wp-includes/default-widgets

Using the Widget API

The new Widget API provides a WP_Widget class and it’s by extending this class that you create your own widget. Your widget then over-rides 3 three methods within WP_Widget:

  1. widget()
  2. update()
  3. form()

The easiest way to demonstrate this is by creating a basic text widget. So we’ll build a WordPress 2.8 Text Widget.

Building Your Widget

As with the current version of WordPress, your widget needs to contain the some basic information so that WordPress will recognise it as a plugin:


<?php
/*
Plugin Name: New Widget API
Plugin URI: http://www.paulmc.org/whatithink/
Description: Demonstration of the WordPress 2.8 Widget API
Version: 1.0
Author: Paul McCarthy
Author URI: http://www.paulmc.org/whatithink
*/

The first step is to create your widget class by extending WP_Widget:


class WP_My_Widget extends WP_Widget {

Your widget needs a constructor, that is, a function that will be called when the widget is loaded. Your constructor must have the same name as your widget. Within the constructor, specify an array to hold your widget options, control options and call the WP_Widget constructor.


function WP_My_Widget() {

$widget_ops = array ('classname' => 'my_widget', 'description' => __('The description for your Widget') );
$control_ops = array ('width' => '300', 'height' => '400');

$this->WP_Widget('my_widget', __('My Widget'), $widget_ops, $control_ops);

}

Once you’ve created your constructor, it’s time to over-ride the methods needed to make your widget work. The first method to over-ride is widget().

The widget() method is where your widget does it’s work. The widget() method takes two parameters. The first provides you with access to the widget display settings and the second provides access to that particular instance settings.

As this is a simple text widget, we’ll use just two settings – title and text.


function widget($args, $instance) {

extract ($args);

$title = empty($instance['title']) ? __('My Widget Title') : apply_filters('widget_title', $instance['title']);
$text = apply_filters('widget_text', $instant['text']);

echo $before_widget . $before_title . $title . $after_title;
echo $text;
echo $after_widget;
}

The next method that we’ll over-ride is the update() method. This method provides us with the means to update and save our widget settings. It takes two parameters, the first is an array that contains the settings provided by the user via the widget form, and the second is an array containing the old settings for the widget.


function update ($new_instance, $old_instance) {

$instance = $old_instance;

$instance['title'] = strip_tags($new_instance['title']);
$instance['text'] = $new_instance['text'];

return $instance;
}

That’s it. All the method does is store the old settings in an array, update the array with the new settings and then pass the new settings back to the WP_Widget class. The WP_Widget class handles the actual updating and saving.

Our next method to over-ride is form(). This method is used to display the widget control form. It takes one parameter, an array with the current settings.


function form ($instance) {

$instance = wp_parse_args( (array) $instance, array('title' => '', 'text' => ''));

$title = strip_tags($instance['title']);
$text = format_to_edit($instance['text']);

?>

<p>
<label for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Title:'); ?>
<input class="widefat" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" type="text" value="<?php echo attribute_escape($title); ?>" />
</label>
<textarea class="widefat" rows="16" cols="20" id="<?php echo $this->get_field_id('text'); ?>" name="<?php echo $this->get_field_name('text'); ?>"><?php echo $text ?></textarea>
</p>

<?php
}
}

That’s it. A simple text widget written using the WordPress 2.8 Widget API.

If you’d like to review the full code, with comments, then you can download it here:

New Widget API Plugin File

Wall-E Case Mod

April 9th, 2009
WALL-E Case Mod

WALL-E Case Mod

Via Damn Cool Pics.

That is damn cool!

Edit: Opps. Forgot the link!

New Plugin – WP Frame Breaker

April 8th, 2009

For all you WordPress authors out there unhappy with Diggs new policy of putting outbound links in a frame, here’s an easy way to break out of the frame – WP Frame Breaker.

Follow the link to read more and download the WordPress Plugin.

Letter of the Day – N

April 8th, 2009

N is for Nice

It’s so kind of you to say!

Nice is a Unix program used to change the priority of processes. Mainly used in cases where you want a particular program to run at a higher priority than normal.

Renice is used to change the priority of processes already running.

Just one of those commands that you’ll probably never use.