Atom & RSD together again for the first time...

Posted by Daniel Tue, 16 Oct 2007 14:47:00 GMT

It Pays To Advertise: Joe Cheng: Configuring an AtomPub blog needs to be equally easy. For some reason, people in the AtomPub community don’t seem to like RSD (only Six Apart puts Atom endpoints in RSD). We need another autodiscovery mechanism.

Hmmm.  When I looked at RSD nearly five years ago, it didn’t seem so bad.  In any case, here’s a ticket and a patch to get WordPress to support autodiscovery of AtomPub endpoints.

[Here, here! And the peasants rejoiced! And the reason one (influential) person in the Atom community didn't like RSD wasn't for technical reasons, but because Dave Winer is an acquaintance, and an early supporter of RSD... and he was reviled by some members of that community. Anyway, all these years later, RSD is quietly doing its job, and should be employed for this purpose. That was kinda the point, with no preference for one API over another. Thanks Sam!]
Source: Sam Ruby

Posted in , , , , , , ,  | no comments | no trackbacks

Agile “cheat” Sheet

Posted by Daniel Mon, 24 Sep 2007 00:37:00 GMT

Agile “cheat” Sheet: I checked to see if there was a version of this already for "cheat", the command line ruby wiki cheat sheet thing. There wasn't.

Now, there is!

Happy software crafting...

