Color schemes for graphs out of excel can be pretty bland, and there are ways to get aesthetically pleasing color sets with predefined palettes like Tango or COLOURlovers which is a huge repository of color schemes.
However these, or just using linear interpolation between two colors or a color and white don’t do your data justice.
The gist is, colorspace doesn’t match your eyeballs, and equidistance colors in HSL don’t have the same lightness intensity. As best explained in this post over at vis4.
You can jump right in to some color palettes (which are also GIS friendly) at Color Brewer
Here are some more graph libraries worth investigating:
And a bunch of random tools here
And this guy does beautiful things in flash
Also. What you really came looking for:
Module has a built in callback for when it is included in a class.
self.included(klass) is called on the module directly after a class declaration which includes it.
ancestors but not a direct way to look at descendant classes. However you can use
ObjectSpace to iterate over classes, and use the
< comparison to see if a class has your module as an ancestor.
You could also use
ancestors.include?(MyModule) to be more concise.
When using mechanical buttons to trigger events on a micro-controller there can be some voltage spikes that can re-trigger whatever logic you have for that button.
The same goes for rotary encoders, which in case of this one at sparkfun is two ‘buttons’ 90’ out of phase from one another, thus allowing you to detect clockwise or counter clockwise movement.
There are a few ways to filter out unwanted mechanical noise. Using capacitors to react to the sudden spikes, or in software. In software you can check the values in your main loop, but that can be troublesome if your loop includes a lot of logic.
The other two approaches involve interrupts. You can use a timer to poll the pins at a regular interval, or you can attach an interrupt to the change of each pin.
Arduino cooking timer has a great example of polling based matching. I really liked his code but wanted to try to code my own since this is a learning experience for me.
By looking at the value of both pins when one of them changes, you can predict the next valid value. By ignoring any other values, you do a good job of filtering out any noisy values that happen during one turn of the knob.
Check out the source over at my git hub
Here’s a video of it in action!
If you find yourself dealing with explicit data from binary files in ruby, you may end up writing something like this.
unpack work great, and have a wealth of ways to get at the data String#unpack rdoc. But after using nice DSLs like ActiveRecord and DataMapper, we can do better!
BinData has patterns for cleanly describing how to access the data structures found in binary files. Data can be nested inside other types, including ones you define yourself.
I’m using it to read a Minecraft map file and manipulate shapes with ruby. Here are some of the highlights of what BinData can do!
Go check it out over at Rubyforge
A lot of times, a little white-space can improve readability of a series of function calls, or a data structure, such as a hash.
If you are vimpire, check out tabular it can do things like:
and for your Cucumber steps you can turn
I won’t reinvent the wheel, so give this vimcasts.org screen cast a watch!