ArticleDirectory
1. Install thin
2. Start and Stop thin
3. Cluster
4. runlevels
5. Run rails
1. Install thin
Gem install thin
He will need some gem support.
Rack-0.9.1Eventmachine-0.12.6Daemons-1.0.10Thin-1.0.0
Of
1. Japanese to UTF-8Differences between iconv. New ('cp932', 'utf-8') and iconv. New ('shift _ JIS ', 'utf-8')
Iconv. New ('shift _ JIS ', 'utf-8') does not support the following formats:
When bytes 001-18 xxxxxxx, you can only replace the bytes
Ruby's array is basically used. Compared with arrays in C #, the least habit is to allow negative indexes (somewhat similar to Javascript)
Arr = [3, 4, 5, 6, 7, 8, 9] puts arr [0] #3 puts arr. first #3 puts arr [arr. length-1] #9 puts arr [arr.
I have written a simple unit test library for myself in Ruby over the past few days. It feels a little DSL.
It seems that there is no ruby format. Use Lua to make it together.
Sample Code:
Code highlighting produced by Actipro CodeHighlighter
Ror deployment methods are divided into front-end and back-end architectures:
I. Front-end
The frontend is used to process static resources, distribute dynamic requests to the backend, and sometimes provide some additional functions, such as
Why am I a senior. net
Program Employee, after a month of Ruby on Rails learning, he will think: only after I understand Ruby on Rails, in order to complete many previously developed applications with less time and coding?
You are a senior. Net
I. Create a table (using Ruby script/generate model attach) and generate a model.
Open dB/migrage/007_create_attaches.rb and change it
Class createattaches Def self. Up
Create_table: attaches,: force => true do | T |
T. Column: name,: string #
Ruby identifiers are used to point to constants, variables, methods, classes, and modules. The first letter of the identifiers helps us determine the scope of the content that the identifiers direct.
Ruby is case sensitive.
Ruby uses a convention
transfer character meaning:
serial number, for example, \ D [0-9] numeric character \ D [^ 0-9] Except for any number character \ s [\ s \ t \ n \ f blank character \ s [^ \ s \ t \ n \ f] any character except blank character \ W [A-Za-z0-9 _]
I have seen several articles about Ruby on Rails (ROR) recently.ArticleYou can't help but download a copy of it to try it out.
The reference document creates a very simple system and does not take much time, mainly because the scaffold function
A class method is also called a static method. It is called by class name. Instance method. You must create a new instance before using it.
Class Foo def self. bar puts 'class method' end def Baz puts 'instance method' endendfoo. bar # class
Read an object and print it out:
Lines = file. open ('dom. js '). readlinesputs "=================================" lines. each {| Line | puts (line )}
Or:
File. Open ("dom. js") Do | file | while line = file. Gets puts line endend
The
I think it's up to me to wait for me to take the DBA test. To be a DBA or to be a programmer it's a questions. In fact, I personally prefer to do this.ProgramDesign, but considering my personality, I feel more appropriate to be a DBA. In the
I want to be a professional technical writer, but I am too emotional to write rigorous technology.Article, Always like to show too many emotional colors in your own articles. This series of articles shows my recent feelings from the name, and it is
Linux installation: I used the source code compilation method for installation. The operating system is Red Hat Linux release 7.3 (Valhalla)
Download from the ruby Main SiteSource code, "Get Ruby now!" on the right of the Home Page !! ", Which
Mailfactory is a simple mail package on rubyforge. With this package, we can easily send emails with attachments and HTML formats. However, currently, mailfactory has some problems in Chinese support, A patch is required.
Install mailfactory
From the technical point of view, Ruby itself is really nice.ProgramThe work of Members becomes easy and interesting!The followingCodeDemonstrate how to find a prime number less than 100:
Copy code The Code is as follows: using system;
Namespace
Unlike Java, Ruby does not support Unicode internally (it is said that Unicode is supported by 2.0, but not confirmed)In character encoding, Ruby uses the iconv library of Open Group. This library appears to be available by default in Linux, but
You may have noticed that in our previous code, the database definition uses an integer field id as the primary key, which is a convention of Active Record.
Maybe you have to ask, why don't we use order numbers or a meaningful column as the
Recently I started to learn ruby. to practice the basic syntax, I used ruby to write an insert sorting algorithm, which may be a trace of translation from C #.
1. Insert sorting
Seq = [3, 4, 9, 0, 2, 5, 9, 7, 1]1. upto (seq. length-1) do | I |If
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.