background preloader

Your community gem host

Your community gem host

Related:  RubyRuby CodingRuby on Rails November 09, 2005 REXML (Ruby Electric XML) is the XML processor of choice for Ruby programmers. It comes bundled with the standard Ruby distribution. It's fast, written in Ruby, and can be used in two ways: tree parsing and stream parsing. In this article, we show some basic constructs on how to use REXML for XML processing.

Ruby in Twenty Minutes Now let’s create a greeter object and use it: irb(main):035:0> g ="Pat")=> #<Greeter:0x16cac @name="Pat">irb(main):036:0> g.say_hiHi Pat!=> nilirb(main):037:0> g.say_byeBye Pat, come back soon.=> nil Once the g object is created, it remembers that the name is Pat. Hmm, what if we want to get at the name directly? Arduino Firmata on Ruby Firmata is a protocol to controll Arduino from software on PC. You can embed Arduino code into Ruby application. This library supports sharing an Arduino between multiple processes. % gem install arduino_firmata Ruby 1.8.7 or 1.9.2 or 1.9.3 or 2.0.0 testing with Arduino Diecimila, Duemillanove, UNO, Leonardo, Micro and Seeduino v2 Arduino Standard Firmata v2.2 Arduino IDE -> [File] -> [Examples] -> [Firmata] -> [StandardFirmata] ArduinoFirmata Command

Global variables A global variable has a name beginning with $. It can be referred to from anywhere in a program. Before initialization, a global variable has the special value nil. Numbers in Ruby: Ruby Study Notes - Best Ruby Guide, Ruby Tutorial Let's play with Numbers. In Ruby, numbers without decimal points are called integers, and numbers with decimal points are usually called floating-point numbers or, more simply, floats (you must place at least one digit before the decimal point). An integer literal is simply a sequence of digits eg. 0, 123, 123456789. Underscores may be inserted into integer literals (though not at the beginning or end), and this feature is sometimes used as a thousands separator eg. 1_000_000_000.

從無到有: 安裝 & 自動部署 Ruby on Rails 網站. 這個月把網站從 Amazon EC2 搬回自己的 server, 目前整個環境是 Linux(Ubuntu) + Apache + Ruby on Rails 在跑, 筆記一下從無到有的配置方法: 虛擬主機, 另一個較有名的是 VMWare, 這裡是選用 VirtualBox 4.2.12 作 host. 安裝之後設定一下配置, 大部份都用預設的就可以, 比較不一樣的地方有, 記憶體 1024 MB, 網路使用橋接界面卡的方式, 這樣可以在虛擬 OS 內連線取得固定 IP, 這對使用自有網址來架設網站是很重要的. 下載 Ubuntu 最新版本, 這裡使用 13.04, 然後將映像擋掛載在 VirtualBox 後啟動, 照指示一步一步安裝. Learn Ruby The Hard Way If you did the Study Drills from the last exercise you should have seen all sorts of commands (methods/functions) you can give to files. Here's the list of commands I want you to remember: close -- Closes the file.

Learn Ruby The Hard Way This exercise has no code. It is simply the exercise you complete to get your computer to run Ruby. You should follow these instructions as exactly as possible. For example, Mac OS X computers already have Ruby 2, so do not install Ruby 3 (or any Ruby). A major part of this book is learning to research programming topics online.