Library Hat Rotating Header Image

2012:

Effectively Learning How To Code: Tips and Resources

*** This post has been originally published in ACRL TechConnect on Dec. 10, 2012. ***

Librarians’ strong interest in programming is not surprising considering that programming skills are crucial and often essential to making today’s library systems and services more user-friendly and efficient for use. Not only for system-customization, computer-programming skills can also make it possible to create and provide a completely new type of service that didn’t exist before. However, programming skills are not part of most LIS curricula, and librarians often experience difficulty in picking up programming skills.

In this post, I would like to share some effective strategies to obtain coding skills and cover common mistakes and obstacles that librarians make and encounter while trying to learn how to code in the library environment based upon the presentation that I gave at Charleston Conference last month, “Geek out: Adding Coding Skills to Your Professional Repertoire.” (slides: http://www.slideshare.net/bohyunkim/geek-out-adding-coding-skills-to-your-professional-repertoire). At the end of this post, you will also find a selection of learning and community resources.

How To Obtain Coding Skills, Effectively

1. Pick a language and concentrate on it.

There are a huge number of resources available on the Web for those who want to learn how to program. Often librarians start with some knowledge in markup languages such as HTML and CSS. These markup languages determine how a block of text are marked up and presented on the computer screen. On the other hand, programming languages involve programming logic and functions. An understanding of the basic programming concepts and logic can be obtained by learning any programming language. There are many options, and some popular choices are JavaScript, PHP, Python, Ruby, Perl, etc. But there are many more.  For example, if you are interested in automating tasks in Microsoft applications such as Excel, you may want to work with Visual Basic. If you are unsure about which language to pick, search for a few online tutorials for a few languages to see what their different syntaxes and examples are like. Even if you do not understand the content completely, this will help you to pick the language to learn first.

2. Write and run the code.

Once you choose a language to learn, there are many paths that you can follow. Taking classes at a local community college or through an online school may speed up the initial process of learning, but it could be time-consuming and costly. Following online tutorials and trying each example is a good alternative that many people take. You may also pick up a few books along the way to supplement the tutorials and use them for reference purposes.

If you decide on self-study, make sure that you actually write and run the code in the examples as you follow along the books and the tutorials. Most of the examples will appear simple and straightforward. But there is a big difference between reading through a code example and being actually able to write the code on your own and to run it successfully. If you read through programming tutorials and books without actually doing the hands-on examples on your own, you won’t get much benefit out of your investment. Programming is a hands-on skill as much as an intellectual understanding.

3. Continue to think about how coding can be applied to your library.

Also important is to continue to think about how your knowledge can be applied to your library systems and environment, which is often the source of the initial motivation for many librarians who decide to learn how to program. The best way to learn how to program is to program, and the more you program the better you will become at programming. So at every chance of building something with the new programming language that you are learning, no matter how small it is, build it and test out the code to see if it works the way you intended.

4. Get used to debugging.

While many who struggle with learning how to code cite lack of time as a reason, the real cause is likely to be failing to keep up the initial interest and persist in what you decided to learn. Learning how to code can be exciting, but it can also be a huge time-sink and the biggest source of frustration from time to time. Since the computer code is written for a machine to read, not for a human being, one typo or a missing semicolon can make the program non-functional. Finding out and correcting this type of error can be time-consuming and demoralizing. But learning how to debug is half of programming. So don’t be discouraged.

5. Find a community for social learning and support.

Having someone to talk to about coding problems while you are learning can be a great help. Sign up for listservs where coding librarians or library coders frequent, such as code4lib and web4lib to get feedback when you need. Research the cause of the problem that you encounter as much as possible on your own. When you still are unsure about how to go about tackling it, post your question to the sites such as Stack Overflow for suggestions and answers from more experienced programmers. It is also a good idea to organize a study group with like-minded people and get support for both coding-related and learning-related problems. You may also find local meet-ups available in your area using sites like MeetUp.com.

Don’t be intimidated by those who seem to know much more than you in those groups (as you know much more about libraries than they do and you have things to contribute as well), but be aware of the cultural differences between the developer community and the librarian community. Unlike the librarian community that is highly accommodating for new librarians and sometimes not-well-thought-out questions, the developer community that you get to interact with may appear much less accommodating, less friendly, and less patient. However, remember that reading many lines of code, understanding what they are supposed to do, and helping someone to solve a problem occurring in those lines can be time-consuming and difficult even to a professional programmer. So it is polite to do a thorough research on the Web and with some reference resources first before asking for others’ help. Also, always post back a working solution when your problem is solved and make sure to say thank you to people who helped you. This way, you are contributing back to the community.

6. Start working on a real-life problem ‘now.’ Don’t wait!

Librarians are often motivated to learn how to code in order to solve real-life problems they encounter at their workplace. Solving a real-life problem with programming is therefore the most effective way to learn and to keep up the interest in programming. One of the greatest mistake in learning programming is putting off writing one’s own code and waiting to work on a real-life problem for the reason that one doesn’t know yet enough to do so. While it is easy to think that once you learn a bit more, it would be easier to approach a problem, this is actually a counter-productive learning strategy as far as programming is concerned because often the only way to find out what to learn is by trying to solve a problem.

7. Build on what you learned.

Another mistake to avoid in learning how to program is failing to build on what one has learned. Having solved one set of problem doesn’t mean that you will remember that programming solution you created next time when you have to solve a similar problem. Repeating what one has succeeded at and expanding on that knowledge will lead to a stronger foundation for more advanced programming knowledge. Also instead of trying to learn more than one programming language (e.g. Python, PHP, Ruby, etc.) and/or a web framework (e.g. Django, cakePHP, Ruby On Rails, etc.) at the same time, first try to become reasonably good at one. This will make it much easier to pick up another language later in the future.

8. Code regularly and be persistent.

It is important to understand that learning how to program and becoming good at it will take time. Regular coding practice is the only way to get there. Solving a problem is a good way to learn, but doing so on a regular basis as often as possible is the best way to make what you learned stick and stay in your head.

While is it easy to say practice coding regularly and try to apply it as much as possible to the library environment, actually doing so is quite difficult. There are not many well-established communities for fledgling coders in libraries that provide needed guidance and support. And while you may want to work with library systems at your workplace right away, your lack of experience may prove problematic in gaining a necessary permission to tinker with them. Also as a full-time librarian, programming is likely to be thrown to the bottom of your to-do list.

Be aware of these obstacles and try to find a way to overcome them as you go. Set small goals and use them as milestones. Be persistent and don’t be discouraged by poor documentation, syntax errors, and failures. With consistent practice and continuous learning, programming can surely be learned.

Resources

A. Resources for learning

B. Communities

 

Present Your Slides without Access to the Internet with Free IPad Apps

*** This post has been also published on ACRL TechConnect on Nov. 20, 2012. ***

Librarians often use presentation slides to teach a class, run a workshop, or give a talk. Ideally you should be able to access the Internet easily at those places. But more often than not, you may find only spotty Internet signals. If you had planned on using your presentation slides stored in the cloud, no access to the Internet would mean no slides for your presentation. But it doesn’t have to be that way. In this post, we will show you how to locally save your presentation slides on your iPad, so that you will be fully prepared to present without Internet access. You will only need a few tools, and the best of all, those tools are all freely available.

1. Haiku Deck – Make slides on the iPad

If your presentation slides do not require a lot of text, Haiku Deck is a nice iPad app for creating a complete set of slides without a computer. The Haiku Deck app allows you to create colorful presentation slides quickly by searching and browsing a number of CC-licensed images and photographs in Flickr and to add a few words to each slide. Once you select the images, Haiku Deck does the rest of work, inserting the references to each Flickr image you chose and creating a nice set of presentation slides.

You can play and present these slides directly from your iPad. Since Haiku Deck stores these slides locally, you need access to the Internet only while you are creating the slides using the images in Flickr through Haiku Deck. For presenting already-made slides, you do not need to be connected to the Internet. If you would like, you can also export the result as a PowerPoint file from Haiku Deck. This is useful if you want to make further changes to the slides using other software on your computer. But bear in mind that once exported as a PowerPoint file, the texts you placed using Haiku Deck are no longer editable. Below is an example that shows you how the slides made with Haiku Deck look like.

Note. Click the image itself in order to see the bigger version.

So next time when you get a last-minute instruction request from a teaching faculty member, consider spending 10-15 minutes to create a colorful and eye-catching set of slides with minimal text to have it accompany your classroom instruction or a short presentation all on your iPad.

2. SlideShark – Display slides on the iPad

SlideShark is a tool not so much for creating slides as for displaying the slides properly on the iPad (and also for the iPhone). In order to use SlideShark, you need to install the SlideShark app on your iPad first and then create an account. Once this is done, you can go to the SlideShark website (https://www.slideshark.com/) and log in. Here you can upload your presentation files in the MS PowerPoint format.

Once the file is uploaded to the SlideShark website, open the SlideShark app on your iPad and sync your app with the website by pressing the sync icon on top. This will display all the presentation files that have been uploaded to your SlideShark website account. Here, you can download and save a local copy of your presentation on your iPad. You will need the live Internet connection for this task. But once your presentation file is downloaded onto your SlideShark iPad app, you no longer need to be online in order to display and project those slides. While you are using your iPad to display your slides, you can also place your finger on the iPad screen which will be displayed on the projector as a laser pointer mark.

SlideShark also recently added the integration option with a user’s Dropbox or Box account and the support for playing the embedded video in a PowerPoint file.

3. Adapter

Last but not least, when you pack your iPad and run to your classroom or presentation room, don’t forget to take your adapter. In order to connect your iPad to a projector, you usually need a iPad-VGA adapter because most projectors have a VGA port. But different adapters are used for different ports on display devices. So find out in advance if the projector you will be using has a VGA, DVI, or a HDMI port. (Also remember that if you have an adapter that connects your Macbook with a projector, that adapter will not work for your iPad. That is a mini DVI-VGA adapter and won’t work with your iPad.)

4. Non-free option: Keynote

Haiku Deck and SlideShark are both free. But if you are willing to invest about ten dollars for convenience, another great presentation app is Keynote (currently $9.99 in Apple Store). While Haiku Deck is most useful for creating simple slides with a little bit of text, Keynote allows you to create more complicated slides on your iPad. If you use Keynote, you also don’t have to go through SlideShark for the off-line display of your presentation slides.

Creating presentations on the Keynote iPad app is simple and uses the same conventions and user-interface as the familiar Keynote application for OS X. Both versions of Keynote can share the same presentation files, although care should be taken to use 1024 x 768 screen resolution and standard Apple fonts and slide templates. iCloud may be used to sync presentations between iPads and other computers and users can download presentations to the iPad and present without Internet access.

The iPad version of Keynote has many features that make Keynote loved by its users. You can add media, tables, charts, and shapes into your presentation. Using Keynote, you can also display your slides to the audience on the attached projector while you view the same slides with a timer and notes on your iPad. (See the screenshots below.) For those with an iPhone or iPod Touch, the Keynote Remote app allows presenters to remotely control their slideshows without the need to stand at the podium or physically touch the iPad to advance their slides.

Do you have any useful tips for creating slides and presenting with an iPad? Share your ideas in the comments!

Enabling the Research ‘Flow’ and Serendipity in Today’s Digital Library Environment

*** This post has been also published on ACRLog on Oct. 29, 2012. ***

Today’s library users do not carry pencils and notebooks to a library. They do no longer want to be isolated to concentrate on deep study or contemplative reading when they are at a library. Rather, they have the dire need to be connected to the biggest library the human race ever had, the World Wide Web, always and even more so when they are at a library walking through the forest of fascinating knowledge and information. The traditional library space packed with stacks and carrels does not serve today’s library users well whether they are scholars, students, or the public visiting a library for research, study, or leisure reading. As more and more library resources are moved to the fast and convenient realm of the World Wide Web, libraries have been focusing on re-defining the library space. Now, many libraries boast attractive space almost comparable to trendy, comfortable, and vibrant coffee shops. The goal of these new library spaces are fostering communication, the exchange of ideas, and social learning.

How the loss of book stacks and carrels affects library patrons

However, some library patrons complain about this new and hip research and reading environment that libraries are creating. They do not experience comfort and excitement, which today’s libraries strive to provide in their new coffee-shop-or-makerspace-like library space. These patrons rather miss the old dusty moldy stacks packed with books, many of which were left untouched except by a handful of people for a very long time. They miss the quiet and secluded carrels often placed right outside of the stacks. They say that browsing a library’s physical collection in those stacks led them to many serendipitous discoveries and that in those tiny uncomfortable carrels, they were completely absorbed into their own thoughts reading away a pile of books and journals undisturbed by the worldly hustle and bustle.

This is an all-too-familiar story. The fast and convenient e-resources in library websites and the digital library collections seem to deprive us of something significant and important, that is, the secluded and sacred space for thought and contemplation and the experience of serendipitous discovery from browsing physical library collections. However, how much of this is our romantic illusion and how much of it is it a real fact?

How much of this environment made our research more productive in reality?

What we really love about browsing book stacks at a library

In the closing keynote of 2012 ACCESS Conference last Sunday, Bess Sadler, the application development manager at Standford University Libraries noted the phenomenon that library patrons often describe the experience of using the physical library collection in emotional terms such as ‘joyous,’ ‘immersive,’ and ‘beautiful’ characteristic to our right brain whereas they use non-emotional terms such as ‘fast’ and ‘efficient’ to describe their use of a library’s online/digital resources. The open question that she posed in her keynote was how to bring back those emotional responses associated with a library’s physical collection to a library’s digital collection and its interface. Those terms such as ‘joyous,’ ‘immersive,’ and ‘beautiful’ are often associated in a library user’s mind with their experience of serendipitous discovery which took place while they were browsing a library’s physical book stacks. Sadler further linked the concept of serendipitous discovery with the concept of ‘flow’ by Csikszentmihalyi and asked the audience how libraries can create such state of flow with their digital collections by improving their interfaces.

One of the slides from Bess Sadler’s Closing Keynote

This was a very interesting question to me because I have been mostly thinking about the concept of flow in the context of library services (and more specifically, gamification applied to libraries) and the usability of the systems that serve a library’s online resources.

The most annoying thing about the e-resources that today’s libraries offer is that the systems where these resources reside do not smoothly fit into anyone’s research workflow. How can you get into a zone when the database you are in keeps popping up a message asking if you want to renew the session or demands two or three different authentications for access? How can you feel the sense of smooth flow of thought in your head when you have to navigate from one system to another with puzzling and unwieldy interfaces in order to achieve simple tasks such as importing a few references or finding the full-text of the citation you found in an e-book or an online journal you were reading?

Today’s research environment that libraries offers with its electronic resources is riddled with so many irritating usability failures (often represented by too many options none of whose functions are clear) that we can almost safely say that it is designed anything but for the ‘flow’ experience. The fact that these resources’ interfaces are designed by library system vendors and light years outdated compared to the interfaces available for individual consumers and that librarians have little or no control over them only exacerbate the problem. So I always associated the concept of flow with usability in the library context. And considering how un-user-friendly the research environment offered by today’s libraries is overall, asking for ‘joyous,’ ‘immersive,’ or ‘beautiful’ appeared to me to be a pretty tall order.

But more importantly, the obstacles to the ‘flow’ experience are not unique to online resources or digital libraries. Similar problems do exist in the physical collections as well. When I was a grad student, the largest library collection in North America was available to me.  But I hated lugging back and forth a dozen periodicals and monographs between my apartment and the university just to get them renewed. (This was the time before the online renewal!) After the delightful moment of finding out in the online catalog that those rare scholarly books that I want are indeed available somewhere in that large library system at Harvard, I grumbled at the prospect of either navigating the claustrophobic rows and rows of stacks at Widener Library in order to locate those precious copies or running to a different library on campus that is at least a half mile away. At those times, the pleasure of browsing the dusty stacks or the joy of a potential serendipitous discovery was the last thing that I cared for. I was very much into my research and exactly for that reason, if I could, I would have gladly selected the delivery option of those books that I wanted to save time and get into my research flow as soon as possible. And I did so as soon as my university library started moving many books to an off-site storage and delivering them on-demand next day at a circulation desk. I know that many faculty at academic institutions strongly protest against moving a library’s physical collection to an off-site storage. But I confess that many times when the library catalog showed the book I wanted as located on the stacks and not at the off-site storage, I groaned instead of being delighted. I won’t even discuss what it was like to me to study in a library carrel. As an idea, it is a beautiful one to be immersed in research readings in a carrel; in reality, the chair is too hard, the space is too dark and claustrophobic, the air is stale, and the coffee supply is, well, banned near the stacks where those carrels are. Enough said.

The point I am trying to make is that we often romanticize our interaction with the physical stacks in a library. The fact that we all love the library stacks and carrels doesn’t necessarily mean that we love them for the reasons we cite. More often than not, what we really like and miss about the library stacks and carrels is not their actual practical utility to our research process but the ambiance. Strand, the used bookstore in NYC is famous for its 18 miles of books. Would you walk along the 18 miles of books even if you know in advance that you are not going to make any serendipitous discovery nor find nothing directly useful for your research topic at hand? Yes you bet. Would you walk by the stacks in Trinity College Library in Dublin,  UK even though you are not doing anything related to research? A very few of us would say ‘No’ to such an invitation.

Can you resist walking between these stacks? Our desire doesn’t always correspond to its practical utility.

But the fact that library stacks and browsing them may contribute very little to the actual research output doesn’t mean that the stack-browsing is therefore not useful. To borrow the words of Saint-Exupéry, something is truly useful because it is beautiful (The Little Prince, Ch. 14). Let me explain.

The library book stacks as high as the walls filling up the whole floor generate the sense of awe and adventure in us because it gives us the experience of ‘physically’ surrounded by knowledge. It is magical and magnificent. It is amazing and beautiful. This is where all those emotional adjectives originate. In the library stacks, we get to ‘see’ the knowledge that is much bigger than us, taller than us, and wider than us. (Think of ‘the sublime’ in Kantian aesthetics.) When our sensory organs are engaged this way, we do not experience the boredom and tediousness that we usually feel when we scroll up and down a very long list of databases and journals on a library web page. We pause, we admire, and we look up and down. We are engrossed by the physicality of the stacks and the books on them. And suddenly all our attention is present and focused on that physicality. So much so that we even forget that we were there to find a certain book or to work on a certain research topic. It is often at these moments that we serendipitously stumble upon something  relevant to what we were looking for but have forgotten to do so. Between the magnificent tall stacks filled with books, you are distracted from your original mission (of locating a particular book) but are immersed in this new setting at the same time. The silence, the high ceiling, the Gothic architectural style of an old library building, and the stacks that seems to go on forever in front of us. These are all elements that can be conducive to a serendipitous discovery but “if and only if” we allow ourselves to be influenced by them. On the other hand, if you are zooming in on a specific book, all of this visual magnificence could be a nuisance and a bother. To a scholar who can’t wait to read all of the readings after physically collecting them first, the collection process is a chore at best. To this person, neither a serendipitous discovery nor the state of ‘flow’ would be no doubt more difficult to happen in between the stacks.

If this is a relatively accurate description of a serendipitous discovery that we experience while browsing the physical collection on library book-stacks, what we really miss about the traditional library space may well be the physicality of its collection, the physical embodiment of the abstract concept of knowledge and information in abundance, and its effect on our mental state, which renders our mind more susceptible to a serendipitous discovery. And what we are most unhappy about the digital form of knowledge and information offered by today’s libraries could be that it is not presented in the space and environment where we can easily tune our mind into the content of such digital knowledge and information. It is the same Classical Greek text that you see when you pull out an old copy of Plato’s Meno in the narrow passage between tall book-stacks at Widener and when you pull up the text on your computer screen from the Perseus Digital Library. It is our state of mind influenced by the surroundings and environment that is different.  That state of mind that we miss is not entirely dictated but heavily influenced by the environment we are present.  We become different people at different places, as Alain de Botton says in his book, The Architecture of Happiness (Ch 1). Who can blame a library user when s/he finds it hard to transform a computer screen (which takes her to many digital collections and online resources from a library as well as all sorts of other places for entertainment and distraction) into the secluded and sacred space for thought and contemplation?

Using Perseus Digital Library is way more efficient for research and study the classical Greek texts than using the physical collection on your stacks. However, we still miss and need the experience of browsing the physical collection on the stacks.

How to facilitate the ‘flow’ and serendipity in today’s libraries

The fact that today’s libraries no longer control the physical surroundings of a library patron who is making use of their resources doesn’t mean that there are nothing libraries can do to make the research environment facilitate serendipitous discoveries and the state of ‘flow’ in a researcher’s mind, however.  Today’s libraries offer many different systems for library users to access their online resources. As I have mentioned above, the interfaces of these systems can use some vast improvement in usability. When there are as few hindrances as possible for a library patron to get to what s/he is looking for either online or at the physical library space, s/he would be able to concentrate on absorbing the content more easily instead of being bogged down with procedures. The seamless interoperability between different systems would be very much desirable for researchers. So, improving the usability of library systems will take library patrons one step closer to obtaining the flow state in their research while using library resources online.

As far as the physical space of a library is concerned, libraries need to pay more attention to how the space and the environment of a library emotionally affects library patrons. Not all research and study is best performed by group-study or active discussion. Baylor University Libraries, for example, designate three different zones in their space: Silent, Quiet, and Active. While libraries transform more of their traditional stack-and-carrel space into vibrant group study rooms and conversation-welcoming open spaces, they also need to preserve the sense of the physical environment and surroundings for library patrons, because after all, all of us desire the feeling of being in a sacred and dedicated space for contemplation and deep thoughts from time to time. Such space is becoming rarer and rarer nowadays. Where else would people look for such space if not a library, which the public often equate to a building that embodies the vast amount of knowledge and resources in the physical form.

Facilitating the serendipitous discovery in browsing a library collection in the digital environment is more tricky because of the limitation of the current display mechanisms for digital information. In emulating the experience of browsing books in the physical form on a computer screen, the Google WebGL Bookcase has made some progress. But it would be much more efficient combined with a large display mechanism that allows a user to control and manipulate information and resources with gestures and bodily movements, perhaps something similar to what we have seen in the movie, Minority Report.  However, note that information does not have to be bound in the form of books in the digital environment and that digital books do not have to be represented as a book with pages to thumb through and the spine where its title is shown . If we set aside the psychological factors that contribute to the occurrence of a serendipitous discovery, what is essential to efficient browsing boils down to how easily (i) we can scan through many different books (or information units such as a report or an article) quickly and effectively and (ii) zoom in/out and switch between the macro level (subjects, data types, databases, journals, etc) and the micro level (individual books, articles, photographs, etc. and their content).  If libraries can succeed in designing and offering such interfaces for digital information consumption and manipulation, the serendipitous discovery and the efficient browsing in the digital library environment can not only match but even exceed that in the physical library book-stacks.

 

More APIs: writing your own code (2)

*** This blog post has been originally published in ACRL TechConnect 0n October 9, 2012. ***

My previous post “The simpest AJAX: writing your own code (1)” discussed a few Javascript and JQuery examples that make the use of the Flickr API. In this post, I try out APIs from providers other than Flickr. The examples will look plain to you since I didn’t add any CSS to dress them up. But remember that the focus here is not in presentation but in getting the data out and re-displaying it on your own. Once you get comfortable with this process, you can start thinking about a creative and useful way in which you can present and mash up the same data. We will go through 5 examples I created with three different APIs.  Before taking a look at the codes, check out the results below first.

I. Pinboard API

The first example is Pinboard. Many libraries moved their bookmarks in Del.icio.us to a different site when there was a rumor that Del.cio.us may be shut down by Yahoo. One of those sites were Pinboard.  By getting your bookmark feeds from Pinboard and manipulating them, you can easily present a subset of your bookmark as part of your website.

(a) Display bookmarks in Pinboard using its API

The following page uses JQuery to access the JSONP feed of my public bookmarks in Pinboard. $.ajax() method is invoked on line 13. Line 15, jsonp:”cb”, gives the name to a callback function that will wrap the JSON feed data in it. Note line 18 where I print out data received into the console. This way, you can check if you are receiving JSONP feed in the console of Firebug. Line 19-22 uses $.each() function to access each element in the JSONP feed and the .append() method to add each bookmark’s title and url to the “pinboard” div. JQuery documentation has detailed explanation and examples for its functions and methods. So make sure to check it out if you have any questions about a JQuery function or method.

Pinboard API – example 1

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Pinboard: JSONP-AJAX Example</title>
<script type="text/javascript" src="http://jqueryjs.googlecode.com/files/jquery-1.3.2.min.js"></script>
</head>
<body>
<p> This page takes the JSON feed from <a href="http://pinboard.in/u:bohyunkim/">my public links in Pinboard</a> and re-presents them here. See <a href="http://feeds.pinboard.in/json/u:bohyunkim/">the Pinboard's JSON feed of my links</a>.</p>
<div id="pinboard"><h1>All my links in Pinboard</h1></div>
<script>
$(document).ready(function(){	
$.ajax({
  url:'http://feeds.pinboard.in/json/u:bohyunkim',
  jsonp:"cb",
  dataType:'jsonp',
  success: function(data) {
  	console.log(data); //dumps the data to the console to check if the callback is made successfully
    $.each(data, function(index, item){
      $('#pinboard').append('<div><a href="' + item.u + '">' + item.d
+ '</a></div>');
      }); //each
    } //success
  }); //ajax

});//ready
</script>
</body>
</html>

Here is the screenshot of the page. I opened up the Console window of the Firebug (since I dumped the received in line 18) and you can see the incoming data here. (Note. Click the images to see the large version.)

But it is much more convenient to see the organization and hierarchy of the JSONP feed in the Net panel of Firebug.

And each element of the JSONP feed can be drilled down for further details by clicking the object in each row.

(b) Display only a certain number of bookmarks

Now, let’s display only five bookmarks. In order to do this, only one more line is needed. Line 9 checks the position of each element and breaks the loop when the 5th element is processed.

Pinboard API – example 2

$.ajax({
  url:'http://feeds.pinboard.in/json/u:bohyunkim',
  jsonp:"cb",
  dataType:'jsonp',
  success: function(data) {
    $.each(data, function(index, item){
      	$('#pinboard').append('<div><a href="' + item.u + '">' + item.d
+ '</a></div>');
    	if (index == 4) return false; //only display 5 items
      }); //each
    } //success
  }); //ajax

(c) Display bookmarks with a certain tag

Often libraries want to display bookmarks with a particular tag. Here I add a line using JQuery method $.inArray() to display only bookmarks tagged with ‘fiu.’ $.inArray()  method takes value and array as parameters and returns 0 if the value is found in the array otherwise -1. Line 7 checks if the tag array of a bookmark (item.t) does include ‘fiu,’ and only in such case displays the bookmark. As a result, only the bookmarks with the tag ‘fiu’ are shown in the page.

Pinboard API – example 3

$.ajax({
  url:'http://feeds.pinboard.in/json/u:bohyunkim',
  jsonp:"cb",
  dataType:'jsonp',
  success: function(data) {
    $.each(data, function(index, item){
    	if ($.inArray("fiu", item.t)!==-1) // if the tag is 'fiu'
      		$('#pinboard').append('<div><a href="' + item.u + '">' + item.d
+ '</a></div>');
	}); //each
    } //success
  }); //ajax

II. Reddit API

My second example uses Reddit API. Reddit is a site where people comment on news items of interest. Here I used $.getJSON() instead of $.ajax() in order to process the JSONP feed from the Science section of Reddit. In the case of Pinboard API, I could not find out a way to construct a link that includes a call back function in the url. Some of the parameters had to be specified such as jsonp:”cb”, dataType:’jsonp’. For this reason, I needed to use $.ajax() function. On the other hand, in Reddit, getting the JSONP feed url was straightforward: http://www.reddit.com/r/science/.json?jsonp=cb.

Line 19 adds a title of the page. Line 20-22 extracts the title and link to the news article that is being commented and displays it. Under the news item, the link to the comments for that article in Reddit is added as a bullet item. You can see that, in Line 17 and 18, I have used the console to check if I get the right data and targeting the element I want and then commented out later.

This is just an example, and for that reason, the result is a rather simplified version of the original Reddit page with less information. But as long as you are comfortable accessing and manipulating data at different levels of the JSONP feed sent from an API, you can slice and dice the data in a way that suits your purpose best. So in order to make a clever mash-up, not only the technical coding skills but also your creative ideas of what different sets of data and information to connect and present to offer something new that has not been available or apparent before.

My second example uses Reddit API. Reddit is a site where people comment on news items of interest. Here I used $.getJSON() method instead of $.ajax() in order to process the JSONP feed from the Science section of Reddit. In the case of Pinboard API, I could not find out a way to construct a link for a call back function. Some of the parameters had to be specified such as jsonp:”cb”, dataType:’jsonp’. So I needed to use $.ajax() method.

On the other hand, in Reddit, getting the JSONP feed url was straightforward: http://www.reddit.com/r/science/.json?jsonp=cb.   Line 19 adds a title of the page. Line 20-22 extracts the title and link to the news article that is being commented and displays it. Under the news item, the link to the comments for that article in Reddit is added as a bullet item.You can see that in Line 17 and 18, I have used the console to check if I get the right data and targeting the element I want.

This is just an example, and for that reason, the result is rather a simplified version of the original Reddit page with less information. But as long as you are comfortable accessing and manipulating data at different levels of the JSONP feed sent from an API, you can slice and dice the data in a way that suits your purpose best.

Reddit API – example

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Reddit-Science: JSONP-AJAX Example</title>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.0/jquery.min.js"></script>
</head>

<body>
<p> This page takes the JSONP feed from <a href="http://www.reddit.com/r/science/">Reddit's Science section</a> and presents the link to the original article and the comments in Reddit to the article as a pair. See <a href="http://www.reddit.com/r/science/.json?jsonp=?">JSONP feed</a> from Reddit.</p>

<div id="feed"> </div>
<script type="text/javascript">
	//run function to parse json response, grab title, link, and media values, and then place in html tags
$(document).ready(function(){		
	$.getJSON('http://www.reddit.com/r/science/.json?jsonp=?', function(rd){
		//console.log(rd);
		//console.log(rd.data.children[0].data.title);
		$('#feed').html('<h1>*Subredditum Scientiae*</h1>');
		$.each(rd.data.children, function(k, v){
      		$('#feed').append('<div><p>'+(k+1)+': <a href="' + v.data.url + '">' + v.data.title+'</a></p><ul><li style="font-variant:small-caps;font-size:small"><a href="http://www.reddit.com'+v.data.permalink+'">Comments from Reddit</a></li></ul></div>');
      }); //each
	}); //getJSON
});//ready	
</script>

</body>
</html>

The structure of a JSON feed can be confusing to make out particularly. So make sure to use the Firebug Net window to figure out the organization of the feed content and the property name for the value you want.

But what if the site from which you would like to get data doesn’t offer JSONP feed? Fortunately you can convert any RSS or XML feed into JSONP feed. Let’s take a look!

III. PubMed Feed with Yahoo Pipes API

Consider this PubMed search. This is simple search that looks for items in PubMed that has to do with Florida International University College of Medicine where I work. You may want to access the data feed of this search result, manipulate, and display in your library website. So far, we have performed a similar task with the Pinboard and the Reddit API using JQuery. But unfortunately PubMed does not offer any JSON feed. We only get RSS feed instead from PubMed.

This is OK, however. You can either manipulate the RSS feed directly or convert the RSS feed into JSON, which you are more familiar with now. Yahoo Pipes is a handy tool for just that purpose. You can do the following tasks with Yahoo Pipes:

  • combine many feeds into one, then sort, filter and translate it.
  • geocode your favorite feeds and browse the items on an interactive map.
  • power widgets/badges on your web site.
  • grab the output of any Pipes as RSS, JSON, KML, and other formats.

Furthermore, there may be a pipe that has been already created for exactly what you want to do by someone else. As PubMed is a popular resource, I found a pipe for PubMed search. I tested, copied the pipe, and changed the search term. Here is the screenshot of my Yahoo Pipe.

If you want to change the pipe, you can click “View Source” and make further changes. Here I just changed the search terms and saved the pipe.

After that, you want to get the results of the Pipe as JSON. If you hover over the “Get as JSON” link in the first screenshot above, you will get a link: http://pipes.yahoo.com/pipes/pipe.run?_id=e176c4da7ae8574bfa5c452f9bb0da92&_render=json&limit=100&term=”Florida International University” and “College of Medicine” But this returns JSON, not JSONP.

In order to get that JSON feed wrapped into a callback function, you need to add this bit, &_callback=myCallback, at the end of the url: http://pipes.yahoo.com/pipes/pipe.run?_id=e176c4da7ae8574bfa5c452f9bb0da92&_render=json&limit=10&term=%22Florida+International+University%22+and+%22College+of+Medicine%22&_callback=myCallback. Now the JSON feed appears wrapped in a callback function like this: myCallback( ). See the difference?

Line 25 enables you to bring in this JSONP feed and invokes the callback function named “myCallback.” Line 14-23 defines this callback function to process the received feed. Line 18-20 takes the JSON data received at the level of data.value. item, and prints out each item’s title (item.title) with a link (item.link). Here I am giving a number for each item by (index+1). If you don’t put +1, the index will begin from 0 instead of 1. Line 21 stops the process when the processed item reaches 5 in number.

Yahoo Pipes API/PubMed – example

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>PubMed and Yahoo Pipes: JSONP-AJAX Example</title>
<script type="text/javascript" src="http://jqueryjs.googlecode.com/files/jquery-1.3.2.min.js"></script>
</head>
<body>
<p> This page takes the JSONP feed from <a href="http://pipes.yahoo.com/pipes/pipe.info?_id=e176c4da7ae8574bfa5c452f9bb0da92"> a Yahoo Pipe</a>, which creates JSONP feed out of a PubMed search results and re-presents them here. 
<br/>See <a href="http://pipes.yahoo.com/pipes/pipe.run?_id=e176c4da7ae8574bfa5c452f9bb0da92&_render=json&limit=10&term=%22Florida+International+University%22+and+%22College+of+Medicine%22&_callback=myCallback">the Yahoo Pipe's JSON feed</a> and <a href="http://www.ncbi.nlm.nih.gov/pubmed?term=%22Florida%20International%20University%22%20and%20%22College%20of%20Medicine%22">the original search results in PubMed</a>.</p>
<div id="feed"></div>
<script type="text/javascript">
	//run function to parse json response, grab title, link, and media values - place in html tags
	function myCallback(data) {
		//console.log(data);
		//console.log(data.count);
		$("#feed").html('<h1>The most recent 5 publications from <br/>Florida International University College of Medicine</h1><h2>Results from PubMed</h2>');
		$.each(data.value.items, function(index, item){
      		$('#feed').append('<p>'+(index+1)+': <a href="' + item.link + '">' + item.title
+ '</a></p>');
        if (index == 4) return false; //display the most recent five items
      }); //each
	} //function
	</script>
<script type="text/javascript" src="http://pipes.yahoo.com/pipes/pipe.run?_id=e176c4da7ae8574bfa5c452f9bb0da92&_render=json&limit=10&term=%22Florida+International+University%22+and+%22College+of+Medicine%22&_callback=myCallback"></script>
</body>
</html>

Do you feel more comfortable now with APIs? With a little bit of JQuery and JSON, I was able to make a good use of third-party APIs. Next time, I will try the Worldcat Search API, which is closer to the library world and see how that works.

A bad business model or a savvy market strategy? Thinking like a vendor

I want to talk about an e-book platform called Inkling whose web version is not cross-browser compatible. But what I am really interested to talk about is neither an ebook platform nor its cross-browser support. I am interested in thinking about the way we assess and evaluate resource products from vendors and their market strategies as librarians. I am using Inkling just as an example to touch on this topic.

Inkling is a company that makes an interactive textbook. It works with publishers to get a contract for certain titles of theirs, so that those titles can be made to e-books that run on and are sold at the Inkling platform. Inkling originally started as an e-book platform app on the iOS device such as an iPad and iPhone. The Inkling platform is quite nice. Adding annotation is easy and the page numbers of a print book is clearly marked on the side of its e-book version. Inkling e-textbooks in medicine offer interactive quizzes integrated into a human anatomy diagram and include related audio and video files that can be played right there inside the app, thereby broadening the utility of a textbook to students. The Inkling e-book platform also provides various sharing features that can be handy for students and teachers.

Recently, Inkling released a Web version. My library, which tested its app version earlier, was interested in purchasing some of the titles that were available at the Inkling Store for library patrons. Not only did we like the Inkling platform as a reading platform but we also found out that those titles were not available as e-books from any other vendors. My library wanted to provide more medical titles as e-books so that our students and faculty can access them with convenience. But while testing their Web version, we found a few problematic things for library patrons. (1) First, the Web version of Inkling doesn’t allow library patrons to use their iPad/iPhone version unlike products such as Naxos Music Library. So the convenience of getting the resource on a personal device was taken away in the Web version. (2) Second, Inkling requires each library patron to create a separate Inkling account in order to access the Web version of Inkling through the institutional subscription. The double authorization required – one for the university log-in and the other for the inkling log-in – was cumbersome and annoying. The majority of library users do not want to create an additional account for each database or resource that they use through the library subscription.

But the most problematic was (3) the fact that Inkling’s Web version only runs on Safari and Chrome.  No Firefox, no IE. This was a deal-breaker for us because the number one browser that is used to access our library’s website is IE and the second is Firefox according to the Google Analytics statistics. Furthermore, the most important patron group that my library serves, the medical students and faculty at our school, mostly work on the student laptops and office PCs that the school IT department configures and issues, and those student laptops and computers only come with IE and Firefox. Students and faculty have to request IT if they want to install any new software on these standard laptops and PCs. For this reason, when the limited browser support of the Inkling Web was known, librarians at my library unanimously agreed to wait for Inkling to add the support for other web browsers. We also did a demo of the Web version to a group of faculty with a few students included but the responses were lukewarm. So waiting was agreed to be the best option at this point.

At the same time, it was puzzling why Inkling released a Web product that only supports Safari and Chrome. We were told that Inkling e-books use HTML5 and CSS3 extensively and that not all the HTML5 and CSS3 features that Inkling uses are supported in IE and Firefox.  Okay, but if the Web version is to target institutional subscriptions rather than individual consumers – whom their iPhone/iPad version targets, then why the limited cross-browser functionality? In my opinion, no libraries were going to purchase ebooks that are going to run on web-browsers that half of their library patrons or more do not already have on their computers. Perhaps did Inkling release its Web version in haste and are planning to add cross-browser support as soon as possible? However, when my library inquired about Inkling’s future plan of cross-browser support, we were told that they were planning to add that feature in the future but without any timeline for it. Then, the cross-browser support didn’t seem like a high-priority for them. So if this is the case, what is going on?

Source: http://www.flickr.com/photos/angeliathatsme/6182582677/

As long as I was thinking as a librarian, I could only think that this was simply a bad business model. But let’s think about from Inkling’s perspective.  Is there a possibility that this is not a bad business model but an actually savvy business strategy? I do not doubt that Inkling’s development team can make their platform work with Firefox and IE. From the product they built, Inkling seems to have a capable dev team. I wonder if the company is debating internally whether adding the cross-browser support to their e-book platform would be a worthwhile investment at this point.

(A) First of all, HTML5 is being fast accepted as the new web standard and the W3C has a working group to finalize the specification. So whatever feature Inkling needs and FireFox lacks may well be soon added. And hopefully IE will follow the suit. If the browser support for these features are coming, Inkling may well do better by simply waiting a bit.

(B) The company may be uncertain about how much revenue will be generated from the institutional subscriptions. If the main attraction of their product lies in its availability on iPhone and iPad, then since this feature is not allowed for the users of Inkling’s Web version through the institutional subscription, individual consumers may well remain as their main target customer group. And for that matter, the release of the Web version itself doesn’t necessarily mean that the company is targeting institutional subscriptions as the main customers. The Web version might be a nice companion for the individual users who nevertheless purchase Inkling books mostly to use them on the iOS platform.

(c) But most importantly, Inkling’s real target could be mobile devices, not desktops. Now think about mobile devices – many different kinds of smartphones and tablets. If they are iOS devices, they will have Safari web browser. If not, they are likely to be Android devices. What browser do Android devices have? Chrome. So perhaps what the real market strategy of Inkling is going for the mobile market, not the desktop market. Maybe this is what they are really after.  Now the choice of Sarafi and Chrome seems to make much more sense, doesn’t it? And I have to say that focusing on the mobile is only smart considering that the Mobile Internet is about to surpass the Desktop Internet.  Of course, I have no way of knowing if any of these guesses are true. I am simply testing hypotheses.

So what was the lesson I learned? It was something obvious but nevertheless I have been overlooking for a while. As librarians, we are used to evaluate a resource product based upon how user-friendly it is for library patrons to use and how easy it is to implement in the common library setting (such as IP authentication by EZproxy and institutional log-in). However, these two factors are not necessarily the greatest concern for the vendors. That doesn’t mean that their business model is bad. They just happen to have a different business model that is not quite library-friendly. But vendors don’t exist to be library-friendly as much as libraries exist to purchase vendor products.  And sometimes, thinking about their concerns rather than ours can give us librarians a clue of where the vendors are going with their products and what their responses to our requests are likely to be, which we need to be aware of and to understand as much as we can. It is a good mental exercise for librarians.

 

 

The simplest AJAX: writing your own code (1)

*** This blog post has been originally published in ACRL TechConnect 0n September 12, 2012. ***

It has been 8 months since the Code Year project started. Back in January, I have provided some tips. Now I want to check in to see if how well you have been following along. Falling behind? You are not alone. Luckily there are still 3-4 months left.

Teaching oneself how to code is not easy. One of the many challenges is keeping at it on a regular basis. Both at home and at work, there seems to be always a dozen things higher in priority than code lessons. Another problem is that often we start a learning project by reading a book with some chosen examples. The Code Year project is somewhat better since it provides interactive tutorials. But at the end of many tutorials, you may have experienced the nagging feeling of doubt about whether you can now go out to the real world and make something that works. Have you done any real-time project yet?

If you are like me, the biggest obstacle in starting your own first small coding project is not so much the lack of knowledge as the fantasy that you still have yet more to learn before trying any such real-life-ish project. I call this ‘fantasy’ because there is never such a time when you are in full possession of knowledge before jumping into a project. In most cases, you discover what you need to learn only after you start a project and run into a problem that you need to solve.

So for this blog post, I tried building something very small. During the process, I had to fight constantly with the feeling that I should go back to the Code Year Project and take those comforting lessons in Javascript and JQeury that I didn’t have time to work through yet. But I also knew that I would be so much more motivated to keep learning if I can just see myself making something on my own. I decided to try some very simple AJAX stuff and started by looking at two examples on the Web. Here I will share those examples and my review process that enabled me to write my own bit of code. After looking at these, I was able to use different APIs to get the same result. My explanation below is intentionally detailed for beginners. But if you can understand the examples without my line-by-line explanation, feel free to skip and go directly to the last section where the challenge is. For what would your AJAX skill be useful? There are a lot of useful data in the cloud. Using AJAX, you can dynamically display your library’s photos stored in Flickr in your library’s website or generate a custom bibliography on the fly using the tags in Pinboard or MESH (Medical Subject Heading) and other filters in PubMed. You can mash up data feeds from multiple providers and create something completely new and interesting such as HealthMap, iSpiecies, and Housing Maps.

Warm-up 1: Jason’s Flickr API example

I found this example, “Flickr API – Display Photos (JSON)” quite useful. This example is at Jason Clark’s website. Jason has many cool code examples and working programs under the Code & Files page. You can see the source of the whole HTML page here . But let’s see the JS part below.

<script type="text/javascript">
//run function to parse json response, grab title, link, and media values - place in html tags
function jsonFlickrFeed(fr) {
    var container = document.getElementById("feed");
    var markup = '<h1>' + '<a href="' + fr.link+ '">' + fr.title + '</a>'+ '</h1>';
    for (var i = 0; i < fr.items.length; i++) {
    markup += '<a title="' + fr.items[i].title + '" href="' + fr.items[i].link + '"><img src="' + fr.items[i].media.m + '" alt="' + fr.items[i].title + '"></a>';
}
container.innerHTML = markup;
}
</script>
<script type="text/javascript" src="http://api.flickr.com/services/feeds/photos_public.gne?tags=cil2009&format=json">
</script>

After spending a few minutes looking at the source of the page, you can figure out the following:

  • Line 12 imports data formatted in JSON from Flickr, and the JSON data is wrapped in a JS function called jsonFlickrFeed. You can find these data source urls in API documentation usually. But many API documentations are often hard to decipher. In this case, this MashupGuide page by Raymond Yee was quite helpful.
  • Line 3-8 are defining the jsonFlickrFeed function that processes the JSON data.

You can think of JSON as a JS object or an associative array of them. Can you also figure out what is going on inside the jsonFlickrFeed function? Let’s go through it line by line.

  • Line 4 creates a variable, container, and sets it to the empty div given the id of the “feed.”
  • Line 5 creates another variable, markup, which will include a link and a title of “fr,” which is an arbitrary name that refers to the JSON data thrown inside the jsonFlickrFeed fucntion.
  • Line 6-8 are a for-loop that goes through every object in the items array and extracts its title and link as well as the image source link and title. The loop also adds the resulting HTML string to the markup variable.
  • Line 9 assigns the content of the markup variable as the value of the HTML content of the variable, container. Since the empty div with the “feed” id was assigned to the variable container, now the feed div has the content of var markup as its HTML content.

So these two JS snippets take an empty div like this:

<div id="feed"></div>

Then they dynamically generate the content inside with the source data from Flickr following some minimal presentation specified in the JS itself. Below is the dynamically generated content for the feed div. The result like this.

<div id="feed">
<h1>
<a href="http://www.flickr.com/photos/tags/cil2009/">Recent Uploads tagged cil2009</a>
</h1>
<a href="http://www.flickr.com/photos/matthew_francis/3458100856/" title="Waiting at Vienna metro (cropped)">
<img alt="Waiting at Vienna metro (cropped)" src="http://farm4.staticflickr.com/3608/3458100856_d01b26cf1b_m.jpg">
</a>
<a href="http://www.flickr.com/photos/libraryman/3448484629/" title="Laptop right before CIL2009 session">
<img alt="Laptop right before CIL2009 session" src="http://farm4.staticflickr.com/3389/3448484629_9874f4ab92_m.jpg">
</a>
<a href="http://www.flickr.com/photos/christajoy42/4814625142/" title="Computers in Libraries 2009">
<img alt="Computers in Libraries 2009" src="http://farm5.staticflickr.com/4082/4814625142_f9d9f90118_m.jpg">
</a>
<a href="http://www.flickr.com/photos/librarianinblack/3613111168/" title="David Lee King">
<img alt="David Lee King" src="http://farm4.staticflickr.com/3354/3613111168_02299f2b53_m.jpg">
</a>
<a href="http://www.flickr.com/photos/librarianinblack/3613111084/" title="Aaron Schmidt">
<img alt="Aaron Schmidt" src="http://farm4.staticflickr.com/3331/3613111084_b5ba9e70bd_m.jpg">
</a>
<a href="http://www.flickr.com/photos/librarianinblack/3612296027/" block"="" libraries"="" in="" computers="" title="The Kids on the ">
<img block"="" libraries"="" in="" computers="" alt="The Kids on the " src="http://farm3.staticflickr.com/2426/3612296027_6f4043077d_m.jpg">
</a>
<a href="http://www.flickr.com/photos/pegasuslibrarian/3460426841/" title="Dave and Greg look down at CarpetCon">
<img alt="Dave and Greg look down at CarpetCon" src="http://farm4.staticflickr.com/3576/3460426841_ef2e57ab49_m.jpg">
</a>
<a href="http://www.flickr.com/photos/pegasuslibrarian/3460425549/" title="Jason and Krista at CarpetCon">
<img alt="Jason and Krista at CarpetCon" src="http://farm4.staticflickr.com/3600/3460425549_55443c5ddb_m.jpg">
</a>
<a href="http://www.flickr.com/photos/pegasuslibrarian/3460422979/" title="Lunch with Dave, Laura, and Matt">
<img alt="Lunch with Dave, Laura, and Matt" src="http://farm4.staticflickr.com/3530/3460422979_96c020a440_m.jpg">
</a>
<a href="http://www.flickr.com/photos/jezmynne/3436564507/" title="IMG_0532">
<img alt="IMG_0532" src="http://farm4.staticflickr.com/3556/3436564507_551c7c5c0d_m.jpg">
</a>
<a href="http://www.flickr.com/photos/jezmynne/3436566975/" title="IMG_0529">
<img alt="IMG_0529" src="http://farm4.staticflickr.com/3328/3436566975_c8bfe9b081_m.jpg">
</a>
<a href="http://www.flickr.com/photos/jezmynne/3436556645/" title="IMG_0518">
<img alt="IMG_0518" src="http://farm4.staticflickr.com/3579/3436556645_9b01df7f93_m.jpg">
</a>
<a href="http://www.flickr.com/photos/jezmynne/3436569429/" title="IMG_0530">
<img alt="IMG_0530" src="http://farm4.staticflickr.com/3371/3436569429_92d0797719_m.jpg">
</a>
<a href="http://www.flickr.com/photos/jezmynne/3436558817/" title="IMG_0524">
<img alt="IMG_0524" src="http://farm4.staticflickr.com/3331/3436558817_3ff88a60be_m.jpg">
</a>
<a href="http://www.flickr.com/photos/jezmynne/3437361826/" title="IMG_0521">
<img alt="IMG_0521" src="http://farm4.staticflickr.com/3371/3437361826_29a38e0609_m.jpg">
</a>
<a href="http://www.flickr.com/photos/jezmynne/3437356988/" title="IMG_0516">
<img alt="IMG_0516" src="http://farm4.staticflickr.com/3298/3437356988_5aaa94452c_m.jpg">
</a>
<a href="http://www.flickr.com/photos/jezmynne/3437369906/" title="IMG_0528">
<img alt="IMG_0528" src="http://farm4.staticflickr.com/3315/3437369906_01015ce018_m.jpg">
</a>
<a href="http://www.flickr.com/photos/jezmynne/3436560613/" title="IMG_0526">
<img alt="IMG_0526" src="http://farm4.staticflickr.com/3579/3436560613_98775afc79_m.jpg">
</a>
<a href="http://www.flickr.com/photos/jezmynne/3437359398/" title="IMG_0517">
<img alt="IMG_0517" src="http://farm4.staticflickr.com/3131/3437359398_7e339cf161_m.jpg">
</a>
<a href="http://www.flickr.com/photos/jezmynne/3436535739/" title="IMG_0506">
<img alt="IMG_0506" src="http://farm4.staticflickr.com/3646/3436535739_c164062d6b_m.jpg">
</a>
</div>

Strictly speaking, Flickr is returning data in JSONP rather than JSON here. You will see what JSONP means in a little bit. But for now, don’t worry about that distinction. What is cool is that you can grab the data from a third party like Flickr and then you can remix and represent them in your own page.

Warm-up 2: Doing the same with JQuery using $.getJSON()

Since I had figured out how to display data from Flickr using Javascript (thanks to Jason’s code example), the next I wanted to try was to do the same with JQuery. After some googling, I discovered that there is a convenient JQeury method called $.getJSON(). The official JQuery page on this $.getJSON() method includes not only the explanation about JSONP (which allows you to load the data from the domain other than yours in your browser and manipulate it unlike JSON which will be restricted by the same origin policy) but also the JQuery example of processing the same Flickr JSONP data. This is the example from the JQuery website.

$.getJSON("http://api.flickr.com/services/feeds/photos_public.gne?jsoncallback=?",
  {
    tags: "mount rainier",
    tagmode: "any",
    format: "json"
  },
  function(data) {
    $.each(data.items, function(i,item){
      $("<img/>").attr("src", item.media.m).appendTo("#images");
      if ( i == 3 ) return false;
    });
  });

As you can see in the first line, the data feed urls for JSONP response have a part similar to &jasoncallback=? at the end. The function name can vary and the API documentation of a data provider provides that bit of information. Let’s go through the codes line by line:

  • Line 1-6 requests and takes in the data feed from the speicified URL in JSONP format.
  • Once the data is received and ready, the script invokes the anonymous function from line 7-11. This function makes use of the JQuery method $.each().
  • For each of data.items, the anonymous function applies another anonymous function from line 9-10.
  • Line 9 creates an image tag – $(“<img/>”), attaches each item’s media.m element as the source attribute to the image tag – .attr(“src”, item.media.m), and lastly appends the resulting string to the empty div with the id of “images” – .appendTo(“#images”).
  • Line 10 makes sure that no more than 4 items in data.items is processed.

You can see the entire HTML page codes in the JQuery website’s $.getJSON() page.

Your Turn: Try out an API other than Flickr

So far we have looked through two examples. Not too bad, right? To keep the post at a reasonable length, I will get to the little bit of code that I wrote in the next post. This means that you can try the same and we can compare the result next time. Now here is the challenge. Both examples we saw used the Flickr API. Could you write code for a different API provider that does the same thing? Remember that you have to pick a data provider that offers feeds in JSONP if you want to avoid dealing with the same origin policy.

Here are a few providers you might want to check out. They all offer their data feeds in JSONP.

First, find out what data URLs you can use to get JSONP responses. Then write several lines of codes in JS and JQuery to process and display the data in the way you like in your own webpage. You may end up with some googling and research while you are at it.

Here are a few tips that will help you along the way:

  • Verify the data feed URL to see if you are getting the right JSONP responses. Just type the source url into the browser window and see if you get something like this.
  • Get the Firebug for debugging if you don’t already have it.
  • Use the Firebug’s NET panel to see if you are receiving the data OK.
  • Use the Console panel for debugging. The part of data that you want to pick up may be in several levels deep. So it is useful to know if you are getting the right item first before trying to manipulate it.

Happy Coding! See the following screenshots for the Firebug NET panel and Console panel. (Click the images to see the bigger and clearer version.) Don’t forget to share your completed project in the comments section as well as any questions, comments, advice, suggestions!

Net panel in Firebug

 

 

Console panel in Firebug

How Not To Kill Your Own Creativity

Yesterday, I ran into this news about Darien Library. They were doing a campaign about “Donate Blood and Your Library Fines Waived.”  Immediately I thought ‘What a wonderful idea!’ Library fines can be a hassle. Lots of times people accumulate library fines by missing the due dates without intending and then get a headache later on. Library fines are not in any way a positive part of library experience even if they are the result of a user’s own fault.

I was most impressed by the fresh perspective on the whole library fine matter. The campaign by Darien Library was actually addressing this negative issue and changing it to something positive and even exciting. Getting library fines waived is like getting a free cookie. We are drawn to freebies. The condition for the freebie is a great cause – donating blood. This little one-day event page even lists “Facts about blood donation from the Red Cross.”

  • Every two seconds someone in the U.S. needs blood.
  • The blood used in an emergency is already on the shelves before the event occurs.
  • A single car accident victim can require as many as 100 pints of blood.
  • Roughly 1 pint of blood is given during a donation.

It is a great marketing event that brings in many library patrons’ goodwill with an educational element thrown in. But after I tweeted about this campaign, immediately a few librarians commented about those who are not eligible to donate blood for health or other reasons. And for a moment there, I wondered, ‘Wow that’s right… I didn’t think about that. Is this whole idea discriminatory?’

Homer & Splash from Flickr
http://www.flickr.com/photos/dongga/5887286736/

Then I had a light-bulb moment. No it is not a discriminatory idea. And this is exactly how we kill our own creativity before even it grows out of a seed!

The concern about those who are ineligible to donate blood is legitimate. ‘But’ it disregards a very important fact that what Darien Library is doing is an one-time event (or so I assume). It is a not a standing policy; blood is not an all-the-time accepted means to pay out your library fines (as far as I surmise). Just one day one time, the library is creating an event based upon a cool and interesting idea, that is: ‘Let’s invite those who are willing to donate blood gather at the library location – the bonus is if they have library fines, those fines will be waived!’  Getting library fines waived is just a hook, an excuse for bringing people in and having a good day that is dedicated to a good cause. It’s more like an icing on a cupcake.  Yes, it could be that there are some people who would donate blood only truly one hundred percent because they want their library fines waived. But this kind of case is probably rare.

But what happened to me for a moment was interesting. When I saw those concerns about those ineligible for blood donation, my mind immediately flipped from the creativity mode to something completely opposite. I started scrutinizing a cool one-time event idea as something like a standing policy. I started to forget what the original idea was about (bringing people together under the good cause of blood donation) and began to worry about all sorts of consequences and distant considerations. This is dangerous. But the transition in my mind was so smooth that I didn’t even notice what was happening. Sometimes, you have to consciously fight with yourself to preserve your own creative ideas.

We all have a pattern in the way we think and it is hard to escape from that pattern. Many patterns are common. We tend to exaggerate the negative and overlook the positive. We do not appreciate normalcy until we get into a crisis. We tend to act instead of observe and listen first because acting is often easier than observing and listening. Most of all, we tend to kill our own creativity often as soon as it springs up and start asking questions that are not really relevant. Thinking about long-term consequences and policy implications for an one-time event for example is such a case. We get mired in so many possible concerns and considerations that we get too paralyzed to even act. There are cases in which consequences must be thought out seriously. But even in cases that are not so, we tend to think in the same way.

Breaking this habit is difficult. For example, we tend to think that we can just do things if we really put our mind to it. As this very Aristotelian blog post points out, “Just do it” often doesn’t cut it because our action is the result of our habit as much as our motivation or idea in our mind. So we need to train our mind not to kill our own creativity. We need to practice nurturing our own creativity. We need to say to ourselves and our ideas first “Why Not” instead of “Why.”

 

 

Why Gamify and What to Avoid in Library Gamification

*** This blog post has been originally published in ACRL TechConnect 0n August 7, 2012. ***

In my last post, “Applying Game Dynamics to Library Services,” I presented several ideas for applying game dynamics to library services. After the post, I have received a comment like this, which I thought worthwhile to further explore.

  • What about the risk of gamification – the fact that it can deprive people of internal motivation for serious activities by offering superficial external rewards?

We tend to associate the library with learning, research, scholarship, and something serious. By contrast, games make us think of fun. For this reason, it is natural to worry about a library or any library-related activities such as reading, studying, researching becoming frivolous and trivial by gamification. In an effort to address this concern, I will point out that (a) gamification is a society-wide trend (and as such, highly likely to become not so frivolous after all), (b) what to avoid in gamifying libraries, and (c) what the limit of gamification is in this post. The key to successful gamification is to harness its impressive power while being fully aware of its limit so that you won’t overestimate what you can achieve with it.

Why gamify?

SCVNGR plans to create a game platform as Facebook built a social platform.

Gamification is not just a hot topic in libraries or higher education. It is a much bigger society-wide trend. In a similar way in which Facebook has evolved from a single website to practically ‘the’ social platform and layer of the real world with over 900 million active users as of May 2012, now a game layer is slowly being built on top of the real world. Just as the social layer effectively fused social elements into the world, the game layer brings gaming elements into reality. A game layer that we can compare to Facebook has not yet emerged. Nor is clear how far gamification will penetrate our daily activities. But we can imagine what a semi-universal social platform is going to be like from location-based smartphone apps such as Foursquare and Gowalla. Instead of building a virtual world for a game, these apps gamify the real world. Our mundane everyday activities in the non-game context turn into gaming opportunities for rewards like badges, points, rankings, and statuses.

But why apply game design elements to the non-game context in the first place? The short answer is that people are more motivated, engaged, and often achieve more in games than in the real world. Why are people better at a game than in real life? It is because games offer an environment intentionally designed to provide people with optimal experience by means of various gaming mechanisms and dynamics. Games make people perform better in the way the real world does not. It was in this context that a game designer and game studies researcher, Jane McGonigal, stated that reality is broken.”1 Gamification aims at extracting those game mechanisms and apply them to reality in order to make the real world experience more interesting and engaging.

Gabe Zichermann’s definition of gamificaion as“the process of game-thinking and game mechanics to engage users and solve problems” expresses the goal of gamification well.2 In this definition lies a good answer to the question of why libraries need to pay attention to games and game dynamics. Game dynamics can raise library users’ level of engagement with library resources, programs, and services. They can help library users to solve problems more effectively and quickly by making the process fun. A good example of such gamification is the NCSU Mobile Scanvenger Hunt, which was described in the previous post here in ACRL TechConnect blog.

What to avoid in library gamification

Since games can induce strong motivation and spur a high level of productivity, it is easy to overestimate the power of game dynamics. Perhaps, everything we do will turn into a game one day and we will be the slaves of omnipresent games that demands ever more motivation and productivity than we can summon! However, not all games are fun or worth playing. Designing good game experiences is nothing but easy.

The first thing to avoid in gamification is poor gamification. Gamification can easily backfire if it is poorly designed. Creating a library game or gamifying certain aspects of a library doesn’t guarantee that it will be successful with its target group. Games that are too challenging or too boring are both poorly designed games. Naturally, it is much more difficult to design and create a good game than a bad one. The quality of the game – i.e. how fun it is – can make or break your library’s gamification project.

Second, one can over-gamify and make everything into a game. This is quite unlikely to happen at a library. But it is still important to remember that people have a limited amount of attention. The more information we have to process and digest, the scarcer our attention becomes. If a library offers many different games or a variety of gamified experiences all at once, users may become overwhelmed and tired. For this reason, in pioneering the application of game dynamics to libraries, the best approach might be to start small and simple.

Third, a game that is organization-centered rather than user-centered can be worse than no game at all. A game with organization-centered design uses external rewards to increase the organization’s bottom line in the short term.3 Games designed this way attempt to control behavior with rewards. Once users feel the game is playing them rather than they are playing the game, however, they are likely to have a negative feeling towards the game and the organization. While a library doesn’t have the goal of maximizing profits like a business, which can easily drive a business to lean towards organization-centered gamification, it is entirely possible for a library to design a game that is too heavily focused on the educational aspect of the game, for example. Such gamification is likely to result in lukewarm responses from library patrons if what they are looking for is fun more than anything else. This doesn’t mean that gamification cannot make a significant contribution to learning. It means that successful gamification should bring out learning as a natural by-product of pleasant and fun experiences, not as a forced outcome.

Harnessing the power of game dynamics

Games are played for fun, and the fun comes from their being ‘not’ real life where one’s action comes with inconvenient real-world consequences. For this reason, when a goal other than fun is imposed on it, the game begins to lose its magical effect on motivation and productivity.  It is true that games can achieve amazing things. For example, the game FoldIt revealed the structure of a specific protein that long eluded biochemists.4 But people played this game not because the result would be revolutionary in science but because it was simply fun to play.

It is probably unrealistic to think that every task and project can be turned into a fun game. However, games can be used to make not-so-fun work into something less painful and even enjoyable to some degree, particularly when we lack motivation. In his book, Game Frame, Aaron Dignan cites the story of tennis player Andre Agassi.5 Agassi played a mental game of imagining the tennis ball machine as a black dragon spitting balls in an attempt to smite him. He did not hit 2,500 balls a day purely because it was fun. But by making the grueling practice into a game in his mind and tying the game with his own real-life goal of becoming a successful tennis player, he was able to endure the training and make the progress he needed.

In applying game dynamics to library services and programs, we can take either of two approaches:

  1. The ultimate goal can be simply having fun in some library-related context. There is nothing wrong with this, and at minimum, it will make the library a more friendly and interesting place to patrons.
  2. Or, we can utilize game dynamics to transform a more serious task or project (such as learning how to cite literature for a research paper) into something less painful and even enjoyable.

 

Gamification with little investment

Budge, a gamification website

Gamification is still a new trend. A pioneering gamification app, Gowalla lost to Foursquare in competition and was acquired by Facebook last December, and it is yet to be seen how Facebook will put Gowalla to use. Another gamification tool, Budge is closing down at the end of this month. For this reason, those who are interested in trying a gamification project at a library but may wonder if the result will be worth investment.

In this early stage of gamification, it will be useful to remember that gamification doesn’t necessarily require complicated technology or huge investment. You can run a successful game in your library instruction class with a pencil and paper. How about rewarding your library patrons who write to your library’s Facebook page and get most “likes” by other patrons? Or perhaps, a library can surprise and delight the first library patron who checks in your library’s Foursquare or Yelp page by offering a free coffee coupon at the library coffeeshop or simply awarding the Early-Bird badge? In gamification, imagination and creativity can go a long way.

What are your gamification ideas that can engage library patrons and enliven their library experience without huge investment? Share them with us here!

Notes
  1. Jane McGonigal. Reality Is Broken: Why Games Make Us Better and How They Can Change the World.  (New York: Penguin Press, 2011), 3.
  2. Gabe Zichermann and Christopher Cunningham. Gamification by Design: Implementing Game Mechanics in Web and Mobile Apps. (Sebastopol, CA: O’Reilly Media, 2011), xiv.
  3.  The distinction between games with organization-centered design vs. those with user-centered is from Scott Nicholson, “A User-Centered Theoretical Framework for Meaningful Gamification,” (pre-print) http://scottnicholson.com/pubs/meaningfulframework.pdf.
  4. Elizabeth Armstrong Moore, “Foldit Game Leads to AIDS Research Breakthrough.” CNET, Sep. 19, 2011, http://news.cnet.com/8301-27083_3-20108365-247/foldit-game-leads-to-aids-research-breakthrough/.
  5. Aaron Dignan, Game Frame: Using Games as a Strategy for Success, (New York: Free Press, 2011), 80.

Applying Game Dynamics to Library Services

*** This blog post has been originally published in ACRL TechConnect 0n July 9, 2012. ***

There is a lot of talk about games at libraries. Public libraries in particular have been active in incorporating games in their programs and collections. Even for academic libraries, gaming is no longer a foreign topic. The 2012 Horizon Report sees Game-Based Learning to be on the 2-3 years horizon for adoption. That is not a very long time away from the present.

I am not going to talk about games here, of which I am a rather poor player in general. Instead, I would like to talk about game dynamics and how they can be applied to library services. I am really late for writing about this idea, which I heard about a few years ago. But probably now is as good a time as any as the Horizon Report this year mentions gaming.

A light bulb in my head lit up when I listened to the TED talk, “The game layer on top of the world” by Seth Priebatsch during my commute. (See the video below.) There, he talks about the game layer as something that is being built now after the social layer that Facebook has pretty much established. Just as the social layer has fundamentally changed the mode of human interaction and the way of our lives as a result, Priebatsch sees a similar potential in the game layer.

What has attracted my attention in this talk about the game layer was not so much the game per se as the the impressive power the game dynamics wield to human beings. Once you hear those examples of the game dynamics, their impact is immediately obvious. But until now, I haven’t had a conscious understanding about how successful well-designed games can be at providing people with such engaging and immersive experience.

According to Priebatsch, among those game dynamics are: (a) appointment dynamic, (b) influence & status, (c) progress dynamic, and (d) communal discovery. (He says that there are three more but he only mentions four in the talk.) Since he details what each of these dynamics mean in the talk below with clear examples, I am not going to repeat the explanation.

Seth Priebatsch: The game layer on top of the world

To simply put, these game dynamics are very powerful motivators for human action. Did you know that Farmville can change the behavior pattern of over 70 million people by simply changing a rule for how often a Famville user needs to water the crop? The power of these game dynamics stems from the fact that they require meeting relatively simple conditions in return for attainable rewards. Games usually begin with simple tasks that award you with some goods and elevation in your status or level. Then gradually, the tasks become complicated for more challenging rewards. The game dynamics drive game players to plan and perform simple to complicated actions. These often motivate individuals to exert a significant level of diligence, creativity, and resourcefulness.

What is really cool about these game dynamics is that they are applicable to any human action in the real world, and not just in the gaming world. Sure, you can create a game to tap into people’s creativity and diligence. (In another TED talk, “Gaming can make a better world,” Jane McGonigal explores the possibility of harnessing the human energy and creativity spent on gaming to solve the real-world problems. See the video below.) But, you do not have to. You can just as easily embed these game dynamics outside the traditional game sphere. These dynamics tend to be quite effectively utilized in games. But they do not have to be restricted to online games.

So my question is whether these game dynamics can be applied to make library services more engaging and interesting to library users? Can libraries take advantage of these game dynamics to help library users to attain the goals that they themselves probably want to reach but often fail to?

Here are some of my thought-experiments applying game dynamics to library services.

  1. Provide level-up experience for library users.
    Suppose your user logs into a library proxy system every time for browsing library’s databases, e-books, and e-journals. How about based upon the time spent and the number and frequency of log-ins, allowing the user to level up from ‘novice library user’ to ‘super researcher’? Of course, you would probably want to use way more appealing terms such as “Paladin level 20 Killer Ninja Researcher” instead of “Super Researcher.”
  2. Award some status and powers associated with library use that can be admired (with the addition of visible tokens for them).
    Allow users to tweet, Facebook, and G+ their updated status and powers as they level up, so that it can be boasted to others. Status and power is meaningless unless it is looked up to by others in one’s own community. How about re-issuing library cards as in Judo with some sort of belt system: red belt, black belt, brown belt, white belt etc.? Add up some sleek mini-posters that celebrate some of those high belt status in the library space where everybody can see. Or even better something users can boast in their Facebook pages. It might just work to motivate library users to study more, read more, and research more.
  3. Show the progress bar in library catalog.
    The progress bar makes you goal-oriented. It gives you satisfaction whenever you move the bar one notch to the right. It makes you feel that you are moving towards something good. Why not show the progress bar in the library OPAC? If a user run a search, show the progress! If a user selects a record in the search results, move one notch up in the progress bar. If s/he clicks holdings or the links in the record, how about showing the Happy Face or a Dancing Penguin for a second before moving on? Humans have such a soft spot for positive feedback that if a required action is simple and easy enough, they might just do it for fun.
  4. Color-code the status of checked-out books.
    In the library’s “My Account” page, mark past-due books as red and newly checked-out books as green. Items that are about the midway of the check-out period can be in yellow. Or show it as an hourglass that loses its sand on the top part as you pass the due date of library books. This may make people more compelled to return the overdue items.
  5. Library currency to accumulate and spend?
    Let users to boast taking out and returning books from the library to others. Maybe give them points per transaction? Social reading is already a big phenomenon. Combined with a library, it can create even more fun experience. Maybe it can be just like Gowalla or Foursquare. Maybe users can trace their reading history and find others with a similar reading pattern. How about letting library users to accumulate and spend library points (or currency) for coffee at a library cafe? Now some students may seriously start reading.

Game dynamics are significant because they can be used to build a foundation for our willing participation in a project for our own optimum performance. Libraries have been an indispensable means for individuals who aspire for learning, experience, and knowledge, and serving those individuals has been always a crucial mission of libraries. Game dynamics can be utilized to help libraries to serve such mission more effectively.

PS. Also check out the talk below by Jane McGonigal about her explanation regarding why people are so much more successful at games than at the real life and how we may perhaps harness that potential to solve the real life problems.

Jane McGonigal: Gaming can make a better world

 

My Talks and Presentations at ALA Conference

Here are the presentations and talks I gave at the ALA conference 2012. This year’s ALA conference was a challenge because I was swamped with work until the last minute I left work for the conference. So I wasn’t able to write any blog post before the conference. And of course, I spent more time on polishing the slides once I got to Anaheim.  Although I was not fully prepared both physically and mentally, however, the ALA Annual Conference was, as always, invigorating and informative. I am still digesting much of what I have learned from the conference and hopefully I can summarize some of those things later to share.

In the meantime, here are the slides of the talks and presentations that I gave at the conference. Big thanks to my co-presenters, Jason Clark and Tod Colegrove. It was one of the most amazing collaboration experience I ever had. Also special thanks to the LITA Heads of Library Technology Interest Group for inviting me to serve on the panel discussing the adoption of open source software at libraries. And as always, I greatly enjoyed the lively discussion at the LITA Mobile Computing Interest Group meeting.

Here are the final slides.

“I Can Do It All By Myself”: Exploring new roles for libraries and mediating technologies in addressing the Do-It-Yourself mindset of library patrons  with Tod Colegrove and Jason Clark.