Archive for August, 2004

New mozilla.org

August 31st, 2004 by daryl

As noted here and many other places around the Web (later if not now, no doubt), Mozilla has launched a new site that features the Firefox and Thunderbird products. If you haven’t checked out these applications, you’re missing out.

Fair and Balanced

August 30th, 2004 by daryl

I’m a busy guy and, while I’m interested in news and politics and would like to keep up with them, I’ve got other priorities. Accordingly, I’m always in danger of being over-credulous of what I do hear on the news (my primary news source being, ahem, The Daily Show). My mom and I have hashed this out before, and not (I think) without hurt feelings. Because I latched onto whatever liberal propaganda seemed probably at the time to be right, she accused me of not thinking critically. And because she bought whatever the Bush propaganda bureau spat out and smirked openly at any other input as part of the liberal media’s nefarious plot to turn the world into a bunch of Jesus-hating abortionists, I thought her view was a little narrow as well. (It’s vaguely possible that my recollection of her approach has been colored somewhat by a bruised ego at having my critical thinking skills questioned, whether or not I had, in this particular instance, showed myself to be in possession of an abundance of such skills.)

There is a difference, after all, between monitoring news sources oriented toward the opposite political spectrum than your own for the sake of being able to find a middle-ground approaching the truth and doing so for the sake of sneering at the sources and rejecting out of hand anything they have to say because there happens to be a Bush propaganda bureau come-back posted on the Freepers board. Maybe it’s not fair of me to suggest that anybody actually does this, or at any rate intends to do this.

Lucky for those of us short on time and patience, a purportedly non-partisan watchdog organization has emerged to call both parties to the carpet for their disinformation campaigns this year. Spinsanity today has featured such headlines as the following:

  • Cheney’s not-so-Freudian slips
  • From technically true to blatantly false
  • The myth of Kerry knowingly volunteering for dangerous duty lives on
  • The phony attack on Bush’s stem cell research “ban”

The first two items note some pretty blatant propaganda efforts on behalf of the Bush administration. The last two describe ways in which the Kerry campaign is at best equivocating and at worst exploiting a misunderstanding about Kerry’s war record. Everybody’s guilty, and nobody’s spared. This seems an ideal way of keeping track of who’s playing what tricks during this year’s campaign. It’s a way of getting (apparently) non-partisan information without having to stay tuned in to six networks with varying political affiliations in order to filter out the noise and have a halfway decent chance at evaluating the candidates based on their merits rather than on what lies the other side happens to be telling about them.

I rather doubt anything I read at Spinsanity is going to change my mind about whom I’m voting for. It’d take a pretty big piece of dug-up dirt to do that. But reading the headlines does make me feel a little better about my level of credulity, as if I’m doing at least a little diligence rather than voting for one guy (who may or may not be a douchebag) because I happen to think based on the Jesus-hating, abortionist-cultivating liberal media’s spin that the other guy is a clod and a menace to polite civilization.

Some Reasons I Use Firefox

August 25th, 2004 by daryl

We’ve secretly replaced the browsers at Company X with the new and improved Browser Y. Let’s watch on hidden camera to see what happens.

You probably have to be a child of the ’80s to get that. Several things bring the browser wars to mind. Foremost is my recent involvement with a soon-to-be-unveiled project to promote the Firefox browser, in addition to my own fairly recent switch to Firefox.

Post-foremost is my having been directed to Browse Happy, a project sponsored by the Web Standards Project with the aim of showing people that there are alternatives to the usual suspect, Microsoft Internet Explorer. They go out of their way to note that they have nothing in particular against Microsoft but that there are superior, more secure, standards-compliant browsers out there that many non-power users may simply not know about.

