I’d been wanting to try out Heroku and Tornado for a while, so why not try them together? I found a nice starter repo by Mike Dory, co-author of the O’Reilly Tornado book, so I figured I’d use that. I forked it and rearranged it a bit, and it worked perfectly! Here’s what I did:
- I’m on a brand new computer, so I had to install some basic stuff first:
- Setuptools:
sudo curl http://python-distribute.org/distribute_setup.py | sudo python
- PIP:
sudo curl https://raw.github.com/pypa/pip/master/contrib/get-pip.py | sudo python
- Get the starter repo.
- Make a Heroku account if you don’t have one and set it up.
- Make init-project.sh runnable:
chmod +x init-project.sh
- Run
./init-project.sh
- That should be it, and your Heroku app is live!
Let me know if this works for y’all!
Recently I wrote up a tutorial on getting started programming Processing sketches in Clojure. The clj-processing bindings require a slightly involved build process, which I’m detailing here. I have since created a quick-start project that contains the pre-built binary, so unless you want to build a newer version of the processing.core.jar library, you can use that. So here’s how to build it. read more…
For the past little while here at the studio, there’s been a lot of buzz and conversation about Clojure, a modern LISP language that runs on the Java Virtual Machine. It’s a fascinating language that can help anyone learn about functional programming. There are a variety of interesting resources for learning Clojure, but I find it’s most fun when your code can make something happen on your screen instantly, like Processing does for Java.
As such, my friend Tims Gardner and I were talking about putting together a class on Clojure & Processing using Roland Sadowski’s clj-processing bindings and Arthur Edelstein’s Clooj IDE. So, to make things as fast and easy as possible for people to get started, I made a Clooj/Processing Starter Project that you can download and start using right away! Here’s what you need to do. read more…
My studiomates and I do workshops most weekends on various (sometimes esoteric) coding and hacking subjects, and recently The Atlantic ran a story about us on their blog.
Awesome! For more information on Kitchen Table Coders, check out our website and our EventBrite page.
The New York Society for Research Art presents a gathering of artists, curators, gallerists and theorists to investigate and debate the role of scientific and technological experiment in contemporary art practice—when is an artwork a science project, and when is a science project an artwork? Our guest speakers will present a variety of perspectives on the topic, ranging from historical to curatorial to practical to economical. The talks will be followed by an open panel discussion to address and debate the presented ideas interactively with the audience.
The event is free and open to the public! Register on EventBrite (and please consider a donation!). Also check out the Facebook Event.
Confirmed speakers include:
- Georgia Krantz, Education Manager, Guggenheim
- Kyle McDonald, Artist
- Luther Davis, Artist
- Keynote by Ted Hayes and Alex Dodge, Artists
Presenter Biographies:
Georgia Krantz works full-time as the Education Manager for Adult Interpretive Programs at the Guggenheim Museum. She is an art historian with extensive teaching experience from Ancient to Contemporary Art. She is Adjunct Professor at the New School as well as ITP, and lectures at the Guggenheim, the Museum of Modern Art and the International Center of Photography. Over the past few years she has been involved in several outside projects including an NEA-funded educational website for the Rubin Museum of Himalayan Art, and Vital Visionaries, a study by the National Institute on Aging on the value of art for promoting intergenerational communication. She has an MA in Art History (Northern Renaissance and Baroque Art), and is working on her Ph.D dissertation in Modern Art.
Kyle McDonald works with sounds and codes, exploring translation, contextualization, and similarity. With a background in philosophy and computer science, he strives to integrate intricate processes and structures with accessible, playful realizations that often have a do-it-yourself, open-source aesthetic.
http://kylemcdonald.net/
For one of my major projects I’m tasked with figuring out how we can locate mobile wireless devices within a limited location, and it seems a lot of other people I’ve talked to are in the process of figuring out the same thing, so here’s an overview of what I’ve learned so far. read more…
It’s been a struggle, but I finally figured out how to use a Roving Networks RN-XV WiFi module as a remote switch. It’s not hard now that I know how it works, but figuring out was quite difficult, as the manual is apparently incorrect and the firmware it shipped with was causing problems. Read on for the solution!
Hardware
Simple! Here’s all you need:
- An XBee breakout board (so you can plug it into your breadboard)
- An XBee Explorer (not necessary with ad-hoc mode, but I had one around so this tutorial will use it)
- 3.3V regulator (ONLY—the module has a 10% tolerance, so anything beyond that will either not work or damage the module).
- 10µF and 0.1µF capacitors for good measure (clean power is especially important when using radio devices)
- Power and Ground (Pins 1 and 10, the top and bottom pins on the left side of the module)
- An LED connected to pin 9. In practice you’d want to put a current-limiting resistor on it, i.e. 220 ohms, but for a quick test it won’t matter. The module only drives 8mA on this pin.
- That’s it!
set wlan phrase <your wpa password> set wlan ssid <your ssid> save reboot
ftp u
telnet <module's ip address> 2000
set sys mask 0x21f2
set sys output 2 2
set sys output 0 2
References
- RN-XV User Manual (API reference, etc.)
- RN-XV Datasheet (pinout and electrical characteristics)
- Install Eclipse. I had the “Galileo” version which I found out the hard way isn’t supported, so I downloaded the newest as of writing (“Indigo”).
- Install the Android SDK.
- Install the Android Developer Tools (ADT) plugin for Eclipse.
- Download the WiMM Android Add-On (make a free developer account first to get it).
- Put the WiMM Add-On folder in the add-ons folder in the Android SDK.
- Run the Android SDK Manager from Eclipse > Window.
- Select and install Android 2.1 (API 7) and the Android SDK Platform Tools.
- Make a WiMM Android Virtual Device with SD card 2 GiB and resolution 160×160.
- You can now make new projects that target the WiMM One Add-On.
Building and Running on the Emulator
- Open a terminal at [your-android-sdk]/add-ons/addon_wimm_one_7/tools and run ./emu.
- Wait for the emulator to boot up (it takes a minute).
- Hit “Run” in Eclipse.
- If you get an expired certificate error, look here.
- If you’re prompted to choose a device, choose the emulator.
Building and Running on the Device
- On your WiMM, go to Settings > Advanced and turn on “Allow USB debugging”
- Plug in your WiMM.
- Open a terminal at addon_wimm_one_7/tools and run ./android update adb.
- Go to addon_wimm_one_7/platform-tools and run ./adb kill-server and ./adb start-server.
- Now run ./adb devices and you should see your hardware device listed as well as any running emulators.
- Now when you run your app from Eclipse, you can choose your hardware device!
The RN-XV WiFi module is a nifty little WiFi module designed to fit the same pinout as an XBee, so it’s intended to be a drop-in replacement.
Tonight I whipped up a little test of the module to get a joystick to talk to a Node.js server over WiFi. I attached +3V power and ground to the module (pins 1 and 10, respectively), pin 2 (TX) to Arduino digital pin 0 (RX), and pin 1 (RX) to Arduino digital pin 1 (TX). That’s all the hardware setup you need.
I used this WiFly library to handle the connection. All it does is talk to the WiFly module over serial and send control commands, so the library abstracts that a bit. Here’s the Arduino sketch I built: read more…
Today I was working away from my home file server which runs the BitTorrent server Deluge. My Deluge Web UI stopped working for some reason (and it never worked that well in the first place) and I really needed to start a torrent at home. Deluge has an “Auto Managed” feature that’s enabled by default, but since I seed a lot of torrents, it actually prevents a new torrent from starting to download automatically, so I have to disable that and the resume the torrent after adding it. Thankfully Deluge has a Python client interface we can use to write our own scripts.
Here’s an example script that adds a URL from an argument with auto_managed turned off:
#!/usr/bin/env python
# encoding: utf-8
"""
DelugeEasyAdd
Starts a new Deluge torrent from a URL.
Created by Ted Hayes.
"""
import urllib, os, sys, re
# Import the client module
from deluge.ui.client import client
# Import the reactor module from Twisted - this is for our mainloop
from twisted.internet import reactor
# Set up the logger to print out errors
from deluge.log import setupLogger
setupLogger()
# Connect to a daemon running on the localhost
# We get a Deferred object from this method and we use this to know if and when
# the connection succeeded or failed.
d = client.connect()
PRIO_NORMAL = 1
PRIO_MAX = 5
torrentURL = sys.argv[1]
# btjunkie URLs use 'download.torrent' as the filename, get a better one
if re.search("btjunkie", torrentURL):
filename = re.findall("torrent\/(.*?)\/", torrentURL)[0]
else:
filename = os.path.basename(torrentURL)
print "Using filename: %s" % filename
def addTorrent():
client.core.add_torrent_url(torrentURL, '/home/daleth/Downloads/'+filename, {'auto_managed':False}).addCallback(added)
def added(s):
print "Added status: ",s
#client.core.resume_torrent()
disconnect()
# We create a callback function to be called upon a successful connection
def on_connect_success(result):
print "Connection was successful!"
addTorrent()
def disconnect():
print "disconnecting"
client.disconnect()
reactor.stop()
# We add the callback to the Deferred object we got from connect()
d.addCallback(on_connect_success)
# We create another callback function to be called when an error is encountered
def on_connect_fail(result):
print "Connection failed!"
print "result:", result
# We add the callback (in this case it's an errback, for error)
d.addErrback(on_connect_fail)
# Run the twisted main loop to make everything go
reactor.run()
I still have to figure out how to then automatically resume the torrent.
Here are some helpful links:
Following Trammell Hudson’s excellent introductory workshop on assembly and reverse engineering, here are my notes on what I had to do to get things up and running.
I was doing this on my Ubuntu 10.04 Linode instance, and we were targetting ARM processors, so first I had to install the appropriate gcc toolchain. I didn’t have add-apt-repository, so I had to install python-software properties first. The last install is to get libc (stdio, etc).
sudo apt-get install python-software-properties sudo add-apt-repository ppa:linaro-maintainers/toolchain sudo apt-get install gcc-4.5-arm-linux-gnueabi sudo apt-get install libc6-armel-cross libc6-dev-armel-cross
Then I used these commands for compiling, disassembling and looking for interesting strings:
arm-linux-gnueabi-gcc-4.5 -O3 -c helloWorld.c arm-linux-gnueabi-objdump -D helloWorld.o | less strings -t x helloWorld.o
Eagle Error: old version of device set is not present in the new version of this device set.
Today I was attempting to paste parts of an Eagle schematic I found online into a new schematic, and I was getting the following error message:
Package variant PTH1 in the old version of device set RESISTOR is not present in the new version of this device set.
This is caused by a library in the original schematic having some different package definition than the library in the new schematic. The fix is easy: In the original schematic, go to Library > Update All. Then you can copy and paste without the error!
If you’ve been getting an Arduino error like this:
avrdude: verifying ...
avrdude: verification error, first mismatch at byte 0x0007
0xff != 0x7f
avrdude: verification error; content mismatch
It may be as simple a fix as moving your USB cable from a hub directly to your computer—that fixed it for me!
More information: I had also been getting errors like this from avrdude:
avrdude: 2 retries during SPI command
For anyone in the NYC area, I’m running a workshop on PureData, the free, open-source sound synthesis software. Sign up here! Here’s the description:
Bored with ordinary instruments? Can’t figure out how to get just the right sound you’re looking for? Ever wanted to build your own virtual instruments from scratch, or make a physical interface for your music? Wondering how sound and synthesizers work in the first place?
PureData is a free, open-source tool for making noise that encourages experimentation and rapid prototyping, and it’s fun, too! I’ll walk you through the basics of both PureData and sound itself to enable you to explore a whole new field of sonic possibilities. No programming knowledge required—I’ll tailor the material to your experience levels, so come check it out and bring your ideas and questions!
Come check it out!
We humans tend to treat our perceptions as holistic—as seeing things as things, instead of as an accumulation of parts, details and features. This is the great abstracting power of the 3-pound neural network in our heads, and is a major differentiating characteristic from other computational paradigms. read more…
Today I had a directory full of mp3 files for a Flash game that each had the text “woman01″ in them. Since I wanted to just keep the rest of the filename, I put together this Bash one-liner:
for f in *; do mv $f ${f/woman01/}; done
Simple and effective! Bash has a surprising array of string-manipulation capabilities, which I learned about here.
The title says it all: for my “Deconspectrum” installation, I am burning a program onto a bunch of ATMega328 chips using a USBtinyISP (In-System Programmer). At first I was running into a perplexing problem: the program was running much slower than it should have been. I could tell immediately because I had a short POST (Power-On Self Test) at the beginning of the program that flashes the LED Red-Green-Blue, and it was going far slower than it should have been. read more…