Building CouchDB

This is a quick technical post for posterity, if you’re not interested I won’t be offended if you leave now.

I’m working to try to get couchdb on my hosting provider, Dreamhost. They’ve been a great service for me so far, but understandably this isn’t something they’re yet ready to support. So rather then a few apt-get’s I’m building it from source, which means erlang and spidermonkey.

I’ve got those two dependencies build (I hope) but I kept hitting an error with couchdb’s configure script complaining that it couldn’t find the libraries, despite me setting;

./configure --prefix=$RUN --with-js-lib=/home/wjhuie/run/lib/ --with-js-include=/home/wjhuie/run/include/js

Note, since I don’t have root or sudo access that I use a ~/run directory;

export RUN=/home/wjhuie/run

This is so I can isolate my installed software from the system stuff. In configuring couchdb it was able to find but complained about not being able to find jsapi.h. In the end the error isn’t that it couldn’t find it but that the header wasn’t able to compile successfully.

I searched far and wide with out much luck (and having seen others with similar problems) but in the end I realized I was missing some required files. Since the instructions from the couchdb wiki weren’t very useful;

I had followed this, more helpful, advice;

However, the commands listed needs to be modified slightly to include two files generated during the build, jsproto.tbl and jsautocfg.h;

So for the record (in case it helps someone else someday) I built my spidermonkey like this;

make -f Makefile.ref BUILD_OPT=1 JS_DIST=$RUN

Then installed it with;

cp *.h /usr/include/js
cd Linux_All_OPT.OPJ
cp jsproto.tbl jsautocfg.h $RUN/include/js
cp $RUN/lib

A good way to get a hint on the problem is to create a sample “program” and try to compile it. To do this, create a file called “test.c” with the contents;

#include </home/wjhuie/run/include/jsapi.h>
void main()
{ }

Then try to compile it with;

make test 2>&1 | less

That should allow you to see what’s going on and once that works then couchdb’s configure test should also! Now I have to sort out the unicode library requirements!

Posted in code, couchdb | Comments Off on Building CouchDB


I’ve been using a lot of python, jQuery and web services recently and thought it was time to pull together those skills into a public app.

Like most developers, I often “scratch my own itch” and write code to solve a problem or learn something. I try to post what I can but some solutions are hosted internally and I know there are numerous code fragments scattered across my hard drives which haven’t made it into posts.

Many of these projects are “evolutionary dead ends” but I think it’s important to engage in “purposeful play” without anticipating success or failure. You really have to take time to nurture your childlike creativity and it’s often in these limitless exercises that we develop the foundation for real breakthroughs for more “respected” works.

I was reminded of this recently when I watched a presentation by Aaron Koblin on some of his creative works. His compositions are stunning and while I recall noticing many of those projects independently over time, it was seeing the evolution of his portfolio that really inspired me.

If you watch the video you can see how his work went from a type of deliberate play to having a full “application”. It’s a lesson I try to perpetually embody with a “just do it” attitude, and it’s rewarding to see someone having applied it with such success.

So in that vein, I decided to clean up one of my sites and pull together a lot of these components into something “useful”. I call it “twitterline”, because “twitterbar” may be more descriptive but doesn’t roll off the tongue as well. You can see an example and get a pretty good idea of what it’s used for.

The API is “RESTful” and is simply “” followed by your twitter ID, e.g. “/wjhuie” and the number of days that you’d like to graph, e.g. “/4”. I’ve limited the number between [1, 14] and if you don’t supply a number the default is 7, which all make for reasonable defaults.

However, beyond just looking at the bar graph on my site, you should be able to embed it wherever you wish! You can check the source on my example, mostly you’ll need to make sure jQuery and jQuery.Flot are embedded first and you’ll likely want to tweak the CSS. Just let me know if you need help to it up and running or if you’d like some different defaults.

It’s intended to be a simple culmination of a more complex process (which I’ll blog more on later) but I hope it inspires you to dust off a project of your own or start a new one!

Posted in code, python, twitter, visualization | 2 Comments

Google’s Unspoken Security Vulnerability

Let’s be honest, I really like Google. Without them I couldn’t be as productive or near as smart as I am today. I often tell people, the most important Quotient out there isn’t Intelligence or Emotional, it’s their Google IQ. It’s OK if you don’t know it… but if you can’t find it then you’re in trouble.

I mentioned previously that Google’s browser, Chrome, fails what I consider to be an important security test, but I’ve been largely silent on another issue Google seems to have ignored.

However, I can only conclude that it’s a threat larger then we faced with GMail and should be rectified quickly.

Initially, when GMail was released it had no comprehensive security, i.e. most of the communication between you and GMail was unencrypted. Immediately, there was a outcry from the computing-public (at least those savvy enough to understand the implications) and Grease Monkey scripts were written to force an encrypted connection for all the transactions and now it’s an easily configured feature in GMail’s settings.

However, the same flaw has systematically been overlooked in Google Reader. As any ATOM / RSS convert knows, feeds have become a critical component of our computing existence and as any social network participant knows… they’re not  just for websites anymore.

Gone are the days when RSS was used simply for notifications that a public post or comment had been written. Now it’s used for some of my most intimate (at least of the digital sort) conversations. I get everything from status messages (which on Facebook aren’t as public as on twitter) to direct private messages all sent to my reader. Not only are they sent unencrypted, but even worse I’m forced to use an unencrypted connection to read them.