I’m also reminded of a blog entry I read here recently whose author complains about sites that tell him he should use Firefox. He cites a couple of debatably incorrect reasons he uses MyIE2 instead of Firefox, and he gripes that he’s big enough to decide on his own what browser to use. Fair enough. So I’m not going to tell you you should use Firefox (though I don’t think it’d be a bad idea), but I’m going to tell you briefly a few of the reasons I use it.

  • It’s free. Debatably, so is IE, but it comes at the cost of using Windows. That’s not free.
  • It’s free. This is important for two reasons, the first of which is economic. The second is more socio-political. I believe in the free software movement, which is in many ways similar to grassroots movements, which I find empowering and appealing.
  • It’s frequently updated with fixes. Last major revision to IE was a couple of years ago, right?
  • It’s extensible. If I want to add behavior to my Firefox, I can do so with relative ease. By which I mean that (as a standard user) I can download extensions or that (as a programmer) I can write my own.
  • It’s cross-platform. I can have the same environment on my Windows box and my Linux boxes (or my Mac, if I had one).
  • It’s less than a browser and more than a browser. That is, it’s a lean browser, slim on many of the bells and whistles that constitute bloat unless you choose to install extensions. But it’s also a lot more than a browser because it has the Gecko engine underpinning it, and you can take advantage of that to use Firefox (using XUL) as a development platform. Much more than a browser.

If you happen to be game for learning more after reading this briefest of summaries of why I use Firefox, try downloading it here.

Amazon Wishlist Updated Again

August 17th, 2004 by daryl

I’ve added some functionality to the Amazon Wishlist plugin that allows the user to define where to display the output. As in the initial version, the output can be displayed immediately after the category listing. This option will be best for those not inclined to edit their templates in any way. The second option is to invoke a function named “get_amazon_wishlist()” within any template to display the information.

In order to display the book information as a coda to the category listing, one need only edit the plugin’s first line of uncommented code:

[php]
$aw_show_after_cats = 0;
[/php]

Setting this variable to 1 causes the book to be displayed automatically after the category listing.

Leaving the variable set to 0 suppresses the automatic display of the book. If you wish to apply the plugin to your templates manually, you’ll need to edit wp-includes/template-functions-general.php to add the following function:

