InquiryLabs

Politics, Programming and Possibilities

Textmate Backtracer 1.0

The backtracer has been around for a while now, and seems to have done its job well enough to deserve a 1.0 mark. This release includes a small improvement from Geoff Grosenbach that limits the loading of this plugin to development mode only. Geoff notes that this “simplifies the backtrace when running tests”. Thanks Geoff.

Download Version 1.0

Enjoy!

Ralph Douglass has made some nice improvements to my earlier instructions for installing Ruby SDL on Mac OS X. In fact, his instructions are a mere 25 lines compared to my 90!

Now if only someone more knowledgable than myself would wrap this all up in to a Port file… :)

[tags]ruby, simple directmedia library, sdl[/tags]

Setting up OpenCV on Ubuntu

OpenCV is a fast and well-designed C library for computer vision research and development. Since I’m not aware of an OpenCV library for Mac OS X, I’m using my old Ubuntu box to get things up and running.

So I don’t forget what I did, here’s some of the configuration I had to do:

  • Install libraw1394-dev Ubuntu package
  • Using ‘testlibraw’, check permissions
  • # sudo chgrp video /dev/raw1394
  • # sudo chmod g rw /dev/raw1394
  • Download OpenCV 0.9.7
  • # ./configure –with-apps; make; make install
  • # export LD_LIBRARY_PATH=/usr/local/lib
  • Compile and run my app with the following script

#!/bin/sh
export LD_LIBRARY_PATH=/usr/local/lib
echo `pkg-config --cflags opencv`
echo `pkg-config --libs opencv`
g `pkg-config --cflags opencv` -g -o igaze igaze.c `pkg-config --libs opencv`
./igaze

qforms á=á=á=á=á= dynarch_calendar á=á=á=jstree

á= á=á=lightbox jsá=á=á= stateful_formá=á=á= á=textarea tools

Bundles that include javascripts, stylesheets and images are getting easier and easier. It’s a wonderful time to be a Rails developer :)

For those who would like to know what bundled_resource is, check out my earlier post that introduces the problem and solution offered by this package.

This release marks a much improved and nearly completely rewritten dynarch calendar bundle. Here’s what’s new:

  • It is no longer necessary to call convert_date_to_multi_params! in your controller
  • Backwards compatibility for non-javascript browsers. Calling dynarch_date_select now calls the built-in rails date_select method so that users who have browsers without javascript can still select a date in a reasonable way.
  • There is no longer an obnoxious “:date” field in the returned multiparameter values.
  • Bundles now accept optional parameters. For the dynarch_calendar bundle, you can specify the color, language and icon for your dynarch calendar.
  • 12-hour time is handled in a novel way, so that the user enters a 12-hour time (e.g. 3 PM) and Rails can read it as if it’s a 24-hour time
  • Better documentation.

Version 0.9 of bundled_resource now also includes a “stateful_form” bundle that makes it easier to store the open/closed states of form sections. This is particularly useful for AJAX forms that have hidden sections that the user can open up. When the form is submitted to the server and returned with an error, the form will retain its open/closed states so that it’s just as the user expects it.

You can download bundled_resource 0.9 here (345 KB) or use the subversion repository directly:

svn://syncid.textdriven.com/svn/opensource/bundled_resource/trunk

Compliments of syncPEOPLE social conference software development

Mindshare moving from PHP to Rails

Jamis Buck just pointed me to these two links, and I wanted to share the side-by-side snapshot. Not that this is new news:


Rails and PHP mailing lists.png

I’m thinking of moving back to PHP, just so I can keep up with all of the mail each day. (just kidding).

Virtue for Tiger

Seems like I’m way behind the times, but I discovered today that the Virtue desktop manager is available for Mac OS X Tiger!

Just wanted to share, in case you haven’t found out about it yet :)

Are You Sure You Want that Electrical Cord?

So my wife (Kelty) bought a 6 foot long extension cord a couple of days ago. It looks plain enough. But the label on this thing is hilarious. I can’t believe someone actually wrote this with the intent to educate another human being:

DANGER! ELECTRICAL CORDS CAN BE HAZARDOUS. Misuse Can Result in FIRE or DEATH by ELECTRICAL SHOCK. Please Read BOTH SIDES Carefully and Follow All Directions.

  • A Cord Not Marked For Outdoor Use Is To Be Used Indoors Only
  • Inspect Thoroughly Before Each Use
  • Make Sure Appliance is OFF Before Connecting Cord to Outlet
  • Do Not Use Excessive Force to Make Connections
  • Do Not Remove, Bend or Modify Any Metal Prongs or Pins of Cord
  • Keep Away From Water
  • DO NOT USE WHEN WET
  • FULLY INSERT Plug Into Outlet
  • Do Not Drive, Drag or Place Objects Over Cord
  • Do Not Walk on Cord
  • AFTER USE, GRASP PLUG to Remove From Outlet
  • Always Unplug When Not in Use
  • Warning: This product contains chemicals, including lead, known to the State of California to cause cancer, and birth defects or other reproductive harm.
  • Wash hands after handling.
  • DO NOT REMOVE THIS TAG.

