sdef - scripting definition files

August 24th, 2009

Scripting definition files (sdefs) are XML files that describe everything
about an application scripting interface: terminology, implementation
information, and complete documentation. Applications may incorporate
them to define their own scriptability, and scripting clients such as
AppleScript and Scripting Bridge read them to determine what operations
an application supports.

man sdef

Graph Database Neo4j

August 21st, 2009

Neo4j is a graph database. It is an embedded, disk-based, fully transactional Java persistence engine that stores data structured in graphs rather than in tables. A graph (mathematical lingo for a network) is a flexible data structure that allows a more agile and rapid style of development.”

From the site:

  • graph-oriented model for flexible data representation;
  • graph network consisting of nodes, relationships and properties;
  • highly scalable to bilions of nodes/rels/props;
  • can be sharded to scale out across multiple machines;
  • hi-speed traversals in the node space;
  • small footprint (500k jar)
  • ACID transactions;
  • robust persistence;
  • concurrency control;
  • API;
  • Neo4j.rb, JRuby API;
  • Lucene for quering and indexing.

Neo4j is released under a GNU Affero General Public License, so read carefully. There’s a price table for commercial products that includes severall support levels.

tokyo cabinet

July 23rd, 2009

Interesting article with links from Ilya Grigorik about Tokyo Cabinet, Tokyo Tyrant (remote network access to the DB, via a rest_client p.ex.) and the “magnifique” Lua programming language, integrated for the ease of creation of user _designed functions into the server. A question I asked is the ability, or lack, of dinamically feed the server with extensions, without the need for restarts (updates, etc).

Not to miss this article too: Tokyo Cabinet: Beyond Key-Value Store

Tokyo Cabinet starts here with a nice presentation from its creator, another Japanese developer Mikio Hirabayashi.

Ruby, Perl, Python et_al bindings available.

I tell you, “it’s Big in Japan

vimblog.vim on MacVim

June 6th, 2009

I was contacted via Twitter for some support on getting vimblog.vim to work on MacVim, on Mac OSX Leopard. The unique problem is that it must be compiled with Ruby interpreter support. So here is a quick guide to do it, building from Macvim git repository:

# select a folder where to build the aplication on your area:
cd to_your_workingspace_apps_folder
# get (clone) MacVim from its MacVim.git repository:
$ git clone git://
$ cd MacVim
$ cd src
# now let us configure it for macvim gui and for +Ruby (I’ll add +Python and +Perl) support:
$./configure --enable-gui=macvim --enable-rubyinterp --enable-perlinterp --enable-pythoninterp --with-ruby-command=/Users/pedro/.rvm/rubies/ruby-1.8.7-p357/
$ make
# Success ? Let’s build the
$ cd MacVim
$ xcodebuild
# Sucess ? Let’s try it…
$ open build/Release/
# now lets copy vimblog to $HOME
$ cp $HOME/Downloads/vimblog.vim $HOME/.vim/plugin
# insert your credentials
# now test the existence of the script. Run MacVim and execute
:B + TAB
# you shoud get code completion for the Blog command.
# get the 10 most recent articles
:Blog rp

if you get problems, before another build, do a:
$ make distclean

Screenshots: jump to flickr macvim window jump to flickr building space

I wiped out the default OSX Ruby and use only RVM Rubies. So now to compile, one needs to specify the exact ruby interpreter. It’s updated on the ./configure statement above.
One can use the default Ruby used by RVM, using the default rubies path like below:
$./configure --enable-gui=macvim --enable-rubyinterp --enable-perlinterp --enable-pythoninterp --with-ruby-command=/Users/pedro/.rvm/rubies/default/
removed the old download place, and updated to the new one (above)

class Monstar

June 5th, 2009

I recently had to move from using FastCGI on Camping Ruby framework, to sweet Mongrel because of getting too much 500 HTTP errors under some load tests. Yes irc::zimbatm, me too.
When on FastCGI behing Lighttpd, upon each request, the code is loaded so after changing its source, it gets updated.

Now, under development, Mongrel(s), behind the same Lighttpd frontend, need to be restarted upon source code changes in the models, views, controllers or helpers (yet not CSS files, since they are taken care by lighty). Instead of moving to the xterm, kill the process and restart it i decided to automate it.
Since i was disconnected from the webz, I’ve done this script to detect file changes from a pre-specified array of files, monitored under a certain interval in seconds, with an action to start, kill, and restart an app (in my case, a Mongreled Camping web app).

Problem: Threads
Solution: Process::fork

The app load (in this case I load/execute ruby scripts) is done via Process::fork. A new process starts up each time this method is fired up upon a, 'r').ctime change:

def load_app
 @pid = Process.fork { load(@app) }

Before loading up a new updated instance of the app, the previous one must be terminated. Threads behaviour was problematic because of the thread tree termination in time. This is well done, in a safe mode, with Process::kill(signal, pid) and Process::wait(pid) that waits the pid process termination, essential in the case of Mongrel server.

def kill_app
  Process.kill("KILL", @pid)

