Content Management Systems a go-go

Well, I’m now running WordPress. I know I appear to be aimlessly flitting between content management systems on this site but it’s more of a little research project I swear. Hopefully it’s all happening pretty seemlessly for everyone reading my ramblings. This time RSS came to the fore, allowing me to simply export a feed of all my previous posts and import them straight into WordPress. This sort of portability is very very nice for the user. I’d love to see this sort of functionality for hierachically structured data in larger enterprise systems.

I’ve got Wordpress up and running with a few choice plugins and a new theme in a couple of days which is nice. Hopefully any minor issues will be ironed out as I find them. An added bonus is comments are now back, I’ve got so many things to rave about after getting back from BarCamp and Future of Web Apps that letting anyone else point out the errors is only fair.

Useful API links

After a load of research for a couple of projects I thought I may as well add a large pile of links to a post for future reference. Feel free to wander through if your interests stretch to using scripting languages in mashups and the like.

PHP

Python

Ruby

Shiny Content Management

Well, my presentation over at the local Ruby on Rails Usergroup went down OK last Thursday. I could have done with some more time to prepare and do up some nicer slides but most of the presentation was quite hands on with me coding and talking, which was a first for me.

My presentation was basically a whistle stop tour of Radiant. I rambled on for about fifty minutes or so, quickly going through the basic concepts of Pages, Layouts and Snippets and then on to an example site which I built from scratch in front of everyone – with only a few obvious errors and obvious mistakes.

I ended up talking some about ommissions in Radiant, which I’m not sure I got across as the positive that I feel they are (at least for me). I dont want a fully featured blogging system, rather something that’s easy enought to jump into somewhere and see how it works. A few ideas came up from this discussion that, given the chance, I’ll mention on the Radiant mailing lists, or give them a go myself – like the ability to save configurations of pages, snippets and layouts and then load then instead of one of the three default prepopulation options. Though I’m busy modding the Radiant commentable behaviour and pondering a move to the Mental release candidate at the moment.

It at least got me back in to presenting to an industry audience, quite different from the teaching I’d been doing. Hopefully a good thing ahead of BarCamp in a weeks time.

WebDD

Just back from WebDD down in Reading at the Microsoft Campus and thought I’d post a few thoughts. I’ll get into a few of these topics in more detail down the line when time permits but for now…

I went to a few talks, one on Microformats by Glenn Jones and the other on web standards design by Patrick Lauke that I enjoyed but didn’t learn much. I wasn’t the intended audience really and I’d gone along because I didn’t fancy the alternatives. Both were entertaining and well attended anyhow, and I’m sure the more developer orientated folk got a lot out of both.

The main two things I came away thinking about however were the upcoming version of Visual Studio (codename “Orcas”) and Microsofts new identity platform CardSpace

Now I’m not generally a fan of IDEs, but someone has been thinking alot about how Visual Studio (and the new Expression Web) can be of use to web designers. Some of the CSS tools are very cool, I might do some screenshot from Expression (we all got free copies) if I get the chance. Their has also been a huge effort to integrate Javascript functionality, including full debugging and breakpoint support as well as intelissense. All of which looks really rather nice.

According to Microsoft Windows CardSpace enables users to provide their digital identities in a familiar, secure and easy way. Which should have alarm bells going off and (bad) memories of Passport flooding back. I went in not knowing much and in quite a sceptical mood, assuming the worst. Turns out I was wrong. The presentation, by Barry Dorrans, covered quite a bit of ground from an introduction, through code and working examples and even a big discussion of the issue of identity and OpenID in particularly. I’m suprised that I haven’t seen any mention of CardSpace along with the recent rise in discussion around identity and OpenID. More on this soon.

One last thing on the WebDD site caught my eye: around 350 people with a 50/50 split of web developers and web designers. In reality I think about 20 of us registered as designers which amused me. Microsoft doesn’t (yet) have a pull over designers as it does over developers. More on that too when I get my thoughts in order.

Experiment over

Ok, well, that was interesting I thought. For those that haven’t followed along on the site I thought I’d recap some of the weird and wonderful colour schemes that have been used on this site as part of my experiment with colorburn

Some were just about OK, some were quite nice really and a few were, er, pretty much unreadable (sorry). I’ll let you decide which where which:

20th 21st 22nd 23rd 24th 25th 27th 28th 29th 30th 31st 1st

Incoming!

Just a few things coming up in the next month that I’m attending that I thought warranted a post.

WebDD 3rd February Heading down to Microsoft in Reading for Web Developer Day for a weekend of web design and development discussions and listening to Bruce and Patrick go on about something interesting.
Newcatle Rails Usergroup 8th February I’m giving a talk on using Radiant to our local Ruby and Rails Usergroup so we’ll see how that goes. I’ll publish the slides afterwards given the chance.
BarCamp London 17th-18th February Yeah. I got a ticket for Barcamp thanks to Meri. I just need to think of something to talk about now. Oh, and sort travel.
Future of Web Apps 20th-21st February Been looking forward to heading down to FOWA for a while and a few people from work are coming too. Be good to see all the usual suspects as well, at least those that aren’t going to Barcamp a few days before.
Geek Dinner 21st February I’d already booked the day after FOWA off work knowing that something would come up. As if by magic I’m finally in London for one of Ian’s famous GeekDinners.

Now I think about it, or rather now I write them all down in one place, I think I might have got carried away.

URI Templates in the Real World

