Skin of Stars

Icon

Kevin Carmody on machines, media and miscellanea.

PHP Script for RSS auto-discovery and OPML file generation

Hey All,

I recently got a reasonable size list of blog URLs. What I wanted was to import all these into a feed reader (via OPML). There seemed to be a lack of conversion scripts for batch URL->find RSS link->feed reader import file (I may be wrong, please let me know if I am :) , so I made one in PHP. I guess this is like an automatic-blogroller. I have just used this as a command line script, I’m not recommending you use this in ‘the wild’ as one might say, I have made little concession to security as I had a trusted list of URLs.

There are basically three steps to this

  1. Take an input file of newline seperated URLs, in my case blogs.
  2. Find (auto-discover) associated RSS feed of each blog URL
  3. Output an OPML file that you can use to import into a feed reader

What it does:

  • Takes a well formed list of newline separated URLs of blogs and turns it into an OPML
  • If the URL source doesn’t contain a <link> to an RSS feed in the head it doesn’t add it to the OPML
  • Detects the <title> and adds that to the OPML text field, or uses the URL if <title> isn’t present

What it doesn’t:

  • Check the RSS feed is validated XML
  • Any other checking really :)
  • Come with any sort of warranty/guarantee

Some of the key functions are from Keith Devens work. Thanks.
Read the rest of this entry »

Moving hosted SVN, the trials and the tribulations

Over the last few weeks Mike Robinson and I have discussed and decided an SVN restructuring for improving our build and deployment processes. I would encourage you to read a bit more about that (and various other geekness) at his blog.

So I’ve spent this week moving our company hosted SVN from Beanstalk to Springloops. I feel I’ve been swinging between hell and zen, but the learning has been awesome. As a summary of what I’ve found I thought I’d give a quick walk through how I did it.

Read the rest of this entry »

Has it really been that long?

Hello all, it’s been a while. The Skinofstars site has been languishing in disuse for some time now. Like I’m sure many others, I’ve found the transition to micoblogging is all too easy. Sometimes though, one wants to write something a little longer and long gaps are not helpful when you finally think of something. So I guess I’m just posting to get rid of some writers block really.

For the six months since my last post (my, that is a long time!) I’ve been working at Studio Lift in Reading. There are five of us; two designers, two coders and a multi-talented boss. We fill our days making like this and like this (bad linking! :) using Movable Type. This is the same blogging platform that is used by the BBC, The Guardian, ReadWriteWeb and various others. It comes in both Commercial and Open Source offerings and is perhaps one of the most venerable of blogging systems.

Does that mean I’m going to talk tech now?… sure (jump?). Movable Type (mt) has just released its 5th version. This places more emphasis on managing multiple blogs within a site structure. Very useful if you’ve ever tried to manage multiple blog instances (how many blogs do you think The Guardian has?). There is also a new emphasis on social communication (see Motion).

The system is written in Perl but because the publishing is static files you can drop pretty much any scripting language in without any problems. My current language of choice for server-side is PHP. You hook your language in with mt using their own markup derived syntax, and to be honest for a simple blog you never have to touch another language. Let’s look at an example which will iterate over a collection of the last five entries:

<mt:Entries lastn=”5″>
<h2><mt:EntryTitle /></h2>
<p><mt:EntryBody /></p>
</mt:Entries>

There is documentation, with my favourite page being the tag reference, but otherwise there certainly isn’t the same breadth of documentation as you would find with something like WordPress. Perhaps the strong ties with the commercial side of the software, it was increasingly license prudish at the Open Source blogging party, has been a hindrance to a warm and fuzzy community embrace. Still, some big media hitters use it so they’ve certainly got something right.

Well, as I said, I work in Reading and my crappy car’s wiper motor has broken so I’ve got to get up early and catch a bus. It’s been nice to talk to you again. Thanks for putting up with my tech chatter, I expect that you’ll get variation soon enough as we head towards the General Election :)

Night Night.

http://www.williamfiennes.com/

A Website Apart

Hey all, just a quick one today. I just had a job interview and I was asked the question “which design websites do I frequent”? I ummed and erred a little before mentioning Digg and Slashdot. Not very design focused I know (except maybe Digg’s design section). I also said that I trawl the blogs for Ideas, which is true. I neglected to mention one of my favourite sites though, one which each and every one of you should have in your Feed Reader: A List Apart. I love that site and I felt a little ashamed for forgetting it, so as penance I am reminding you all to check it out.

