In Brief: The Digital Past – Fall 2014

This semester, I’ve adjusted my H390 – Digital Past syllabus to focus student projects on Gilded Age/Progressive Era Chicago.

My last two classes, which consisted of mostly non-majors, struggled with the breadth of  my “pick a topic in history” final project instructions. I also found that since I am not an expert on all possible historical topics, I spent a great deal of grading time validating basic factual information and immersing myself in their topics so that I could adequately grade them. I’m hoping this is easier for me as well.

Additionally, I find that digital resources on Chicago during this time are quite prevalent. I already teach the Homicide Project Database out of Northwestern University Law School, so adjusting the rest of my in-class exercises worked out well.

The best part about teaching with technology? It’s a constant state of learning and adjustment.

How I Learned to Read Class Materials on my iPad

I’ve always been a paper person. I like to print articles and mark them up in multi-colored highlighters. I write notes in the margins. I employ a complicated symbol system of stars, boxes, brackets and arrows to help me keep track of my thoughts.  The process of writing it down helps me to clarify my thoughts. It helps me remember. I’ve always done it this way.

It occurred to me that it’s a little insane to call myself a “digital” person when I don’t fully employ the technology or the tools available to me. I got an iPad for my birthday in June and until now I only used it for social media. This semester, I decided to experiment with reading articles online instead of wasting the paper to print them. I’d already organized my Zotero libraries to keep track of my sources. I also had purchased GoodReader (at the encouragement of several friends) to help me annotate pdfs, so I don’t lose the note-taking capability.

So far, to keep myself organized between my laptop and my iPad, I’ve been using GoodReader and Dropbox. These apps help me get the articles on my iPad and annotate like a fiend.  It’s pretty efficient. In the event that this system may help others, here is what I did.

Set up Dropbox

Install Dropbox on your computer. (Accounts are free for up to 2GB of storage.)

Open the Dropbox folder and create a new folder. Mine is called “Goodreader Sync.” The only items I put in here are items I plan to read on my iPad.

Set up GoodReader

Once you’ve installed GoodReader ($4.99), open it and select “Connect to Servers” > “Add” > “Dropbox” and input your account information.

Now it’s time to set up the sync: select “Connect to Servers,” click on Dropbox, name your connection–I named mine “Readings.” Tap the folder to connect to Dropbox and sign in with your  login information. Select the Dropbox folder you want to sync,  and select “Sync” from the buttons at the bottom of the window.

Click “Proceed”. GoodReader will then ask you to either create a new folder or “Download Here and Sync”. If you select “download here” all of your readings will populate your general GoodReader folder. I created a special folder in GoodReader to eliminate clutter, but it’s up to you.

Sync Thyself

That’s it! You can now use the green “Sync” button to connect the two. (Remember, you need to be connected to the Internet to sync your files.)

goodreader

So far, my work flow consists of collecting all the week’s pdf readings from the browser on my laptop and organizing them into my “GoodReader Sync” folder in Dropbox. Once I sync from GoodReader, I’m ready to annotate for class.

Anyone else have a way to manage this? As this is the year I organize myself digitally, I’m always looking for suggestions.

Using JavaScript Libraries: Download or Link?

There are numerous open-source JavaScript libraries floating around the web that can be of particular use to historians. Google hosts quite a few of these, including the very popular jQuery and jQueryUI. For data visualization, some good options for historians include: Stanford University’s D3, or MIT’s SIMILE Widgets such as TimelineExhibit andTimePlotTimeMap combines the functionality of Timeline with popular mapping APIs to provide an easy way to plot geographic and chronological events in context.

Once you find a library and decide you want to use it, you need to make a decision, do you download and install the library on your own server or do you just link to the hosted library?  Your answer will depend on a variety of issues.

Linking
Libraries that are hosted elsewhere are handy, there are no files to install and a simple line of script can bring you all the functionality you’d want without you having to architect the file structure on your own servers. To load a hosted library, copy and paste the code snippet for that library (shown below) in your web page. For instance, to load jQuery, embed the <script src="//ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js"></script> snippet in the <head> tag of your HTML page.

However, it’s important to note that any JavaScript that gets included in your webpage runs  within the context of your entire domain and can access any data contained therein. Using a library from a known and frequently-validated entity, such as Google, isn’t likely to cause problems, but it you’re looking to grab functionality from a third-party that isn’t as well-known, these files might cause issues on your own site. Always use code (whether you opt to link to it or download it) from sources you trust.

Additionally, the hosts of the library you’d like to use might not appreciate the additional server load that is created when you link to their libraries. Always read the documentation for instructions how best to use their library. In these cases, you should consider downloading the library to run from your own server. But where do you put it once you have it on your local machine?

Downloading
If you opt to download a JavaScript library, you’ll need (eventually) to upload the entire library to your web server. For ease of organization, you can create a separate “javascript” or “js” folder at the root level of your site to house all of your libraries.

“js” is the folder and contains only JavaScript files and other libraries. You’ll notice here that I’ve installed the “timemap” library. I’ve organized all of my libraries into distinct folders, so that I can keep track of my files. Some of these libraries come with dozens of separate files, so keeping them organized becomes critical as you use more and more of them.

Most library documentation is helpful and includes instructions on how to download, but if you happen upon one that does not, these basic instructions apply:

