Time of Update: 2015-03-31
標籤:attr_reader方法------讀取執行個體變數attr_writer方法------改寫執行個體變數attr_accessor方法-----讀寫執行個體變數 class Person attr_reader :name ---------1 attr_writer :name ---------2 def initialize(name) @name = name endend1 相當於: def name @nameend2 相當於:def
Time of Update: 2015-06-09
標籤:Ruby on Rails on Mac====================================================================================http://morizyun.github.io/blog/marvericks-rails-setup-ruby-rvm-msyql/for general : useful :
Time of Update: 2015-05-21
標籤:在安裝CocoaPods之前要先配置好RUBY環境,本文就怎麼安裝RUBY的環境進行一總結。安裝Ruby環境首先需要安裝Xcode然後需要安裝Homebrew,接下來需要安裝RVM最後安裝Ruby環境。安裝XCode就不用說了,大家都會。Homebrew是一個包管理器,用於在mac上安裝一些os x上沒有的UNiX工具。Homebrew將這些工具統統安裝到了 /usr/local/Cellar 目錄中,並在 /usr/local/bin
Time of Update: 2015-04-16
標籤:素數篩法 linux64 nasm 彙編 在博文(1)和(2)裡分別用了4中方式寫一個素數篩選的演算法,分別是javascript in browser、node.js、ruby和c;最終的結果是c最快,node.js其次,js in
Time of Update: 2015-12-12
標籤:Ruby on Rails 是一個可以使你開發,部署,維護 web 應用程式變得簡單的架構。2015年10月程式設計語言熱門排行榜 Ruby進入TIOBE熱門排行榜前十,可見其流行程度如此之高。本文就幫你開啟Ruby on Rails Web開發的大門,助你進入Ruby on Rails的世界,感受不一樣的風景。Ruby on
Time of Update: 2015-12-22
標籤:注釋單行注釋就是 #多行注釋比較奇怪是 用 = begin 和 =end#!/usr/bin/ruby -wputs "Hello, Ruby!"=begin這是一個多行注釋。可擴充至任意數量的行。但 =begin 和 =end 只能出現在第一行和最後一行。 =end條件判斷if conditional [then] code...[elsif conditional [then] code...]...[else code...]endif 運算式用於條件執行。
Time of Update: 2015-06-27
標籤:rubyreturn,break,next 這幾個關鍵字的使用都涉及到跳出範圍的問題,而他們的不同 則在於不同的關鍵字跳出去的目的範圍的不同,因為有代碼塊則導致有一些地方需要格外注意。return常用方式通常情況下的return語句和大家理解的意思是相同的。 def m1 param if param == 1 return ‘returned 1‘ end ‘returned default
Time of Update: 2015-05-06
標籤:首先看下他們的關係 irb(main):100:0> String.class => Class irb(main):101:0> String.class.superclass => Module irb(main):102:0> String.class.superclass.superclass => Object class < Module <
Time of Update: 2015-04-11
標籤:代碼塊在其他的語言中都或多或少接觸過一些,如perl中sort{$a<=>$b}keys,傳入代碼塊實現按數值排序,在swift中用到閉包,更加深入學習到training closure、capturing value等代碼風格,對代碼塊有了深入的瞭解,並且意識到代碼塊是參考型別(Reference Type),和Value
Time of Update: 2015-04-05
標籤:如何快速正確的安裝 Ruby, Rails 運行環境https://ruby-china.org/wiki/install_ruby_guide對於新入門的開發人員,如何安裝 Ruby, Ruby Gems 和 Rails 的運行環境可能會是個問題,本頁主要介紹如何用一條靠譜的路子快速安裝 Ruby 開發環境。次安裝方法同樣適用於產品環境!系統需求首先確定作業系統環境,不建議在 Windows 上面搞,所以你需要用:Mac OS X任意 Linux 發行版本(Ubuntu,CentOS,
Time of Update: 2015-01-14
標籤:步驟1安裝homebrew, 通過它安裝系統所需要的包ruby -e "$(curl -fsSL https://raw.github.com/mxcl/homebrew/go/install)"安裝完成後,brew doctor 自檢一下步驟2安裝curl -L https://get.rvm.io | bash -s stablesource ~/.rvm/scripts/rvm$ rvm -vrvm 1.26.4 (master) by Wayne E. Seguin
Time of Update: 2015-01-05
標籤:ruby wc 統計單詞數和行數等 在Ruby中我們定義一個wc方法,用來統計檔案中出現的文本行數、單詞數和字元數,ruby代碼程式如下:def wc(filename) nline = nword = nchar = 0 File.open(filename) do
Time of Update: 2014-12-30
標籤:第二章類繼承,屬性,類變數1.如何聲明一個子類class Treasure < Thing這樣Thing類中的屬性name,description都被Treasure繼承 2.以下三種方式傳入父類initialize方法的參數分別是什嗎?# This passes a, b, c to the superclassdef initialize( a, b, c, d, e, f ) super( a, b, c )end# This passes a, b, c to
Time of Update: 2014-12-28
標籤:第一章字串,數字,類和對象為了證明Ruby真的好用,hello world也能寫的如此簡潔: puts ‘hello world‘ 1.輸入/輸出print(‘Enter your name‘)name=gets()puts("Hello #{name}") 註:Ruby是區分大小寫的 2.String類 puts("Hello #{name}")中的變數 name是內嵌在整個String裡的,通過 #{ } 包裹進行內嵌求值,並用雙引號""
Time of Update: 2014-12-03
標籤:style blog http io ar os 使用 sp java 通過form來建立資料,本章節將會涉及內容:建立form,使用者重導向,渲染views 和
Time of Update: 2014-12-01
標籤:ruby 檔案相似性 外部編碼 1.相似度定義我們定義,則,我們設,則,|C|=s,則相似度p=,p(0,1)2.相似度檢測演算法設計
Time of Update: 2014-08-19
標籤:java io 檔案 ar art 問題 size ef 近在Netbeans中用ruby時,發現輸出的中文全是亂碼,解決方案如下:在Netbeans的安裝目錄中找到etc目錄,然後開啟這個目錄,然後用把此檔案在netbe
Time of Update: 2014-07-31
標籤:style blog color 使用 strong 資料 ar 代碼 ruby具有在運行時執行以字串形式儲存的代碼的功能設施,eval族方法 。包括Kernel#eval,Object#instance_eval,
Time of Update: 2014-07-30
標籤:aws sqs ruby demo # Amazon SQS搜集整理aws sqs 的文檔以及使用Ruby demo## Amazon Simple Queue Service (SQS) 是一個可伸縮且可靠的訊息傳遞架構,可以使用它簡便地建立、儲存和擷取簡訊。可以使用它構建基於 Amazon Web Services 的應用程式。使用 SQS 是構建鬆散耦合的 Web
Time of Update: 2014-10-18
部署Ruby伺服器,部署ruby# 建立項目相關目錄/opt/logs/tv-cibn-cms#ruby 使用者下安裝 rbenv 及 ruby 1.9.3# 安裝編譯相關包yum install -y gcc openssl-devel libyaml-devel readline-devel zlib-develsu - ruby #/home/ruby# 安裝 rbenvgit clone https://github.com/sstephenson/rbenv.git ~/.