As one can see jump to flickr in this screenshot the main app process holds on while the child, in this case our Mongrel’ed Camping web app, is terminated and created a new one. jump to flickr Verbose mode to assert its behaviour. Suits this specific need.

This is very usefull to make tests (Test::Unit:TestCase) run automatically upon source changes (will get to an Autotest clone).

Changing from load(@app) to system(@app), one can get any command be executed. ftp, cp, etc…

The script is here do download under a Ruby License.

Usage: monstar [options]
-a, --app SCRIPT.RB,PARAMS,...
-i, --interval VAL
-f, --files FILE,FILE1,...
-h, --help

mac mini 09

May 12th, 2009

The new Mac Mini arrived today.
Still in the box:
Some pics  jump to flickr here, jump to flickr here and jump to flickr here privacy…

April 9th, 2009

I subscrived to some mail publications from Sun Microsystems. After that, one gets the usual validation e-mail.
This one states:

“Dear Sun Community Member,

Thank you for subscribing to the following Sun Microsystems eNewsletter(s)/notifications:
Sun respects your email privacy and security. In order to start receiving these publications, you must first confirm your subscriptions. Please click on the url below to activate your subscription(s):
Thank you for subscribing. We hope you find the information to be valuable.”

The problem here is that the confirmation URL query is nothing but a (*not* garbled) sequential ID. Altering the ID from the link, all the other subscrivers e-mail starts poping-up, and more, they get activated if not done yet.
So, the above “Sun respects your email privacy and security” isn’t quite as should be.

With a simple script, one can get all the subscrivers. I can see a spammer doing a:
“Dear subscriver, we are partnering with to sell you this lovely vacuum cleaner.”

Dear Sun, prevent us from buying lovely vacuum cleaners, fixing these vulnerabilities.

Update: Less than 24h later, Sun contacted me and fixed (the e-mail adress obfuscation, yet one can still approve other confirmations randomly) it. Well done.

Mozilla Bespin

February 19th, 2009

“Bespin proposes an open extensible web-based framework for code editing that aims to increase developer productivity, enable compelling user experiences, and promote the use of open standards.”

one can read this here.
Bespin’s initial prototype includes support for very basic features, but one can easily notice its power. Its all drawn in the canvas, every character, cursor blinks, scroll bars, text selection, etc. As a Vim user, I immediatly thought of Vim commands/keybindings in Bespin. Even the simpler and most generally used ones. Not even asking for .vim power scripting ability. And that is a feature any one of us* can write as soon as Bespin coders release a good API. And it is already in the air. Neat.

By the way,

The collaborative coding feature isn’t active yet, but if one can give instant editing access to a file for a “check this class”, that’s going to probably replace lots of gists, pasties, etc, on a coder2coder basis.
Code repository access via Dashboard ? Yes please.

I have no doubts, this is going to be a very usable product, for this little I’ve seen. The look’n'feel seems great (even if I had no repeat-key :) )

* floss

on work…

January 15th, 2009

3 or 4 new projects ahead.

One of them will be  CouchDB and Merb (no DataMapper, no ActiveRecord). The db schema is modeled by each user and upon criteria decisions.
All of them Git managed, as been doing for the last year.
Served by a Debian based Linux distro, coded under Debian, UNR (my lovely little netbook), and OSX,  mainly in Ruby 1.8.7. Production server structure not defined yet but development phase will be Mongrel. May implement a very simple queuing system for a specific need.
Very likely use of AWS (not SimpleDB) for the sake of _simplicity_ .
Editor ? Vim.

None of this is of great interest for the project itself of course. I’ll be queuing 2 or 3 of them, in paralel with the main one. As in everything, time management is almost everything to GTD. Must. repeat. this. always.

CouchDB Implementation

November 21st, 2008

… just marking this CouchDB Implementation technical post from Ricky Ho here to read tomorrow while hacking on my new Aspire One. Basically, Ricky’s posts are almost all a must_read.

Gist from Vim

November 20th, 2008

Some things are pure smartness: Gist integrated with Vim by the use of vimscript for gist by Yasuhiro Matsumoto.

For reference:
:[from],[to] Gist -p # post lines (from, to) to gist privatelly
:[from],[to] Gist # post lines (from, to) to public gist
:Gist [xxxxx] # edit gist xxxxx
:Gist -l # lists my gists
:Gist -k # lits gists from all

I used Paul Dixon’s Paste bin when needed, specially by its simple interface and good highlighting features. Very good. But Gist makes me able to store my gists on my own account. jump to flickr Quite nice.

Mitch Altmann at Codebits

November 17th, 2008

During the three days of Codebits where our minds are focused on hacking code, learning, networking, coding, eating pizza, creating ideas and implementing them, I had the pleasure to meet and talk to Mitch Altman.

Mitch invents and hacks the coolest things.
Here at Make Magazine, you can see how his BrainMachine is built, and using it is quite an experience…

Yet, my favourite one is the Trippy RGB Waves (schematic, video, photos).

Like Mitch said, imagine a Trippy RGB full wall, how cool would it be walking by!

on Paul Graham’s Bad Economy post

