Karen’s New Baby: Update

Still not referring to the baby (no longer) in her belly…

but her iPad. Last time when I was finishing up my post Karen pointed out that the lines weren’t from use but the lines left after the micro-cleansing cloth did it’s job. So I redid this cleaning the screen each time for three different apps.

Note: the preview function in WordPress isn’t showing the animated GIFs, so if you want to see the action, click on the image to see the animation.

Flipboard (what up Wills and Kate!), lots of flipping and scrolling.

Tiny Wings, one finger push in the bottom of the right screen (and a single push for the start button).

And, surprise, a rainbow drawing using SketchBook Express.

This was done by : cleaning the iPad, using the App, taking a picture of the iPad turned off with an indirect flash (the non-reflective scattering off the oil picks up the light more than the fully refelective non-oily surface), and editing in PhotoShop to bring out the color.

Karen’s New Baby

This post is in reference to her iPad 2, not the baby in her belly. After watching my darling wife incessantly google “iPad2 news” for months now, it’s finally arrived. Having thought I would take little interest in a giant iPhone, I must admit, the experience of using one is altogether different thanks to a number of innovative apps that do something I am particularly fond of, data aggregation. For example one, Paprika, let’s you choose a recipe online, and instantly and accurately parses it into your personal cookbook, in a well designed and intuitively simple format. Another of my favorites, Flipboard, is an aggregator of all sorts of feeds: google reader, LA Times, Facebook, blogs, etc.. It’s essentially the messy web experience we are all used to, formatted and put into a design that’s easy on the eyes. As much as I’ve enjoyed watching the delight it’s brought Karen, I’ve been interested in the way she uses it. The flipping etc., so I did a fun little analysis.

First, I took an overexposed picture in a dark place and constricted my flash so that the screen did not pick up a lot of reflection.

Next, I imported the image into photoshop, warped and played with the color histograms to get this.

After a little editing in matlab, I created this heat map, the hotter colors show where Karen touches the iPad2 the most. You can see two consistent lines that she chooses to swipe along, the other two being symmetric about the center line since there is no well defined “up” or “down” on the screen. It is pretty amazing how consistent she is though! Awesome/disappointing update: Karen informs me the lines are where the iPad’s cover does NOT touch the glass. Microfiber win!

Finally, I put it right back into her iPad. I hope she doesn’t get mad that I replaced her flower picture…

Rainbows: Open Letter to Justin Bieber

Biebs,

How do you do it? Is it your hair? Your sweet moves? Your shirts? No wait, I literally own that same exact shirt. And still, every time I get paparazzi’ed, I look like a vertically stretched umpa lumpa that rode the short bus to learn how to make pancakes in the park. Do tell.

Jerod

Science: Rsync Your Website

Not a lot of rainbow in this one. This is a pretty dry, but useful tutorial. In a recent conversation with my good friend Nick Matterson about effective web development tools, the topic of getting files onto a server came up. A lot of people use GUI tools, while others do command line stuff. This tutorial is purely command line (i.e. Mac’s Terminal), and after a few short lines of code results in a website that is automatically mirrored to a local folder, updating in 1 minute increments via a crontab.

The process happens in a few basic steps:

* Establish a security key connection for ssh. This is useful beyond this trick if you ever want to login without a password. Here is a more detailed link, but the process is simple. Generate a key on the local machine via:

ssh-keygen -t rsa

Leave the fields blank, if a key already exists don’t overwrite it. Now, just like in the link:

cat /Users/rasmussj/.ssh/id_rsa | ssh username@IPADDRESS ‘cat >> .ssh/authorized_keys’

This puts the key on the remote host so I no longer need a password.

* Now that I can do that, the rsync command can sync the two folders. Without it you just have to enter in your password every time (which is why it won;t work with crontab). Here is the syntax I used to sync the folders in ~/Desktop/Homepage to /www/jerodweb on my web server (A Small Orange).