I do quite a bit of big picture web site/application design at work (ok, that probably needs more of a description). I get involved in alot of the details that lie somewhere off to the side of the obvious bits that need to be done (mmm, not much better). All those technologies and tools and ideas only tell part of the story of building a successful site or online application. Even something stringing together a good idea, clean markup, good CSS, some fancy backend code (insert prefered option) and a sprinkling of user centred design tools can fall down on the hidden details; good form labels, help messages that actually help rather than just repeating the problem, organising file systems to allow for simple scaling, skinning and internationalisation, etc.

Tom Coates spoke last year about his concept of Native to a Web of Data which really struck a chord at the time, and not just because I still want this on a t-shirt. More recently the idea of REST has really caught on, especially amongst the dynamic languages crowd – you just need to look at Rails 1.2 for an example their. The big picture is HTTP is back and everyone who didn’t already get it should be doing some reading.

Another notable person talking quite a bit about REST, HTTP and related issues is Joe Gregorio. Amongst other interesting posts, I came across one on URI Templates a good while ago and have been following the specification to produce recent documentation. The idea is simple and so is the specification. A quick example, for a simple CRUD interface might be:

Action URI Method
View /view/{id} Get
Add /page/add Get, Post
Edit /page/edit/{id} Get, Post
Delete /page/delete/{id} Post

Doing this for a site or application in the early stages of development really helps to highlight what actions are available, and to remove the need for costly changes later in the day. It also helps others learn, mainly through discussion, about the different HTTP methods and the importance of the URI in general.

Posting to Twitter using PHP

Please note that Twitter no-longer support Basic Auth via the API so the following code no longer works. Please see the official docs for more info

Like others I’ve found myself becoming something of a fan of Twitter, the impossible to explain social networking site. If you’re reading this, have a twitter account and not already my friend then add me if you like.

Apart from the interesting social aspects I’m also interested in Twitter as an API for all sorts of communications, remember Twitter already deals nicely with SMS messaging, Instant Messaging, subscription and the like and has a nice XML and JSON based API. I’ve been using the Zamano SMS gateway at work for a few projects and Twitter actually lets me some more and doesn’t come with a price tag.

I started out playing with curl to send updates like so (obviously with a real username and password):

curl -u username:password -d status="twittering from curl" http://twitter.com/statuses/update.xml I then used the PHP curl features to do the same thing from PHP: <?php // Set username and password $username = 'username'; $password = 'password'; // The message you want to send $message = 'is twittering from php using curl'; // The twitter API address $url = 'http://twitter.com/statuses/update.xml'; // Alternative JSON version // $url = 'http://twitter.com/statuses/update.json'; // Set up and execute the curl process $curl_handle = curl_init(); curl_setopt($curl_handle, CURLOPT_URL, "$url"); curl_setopt($curl_handle, CURLOPT_CONNECTTIMEOUT, 2); curl_setopt($curl_handle, CURLOPT_RETURNTRANSFER, 1); curl_setopt($curl_handle, CURLOPT_POST, 1); curl_setopt($curl_handle, CURLOPT_POSTFIELDS, "status=$message"); curl_setopt($curl_handle, CURLOPT_USERPWD, "$username:$password"); $buffer = curl_exec($curl_handle); curl_close($curl_handle); // check for success or failure if (empty($buffer)) { echo 'message'; } else { echo 'success'; } ?>

Obviously you could do more with the return than print out a success or failure message. The $buffer variable has the returned XML or JSON for you’re parsing pleasure.

I’m going to try out some of the other API methods too, probably play more with XSL or look more closely at the PEAR JSON module in building up a simple library as a quick search didn’t throw up much of interest and the API is nice and simple; making it fun to hack on.

Colorburnified

If you visited the site previously since the Radiant move you might notice a new colour scheme. Come to mention it if you visit tomorrow, or the day after you should get a different colour scheme too.

I mentioned that I planned on a few experiments around these parts and this is the first one. I’m a big fan of ColorBurn from Firewheel. For those that haven’t seen it it’s a desktop widget that displays a new four colour colour scheme every day that looks a little something like:

ColorBurn OS X Widget

I often use it for inspiration for colour sets, or just to appreciate interesting colour combinations. This just takes it a step further. A little reverse engineering and I have a script (PHP this time, running from a cron job) that writes out a new stylesheet once every day with the colours from ColorBurn (using the magic of XSL if you’re interested). I’ve used an alpha transparency on the image to the top left of the page which might result in strange effects in browsers that I dont care about too much. Sorry, but I did warn you.

I have a feeling that some days I’ll wake up and regret this experiment and others I’ll be pleasantly suprised. I’m not going to cheat either. ColorBurn provides me with four colours and the script will use them in the order they come in.

OPML Feeds using Radiant

As mentioned when I moved the site over to Radiant I promised a few tutorials and behind the scenes footage of goings on. So here goes with a quick look at how I added a nice OPML feed to my site.

For those not familiar with OPML it’s an XML format for outlines, often used for storing blog rolls and the like.

What I wanted was a friends parent and the ability to add friends to it and for them to appear in a dynamic OPML feed. The following screenshot shows what I ended up with:

Tree showing Friends feed in Radiant

To accomplish this within Radiant I needed a custom layout, one which would simply render the content but also had the relevant header and footer markup. Note the mime type setting as well.

Layout for OPML in Radiant

Next up is the page which actually uses the OPML layout to render the page.

friends feed from Radiant

Note that I set the status of all the friends records to hidden, and then set the status of the r:children:each loop to search for hidden children. This way the individual friends records dont show up as seperate pages.

All I need to do then is add children to the parent, friends-feed in my case. I added a few page parts to each friend page to make management a little easier; a link, a feed and for a little added spice xfn.

Edit friend view from Radiant

All in all it makes adding and updating friends easy, and the general approach will work with pretty much any content where you want to compose a single page based on it’s children.