Imagine you have a large folder of images in Google Drive. I don’t have to imagine this as I do thanks to an IFTTT recipe.1 Google tends to be kind of stingy with the kinds of filtering/interactions you can have with files in their folders and we know that if you get stuff in Google Sheets then a world of other possibilities opens up. I’ve been thinking about what options there are with Google file storage because VCU is a GAFE school and we have unlimited Drive storage. That might open some media storage options with heavy load projects like our Field Botany site or our more recent work with the East End Cemetery. So . . . I wrote a quick script to take a large G Drive folder full of images and write the content to a spreadsheet while embedding an image preview. The script is below. I ended up revamping both enough that I felt it was worth reposting. For the record, the script ran through about 4,500 images but it may have timed out so keep that in mind if you’re dealing with lots of images. 1 I figure if I have enough backups to my online backups then I can pretend I’m safe.
When working with Google Forms, there are two elements- the sheet (where the responses go) and the form. It’s not obvious how you might allow another user to copy both a form and a sheet in Google. So . . . assuming you set the document so that anyone can see it (or share it directly with whomever) . . . You can append copy to the form URL and it’ll copy the blank spreadsheet and the form. https://docs.google.com/forms/d/1pf0xf1G_-C-p9QXjw1L5BjvZC1SHTGd71hvGBjuFGN4/copy If you append copy to the sheet URL, it’ll copy the spreadsheet with content and the form. https://docs.google.com/spreadsheets/d/1Lrq5sbr-Q_8TFky81OSMFgTO1OnQ8bbN1G05m0q3dVQ/copy
flickr photo shared by Kecko under a Creative Commons ( BY-ND ) license Man. This was a slog and really highlighted gross inadequacies in my conceptual understanding of pretty much everything. That being said, with an end-around, it works. The whole thing is below but there were really two pieces where I got stuck and flailed away on Stackoverflow and other places for quite some time. Getting the JSON I always struggle with nested data and getting things right. It seems so stupid simple now . . . response.feed.entry but I’m often unclear when it’s periods, when it’s =>, or when it’s something entirely different. You mix that with a few levels of confusion around the process and you end up with many variables you can screw up. For instance, if I remember correctly response[‘feed’][‘entry’] also works. Searching all of the JSON I’m cheating here. I couldn’t get the scope of the filter to be all of the data returned in the JSON. It kept stopping at the first element- id. So I cheated. I wrote a formula on the spreadsheet to mash all the cells together per row and pointed the filter at that data. Ugly. But functional. I don’t know what it’ll end up being. Not what it is but now that the framework is built, we can […]
flickr photo shared by cogdogblog under a Creative Commons ( BY ) license Because I still read the posts from the good people over at HCPS I came across Doug’s post on a script that Michael Price wrote. The script sets up a form that lets anyone upload a file to a Google Folder.1 It intrigued me so when one of our professors was asking about allowing students to upload raw video for other students to use, I figured I’d check this out as a solution. You can/should get the basics from the video that’s in the post above. I made a few alterations based on our particular needs. One, I wanted the folder to be viewable by anyone so they could get the files easily. I could have set the sharing permissions after the creation of the file by hand but . . . I didn’t want to.2 I also wanted to tighten up the connection between submission and being able to see all the results. It turns out you can’t currently iframe any of this without drama so I included a link to the folder after the submission and demo’d using the Google Folder WordPress plugin I made a while ago below. The main work is done in the script below (all credit to Michael Price). I just […]
Functional is a kind way to describe this . . . but it’s hard to argue with computers doing tedious work that was previously done by hand. The goal here was to automate the collection of the comments on 300 or so posts from the CDC’s Facebook page so they could be analyzed. Ebola is in the mix which leads to some comments that may very well rival YouTube comments in terms of causing me sadness. We did end up with around 34,000 comments which would have been hand copied in the past. So some karma balance was achieved. wTake all this with a grain or two of salt. It works but may very well be illegal in some states or do things in a way that would make real programmers weep. Consider my programming skills to be like a man trying to swat flies with a broomstick- lots of furious action, panting, cursing, and every so often I will kill a fly and celebrate wildly.1 The Facebook This was my first experience trying to do anything with Facebook. The hardest part here for me was just getting the stupid access token needed to get at the JSON feeds. I eventually found the secretly named Facebook Login Example. Part of my issue was that I thought I could skip the […]
This is a post about (at least temporary) failure. I should be able to do all this via the Facebook API/SDK but I’m doing something wrong. While I’m learning a decent amount in the land of programming, fundamentally I still suck. With that cathartic self-flagellation out of the way . . . I’m working with someone who wants to grab all the comments from a large number of CDC posts about health issues for some research. She is currently doing it by hand. Here are two improvements to that awful reality.1 Expand All Comments In FB land if there are many comments you only see the most recent. And if there are many, many comments you have to keep hitting “View Previous Comments” over and over. That’s super boring to do once. If you have to do it a lot it would really suck. Enter Alec’s bookmarklet. I tweaked it a tiny bit because I think FB changed the wording but it works like a charm. You’d copy the text below. Add a bookmark and then click edit. Replace the URL with this text and name it whatever you want. Grab All Comments Now to grab all these enlightening comments . . . Install the Scraper Chrome Extension. You can now right click a particular item and choose “scrape similar.” […]
The challenge as initially laid out was to let students log the miles they walk and have those miles show their progress from Richmond VA to Key West FL on a map. I found quite a few ways not to do this- mostly because I was attacking the problem in the wrong way. I wanted to set a point of origin, a destination direction and then map a straight line for X amount of miles. It may be possible but it feels like you’re fighting the system the whole way. I took some time off and let it marinate in my head and a much easier solution appeared. Goal In the end I realized I wanted to get the path from Richmond to Key West and then be able to add a marker to that path at any mileage point along the way. The miles would be pulled from Google Form submissions. One of the key helpers was epoly.js . It adds a number of tricks which come in handy- including the option to GetPointAtDistance along a path. I used this example for find the midpoint of a route as the starting template. I figured I’d leave the midpoint as a goal and then all I needed to do was add another marker that was placed based on the sum […]
I thought I’d take a stab at using Google Script to capture Instagram data after being inspired by all the great Martin Hawksey has done with the TAGS Explorer. I’m doing something very similar and it turned out to be fairly straightforward to take the PHP I’d written previously and turn it into something that’d function in Google Sheets. I found this example highly useful in creating my own script.1 The following script can also be set with a time based trigger to fire every X minutes/hours/days which is perfect for this particular project. You can see it pulling 20 pictures worth of data every hour here if you’d like. 1 I basically copied portions of it.
It sounds like an exciting new buddy movie . . . but it’s an attempt to better integrate elements of our Discourse install in WordPress using Benson (a neat plugin Mark made that lets you use Angular w/in WordPress). I decided to look into this after seeing this example using Twig. Ordinarily, I’d do something like this using Discourse’s RSS feeds and probably manipulating it with FacetWP. I’m opting to look at these other options for a few reasons. One, with WordPress expanding JSON I want a better idea of how all that works in comparison to RSS. Two, I don’t really like duplicating all this content through the syndication option if I can achieve the same effect in other ways. I’m not so worried about space (although I don’t like to waste it) but there are occasionally issues with updates and duplications using RSS the way we do. I wonder if JSON will straighten some of that out. Angular also opens up a realm of options as you get closer to writing code rather than relying on plugins. And finally, I want to knit Discourse more tightly to WordPress. That’ll matter because of the strong resistance to “another site?” responses. What can you get out of Discourse via JSON? Short answer- lots of stuff. Much like WordPress you can […]