Friday, August 30, 2013

Redesign prototype: v0.1.0


Images via: http://placeit.breezi.com/

Let's be everywhere

One of the tricky things about inspiration is that it can happen anywhere at anytime. As librarians, the faster we allow that spark of creativity to translate into obtaining rich library resources, the better we serve our patrons and the better we enable the university to accomplish its mission.

A guiding principle of our redesign effort has been to pursue a responsive design -- something that will enable patrons using any media device to access our resources. In the images above, you can see how people may interact with the new design on a phone, a tablet and a laptop computer. However a user comes to our website, we'll provide them the same great services, resources and online features they would find at a desktop computer within Wilson Library. After all, who knows where the next great U of M invention will take place? Wherever it happens, the libraries need to be present, too.

The prototype homepage

I know I'm burying the prototype link, but that's only because I want to over-emphasize how the site needs to be evaluated across all types of devices. Please, pretty please, take out your phones, your Kindles, your iPads, your Xboxes, etc. and take a few moments to imagine interacting with this design anywhere you use the internet. Okok, with that mindset in place, here's the link to our first prototype.

Features/Flaws

FYI, in this first design iteration, we've mocked up the interface as if the user was signed into their library account. Future versions will allow you to toggle between unauthenticated and authenticated views of the homepage.

Search: The prototype includes a working MNCAT Discovery blended search box (catalog + Primo Central). It's very important to note this form points to the Primo Implementation Group's staging server and that the catalog data is over one year old! The staging environment is the sandbox for us to test our future search engine configuration. Please be aware the staging environment is subject to change, and is only meant for evaluative use. Don't forget to try out the advanced search, too.

Boxy Main: The main panel contains responsive "feature boxes". This is where the design is least complete, but contains the greatest potential. The intention is to provide an array of content that is personalized and strategically placed to promote speed of access to our resources. I can imagine boxes to advertise new services or collections here.

Collection Highlight: WPMG will work to create an editorial oversight committee to draw attention to highlights of our collection. The Stephen King covers only illustrate the potential of this space. It's worth noting that the carousel here is touch-enabled, so trying giving it a flick of your finger.

Continuum: This section is for library news and special events, allowing the audience access to the new Continuum site and methods for Friends of the Libraries to engage with the homepage. Needless to say, we'll be working closely with Mark on ideas for this area of the page


Exaggerated Footer: It might look large, but it adds a nice foundation to the page and allows people to use the old CTRL+F command to quickly find links to services and resources. It's meant to be an omnipresent site map. We'll be closely watching how it is used and what items can be edited or improved here.