October 17th, 2008

Paul Graham’s gluing the recession factor with lack of competition, investor semi-blindness, operating cheaply and time is [always] now. While evidence is a virtue, this is !new.

:note for non-programmers: ‘!’ as an alias for ‘not’

This slideshare leaked from, as stated, a Sequoia Capital presentation is worth to look at.

github repo’s update

October 2nd, 2008

Updated my source code repo account.

Disparition de Guy Decoux

September 25th, 2008

This is a small post to remember a great ruby programmer.
Ruby France announced Guy Decoux “disparition”:

“He was part of the generation of developers who switched from Perl to Ruby in the 90s. While his mastering of Perl was already great, his knowledge about Ruby was so deep and impressive that a lot of Rubyists would have been very happy to have the same one.”

Announcement at ruby-talk where we can see lots of appreciation and recognition for Guy’s work.

_why has a wonderfull post and drawing at
The following paragraph from _why’s post:
“You’ll hear a lot of people say that we didn’t know who he was. That no one met him. But we all read alot of his code. And clearly that was how he wanted us to know him. Think of how that stands in such sharp contrast to the self-advertisement and vanity journalism of the Web today. We knew him, just not in the way we’re used to.”

Guy’s work in ruby-core libs lives inside the machines we daily operate.
Goodbye Guy Decoux.

fragment identifiers

June 12th, 2008

Q: how in Routes/Markaby do we implement fragment identifiers # as in, for named anchor jumps ?
H(int): is it necessary to parse the controller ?
H(int): can a regexp solve it ? ‘/foo/(\w+)#(\w+)’ doesn’t…
A: …


June 9th, 2008

ActiveRecord database schema migration info is stored in the main database, so that if one needs to manually hack a migration (fastforward/rewind), just update TABLENAME_schema_infos column ‘version’ to a new value and manually change your schema. Next ‘boot’ may generate (or not) new migrations.

riverside=# select * from foobar_schema_infos;
id | version
1 | 1.4
(1 row)

In a self note, forget not to set option :id => false on join tables for has_and_belongs_to_many relations.

June 6th, 2008 is well described here, @ karlus. We and some more fine guys will be focusing on Gathering of Developers in our city, Porto::Portugal::Europe. We’ll be doing presentations (mostly but not only technical ones), debating ideas, working together hopefully on projects, networking and building business (well, one of the first meetings was partially dedicated to push Nuno sysadminin’ skills to start a “pro” hosting company). Barcamp, First Tuesday, TechMeet, we’ll be having a bit of ‘em all.

The starting group talks Python (Nuno), Ruby (me and Mario), media and communication (Carlos), Php (and domain registering savoir-faire ;) Karlus), and guess what: we’re all on Twitter, like godevel is.

The developers part of GOD isn’t restricted to code_monkeys. We speak business, startup’ing, venture capital, economy, talks (long or lightning), beer, unix, languages, hw, sw, media, web, web, web, servers, life, laptops, frameworks, gossip, gadgets, working environments, projects, code, code, scripts, threads, scaling, architectures. We’ll be focusing less on ideas, more on work. Implementations. On doing it.

I look forward a code_day in wich we’ll be coding for ourselves/others under a strong networking environment, during wich lightning-talks will hopefully rise.

More to come soon…
As for now, I’m fighting threads and forks in Ruby…

2008 ACM-ICPC Programming Results

April 13th, 2008

Draft configuration for the programming environment at 2008 ACM-ICPC World Finals.
“Pascal has been dropped as a World Finals Language”… I miss Delphi (Object Pascal)

Look at the final results.
Now lets see 2007 standings.

Geo pattern ?

blog with Vim script

April 10th, 2008

… after severall exchanged emails between me and Andrei Thorp about the Vim blogging ruby script, we made some changes. So instead of the initial test for Vim compiled with +ruby message s:ErrMsg, we now have an echo.

Andrei’s git (yep, they are git fans too, git rocks!) commit was calling another Vim from his machine. That was not a +ruby vim. So an error was fired upon git commits. Now we fixed it. This is now, vimblog 1.1. Thanks Andrei.

Open Source++

Rubinius documentation

April 7th, 2008

self note for a nice read: Introduction to the Rubinius compiler

Shoes.rb on Github

April 4th, 2008

_why posted in Shoes mailinglist that he will be moving source code to Since I am using Git for some months, this is good news.

In short, Shoes.rb repository:
You can clone the repository with:
git clone git://

Ditz, (“a simple, light-weight distributed issue tracker designed to work with distributed version control systems like darcs and git”) will be used as an issue tracker. The YAML database file is included in the commits, since it becomes a project source file. Its Ruby coded and produces quite nice HTML pages.

…nice move _why

the spirit that lives in the computer

April 2nd, 2008

“We are about to study the idea of a computational process. Computational processes are abstract beings that inhabit computers. As they evolve, processes manipulate other abstract things called data. The evolution of a process is directed by a pattern of rules called a program. People create programs to direct processes. In effect, we conjure the spirits of the computer with our spells.”

“Structure and Interpretation of Computer Programs”