Dr Nic

Give up RJS and go pure

RJS seems like a nice idea. Its Ruby with embedded Javascript.

Now put away the crayons and get back to pure Javascript with embedded Ruby with “MinusR” – RJS minus the R (for Ruby).

This is especially useful if you want a clean way to support non-Prototype/Scriptaculous frameworks, like jQuery. You can call the raw Javascript for these libraries, and embed your Ruby objects using Erb and a handy js helper to convert Ruby to JSON.

Its clean, healthy fun. Like carrots.

Makes me think about jogging, its just that healthy for you.

RadRails Templates on Trac

I have started to cleanup the Ruby and RHTML templates previously released. They are now stored on SVN so you can get latest versions. They now have a ticketing system for improvements. They now have a Wiki for everyone to help everyone.

Summary

RadRails Templates now has a home: http://radrailstemplates.com/

Kyle from the RadRails is busy making improvements to template support for the next release, and has promised that the new and improved templates will also be included in it. Bonza.

Cutting edge releases

You can get the latest edge releases of the templates via Subversion: http://radrailstemplates.com/svn/templates/trunk/

Juicy new improvements

I’ve cleaned up a bunch of the original templates, and started to add new ones that seem generally relevant to everyone: see the CHANGELOG.txt

Extensions and modularisation of templates

Currently the templates come in two big XML files: one for Ruby editor, and one for the RHTML editor. On the plus side, this makes importing new templates easy: you delete all the old templates and them import the new file, and go for a coffee.

On the negative side, this infers all new templates need to go into the same file and thus are imposed upon everyone. Instead there might be templates associated with rails plugins, that aren’t generic.

I don’t have a good plan for what to do about this yet. In the short term, submit any patches or new template files to trac and we’ll figure it all out in due course.

If you want to create patches of your own templates see below.

Similarly, if you add new templates locally and don’t want to share but don’t want to lose them each time you upgrade, my initial suggestion is to do the following:

  1. Checkout the templates from svn: svn co http://radrailstemplates.com/svn/templates/trunk/ radrailstemplates
  2. Do an initial export of your local templates that you want to keep into a separate XML file
  3. Delete all local templates
  4. Import the radrailstemplates/ruby-templates.xml file, if its the Ruby editor, else the rhtml-templates.xml file for the RHTML editor
  5. Import your personal, saved templates on top
  6. Export everything on top of the radrailstemplates/ruby-templates.xml file (if its the Ruby editor, etc). Now you have modified your local copy of the templates.
  7. Now create a patch of the differences using svn.
  8. Attach the patch to a trac ticket. A description of each template added would be very handy as its very difficult reading the xml patch.
  9. Alternately, keep the patch in a safe place for a rainy day. But if you don’t want to share your templates you will hopefully be able to continually do svn update on the template files and your templates should be kept for you (unless you get nasty conflicts)

Port 8669

FIXED You can happily ignore this section, or read Ry’s comment for solution.

My skills with apache are apparently lacking. Why does the raw port number keep appearing in the url?

Its hosted on TextDrive, and the .htaccess file in my /web/public folder is:

RewriteEngine On
RewriteRule ^trac_common/(.*) http://radrailstemplates.com:8669/trac_common/$1 [P]
RewriteRule ^trac/?(.*) http://radrailstemplates.com:8669/$1 [P]
RewriteRule ^radrailstemplates(.*) http://radrailstemplates.com:8669/radrailstemplates$1 [P]

How do I fix this?

What’s a hoe?

The New Gem Generator rocks. Type newgem <gem_name> and you get all standard scaffolding for a gem. They look just like plugins, or vice versa. And the -b option bangs out new command line apps. Sweet.

It also generates a Rakefile for you filled with rakey goodness. You just need to setup a few values – author, description, etc – and then you can repackage your gem, install it, and upload it to Rubyforge as much as you like.

But on the other side of the InterWeb, there is a man intent on gifting your gems with more Rake commands than you could poke a stick at. Or a rake, perhaps. A man so over exposed to raw rakedness that it would be folly for the New Gem Generator to ignore his raked presence.

The man: Ryan Davis. The rakey loveliness: hoe.

So, you might ask: What’s a hoe?

To get the latest newgem and hoe do:

> gem install newgem \-\-include-dependencies

Simply, your new gems are now imbued with more Rake tasks than you could poke a hoe at. As of hoe-1.1.4, you get:

> rake -T
rake announce         # Generate email announcement file and post to rubyforge.
rake audit            # Run ZenTest against the package
rake check_manifest   # Verify the manifest
rake clean            # Remove any temporary products. / Clean up all the extras
rake clobber          # Remove any generated file.
rake clobber_docs     # Remove rdoc products
rake clobber_package  # Remove package products
rake debug_gem        # Show information about the gem.
rake default          # Run the default tasks
rake docs             # Build the docs HTML Files
rake email            # Generate email announcement file.
rake install          # Install the package. Uses PREFIX and RUBYLIB
rake install_gem      # Install the package as a gem
rake multi            # Run the test suite using multiruby
rake package          # Build all the packages
rake post_news        # Post announcement to rubyforge.
rake publish_docs     # Publish RDoc to RubyForge
rake redocs           # Force a rebuild of the RDOC files
rake release          # Package and upload the release to rubyforge.
rake repackage        # Force a rebuild of the package files
rake ridocs           # Generate ri locally for testing
rake test_deps        # Show which test files fail when run alone.
rake test             # Run the test suite. Use FILTER to add to the command line.
rake uninstall        # Uninstall the package.

Have things changed because of Hoe?

Yes, now pay attention.

Note, with support from hoe, when you add additional command line apps to your bin folder, you do not need to update your Rakefile. All files in bin are assumed to be executable apps. [1]

Additionally, the files you want bundled into the gem must now be added into the Manifest.txt file. Your initial Manifest file is generated for you, you need to update it for any additional files.

[1] The railties gem is an anti-example: its bin folder is filled with template executables; only the rails script is actually an executable (this is the script you use to create your initial rails application scaffolding; similar to the newgem executable for gems).

MS Photosynth demo truly awesome

Take 100 photos of an area – some close-ups and some panoramic shots. Then try to figure out how they all fit together. Since digital cameras came out and memory got cheaper and cheaper, taking 100 shots of one location is entirely possible. But why bother? You’ll never want to look at all of them again.

Until you get to dump them into Microsoft’s Photosynth software. It will recreate the whole 3D area and allow you to navigate through your images in 3d space.

Its currently one stage better than vapourware: demoware of someone else’s photos. But its brilliant.

Find a PC. Load up Internet Explorer 6 or 7. Go here: http://labs.live.com/photosynth/default.html

It has all the novelty value of Google Earth when we all first got our hands on it.

Only negative that popped into my mind without prompting was the initial preview of each pane is blurred until the real picture is loaded. I don’t like looking at blurry pictures. My eyes try to focus on them, and then start looking at them cross-eyed as if they were a Magic Eye puzzle and there is an eagle hidden somewhere.

Truly lovely implementation of a wonderful idea.

Update: Nice video introduction