Categories
Blog

My Veidt toy ad in the Watchmen movie

Yes, I’m still talking about this.

At 2:11:17, you’ll see Veidt’s wall of TVs, and for a brief four seconds, my ad appears on screen, along with what I have deduced (deduced means ‘guess’, right?) are the following videos.

Adrian Veidt watches a wide array of TV
Adrian Veidt watches a wide array of TV
Real Men Use Veidt Sylvester & Tweetie a Harrier jet missile Nostalgia ad Rambo: First Blood Part II tits! ?
Altered States Wendy’s “Where’s the Beef?” commercial episode of Night Court The Road Warrior Nixon re-elected / security camera feed 1984 Apple’s Macintosh commercial The Manchurian Candidate? *UNAIRED* OZYMANDIAS TOY AD!!! 1985
The Prisoner This Island Earth Haredevil Hare ? missile footage Addicted to Love hot air balloon? more porn

I can’t be certain about The Manchurian Candidate (it could even be an episode of The Twilight Zone for all I know), and have no idea where that hot air balloon is from. Maybe someone can help me out in the comments?

Categories
Blog

Getting 5.1 audio out of a Mac Mini

“Why does it keep getting quieter?” a special lady friend asked while listening to a Genesis 5.1 audio DVD on my Mac Mini media PC.

After some digging, I found this, which I hadn’t realized:

To turn on 5.1 audio in Apple’s DVD player, Choose DVD Player > Preferences, and then click Disc Setup. At the bottom of that window, change the Audio output setting to “digital out” and (very important) check the box next to “Disable Dolby dynamic range compression.” Voila! Your DVD’s 5.1 sound is now streaming out of your Mac Mini.

Thanks to HVY TK’s how to enable 5.1 sound output from a Mac Mini and Jen for bringing over music about settings on the Mellotron and mowing the lawn.

Categories
Blog

Customizing an RSS feed using Drupal and Views

Note: This has only been tested with Drupal 6.x.

For some boneheaded reason, the latest version of Views for Drupal doesn’t let you customize the fields output in an RSS feed. If you create a new feed view, under the Fields block, you’ll get a message saying “The style selected does not utilize fields.” Well la de da. This means you’re stuck displaying the default content, despite which fields CCK says it is displaying or hiding.

Of course. Why would you want to customize your fields, anyway?

So here’s how I was able to customize the RSS fields output by including the entire node in the RSS feed results. If you want a tutorial on how to first setup an RSS feed, there’s a tutorial on creating a custom rss feed in Drupal.

Now that you have your feed setup, you’ll see there’s nothing you can do with it. But there is a Views function you can overwrite in template.php to add more data to the output rows.

/**
 * Default theme function for all RSS rows.
 */
function phptemplate_preprocess_views_view_row_rss(&$vars) {
  $view     = &$vars['view'];
  $options  = &$vars['options'];
  $item     = &$vars['row'];
 
  // Use the [id] of the returned results to determine the nid in [results]
  $result	= &$vars['view']->result;
  $id		= &$vars['id'];
  $node		= node_load( $result[$id-1]->nid );
 
  $vars['title'] = check_plain($item->title);
  $vars['link'] = check_url($item->link);
  $vars['description'] = check_plain($item->description);
  //$vars['description'] = check_plain($node->teaser);
  $vars['node'] = $node;
  $vars['item_elements'] = empty($item->elements) ? '' : format_xml_elements($item->elements);
}

I need to get a real code parser. This is just embarrassing.

What I’ve done above is use the 'result' array and 'id' value returned in the &$vars variable to determine the node ID of the returned results. The ID is just the position the node appears in the list of results (1,2,3,etc.). It’s one higher than the keys to the objects in the ‘results’ array (0,1,2,etc.) so just tell the function to get the nid in the object at position ID minus 1, and now you have the nid of the result. I load the nid into the &$vars array to be sent to the Views template, which I’ll get to now.

Views already has support for templates, but my complaint with its templates — like my complaint with much of Drupal — is that it gives you a half-finished template. It doesn’t give you the perfectly-rendered, nicely polished HTML to want, and it doesn’t give you an array to customize how you see fit: it gives you something in the middle, usually consisting of an array of preformatted elements. So thanks for that. I hope you like all your content wrapped in <p> tags! Well, most of the time, anyway!

Ahem, where was I? Ah, the template. Views recommends using a template called views-view-row-rss.tpl.php (you’ll notice it corresponds to the function name above). This is the most generic RSS template, but you can use a more specific one if you don’t want to use the same formatting on all your RSS feeds. Now that you have the $node variable at your fingertips, you can put any of the node content in the feed. Here’s what I did with it.

