Sunday, November 20, 2011

Eggbot DNA Sequence Plot

I wanted a ping pong ball to take to work with DNA sequence on it. An arbitrary FASTA file off of JGI's IMG site provided the data, which pasted into a 3200 wide by 800 tall Inkscape doc, the standard size for the Eggbot. It didn't want to plot as text, so after a bit of doc hunting, I found the Hershey Text which is text as paths. The first ping pong ball was too crowded to read. A couple of iterations of cutting text out, resizing, and rearranging showed that six lines of about 45-50 characters each stretched to almost the full size of the image fit onto a pingpong ball at a readable size.

Here is the result in a grainy computer photo:



The Eggbot kit is from Evil Mad Science and was pretty easy to assemble.

Troubleshooting the Eggbot

I set up the Eggbot with my daughter for another session of printing and she immediately started hitting problems. This is what we observed:

The pen would flop to the right and the drawing would all clump up at that side. Starting with the pen swung to the left to compensate and the drawing would clump to the left.

Pen rotation was very jerky.

There were a couple of red lights on the board at the left side with the connector panel for the small wires.

Pen arm rotation seemed to always be to one side when done manually for a number of steps. Positive seemed to be under control, negative flopped more in same direction.

This seemed to align with wiki manual instructions about adjusting the potentiometer for the motors, but that didn't seem to help. It also did not mention the red lights.

Eventually I looked at the physical wiring connections of the motors and found the brown wire at the bottom disconnected, which is one of the wires to the pen arm. Reconnect the brown wire and the Eggbot went back to work like normal.

Monday, November 1, 2010

Trying out blekko

Blekko is an interesting new search engine where you can do a positive filter by including a slashtag. /ruby and /javascript worked well for me. I created slashtag /edallen/wargame when I didn't find a wargame or wargames slashtag and put a few favorite links in it to start out. I couldn't figure out how to exclude based on a term or slashtag so far, like wargames -movie or wargames -/movie to get links about the movie out of the listing. The help section on blekko was silent on this so far as I could tell. They talk about excluding individual results from the returned set after the fact but not filtering the search by exclusion as far as I can tell.

Sunday, October 10, 2010

json_pure 1.4.6 warnings

Was getting the constants reloaded warnings from json_pure 1.4.6 loading after json 1.4.6 . Found some discussion pointing to a patch at github.com/flori/json.
Tried setting that as the source for the json gem in the Gemfile (gem 'json', :git => "git://github.com/flori/json.git" )and bundle installing. First run after that blew up like this:

allen$ rails c
/Users/allen/.rvm/gems/ruby-1.9.2-p0@global/gems/bundler-1.0.0/lib/bundler/source.rb:544:in `rescue in load_spec_files': git://github.com/flori/json.git (at master) is not checked out. Please run `bundle install` (Bundler::GitError)
from /Users/allen/.rvm/gems/ruby-1.9.2-p0@global/gems/bundler-1.0.0/lib/bundler/source.rb:542:in `load_spec_files'
from /Users/allen/.rvm/gems/ruby-1.9.2-p0@global/gems/bundler-1.0.0/lib/bundler/source.rb:362:in `local_specs'
from /Users/allen/.rvm/gems/ruby-1.9.2-p0@global/gems/bundler-1.0.0/lib/bundler/source.rb:527:in `specs'
from /Users/allen/.rvm/gems/ruby-1.9.2-p0@global/gems/bundler-1.0.0/lib/bundler/definition.rb:341:in `block in converge_locked_specs'
from /Users/allen/.rvm/gems/ruby-1.9.2-p0@global/gems/bundler-1.0.0/lib/bundler/definition.rb:330:in `each'
from /Users/allen/.rvm/gems/ruby-1.9.2-p0@global/gems/bundler-1.0.0/lib/bundler/definition.rb:330:in `converge_locked_specs'
from /Users/allen/.rvm/gems/ruby-1.9.2-p0@global/gems/bundler-1.0.0/lib/bundler/definition.rb:145:in `resolve'
from /Users/allen/.rvm/gems/ruby-1.9.2-p0@global/gems/bundler-1.0.0/lib/bundler/definition.rb:93:in `specs'
from /Users/allen/.rvm/gems/ruby-1.9.2-p0@global/gems/bundler-1.0.0/lib/bundler/definition.rb:137:in `specs_for'
from /Users/allen/.rvm/gems/ruby-1.9.2-p0@global/gems/bundler-1.0.0/lib/bundler/definition.rb:126:in `requested_specs'
from /Users/allen/.rvm/gems/ruby-1.9.2-p0@global/gems/bundler-1.0.0/lib/bundler/environment.rb:23:in `requested_specs'
from /Users/allen/.rvm/gems/ruby-1.9.2-p0@global/gems/bundler-1.0.0/lib/bundler/runtime.rb:11:in `setup'
from /Users/allen/.rvm/gems/ruby-1.9.2-p0@global/gems/bundler-1.0.0/lib/bundler.rb:100:in `setup'
from /Users/allen/Projects/charsheets/config/boot.rb:8:in `'
from :29:in `require'
from :29:in `require'
from script/rails:5:in `
'

