Hi all! I have a Hash like this
{ 55 => {:value=>61, :rating=>-147},
89 => {:value=>72, :rating=>-175},
78 => {:value=>64, :rating=>-155},
84 => {:value=>90, :rating=>-220},
95 => {:value=>39, :rating=>-92},
46 => {:value=>97, :rating=>-237},
52 => {:value=>73, :rating=>-177},
64 => {:value=>69, :rating=>-167},
86 => {:v...
Hi,
I used packager to make an executable file for the following code:
Shoes.app do
stack :margin => 10 do
@edit = edit_box :width => 1.0 do
@para.text = @edit.text
end
@para = para ""
end
end
then I got error message:
Error in C:/Program Files/Common Files/Shoes/0.r1134/lib/shoes.rb line 394utf.rb: 10:
compil...
Hi there,
So Rails 2.2 added mailer layouts, which is great, except that I can't figure out how to make them work when I'm sending a multipart email..it's wrapping my mail content with the same layout for both the text/plain version and the text/html version. What I want is to wrap my layout around either only the text/html version, or...
I've bought "Programming Ruby" from Pragmatic Programmers (still in beta), but friends say that "The Ruby Way" is much better. Should I buy it or wait for Ruby 1.9 books?
...
I was reading about self-referential has_many :through data situations today, because I'm trying to build a Rails application that uses them. I found this example situation on the Internet, and I have a question about it. Let me post this example code from this guy's blog:
create_table :animals do |t|
t.string :species
end
create_tabl...
I've been using a text editor for my rails app for a while and I have a workflow that I am happy with for my existing app.
However, I am about to be starting a new app and it appears that Aptana RadRails is sufficiently developed and stable enough for use. (The last time I tried it it was in beta and wasn't quite fully baked.)
So my qu...
(this is regarding the Ramaze.net framework)
I ran into some really strange problems while storing custom Objects
in session. I noticed that only the attributes on the objects
immediately stored in session were being updated. However, if those
objects contained references to other objects, those referenced
objects were not updated if th...
I'm learning Rails and it's going well so far. My biggest question at the moment is: how do I go about manually inserting a row into my database? I've got the scaffolding in place for creating rows of DataTypeOne, but I want a row for DataTypeTwo to be created when the form for DataTypeOne is submitted (and have it reference the id of Da...
This would be useful when I have a user's address or zipcode, and used that to find their timezone so they don't have to enter it in a separate field.
...
Does anybody know of ruby implementation of RSA Data Security, Inc. MD5 Message-Digest Algorithm defined at http://tools.ietf.org/html/rfc1321
I found a javascript implementation at https://developer.openx.org/fisheye/browse/openads/branches/2.0/branches/openads-2.0.11/admin/md5.js?r=16584 ... It has a function MD5 which does the encodi...
I want my server to send a multipart response (multipart/x-mixed-replace). I'd prefer some kind of solution using the Sinatra framework or a generic Rack app, but any example in ruby would be nice. Here's the equivalent of what I'm trying to do, in PHP:
<?php
header('Content-type: multipart/x-mixed-replace;boundary="rn9012"');
prin...
I recently wrote mailing list software in Ruby On Rails. I would like to get some expert advice on the best way to test it. For example, it would be cool if I could write a script generate 10,000 email addresses, use the software to send an email to those 10,000 addresses, and then write a script to make sure the emails got through. I...
Suppose you have a software package. You want to make it a gem, because gems are the de facto standard way to distribute anything in the Ruby world. Gems are great -- for libraries. But for real applications, the Rubygems system seems lacking. Only "recently" did they introduce a way to mark executables to be placed in somewhere in t...
Does anyone know a good solution for implementing a function similar to Ruby's timeout in Python? I've googled it and didn't really see anything very good. Thanks for the help.
Here's a link to the Ruby documentation
http://www.ruby-doc.org/stdlib/libdoc/timeout/rdoc/index.html
...
I want to write a simple chat-client in Ruby for the terminal.
The Problem is, that I need two separate "windows", one for the chatlog and another for the input prompt. I dont have a clue how to do this. I watched (n)curses and some other ruby-libs, but nothing gives me this functionality.
.------------------------------.
| Mike: Hi Je...
Using Ruby I'm trying to split the following text with a Regex
~foo\~\=bar =cheese~monkey
Where ~ or = denotes the beginning of match unless it is escaped with \
So it should match
~foo\~\=bar
then
=cheese
then
~monkey
I thought the following would work, but it doesn't.
([~=]([^~=]|\\=|\\~)+)(.*)
What is a better regex ex...
I want something simple in order to experiment/hack. I've created a lot interpreters/compilers for c and I just want something simple. A basic BASIC :D
If you don't know any (I've done my google search...), yacc/bison is the only way?
Thx
...
So I need to approximate a blit-like function for a scrolling tilemap editor built in Shoes. I can't find anything remotely like this in the examples or documentation. The tankspanker example does a bit of scrolling, but it uses vector functions only and doesn't seem do any copying of images to other images.
Does anybody have any id...
I'm trying to setup a second ruby install in my home directory (a different version of ruby for testing). I've compiled ruby into ~/bin/ and everything is working until I try to install rubygems.
I have GEM_HOME set to ~/gems directory and GEM_PATH set to the same. Then I try to install rubygems with
~/bin/ruby setup.rb
The installat...
How can I remove the very first "1" from any string if that string starts with a "1"?
"1hello world" => "hello world"
"112345" => "12345"
I'm thinking of doing
string.sub!('1', '') if string =~ /^1/
but I' wondering there's a better way. Thanks!
...