1. Download the entire library to your local machine.
2. Unzip it and FTP it to the “javascript” or “js” folder on your web server.

That’s it. The library is now available for you to use on any page on your site.

To call your library, you’ll need to include all the appropriate <script> tags in the <head> tag of your HTML page. For example, to load TimeMap, one would need to call five different JavaScript files. In the example below the Google Maps API v3 is being called by a URL, while the rest are pulling from the local server by using the relative path “../js/timemap/lib/” code as seen below.

Troubleshooting
You can use multiple JavaScript libraries, but you should be aware of any possible conflicts. Always check the library documentation for issues of library incompatibilities. You can check for known JavaScript Library conflicts by searching Google for your library name and “conflict,” (e.g., jquery conflict)

To ensure your library is loading correctly, you can use any of the popular in-browser debugging tools like Firebug or Chrome Developer Tools. For example, if one incorrectly types the file name for the Timeline JavaScript file in the <script> tags, the page will fail to load. By using Chrome Developer Tools, it’s easy to see the Internal Server Error is due to a non-existent file on the server; the tool even gives the number of the problematic line of code causing the issue.

JavaScript libraries are a convenient way to harness the power of JavaScript functionality without having to write all the code yourself. Happy coding!

Great Expectations

I had partial success with my mapping project this weekend.

I had originally planned to map each state with little popup boxes showing details on the numbers for each state. It turns out that I greatly underestimated both my skills with JSON files and the Google APIv3 for maps.

But let me back up. I did have success mapping multiple points on a map. I also successfully mapped a point on a map with a detail window on click (click on the marker to see the details.) However, when I tried to map multiple points on a map with detail boxes, that’s where the train went off the rails.

Apparently, the Google Maps API has issues with looping through a long list of details to set markers and info boxes. It only pulls the last info box in the list. There are a nice bunch of tutorials on how to fix the issue, BUT since I am not as well schooled in javascript and calling JSON information, I could not get it to work.. although I did try. My attempt to get it to work is avail here and frankly, I think it’s a big old mess. For one, I’m not sure how to call the separate JSON file. [The tutorial I was using is here. I have his book and his examples were working well for me up until this point, which makes me think it’s a js/json problem.]

For reference, here is my JSON data.

var json = [
{
"state": "Virginia",
"lat": 37.768002,
"lng": -78.205704,
"detail": "In Virginia, 1254 men were executed between 1620 and 2002; 88 women were executed in this same time frame."
},
{
"state": "West Virginia",
"lat": 38.467999,
"lng": -80.969597,
"detail": "In West Virginia, 150 men were executed between 1620 and 2002; 4 women were executed in this same time frame.."
},
{
"state": "Maryland",
"lat": 39.072399,
"lng": -76.790199,
"detail": "In Maryland, 293 men were executed between 1620 and 2002; 11 women were executed in this same time frame.."
}
]

 

I’ll continue to try to debug and hack at it to get it to work, but I’m finding the online documentation only partially helpful. One big problem is that I’m not totally confident that I know how to code the start and end to each file. So when I find code snippets of “solutions” to common problems, I’m not entirely sure where to put the code. Since the order is really important, I’m sure I have some things out of order.

Full code examples would be more helpful so that I can see it in context, but I know this is a learning curve problem, and that it will diminish with time. These “help” blog posts are written for experienced coders and right now I’m a hack at best. So for the time being, I’m embracing my hack status and putting this to the side as a problem for another day.

Getting Ready to Map

I started the evening ready to tutorialize myself in Google APIs and mapping examples. I read two paragraphs and realized that I’d better do some prep work on my own data before I continue.

I also realized that I can organize myself better if I set some goals for my coding work. I have one goal this week: Successfully map all the executions in the database with fancy little popup boxes showing the details for each state. That’s it.

Once I get that to work, for my tutorial in two weeks, I’ll drill down into Virginia, Maryland and DC to show more detailed local information. But, don’t let me get ahead of myself.

On the prepping side, every tutorial I looked at pleaded with the reader NOT to geocode the latitude and longitude information on the server, but to do it in the source database whenever possible.  Since I only have 51 states to deal with and the information is static, adding in lat/long for each execution in the database wasn’t going to require that much brain damage. I created a new table of state lat/long information and populated the appropriate general state lat/long information. [Like everything I do in phpMyAdmin, I did one state by hand and looked at the SQL commands to replicate for the other 50 states. (After 8 weeks, I am beginning to realize that I learn by trial and error–useful, but incredibly frustrating.)] Per Google’s request, I created my lat and long fields in the new table as FLOATS with the size of (10,6), which will allow me to store 6 digits after the decimal, plus up to 4 digits before the decimal, e.g. -123.456789 degrees. I then joined this new table to my main executions table with a new foreign key between my original executions table and the id from the statelatlong table.

I then needed to make sure I actually understood how to JOIN these tables, so I walked through a tutorial (on Wikipedia nobles), replaced their fields with my own and TA DA! it worked. For reference, all the information in the results, save lat and long, are located in my original table. The lat long coordinates are stored in the new table. (The code I used is here on my github.)

Now I feel like I’m ready to actually start trying to get my maps to work… the results of which, I’ll describe in a new post. Once I get there.