2010-11-02

Cylon Jack-O-Lantern

Als kurzfristiges Halloween Projekt haben wir uns ein Cylon Jack-O-Lantern vorgenommen. Die Idee haben wir von hier und hier. Allerdings haben wir eine andere Hardwarebasis gewählt (Microcontroller).

Die Hardware wurde aus 16 LEDs, einem Microcontroller (PIC 16F876A) sowie Widerstände, Quarz, Kondensatoren  am Samstag Nachmittag zusammengelötet. Als "Gehäuse" dient ein Plastikei einer Riesen-Kinderüberraschung (gut das ich sowas als potentielle Gehäuse aufhebe ;-).
Der einstellbare Widerstand sollte dazu dienen die Geschwindigkeit der Animation einzustellen - dieses Feature fiel aber dann der knappen Zeit zum Opfer.

Weiter ging es dann mit dem Schnitzen des Kürbis. Vorlagen oder Muster für einen Cylon-Kürbis finden sich im Netz genug, sodass wir hier nur nachahmen mußten. Wie wir finden ist uns das fürs erste Mal ganz gut gelungen.

Dann blieb nur noch das Programm für die Ansteuerung zu schreiben. Als Betriebsmodi haben wir implementiert: Wake-Up (Leuchtdioden werden von der Mitte aus aktiviert, wenn alle an sind, schalten sie kurz auf volle Helligkeit), Stand-By (Wandernder Leuchtpunkt mit einer LED) und Scan (Wandernder Leuchtpunkt mit 5 LED).


Der Quellcode ist nicht unser Glanzstück, aber es musste halt schnell gehen - und schließlich zählt das Ergebnis: Der Jack-O-Lantern konnte mit beginnender Dunkelheit in Betrieb genommen werden.

Wer das Projekt nachbauen will: Den Quellcode gibt es hier.

Für das nächste Jahr wollen wir das Projekt ausbauen: Bewegungsmelder, Sound, ... mal sehen was uns sonst noch einfällt.

2010-10-02

Single-Hand Watch - Win7 Gadget

On my wishlist is a single hand watch from BOTTA which not only has only one hand but also has a 24h display - see UNO24.

To check if I able to cope with this sort of watch I make a Windows 7 gadget of such a watch. The picture shows the watch at about 11:30 pm.

The gadget can be downloaded here.
In the source code repository also the svg files are contained, if you want to create your own design.

2010-08-12

Define cucumber environment in .couchapprc

When you set-up a .couchapprc file you can define different databases, hosts ... for different environments (see couchapp doc).
To use these set-up when running cucumber I modify the env.rb mentioned here. It use the test environment defined in .couchapprc for cucumber scenarios.


Example .couchapprc file:

2010-08-01

BrainDump: CouchDB link cheatsheet

Note: "File" and "folder" refer to a couchapp directory structure.

{prefix} = /{db}/_design/{application}
{list_function} = name of file in lists folder (without .js)
{show_function} = name of file in shows folder (without .js)
{view_function} = name of subfolder in views folder

functionality link function Read on
list {prefix}/_list/{list_function}/{view_function} function(head, req) CouchDB book
show {prefix}/_show/{show_function}/{doc_id} function(doc, req) CouchDB book
view {prefix}/_view/{view_function} map: function(doc)
reduce: function(keys, values, rereduce)
intro,
view parameter

2010-07-22

BrainDump: irb - require returns LoadError: no such file to load

Situation:
irb(main):011:0> require 'json'
LoadError: no such file to load -- json
 from (irb):11:in `require'
 from (irb):11
 from :0
irb(main):012:0> require 'rubygems'
=> true
irb(main):013:0> require 'json'
=> true
irb(main):014:0>  

Solution:
Do
require 'rubygem' 
before

2010-07-10

Culerity, Cucumber and Couchapp - Part 2

Some further modifications in the files mentioned here were necessary to get the initial setup runable.
(System configuration: WinXP, JRuby 1.5.1, CouchDB 0.11, couchapp 0.6.2)
  1. step_definitions/common_culerity_steps.rb - add this
    1. def couchapp
    2.   'rem' # enter your couchapp name here
    3. end
  2. support/paths.rb - modify

    Before:
    1.     when /start page/                                            
    2.       "/#{database}/_design/#{database}/index.html"
    3.     else                                                        
    4.  
    After:
    1.     when /start page/
    2.       "/#{database}/_design/#{couchapp}/index.html"
    3.     else
  3. step_definitions/common_culerity_steps.rb - remove ":resynchronize => true," from
    1.     $browser = Culerity::RemoteBrowserProxy.new $server, {
    2.       :browser => :firefox,
    3.       :javascript_exceptions => true,
    4.       :resynchronize => true,
    5.       :status_code_exceptions => true}
    6.  
  4. start_page.feature - modify the example scenario to
    1.   Scenario: go to the start page        
    2.     When I go to the start page          
    3.     Then I should see the text "Generated CouchApp"

After this modifications I got:
E:\projects\privat\rem>jruby -S cucumber --no-color
Feature: start page
  In order to feel welcome
  As a user
  I want to be welcomed on the start page

  Scenario: go to the start page                    # features\start_page.feature:7
2010-07-10 17:01:12 [INFO] Visit your CouchApp here:
http://localhost:5984/hejhej/_design/rem/index.html
    When I go to the start page                     # features/step_definitions/common_culerity_steps.rb:90
    Then I should see the text "Generated CouchApp" # features/step_definitions/common_culerity_steps.rb:119

1 scenario (1 passed)
2 steps (2 passed)
0m8.625s

E:\projects\privat\rem>

2010-07-09

Culerity, Cucumber and Couchapp

Starting a new couchapp application I want to try BDD. I found a small tutorial how to testing couchapps with cucumber and culerity. Unfortunatly I have to deal with WinXP, and so I run into some trouble because the culerity server doesn't start. Finally I can solve it by insert "jruby " in culerity-0.2.10/lib/culerity.rb, line 28.

Before:
def self.run_server
   IO.popen(File.dirname(__FILE__) + "/../bin/run_celerity_server.rb", 'r+').extend(ServerCommands)
end
After:
def self.run_server
   IO.popen("jruby " + File.dirname(__FILE__) + "/../bin/run_celerity_server.rb", 'r+').extend(ServerCommands)
end