Hanging Out in Boston

21 June 2009

I arrived in Boston about 5pm yesterday. Unfortunately, my early flight on AA had been cancelled and they put me an a layover at DCA schedule, so my expected arrival went from 10am to 5pm. This also meant that I missed the American Craft Brewing Festival that Jon had been working at on Friday & Saturday. We decided to head out, eat at Sunset Grille & Tap, and then play some pool at the bar on the top floor of the same building.

Today we explored Cambridge, got free ice cream from Ben & Jerry’s, ate at the post-Festival brunch buffet that the Publik Roadhouse hosted for all the folks who staffed the Brewing Festival, and went shopping at REI for a new rain jacket for Jon. Also, on the way over to REI, I got to check out Fenway Park from the car.

Sphere: Related Content

Comment

---

100 Days Address

29 April 2009

Barack Obama’s been in office for 100 days as of today. Hulu (among many other online video streaming providers) is going to be showing it live.

[removed live embed video after the fact]

Sphere: Related Content

Comment

---

Movers

23 April 2009

Pew says that Missouri had a net gain of about 14,000 last year. According to their study, those gains were of Whites and Hispanics while there was a net loss of Blacks and Asians.

Missouri Moving statistics

I wonder what this says about the Political makeup of Missouri. I’m inclined to think that this gain is increasingly shifting the landscape purple (from red). Especially as the majority of these movers are coming from traditionally blue states. Notice that Illinois & NY are losing alot. Although, the folks moving out of Illinois (and maybe into Missouri are probably from south of I-80, which means they are most likely republican. So…who knows…

Sphere: Related Content

Comment

---

ACM Presentation

18 March 2009

Walker Hamilton speaks to ACM, originally uploaded by interpunct.

I spoke at ACM in Chicago on March 11th. My presentation was about the work I was allowed to be a part of while on the staff of the Obama New Media Team.

Sphere: Related Content

Comment [3]

---

New Textpattern Callback Event

10 December 2008

There exist several plugins within the pantheon of textpattern plugins that could really use a tweak or addition to the callback system that allows for event-based plugin integration.

The two plugins most concerning me are wlk_article_glyph and wlk_sphereit. Both of these require that the user of the plugin replaces the <txp:body /> tag in their article form. This is inconvenient, at best. For instance, should a user wish to employ both of these tags, they will quickly find that they cannot.

wlk_sphereit, as part of the Sphere.com indexing method, generates it’s own body tag so that it can add some tags around the body to improve the Sphere search engine’s indexing capabilities (and it’s specificity…what is and isn’t article content).

wlk_article_glyph was created in a few minutes at the request of someone of the textpattern forums as a method of adding a glyph to the end of an article, as they do in some newspaper and magazines.

So, to allow both of these to work in textpattern, I forked the unofficial dev 4.0 branch over at github and started hacking at it.

First I added a new callback_event function called “callback_out_event”. This function is only in use in areas like <txp:body /> and <txp:excerpt /> so I removed the $step and $pre variables. Also, I created this function because, while php5 will let you set a default attribute for a function argument that’s being passed by reference, php4 will not.

function callback_out_event($event, &$the_out)
{
	global $plugin_callback;

	if (!is_array($plugin_callback))
		return;
	$return_value = '';
	foreach ($plugin_callback as $c) {
		if ($c['event'] == $event) {
			if (is_callable($c['function'])) {
				$return_value .= call_user_func($c['function'], &$the_out);
			}
		}
	}
	return $return_value;
}

I also now pass by reference whatever variable is being returned by the tag function where I’m placing the callback event. In the case of the body tag, I placed it here:

function body()
{
	global $thisarticle, $is_article_body;
	assert_article();

	$is_article_body = 1;
	$out = parse($thisarticle['body']);
	$is_article_body = 0;
	callback_out_event('pre_body_render', $out);
	return $out;
}

So that my plugin function that’s accessing the callback can access it like this:

register_callback('wlk_test_body', 'pre_body_render');

function wlk_test_body(&$content) {
	$character = '&#9733;';

	if(substr($content, -4)=='</p>')
	{
		$content = '<!-- sphereit start -->'.
				substr($content, 0, -4).' '.
				$character.
				'</p><!-- sphereit end -->';
	}
}

The wlk_test_body function gets called whenever the pre_body_render callback is called. I can access the body content (as it’s passed by reference) and add whatever I need to the body.

I have created a test plugin which you can download here. Also, the textpattern source code fork is here

Sphere: Related Content

Comment [5]

---

« Older