Because Windows file deletion mechanism is different from Unix like, so does not guarantee that the following code can be used in Windows, which child upper I test in Windows also good AH!
Copy Code code as follows:
#!/usr/bin/ruby
Arr = [1, 2, 3]
1) arr2 = arr. each {| element = element * 2} # Both arr and arr2 are still equal to [1, 2, 3] each. The changes to elements in the original array traversal are not saved.2) arr2 = arr. map {| element = element * 2} # arr is equal
I will first write down some of my experiences over the past two days.
1. How to Use gem to delete new versions and retain old versions
We know that the method for clearing the old version of GEM is to update the new version of GEM cleanup. But if
How to use Ruby for Windows shell programming.
For example, create an Internet Explorer instance.
Require
"
Win32ole
"
#
Include library
IE
=
Win32ole. New (
'
Internetexplorer. Application
'
)Ie. Visible
=
This section describes the fileutils module of the file class filetest module of the Dir class.
-------------------------------------------------------------Directory operation: Use the static method of the Dir class or create an Instance Object
One project uses the ruby language, which is not supported by sourceinsight by default. The supported methods are as follows:
1. Visit the sourceinsight official website to obtain Ruby language support.
Http://www.sourceinsight.com/public/,
Ruby Deployment Tool Overview: vglad 1.3 release and Capistrano handover and Maintenance
The recent message about jamis Buck's stopping Capistrano development has caused many people to worry about the future of the Deployment Tool. Fortunately, the
You have written a script for the new feature, but this feature does not allow adding records of the same name. What should I do?
Delete related records during initialization? If you are not familiar with the business, the table structure, and the
When testing the model, one change was observe. I wanted to test it, but the observer refused to execute it in rspec, but there was no problem with test env in the console.
It took me a day to debug and finally failed to solve the problem. If you
My environment is Ruby 1.9.2p290 + rails2.3.4 + mysql5.5.15. When I run "DB: migrate", the error message is as follows:!!! The bundled mysql. RB driver has been removed from rails 2.2. Please install the MySQL gem and try again: Gem install
ArticleDirectory
Ruby-adding a directory to $ load_path-what does it do?
Similarities: all three are defined in the kernel and contain the meaning of something.
Differences:
1. requre and load are used for files ending with. RB.
In Ruby, the so-called block-based method refers to the abstraction of the control structure. It was initially designed to abstract loops, so it is also called an iterator.Syntax: method_name do... end or method_name {}
1
#
Block call
"Require" can be merged into. RB proposal, and can be omitted ". RB ". in addition, it will only commit at the first time. If it is "require" again, it will ignore
Code highlighting produced by Actipro CodeHighlighter
Use netbeans debug RubyCode
Netbean debug Ruby
Debug Ruby code in netbeans
1. Get the gems package ruby-debug-ide-0.4.6.gem for ruby-debug-ide now I only see 0.4.6 and 0.4.5 available, and other high versions will always have issues
2.
I. Judgment Structure
If
ExpressionElsif expression
Else
End
IfExpression then end#Use then when writing a line
IfExpression#When the expression returns true, run the preceding code.
... Unless expression#When the expression is
Ruby supports arrays and hash. Both arrays and hash are accessed through indexes. The difference is that arrays are indexed by numbers, while hash indexes can be any object, therefore, the array access speed is faster (direct positioning), while
Conversion of GBK and UTF-8
Use GBK instead of gb2312, because GBK not only contains simplified Chinese, but also traditional Chinese, is a large character set.
#
Utf8 to GBK
Def
U2g (ucode)Begin
"
# {Iconv. Conv ('gbk', 'utf-8',
Http://article.yeeyan.org/view/52654/18184
Rack provides interfaces between the Web server and the ruby development framework. It frees framework writers from the heavy burden of writing a processing module for each web server, saving a lot of
Ruby on Rails win Installation
I found the new technology Ruby on Rails. I will not talk about it any more. Let's talk about my installation process today!
First, download
Http://rubyforge.org/projects/rubyinstaller/
I got the latest! Then install
Ruby used to learn a lot from perl, one of which is the global magic variable. Among these variables, it is estimated that no $ _ is more strange. For example, the gets method has this effect: while returning the row data you just read, it also
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