[php]
function get_amazon_wishlist(){
echo amazon_wishlist(”");
}
[/php]

Optionally, you could also just add the following inline within your template:

[php]
echo amazon_wishlist(”");
[/php]

Both methods simply call the plugin function.

The revised plugin can be downloaded from the original url, here.

Words, Words, Words

August 17th, 2004 by daryl

I recently happened to be on the receiving end of an out-of-the-blue $300 gift certificate to Amazon. This was very convenient, as there were a couple of books I had been wanting. On top of the books, I picked up a couple of magazine subscriptions that I wouldn’t otherwise have bought (one of which my subscription to had just run out). Purchases included the following:

  • The Broom of the System, David Foster Wallace (already had this, but it’s apparently on permanent loan to a friend I haven’t seen in a couple of years)
  • Oblivion: Stories, David Foster Wallace (his newest)
  • Pippi in the South Seas (for Lennie)
  • Pippi Goes to School (for Lennie)
  • Fox in Socks (ostensibly for Lennie; really more for me)
  • Baby Whales Drink Milk (Mleeka wanted this one for Lennie)
  • Sir Cumference and the Dragon of Pi: A Math Adventure (for Lennie)
  • Crossroads of Twilight, Robert Jordan (for Mleeka)
  • JR, William Gaddis (I read this a few months ago but wanted to own it; it’s one of the most dazzling books I’ve ever read)
  • Agape Agape, Gaddis (his last)
  • The Rush for Second Place: Essays and Ocassional Writings, Gaddis (rounds out my collection of all of his work)
  • A Devil’s Chaplain: Reflections on Hope, Lies, Science and Love, Richard Dawkins
  • You Bright and Risen Angels, William T. Vollmann (seemed sort of up my alley; I’ve never read this guy before)
  • Quicksilver : Volume One of The Baroque Cycle, Neal Stephenson (I read Cryptnomicon a few years ago and thought it was tolerably decent, so figured I’d try this out.)
  • Mencken Chrestomathy, H.L. Mencken (I’ve been meaning to read more of him for some time, and this collection is a nice sampling of his work on a range of topics.)
  • The Baby Book: Everything You Need to Know About Your Baby from Birth to Age Two, James Sears
  • The Great All-American Wooden Toy Book (I’d like to make some toys for Lennie and Zac and Ella.)
  • My First Magic Set (for Zac, whom I’m going to try to teach to do magic tricks if he’s interested)
  • Harper’s Magazine (David Foster Wallace has written a lot for them, and it seems like probably a good magazine, so I thought I’d try out a subscription.)
  • Poetry (Probably the oldest and best-known respected poetry magazine going. My subscription recently ran out and I was too stingy to renew, but this windfall allowed me to go ahead and pick up a two-year subscription.)

Whew, lots of reading to get done. I always love getting new books and never know where to start. I just like holding them, having them all stacked up on the coffee table. When I finally got time last night to look at the books, I had trouble deciding whether to go ahead and dig into the not-so-short stories in Oblivion or to pick up the shorter Gaddis essays or the Mencken collection. And then of course I wanted to go ahead and begin rereading The Broom of the System, which made me want to dive right back into another reading of Infinite Jest, which, with my various commitments and spending time with the baby, etc., will take me about six years to get through this time. Ah, to be independently wealthy.

Amazon Wishlist Updated

August 16th, 2004 by daryl

A user reported that the Amazon Wishlist plugin wasn’t returning results from any but the first ten books on her list. Sure enough, I checked, and Amazon’s API returns only ten results at a time. So I’ve extended the functionality. You can now set an option that tells the code whether to check the whole list or whether to check just the first ten books. In order to check beyond the first ten results, multiple requests have to be made. So if your list is 50 pages long (500 books), that’s 50 requests that have to be made to the Amazon Web service in order to display one random book on your site. If you’ve got a lot of books, you might want to opt for selecting from the short list, which I believe will usually represent your most recent additions. In any case, the additional option you can change is at the bottom of all the other variables you can set near the top of the script and looks like this:

[php]
$aw_search_all = 0; //Set to 1 to return all wishlist results rather than first 10 (requires additional requests, so longer processing)
[/php]

It’s set to 0 by default, just to be safe.

I’ve also updated a bug that was causing an occasional error when the author block was being displayed. You’ll definitely want to download the new version (same location as the old version) to get this fixed or you’ll have “invalid argument passed to foreach” errors displayed sporadically on your page.

The next planned update is to allow you to display your book anywhere on the page. Currently, I just piggyback it on top of the category listing. No telling when I’ll get to that update. If there’s any demand, I may also add code that allows you to set a page threshold so that if you have 500 books on your list but want to display from more than the first 10 (but not all 500), you can set a maximum number of requests.

PHPizer Plugin

August 14th, 2004 by daryl

From time to time, I’ll have occasion to include some PHP code in my entries, and PHP’s a lot easier to read if it’s syntax-highlighted. Many forums allow you to wrap special tags around you code to cause it to be syntax-highlighted, and though I’ve seen some WordPress plugins out there for doing syntax highlighting, they’ve seemed a little more complicated that has seemed quite necessary, or they’ve been dependent upon some library or another being in place. So I rolled my own, which can be downloaded here.

If you want to syntax-highlight a code block, just wrap the tags <php> and </php> (replace angle brackets with square brackets) around it and this plugin filters it through the highlight_string() function. You can also specify a div class name that allows you to define a style for the container div. I’ve chosen to set my code off by putting it in a gray box with some margin and padding and a thin border. The default class name is set to “code”. The code itself for this plugin (to demonstrate the plugin in action, which strikes me as being rather like standing between two mirrors and seeing infinity as they reflect one another’s images recursively) is as follows (note that I had to screw with the code just a smidgin to keep it from parsing the php marker tags in the regular expressions — if you want to use this, download the source from the link, as that’s unscrewed-with, commented code):

[php]
$phpizer_div_class=”code”;

function phpizer($text) {
global $phpizer_div_class;
$parse=0;
$codebuffer=”";
$finaltext=”";
$count=1;

//Get lines into an array so we can iterate over them.
$lines=split(”n”,stripslashes($text));

foreach($lines as $theline){
//If we’re starting a code block, set flag and suppress marker tag display.
if(preg_match(”/[ php]/”,$theline)){
$parse=1;
$theline=”";
}
if(preg_match(”/[ /php]/”,$theline)){
$parse=0;
$finaltext .= “

n” . highlight_string(”< ?phpn" . $codebuffer . "n?>n”,1) . “

n”;
$count++;
$codebuffer=”";
$theline=”n”;
}
//Not code, so just add current line.
if($parse==0){
$finaltext .= $theline;
}
else{
$codebuffer .= $theline;
}
}
return $finaltext;
}

add_filter(’the_content’, ‘phpizer’, 8);
add_filter(’comment_text’, ‘phpizer’, 8);
[/php]

Chuck Mangione on my Daughter’s Chest

August 9th, 2004 by daryl

A few weeks ago, we noticed a big ugly purplish, slightly raised blotch on Lennie’s chest. It looked most painful, but she didn’t seem to be bothered by it. We had just gotten home from a weekend trip and wondered if her car seat belt had been too tight and bruised her. When it didn’t go away pretty quickly, we took her to the doctor (this was the occasion of the destruction of my carnie dreams), and it turned out that the mark is a hemangioma, and a pretty darned mild one, based on some of the pictures out there. Naturally, I can’t help but think of Chuck Mangione when I see the mark.

Lucky as one might count oneself to find an acclaimed trumpeteer (and not just a vaguely homophonic birthmark) on his infant daughter’s chest (it’s rather like finding Jesus in a cinnamon bun), I can’t help thinking that I’m luckier than even such a fortunate person to have turned up with a happy, healthy baby.

Amazon Wishlist

August 9th, 2004 by daryl

Another Update (Sept. 3, 2004): I’ve added a category for the amazon plugin that’ll list all relevant posts so I don’t have to keep going back and adding these stupid updates. Be sure to read all posts in the category for complete details.

Update (Aug. 16, 2004): I’ve added some functionality and fixed a bug. Check here for details.

I’ve just written my first WordPress plugin. Actually, I had previously modified the acronym plugin to allow me to specify some common words that should always be associated with links (only later did I notice that the author of the original plugin had already done just this). Amazon Wishlist is my first original plugin, though, and even at that, the bulk of the code isn’t mine. I found a fairly concise script that interfaces with the Amazon API and another that actually handles making the connection, and I wrapped some code around the results to make it all into a nice configurable plugin for WordPress. Incidentally, there is another Amazon plugin here that allows you very easily to browse books and insert them into your entries. Very nifty, but it serves a different purpose.

Installation
You have only to download the plugin, stick it in your wp-content/plugins directory, edit a few variables, optionally add some style sheet definitions, and activate the plugin using your control panel. Straight from the code itself:

[php]
$aw_dev_token=”; //Get this from http://www.amazon.com/gp/aws/landing.html.
$aw_associates_id=”; //Optional; set to empty string if not applicable.
$aw_type=’lite’; //could also be heavy, though it doesn’t seem to make a difference in the search results.
$aw_wishlist_id=”; //The id of the wish list you wish to search. Hint: Search for (don’t simply go to) your wish list and copy the id from the end of the URL.

$aw_header=’Amazon Wish List’; //Used to label the box.
$aw_show_author = 1; //Set to 0 to suppress.
$aw_image_size = ‘Medium’; //’Small,’ ‘Medium,’ or ‘Large’
$aw_show_price = 1; //Set to 0 to suppress.
[/php]

Here’s hoping it’s not buggy and that it helps somebody out. You can see it in action in my sidebar.

Philosophy and the Mirror of Nature

August 8th, 2004 by daryl

David Foster Wallace, one of my very favorite authors, gives us this story in his newest collection Oblivion. I desperately want to read this book but will have to wait for the library to get it (I think I’ll call tomorrow and ask them to) or for it to come out in paperback. I found the link at the blog of one Maud Newton, which I happened across when doing a search on DFW.

While we’re on Wallace, check out this article about a piece he did for Gourmet about the Maine Lobster Festival in which he apparently stood up for the ethical treatment of lobsters in pretty typical verbose fashion.