I'd like to be able to get all the key-values stored in a Berkeley DB using the Ruby bindings from http://github.com/mattbauer/bdb/tree/master but I'm not sure how to proceed. Any pointers will be appreciated.
UPDATE
Here's a small script that loops over the keys and prints them. Based on Pax' answer:
require 'rubygems'
require 'bdb'
...
In the documentation I read:
use \A and \Z to match the start and end of the string, ^ and $ match the start/end of a line
I am going to apply a regular expression to check username (or e-mail is the same) submitted by user. Which expression should I use with validates_format_of in model? I can't understand the difference: I've alw...
I am starting to learn Qt4 and Python, following along some tutorial i found on the interwebs. I have the following two files:
lcdrange.py:
from PyQt4 import QtGui, QtCore
class LCDRange(QtGui.QWidget):
def __init__(self, parent=None):
QtGui.QWidget.__init__(self, parent)
lcd = QtGui.QLCDNu...
I have a Rakefile that compiles the project in two ways, according to the global variable $build_type, which can be :debug or :release (the results go in separate directories):
task :build => [:some_other_tasks] do
end
I wish to create a task that compiles the project with both configurations in turn, something like this:
task :build...
Hi all
I am looking for possibility to have ruby-based webserver communicating by pipe, not by TCP/IP. So I will send HTTP request by pipe and I want to read response by pipe. It should be used as bundled/internal webserver (RPC or something) for desktop application. I don't want to handle ports configuration when there will be more ins...
I need to implement a undirected graph G = (V,E) in Ruby on Rails and thought of building a Vertex and an Edge model where *Vertex has_many Edges*.
As an edge connects exactly two vertices, how would you enforce this in Rails?
Do you know any gem or library that would help implementing such a graph (not intrested in re-inventing the w...
(?:)
It is a valid ruby regular expression, could anyone tell me what it means?
Thanks
...
I am giving a series of talks to a .NET (C#) development team on the Ruby language and environment. I am approaching it as an opportunity to highlight the benefits of Ruby over C#. At first, I want to concentrate on the language itself before moving into the environment (RoR vs ASP MVC, etc). What features of the Ruby language would y...
Since I didn't get the expected answer on my last question I'll try to simplify and narrow my question:
How can I build a dropdown-menu that uses AJAX (no submit-button) to call the show action of a certain controller?
The following things are given:
Model-Association is Categories HABTM Projects, therefore the dropdown-menu consi...
Trying to use the nested model form in the new rails release candidate. I have this, but it only renders form fields for each existing associated photo object.
(Given a form builder f that was created for my parent model object)
%h3 Photos
- f.fields_for :photos do |photo_form|
%p
= photo_form.label :caption
= photo_form.te...
Hi,
I have a few Solaris 10 boxes and I'd like to have RDiscount running there. (They are Joyent accelerators, which have a somewhat customized, BSD-ish, userland, in case it matters.)
I'm aware of Maruku, rpeg-markdown and other ruby alternatives to BlueCloth, but initially I'd like to go with RDiscount.
Here's what I get when trying...
I've got a gem (will_paginate) that's broken on my version of Oracle. The default paginate_by_sql method in the WillPaginate module is inserting an extra 'AS' into a query and causing it to fail.
The code itself is easily fixed, but i'm not sure of the best way to get rails to pick up my change.
I don't want to change the code in the ...
Every time I try to run any class from my rails 2.2 app's lib directory using "script/runner -e production ClassName.run" I get the following error:
"/usr/lib/ruby/gems/1.8/gems/rails-2.2.2/lib/commands/runner.rb:47: /usr/lib/ruby/gems/1.8/gems/activesupport-2.2.2/lib/active_support/dependencies.rb:89:in `const_missing': uninitialized c...
I'm playing around with making a simple terminal-based game with Ruby, and I'm currently trying to come up with a way of reading input from the terminal.
So far I've been using gets, but I'd like to have the game react instantly without requiring a newline (so you don't need to press a key, THEN enter).
I've figured out I need to put t...
Hi all,
I'd like to render multiline text in Rails, the action looks like:
def mutli_text
render :text => 'Word1\nWord2'
end
and I'd expect the response to be :
Word1
Word2
unfortunatly I get Word1\nWord2
Any help would be appreciated
(The action must render a multiline response to get the autocomplete jquery plugin working)
...
I have a very simple task at hand. If the last time a record was updated has been longer than 15 minutes, display a button. Otherwise, don't display the button.
The field is a datetime.
My view code:
<% if @object.display_button? -%>
my button
<% end -%>
My display button method on that object:
def display_button?
return fals...
Which gem or plugin should I use for building Myspace applications using Ruby on Rails?
...
Summary: The basic question here was, I've discovered, whether you can pass a code block to a Ruby array which will actually reduce the contents of that array down to another array, not to a single value (the way inject does). The short answer is "no".
I'm accepting the answer that says this. Thanks to Squeegy for a great looping st...
In python, a module doesn't have to have a main function, but it is common practice to use the following idiom:
def my_main_function():
... # some code
if __name__=="__main__": # program's entry point
my_main_function()
I know Ruby doesn't have to have a main method either, but is there some sort of best practice I should fo...
I know this may be a stupid question, but I don't know how to create a ruby function that accepts a hash of parameters. I mean, in Rails I'd like to use a function like this:
login_success :msg => "Success!", :gotourl => user_url
What is the prototype of a function that accepts this kind of parameters? How do I read them?
Thanks in a...