I'm writing a game which is taking user input and rendering it on-screen. The engine I'm using for this is entirely unicode-friendly, so I'd like to keep that if at all possible. The problem is that the rendering loop looks like this:
"string".each_byte do |c|
render_this_letter(c)
end
I don't know a whole lot about i18n, but I ...
Ruby is truly memory-hungry - but also worth every single bit.
What do you do to keep the memory usage low? Do you avoid big strings and use smaller arrays/hashes instead or is it no problem to concern about for you and let the garbage collector do the job?
Edit: I found a nice article about this topic here and another one here - old ...
I'm currently primarily a D programmer and am looking to add another language to my toolbox, preferably one that supports the metaprogramming hacks that just can't be done in a statically compiled language like D. I've read up on Lisp a little and I would love to find a language that allows some of the cool stuff that Lisp does, but wit...
How can I copy and paste in irb (Interactive Ruby Shell) on Windows?
...
I'm using the current version of restful_authentication that is found on github and I'm having a bunch of strange session issues. The server seems to be somehow assigning sessions to users it shouldn't be. This only happens when crossing the logged out/logged in barrier.
Here's an example. With no sessions active on the server, I log in...
Say I'm writing some ruby code and I want to use the standard Date type to get the current date. Instead of using a search engine, is there a faster way to find the documentation for this class? I know I can get the methods for Date by typing Date.methods, but as far as I know this doesn't provide details about argument types or return ...
In ruby I am parsing a date in the following format: 24092008.
I want to convert each section (year, month, date) into a number.
I have split them up using a regex which produces three Strings which I am passing into the Integer constructor.
date =~ /^([\d]{2})([\d]{2})([\d]{4})/
year = Integer($3)
month = Integer($2)
day = Int...
('1' * N) !~ /^1?$|^(11+?)\1+$/
On the net, I found this piece of Ruby code that works for N >= 0 that determines whether or not N is a prime. From what I can tell, it looks like play with regex but I have no idea how it works. Could someone tell me how it works?
...
I'm looking at ways to deploy a Ruby on Rails app (running on JRuby) to a Tomcat instance for testing.
The tomcat instance is running on a Solaris server that I can SSH to. I've looked at using Capistrano, but there doesn't seem to be a lot out there about using it to deploy to Tomcat, or even about running it under JRuby, and I keep hi...
How do you calculate the length of the string that would be returned by Array::pack? Is there something like Python's calcsize?
...
I'm expanding my Ruby understanding by coding an equivalent of Kent Beck's xUnit in Ruby. Python (which Kent writes in) has an assert() method in the language which is used extensively. Ruby does not. I think it should be easy to add this but is Kernel the right place to put it?
BTW, I know of the existence of the various Unit framew...
I'm trying to get started writing some Ruby on Rails apps and have been successful with Mongrel but, I'd like to deploy my apps to my Apache 2.2 instance on Windows? All the tutorials I've found seem out of date and are for older versions of Apache/Rails.
Does anyone know of a good, current tutorial for configuring Apache 2.2 for Ruby ...
I'm looking to pick up a few books on RoR to help teach myself how to build a scalable RoR app.
I have read the RailsSpace book, and am starting the Rails Way book tonight.
Some topics of interest are:
REST - considering using Amazon's SimpleDB
Using RSpec effectively
memcached - server architecture and code implementation
mongrel -...
Has anyone ever done work to get Ruby to do continuations (like Seaside on Smalltalk)?
...
I was going through the AWDR book on web development with ruby on rails and one of the issues with the old code was it didn't use respond_to to make sure the view used would be the javascript view. Now in some updated examples I've seen people mention they later, when implementing graceful degradation, use request.xhr? to tell if the use...
I created a Rails application normally. Then created the scaffold for an event class. Then tried the following code. When run it complains about a InvalidAuthenticityToken when the destroy method is executed. How do I authenticate to avoid this response?
require 'rubygems'
require 'activeresource'
class Event < ActiveResource::Base
s...
I need to substitute the value of a string into my regular expression in Ruby. Is there an easy way to do this? For example:
foo = "0.0.0.0"
goo = "here is some other stuff 0.0.0.0"
if goo =~ /foo's value goes here/
puts "success!"
end
...
Is there a viable open source Ruby on Rails content management system out there?
I need a CMS with the ability to manage structured content, content relationships, classification (structured taxonomy and free tagging) and simple publishing workflow. I'd prefer the content ultimately be persisted as XML. Also content needs to be abst...
In the database I have a field named 'body' that has an XML in it. The
method I created in the model looks like this:
def self.get_personal_data_module(person_id)
person_module = find_by_person_id(person_id)
item_module = Hpricot(person_module.body)
personal_info = Array.new
personal_info = {:studies => (item_module...
Sometimes it feels that my company is the only company in the world using Ruby but not Ruby on Rails, to the point that Rails has almost become synonymous with Ruby.
I'm sure this isn't really true, but it'd be fun to hear some stories about non-Rails Ruby usage out there.
...