Some important differences between Ruby and C # are as follows:
1. Ruby is a dynamic language, and C # Is a static language-that is, after an object is new, Ruby can dynamically add some attributes or methods to the object instance (as does
I won't go into any further discussions about symbol. I just want to talk about the advantages of it.
Each object in ruby is identified and distinguished by a digital ID. You can use XXX. object_id to view the ID.
Puts "0001". object_idputs "0001
ProgramEncoding is generally divided into several situations:1. source code file encoding2. receive external Content Encoding3. Runtime Environment Code4. Operating System Code
First, you can add a line of declaration in the header of the Ruby
5Use other synchronization Technologies
Another synchronization mechanism is the monitor, which Ruby implements in the monitor. RB library. This technology is more advanced than mutex. In particular, mutex locks cannot be nested, but listener
Begin
#
Start
Raise
..
#
Throw an exception
Rescue [exceptiontype = standardexception]
#
Capture exceptions of the specified type. The default value is standardexception.
$!
#
Exception Information
$ @
#
When I started my ruby journey, I wrote my study notes for people with other OO language experiences. Let's take a look at the magic ruby.
The first sample! First meeting.
#
! /Usr/bin/ENV Ruby
Class
MegagreeterAttr_accessor: names
Unlike Java, super in Ruby replaces not the parent class, but the method with the same name as the current method in the parent class. In Ruby, super is used flexibly. When super is used, without any parameters (and no parentheses), the actual
This note is used to help understand the "The ruby language allows us to define classes based on an object so that we can expand the behavior of an object separately. The example is as follows:Test = "hello" # normal string
Normal = A. DUP # normal
In Ruby, how does one perform Chinese Word Segmentation search?
This issue is currently under consideration,Target is to useFerret,Ferret is the ruby version of Lucene search engine. With a little Lucene experience, I personally like ferret very
Bruce Tate's beyond JavaArgue that JavaAs the preferred language for enterprise development, the rule will eventually end, and enterprise innovation also takes place in Java for the first time in ten years.Out of the domain. In that book, he
Finally, let's look at distributed programming in ruby. Nowadays, the network is very common. Sometimes we want to transmit various objects on the network, but unfortunately, protocols like CORBA and RMI are very laborious to use and require special
1. Write CGI
A simple CGI program is as follows:
#! /Usr/bin/ENV RubyPrint "HTTP/1.0 200 okrn"Print "Content-Type: text/htmlrnrn"Print "Hello world! RN"
We can use Ruby to process submitted parameters, fill templates, generate HTML, and so on, but
Phprpc + Ruby + Arduino = led turn-on (?) Well, I know this is a very boring sample.
For phprpc and Arduino, Google
Before reading this demo, please install the SerialPort mentioned in another article.
With another gem
KIT: phprpc
In this example,
It is very easy to use Ruby to get the page content. I checked the information and tried to write an email sending code. It seems that Ruby is used to implement "Java calls jruby to get webpage content (jdk1.5) "The requirement in this article is
Currently, ruport supports output in PDF, HTML, CSV, and TXT formats. What if you want to print. xml and. Bat reports?
This example uses the XML format as an example to implement another custom application of ruport: formatter.
Ruport application
Ruby tips Thor
Http://asciicasts.com/episodes/242-thorSinatra
Sinatra is a set of micro-web small frameworks that combine small Web apps or for Web Services. It is neither MVC nor built-in Orm. The most important thing is that it provides a set of
In the previous content, we created the order Model and the representation page. This time, we will continue to compile the CHECKOUT process.
1. On the checkout. rhtml page, there is a CHECKOUT button that has not been written for it last time.
Ror Official Website:Http://www.rubyonrails.org/It can be used as a starting point for understanding this technology. There is a video worth watching to build a blog within 15 minutes.
Rolling with Ruby on Rails:Http://www.onlamp.com/pub/a/onlamp/200
Ruby processes strings like numbers. We enclose them with single quotation marks ('...') or double quotation marks.Ruby> "abc""Abc"Ruby> 'abc'"Abc"Single quotation marks and double quotation marks have different functions in some cases. A string
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.