Displaying 20 results from an estimated 1000 matches similar to: "Help on Regular EXpression"
2011 Aug 12
8
Need some help with regular expression
I need to validate a string from a user (a location for use with
geotagging) that is. I want to make sure that the user specify a city
and a country in my inp ... So i wrote this =>
validates :usri_location,
:presence => true,
:format => {:with => /^[a-zA-Z]+{\,\s}+[a-zA-Z]/i},
:on => :create
I want to make sure that the user writes city,
2006 Apr 01
2
Textile headaches
I have the newest version of RedCloth installed (3.0.4). I want the
following output:
<h1>Header</h1>
<p>Some text</p>
This is what I tried but no luck:
irb(main):002:0> require ''rubygems''
=> true
irb(main):004:0> require_gem ''RedCloth''
=> true
irb(main):006:0> RedCloth.new("h1. Header\r\nSome Text").to_html
2009 Aug 27
8
Adding New Column
I added a new column using a migration. Once I updated the
new.html.erb, edit.html.erb, show.html.erb, and the index.html.erb I
brought up my web pages. There was a field to update show. I tried the
update and the it was successful but the update did not show up in any
of the other pages. What did I miss? I am using 2.3.3 of ror.
2008 Apr 03
1
Listening on conversations for training?
Hello
I assume it's possible to do this with Asterisk: To train a new
worker who works remotely, I'd like to have him listen in on support
calls so that he gets to learn the kind of problems that come in, and
how they're solved.
When a call comes in and the support person thinks it's worthy to have
the trainee be part of it, he will ring the trainee so he can join the
call.
2011 Aug 25
5
custom fact regex problem
Hi guys
I have a custom fact envt, it was working fine but now I have to make
some changes in it;
puppet client''s hostname is of the type 1234qa-abc-de.local where 1234
can be any thing of any length.My custom fact should contain qa, ie I
want to check in the first part(before the first -) of the hostname
if there exists a pattern/word qa and if it exists then my custom
fact
for envt
2008 May 29
7
when is a boolean not a boolean?
Weird problem.. I''m new to rails and ruby... maybe someone can explain
what I am not getting..
Env: Mac OS X 10.5.3, Rails. 2.0.2, ruby 1.8.6 (2007-09-24 patchlevel
111)
A User class created using the restful_authentication plugin
A Company class (has lots of fields not really important to the
problem below)
Users can have many companies, entered into the User.rb model as one
would
2004 Jun 23
1
New VM feature: broadcast and delete=yes
New in CVS - taken from bug 1361:
Voicemail broadcasts
Description: Add a flag to the last field of voicemail boxes that allows
deletions:
delete=yes
Also permits voicemail to be entered in the following manner, to allow
multiple recipients for a single recording:
Voicemail(u1001[@context][&1002[@context][...]])
Example 1:
1235 => 4242,Example Group,,,cc=4200;4300;*@other|delete=1
2012 Sep 28
1
'Training mode'
I was asked today if we could somehow have a trainee on the phone with a
supervisor conferenced in, but somehow have it so anything the
supervisor says is only heard by the trainee and not the customer.
Is there a feature like that?
2008 May 16
3
has_one and find_by_id issue
I have two models:
testamonial
photo (has_attachement)
testamonial has_one photo
The issue is when do this:
@testamonial = Testamonial.find_all_by_id(id)
I get "undefined method `photo'' for" in my browser?? BUT here is the
big kicker....
If I do @testamonial = Testamonial.find(:first)
everything works fine and the image is show!.. (find :all works too
when I loop
2012 Sep 30
3
How to escape a forward slash with gsub, also does interpolation work with gsub?
I am trying this:
I want to replace all the text in between java comments:
/* start */
replace this text here
/* end */
I''m trying:
text.gsub(//* start */(.*)/* end *//im, replace_with)
But i''m getting errors relating to expecting keyword_end.
How should I be escaping /* and */ ?
Also, does string interpolation work in gsub regex? Say I had variables
like:
start_tag =
2009 Jan 17
3
[Cucumber] Struggling with "multiple step definitions"
Hey gang,
I find myself struggling with multiple step definitions in cucumber
all the time. I regularly test the contents of my flash[:notice] in
steps, since I think that''s part of the behaviour of the app. So,
while implementing a new feature, I ran into the following error:
/opt/local/lib/ruby/gems/1.8/gems/cucumber-0.1.15/bin/../lib/cucumber/
step_mother.rb:81:in
2006 Apr 01
0
Winbind and email server]
okay, im far from a pam expert, but i don't see any mention of winbind there?
It's my weekend at the moment so i can't get to my test box at work to
show you my pam module using winbind, but maybe you should check out this
page on my website, it's using ldap try and use this and replace any
mention of ldap with winbind
http://www.yourhowto.org/content/view/35/9/
or
i have a
2009 Aug 13
6
Strange Routing
Hi Guys,
I have some strangeness with routing, using standard route
map.connect '':controller/:action/:id''
map.connect '':controller/:action/:id.:format''
Using console I did
>> rts = ActionController::Routing::Routes
>> rts.generate(:action => "edit", :controller => ''vendorlocations'', :id => 10)
=>
2007 Aug 04
1
ActiveRecord gotcha with references?
I have this situation:
class Employee < ActiveRecord::Base
belongs_to :designation
end
class Designation < ActiveRecord::Base
end
I do the following at the irb console:
Step 1: Find an employee
>> emp = Employee.find 3
=> #<Employee:0x35a7d34 @attributes={"designation_id"=>"3", "id"=>"3",
2010 Apr 28
1
Multiple cex sizes in main for xyplot?
Folks:
I would like to write two lines of text in two different font sizes (or
faces or ...) as the title ("main") of a trellis plot. The following code
does it, but not well:
xyplot((0:1)~(0:1),
main = textGrob(lab=c("Some Text","Some More Text"),y=c(.95,.8),
gp=gpar(cex=c(1.2,1.0)))
)
There is too much space between the title text and the plot. I assume
2006 Jan 20
4
validates_format_of > Invalid regular expression with simple pattern
Hello,
I try this :
validates_format_of :name , :with => /^[A-z0-9_.- ]*$/ , :message =>
"bad characters"
for accept any name with chars "A" to "z" , "0" to "9" , with "_" "."
"-" and " "
The pattern is really simple but I have this error :
SyntaxError in Login#register
2008 Sep 03
23
error connecting to mysql
i was trying to setup an application checked out from svnin my local
machine. i managed to do all that is required except when it came to
the step of creating databases for the application, when i tried to
connect to mysql i got this error
ERROR 2002 (HY000): Can''t connect to local MySQL server through socket
''/var/lib/mysql/mysql.sock'' (2)
i have spent more than 5
2008 Oct 15
4
Small regular expression question
I''m looking to write a regular expression that will match valid URLs.
My problem is that it almost works, except it accepts URLs with / in the
middle of them, suchs as:
http://www.ruby/rails.com
It looks (to me) like my regular expression should not match strings
like that, but it does. Here is the regular expression:
2009 Oct 01
3
mongrel + mysql can't connect in custom mysql install
Hi all...
The linux box I am working on I do not have root access to, and given I
am at a government site all hope of that is lost.
I have installed the mysql gem as follows:
env ARCHFLAGS="-arch x86_64" gem install mysql --
--with-mysql-config=/home/t192zcs/mysql/mysql-5.1.39-linux-x86_64-icc-glibc23/bin/mysql_config
2009 Jul 06
0
Help with regular expression
First at all sory if my english is not the best.
We have a problem in our web when a user writes a long url. The
structure of the web becomes ugly...
First, we tried to solve this poblem with CSS. We implemented something
like that:
msgforo .p {
overflow: hidden;
word-wrap: break-word;
}
but it wasn''t the solution for our problem because some words at the end
of the line repeat