< ?php
// $Id: views-view-row-rss.tpl.php 3296 2009-05-27 23:08:21Z timtoon $
/**
 * @file views-view-row-rss.tpl.php
 * Default view template to display a item in an RSS feed.
 *
 * @ingroup views_templates
 */
?>
  <item>
	<title>< ?php print $title; ?></title>
	<link />< ?php print $link; ?>
	<description>![CDATA[< ?php 
		$desc = $node->field_teaser[0]['value'] ? $node->field_teaser[0]['value'] : $node->body;
		print nl2br(check_plain(trim($desc)));
	?>]]</description>
	< ?php print $item_elements; ?>
</item>

Christ how can anyone read that. Fixed! Anyway, nothing too fancy here. I don’t like Drupal’s auto-truncating teaser field, so I’m using my own in a custom field called field_teaser. But if there is no field_teaser value, use the whole node body. I hope this isn’t too many unrelated things to make a clear example.

Now that I have my node’s teaser/body, I trim the content, use Drupal’s check_plain function to do the same thing as PHP’s strip_tags method, and convert the new lines to line breaks using nl2br.

So your RSS reader won’t try to parse those <br /> tags as XML, I enclosed the content in <![CDATA[ ... ]]>, so now you won’t lose any formatting that wasn’t just stripped out by check_plain.

At last, I have a custom-formatted RSS feed showing only the field I want. I can use this to put whatever node content I want into my RSS feed, and if you have been able to follow my rambling example, so can you!

There is another method here: Control Title link and “read more” in RSS Feed of views

Categories
Blog

Home Theater Roundup

I went through half a dozen home theater receivers last year, trying to find one that would work connected to my Mac Mini media PC. Here are the results:

Categories
Blog

Who’s #1? You are, Number Six!

I recently had cause to re-watch The Prisoner because a friend of mine hadn’t seen it in nearly eight years and wanted to revisit the series. On the DVD cover was the slogan “no man is just a number” and she remarked on how that saying actually betrayed the intent of the series — a revelation that left me taken aback. To me, Number Six was never just a number, as he so adamantly asserted. He was a free man. But then I was reminded that in the final episode (spoiler alert!), it was revealed that the long-elusive Number One turned out to be none other than Number Six himself. He was a number after all.

Categories
Blog

Maybe I’m doing it wrong.

Consumerist posted this beautifully animated short visualizing the credit crisis.


The Crisis of Credit Visualized from Jonathan Jarvis on Vimeo.

Incidentally, I sure hope I don’t find out how insanely popular this video game reviewer is.

Categories
Work

How to choose the right CMS

I love that they mention a list of what CMSs to avoid and it contains one item.

via Web Designer Depot

Categories
Work

Fix to Drupal to allow NOW() and CURRENT_TIMESTAMP in new tables

This is why I hate CMS software — their incessant, misguided need to over-abstract every little detail. Take for example Drupal’s system for including additional tables into your existing MySQL database. Drupal would have you create a needlessly complex multidimensional array of all the elements in your new data table schema, created with a separate function and called by another custom Drupal function. Because I guess including the actual SQL to create a table was just too fucking simple.

So here’s Drupal’s way of doing it. I hope you like nested parens!

Categories
Work

CMS Madness

Unix gets a bad rap for having an abundance of many needless flavors when — since they all use the same OS — most of the time you’re getting a choice of vanilla, french vanilla, and fat-free vanilla.

But worse than that is the proliferation of more varieties of content management systems then there has any reason to be. Why should I feel limited to just Drupal or Joomla, when there’s tons of suck to go around? If you’re building a new website and would much rather learn some other programmer’s (or worse, a committee of programmers) byzantine system of content management, visit http://www.cmsmatrix.org to view this utterly baffling plethora.

Categories
Work

Joomla vs. Drupal

It’s been my experience that content management systems are each their own special flavor of bad, in particular because they all seem to do a lot of things except the one thing you absolutely need them to do.

As a programmer, I find it a little backwards that I learned PHP and MySQL so I can create my own applications, but with a CMS I am not using those skills — instead I spend most of my time figuring out someone else’s idea of how to build applications and trying to see if what they wrote will work for me.

Awhile ago, CMS Report did a comparison of Joomla vs. Drupal, and as a survivor of building websites with Joomla, I was interested to hear whether there was anything good to say about it.

Drupal fails on such elements as Shopping Carts, Event Calendars, Document Management, and Themes. The majority of these items are functions or features which are considered lacking in the Drupal CMS. Regarding the other CMS, Joomla fails to deliver in such elements as user permission, content management, multi-site management, and standard’s compliance. Joomla fails in elements that are more architecture centric.

Let me go over that again: Joomla fails at content management. For a content management system, that’s pretty bad.