I would like to match patterns on strings like on the following ant documentation. Is there a gem already for this or is this an easy task with regexps?
I know Dir.glob already does this but I don't know how to use it without a real filesystem.
'*' matches zero or more characters, '?' matches one character.
In general, patterns ar...
I'm programming a solution that requires parsing some data sent to a printer that is attached to a serial port. It's only reading, I don't need to interfere with the communication, but I need it to happen real time...
I've searched around and found nothing that allows me to do this kind of stuff using the language i'm programming the so...
I'm trying to set up Factory Girl with Test::Unit and Shoulda in Ruby on Rails. I have installed the gem, created my factory file under the test/factories directory, and created my spec file under the test/models directory. The current error I'm getting is 'ArgumentError: No such factory: test', which leads me to believe that the test_fa...
What is the best way to develop a rails application that has special views for different mobile devices?
Basically I'm looking for something like this ASP.NET MVC solution: http://www.hanselman.com/blog/MixMobileWebSitesWithASPNETMVCAndTheMobileBrowserDefinitionFile.aspx
...
I have two models, Users and Groups. Each group can have many users and each user can be in many groups.
I currently have something simple like:
User:
has_many :groups
Group:
has_many :users
So I have a groups_users table which is just creating rows with group_id and user_id.
I want to add another column to this, (which I h...
I'm integrating my Ruby on Rails app with a usps shipping system. Once you make a postage request, you pay for that postage and it's nonrefundable.
Postage requests will return you an xml response including a base64 string, which is the shipping label.
I'm able to render the shipping label in a view, however to make it foolproof, I w...
When trying to run a simple ruby program I wrote, I am getting this error. Just reinstalled everything the other day, before the code was working fine.
ruby/1.8/i386-mswin32/openssl.so: 14001: The application has failed to start because its side-by-side configuration is incorrect. Please see the application event log for more detail. ...
I am seeing very, VERY strange behavior when I run certain reports:
>> p = BigDecimal.new('0.1785990254E5')
=> #<BigDecimal:b649b978,'0.1785990254E5',16(16)>
>> q = BigDecimal.new('0.76149149E4')
=> #<BigDecimal:b64968d8,'0.76149149E4',8(16)>
>> p-q
=> #<BigDecimal:b6495ab4,'0.124498764E5',16(32)>
>> p.to_s
=> "17859.90254"
>> q.to_s
=>...
$ script/plugin install git://github.com/rails/exception_notification.git
$ ls vendor/plugins/
exception_notification
$ cat vendor/plugins/exception_notification/init.rb
require "action_mailer"
require "exception_notifier"
require "exception_notifiable"
require "exception_notifier_helper"
$ script/console
Loading development environm...
I'm working on a legacy database that is complete non-sense. I have a table called movie that contains columns with names like c00, c01, c02 and so on. The table also uses non-standard primary_keys. So I've created a class called movie like this:
class Movie < ActiveRecord::Base
set_table_name "movie"
set_primary_key "idMovie"
...
> jruby -S newgem testgem --simple -T test_unit
invalid option: -T
Newgem v1.5.1
Also tried
> jruby -S newgem testgem --simple --test-with=test_unit
invalid option: --test-with=test_unit
Also tried MRI.
Any ideas?
Thanks
...
I have a 1:1 has_one / belongs_to relationship between users and registrations. One user has one registration.
When I try to iterate through users in a view and display their registration info (source to follow), I get the following error:
ActionView::TemplateError: You have a nil object when you didn't expect it! The error occurre...
I have following string:
"xxxxx GL=>G0 yyyyyy "
I want to extract GL and G0 using ruby regular expression.
Thanks.
...
How do I compile and build the taf2-curb Ruby gem on Windows XP with MinGW?
I tried this, but I'm kinda fishing, unsuccessfully.
C:\Documents and Settings\Me>gem install taf2-curb -- --with-curl-include=C:/curl-7.19.5-devel-mingw32/include
--with-curl-dir=C:/curl-7.19.5 --with-curl-lib=C:/curl-7.19.5-devel-mingw32/lib --prefix=C:/MinGW...
I'm a complete apple newbie coming from a LAMP+windows setup trying to figure out how ruby and apple works.
So I just executed "gem server" and i have this server running on localhost:8808 now, great -- it works.
BUT Anyone know where the heck is my root directory ie. the equivalent of htdocs? I can't find it, damnit.
cheers...
...
So we run a code quality tool called reek once in a while as part of our project. The tool basically looks for code smells and reports them. Here, we observed that we get "Duplication" smell every time we try to access a key in params more than once (As if we are making a method-call twice with same parameters or we are duplicating an if...
I'd like to run inspect on some object, but unfortunately it's either linking to some really big objects, or has a circular reference. That results in many pages of output.
Is there some way to limit the level of recursion that inspect is allowed to do?
...
I've got code which produces a stack trace at some point:
fileA.rb:1670:in `flow_completed_for'
(eval):58:in `on_success_res_for_register'
fileB:312:in `send'
fileC:312:in `request_specific_response_dispatch'
...
How can I find the source where on_success_res_for_register was defined? The code is called from some timer and I have prob...
As in the standart cycle:
- @goods.each do |good|
???
...to organize this (HAML):
.columns-wrapper
.column First good
.column Second good
.column Third good
.columns-wrapper
.column Fourth good
.column Fifth good
.column Sixth good
...
What are some of the best practices for OOD with Ruby? Mainly, how should files and code be organized?
I have a project that uses several classes and files and I am just wondering how it should all be organized, grouped and included.
...