Tuesday, 20 September 2011

RSS feeds from Twitter Lists

For various reasons, I have been trying to get RSS Feeds from Twitter lists.  The main aim is to get views from a range of accounts onto our site in our own style.  The twitter-supplied gadget is all well and good, but it has its limitations.  Yesterday I discovered the holy grail - an Atom feed for twitter lists:

eg http://api.twitter.com/1/libatcam/lists/cam-uni-libraries/statuses.atom

With the feed, using an Atom feed reader like this one, you can display the twitter statuses on your website, in whatever style you like.  Atom is subtly different from RSS, but if you can work with one, you are sure to get used to the other.

If you only want a feed from one account, the easiest way is to follow ThemeLab's tutorial to get the feed onto your site using only html and JavaScript.  However, if you want to do it the hard way, the RSS feed is:

eg: http://api.twitter.com/1/statuses/user_timeline.rss?screen_name=theul

Then you will need to find yourself an RSS reader, like Magpie to get the tweets onto your site.

Have fun!

Tuesday, 5 July 2011

Organisational Twitter - How to tweet for your institution

As well as my personal account, I have been tweeting on behalf of Cambridge University Library - @theUL - for a couple of years now.  With CPD 23 things introducing more people to Twitter, and possibly getting someone think about setting up an account for his or her organisation, I thought the time would be ripe to share my thoughts about running a Twitter account on behalf of an employer.  So here goes:

1) Think about timing.  It is tempting to set aside 10 minutes before lunchtime to knock "organisational Tweeting" off your to-do list.  However, the result of this is a sudden rush of tweets into your followers' feeds and a drought at all other times: from a user's perspective, it takes more dedication to read 5 tweets from the same person at the same time (see boredom and/or information overload), than 5 single ones throughout the day.  Also, Tweeting at different times increases your reach; people log on at different times of the day - it is better that more people see less Tweets than less people see more.

2) Don't let it become personal.  It sounds obvious, but especially if there is only one person running the feed, personal opinion, @replies to friends arranging lunch or "my cat did x" type tweets are an easy trap to fall into (I've seen some, but will mention no names). Set up two accounts, one for you and one for your organisation. I keep mine on different platforms to avoid confusion. @theUL appears in TweetDeck, @laurawaldoch as an igoogle gadget - they look so different that there is no chance of accidentally posting in one rather than another.

3) Automatic feeds from blogs and news make up the "meat" of our Twitter account.  Using Twitterfeed, news published on our news site is Tweeted without any extra effort from us.  This also applies to blog posts. Various projects and departments keep blogs, and once published, those posts are advertised on Twitter.  The effect of this is that, whether they realise it or not,  a large pool of staff contribute to our Twitter presence. Small organisations may have a smaller pool from which get feeds, but anything with an RSS feed can be used in this way.

4) Initially it can feel daunting to @reply on behalf of your organisation, particularly in an informal way, but keep it friendly and polite (and banish those personal opinions!) and no one will mind.  It really does pay dividends to acknowledge and engage your Twitter followers in this way.  This immediate, personal contact has been the real value of using Twitter for us.

5) Within reason, occasional frivolity is a good way of softening a Twitter feed.  In May,  re-tweeted @marshable's photo of ducklings in the UL courtyard and the reaction to this was immense - the greatest number of re-tweets we have had to date, followed by an outpouring of nostalgia for the Library and for Cambridge in general.  Fostering a positive image of the Library seemed to me to be an end in itself.

These are my Twitter tips.  Do you have any others?  What has worked you?  And just as importantly, what hasn't?

Thursday, 16 June 2011

Welcome back Bold! HTML 5: welcoming the new ...and a return to old ways

Yesterday I went to a techlink session about HTML 5. It was an interesting presentation by Helen Sargen, the Cambridge University webmaster. HTML 5 will be the standard browsers work towards from now on.

HTML 5 is much more forgiving than its most recent predecessor, XHTML 1.0. In xhtml tags had to be lower case, in HTML 5 it won’t matter. Unlike xhtml, tags won’t have to be closed or self closing, they can just be left open. Lots of things will be less rigid than in xhtml and document declarations will be cleaner. I am not convinced that this is a good thing as it will encourage people to write sloppy code (or at least, not encourage the reverse), but it will be of help to those of us whose code is sloppy from time-to-time :)

