Time of Update: 2014-10-21
標籤:blog io os sp 資料 div on cti log class MysqlTest #Code here require "mysql" def testMysql
Time of Update: 2015-03-04
標籤:ubuntu升級ruby到2.1 1.安裝前更新: sudo apt-get -y updatesudo apt-get install cmakesudo apt-get install -y build-essential zlib1g-dev libyaml-dev libssl-dev libgdbm-dev libreadline-dev libncurses5-dev libffi-dev curl git-core openssh-server redis-server
Time of Update: 2015-03-14
標籤:Since the original tech preview release of FastCGI last year, we‘ve been seeing a lot of requests for getting Ruby on Rails running with our FastCGI. Theoretically, since the FastCGI component uses a standard protocol to support
Time of Update: 2015-01-30
標籤:Ruby 安裝從原始碼在windows下安裝Ruby是非常苦逼的差事,可以從http://rubyinstaller.org/或者 http://railsinstaller.org/ 下載已經打包好的安裝程式。Ruby配置在windows中配置環境變數RUBY_HOME=rubyinstaller_dir (實際的ruby所在路徑)在path中添加 %RUBY_HOME%\bin在命令列下運行 ruby
Time of Update: 2015-03-31
標籤:module 的主要目的是把不同的方法和常量分別放進不同的命名空間。module 的命名方式跟類一樣首字母大寫,多個單詞不用底線。 如:CircleAreamodule 文法 module ModuleName ...... endmodule用範圍解析操作符“::”來調用module中的方法和常量。 如:Math::PI, Math
Time of Update: 2015-02-06
標籤:article = nilarticle.nil? # => trueempty? checks if an element - like a string or an array f.e. - is empty:# Array[].empty? #=> true# String"".empty? #=> trueRails adds the method blank? to the Object class:An object is blank if
Time of Update: 2015-01-09
標籤:ruby on rails一、環境安裝centos 作業系統1、安裝rvmcurl -sSL https://get.rvm.io | bash -s stable rvm -v查看是否安裝成功2、安裝rubyrvm install 1.9.3ruby -v 查看ruby版本號碼Rvm命令簡單使用介紹: rvm install ruby &
Time of Update: 2015-01-07
標籤:需求:實現一個簡曆類,必須要有姓名,可以設定性別和年齡,可以設定工作經曆。最終需要三個簡曆初步實現:# -*- encoding: utf-8 -*-#簡曆類class Resume attr_accessor :name, :sex, :age, :time_area, :company def initialize(name) @name = name end def set_personal_info(sex, age)
Time of Update: 2015-01-05
標籤:首先,methods,private_methods是Object類的執行個體方法;instance_methods是Module類的執行個體方法。我們先來看看這樣安排的原因:我們知道一個Ruby對象所能調用的方法包含在其祖先鏈中(包含這個對象的單例類).這裡所說的Ruby對象可以分為2類,一類是普通對象,像"abc",2,obj=Object.new這種對象,它們所屬的類分別是String,Fixnum,Object,我們稱這種對象為普通對象;還有一類對象是類(類本身
Time of Update: 2014-12-18
標籤:des style ar io color os sp for strong IDE: Jetbrains
Time of Update: 2014-12-03
標籤:blog http io ar os sp on 檔案 資料 之前的index頁,顯示的是hello world,現在將其修改為顯示我們在rails console裡面錄入的資料。1.
Time of Update: 2014-06-28
標籤:style blog http color 使用 strong 一、比較語句大部分和其他的語言一樣,這裡注意<=>、 條件陳述式如下幾種形式ifif ..else.. endif..elsif..else..endunless(if
Time of Update: 2014-10-23
標籤:des style blog http io os ar java for how to build a ruby gem 1. first you will creata a
Time of Update: 2014-10-19
標籤:style blog http sp 2014 log bs line as Ruby的case運算式有兩種形式:第一種形式接近於一組連續的if語句:它讓你列出一組條件,並執行第一個為真的
Time of Update: 2014-07-17
標籤:style os width io for 問題 Ruby的Regex為Regexp類的對象主要的元語言字元
Time of Update: 2014-07-16
標籤:style blog http color art for 隱馬爾科夫模型中有三個問題:1) 估計問題:給定一個觀察序列O=O1O2...OT和模型u = (A, B,
Time of Update: 2018-12-08
單從技術而言,ruby本身確實很爽,令程式員的工作變得輕鬆有趣! 下面的代碼示範了如何找出100以內的素數: 複製代碼 代碼如下:using System; namespace Mersenne { class Program { static void Main(string[] args) { for (int i = 2; i < 50; i++) { if (CheckDigital(i)) { Console.WriteLine("{0} ",i); } }
Time of Update: 2018-12-08
前面一節的 Fruit 類有兩個實變數,分別表述水果的類型和狀態.直到為這個類寫了一個定製的inspect方法,我們方才瞭解它不會對一個缺乏屬性的水果做出合理的解釋.幸運的是,Ruby提供了一種允許實變數總是被初始化的方法. initalize方法 當Ruby建立一個新對象時,它總是會尋找一個名為 initialize 的方法並執行它.因此,我們可以簡單通過一個initialize方法向實變數中加入預設值,這樣一來, inspect方法就有東西可說了. ruby> class Fruit
Time of Update: 2018-12-07
一、建立檔案 f=File.new(File.join("C:","Test.txt"), "w+")f.puts("I am Jack")f.puts("Hello World")檔案模式"r" :Read-only. Starts at beginning of file (default mode). "r+" :Read-write. Starts at beginning of file. "w" :Write-only. Truncates existing file to
Time of Update: 2018-12-07
從陌生,到有了初步認識;從閱讀到動手實踐,想說,你很美!Ruby 是一種純粹的物件導向的指令碼語言,它由日本的 Yukihiro Matsumoto 開發。設計這種語言主要是用來控制文本處理(和Regex又有關係了)和系統管理任務。轉自IBM:用 Ruby 語言編程正如下面的樣本所示,任何曾經編寫過如 Perl 或 PHP 等指令碼語言的人都會熟悉 Ruby 文法。但是,Perl 或 PHP 需要使用分號作為一個行結束符,Ruby