And that’s not even all of them.

But putting the long-windedness of this thing aside, the initial warning seems fair enough: electricity can be dangerous. Sure, that’s fine. I’ll be careful.

Of course, most people at this point are thinking, “Well, I don’t think I need to follow the rest of the directions for this so…” and then you can just hear the writer hoping that their uneducated audience will realize, “Oh, wait! The directions say to follow the directions. It’s a good thing I read the first sentence.”

So, being one of the ‘uneducated end-users’, I learn next that if it’s not for outdoor use, then it should only be used indoors. Brilliant.

I love the next one: Inspect Thoroughly Before Each Use. Who actually inspects an extension cord thoroughly before each use? Sure, if I ran it over with a lawnmower I’d probably check to make sure it’s still usable. But do I really need to check it thoroughly before each use?

And we’re supposed to unplug it after each use?? An extension cord exists to make my life easier, doesn’t it?

So, after I’ve read these instructions, thoroughly inspected it, grasped the plug carefully, assured myself that there is no water nearby, considered soberly whether or not I am indoors, checked the appliance for wattage equal to or less than the cord’s capacity, turned the appliance in to the OFF position, gently yet fully inserted the plug in to the outlet, and after I’ve wisely protected myself with a chemical suit against the imminent threat of cancer due to lead poisoning, then I can enjoy the comfort of my nice, warm space heater. I’m so glad these directions were here to guide me along such a rugged path.

Aahhhhhh. Peace at last.

Wait… it looks like there are some warnings on this space heater…

Updated pre-dispatcher

For those who expressed interest in the pre-dispatcher code I’ve been experimenting with, there is now an updated dispatcher.rb available for download.
This one appears to be much more robust in the method used to track down the “built-in dispatcher” and load that code first. If it can’t find the built-in one, it’ll fail silently so that your Rails application can work even if the pre-dispatcher doesn’t.

Thanks to Hans Fugal for testing the original dispatcher.rb code.

Easy Resource Management (Re-post)

UPDATE:
There is now a version 0.9 available (download).

The bundled_resource Plugin

Hot on the heels of my previous announcement, there is now a bundled_resource plugin that takes advantage of all of my previous work in this area at syncPEOPLE, plus some (download).

What’s it for?

If your development is in any way similar to mine, there are a number of useful resources out there that make web applications shine beautifully. For example, there’s the Dynarch calendar and the textarea tools. There are a number of others—too many, in fact. The problem is that as a web developer, it sometimes takes some real surgery to put each one of these in to an application. And then when you create a new page that uses these resources (even within the same app), you have to figure out which pieces to cut and paste to get it functional. Take the Dynarch calendar, for instance. There are 4 javascript files, 1 CSS file (among several to choose from), 2 images, several helper methods, and a controller method that you’ll need in order to get it to work with Rails. Sometimes it’s easier just to ignore the calendar bit because it’s such a pain to set up.

How does BundledResource help?

But what if it weren’t a pain? What if you could write this at the top of your page:

<% require_bundle :dynarch_calendar %>

And your dynarch calendar would just work? That’s what bundled_resource does. Now you can use this method:

dynarch_date_select 'post', 'publish_date'

anywhere on the page, and it’ll work. Easy :)

So it looks easy… what’s going on?

What the bundled_resource plugin does is it keeps all of your resources (javascripts, stylesheets, images) within the plugin’s directory structure and copies them in to the public folder whenever your app starts. This is very similar to James Adam’s technique that he uses with Rails Engines. The advantage, of course, is that you don’t have to worry about copying and pasting files all over the place whenever you want a new bundled_resource. They all belong together in one little folder inside the plugin.

Pre-packaged Bundles

Included with this release (0.7) are three bundles: the Dynarch Calendar, Textarea Tools and qForms. Setting up an app to use them is simple:

  1. Install bundled_resource
  2. Add the following two lines to your layout (just like the RequireResourceHelper):
    <%= stylesheet_auto_link_tags %>
    <%= javascript_auto_include_tags %>
  3. Add a require_bundle :[bundle name] at the top of your view file.
  4. For example:

    require_bundle :qforms

And that’s it! Welcome to Easier Resource Management for Rails.

Upgraded to WordPress 2.0

It’s a new year, and I’ve decided to upgrade to the latest and greatest WordPress. Unfortunately, bringing my data over from the previous version to this blog was not possible.

Instead, if you’d like to visit the archived (older) material, visit this area instead.

  • 0 Comments
  • Filed under: Uncategorized