Blip.tv API and YouTube API Code Samples – Library Mashups

My chapter “Blip.tv and Digital Video Collections in the Library” for the recently released Library Mashups edited by Nicole Engard was in need of some code samples. I wanted to show how to use the APIs I kept mentioning in the writing which focused on the digital library mashup of TERRApod. So… here they are in their basic, rudimentary glory.

The complete code is available for download from my code archive. Think of these examples as the raw materials for building mashups with the blip.tv API and YouTube API. The blip.tv example relies on PHP 5, but I made the YouTube PHP4 compatible and you could adapt the code from there for the blip.tv API. I also included some CURL code in the comments of the files just in case your host requires it. If you have questions or improvements, drop a comment.

A quick word about the book: If you are at all interested in mashups and web services, take a closer look. The book covers one profession’s (the librarian) application of web services to library data problems. Contributions from industry leader’s like John Blyberg, Ross Singer and Karen Coombs make this an interesting read for anyone interested in how web services and open data are changing the nature of web development for libraries.

<end bookplug />


Aggregator of Data – Role of Web Developer and Librarian

In taking a survey of my info gathering and recent web dev activities, I noticed something. First, there is a lot of data in my daily channels of news and info. Raging river of data is probably a better description. Second, the trend in our local library development and app building has been to bring these data bits into manageable streams. Witness:

Library Lifestream

Feed Me Some Worldcat

libTweets

cil2009-TwitSearch

Journal Table of Contents (TOC) Service

Mobile view of MSU blog feed

And these are just local library apps at Montana State… There are open web services and desktop clients (FriendFeed and TweetDeck) that make similar attempts to aggregate data and add value. Wheat from the chaff… Signal from noise… By and large, this has been a role that libraries have played within the physical (our selection of books and relevant, vaild info). I’m wondering how well we can latch onto this trend of aggregation and extend ourselves into the virtual.


A Wordle View of Computers in Libraries 2009

So, I’m back at home while the Computers in Libraries 2009 conference is wrapping up. On the flight home, I got to thinking about major themes and it struck me that there might be a way to represent the themes visually. Enter wordle. If you aren’t familiar with wordle, you can paste source text or even pass URLs of feeds to a simple web form and get a “wordcloud” of major terms. I thought I might try pasting the Computers in Libraries 2009 program text into wordle. Here’s the wordle representation of cil2009. (I removed some basic noise words like keynote, track A, 11:30, etc.)

 (click on thumbnail for full image)

Not surprising to see “Library”, “Libraries”, “Search” and “Social” as some top terms. But, I am glad to see the terms around the edges making some headway. Terms like “mobile”, “development”, and “innovative” suggest that the profession is moving forward.  One missing term that I’m hearing more and more is “embed” or embedding”. I think it’s an important concept and starts to get at a new mode of library services: embedded library instruction, embedded reference services, embedded library web services in the form of widgets and gadgets, etc. Just my thoughts from a cursory scanning… If you have other thoughts about the cil2009 wordcloud, feel free to leave a comment.


Computers in Libraries 2009

Computers in Libraries starts tomorrow and it’s always a great time. I arrived in DC earlier today from an uneventful flight which is always a good thing.  Met up with Karen Coombs and Michael Sauers for some SuperHappyTerrific sushi and now I’m collecting my thoughts regarding my upcoming workshops and presentation.

Web Services for Libraries (with Karen)
Sunday, March 30 from 1:00PM – 4:00 PM
Delicious for subject guides, Flickr for library displays, YouTube for library orientation …Mashups and APIs (application programming interfaces) are becoming staples of modern web design. Libraries, as repositories of data, have a wealth of information that could be placed within the mashup context. With new tools and scripts available daily, it’s becoming easier and easier to bring pieces of the web together and enable users to find and build new web services with library data. This workshop focuses on what an API is and what it can do, the standard components of web services, how to build a simple mashup with JavaScript, how to work with PHP to consume a web service and create a mashup, what web services and mashups mean for libraries, and how to start consuming and creating web services for your library with available tools and scripts. Come learn how open data standards and a little “know-how” can change your library services. Hear what others are doing and what you can do too. (Participants should be comfortable with HTML markup and have an interest in learning about web scripting and programming.)

Widgets, Gadgets, and Mobie Apps for Libraries (with Karen and Michael)
Sunday, March 30 from 9:00 AM – 12:00 PM
As web content continues to grow and the noise-to-signal ratio increases, it has become important for libraries to find ways to get into users’ common web paths: the social networking sites such as Facebook, the web portals such as iGoogle, learning management systems such as Blackboard, even mobile devices such as the iPhone. Our panel of experts looks at creating widgets or gadgets that allow users to have basic library search and browse functions in these new user environments free from the catalog or library website. They demo and teach how to build live applications that provide gateway searching for library journals, books, articles, and much more. Come learn how to play in these new environments and to give users options for searching and consuming library materials in their own learning spaces.

