Yesterday I created a script that displays the latest photos from my flickr profile and displays them on my homepage. It uses the flickr api, more specifically the flickr.people.getPublicPhotos, and an XSL stylesheet to create some pretty html. Just incase you are interested here is the XSL.
<?xml version='1.0'?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:output method="xml" omit-xml-declaration="yes"/>
<xsl:template match="rsp/photos/photo">
<li><a>
<xsl:attribute name="href">
<xsl:text>http://www.flickr.com/photos/</xsl:text><xsl:value-of select="@owner"/><xsl:text>/</xsl:text><xsl:value-of select="@id"/>
</xsl:attribute>
<img>
<xsl:attribute name="src">
<xsl:text>http://farm</xsl:text><xsl:value-of select="@farm"/><xsl:text>.static.flickr.com/</xsl:text><xsl:value-of select="@server"/><xsl:text>/</xsl:text><xsl:value-of select="@id"/><xsl:text>_</xsl:text><xsl:value-of select="@secret"/><xsl:text>_s.jpg</xsl:text>
</xsl:attribute>
<xsl:attribute name="title">
<xsl:value-of select="@title"/>
</xsl:attribute>
</img>
</a></li>
</xsl:template>
</xsl:stylesheet>
I have spent the past half hour bug hunting a bug that doesn't exist. Well it did exist but not where where I was looking. I was creating a small script that uses some XSLT goodness to produce some major funk. For some reason though the script just wouldn't run, even though I have used the same script thousands of times before. It seems the issue wasn't in my coding but the PHP version I was using.
Not long ago I installed PHP 5 on my iBook, this site on the other hand is still being served using PHP 4. The way in which XSLT is done in PHP 4 is significantly different from PHP5. In PHP 4 there are a number of nice functions which do the heavy lifting for you. In PHP 5 they have gone all object oriented and scraped the old way. So for the moment I will have to use two virtual hosts on my iBook: one for PHP 4 development and one for PHP 5.
I was writing a small script a minute ago that gets a page off a remote server that requires HTTP authentication. I was just about to jump on to Google to see the best way of doing that when I remembered that I had done something similar in the past. I found the script hidden on my hard-drive and though wouldn't it be cool to publish the script so others could use it. It seems I had the same idea when I first wrote the script also because it's already out there. I present to you my HTTP-Auth File Retrieval Script.
I am now home for the Easter break. This means two things, Easter is just around the corner and I am going to be allowed to eat chocolate again soon. The other thing that is coming up soon is my birthday. If your looking for something to get me for my birthday a 20inch iMac would go down very nicely.
I now hold the title ECSS webmaster. ECSS stands for Electronics and Computer Science Society. Anyone that joins the department is automatically a member, so the society has over 1000 members. It is my job to give the current site a facelift and a bit of energy. The road ahead is a long one, wish me luck.
I love CSS shorthands. There is one however, that I have been seeing in use but until now not know what it did. When defining a new font style you can shorthand to font: 1em/1.3em verdana,sans-serif;. Hang on what is all that 1em/1.3em stuff doing? I introduce you to the font-size line-height trick which enables you to define both the sizes in the form font-size/line-height.
Installing applications on OS X is usually a fun and enjoyable experience. You download a dmg file, you mount it, drag the app to your applications folder, eject the dmg and you are done. So when I had a pesky pdf earlier that wouldn't display correctly in Preview I tried to download Adobe Reader and see what it's supposed to look like. Adobe have decided however that everything should be made as complicated as possible.
First I had to download a dmg which contained a package installer. Running this installer put a download manager in my Utilities folder. Running this manager downloaded another dmg. This contained a custom package installer. Running this installer I got both a folder with an application and a 'help viewer' app in my Applications folder. After deleting everything apart from the Adobe Reader.app I finally have what I set out for. Why would they want to make it so complicated?
I have been in the market for a DSLR for a while. Last week however, my status changed from wanting one to owning one. I now own a Nikon D40. This is my first proper experience with any SLR and so far I am liking it. There is quite a large learning curve when you use SLR for the first time and my first photos are less than beautiful.
Now I have to decide on how I want to distribute my photos. I can either put them flickr and use the api to pull the latest images on to this site, or I can install something like zenphoto here. I think I will probably go down the zenphoto route as it leaves me with ultimate control over the photos and how they are displayed.