similar to: regular expressions slay me

Displaying 20 results from an estimated 5000 matches similar to: "regular expressions slay me"

2006 Feb 01
8
ruby equivalent of isset()
Hi, Is there a way to test if a certain (local) variable has been initialized? I''d like to do something like if isset(myvar) and myvar.true? #some code else #default behaviour end I have a lot of shared views that I call with params such as { show_pager => true Instead of having to explicitly say show_pager => false it should be possible to make false a default value, right?
2006 Feb 08
5
Regular Expression Question
I have looked through the Ruby Pickaxe book as well as done a search but can''t figure out how to validate the format of a field. The field I want to validate is a credit card expiration date field. Based on our user study (going around the office and asking everyone the way they like to fill out that particular field type) everyone prefers the following format in one field:
2006 Nov 13
3
(A bit offtopic): A good starting book for ruby programming?
Hi all Guess it''s time for me to dig a bit deeper into the ruby language. Can you recommend some good starting books on ruby programming? Thanks. -- Med venlig hilsen Juri Rischel Jensen Fab:IT ApS Vesterbrogade 50 DK-1620 København Tlf: 70 202 407 / Fax: 33 313 640 www.fab-it.dk / juri@fab-it.dk
2007 Aug 08
6
What ruby/rails componet do I need?
I stole a script from the archives which shows how to launch an https version of webrick. However I am getting an error that indicates that my ruby/rails isntallation is missing a component to support ssl as called from webrick. The script line in question is: 6 require ''webrick/https'' and the error stack generated is:
2008 Jan 18
2
NameError when using alias_method -- but method exists?
Hello Rubyists, I am a bit stumped here. I want to extend the ''load_file'' method in the YAML module. Following along with the PickAxe example of making old methods do new things, I try this in irb: >> module YAML >> alias_method :orig_load_f, :load_file >> def load_file(*args) >> contents = orig_load_f(*args) >>
2006 Apr 03
1
singular table names testing
I''ve demoed my rails app and now have to move it to a MSSQL DB. the big problem I''m running into is the table name conventions I have to use. I have to use names like tbl_Transfer & tbl_User. In my tests on the console, I am trying myvar = tbl_Transfer.find_by_sql("select top 1 * from tbl_Transfer") NameError: undefined local variable or method
2006 May 02
4
ordering after a inject
Hi, My results are getting out of order after I do the following command: count = result.inject({}) { |hsh, row| hsh[row[''name'']] = row[''count''].to_i; hsh } Why? Here are more specifics: My complete method is this (based off of acts_as_taggable code - not'' DHHs, but the original one): def self.sql_to_count_plays(lookback) sql =
2006 Dec 27
10
Mixing html tags and Ruby blocks
I''m trying to get the following idea to work: <%= @column_names.each { |t| <td> t.downcase </td> <td> @listing.send(t.downcase)</td> } %> Essentially I want to display a form that has a left and right TD, with the left TD being a column name and the right TD being the column data. If there''s a better way (the Rails way ?), I''m all ears
2006 Mar 22
14
currency conversion webservice in a rails app?
Hi, I''m interested in using a currency conversion web service in my rails app. Does anyone have a free service that they use and like? I found this one http://www.webservicex.net/WS/WSDetails.aspx?CATID=2&WSID=10 I''ve tried to make a simple, plain Ruby script to connect to this and get a conversion rate without success. How do I integrate a webservice into my rails app? I
2006 Jun 25
6
Understanding Common Views
Hi Everyone, I''m trying to formulate my thoughts on how views work in RoR and I understand the basic bits - 1. Every controller has its own view defined using rhtml files in the views/[controller_name] folder. 2. There is one "view" file (rhtml) for every in the controller and has the same name as the method. 3. For portions that are common, partials can be used - file
2006 Feb 09
17
complicated finds are eating my sole
I abandoned ruby way for find_by_sql and still can''t get this... @myplacement = Placement.find_by_sql( "select * from placement where :intake_date >= beg_intake_date and :intake_date <= end_intake_date") just a simple date range...it''s killing me - If I knew how to load placement controller into irb, I could probably try out finds interactive mode... Thanks
2006 May 23
14
Learn Ruby before Learning Ruby on Rails ?
hello Friends, I am a newbie to "Ruby or Ruby on Rails". A J2EE application architect at my day job. A fairly experienced PHP web-developer as well. After reading into the many articles on Ruby/ROR, have to admit looks pretty good so far. Really serious about getting into this and possibly developing some good Web 2.0 applications. Just wondering the best way to learn Ruby on
2005 Mar 09
21
Converting time retrieved from MySQL
I''m having a problem converting a date retrieved from my MySQL database and I''m hoping someone can help. MySQL stores the date/time as this: 2005-03-08 17:00:34.0 and according to my Pickaxe book Ruby stores times as "the number of seconds and microseconds since [...] January 1, 1970". All well and good. Unfortunately, RoR is converting my date to this:
2006 Jun 08
21
"Rails recipes" vs "Rails cookbook"
Reviews Wanted. I''ve read the tables of contents and haven''t yet made up my mind. Is one book clearly better than the other? Is one clearly full of bugs? Is one so much further ahead that there is no choice? Are they both so incomplete that I should just wait and only cook real food? Do trains still have dining cars? Warren Fred -------------- next part -------------- An
2006 Feb 15
7
Ackbar - ActiveRecord Adapter for KirbyBase
= About Ackbar Ackbar is an adapter for ActiveRecord (the Rails ORM layer) to the KirbyBase pure-ruby plain-text DBMS. Because KirbyBase does not support SQL, joins or transactions, this is not a 100% fit. There are some changes to the ActiveRecord interface (see below), but it may still be useful in some cases. = URIs Ackbar: http://ackbar.rubyforge.org KirbyBase:
2006 Feb 10
15
"Ruby for Rails" in early access release
Hi -- My book "Ruby for Rails" is now being released one chapter at a time through the Manning Early Access Program, with the whole book due to appear on May 1. If you''re interested, see http://www.manning.com/books/black (I guess I could have just sent my sig with no body, but anyway :-) David -- David A. Black (dblack@wobblini.net) Ruby Power and Light
2007 May 30
4
Using mocks
I''ve just started doing TDD/BDD and like the idea of mocks. So I set out to use them. The doc pages seem great, I setup the mock and then it just works. Here is what I am trying to do: Myuser is a non-rails model of user attributes. We are going to be mocking the connection to the ldap server. The user class has a login method that connects to the ldap server and if successful,
2006 Dec 07
4
Removing a block of text within a string
When you first visit my site, you see a snippet (the first 75 words) of the most recent post. If it exceeds 75 words, a link will be appended to extend the post and read it in full. Now, my problem is when I post a code snippet, and I use "pre" tags to preserve its formatting, I don''t want that to show up on the snippet... only on the full version of the post. The reason is
2011 Dec 10
5
create user and push out keys.
Hello Im just been working with puppet, the first usecase i have is to set up a system to create users and then push ssh keys on this machines in the create users .ssh files. I just started with puppet so i am a bit cluesless, Can someone push me in the right direction? Im having a centos enviorment. -- You received this message because you are subscribed to the Google Groups "Puppet
2008 Oct 20
5
Combining all possible values of variables into a new...
I'm trying to create a new column in my data.frame where subjects are categorized depending on values on four other columns. In any other case I would just nest a few ifelse statements, however, in this case i have 4*6*2*3=144 combinations and i get weird 'context overflow' errors. So I wonder if there is a more efficient way of doing this. For illustrational purposes, let's say