Flaws: We're still working to fully implement all our ideas here. There are browser issues, incomplete features, and authentication isn't baked yet. You can expect additional work to go into rounding out this prototype soon. We have tested the site in many browsers and operating systems, and things look pretty good until you hit WinXP/IE8 (you knew I'd say that, right?). Additional labor will be spent making IE8 use acceptable. If you notice something that looks particularly wrong, please let us know by providing us with...

Feedback

We need and love feedback.

Anything from a short reaction to a detailed response will be greatly appreciated. I personally think it's a nice first step towards the future, but it's also certainly far from complete. There is a lot of work left here, but there is also a lot of good direction here, too.

We'll next be working through some accessibility and user testing, which will drive considerable improvements to the design, so please do not expect this look and feel to stand still until January. We'll work carefully to resolve issues and incorporate feedback from everyone, so do not be shy about voicing your opinion.

Please take some time to think the design over and let us know where we stand by completing our short survey.

Thanks everyone!
- Eric

For the Web Development Department

Tuesday, August 27, 2013

Opening Hours on the Libraries web site: "Right-sizing" complexity

Last week we rolled out a new set of pages listing the opening hours for the 30-plus library buildings, collections, and other place-based resources that make up the University of Minnesota Libraries. Behind these new pages lies a corresponding new system that relies on Google Calendar for maintaining opening hours information. This system is a considerable improvement over our previous tools for recording and listing opening hours.

The previous system and why we replaced it

When our previous opening hours listing system was built, it was implemented with the goal of using the internal content management tools of our web site's native content management system, Drupal. Drupal provides a means to set up custom types of pages with a variety of data fields of various types (essentially, a content-specific data model and corresponding page authoring template). Additional Drupal components provide means to query, filter, and organize the data stored under these custom content types in flexible ways. So far, so good.

As it turns out, however, opening hours for Library locations and services are…well…complicated. Hours vary over different days of the week and between academic semesters, summer session, and breaks. Throw in the occasional holiday and other special cases, and the interplay of different patterns and exceptions to the patterns becomes quite elaborate——both on the data modelling side (or, “What site maintainers have to enter into the system”) and on the information display side (or, “What visitors see.”) So in the end, the understandable desire to build within our native tool resulted in a system that was more complicated than it needed to be, both for site authors and for site users. See image above: For bonus points, figure out if SMART Learning Commons is open today. Go!

With that in mind, we set out to find a better way.

How the new system works

Turns out that what we might call “the Calendar Problem” has already been solved. Many times. University of Minnesota staff, faculty and students have one such solution ready at hand——Google Calendar——and most are already proficient in its use. Wouldn't it be nice if we could use a familiar tool like Google Calendar to manage opening hours information? That would solve part of our challenge: Providing a (relatively) user-friendly way to manage opening hours data. This would allow us to delegate the maintaining of hours information to those staff who are most familiar with each location without having to get them up to speed on using Drupal along with our elaborate custom hours content model.

Above: The hours for Wilson Library and additional services at Wilson, as seen by the opening hours maintainer in Google Calendar.

That still leaves the other half of the problem: A visitor-friendly way of presenting the opening hours information. As luck would have it, Google Calendar provides an API——Application-Programming Interface, or, more colloquially, a structured and documented way for a computer program to accept requests for its output and send back the results of those requests. With that in mind, we set to work to develop a few tools to provide different types of opening hours data:

  • Prominent listings of today's hours for our five main locations on the front page of our web site;
  • Prominent listings of today's hours for each library or collection on its own web site (e.g., Special Collections, Rare Books, and Manuscripts);
  • A dedicated “hours” page for each library or location listing its own hours for the upcoming week along with the hours of specific resources within that location (e.g. the Special Collections, Rare Books, and Manuscripts hours page); and
  • A search tool to allow visitors to find hours for future dates——Much benefit for, say, a researcher from distant lands planning a visit to a special collection (also at link immediately above).

At right: The new web listing of Wilson Library hours, with search option. View the live Wilson Library hours page.

Separation of concerns and positive side-effects

Where the previous system was built entirely within Drupal, this new system was designed with a different set of goals:

  • To delegate the work of fetching data from Google Calendar to a separate subsystem optimized for that task and unconcerned with the specific needs of Drupal;
  • To provide the basic data in a generic format that could be available to non-Drupal subsystems within our site; and
  • To bundle up the presentation and interface elements needed specifically by Drupal into a Drupal module and theme.

The components we developed, then, serve these different goals:


  • One script is tasked with nightly queries to Google Calendar to fetch the daily and weekly hours for each location and store content snippets for the front page and collection-specific listings;
  • Another script processes the searches that originate from the hours search form, sends them to Google Calendar, and formats the results for display;
  • A Drupal module provides blocks (Drupal-specific preformatted units of web content) that can be enabled and placed in the site using Drupal's content management tools; and
  • Several tweaks to our Drupal theme allow a more attractive display of the hours content wherever it appears in the site.

One positive side-effect of this new system became evident while working on the project: By using Google Calendar as the source of opening hours information, we now have the option to provide this data as a public data source, or feed, that is already widely supported by virtually all desktop and mobile computers. Thus, regular visitors can subscribe directly to the Google Calendar feeds for their favorite locations in their own calendaring system of choice, rather than than visiting our web site whenever they need to check hours.


A last potential D'oh!

As a worldwide, distributed, collaborative project, Drupal never stands still. Last July, as I was elbows-deep in the code for our new opening hours solution, a blog post entitled Presenting the Opening Hours Module cropped up in my feed reader. Looks good, something we might use. I may follow up on that one of these days.

Wednesday, August 14, 2013

A Universal Configuration System for More Secure and Portable Code

Problems

UMN Libraries had much legacy, web application code with hard-coded, environment-specific information, e.g. database usernames and passwords, file system paths, etc. This makes code difficult to move among different environments, like development, staging, and production, because, for example, each environment typically uses different databases, each with different usernames and passwords. Using hard-coding in such a situation effectively requires different versions of each source code file for each environment, which leads to multiple copies of almost identical code, that developers must manually update in each environment. Manual updates of multiple copies of essentially the same code leads to errors. Worse yet, it is almost impossible to use a revision control system to track changes to such code, which would help to prevent those errors as well as provide many other benefits. Perhaps worst of all, this web application code was all in the web server document root, where it is all too easy to mistakenly expose source code files containing sensitive information, like database credentials, to web browsers, a huge security risk.

Solution: A Universal Configuration System

To solve these problems, we designed a universal configuration system. These were our requirements:

  • Portable, environment-agnostic. Must support personal laptops, OIT virtual machines, OIT hardware, development/staging/production environments, etc.
  • Must not assume use by web applications, command line applications, or any specific kind of software.
  • Common convention for configuration location, in order to bootstrap configuration. Allow overriding of the convention.
  • Does not expose sensitive credentials or other information to non-privileged systems or users, e.g. web application configurations must be outside of the web server document root, production database credentials must not be exposed to a development environment.
  • Support for different sets of configuration values for different applications, as well as common configuration values for shared among applications.
  • Framework- and language-agnostic configuration formats.
  • Support for a hierarchy/tree of configuration values.
  • Easily switchable configurations, e.g. allow for switching the configuration of a production application to use a development database instead of the production database, for debugging purposes.
  • Common libraries for all programming languages necessary, deployable via a dependency management system for that language.
  • Support for caching, to minimize loading of configurations.

Implementation

Formats

We prefer the YAML format for configuration data and use it wherever possible. The benefits of YAML are many:

  • Popular format, with parser libraries available for every popular programming language.
  • Terse, easily-to-understand syntax.
  • Support for hierarchies/trees of data.
  • Support for comments.
Our first programming language library to support this system, \UmnLib\Core\Config for PHP, also supports JSON and INI formats, and we plan to support XML, though none of those has all the advantages of YAML.

Location Convention

On all recent machines, OIT restricts almost all customer files to the /swadm directory, providing very little space anywhere else. To minimize confusion about the purpose of sub-directories, we emulate a Linux root file system under /swadm. For example, we put applications in /swadm/bin, website document roots in /swadm/var/www, and configuration files in /swadm/etc. Following this convention allows configuration library code to be simpler and more portable, because we can count on configuration files to always be in the same place. This location also puts configuration files outside the webserver document root, preventing its exposure to web browsers, thus making our code more secure. A common location also encourages pulling configuration data out of application- or framework-specific configuration files, e.g. Drupal's settings.php, so that other applications can use Drupal's database credentials without having to parse PHP or without developers having to copy the credentials to a different file in a different format.

Location Convention Problems

While we can count on having a /swadm directory on all new OIT machines, the UMN Libraries main web site and most other web applications currently reside on older machines where this is not the case. Instead, we have different directory structures in each environment, i.e. /umnlibdev for development, /umnlibstage for staging, and /umnlib for production. Further complicating matters, these customer directories are cross-mounted such that all of them exist simultaneously on a single machine, with their web application code running inside the same instance of Apache. Therefore, it's impossible to have one /swadm/etc to rule them all on those machines. Also, some people like to run multiple development environments on their laptops or local machines, in which cases a single /swadm/etc also would be impossible. For these and other reasons, we needed a way to override the location convention.

Location Convention Solution: Overriding with Environment Variables

We use environment variables to override the location convention, so that any application written in any language, running inside a web server or on the command line, can override configurations and access overridden configurations. This still leaves unsolved the problem of the cross-mounted environments using a single instance of Apache on a single machine. Michael Berkowski provided a clever solution to this problem: Use Apache rewrite rules to conditionally set environment variables depending on the domain. We use the RewriteRule flag S|skip to tie multiples rewrite rules to a single negated RewriteCond. Example:


RewriteCond %{SERVER_NAME} !^wwwstage\.lib\.umn\.edu$
RewriteRule .? - [S=2]
RewriteRule .? - [E=UMNLIB_COMPOSER_AUTOLOADER:/umnlibstage/usr/share/php/composer/vendor/autoload.php]
RewriteRule .? - [E=UMNLIB_CONFIG_PATHS:/umnlibstage/etc]
RewriteCond %{SERVER_NAME} !^www\.lib\.umn\.edu$
RewriteRule .? - [S=4]
RewriteRule .? - [E=UMNLIB_COMPOSER_AUTOLOADER:/umnlib/usr/share/php/composer/vendor/autoload.php]
RewriteRule .? - [E=UMNLIB_CONFIG_PATHS:/umnlib/etc]
RewriteRule .? - [E=UMNLIB_CONFIG_SHOULD_CACHE:true]
RewriteRule .? - [E=UMNLIB_ENABLE_MEMCACHE:true]
view raw
.htaccess
This Gist brought to you by GitHub.


So if the condition is false, we skip the number of rules indicated by the S=, in the second rule. Notice also that the second rule is effectively a no-op, since it doesn't match anything. Its only function is to specify how many of the following rules to skip.

Solution Pitfalls

We encountered a couple of pitfalls in implementing support for the environment variable solution.

Use SERVER_NAME, not HTTP_HOST

In addition to the fact that HTTP_HOST may not always contain a value, relying on HTTP_HOST introduces an XSS security risk. See Why HTTP_HOST is evil for details. We also fell into the pitfall that SERVER_NAME may not contain a value unless you set UseCanonicalName On.

Rewrite Rules Can Override Each Other

Without RewriteOptions inherit, Apache ignores all rewrite directives in all .htaccess files in all parent directories:

Sunday, August 11, 2013

Redesign

The University Libraries' Web Development department is excited to announce we have begun an ambitious project to redesign the Libraries' web site.

Our current design has served us very well, but its 2010 aesthetics and underlying code are no longer up to current web standards. The maturation of HTML 5, CSS 3, web fonts, and responsive frameworks means that we have an incredible set of tools available to us that we're not using. Further, the rapid uptake and wide variety of mobile devices in use on our campuses means that we're not serving many of our users as well as we should. Some of you may be aware that in early 2012, Web Development attempted to outsource some responsive design, a venture that sadly failed. More than a year has passed, our site design is that much older, and we feel strongly that this work is too important to delegate to an outside firm.

As long as we've got the site up on the lift for bodywork, we're going to take the opportunity to make some improvements under the hood. Our site is slow. When you're measuring in seconds and fractions thereof, slow might seem like a relatively minor concern, but extensive research by Google and others shows that millisecond delays have a measurable impact on user engagement with web sites. We've been using a tool called PageSpeed to measure our site's performance, and have begun benchmarking it against some of our peers. We've set ourselves the goal of having the fastest library site in the CIC.

Another area where we hope to make substantial improvements is in accessibility. Our colleagues in the University's Computer Accommodations Program have begun doing regular accessibility audits of various UMN sites. We met with them recently to discuss their methods and our results, and were disappointed in the overall picture of our site's accessibility. Not only is it our duty to comply with accessibility standards, we believe that an organization dedicated to discovery and use of information should be a model for accessibility. We are working closely with CAP with the goal of setting the accessibility standard for the campus with this redesign.

"That's all well and good," you might be saying to yourself, "but what about my screenshots? What about my tutorial videos? What about my instruction materials? What about my comfortable, well-worn paths through our byzantine systems environment?" Our site's look will be changing, particularly the home page, but we're not planning on changing the site's navigational structure. The menus will look different, but they'll have the same items in the same hierarchy. No URLs will be harmed in this redesign.

Furthermore, we intend to use this space, here at ulwebdev.blogspot.com to document our work. If you look at the detailed proposal we circulated to various libraries committees, you'll note that we've set a goal of having functional prototypes in place by the end of August. These prototypes will be visible to and usable by staff and the public throughout our redesign process. You'll be able to watch the site design evolve, so nothing about the final product should be a surprise.

We're pretty excited.



Thursday, August 8, 2013

Early Experimentation Toward Automating Web Application Deployment

The Problem:

"Okay, we just finished writing our application and it's ready for prime time and public consumption! Now what?"

The answer isn't usually too difficult to sort out. You need to find space on a server, make sure it's web-accessible, it can communicate with its database, and a few other things. The process may vary, but the steps are usually pretty similar and the stakes may not be very high for a first time launch. But...

"Okay, our application has been up and running for a while and a lot of people depend on it. We've made some changes and need to get them into production without causing chaos. Now what?"

That's a really common question in web development, but really good answers to it have only started cropping up in the past four or five years. Deploying new software the first time is easy. Improving it without breaking things is entirely different. Usually if you want to change something, you need to try out your new code in a testing & development environment, verify everything is working as intended, then move that new code into a production server. This isn't so bad when things work like they should. In practice though, emergencies come up and a problem arising in production may need to be fixed right there on the fly, leading to an inevitable falling out of sync between test & production environments.

Backing changes out is another problem. If things don't work as expected though, you need a good way to return to the previously working code without disrupting your end users. When copying files around manually, you need to keep a copy of the old files close by when you update them in case you need to move the old ones back in place. That leads to web servers which slowly start looking like this:
  • the-real-file.html
  • the-real-file.html.backup~
  • the-real-file-testing-deleteme.html
  • the-real-file (Copy).html
  • the-real-file (Copy (Copy)).html
Okay, maybe not that bad, but you get the idea.

The Solution:

We have been thinking carefully about how we can improve our web deployment strategies to be sane, consistent, repeatable, automated, documented, logged, and most of all, safe from breakage. One of the tools emerging as a leader in this arena is called Capistrano. Basically, Capistrano steps through a list of tasks to retrieve code from a repository (Github), copy it to a server, and swap it into place for use. But it also manages those old versions on the server too, allowing a seamless and instantaneous return to the previous version when things don't work as planned without the (Copy (Copy)).backup litter.

To make sure things do work as planned before end users ever see the new features, Capistrano can run a whole series of pre-flight checks. These checks may include verifying that the files that contain database passwords are present and correct, running automated software tests, ensuring the application can communicate with a 3rd party resource, or just about anything else we might need.

Looks like we're all clear to deploy our code!

If everything passes, the new code release is swapped instantly in place of the old, and if anything fails, the whole process rolls back without downtime for end users. We can correct the issue, and try again when it's ready.
Something isn't right, but Capistrano was smart enough to notice and back out to the previous working state.


Our Experiment:

As a first proof of concept, we've setup the Affinity String Statistics web application to be deployable with Capistrano. Since it mostly stands alone without deep dependencies on our other web applications, and because a little work was being done on it, it seemed like a good first candidate.

Now, because it only stands alone mostly and not entirely, it is also a good test bed to uncover the kinds of issues we can expect to encounter when fitting other applications for Capistrano deployment. Chiefly, we will have to work out some new ways of organizing files in the UL web space, but recent work Dave has done on configuration file management gives us a really sound push toward accomplishing that.

It's an exciting project, and  in an ideal world we will eventually be able to add "push-button" deployments to all of our custom code on the web for a fast, safe, repeatable path from our desktop workstations through wider testing and into production.

Tuesday, August 6, 2013

U Libraries, Health Sciences & Isilon Storage

OIT continually manages aspects of the hardware lifecycle, much of this being coordinated by the CAB or Change Approval Board (http://www.oit.umn.edu/change-management/change-approval-board/).  Physical hardware has a finite lifespan and eventually passes out of warranty -- and hardware movement occurs within the OIT data centers for a variety of other reasons.  End-users are usually oblivious to these ongoing changes (by design).

The network storage mounts used by the https://www.lib.umn.edu and https://hsl.lib.umn.edu Development, Staging and Production servers lived on EOL'ing storage infrastructure being phased out by OIT.  Our history on that equipment dates back to groundwork laid between the U Libraries and OIT in February 2009 -- a long run indeed.

We initially migrated the Development and Staging systems to Isilon, but encountered significant issues with Production.  It was determined that a 32-bit mode on Isilon needed to be implemented until we upgrade additional infrastructure.

The final move was scheduled for Sunday morning, July 28th, 2013 and entailed coordinating well in advance with OIT, and ensuring that some WebDev staff were available to safely put Drupal into offline mode, shut down several daemons on multiple servers, allow the final data sync to complete, then bring things back online.  The process went smoothly, though (ironically) Isilon at-large did experience a glitch the following day and many systems across the University were affected.  Storage and network outages are posted on System Status (http://systemstatus.umn.edu/view/Main).

Whether change process, network storage or outages -- the Libraries and OIT infrastructure are increasingly aligned, dependent and coordinated.  One immediate advantage is that we can draw on (and contribute toward) a talent pool on the same page.

The Board


Friday, August 2, 2013

What are people searching for on our site?

It's a simple question, but the answer is HUGELY challenging.  In library-land, our online users come visit our web presence and swiftly leave to visit thousands of sites, services and information sources. We're full of info riches, so sometimes answering a simple question just isn't an easy feat, it's a headache.

At U of M, there are currently six search forms on our library homepage:

  • Site search
  • MNCat (library catalog)
  • Article search (EBSCO, PubMed, etc.)
  • Journals search (MetaLib or Primo)
  • Video and Media (scoped Primo search)
  • Course Resources
Each of these search forms will move a user from our website into another application or vendor product. To answer the question of what people are searching for, we need to dive into data held in at least six different places.  Not all of these apps/products have Google Analytics (GA) attached.  Some of them might record the user query in a database, while others will only have the query in their log files.

It's a bit messy, so we've worked to make it much simpler.  Our first open source project on GitHub is called GA Track Form Submit.

Using this code, and taking advantage of event tracking in GA, when a user submits a form where we've added "ga-track" as a class attribute, we'll capture the user query, the radio or drop-down input values and record them (as JSON) along with the Form Submit event in GA.

It's important to note we DO NOT capture any personal information here -- our GA account anonymizes IPs, you know.  We're just recording the form input values for internal use.

For a simple form like our library catalog:
<form name="mncatplus" class="ga-track"...>
  <input name="request" type="text"/>
  <input type="image" src="../path"/>
  <input type="radio" name="type" value="keyword"/>
  <input type="radio" name="type" value="title"/>
  <input type="radio" name="type" value="author"/>
</form>
We'll push an event to GA that records info like this:
FormSubmit{form: "mncatplus", request: "hemingway", image: "Go", type: "author"}
Using this technique, as time goes by, we'll gain a great sense for the most common queries people perform on the site.  But more importantly, we will begin to understand the queries we handle poorly and better focus our efforts to improve the user experience.

So... what are people searching for on our site? Just give us a little bit of time to capture the data and we'll let you know.