[Indeed. I'm so ripping this off to work locally... thanks Luke!]
Source: Luke Melia

Posted in , ,  | no comments | no trackbacks

Of smart folders, Automator and Ruby

Posted by Daniel Fri, 10 Aug 2007 00:15:00 GMT

&tI was working on organizing my computer because I'll be switching machines soon, and it was clearly time for some automation. I built a few smart folders, a couple of burn folders, and some Automator scripts. I was disappointed to see that Automator's shell scripts don't include Ruby out of the box. Easily enough fixed though. Here's what you do: Open /System/Library/Automator/, find the Run Shell Script.action file (it's really a package) control click and select "Show Package Contents" then make your way to /Contents/Resources/Shells.plist and open it with your favorite text editor. Then add
	<key>/usr/bin/ruby</key>
	<dict>
		<key>args</key>
		<array>
			<string>-e</string>
			<string>%</string>
			<string>--</string>
		</array>
		<key>script</key>
		<array>
			<string>$STDIN.each { |arg| puts arg }</string>
			<string>ARGV.each { |arg| puts arg }</string>
		</array>
	</dict>
You can of course create these entries by using the plist editor. When you restart Automator you should be able to choose /usr/bin/ruby from the run shell action. The blocks are just a starting point... then it's up to you...

Posted in  | 2 comments | no trackbacks

Moving to Edge Rails

Posted by Daniel Thu, 09 Aug 2007 01:49:00 GMT

Some of this might be out of date, but the simplest critical path seems to be as follows:
  1. Create a throw away Rails project
  2. Freeze to Edge
  3. Create a new project using Edge to ensure you have the latest environment files etc.
  4. Add the missing ActiveResource gem
  5. Live on the Edge

Command line stuff looked a bit like this.

For the search engines... the error I was getting (under Mongrel) was
Exiting
/Users/daniel/temp/aumeatur/vendor/rails/railties/lib/commands/servers/mongrel.rb:16: warning: already initialized constant OPTIONS
/Users/daniel/temp/aumeatur/vendor/rails/railties/lib/commands/servers/mongrel.rb:19: undefined method `options' for []:Array (NoMethodError)
        from /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:32:in `gem_original_require'
        from /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:32:in `require'
        from /Users/daniel/temp/aumeatur/vendor/rails/activesupport/lib/active_support/dependencies.rb:495:in `require'
        from /Users/daniel/temp/aumeatur/vendor/rails/activesupport/lib/active_support/dependencies.rb:342:in `new_constants_in'
        from /Users/daniel/temp/aumeatur/vendor/rails/activesupport/lib/active_support/dependencies.rb:495:in `require'
        from /Users/daniel/temp/aumeatur/vendor/rails/railties/lib/commands/server.rb:39
        from /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `gem_original_require'
        from /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `require'
        from script/server:3

Posted in , ,  | no comments | no trackbacks

IRB history and completion

Posted by Daniel Wed, 08 Aug 2007 14:19:00 GMT

Who knew? Why & Others did apparently.
require 'irb/completion'
require 'irb/ext/save-history'
ARGV.concat [ "--readline", "--prompt-mode", "simple" ]
IRB.conf[:SAVE_HISTORY] = 200
IRB.conf[:HISTORY_FILE] = "#{ENV['HOME']}/.irb-save-history"
Give it a shot by adding those lines to your .irbrc file (home directory). Try typing Date:: and hitting tab twice... Note that this will break the existing filesystem completion, so e.g. File.open('..tab..> will no longer work.

Posted in  | no comments | no trackbacks

3 Script/Console scraps (YAML, Rails, app.class, reload)

Posted by Daniel Tue, 07 Aug 2007 01:41:00 GMT

I was playing around with script/console for a few minutes at the end of the day at work… and I wanted to check a couple of assumptions… one is that YAML is available! So hard to read ActiveRecord objects like this:

=> #"", "updated_at"=>"2007-06-05 21:11:37", "route"=>"", "title"=>"test",
 "ride_type"=>"road", "id"=>"1", "elapsed_time"=>"21:11:00",
 "created_at"=>"2006-06-05 16:55:00", "mileage"=>nil}>

can be displayed like this

--- !ruby/object:Ride 
attributes: 
  partners: ""
  updated_at: 2007-06-05 21:11:37
  route: ""
  title: test
  ride_type: road
  id: "1"
  elapsed_time: "21:11:00"
  created_at: 2006-06-05 16:55:00
  mileage: 

simply by typing this: y Ride.find(1)

Naturally it works with any object…

Second cool thing I looked up was Mike Clark’s post about the app.class for experiencing your app and exercising controllers…

And the last thing is is that if you need to change your code, instead of killing and restarting the console you can type “reload!” and it will do just that.

Posted in , , ,  | no comments | no trackbacks

Connector and Slingshot Open-sourced and Free

Posted by Daniel Mon, 16 Jul 2007 16:53:00 GMT

Connector and Slingshot Open-sourced and Free: Today Joyent is releasing the source code for our Connector and Slingshot products under the GPL v2. You can get immediate access to the code through our developer portal here. SVN is here. [Cool.]
Source: Joyeur

Posted in , , ,  | no comments | no trackbacks

Apple, On Custom JavaScript Events

Posted by Daniel Thu, 05 Jul 2007 11:06:00 GMT

Apple, On Custom JavaScript Events: This morning when I checked my Gmail account, I read a message (from someone named “Filippelli Christophe”) that said Apple seemed to be using my Custom JavaScript Events code on the iPhone page. (In case anyone misunderstands: this is a very good thing in my opinion.)[It’s a good thing I used this first… or folks would just think I’ve jumped on the iPhone bandwagon. Cool stuff Seth!]
Source: Truer Words - A Journal

Posted in , , ,  | no comments | no trackbacks

JRuby 1.0 Released

Posted by Daniel Tue, 12 Jun 2007 14:17:00 GMT

JRuby 1.0 Released: JRuby, a Java implementation of the Ruby interpreter, has reached version 1.0. A massive congratulations are due to the team. At the time of writing, the release has not been announced on the official site, but you can download the final build.[Hmmm…]
Source: Ruby Inside

Posted in ,  | no comments | no trackbacks

image_science version 1.1.3 has been released!

Posted by Daniel Wed, 30 May 2007 20:59:13 GMT

image_science version 1.1.3 has been released!: ImageScience is a clean and happy Ruby library that generates thumbnails – and kicks the living crap out of RMagick. Oh, and it doesn’t leak memory like a sieve. :) For more information including build steps, see http://seattlerb.rubyforge.org/ [No attitude required, but if true, nice.]
Source: Polishing Ruby

Posted in  | no comments | no trackbacks

RubyMicrosoft

Posted by Daniel Wed, 30 May 2007 20:08:00 GMT

RubyMicrosoft: My colleague John Kordyback pointed out that at the heart of all this is realizing that Ruby is not Yet Another .NET Language but a whole community and attitude to software development. Ruby is a community where open source, agile thinking, and lightweight solutions are deeply ingrained values. He says a common problem in Redmond is that “They ask me ‘Why is this language important’ rather than ‘Why is this thinking important?’” [Unsurprisingly lucid]
Source: Martin Fowler

Posted in , , ,  | no comments | no trackbacks

RSpec goes 1.0

Posted by Daniel Tue, 22 May 2007 21:34:08 GMT

RSpec: Spec provides a Domain Specific Language with which you can express executable examples of the expected behaviour of a system. [I haven’t had a chance to try this, but I’ve been following along for a little while. I’m looking forward to feeling what this is like.]

Posted in , ,  | no comments | no trackbacks

Joyent Connector to be Open Sourced

Posted by Daniel Thu, 17 May 2007 16:30:00 GMT

Joyent Connector to be Open Sourced: Joyent will continue to invest heavily in further development of Connector. We have a full product roadmap for our developers. Today we will be shipping “Lists” a web-based outliner that supports OPML. (More later.) That’s significant investment. [More cool stuff from the folks at Joyent. I’m so glad I have an account with them.]
Source: Joyeur

Posted in , , ,  | no comments | no trackbacks

Rails scraps

Posted by Daniel Wed, 16 May 2007 22:14:00 GMT

There’s some Rails things that I can’t seem to remember… because I often don’t think about them until first deployment. Here’s a few.

rake rails:freeze:gems (moves and unpacks Rails and it's gems into vendor)
rake rails:unfreeze (reverses the above)
rake rails:freeze:edge TAG=rel_1-0-0 (freezes to a specific version, modify the tag to suit)
rake rails:freeze:edge(freezes you to the latest version in the repository (usually unreleased))

Next we have the same routine for any other Gems you might need:

'gem unpack ???????' while in your vendor folder.

Replace the ? with the name of the gem you wish to unpack.

Having done that… you’ll need to add something like this to your environment file:

[There’s some notes about this in the comments, which brings about a way of DRYing some of the requires… and seems to change the number of times something is loaded. There’s also more information here.]
 config.load_paths += %W( #{RAILS_ROOT}/vendor/???????/lib )

Then you can ‘require’ your gem in your controllers or libs etc.

All the “freezing” is about ensuring that the version that you’ve tested is the version your application uses in production. Much deployment peace is found here. I tell you three times.

Posted in , ,  | 2 comments | no trackbacks

On minimalism in software

Posted by Daniel Wed, 16 May 2007 20:34:43 GMT

A long time ago I started writing code because I needed solutions for *my* problems. Not thirty other problems which made it difficult for me to get stuff done. I like getting stuff done.

Ruby continues to attract me after nearly 4 years. I’m amused at how little Ruby I’ve actually written. It’s the nature of the problems I solve with it, in combination with the incredible power of it’s terseness and well written libraries.

For example, a client has data in a MySQL database. The app that put it there seems to have gone missing in a move, and until recently the data was not required. As these things go, it went from “huh?” to “sound the alarms” in short order. My solution to their emergency? Roughly equivelant to:

require 'rubygems'
require 'active_record'


ActiveRecord::Base.establish_connection(
        :adapter => 'mysql',
            :host => '127.0.0.1',
            :database => 'something')

class User <ActiveRecord::Base; end

User.find(:all).each do |f|
  puts "#{f.name}'s email address is #{f.email}"
end

Sure, someone wrote a lot of smart stuff that I relied on… but isn’t that always the case? Well, it is for me. But that’s very little code to set up an ORM and return a useful object.

I recently worked with a C# implementation of the Active Record pattern and was amazed at how much more code (and config) there was involved in getting the same result. That’s not a knock on C# or even the implementation, but it seems that it is in the nature of Rubyists (and Ruby) to produce such minimalist design. I enjoy that.

Posted in , , ,  | no comments | no trackbacks

Older posts: 1 2 3 ... 8