Friday, April 27, 2007

How to add Amazon links to a Drupal page

Do you want a quickie way to add Amazon prices to your Drupal node pages? Here's a code snippet for you:

/* Amazon Start */

$amazon_url = ",Medium&SearchIndex=All&Keywords=";
$amazon_url .= urlencode($title." ".$channel_id);
$amazon_url .= "&ItemPage=1";

$response = file_get_contents($amazon_url);

if ($response === false) {
die('Request failed');

$phpobject = simplexml_load_string($response);

if ($phpobject === false) {
die('Parsing failed');

$found_amazon = 0;
foreach ($phpobject->Items->Item as $item) {
if (($found_amazon == 0) && (($item->ItemAttributes->Binding == "Video Game") || ($item->ItemAttributes->ProductGroup == "Video Games"))) {

print "".l("Buy ".$title,$item->DetailPageURL, array(),NULL,NULL,TRUE).""; ?>
- (starting at OfferSummary->LowestNewPrice->FormattedPrice; ?>)

Tuesday, April 10, 2007

Cambrian House and Crowd Sourcing

The Cambrian House blog has a great piece on Harvard's take on prediction markets like Cambrian House's "IdeaWarz" that leaves product promotion and development to a competitive process. Popular ideas get center stage; unpopular ideas get nada (that's where my ideas end up :( ).
I like the idea of prediction markets and crowdsourcing because it smacks of natural select and psychohistory: that crowd opinions will wash out peaks of dissension and what I called "Digg pinheadism."
Anyways, I urge you give this Cambrian House piece a read. It's interesting regardless of whether you like or hate these concepts.

Sunday, April 01, 2007

Trynt : Have A Tryst with APIs

I stumbled across this site, TryNT. It's a site of home-made APIs. Here's a sampler of what they offer. Seriously cool:

April Fools!

If you logged on this morning and looked at your computer's clock, you may be in for a little surprise. Thanks to George W. Bush, we've got our second Spring Ahead (fittingly on April Fools Day) of the year. Just adjust it back and thanks Dubya for his April Fools Joke. It's not likely to happen again this year. No, Dubya's next trick: darken the skies and turn rivers into blood.