Archive for November, 2006

Playpen #7 – Flickr API

Wednesday, November 22nd, 2006 at 5:20pm

With my new-found ability to consume RSS (and by inference, any XML), my next challenge was to combine that with Playpen # 2 – Lightbox JS and the Flickr API and see what fun I could have.

Firstly, I logged into Flickr and found a suitable photo set of mine to play with, taking note of the setID. Browsing the API documentation, I found the API Explorer page very useful. It gives you some handy values straight away, such as your userID, plus recent photoIDs, setIDs and contactIDs.

If you put the SetID in the form on the Explorer page, and call the method (I used an unsigned call, since I was only interested in displaying pictures, not writing details or uploading), the XML file for your photo set is returned, along with the all-important URL you can use to call the method from your web page.

Whilst I didn’t actually need to save this generated XML file, I did find it useful to see exactly what was what in terms of the schema – sometimes seeing an actual value tells you an awful lot more than just seeing the name of an element or attribute.

I then used Dreamweaver8 to generate a new XSL fragment file, which calls the aforementioned URL as its source. This gives you a display of the XML schema in the bindings panel. You can then drag and drop elements and attributes (relatively) painlessly onto your XSL document:

The nuts and bolts of my stylesheet are as follows:

<xsl:stylesheet version=”1.0″ xmlns:xsl=”http://www.w3.org/1999/XSL/Transform”>
<xsl:output method=”html” encoding=”utf-8″/>
<xsl:template match=”/”>
<h3>
<a href=”http://www.flickr.com/photos/{rsp/photoset/@owner}/sets/
{rsp/photoset/@id}”>Pictures of d.construct2006 in Brighton</a>
by <a href=”http://www.flickr.com/people/{rsp/photoset/@owner}”><xsl:value-of select=’rsp/photoset/@ownername’/></a>
</h3>
<ul class=”thumbnails”>
<xsl:for-each select=”rsp/photoset/photo”>
<li><a href=”http://static.flickr.com/{@server}/{@id}_{@secret}_o.jpg” title=”{@title}” >
<img src=”http://static.flickr.com/{@server}/{@id}_{@secret}_s.jpg” alt=”{@title}” name=”{@id}” width=”75″ height=”75″ id=”{@id}” />
<br /><xsl:value-of select=”@title”/></a></li>
</xsl:for-each>
</ul>
</xsl:template>
</xsl:stylesheet>

The Photo Source URLs page was extremely useful in telling me what paths I needed to construct for the image thumbnails and originals. Even so, I spent a frustrating half hour getting the syntax right. I learned the hard way that copy/paste in the code view doesn’t always get you the right path – but if you drag an attribute from the bindings panel onto the design view of the file (not the code view), the path is sorted out for you!

Basically, I was mistakenly adding:

{rsp/photoset/photo/@attribute}

instead of just {@attribute}, in the loop, and nothing showed up. But the overall title bit worked fine – because this was outside the loop, and did require the rest of the path to parse correctly. Argh!

With a bit of CSS styling, the photoset is displayed nicely in Playpen #7. Clicking the title or thumbnail then brings up the LightboxJS function to display the original image from Flickr, with it’s title and prev/next links to the other pictures in the set.

RSS – Consumer Indegestion

Wednesday, November 22nd, 2006 at 12:37pm

As well as problems generating my own RSS feeds, I’ve been banging my head against the Adobe brick wall as far as consuming RSS is concerned.

Dreamweaver8 is my weapon of choice for development (so shoot me), and I tried a few months ago to get the BBC’s Rugby Union RSS feed added to my rugbypix.com page. Adobe have a tutorial which explains a lot. Trouble was, I did everything they said, and on my localhost test environment, I kept getting an error message:

MM_XSLTransform error:
“http://newsrss.bbc.co.uk/rss/sportonline_uk_edition/rugby_union/rss.xml” is not a valid XML document.
The underlying connection was closed: Unable to connect to the remote server.

The claim that it wasn’t a valid XML document was obviously rubbish, since the BBC’s feed works in all the feed readers I’ve tried! Googling for the error didn’t produce anything sensible, so I shelved the project and put it on the back burner for a while.

Returning to it this afternoon, I tried uploading the XSL fragment (which does the data repeat for the feed) and the page in which the transformation is called, onto my live server. I got a different message – the MM_XSLTransform.cs file was missing – progress! I knew that on my previous attempts, the only transform I could find available was the MM_XSLTransform.vb file, which was the wrong server model for my site.

Another quick google for the C# transform got me to this page. And, voilĂ ! a link to download the missing MM_XSLTransform.cs. Bung it in the includes/MM_XSLTransform/ folder and upload it to the site, and Bob’s your uncle… BBC Sport Rugby Union feed at rugbypix.com

Great, another niggling problem ticked off my list!

20×2 v6.5 – Where Am I?

Monday, November 20th, 2006 at 4:34pm

I had fun at last night’s 20×2 event, which was well attended by those keen to see the first event held outside Texas. The speakers were:

  1. allison pickett (artist)
  2. steve day (comedian)
  3. jaye joseph (designer)
  4. jon roobottom (designer)
  5. ann mcmeekin (designer/photographer)
  6. steve marshall (developer/designer)
  7. bobby pathak (journalist)
  8. frances berriman (designer)
  9. diego brown & the good fairy (band)
  10. james edwards (developer/designer) – no-show :-(
  11. david frew (acerbia)
  12. john bergaman (artist)
  13. jen dixon (writer, photographer, web geek)
  14. andy galletly (producer/cinematographer)
  15. gavin strange (designer)
  16. leisa reichelt (user experience consultant)
  17. gia milinovich (blogger/tv presenter)
  18. sam sethi (entrepreneur, techcrunch uk)
  19. buswell (band)
  20. foundry (artist)

As you can see, a varied bunch, and certainly a varied interpretation of the question, where am i?

And here are a few photos from the evening:

[my name is roobottom...]

[frances berriman... cue hysteria!]

[foundary whizzes up some art in 2 minutes]

You can see a few more photos from the event at my flickr account.