There are some new tags in HTML 5 which I am really looking forward to using – the whole set of tags relating to forms has been re-written so that form checking, place holder values in fields and lots of other useful stuff can be done without using JavaScript; videos can just be embedded within the new  <video> tags. There are also new tags for navigation, breadcrumbs, headers and footers as well as section and article, to avoid the confusing pile up of </div> tags at the end of a page (if you don’t know what I mean, look at the last few lines of code http://www.lib.cam.ac.uk/) – </section></article> etc is much easier to untangle than </div></div>.

The caveat to all this, of course, is that while all new browsers will be backwards compatible, old browsers won’t have a clue what to do with the new tags. HTML 5 will (mostly) work on IE 9, Firefox 4, and the latest versions of Opera and Safari, but nothing older than that. Therefore, these new tags are essentially useless to us for the next few years, until our users' browsers catch up.

See http://www.w3.org/TR/html5-diff/ for W3C's guide to HTML 5.

Apparently HTML 5 is an evolving standard, new tags are liable to be added all the time.

…Oh and bold is now back in favour, so forget your xhtml <strong> tags and revert to <b> … at least until next time.

Friday, 15 April 2011

How to run a Perl script from a PHP or Perl file

There comes a time in many a complex system when it is useful to call one Perl file from another.  In my case, a Perl script creating a list of IT accounts to be created had to be called from two distinct places - our PHP online application to use IT facilities, and our Perl admissions administrative interface.

For the PHP page, I created a shell script calling the file in a PHP-bin (it is better for security apparently):


For the Perl, because it is already in a passworded area of our site, I just call the file directly:

system("/usr/bin/perl /home/httpd/yourpath/directory/filename.perl");

Wednesday, 2 February 2011

Images - floats and displays

In the good old days when I started here (the practically pre-historic 2003) images on websites were simple enough, just upload your image, link to it with <img src="whatever">  and there it was.  The only other option I used was to align it left or right so that the text would flow around the image at its chosen point on the page.

Not any more.  Fast forward to the University style sheets (which, may I say are fantastic, making it easy to put together a professional looking page) and images cause the uninitiated problems.   Put the old image tag within a paragraph tag and the image will automatically go to the right, with a boarder and the text will flow around it.  In 90% of cases, this is exactly what you'd want the image to do.  Put the image outside a paragraph tag and it will appear on a line of its own.  This is usually not what is wanted.

For the record, what you now need, in xhtml, is a style containing a float and or a display command.  The purest way to do this is to add a class to your external css style sheet containing the relevant instructions:

img.floatright { float:right; }

then in your code <img class="floatright" src="whatever">

The lazy way is to put it all in the img tag: <img style="float: right" src="whatever">

For the record, if you just want an image to appear after your text (rather than aligned right or left), set "float" to none and use "display" instead

<img style="float: none; display:inline" src="whatever">

Monday, 17 January 2011

eBooks pages

eBooks pages are a bit of a problem, aren't they?  Ideally eBooks would all be catalogued in the normal way and people would find them whenever searching the Library catalogue.  There would also be an option in that catalogue to restrict the search to only full text electronic items that could be easily accessed from home.  Here at Cambridge, this just isn't going to happen in the short term - collections change too rapidly and cataloger's time too limited for our OPAC to hold a comprehensive list - so we need to have an eBooks web page.

The problem is that the page quite quickly gets too wordy or is misleading. Our users can access all eBooks in some collections but only some in others - I want a simple yet accurate way of letting our readers know what we have.

In search of inspiration, I have checked the eBooks pages of some other university libraries (in rough order as they appear under a Google search for "University Library UK")

Oxford  - list of eBooks with short description of holdings.  Grouped by subject.

Glasgow say to search the library catalogue; their eBooks must all be catalogued - good for them!

York have everything in their catalogue but also lists major collections and has a link to a source of free eBooks.

Liverpool list their collections with text to indicate whether people can access all collections or just part of it.  They also have "key resources" links at the side using easily recognisable product logos.

University of London say to search the catalogue.

Sheffield - each ebook title is listed individually and can be accessed by subject or from an A-Z list.

The OU have a  browsable list of publisher's sites with a detailed description of contents and holdings.  Like us, some, but not all titles are in the Library catalogue.

For the record ours it at http://www.lib.cam.ac.uk/electronicresources/ebooks.php

We have come to no conclusions yet, but watch this space....