The Portable Library: Going “Atomic” with Library Web Services
Monday, March 30 from 10:30 AM – 11:45 AM
There is an opportunity for libraries to braodcast into our users’ common web paths (like Facebook and iGoogle) and to create mobile library apps that allow users to have basic library search functions in these new user environments.  Live applications from MSU Libraries illustrate: a Google Gadget that allows gateway searching for library journals, books, and articles and a series of OpenSearch plugins that let patrons search library content from within the web browser. Come learn about the simple steps you can take to make these widgets and research tools happen at your library.

Presentation files and handouts for all sessions are available at http://www.lib.montana.edu/~jason/talks.php.

Demos and “Downloadables” for all sessions are available at http://www.lib.montana.edu/~jason/files.php.

I’m also trying to track the official tags and hashtags for the conference.  It’s looking like “#cil2009″ for twitter and “cil2009″ for all other tagging.  See everyone around Crystal City or teh Internets…


YouTube as a Medium for Conversation

Ever since I watched SNL’s digital short, “Lazy Sunday” on YouTube, I recognized the fun potential of this online video thing. In time, YouTube would deliver other priceless moments. Try a Google search for “boom goes the dynamite” or “chocolate rain” to see what I’m talking about. I say, “priceless”, with tongue firmly planted in cheek. YouTube moments are usually viewed within a certain frame of satire and in the spirit of lampooning the “everyone is a star” meme that this great Internet enables.

So, it was with a high level of interest that I decided to participate in an experiment to use YouTube to promote discourse and civic debate. The idea comes from some local independent filmmakers and several academics from Montana State University who ask a series of questions about the emerging video platform by creating a YouTube video. Among the questions asked: How are people thinking about the effects of YouTube on society? What is unique about this new age of video sharing? Is it just a game that kids play to create alter-egos to insult others? Are hate speech and acts of violence a necessary consequence of allowing free video sharing? Does YouTube have far wider implications for social justice, religion and disenfranchised groups?

But enough with my writing… It’s all very meta, so have a watch and leave a comment if you have something to say.

Full details and descriptions available at http://www.youtube.com/watch?v=nWa0l-YxvO8.


Unix Global Find and Replace (using find, grep, and sed)

Finding and replacing strings and characters can be a dicey operation for a web developer. Too much can lead to breaking your web site. Too little can lead to missing that piece of HTML needing to be updated or deleted. Many tools exist that can help you in the process – Dreamweaver, Homesite, and many text editors have powerful interfaces for searching and replacing. (E.g., Use cntrl-f on windows or cmd-f on mac to see the Find and Replace window in Dreamweaver.) But there’s some really great functionality on the command line for Unix/Linux users that shouldn’t be overlooked. I’ve been experimenting with a procedure for making these global matches and replaces within the Unix shell environment and I wanted to document the process somewhere. This seems like as good a place as any…

Important: All the commands below must be run from the shell environment on a Unix or Linux system. If you aren’t sure what I’m talking about, check the wikipedia reference for shell.

Step 1: Find the pattern needing to be replaced or updated, print out files needing change

find . -exec grep ‘ENTER STRING OR TEXT TO SEARCH FOR’ ‘{}’ \; -print

*Note: I’m using the “find” and “grep” commands to search for a matching pattern which will print out a list of files and directories that need changes. If I’m at the top level of my web site the “.” in the find command will search for the pattern down through any directories below. On a large site, the process can take some time.

Step 2: Move/copy files into test directory to test expression; preserve owners, groups, timestamps

cp -p -r test test-backup

*Note: These directories would be named according to the directories or files you need to change based on the results from Step 1. The “-p” will preserve owners groups and timestamps in the copied directory. The “-r” will copy recursively down through any associated sub-directories. I do this so I can compare the new directory to the original directory after I’ve test run the global changes.

Step 3: Run test on find and replace expression in /test-backup/ directory

find . \( -name “*.php” -or -name “*.html” \) | xargs grep -l ‘ENTER STRING OR TEXT TO SEARCH FOR’ | xargs sed -i -e ‘s/ENTER OLD STRING OR TEXT TO REPLACE/ENTER REPLACEMENT STRING OR TEXT/g

*Note: I’m using the “find .” command to search for .php and html files in the current working directory as I only want to target the files that need to be touched (you should change according to your requirements), next I’m piping that result to the “grep” command which searches for the string or text specified and holds only the matched files in memory, and finally I’m passing the grep result to the “sed” command which matches the string or text and replaces it with the new string or text value.

