occasionally useful ruby, ubuntu, etc

18Apr/096

Announcing: Ramastic, a skeleton for Ramaze

This is something I've been working on since slightly before my original call for suggestions a while back.  It's not done yet (I'd say it's somewhere around 75% done) but I want to get it out there before I totally lose steam on it.  There are a few inline styles I was planning on removing, but haven't gotten around to, so...apologies.  If you find it of use, please leave a comment.

And yes, it doesn't look that great.  But I'm expecting you to restyle everything anyway and possibly blow away the templates entirely in your instantiation of the skeleton.

Now, without further ado, here are features and screenshots:

Features/requirements

Screenshots

Repository

Github.

Thanks for looking!

Filed under: ramaze, ruby 6 Comments
8Apr/092

Ideas Needed for Mr. Bones skeleton built on Ramaze

If I were to make a skeleton using Mr. Bones that was built on Ramaze, what would people like to see in it?  It's for my use first, but the community's use a close second if I can generalize it enough.  I was thinking along the lines of openid support, having a decent home page and logged-in-user gateway, appropriate nav-bars, haml+sass, jquery+ui, etc....thoughts?  What do you find yourself doing at the beginning of every website project that you'd like to not have to repeat every time you start a project?

Filed under: idea, ramaze, ruby, web 2.0 2 Comments
2Apr/090

re-"require"-ing: how's the speed?

What this is about

So I like the design that, when you need a particular library in your code, you require it in right there in the method/class (JIT library-loading, so to speak), even if it means the require directive will get executed more than once. Running through irb you can tell that calling require twice on the same library is usually much faster the second time, but how much faster?
Read on for benchmarks!

Filed under: ruby Continue reading
8Mar/090

Gotcha with Sequel and Association Caching

One thing to remember with Sequel is that it caches associations -- for an hour, by default. Normally this is good -- if I say my_model.my_associated_models twice in one request, I'd like that to be cached. But at least with Ramaze, where you can access a variable that persists between requests (via session, like session[:user]), you have to remember that associations on that session object get cached, too. So what does that mean? That means if you have a user view their posts (with session[:user].posts), and then they go make a post, and then they come back to view their posts again...the new post won't be in the list of posts! So you have two basic options here, that I know of -- either a) manually kill the cache by putting session[:user].refresh on the action that alters the associations of session[:user], or b) put session[:user].refresh in a place that gets executed at the beginning of every request.

Filed under: ramaze, ruby, sequel No Comments
22Feb/098

Ruby 1.9 and OpenSSL on Ubuntu

Having trouble getting openssl working on your Linux box and Ruby 1.9 (or 1.9.1, specifically)? Here's something to give a try...

28Jun/085

Partial success!

For a good chunk of yesterday, I was trying to ""port"" my exceedlingly simple Ruby application to Windows. The hitch? It uses Gosu (game engine), Chipmunk (physics engine), ImageMagick (popular graphics tool), and RMagick (wrapper for ImageMagick in Ruby). With the help of RubyScript2Exe it almost, almost worked. Gosu and Chipmunk had no problem, as they had no-strings-attached .so files and apparently were programmed well. ImageMagick, despite trying to be a pain in the ass by making me include an extra dozen DLLs in my project folder, actually did end up working. But RMagick...when moving the generated app to a new computer that didn't have ImageMagick installed freaked out with a weird "address not accessible" error or something. After some fiddling I gave it up as a lost cause and dropped support for ImageMagick+RMagick. The only reason they were there in the first place is because I wanted to load SVG files whenever possible, and possibly have some dynamic graphic generation, but...the former isn't that great anyway, and the latter will have to be done other ways, if at all.

So, yes, Ruby+Gosu+Chipmunk play just fine with RubyScript2Exe on both Windows and Linux.

26Jun/080

Distributing Ruby Apps

So I'm pondering the idea of writing a game...but I want it to be playable on Windows and Linux, and I want it to be available on Linux without much trouble. I've made a couple interesting discoveries, in terms of applications to help me do this.

23Apr/080

Ruby + Ruby on Rails tutorial

Note that this isn't finished and may never be finished, but I didn't want it to stagnate in my Proofs box any longer. So take what you can from it.

You, like me, have probably heard all of the hype around Ruby on Rails. "Convention over configuration" they say, and "Don't Repeat Yourself" are common Ruby on Rails adages. Well, it's true. Creating a new database is as simple as telling Rails your database credentials and typing a single command. Adding new tables takes just a single command.

When I set out to learn Ruby on Rails, I was beset with a bit of confusion. Rails 2.0 was released recently (December '07) and Ruby 2.0 is coming out soon. As a result of the Rails thing, there are a lot of out-of-date tutorials out there. So hopefully this will help someone out there trying to learn Rails right now.

Audience: Some programming experience (preferably web programming), but no Ruby/Rails experience.
Any operating system, but some bias towards Linux/Ubuntu
Goals:

  • Set up a development environment for Ruby and Rails
  • Write hello world in Ruby
  • Learn some Ruby syntax
  • Learn some Rails commands
  • Write hello world in Rails
  • Output data from a database
  • Take form data and update a database
  • Introduce Rails API for flash, style, javascript
  • Introduce flash variables
  • Apply style sheets
  • Apply javascript files
  • Prepare for future (Ruby 2.0)

Finally, this tutorial uses the following technologies and versions:

  • Ruby: 1.8.6
  • Rails: 2.0.2
  • Rake: 0.8.1
  • Rubygems: 1.0.1

If you're still interested, read on!

20Apr/080

Ruby Currency Converter

If anyone's interested, I made a little Ruby currency converter.

Currency Converter

Filed under: ruby No Comments
9Apr/080

STDERR

So I was trying to capture the stdout and stderr from Ruby from external apps executed with the backtick operator, when Finally I found this page. It's quite useful!

Filed under: ruby No Comments