[rwet week 8] petfinder + nytimes biographies

Screenshot 2016-04-01 14.25.48

Last year, I learned that Petfinder has an API, which was a pretty amazing discovery. For this project, I used its Get Random Pet function, which randomly picks an adoptable pet from its database.

From there, I extracted the pet’s name and description from the JSON file.

I then took that pet’s name, and used the New York Times article search API to find articles with that name as a keyword. I then took the “lead paragraph” from the first article chosen.

I used the NLTK library to split sentences into lines, and then made a little biography poem with alternating lines from each.

I’m pretty happy with the results, though if I had more time I would clean up the code so that it works more consistently. (For example, it currently only really works if the pet name is just one word.)

Screenshot 2016-04-01 14.28.10

Screenshot 2016-04-01 14.36.31

Screenshot 2016-04-01 14.41.21


Screenshot 2016-04-01 14.50.44


Screenshot 2016-04-01 14.56.59


Screenshot 2016-04-01 15.03.52https://gist.github.com/nicolehe/5943a8beb734b5bee5c874eb3a98f6d0.js

[live web week8] recreating an older socket project with webrtc

Screenshot 2016-03-30 10.06.00

Screenshot 2016-03-30 10.06.07

(URL here.)

This week, I simply recreated the chatroom I made a few weeks back using peer.js instead of socket.io. The difference now is that you have to call the other person/people, but otherwise it works in the same way. Much more simple, but maybe less interesting?


[nothing week 8] einstein’s dreams and projection mapping


Without knowing anything about the book going in, I enjoyed reading the first few sections of Einstein’s Dreams. It reminded me a lot of Invisible Cities, in using small vignettes to explore a specific idea, or a version of an idea. Although it’s ostensibly about time — and the different possible ways time could work or exist in our universe — it seems to be more of a reflection on humanity and about people. More about philosophy than about physics, which is a little different from what might be expected from a book with “Einstein” in the title.

One of my favorites was “26 April 1905,” which is the one depicted in the illustration above. It describes a world where “time flows more slowly the farther from the center of earth.” As a result, in fear of old age and death, everyone lives at the top of mountains, and rich people build tall stilts for their houses. Only a few adventurous people visit the valleys and swim in the rivers down below. In contrast, those at the top “have become thin like the air, bony, old before their time,” defeating the whole purpose.

This vignette is very proverb-like, maybe even a little too on the nose. But even so, I thought it was an effective story.

My other favorite was “3 May 1905,” describing “a world in which cause and effect are erratic.” I found the examples and questions it raised to be quite interesting:

A man stands there just now, absently emptying his pockets and weeping. Without reason, his friends have abandoned him. No one calls any more, no one meets him for supper or beer at the tavern, no one invites him to their home. For twenty years he has been the ideal friend to his friends, generous, interested, soft-spoken, affectionate. What could have happened? A week from this moment on the terrace, the same man begins acting the goat, insulting everyone, wearing smelly clothes, stingy with money, allowing no one to come to his apartment on Laupenstrasse. Which was cause and which effect, which future and which past?

In this world, artists thrive and scientists have no power. The reason this example is interesting, I think, is because there is some truth to it that already exists in our world.

I worked with Jamie on our two projection mapping projects this week. The first one we made was having snow fall between two squares:

The second was a spinning pizza in a box. This one was particularly hard to capture in a video with my phone camera, so it’s kind of dark, but you get the idea.

[pcomp week 8] Final project idea: Tinder Robot


This idea came to me in as I was falling asleep a few weeks ago, which probably means that it’s either really good or really bad. I hope to find out which one it is soon!

My idea for my final project in pcomp is based around the popular dating app, Tinder. The way it works is that it shows you profiles of other users, and you can “swipe left” to say no, and “swipe right” to say yes. I think it would be interesting to have a computer automate the process for you by reading your body to determine whether or not you truly want to say yes or no to a potential match. Reading your “heart’s desire,” if you will.

The user, connected to some kind of biometric sensor (heart rate monitor? GSR sensor? both?)  would look at a Tinder profile on the screen, and the computer would read whether or not they were excited by the profile. If not, a robot hand controlled by a motor or a servo of some kind would swipe left. If so, it would swipe right.

For demoing purposes, I’d set up some kind of dummy Tinder account that anyone can try. But I think this experiment would be even more interesting if users were willing to put their own phones and Tinder accounts on the line, so there actually some (small) stakes for them.

There are a few questions, of course, that I need answer moving forward:

  • What kind of sensors should be used?
  • How should the data be read to interpret interest or lack of interest?
  • What potential obstacles are there in the Tinder UI? (For example, I think if you and another user both swipe right, a different screen pops up. How would we deal with that?)
  • Should we use another display to show what the sensor readings are? (I drew one in the sketch above just in case.)

[icm week 8] Soulmate Machine (data & APIs)

Screenshot 2015-10-26 00.07.42

(TLDR: Check out the Soulmate Machine here.)

For this week’s assignment to work with data, I’m not sure why, but I knew pretty quickly that I wanted to use Petfinder’s API.

If you are tragically unfamiliar, Petfinder is a website where you can find all sorts of adoptable pets across the country.

I signed up for an API key, read the documentation, and got to work pulling JSON from their site. They had a rather interesting “get random” method that allows you to find a random pet in their database, picking from specific characteristics like breed, size, age, and more.

I thought it’d be fun to make some kind of pet “matchmaking” based on some questions you were asked. (I certainly have a soft spot in my heart for internet quizzes).

I picked 5 questions for 5 characteristics — location, gender, species, age and size. Each answer sets a different result. For example, if you pick “bud light” under question 3, you’ll get a dog.

Screenshot 2015-10-26 00.20.45

The page is not much to look at, and that’s largely because I had a lot of confusion with combining DOM in p5 and also editing CSS and the HTML file simultaneously…Organizing things on the page in a way that didn’t look awful was difficult (and I still haven’t succeeded). I also couldn’t figure out how to do certain things like make a button open a link. I think the combination of using P5 and CSS was confusing in particular.

Sometimes, particular answers don’t actually have any adoptable pets (for example, an extra-large baby pig in New York). One challenge I had was figuring out how to 1) read the JSON file to confirm that this was the case, and 2) write the code in p5 to reflect if there was no match. I’m happy to say I sorted it out by looking in the JSON file and seeing that there was no “pet” name when there was no match, so I simply wrote the line if (data.petfinder.pet == undefined) followed with some text saying that there was no match.

Screenshot 2015-10-26 00.36.43

The concept for this project was a bit silly (which is increasingly looking like a theme in my work…), but the nice thing about using a real API is that it’s actually connected to the real world of pets that need homes. On the match page, you can click the “in love” link to go directly to your soul mate’s Petfinder page, and maybe even adopt!

You can try Soulmate Machine here. My P5 code is below.

Continue reading “[icm week 8] Soulmate Machine (data & APIs)”