The Artima Developer Community
Sponsored Link

Ruby Buzz Forum
Ruby + Konfabulator

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
James Britt

Posts: 1319
Nickname: jamesbritt
Registered: Apr, 2003

James Britt is a principal in 30 Second Rule, and runs ruby-doc.org and rubyxml.com
Ruby + Konfabulator Posted: Aug 20, 2005 11:02 AM
Reply to this message Reply

This post originated from an RSS feed registered with Ruby Buzz by James Britt.
Original Post: Ruby + Konfabulator
Feed Title: James Britt: Ruby Development
Feed URL: http://feeds.feedburner.com/JamesBritt-Home
Feed Description: James Britt: Playing with better toys
Latest Ruby Buzz Posts
Latest Ruby Buzz Posts by James Britt
Latest Posts From James Britt: Ruby Development

Advertisement

I recently got around to installing Konfabulator and playing round with assorted widgets.

One that caught my eye was the Allgäu Web-cams viewer by Thomas Heinbach. Nice as the assorted images are, though, I was disappointed to find they did not include Kempten, a town dear to my heart and offering a Rathausplatz Web cam.

It didn't take long to dissemble the widget, see how it works, and hack in support for Kempten. It was also interesting to see just how the widget manages to get such images.

When Konfabulator is installed (on Windows, at least), it includes a Unix shell (sh) and and assorted Unix libs and utilities (cat, ln, make). Interesting. This may be to provide some compatibility layer with Unix-based Mac Konfabulator.

Widget behavior is controlled using JavaScript, bundled up in XML files (and, optionally, external .js files which my be loaded from the main widget code).

The Web cam widget fetches images by invoking curl.

As an experiment I swapped out the image fetching line with a command-line call to Ruby (using open-uri). It worked fine.

Much as I like ECMAScript, I wondering how one can write Konfabulator code in Ruby. Certainly one option is to have the widget make XML-RPC (or simply RESTful POX calls) to some Ruby service.

I believe it is possible, on Win32, to invoke ActiveX controls. See this ruby-talk message. So one could call into ActiveRubyScript.

There is also Kapsules, though I've yet to try it. And Ruby-EFL bindings, but I am unaware of how to get this to play well on Win32.

(I wonder if those Unix utils are cygwn-based, or MinGW, and if one could simply compile Ruby as a standalone app and drop it in with the other binaries in Konfabulator\UnixUtils\usr\local\wbin.)

If one wanted to ship a Ruby-based widget, though, to current Konfabulator users, one possibility would be to bundle up all needed Ruby fies with RubyScript2Exe, and launch some WEBrick service via the widget script CLI to handle the core processing and exchange messages with the JavaScript in the widget. If you were clever enough you could probably bundle up the SQLite3 DLL (again, I'm talking Windows; I assume something similar is just as doable on the Mac) and offer your widgets persistent storage.

Perhaps run a Nitro app that speaks XML and leaves the rendering to Konfabulator. Or, even simpler, use Catapult.

Well, except there's a catch: Konfabulator does nor expose an XML parser via JavaScript. Sadness. I went looking trough the code for a "Check for updated widgets" widget, and it uses some gnarly calls to indexof to parse RSS.

But, a quick search revealed the use of eval(). Ah so. It may very well be possible to have Catapult simply return JSON and have the widget just eval the response. No need for XML. (Just to clarify: indeed, Catapult will have no problem emitting JSON or anything else. Just need to see if running eval over the JSON does the Right Thing.)

I may look at hooking Catapult to Orbjson, or run Orbjson with Nitro under WEBrick as a service. Then just leave the GUI logic to Konfabulator

 

Read: Ruby + Konfabulator

Topic: Rails 0.13.1 RDoc as Windows CHM File Previous Topic   Next Topic Topic: More Drawers for Your Docs

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use