Historically, email was rarely encrypted on the wire when it was sent from the sender to the receiver’s email system, although that has recently changed. However, the main security concer with GMail was anyone on the same network could view the contents of their inbox as they were reading their messages!

I really don’t use email all that much anymore and instead rely on social networks and RSS notifications for the bulk of my personal communications. Which, thanks to Google Reader’s lack of an encrypted configuration, is sent free and in the clear!

I think it’s time Google acknowledges the role and responsibility that Google Reader has in people’s private lives and works to properly secrure that information.

Posted in frustration, Google, security | 2 Comments

Build your own ioGun!

I apologize for what will effectively be a brain dump post, but a new friend of mine from the hackaday forums is getting started on his own accelerometer controlled system and I wanted to see if I could save him some time and frustration.

I think standing on the shoulders of Giants is a fantastic aspect of human nature, now if only someone could show me to some friendly Cyclopi (is that really the right pluralization?), and frankly I could not exist, let along thrive in the technological world if it were for the good graces of a great many people.

Perhaps I will write a _very long_ blog thank-you to them (if I can remember them all). So consider this my little chance at saving some of you a few hours of your precious time (and brain strain). Because of the very nature of hacking (i.e. everything’s just a little different and throw together) this can’t quite be the same quality as an instructable but it should get some of you started!

I’ve put up my code here so that’s quite obviously the place to start. You’ll find a python script and an HTML page. The script connects to the MoteDaemon port I referenced earlier and will write these data points out to a JSON file which can be served via your webserver, and is then picked up by the HTML page.

If you look through the code you’ll see there’s clearly some tuning that can be done. As people on many forums pointed out there’s a “lag” which is really just because of my polling rates (and less to do with the network traffic).

Two important things here, first you’ll see that I created a separate thread for the monitoring and one for the output, that’s because the wiimote data is fast and furious and you don’t want to block and miss any!

Second, I know writing to an JSON file isn’t ideal so the output part actually buffers 10 events and writes those, luckily jQuery is smart enough to only pull the file if it’s changed so it’s not as bad as it sounds.

Once you’ve got the accelerometer data into python (and then into JSON) it’s ‘just’ a matter of writing the webpage you want! jQuery makes some stuff really easy so I suggest giving it a look if you haven’t yet!

Of course what makes it really easy for me was the ioBridge module. I just plugged in a servo there and defined a widget on their page and ‘viola I had a webservice I could send commands to!

I hope that helps give some of you (or at least one of you) a boost, and if I can help out at all please let me know!

Posted in code, hardware, inspiration, iobridge, opensource, python | 2 Comments

Wiimote Controlled Coil Gun

I know it seems like a while since I last posted, but since my Christmas enlistment into the Joint Strike Force I’ve been busy winning WWIII for America! Actually it’s not been all video games, I’ve been working on a Django project that I hope to release in a few weeks, and inspired by ServoBeer I managed to find time for some ioBridge hacking.

However, as you can tell my recent militaristic tendencies have probably gotten the better of me!

Weapons of War

Weapons of War

As you know from my previous posts I’m interested bringing a higher level of physical awareness and capability to my typical computing environment. Embedded systems are usually used to bypass the need for sophisticated systems, and the ioBridge is great for those situations.

Yet, I’m perfectly comfortable with the idea of using a laptop for a command and control system. It might be a more “tethered” solution then some people would like but I figure in a few years my iPhone will be able to fulfill the role my laptop currently has!

I wanted to move beyond some of the work I’ve been doing with passive sensors and in thinking about some ideas for a more active interfaces I realized that the wiimote certainly fits the description of a powerful controller! There are already enough great wii control hacks out there and some programs let you use the wiimote as a mouse!

But I wanted more then to just replace my mouse, and in most of these cases the flow control goes from the wiimote to a computer, or the wiimote to an arduino with lots of wiring. I wanted to both avoid the electrical requirements as well as extend the influence and “reach” of my wiimote beyond my immediate vicinity.

There are certainly times when you wouldn’t want to put your expensive new Macbook in harm’s way. Whether on the front lines or in the basement laptops are sometimes the wrong systems to dedicate to a task, so ioBridge to the rescue!

The ioBridge already has a number of features which make it idea for “remote” situations and so all I needed create was a mechanism to coordinate wiimote events sent to my computer with ioBridge events sent to the module. Luckily the team at ioBridge has created just such an API!

In this setup I use a python script and MoteDaemeon to bring the events into my laptop’s domain. Of course I could script up a number of local events but what I wanted to do was act on that data and sending commands to an ioBridge module.

So I build a website which monitors the position from one axis of the wiimote and extrapolates that position to a servo output on a remote ioBridge module (which happens to be in my office, but doesn’t have to be). I’m also tracking some of the button inputs and can expand easilly to include other axes as well!

Now I just needed something fun to control on the other end! I happened to have an office golf putter lying around and that uses an electromagnetic induction coil to generate the force needed for the ball return when you sink a putt. If you take that apart and replace the metal cylinder with something a tad bit smaller then you’re left with a coil gun capable of some pretty powerful shooting!

I’m not sure it’s up to DoD standards yet but remember the only required link between the wiimote and the ioBridge module is the Internet so if you can sneak one of these into your friend’s house, or a colleagues’ office, then you could be anywhere on the planet with Internet access and stick it to them!

How’s that for “Can you hear me now?”. Check out the video of it in action on YouTube or Vimeo!

Posted in hacks, hardware, iobridge | 80 Comments