rsync ~/Desktop/Homepage/* username@IPADDRESS:/www/jerodweb/

* So easy! Now the last step is to create a crontab to do however frequently you wish, at the command line do

crontab -e

And then using your default editor you’ll be able to put the rsync line from above into a cronjob using this syntax.

0 * * * * rsync ~/Desktop/Homepage/* username@IPADDRESS:/www/jerodweb/

This will get the update done hourly, but you can easily change that to every minute. Super easy and you’ll never have to worry about syncing again. Also super boring too though… hope it helps Nick! Coda is great by the way.

Science AND Rainbows: Cartoonizing iPhone Movies

Ever seen those creepy Charles Schwabb commercials with the crazy life-like animations? They are done by rotoscoping, which takes about 100 (artist) man hours per single minute of film. I don’t quite have the skills for that, or the time. So I hacked together a solution for my upcoming friend film festival movie about giving, which I’ll post the finished product when it’s complete. For now, the technical side of things:

  • Movie shot on an iPhone, clipped and emailed to myself.
  • Using QuickTime on a Mac, I exported the movie to images and stripped out the audio.
  • Using Matlab I imported each image and processed with the wonderful bilateral filter function. This takes about 11s for each image, at 30 frames/s that is about 6.5 minutes for 1s of processed film.
  • I imported the images back into QuickTime and put the audio back in, save as a movie and voila! Not perfect, but interesting to look at.

Thanks Shoma for participating (and my awesome viking paper ship)!

Before:

After:

Science AND Rainbows: Quantified Art

Pretty much since the day I met the uber talented Jeff McMillan we’ve talked about collaborating on something. After our Sundance Film Festival hopeful, “Trash Boat: The Movie” fizzled out we’ve been at a loss for clever ideas. Jeff, you see, is teaming with natural talent and years of training. Myself, not so much. I love creating, but even in the rare case that I can illustrate anything with a modicum of pleasantness it takes a loooong time. And effort. And usually a hint of plagairism. So, we decided to mix my training and his, a blend of science and art. The scientific question is timeless and fundamental, what is good art? The usual answer given is that beauty is in the eye of the beholder, but the scientist in me doesn’t believe that, or at least thinks that beauty can be quantified. And doing so is the central thesis in this art experiment.

The design (if you detect a hint of tongue-in-cheek overly verbose description, you’d be correct):

Hypothesis: A drawing is made up of 3 equal components. 1) Line work, 2) color theory and selection and 3) color execution. When decomposing a technically proficient composition and supplementing with technically insufficient skill the piece will linearly degrade in “appeal”.

Methods: Two participants with polar artistic backgrounds will contribute varying components to a single piece. All permutations of component contribution will be executed. Line work will be done digitally using a WACOM tablet drawn in photoshop, constrained to a minimum of 30 minutes to further characterize technical ability. Color choice will be limited to 8 web-safe colors, chosen independently and prior to composition with pseudo-realism being the aim. Execution will be limited to 30 minutes, again to maximally characterize technical capability. The 4 linear permutations of this would then be:

1) Artist – 30 minutes of line work, 8 color choice, 30 minutes of execution.

2) Artist – 30 minutes of line work (copied from 1), 8 color choice (again, copied from 1). Layperson – 30 minutes of execution.

3) Artist – 30 minutes of line work (copied from 1). Layperson – 8 color choice, 30 minutes of execution.

4) Layperson – 30 minutes of line work, 8 color choice, 3 minutes of execution.

Analysis: To quantify the aesthetic appeal of the various composed pieces, a web based survey  will be used. Presentation of each composition will be displayed randomly and independently to counter balance the design for order effects. The user will mark each composition on a linear scale of 1 to 10. Each entry will be recorded into a database for later aggregation and data analysis.

Results: ?

Pretty nerdy, huh? I should have the web survey up in a following post soon. In the mean time here are the 4 images from worst to first:

Line Work: Layman, Color Theory: Layman, Execution: Layman

 

Line Work: Expert, Color Theory: Layman, Execution: Layman

Line Work: Expert, Color Theory: Expert, Execution: Layman

Line Work: Expert, Color Theory: Expert, Execution: Expert

Science and Rainbows: Harry Potter Edition

Sooooooo, is Harry Potter nerdy? Yes. Is nerdy cool these days? Yup. Does that make my wife the coolest person I know? Yes. Is answering your own questions annoying? HECK YES. So no more of it. Karen was having a poor day today, so I finished a little project I have been promising her for ages. It looks simple but has a few things going on behind it, which I will explain, but first the actual project.

Anyone who has seen the Harry Potter film (2, 3?) with the Weasley clock will recognize this one. It’s a clock that geo-locates the members of the Weasley family. This one locates members of my family (only me so far). And get this, IT’S ACTUALLY HAPPENING!!! The hand will point to wherever I am, updating every 60s! I only have three locations at the moment: home, work and lost (somewhere other than home or work). But that captures about 85% of my life, so it’s fairly accurate. AND it is the background of our home computer, which is our main entertainment display! It’s also displaying a real time count down to the movie premiere next week.

OK, so for those who care, this is how I did it. The principal components used are: iPhone App InstaMapper’s GPS Tracker writing to a webpage in a simple text line, a crontab to grab that text line, a shell script to parse it and translate it into a location, a series of pre-edited .jpegs of the clock, and finally geektools to display it on the desktop. This is all done in Mac but I am certain nothing about this is Mac dependent (though you may need to find separate solutions for part of the components). In any case, this all sounds difficult but in reality it’s not too bad. Step by step.

Getting and using the iPhone App: The app was $.99 when I bought it a long time ago. I don’t exactly recall setting up the site for a text GPS coord. line but I recall it not being very difficult.

The crontab to grab that line: A crontab is an automated script that runs when you specify it to. In my case I run it as often as possible which is in 1 minute increments. InstaMapper only uploads GPS data every ~30s or so, which defeats the purpose of getting coordinates much faster than every 1 minute. Open up a terminal, enter the command crontab -e. Assuming vi is your editor, hit the i key to enter into input mode, copy and paste this line:

* * * * * curl “http://www.instamapper.com/api?action=getPositions&key=13399805532640859891” > ~/Documents/PotterApp/iphone_loc.txt;

Substituting your web page. When you are done esc key, wq enter. This will save the GPS locations in a text file on your computer. It is very small so don’t sweat the space.

A shell script to parse it and translate it into a location: This I put into the same folder as the downloaded text file. It calculates a proximity of my iPhone to the two locations, work and home, and defines potterCurrent.jpg based on this. Lost is the default.

#!/bin/bash
lat_iphone=`cut -f 4 -d , ~/Documents/PotterApp/iphone_loc.txt | tail -n 2 | head -n 1` ; long_iphone=`cut -f 5 -d , ~/Documents/PotterApp/iphone_loc.txt | tail -n 2 | head -n 1` ;
lat_home=33.76391;
long_home=-118.13983;
lat_work=33.63904;
long_work=-117.852681;
rm ~/Documents/PotterApp/potterCurrent.jpg
cp ~/Documents/PotterApp/potterlost.jpg ~/Documents/PotterApp/potterCurrent.jpg
lat_diff=`echo “$lat_iphone – $lat_home” | bc`;
lat_diff=`echo “1000 * $lat_diff” | bc`;
long_diff=`echo “$lat_iphone – $lat_home” | bc`;
long_diff=`echo “1000 * $long_diff” | bc`;
lat_diff2=`echo “$lat_diff * $lat_diff” | bc`;
long_diff2=`echo “$long_diff * $long_diff” | bc`;
sum_diff=`echo “$lat_diff2 + $long_diff2” | bc`;
sum_diff=`echo “$sum_diff / 1” | bc`;
if [ $sum_diff -eq 0 ]; then
rm ~/Documents/PotterApp/potterCurrent.jpg
cp ~/Documents/PotterApp/potterhome.jpg ~/Documents/PotterApp/potterCurrent.jpg
fi
lat_diff=`echo “$lat_iphone – $lat_work” | bc`;
lat_diff=`echo “1000 * $lat_diff” | bc`;
long_diff=`echo “$lat_iphone – $lat_work” | bc`;
long_diff=`echo “1000 * $long_diff” | bc`;
lat_diff2=`echo “$lat_diff * $lat_diff” | bc`;
long_diff2=`echo “$long_diff * $long_diff” | bc`;
sum_diff=`echo “$lat_diff2 + $long_diff2” | bc`;
sum_diff=`echo “$sum_diff / 1” | bc`;
if [ $sum_diff -eq 0 ]; then
rm ~/Documents/PotterApp/potterCurrent.jpg
cp ~/Documents/PotterApp/potterhome.jpg ~/Documents/PotterApp/potterWork.jpg
fi
echo “$def_loc”
echo “iPhone Coordinates: “${lat_iphone}”,”${long_iphone}

I added this line to my crontab above to execute it. It can go right after the other line as long as there is a semicolon separating the two. For those that are new to scripts, you will use vi get_loc.sh to enter into the editing mode, again hit the i key to get into insertion mode and copy and paste this in. When you are done esc key, wq enter. You will likely have to enter the following command to it to execute chmod 755 get_loc.sh.

/bin/bash ~/Documents/PotterApp/get_loc.sh

Now, the image potterCurrent.jpg should reflect the GPS coordinates of my phone. Note I edited these in Photoshop, I do not own them. Some one else should get credit for the artwork, not myself.

Finally, we want to have the desktop display the image, refreshing every 60s. Download GeekTool to do this. It’s a pretty amazing program capable of doing amazing things. You can follow the instructions online to see how to display an image. I also have parsed my system’s time to get the countdown to the movie, that line goes into a GeekTool shell script window. It is the following:

days=`date | awk ‘{print $3}’`;cntdays=`expr 19 – ${days}`;echo $cntdays “days”;hours=`date | awk ‘{print $4}’ | cut -c 1-2`;cnthours=`expr 23 – ${hours}`;echo “” “$cnthours” “hours”;mins=`date | awk ‘{print $4}’ | cut -c 4-5`;cntmins=`expr 59 – ${mins}`;echo “” “$cntmins” “mins”;secs=`date | awk ‘{print $4}’ | cut -c 7-8`;cntsecs=`expr 59 – ${secs}`;echo “” “$cntsecs” “secs”;

So, there it is! A bit complicated, but pretty fun. I hope it cheers her up! Happy 9th Anniversary my love!