Changed to just (gem 'json') and bundle install again.
Now it's working cleanly in both console and unicorn-rails, it seems the patching worked, though I need to understand things better.

allen$ rails c
Loading development environment (Rails 3.0.0)
ruby-1.9.2-p0 >

Why Mongoid

Just noticed the previous post to my mongoid troubleshooting post mentioned mongo_mapper. Why did I change? I hadn't gotten too deep into either one so didn't have much of an opinion. I picked mongo_mapper initially since it had more of a track record, even though some blog posts said mongoid integrated a bit better with Rails 3. But then I wanted to try out devise and they had switched from direct support of mongo_mapper to mongoid. I started into a brief look at what it would take to hook up devise with mongo_mapper, since I had started using it (barely), but then I found Daniel Kehoe's excellent devise mongo starter project http://github.com/fortuity/rails3-mongoid-devise and tried it out. I started a test project off of it as he suggested, and that worked right away. Later fiddling with my Gemfile got things out of sync. Now I see he is using an updated his Gemfile's lines for mongoid, so I will try that.

Round and round in circles on mongoid dependencies

I kept having the bug where it fails to load the binaries for bson_ext:

>rails c

**Notice: C extension not loaded. This is required for optimum MongoDB Ruby driver performance.
You can install the extension as follows:
gem install bson_ext

If you continue to receive this message after installing, make sure that the
bson_ext gem is in your load path and that the bson_ext and mongo gems are of the same version.

After several rounds of fiddling what worked was uninstalling mongo, mongoid, bson, bson_ext and then in the Gemfile:


# Bundle gems needed for Mongoid

gem "mongoid", "~>2.0.0.beta"
gem "mongo", "1.0.9"
gem "bson", "1.0.9"
gem "bson_ext", "1.0.9", :require => false

I think among the things that had me tripped up before was that just specifying bson was getting me 1.10, but mongo is 1.0.9 and there is some version matching needed. I think the :require => false on bson_ext may be important too.

Monday, September 27, 2010

Rails stack

I had a good weekend. Got in about a day's worth of hacking scattered among the bike rides, walk downtown, library, laundry, grocery run, attempt to fix Wii, exercise, reading, etc. Stood up the beginning of a fresh Rails stack to build a Rails 3 project with rvm, Ruby 1.9.2, MongoDB, MongoMapper, Devise, Rspec & Cucumber. We use Ruby 1.8.7, svn, mysql, test-unit and Rails 2.3.x at work, so its a stretch in all directions. Even tried refreshing my rusty and never very fluent vim skills by doing all my editing with vim. I'm really enjoying Bundler and looking forward with playing more with the rest.

One possibly useful tidbit for a few days: cucumber-rails from Aslak Hellesoy's github repo as of 9/26/10 wanted version 0.2.2 of aruba, but the aruba there is 0.2.1 which had me stuck for a bit. I got my Gemfile to bundle install with cucumber by downloading cucumber-rails from the repo and bumping back the aruba dependency to 0.2.1 in the gemspec, pointing the Gemfile to the local copy with 'gem "cucumber-rails", :path => "/path/to/the/local/cucumber-rails" and crossing my fingers. The first feature is working, and a couple of feature files of todos are properly yellow, so it is at least superficially not 'sploding on me.

The project? To begin with, an RPG character sheets DB targeting my iPad as a gaming accessory. I figure on doing Barbarians of Lemuria, diaspora, and Savage Worlds. This is the "Silly project" that I sat on for awhile getting started for real.

When there is something worth looking at, I expect to put it up on Github. Not sure where I'll serve it from, probably Heroku if they're ready for 1.9.2/Rails3/Mongo by the time I'm ready to deploy.