Latest Web Design

Hey All,

Just thought I would tell you all about a new site that I’ve created for homework. It’s for an Oxford based band called Branch Immersion, a three piece acoustic outfit, some friends of mine. The site is hosted on the uni servers at the moment but I expect we’ll host it here at SkinOfStars towers soon enough once they’ve bought their domain name and I’ve ported the static pages to WordPress.

This is an original design and I must be honest, one I am very proud of. Please check it out at the temporary address (I’ll update with the final address later):

http://wwwusers.brookes.ac.uk/06021836/u75131

http://skinofstars.com/branch_immersion

One Day Blog Hack

Hey All,

I’ve decided to do a blog hack in a day and here you see the result. I was struggling with Drupal as a blogging platform, and frankly an anything platform, so I decided to move to the decidedly easier WordPress. I’m not saying there is anything wrong with Drupal, it’s a great platform. The problem is that it’s built for so many tricks that you have to give it a real shove when you want something simple. For example, handling images. On a content sytem one would have thought that would be an obvious feature, but with drupal you have to go get a plugin. Madness I tell you! Not that getting WordPress means I’ll be bloggin frantically, but it makes life a lot easier.

So here is how I got from Drupal 6 to WordPress 2.7 in a day:

1. Backup the Drupal database & import the data into WordPress

Moving around between platforms is quite common, so you’ll often find a script to aid you in moving database info from one structure to another. WordPress has many such scripts built in for many platforms, but for Drupal I got my assistance from Mike Smullin. I had to make some minor changes, for example I added this SQL statement to change my Drupal post_type ‘story’ to WordPress’s ‘post’

UPDATE wp_posts SET post_type = REPLACE(post_type,’story’,’post’);

Pretty easy stuff really. If you’re going to do it yourself, make sure you do it locally on backup copies. I hosed a few before I got it right.

2.Theme Hack

Ahh yes, the inevitable theme quandry. I had thought about what I wanted Skinofstars.com to look like for a while, but I wanted to do it reasonably quickly as I hate it when these things hang around. My layout plan was simple enough. Only one or two blog posts on the front page with info on my other nettyness, like tweets. I also knew that I’d want access to other pages (as you find in the Further section.. not sure on that name). So I searched some WordPress themes and came across Grid Focus. It seemed to have the right level of minimalism that I was looking for as well as reasonably suitable layout. In order for it to work for me though I had to make a few hacks including some JQuery magic to include my further section (hope you like the transitions) and some layout hacks for the differences between a narrow and wide content column (you’ll see if you view this in single/comments mode).

3. Content Update

Probably one of the most time consuming parts. Much of my old content was Uncategorised for no reason and lacked any tags. Many posts from back in the Blogger days didn’t even have a title. I went through almost all of them (I’ve taken a break from the 1996 stuff) and finally managed to put these years of outpourings into some kind of order.

4. Update to server

Well, that’s just a bit of FTP and MySQL. Job done.

Ruby On Rails, RSS and Atom feed parsing with Feed Normalizer and subsequent storage

I’ve battled for days on this, but I now finally know how to parse feeds and store them in a database in Ruby On Rails. This won’t be of much interest to the casual reader, but if you are scouring the web for an answer (as I was) then you will probably find this very useful:


class Feed < ActiveRecord::Base
require_association 'post'
require 'feed-normalizer'
require 'open-uri'
require 'rss/2.0'

belongs_to :user
has_many :posts, :dependent => :destroy

#put some other stuff here for feed validation etc

def refresh_all
refresh(Feed.find(:all))
end

def refresh(feeds)
feeds.each do |feed|
rss = FeedNormalizer::FeedNormalizer.parse open(feed.uri)
rss.entries.each do |item|
post = Post.new(:feed_id => feed.id)
post.link = item.url or raise "post has no link tag"
post.title = item.title or "no title"
post.content = item.content or "no text"
post.created_at = item.date_published if item.date_published
post.save
end
end
end

end

How We Read The Web