Step 4: Test files and applications to ensure changes didn’t break functionality and that owners, groups, timestamps were preserved

Step 5: After testing, run expression from Step 3 in ALL the directories or files needing the changes. Delete /test-backup/ directory

Steps 1 and 3 are the heart of the matter. I’m learning the power of these commands, so I’m pretty cautious about backing up and testing on directories and files that aren’t live. Once I have the expression dialed in, I’ll run it on a more global scale. So, there you have it – my find and replace process in a nutshell. Use at your own discretion and feel free to share your thoughts in the comments.


Computers in Libraries 2008 – Trends and Highlights

It’s been just over a week since I returned from Computers in Libraries. The InfoToday crew usually puts together a nice set of speakers and ideas and this year was more of the same. I’m not even going to try and summarize everything – check LibrarianInBlack for some of the best summaries or the Technorati CIL2008 tag to follow along from home. As I mentioned in a previous post, I arrived as the conference was winding down, but I was still able to pick up some tips, teach a couple of workshops, and spot some library trends. I’m going to focus on the trends part as the week has given me some time to collect my thoughts. So, here they are, the library trends I’m seeing (based on CIL’s programming and my interests).

Twitter and Libraries – Microblogging and its associated platforms are starting to be noticed and utilized in some library settings. Right now, the emphasis is on connecting to friends, but as more info gets shared in 140 character bits – the Twitter channel is becoming a resource. It’s all about following keywords and topics and choosing your Twitter network of followers (aka “friends”) Pownce and Tumblr are two similar services to watch.

Web Services for Everybody – When Yahoo Pipes came on the scene about a year ago, I wondered when it might start showing up as a tool for library mashups. It’s actually a pretty simple way to use web services in a graphical user interface. Pipes seems limited to pretty simple formats (RSS and ATOM) generally, but it introduces the power and concepts behind web services intuitively. In the long term, it’s still best to learn web services, XML, and some scripting for truly robust mashups, but Pipes lowers the bar for entry in a really nice way.

The Portable Library – At MSU libraries, we’ve been looking at ways to bring library resources into a user’s networked environment. See our widgets and tools for some examples. It was great to meet other developers and libraries pursuing similar efforts. I got to have an extended discussion with Binky Lush, lead web developer at Penn State University Libraries, about her efforts to place library web services into users’ working environments. It’s refreshing to see some of these attempts to move away from the gatekeeping model of web sites as single points of service. Leveraging the network and learning to broadcast bits and pieces of the library into multiple web spaces – iGoogle, iTunes, Course Management Systems – will be an important move for libraries going forward.

Open Source and Learning Outside the Profession – Open source solutions for libraries are becoming easier to implement, but it was nice to see the balanced conversation and practical examples of Open source possibilities for libraries that were part of the “Open Source” track moderated by Nicole Engard. I wasn’t able to see the “Beyond Libraries: Industries Using Hot Tech”, but the idea of looking outside our comfort zone and learning from other industries really resonates with me as an essential trend to follow. Steven Cohen (the track organizer) is onto something here. Innovation frequently happens elsewhere; let’s hear more about it.


Ajax and Web Services Workshops

I came a bit late to the Computers in Libraries 2008 party by arriving on Tuesday night, but I was stilI able to catch up with a few people and make some new friends. It was interesting presenting to a group as they were eating lunch (never done that one before), but the presentations went well. I also had a great time teaching the workshops yesterday. For those that are interested, all the files and code samples from my talks are available below.

Workshop: “Web Services for Libraries.”
Computers in Libraries, Crystal City, VA, 10 April 2008.
http://www.lib.montana.edu/~jason/talks/cil2008-workshop-webservices.pdf
http://www.lib.montana.edu/~jason/talks/cil2008-workshop-webservices-handout.pdf

Workshop: “Ajax (Asynchronous Javascript and XML) for Libraries.”
Computers in Libraries, Crystal City, VA, 10 April 2008.
http://www.lib.montana.edu/~jason/talks/cil2008-workshop-ajax.pdf
http://www.lib.montana.edu/~jason/talks/cil2008-workshop-ajax-handout.pdf

Cybertour: “Next-Generation Digital Libraries.”
Computers in Libraries, Crystal City, VA, 09 April 2008.
http://www.lib.montana.edu/~jason/talks/cil2008-session-diglib.pdf

Cybertour: “What To Do When Interface Design Goes Bad.”
Computers in Libraries, Crystal City, VA, 09 April 2008.
http://www.lib.montana.edu/~jason/talks/cil2008-session-interface.pdf


Web Design and Development Track – Internet Librarian 2007: Day 1

