"A Real-World Use Case" in Chapter 1
In this case a GUI window need to be displayed based on data extracted from "New York Times".
So we have to connect to the VM with X forwarded: ssh vagrant@localhost -p 2222 -X
.
I registered the NYT developer keys.
So the run following commands to extract data:
parallel -j1 --progress --delay 0.1 --results results "curl -sL 'http://api.nytimes.com/svc/search/v2/articlesearch.json?q=New+York+Fashion+Week&begin_date={1}0101&end_date={1}1231&page={2}&api-key=13fdd3f29a9479f92ef74c26166fda3a:16:60048486'" ::: {2009..2013} ::: {0..99} > /dev/null
cat results/1/*/2/*/stdout | jq -c '.response.docs[] | {date: .pub_date, type: .document_type,title: .headline.main }' | json2csv -p -k date,type,title > fashion.csv
< fashion.csv Rio -ge 'g + geom_freqpoly(aes(as.Date(date), color=type), ''binwidth=7) + scale_x_date() + labs(x="date", title="Coverage of New York'' Fashion Week in New York Times")' | display
Now a GUI window named ImageMagick appears, and display the data in file fashion.csv.