I’ve been looking at some interesting research regarding the manner in which users read web pages. I’d come across click mapping previously (links below), software that records where users click, but the Nielsen Norman Group’s eye tracking study follows where users actually look. Though their study tends to focus on commerce aspects (how much do users look at your adverts?) it is also fascinating stuff for those of us wanting to create clean and clear designs.

First thing that’s worth noting, users rarely spend time looking where you want them to. They tend to follow common patterns, the most notable being the F pattern (a couple of quick horizontal scans of the page as we head down it). This means it is for us, the designer, to be aware of this and place our most important content in these areas. One might argue that a regular visitor would know where the most important information on a site is held, yet anyone with any sense knows that we want to make a site clear for everyone.

Now for banners and adverts/promotions. I’m not going to say how to get people to read them (in fact, I’d recommend getting AdBlock Plus to just cleans the web of them!), but if you want to ensure people read all information on your page then make sure that it doesn’t look like an advert. Users have an automatic tendency to ignore anything that looks like a promotion.

Next up I’ll point to Nielson’s study on how pages are read. The key point is that people don’t read, they scan. If you want to make life easy then you could put important anchor words in bold to aids the reader down the route you’d like them to take. When you’re marking this up in HMTL consider whether you should use the ‘b’ or the ‘strong’ tags. Are you merely creating a visual guide (b/i) or do you want to emphasise a word (strong/em)?

The final point I’ll pick up from Nielson is his discussion on screen sizes. Nothing surprising here, most people use 1024×768, that’s a laptop widescreen. One thing I’d like to add to is the misconception that laying out a web page is like laying out for a newspaper or a magazine. Screen sizes and resolutions are not fixed, there is no ‘above the fold’, like we find in newspapers. Even different choices of preferred system fonts or different browsers have an impact on where the cut-off will be on different machines. Interestingly, Neilson does point towards making site layouts fluid for different. Though I don’t consider this such a hard n’ fast rule, I’d like to point you CSS monkey’s 456 Berea St’s article on elastic layouts.

That’s it for this week folks. Happy building.

Some further linkage:

* A wordpress clickmap: http://www.rogerstringer.com/projects/wpclickmap

* A more general use clickmap using PHP and JQuery: http://css-tricks.com/tracking-clicks-building-a-clickmap-with-php-and-jquery/

* Strong or Bold? http://www.think-ink.net/html/bold.htm

Favicons

Sorry for being a little late with the post. I’ll be quick as I’m still working on my aforementioned project.

I thought I’d talk a moment on favicons considering the talk on Google’s recent change.

First thing you need is a favicon.ico file. There are all sorts of programs that, some free some not, that can do this job for you. Instead I’d recommend using a web service, favicon.cc.

Once you’ve saved your favicon and uploaded it to some webspace (however you prefer) then you need to link that icon to your code. This is pretty simple, just include the following code in the <head> section of your HTML:

<link rel="icon" href="http://example.com/favicon.ico" />

Job done.

The January Project

Well, it’s been busy over the festive period. Back in Thanet for Christmas then straight to Jersey for New Years Eve. Home in Oxford now, it’s good to be back. I’ve got a busy semester coming so I’ve decide to just throw myself back into work. I’m planning on have my computing part of my dissertation finished by the end of January, thereafter leaving me eight weeks to write 5000 words on the open development of my computing dissertation in a suitably applied social sciences fashion. Lets start with a little open reflection what I’m constructing.

I am making a news and events information filtering web application. It works like this: News and event announcements comes in one end via submission, XML feeds (RSS, Atom, etc) and possibly some kind of easy tagging widget thingy. Once they are in people get to vote on which is the best story. We have some pages for displaying the popular stories which can be customised by the user based on factors like time or category. These customised filters can then be collected in XML, like Netvibes or iGoogle or just Firefox bookmarks. I’ll probably also throw in some social networking tools as well.

The site should be going live at the start of February and will initially be targeting the Oxford area. At roughly the same time the beta code (built using Ruby on Rails) will be made available on another site with a suitable open license.

I shall post further updates through January on this very blog.

My Twitterings....

Powered by Twitter Tools

About

My name is Kevin Carmody and I live in Oxford, United Kingdom. I am a web developer with a penchant for community sites and a pedantry for open standards.

This here is a collection of my thoughts and musings, a spot for pooling a little of what's rattling around. Thanks for taking the time to visit and I hope you enjoy your stay.