Welcome to the IdeaMatt blog!

My rebooted blog on tech, creative ideas, digital citizenship, and life as an experiment.

Entries from September 1, 2015 - September 30, 2015

Wednesday
Sep302015

Notes From a Conversation With Political Activist Josh Silver (Represent.us)

Since leaving my research programmer position at UMass (funding was drying up), I've been reaching out to leaders to explore possible contributions I could make in the progressive or educational spaces 1. Here I'd like to briefly share a few notes from my conversation with one of them, Josh Silver. NB: Any errors I make are my own - please send corrections!)

And a quick pitch: If you know someone who's hiring in those areas then please give me a ring. (I'm looking for the intersection of progressive work, software tool development, and solid funding.)

Josh Silver (Represent.us)

I had the good fortune to meet Josh Silver, who has made contributions in media reform and campaign finance reform (think Citizens United). He currently runs Represent.Us, and, before that, Free Press. Josh summarized his perspective on what he sees as the two main challenges to policy change (an informed public, and government representatives who actually represent people, not big money or corporations) and gave me a precis on how money is injected into politics (direct to campaigns and super PACs, which can be tracked, and indirect via 501c4 and 501c6 organizations, which is not directly tracked - more here). Josh said there's a lot of activity in data and politics, for example:

He also showed me the Greenhouse browser extension, which rewrites web pages via some information extraction to pop up campaign finance information for people on the page.

