ROR Official website:http://www.rubyonrails.org/As a starting point for understanding the technology, there's a 15-minute video that builds a blog that's worth a visit.Rolling with Ruby on
After using the rails new appname to build rails applications, we can view the directory structure of Rails applications through tree:
Directory structure
The application directory will have 11 directories of App, config, DB, Doc, lib, log, public,
Agent modeProxy proxy mode is a structural design pattern, the main problem is: The problem of direct access to the object, such as: the object to be accessed on the remote machine. In object-oriented systems, there are some objects that for some
Ruby has 4 comparison methods, equal, eql, = =, = =, and behaves differently in different classes. In the use of time is also particularly easy to confuse. This blog post will demonstrate some code to explain each method.
= =-Class sense equality,
Mark your unfinished scene with the @wip (work in progress) tab. These scenarios are not taken into account and are not marked as test failures. When an unfinished scenario is completed and the functional test passes, the @wip tag should be removed
1. In proc and lambda, the return keyword has different meanings :In proc, return only means returning from this lambda.In a lambda, return is not returned from the proc, but rather from the scope in which the proc is defined.
Copy Code code
A collection of hashing-value pairs, similar to this: "Employee" => "salary". It is similar to an array, except that the index is the type of any object that passes through any key, not an integer index.
Sequential traversal of a hashing or value
Ruby arrays are ordered, any object's?? A collection of integer indices. The elements in each array are associated with an index mentioned.
The array subscript starts at 0, such as C or Java. The negative index assumes the end of the array---that
Ruby,nokogori, crawl through the latest 10 pages plus picture ratio and save it both in text and database
Copy Code code as follows:
#encoding: Utf-8
Require "Open-uri"
Require "Nokogiri"
Require "MySQL"
@dbh =mysql.real_connect
Git warehouse outputGit Archive--format=tar--prefix=actasfavor/head | (cd/home/holin/work/&& Tar XF-)Output to the/home/holin/work/actasfavor/directoryPosted by Holin at May 16, 2008 16:42Load controller and model in plugins# Include Hook code
And since Ruby is a completely pure object-oriented language, anything is an object, the method is an object, and the class is an object ..., so self has a lot of environments that distinguish the self meaning of different environments to better
N+1 problem
The n+1 problem is one of the most common performance issues in database access, and first describes what a n+1 problem is:
For example, we have two tables in our database, one is customers, and the other is orders. The orders contains
Recently there is a need to show the number as a fixed number of digits, the number of digits in the front with 0 supplements
Like 5-bit:
Copy Code code as follows:
3-> 00003
292-> 00292
12422-> 12422
It's easy to find Ruby.
Exceptions and executions are always linked together. If you open a file that does not exist and you do not properly handle the situation, your program is considered to be of low quality.
If an exception occurs, the program stops. Exceptions are
Ruby in the implementation of Web crawl, the general use is mechanize, very simple to use.
Installation
Copy Code code as follows:
sudo gem install mechanize
Crawl Web pages
Copy Code code as follows:
Require '
Recently participated in the seven-cow demo contest, decided to use Ruby development. So I ran into some questions and then solved them, and here's a record.
In Ruby, Gem is a very common thing, it is the equivalent of Plug-ins, Ruby has a lot of
I tried to install Ruby through rbenv, but it failed, as shown in the title.
A similar error was reported on the Ruby-build, and the author also gave a description of the environmental requirements on the wiki. But there was no mention of the
To raise this question is to have an objective attitude towards the way of thinking.For the programming language, I have always felt that those I have not used, listening to some of the cows have mentioned the language is better.I have been to
Ruby implements the insertion Sorting Algorithm and the advanced two-way insertion sorting code example, ruby two-way
BasicInsert a record to a sorted table to obtain an ordered table with one added record. In addition, the most critical point is
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.