Input and output
In all this series of articles, a large number of Ruby standard output methods are used when writing Ruby code. Among them, the most common is the print and puts methods, the details of its use no longer repeat.
All of these and
Ruby has three classes of variables, one constant, and two strict pseudo variables (pseudo-variables). There are no types for variables and constants. Although there are some drawbacks to the untyped variable, there are more advantages and good
First, install Ruby under Linux
1-First, we want to get the latest Ruby release version (currently ruby-1.8.2.tar.gz).
Please download it to www.ruby-lang.org/en/20020102.html.
2-then decompression: TAR-ZXF ruby-1.8.2.tar.gz
3-Last Run:
A script that scans all URLs in the current page, written in Ruby, is a good example of learning Ruby's friends.
#scanweb.rb #用法ruby scanweb.rb www.jb51.net 将当前结果保存在c:\1.txt require 'net/http' filename= File.new('c:\1.txt',"w+") if $*[0]==nil puts "
Dynamic programming solves the problem of matrix multiplication, randomly produces matrix sequence, output form ((A1 (A2A3)) (A4A5) results.
Code:
#encoding: Utf-8 =begin author:xu jin, 4100213 date:oct, Matrixchain to find a optimum order by
Regular expressions are a special sequence of characters that can help match or find other strings or string sets, using patterns that maintain a specialized syntax.
The regular expression literal is a pattern between a slash or any delimiter%r as
Variable holds the location where the data for the program to be used is stored.
There are five types of variables supported by Ruby. A brief description and these variables have been experienced in the previous chapters. These five types of
Some important differences between Ruby language and C # are:
1.ruby is a dynamic language, C # is a static language--that is, after the object is new, Ruby can also dynamically add some properties or methods to the object instance (JavaScript is
What is an accessor?We've discussed the real variables before, but not too much discussion. The real variable of an object belongs to its property and is a general difference from other objects from the same class. It is important to read and write
1.whenever
First, the whenever is based on the Linux cron service, so there is no direct way to use the gem on the Windows platform. Whenever should technically be a cron translator, translating the Ruby code into a cron script, and handing the
In Ruby we define a WC method that is used to count the number of lines of text, words, and characters that appear in a file, and the Ruby Code program is as follows:
Copy Code code as follows:
def WC (filename)
nline = Nword = NCHAR = 0
%{string} is used to create a string enclosed in double quotes%q{string} is used to create a string enclosed in double quotes
Copy Code code as follows:
Str=A string
End_of_string
%q! Some String of "Characters"! "Some
A previous article about the use of Git hook deployment application, hook method has a flaw is to go to the server every time to modify the hook corresponding configuration file, this profile is separated from the current warehouse, debugging will
Sass for the CSS to give the characteristics of dynamic language, such as variables, inheritance, operations, functions, etc., more convenient for the writing and maintenance of CSS!
Sass Installation
Because SASS relies on the ruby environment,
Recently I got a lot of pictures from the designer, the results are 1.png,2.png such file name, they also need to make these files into a readable file name, do not want one to be modified, so wrote a simple script to achieve a lot of multiple files
Active record makes it easy to implement CRUD database basics, in the following sections we use the Orders table in the MySQL database for CRUD operations, this time we look at the creation.
We're supposed to have a model called Order:
Class
One of the objects in the ActiveRecord corresponds to a row of tables in the database, and the object's properties correspond to the columns of the table, and you may notice that our order class does not mention anything about the Orders table
ActiveRecord is an object-relational mapping (ORM) layer provided by rails, starting with the basics of active record, connecting databases, mapping tables, accessing data, and more.
Active record uses basic ORM mode: tables are mapped to classes,
So the implementation of our shopping cart is complete, and we can use Ruby's rdoc to generate documentation for our programs, like Dotnet,java,python, RDoc can extract the annotations from the class and method declarations in our code to generate
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.
A Free Trial That Lets You Build Big!
Start building with 50+ products and up to 12 months usage for Elastic Compute Service