We talked a little about the fallibility of human nature and how emotion and stories often trump facts (It's a "basic human survival skill," explains political scientist Arthur Lupia of the University of Michigan. We push threatening information away; we pull friendly information close. We apply fight-or-flight reflexes not only to predators, but to data itself.). (I tend to arrogantly think I'm immune, but I'm not - see Thinking, Fast and Slow and You Are Not So Smart - Amazon links)

Regarding funding for software development, Josh suggested either contacting one of the above organizations, or propose funding for a grant from someone like the Knight Foundation.

I finished up by talking a bit with one of his research assistants about possible tools that could help folks like him and reporters collect campaign contribution information more easily. My takeaway was that there's no good, central aggregator; information is disparate and spans multiple sites.

Great stuff! Stay tuned...

Areas of Interest

  • Skepticism, critical thinking
  • Journalism, media reform
  • Education and science
  • Fact checking
  • Environment, climate change
  • Freethought
  • Politics, digital government, campaign finance reform
  • Citizenship, participation, digital government
Friday
Sep252015

Brief report: Boston Python User Group: Favorite Libraries Meetup

python logo

Last night I attended a favorite libraries Python Meetup organized by The Boston Python User Group (@bostonpython) and hosted by Akamai. Here I'll give a brief summary of the libraries covered, and a newcomer's perspective on the event. The presentations overall were great - focused, not too long, with code examples and demos. And of course the theme was a winner - who doesn't love learning about a tasty library that may come in handy? Fun demos make it even better. I'm looking forward to attending more of them.

Neil Tenenholtz: mrjob

mrjob is a library for writing MapReduce jobs (Hadoop tutorial [here](https://hadoop.apache.org/docs/current/hadoop-mapreduce-client/hadoop-mapreduce-client-core/MapReduceTutorial.htm l), original Google paper here). Neil did a live demo showing how little code is needed to express paralellizable tasks, at the simplest, just a mapper() and reducer() function. He demo'd wordcounta and showed how to run it on different clusters, including simulated, local, and Hadoop or Amazon Elastic MapReduce installations. At one of the UMass labs I worked in, we used Hadoop in a number of ways, including batch data processing and cleanup (i.e., ETL) for the machine learning algorithms, and parallelized SQL via Cloudera Impala. Yummy stuff!

Lindsay Raymond: Funcy

Funcy adds to Python some functional tools "inspired by clojure, Underscore.js, and [his] own abstractions." (They reminded me a bit of the Scala idioms I saw in my brief exposure to it for a Spark GraphX project I did to implement fast graph path searches. Ask me sometime about my take on Scala as compared to Python ;-) Lindsay gave some examples, and it was clear that there's a lot more to the library than can be shown during a short demo, but she touched on concepts like how readable elegantly composed functions are, and how testing is eased by breaking computation down into stand-alone pieces. (As an XP fan, I really appreciated this point.) While I've done less functional programming than perhaps I'd like, funcy got me interested in learning more.

Scott Sanderson: Click

click logo

Click is a package that simplifies writing command-line interfaces. Scott demonstrated (with humor :-) the main features, showing the decorator-based style it uses. Oftentimes I end up writing command line tools for applications that don't need a UI or for ones that can be scripted, and I'll definitely have a look at Click the next time the need comes up. You can read the author's motivation for writing an alternative to the inbuilt argparse module here, and learn how it compares to others at Comparing Python Command-Line Parsing Libraries - Argparse, Docopt, and Click.

Amandalynne Paullada: NLTK

Natural Language Toolkit is a new favorite of mine, and I was excited to see Amandalynne's presentation. The library is rich in features, including word and sentence segmentation, part-of-speech tagging, classifiers, information extraction, and more. Amandalynne demo'd a clever nickname generator (e.g., https://en.wikipedia.org/wiki/Text_segmentation) which, as you'd expect, was a hit. Even (or especially) when it surprised. I'm currently evaluating it for a skeptical toolbox idea I have, using it for named-entity recognition, for example. (I learned a little about this area in my last contract; it's surprisingly difficult.) There's a very well done NLTK book, which I came away from reading thinking that it would be a great introduction to Python for newbies. This is because learning the language is set in the context of text processing, which is inherently cool. Good stuff.

Ned Jackson Lovely: itsdangerous and bcrypt

itsdangerous logo

itsdangerous is a library for doing cryptographic signing, and can be applied to cases like secure "amnesia" ("forgotten password") emails or saving protected cookies. Using the module this way can, in some cases, eliminate the need to store hashed data in server-side tables. bcrypt is a tool for password hashing. Not having done work in this area, I can't say much about these libraries, but I fully believed Ned's point about DIY cryptography being hard to get right, and about getting professionals involved for anything important, such as protecting credit card information.

Tuesday
Sep082015

An Arduino Relaxation Tool Using Two Cell Phone Motors

Here's a fun little project I did a while back, which I thougth I'd share. The idea was to have two small motors (like the ones in cell phones) that you hold in each hand, one motor per hand. The motors alternately pulse back and forth between the left and right hands, with two potentiometers controlling how long each motor stays on, and the delay between switching. I thought it might be relaxing (and fund to build), and it actually is! It's also kind of a treat at parties (at least the geeky ones I'm invited to) because you get to see how differently people set the pots to get their own relaxation level. I like mine relatively slow, but maybe it could be cranked up to work as a stimulator.

Anyway, the project is on GitHub at http://github.com/matthewcornell/arduino-relaxation-tool. Below I've included the readme along with some pics. Enjoy!

Circuit

This is basically a mashup of two standard Arduino projects - reading analog values from a pot, and controlling a piezo motor. The circuits are duplicated for left and right sides. The circuit diagram is here, and a picture of the assembled board is here.

Here is an example of the individual projects:

Parts

Assembly

I used a basic Arduino breadboard - it was pretty straighforward. I didn't have any 33 Ohm resistors so I had to use 3 x 10 Ohm ones in series. For the motors I simply applied some heat shrink tubing for something to hold onto. I looked into more durable cases (I tried ping pong balls), but this worked OK for the prototype. See the pic here.

Code

The code manages four pins - two analog in ones for reading the pots, and two digital out ones for controlling the motors. The fifth pin is the built in LED digital out one that I pulse for effect. The pots are read by adjustPeriodAndDurationBasedOnPots() and saved into two variables: vibePeriod (how often the motor vibrates in ms: a range ~ [100 ms, 2000 ms]) and vibeDuration (how long the motor vibrates, in the same time range). The last variable is isCycleLedOn, which alternates between 0 and 1 with each cycle. After setup() initializes the pins, The standard Arduino loop() function just reads the pots (which sets the two control variables), cycles the first motor, and repeats for the second one. cycleMotor() turns on the motor, cycles the LED, waits the appropriate duration, then repeats to turn the motor off. Finally, adjustPeriodAndDurationBasedOnPots() reads the analog value from each pot (a value between 0 and 1023) and scales it to a range between ~100ms to 2000ms, which seemed to work pretty well. (Any faster was irritating, and any slower would have been boring :-)