Photo Frame (2015 edition)

31 Jan 2015

Newest approach to photo frames: Raspberry Pi. There's also an excellent wallpaper changer called Variety, by Peter Levi. I wrote directions originally at Peter Levi's blog: http://peterlevi.com/variety/how-to-install/

I have recently purchased a Raspberry Pi B+, which might be more updated than the RPi I originally used (a model B from last year sometime.) For my reference, here are directions from installing on the B+.

Complete directions for posterity's sake:

1. Install dependencies:
sudo apt-get install gir1.2-notify-0.7 python-configobj python-pyexiv2 python-pycurl gir1.2-gtk-3.0 python-dbus gir1.2-pango-1.0 gir1.2-glib-2.0 python-imaging python-cairo gir1.2-gdkpixbuf-2.0 python-bs4 gir1.2-webkit-3.0 yelp imagemagick python-lxml gir1.2-appindicator3-0.1

2. Install bzr:
sudo apt-get install bzr

3. Checkout from the repository:
bzr branch lp:variety

4. Run
~/variety/bin/variety

5. Edit Variety preferences to enable start when RPi starts up

6. Edit .config/autostart/variety.desktop to fix path (Exec=sh -c "/home/pi/variety/bin/variety")

7. Install unclutter to hide the mouse cursor:
sudo apt-get install unclutter

8. Run unclutter at startup and disable screen blanking:

sudo nano /etc/xdg/lxsession/LXDE-pi/autostart
- delete line that starts xscreensaver
- Add 4 lines:

@unclutter
@xset s off
@xset -dpms
@xset s noblank

9. Reboot and enjoy

References:

Continue Reading →

Gitting rid of merge commits from git pull

11 Dec 2014

Some of you may know about git merging. I'm learning. I am contributing a bit of work to an open-source library, Scikit-Image. One of the things you do out of politeness, to keep the commit history clean, is to rebase your (possibly many) commits into just one, so that the project's history shows your addition as truly one addition. If, as in my case, your addition ends up taking a long time to get reviewed, you may end up in the situation where you need to pull in the upstream changes that have happened in the meantime.

Let's go through the process I used:

# Add upstream source to pull from:
git add remote upstream https://github.com/scikit-image/scikit-image.git
# Merge upstream's changes into current branch
git pull upstream master
# Check the git log
git log
commit 7bdcdeef0d4146d630d2937ba7b619cd23f233fd
Merge: b9c82d0 f822439
Author: Michael Sarahan <msarahan@gmail.com>
Date: Sat Dec 6 20:27:20 2014 -0800

 Merge branch 'master' of https://github.com/scikit-image/scikit-image into PhaseCorrelation

commit b9c82d03f2c6c9584c834b05ffd5c3714248de4e
Author: Michael Sarahan <msarahan@gmail.com>
Date: Mon Apr 28 08:03:15 2014 -0700

 Add subpixel-precision phase correlation function to feature module

This is bad: an extra commit for the merge to update. What's worse, I had already pushed my branch with this extra commit to github, so it showed up in the pull request. Let's try to get rid of it:

git rebase -i master

(this contains all of the commits I brought in with the merge, but not the merge commit itself!)

How do I get rid of it, then?

git reset --hard BRANCHNAME~1

(Replace BRANCHNAME with the branch that you're currently working on.)

Now, a better way to bring in the updates from master:

git pull --rebase upstream master

Continue Reading →

Political machine learning

24 Nov 2014

After being rather disappointed with the recent election, coming to grips with Jim Inhofe taking control again of the Senate Environment Committee, I've been wondering what I can do for future elections.

In the wake of the elections, NPR featured a former Bush (W) administration official gladly claiming that America had spoken clearly that they didn't like that the average family income had gone down by 2600$ per year since 2007. This infuriated me. It left everyone to draw their own conclusions, but one was obvious: it is Obama and the Democrats' fault for the decrease. Well, let's think for a moment - what happened in 2007? Some kind of economic crash? Was his reference point before or after the crash?

This kind of news is exceedingly misleading, and I am infuriated by how often this kind of thing influences people. We only ever get news with selective context, never the whole story. Anyone wanting the whole story needs to find it themselves, and that's really hard. There are some reliable journalistic sources, but people generally go to the loudest source, or to the one they trust most (often one politically aligned with them).

Enter my newest idea: can you come up with a machine learning system that is capable of aggregating facts, classifying news articles based on their usage of facts, and generally providing a tool for enlightening the public?

I've come up with a few ideas of what this system might do:

  • Monitor news sources; aggregate them into meta-pages on topics, sort of like Wikipedia summaries, with links about where content originated to read more.
  • Expand contexts for all numeric figures stated. People always choose whatever contexts push their agenda. This system should be able to restate facts/statistics in many ways (at least whatever ways the aggregate news source collects), and also be able to make simple inferences about related events (such as average annual salary going down since 2007 <-> recession).
  • Provide something like a browser extension to overlay sites with ratings/warnings about slanted facts. (perhaps something like this: http://link.springer.com/chapter/10.1007%2F978-3-540-77485-3_11)
  • Provide lobbying/contribution information to examine which interests are involved in events/decisions (see the already excellent browser extension, Greenhouse: http://allaregreen.us/)

Whether anyone would read such a thing is another question, but the burden on people to collect facts outside of sound bites is currently too great. The opportunity for voting based on reason rather than emotion is limited as such.

Next: how to get more people to vote.

Continue Reading →