Librarians Learning to Code Presented by Bohyun Kim

One of the great things about librarians is the collaborative and energetic community spirit towards learning new things and Boyhun Kim’s Charleston Conference presentation on November 9, 2012 is an excellent example of this.  In her presentation and her blog, Library Hat, she has pulled together the many learning resources that are available and the communities involved in learning code for library purposes and services.

Posted in Presentations, Programming | Leave a comment

From Coursera to Udacity Computer Science 101 courses

Feeling confident after Nick Parlante’s more general introduction to Computer Science, I began a new class from another Stanford faculty member and a faculty member from the University of Virginia. This Computer Science 101 course from Udacity uses Python, a web scripting programming language as a tool to build a search engine.

Sample of Udacity video instruction page

Sample of Udacity video instruction page

After beginning in the Spring of 2012, I have yet to complete it. It is less introductory than a 101 classification would imply and demands a lot more involvement in solving problems and building upon the information learned earlier in the course.  Even though it is unfinished its focus on a practical application, like building a search engine, has helped me better understand how web crawlers, like the ones that Google uses, search and gather information about websites.

It also helped me better understand Python and gives me hope that I may be able to someday understand how it works enough to use the python library, pycdm, that Shawn Averkamp created at the University of Iowa to use with CONTENTdm.

Posted in Open Education, Programming, Search | Leave a comment

Internet Pioneers in Open Source Software from Dr. Chuck Severance

Integrated into the Coursera course on Internet History by Charles Severance at the University of Michigan are many videos of Internet Pioneers.  This set of three videos is about 3 people who created three of the major open source tools or organizations that drive the Web we use now.

One of the features that they all share is that they are committed to sharing and collaborating, a quality all librarians can appreciate.

  1. Rasmus Lerdorf invented PHP, a web programming language, to help him do his work more effectively and it led to the development of an open source tool and community.
  2. Brian Behlendorf invented with a group of collaborators the Apache Web Server so that they could continue to have a free software tool to create the Web.
  3. Richard Stallman founded the Free Software Foundation and his vision for software and use of the Web certainly predicted the existence of Wikipedia and sharing knowledge and information.
Posted in History of Science and Technology, Open Education, Open Source, Software | Leave a comment

Boolean Search: Library and Computer Science Style

One common set of tools of the librarian trade are the databases that are purchased and taught to researchers in the community they serve.  The most powerful searches are performed based on the boolean logic of AND, OR, and NOT. The figure below is an example of one of those search interfaces:

Academic Search Premier Search box

Each row can be set to focus on a particular field and mixed together with the Boolean operators in the drop-down menus on the left. This week’s course showed what the code looks like underneath the graphic display.

Computer code uses the same basic operators but represents them in the following ways:

    • AND = &&
    • OR = ||
    • NOT = !

It also uses commands that direct the computer to look for certain things in fields within a table of data. For instance, if we were looking at a table with fields full of data about the authors, titles, publication dates and we were looking for that children’s book author whose name starts with “C”.

One line might look like this:

if (row.getField(“author”).startsWith(“C”)) { print(row) }

Before this line there would be a code that would repeat this step, called a for loop and it would retrieve any names that begin with C in the table and print that row. We could then add another line with a boolean operator to get more sophisticated results. The results bring up a list of too many to choose from.

Let’s say that we remember that she wrote a book about a mouse.

if (row.getField(“author”).startsWith(“C”) &&

row.getField(“title”).startsWith(“Mouse”)) { print(row)}

It is really the search, C* in the author field AND Mouse in the title but shows us how it is translated into computer speak through the nice interfaces we use. We might now get the result of Beverly Cleary’s Mouse and the Motorcycle.

Posted in Information Retrieval, Programming | Tagged , , | Leave a comment

Movie Magic Spoiler Alert – Bluescreen

bluescreenIf you are someone who enjoys the wonder of movie-making without the desire to know how it works then read no further. Nick Parlante’s week 3 lecture revealed how the bluescreen/greenscreen trick uses computer code to insert portions of one image onto another. I have always wondered why that works and now I know.

The concept of pixels having a Red, Green, and Blue value is the foundation of this trick. The reason movie studios have those Green or Blue screens on studio is because it allows the computer to easily detect the color of the pixels from the screen and then replace them with pixels from another image.

In code language you need a way to identify which pixels to replace by identifying the Blue or Green ones. This is done by writing code that finds out the number of the Red, Green, and Blue portions of each pixel (remember that they range from 0-255) and finding the average. Comparing the average value of a pixel’s three numbers against a high Green value allows the computer to identify which pixels to replace with pixels from the other image.

Here are some of the key code components:

Commands like pixel.getX() to find the x (or y) coordinates within an image;

if statement to identify which of the green pixels are to be replaced by finding pixels where the Green value is higher than “avg” which is the average of the three color values.

if (pixel.getGreen() >  avg)

Link the pixel from one image to the other using names to represent each image (“image” and “back”)

pixel2 = back.getPixel(pixel.getX(), pixel.getY())

and copying the color values of the other image, pixel2, to the corresponding original “pixel” on the green screen.


This process done on every individual image in a video which is really just a large amount of static images flicking by rapidly.

[Image courtesy of mvjantzen]

Posted in Digital Images, Programming | Tagged , | Leave a comment

Grayscale Revealed

Color photo changed to grayscale

Photo editing software seems magic sometimes in the way that it can switch a photo from color to black and white with a button click. Learning the code for this has pulled back the curtain on this magical process.

When the Red, Green, and Blue values for a given pixel (between 0-255) are the same, you get a gray tone.  This also might explain why scanners or other imaging equipment list color settings as 24 bit and grayscale is only one third the value at 8 bit. If only one number value is needed to determine the pixel color instead of three separate ones for each color channel in Red, Green, and Blue then you have one third of the data.

With the handy for-loop command, Nick Parlante taught us how to calculate an average value for each pixel in a color image and modify each channel to be the same value to change it to gray. Here is the average snippet of code that generated the value to set for each pixel in the loop:

avg = (pixel.getRed() + pixel.getGreen() + pixel.getBlue())/3;

Very fun!

Posted in Digital Images | Tagged | Leave a comment