I spent most of my time in the development track today, but I did get a chance to move around more than I usually do. First impressions from my walk around the conference sessions:

  • Search is still huge. Thirty search tips from Mary Ellen Bates had the largest attendance. I’m not sure what to make of that. Librarians like to search, everyone else likes to …
  • Internet Librarian is just about the right size for me. Familiar faces from last year and participants in my workshops were easy to make contact with.

Some highlights from the “Web Design and Development Track”:

Session C101 — Planning & Implementing Library 2.0
10:15 a.m. – 11:00 a.m.
David King, Digital Branch & Services Manager, Topeka & Shawnee County Public Library

David Lee King presented on strategies for implementing web 2.0 in the library. It was great to see David address the “if you build it, they will come” myth. He stressed the need to ask questions about: why a new service is needed, how a service will be supported, and how to promote and encourage use of the service. A nice, balanced presentation.

Session C102 — Putting Evidence-Based Practice to Work
11:15 a.m. – 12:00 p.m.
Frank Cervone, Assistant University Librarian for Information Technology, Northwestern University
Amanda Hollister, Web Services Librarian, Memorial Library, SUNY Cortland

Frank Cervone and Amanda Hollister presented on moving towards a base of evidence for design and development decisions. Frank stressed that the research process was iterative. Ongoing and continual…. Amanda demoed a tracking user paths software application (built with ASP, XML, and Visual Basic). She was able to show anticipated paths and actual paths to content which was a nice measuring stick. It was a great session helping to frame exactly how to carry out research for development decisions and move away from the anecdotal.

Session C103 — New Rules of Web Design
1:15 p.m. – 2:00 p.m.
Jeff Wisniewski, Web Services Librarian, University of Pittsburgh

Jeff Wisniewski spoke about the new rules of web design. He took out the magnifying glass to really consider some of the pillars of web design. Among his findings: simplicity rules – we need to move away from religion of simplicity; content is king, but design matters; all content is created equally, but some content is more equal than other – eResources content is primary; design for 800×600? – 1024×768 is the new 800×600; RIP websafe palette – most devices are able to display a high range of colors; how often to redesign – constantly, iteratively; top of the page is prime real estate – nope, there is banner blindness. (Note to self: Jeff had a slide of at the end of all of his citations. I’ll have to get the link.)

Actual program descriptions are included below.

Session C101 — Planning & Implementing Library 2.0
10:15 a.m. – 11:00 a.m.
David King, Digital Branch & Services Manager, Topeka & Shawnee County Public Library

Has your library discussed creating a Flickr account? A MySpace teen site? Creating a blog? All these ideas are great, yet all have the potential to fail if not well-implemented. This session provides practical planning and implementation tips for dealing with emerging digital trends, focusing on setting up new Web 2.0 services such as MySpace, blogs, and Flickr to meet client needs.

Session C102 — Putting Evidence-Based Practice to Work
11:15 a.m. – 12:00 p.m.
Frank Cervone, Assistant University Librarian for Information Technology, Northwestern University
Amanda Hollister, Web Services Librarian, Memorial Library, SUNY Cortland

Delivering services based on evidence, rather than anecdotes, is a growing trend within librarianship. Learn how two libraries have introduced evidence-based practice into the Web design process. The Northwestern case study explores the implementation of research into practice through an examination of the environment and the method of facilitation that led to evidence-based decision making for the library’s Web site. The Memorial Library Web site team collects and analyzes paths that users take through the site to discover what users are doing. Do students use the subject pages? How many links do they click before entering a database? Learn how the library has started to use the information about paths and user groups to create a personalized Web site.

Session C103 — New Rules of Web Design
1:15 p.m. – 2:00 p.m.
Jeff Wisniewski, Web Services Librarian, University of Pittsburgh

Web design has evolved over the last decade: Do you know what the new rules are? Is less still more? Is scrolling bad? Is Flash still verboten? Learn about which design guidelines are still relevant, which no longer apply, and what you need to know to design a site that’s useful, usable, and attractive in the Web 2.0 world.


Ajax Workshop – Internet Librarian 2007

My preconference,”AJAX for Libraries”, with Karen Coombs went really well. It’s always great working with Karen. She’s cool, composed, and “wicked” knowledgeable. For the second year in a row, we had a great group of participants. It’s nice to see a growing interest in emerging web programming frameworks and how they might be applied to libraries.

Here are the updated slides and links:

“AJAX for Libraries” Presentation
“AJAX for Libraries” Handout (Code Samples and Explanations)
“AJAX for Libraries” Code Downloads

And some additional examples of libraries using AJAX:


Follow

Get every new post delivered to your Inbox.