I was working with struts validators and need to test a phone number to be digits and starts with a leading 00, I wanna share it here
^00+\d{9,17}$
below is a ruby code snippet:
phone_no=”009621111111″
if phone_no =~ /^00+\d{0,9}$/
puts “match”
else
puts “No match”
end
a quick explain is
^ start from the beginning of the string
+\d{9,17} should include digits with at [...]
Read Full Post »
Posted in Java, Markup Languages, Open Source, Ruby and Ruby On Rails, tagged , IDE, infoq, Java, jruby, netbeans, ruby, Ruby on Rails on December 4, 2007 | Comments Off
Today I installed Netbeans 6 and my first Impression is Wow! I will be posting in-depth look at netbeans-6.0 later.
but, what is new on netbeans-6.0?
Editor Improvements
Smarter code completion
Highlights
Better Navigation and Inspection
Live Templates and Surround Functionality
Ruby/JRuby/Ruby on Rails Support
Project support including Gems and RSpec
Advanced Ruby Editing
ActiveRecord Code Completion
Ruby Debugger
Ruby on Rails Support
Profiling
Profiler integrated into NetBeans IDE
Compare [...]
Read Full Post »
Posted in Ruby and Ruby On Rails, tagged ruby, yaml, yaml4r on November 12, 2007 | Comments Off
Yaml (Yet Another markup language) allows developers to serialize and deserialize Object to files and still human readable and editable. in short!
I will explain how to load, save, update yaml file using ruby (Yaml4r). a sample source code can be found at the end of this article
As always: busy developer walk through:
Installation
gem install RbYAML
Usage
Tip! [...]
Read Full Post »
This is a busy developer tutorial that walk through installing ruby on rails on Linux Machine.
get Downloads ready
type yum install ruby rdoc irb
Rubygems from http://www.rubyonrails.com/down
unzip the package.
type ruby setup.rb
type gem update
type gem install rails –include-dependencies
choose your lovely database: we will be using mysql for this tutorial; so, that requires us to install mysql
type yum [...]
Read Full Post »