Ruby

Here’s where my Safari Bookshelf sits at the moment:

Cross-Platform GUI Programming with wxWidgets
By Julian Smart; Kevin Hock; Stefan Csomor

Design Patterns in Ruby
By Russ Olsen

Ruby on Rails: Up and Running
By Bruce A. Tate; Curt Hibbs

The Rails Way
By Obie Fernandez

The Ruby Way: Solutions and Techniques in Ruby Programming, Second Edition
By Hal Fulton

I’m actually pretty much done with the wxWidgets and Rails: Up and Running books, but I generally don’t delete books until I need the shelf slots. I retrieved The Rails Way because I’m not too pleased with the organization of the Rails: Up and Running book, and besides, I need a reference more than a tutorial now.

Gonna play with my new “purchases” starting tonight, so look for impressions in the coming weeks.

Ruby
development

Comments (0)

Permalink

Zyps presentation…

Here’s the presentation I gave at Code Camp, uploaded to Google Docs…

Ruby
Zyps
development

Comments (0)

Permalink

Ruby/SDL

Goddamn, you mean to tell me the difference between full-screen and windowed in (Ruby) SDL is from this:

SDL::setVideoMode(640,480,16,SDL::SWSURFACE)

…to this?

SDL::setVideoMode(640,480,16,SDL::FULLSCREEN)

I’m going to like this framework, even if the English documentation is crap right now.

Ruby
development
games

Comments (0)

Permalink

Naughty, but I like it…

Normally you can’t add objects to an array like this:

irb(main):001:0> [1] + 1
TypeError: can't convert Fixnum into Array
        from (irb):1:in `+'
        from (irb):1

But Array#+ tries to call to_ary() on its target if it’s not already an array. So just add that method, and voila:

irb(main):002:0> class Fixnum; def to_ary; [self]; end; end
=> nil
irb(main):003:0> [1] + 1
=> [1, 1]

Wait, why stop there?

irb(main):005:0> class Object; def to_ary; [self]; end; end
=> nil
irb(main):007:0> [1] + "foobar" + File.new('test.xml')
=> [1, "foobar", #<File:test.xml>]

Of course, you should probably be using Array#<< for this. But I wonder what other applications there are…

Ruby
development

Comments (0)

Permalink

Local aspects of modules?

Everyone’s so up in arms about re-opening core classes like Kernel and String in Ruby… Why not just apply changes to a target module only when viewed from within the current module or class?

class Bar
	def baz(fizz)
		fizz * 2
	end
end
module Foo
	local class Bar #Or some other keyword.
		def baz(fizz)
			fizz * 5
		end
	end
	def buzz
		puts Bar.new.baz('a') #'aaaaa'
	end
end
puts Bar.new.baz('a') #'aa'

That way you could tweak behavior to your heart’s content without worrying about the expectations of the other libraries you were using. This seems so obvious I’d be surprised if I was the first to think of it, so someone please let me know what problems have been encountered.

Ruby
development

Comments (0)

Permalink

Desert Code Camp…

I’m doing a talk on Zyps at Desert Code Camp on Saturday, May 31st. (Exact time TBD.) There are several other Ruby sessions as well, ranging from beginner to expert.

If you’re in the Phoenix/Tempe area, go get signed up!

Ruby
Zyps

Comments (0)

Permalink

zyps_client, zyps_server…

OK, here we go. The window on the left is the server, and on the right is the client. The server has absolute authority on all object movement right now, so objects on the client will occasionally “snap” back into the places dictated by the server. (That’s the jagged part in the trails on the client; the smaller boundary on the server causes them to change direction on the server only, and fall out of sync momentarily.) The shells in the background are both barfing debug data.

Next up is to test with multiple clients, and with joining/leaving whenever the client wants. I also need to get back the same degree of freedom for live coding that dRuby offered (shouldn’t be too difficult).

zyps_server_client.PNG

Ruby
Zyps
development

Comments (0)

Permalink

I have two Environments talking!

Well, sort of. They can only share one Creature, and then they start throwing DuplicateObjectErrors. And they don’t keep that one creature’s movement in sync. But it sure was a thrill to drop a Creature on one screen and watch it appear, behaviors and all, on the other.

Ruby
Zyps
development

Comments (0)

Permalink

Rubyscript2exe and NSIS…

I also said I’d present on rubyscript2exe, which is likely to turn into a NSIS tutorial as well.

Here’s a quick copy-paste from a build session…
Continue Reading »

Ruby
applications
development

Comments (0)

Permalink

Doodle, Distilled…

Gonna give a brief presentation on Doodle to the Ruby Users Group on Monday. While some folks can just wing it, I needed to prepare notes. The need for brevity and a large font for the projector requires a short and sweet summary.

In hopes of helping others, here’s what I’ve got…

Continue Reading »

Ruby
development

Comments (0)

Permalink