欧美性猛交XXXX免费看蜜桃,成人网18免费韩国,亚洲国产成人精品区综合,欧美日韩一区二区三区高清不卡,亚洲综合一区二区精品久久

打開(kāi)APP
userphoto
未登錄

開(kāi)通VIP,暢享免費電子書(shū)等14項超值服

開(kāi)通VIP
新手RoR十分鐘初體驗Step By Step rails Ruby

聲明一下,這是個(gè)新手啟動(dòng)的體驗文章,高手不要看了。。。:)

1、安裝Ruby
Windows用戶(hù)去 http://rubyforge.org/http://rubyforge.org/projects/rubyinstaller/ 下載 One-Click Installer - Windows 安裝即可,最新版1.8.5-21

2、測試是否安裝成功
建議一個(gè)Test.rb文件,內容如下

  1. hello = "Hello Ruby World."  
  2. puts hello  

在命令行下運行 ruby Test.rb ,注意安裝時(shí)%RUBY_HOME%\bin已經(jīng)設置在你的PATH中了,檢查一下即可,運行正確的話(huà)就會(huì )顯示
Hello Ruby World.
結果出來(lái)

也可以啟動(dòng)FreeRIDE,新建一個(gè)文件,保存,按F5就可以運行得到結果了。在FreeRIDE的Edit菜單==>Preferences...==>Debugger/Run的右邊,選中Run process in terminal,運行時(shí)可以打開(kāi)新的窗口來(lái)查看,默認在FreeRIDE下面顯示結果。

3、利用gem安裝其它模塊
在命令行下運行 gem install rails
安裝提示與結果
Install required dependency activesupport? [Yn]  y
Install required dependency activerecord? [Yn]  y
Install required dependency actionpack? [Yn]  y
Install required dependency actionmailer? [Yn]  y
Install required dependency actionwebservice? [Yn]  y
Successfully installed rails-1.1.6
Successfully installed activesupport-1.3.1
Successfully installed activerecord-1.14.4
Successfully installed actionpack-1.12.5
Successfully installed actionmailer-1.2.5
Successfully installed actionwebservice-1.1.6
Installing ri documentation for activesupport-1.3.1...
Installing ri documentation for activerecord-1.14.4...
Installing ri documentation for actionpack-1.12.5...
Installing ri documentation for actionmailer-1.2.5...
Installing ri documentation for actionwebservice-1.1.6...
Installing RDoc documentation for activesupport-1.3.1...
Installing RDoc documentation for activerecord-1.14.4...
Installing RDoc documentation for actionpack-1.12.5...
Installing RDoc documentation for actionmailer-1.2.5...
Installing RDoc documentation for actionwebservice-1.1.6...

再運行gem list檢查一下看是否安裝上去了,會(huì )有一堆列表顯示,新的也在里面,安裝前后各gem list一下,就可以對比得到以下結果

4、安裝后各模塊介紹
actionmailer (1.2.5) 郵件分發(fā)與測試模塊,類(lèi)似Java里的JavaMail的東東
actionpack (1.12.5) 類(lèi)似于Web的MVC中的V與C
actionwebservice (1.1.6) Web Service支持
activerecord (1.14.4) ORM工具,類(lèi)似Java中的Hibernate之類(lèi)的
activesupport (1.3.1) Rails框架所依賴(lài)的一些基礎工具類(lèi)
rails (1.1.6) Web應用框架Rails包含模板引擎,控制層及ORM

5、默認安裝后的模塊有
fxri (0.3.3)
    Graphical interface to the RI documentation, with search engine.
fxruby (1.6.1, 1.2.6)
    FXRuby is the Ruby binding to the FOX GUI toolkit.
log4r (1.0.5) 日志庫,Java中就象Log4J或Jakarta的Commons-Logging
rake (0.7.1) 類(lèi)似make的工具,Java中就象Ant或Maven
sources (0.0.1)
    This package provides download sources for remote gem installation
win32-clipboard (0.4.0)
    A package for interacting with the Windows clipboard
win32-dir (0.3.0)
    Extra constants and methods for the Dir class on Windows.
win32-eventlog (0.4.1)
    Interface for the MS Windows Event Log.
win32-file (0.5.2)
    Extra or redefined methods for the File class on Windows.
win32-file-stat (1.2.2)
    A File::Stat class tailored to MS Windows
win32-process (0.4.2)
    Adds fork, wait, wait2, waitpid, waitpid2 and a special kill method
win32-sapi (0.1.3)
    An interface to the MS SAPI (Sound API) library.
win32-sound (0.4.0)
    A package for playing with sound on Windows.
windows-pr (0.5.1)
    Windows functions and constants predefined via Win32API

6、創(chuàng )建Web應用
在命令行下運行 rails rorweb ,會(huì )在rorweb目錄下創(chuàng )建相應的一堆完整的Web應用的目錄結構,然后你應該做的就是寫(xiě)你的程序了。
      create
      create  app/controllers
      create  app/helpers
      create  app/models
      create  app/views/layouts
      create  config/environments
      create  components
      create  db
      create  doc
      create  lib
      create  lib/tasks
      create  log
      create  public/images
      create  public/javascripts
      create  public/stylesheets
      create  script/performance
      create  script/process
      create  test/fixtures
      create  test/functional
      create  test/integration
      create  test/mocks/development
      create  test/mocks/test
      create  test/unit
      create  vendor
      create  vendor/plugins
      create  tmp/sessions
      create  tmp/sockets
      create  tmp/cache
      create  Rakefile
      create  README
      create  app/controllers/application.rb
      create  app/helpers/application_helper.rb
      create  test/test_helper.rb
      create  config/database.yml
      create  config/routes.rb
      create  public/.htaccess
      create  config/boot.rb
      create  config/environment.rb
      create  config/environments/production.rb
      create  config/environments/development.rb
      create  config/environments/test.rb
      create  script/about
      create  script/breakpointer
      create  script/console
      create  script/destroy
      create  script/generate
      create  script/performance/benchmarker
      create  script/performance/profiler
      create  script/process/reaper
      create  script/process/spawner
      create  script/runner
      create  script/server
      create  script/plugin
      create  public/dispatch.rb
      create  public/dispatch.cgi
      create  public/dispatch.fcgi
      create  public/404.html
      create  public/500.html
      create  public/index.html
      create  public/favicon.ico
      create  public/robots.txt
      create  public/images/rails.png
      create  public/javascripts/prototype.js
      create  public/javascripts/effects.js
      create  public/javascripts/dragdrop.js
      create  public/javascripts/controls.js
      create  public/javascripts/application.js
      create  doc/README_FOR_APP
      create  log/server.log
      create  log/production.log
      create  log/development.log
      create  log/test.log

7、啟動(dòng)Web應用
進(jìn)入rorweb目錄,運行 ruby script\server 啟動(dòng)之,信息如下
=> Booting WEBrick...
=> Rails application started on http://0.0.0.0:3000
=> Ctrl-C to shutdown server; call with --help for options
[2006-11-25 08:47:44] INFO  WEBrick 1.3.1
[2006-11-25 08:47:44] INFO  ruby 1.8.4 (2006-04-14) [i386-mswin32]
[2006-11-25 08:47:44] INFO  WEBrick::HTTPServer#start: pid=2564 port=3000

默認webrick服務(wù)器啟用了3000端口,訪(fǎng)問(wèn)一下 http://localhost:3000 ,打開(kāi)后可以看到如下之類(lèi)的信息。
Welcome aboard
You’re riding the Rails!
About your application’s environment
點(diǎn)擊查看:
Ruby version 1.8.4 (i386-mswin32)
RubyGems version 0.9.0
Rails version 1.1.6
Active Record version 1.14.4
Action Pack version 1.12.5
Action Web Service version 1.1.6
Action Mailer version 1.2.5
Active Support version 1.3.1
Application root X:/OpenSource/Ruby/rorweb
Environment development
Database adapter mysql

關(guān)于webrick服務(wù)器更多的信息可以訪(fǎng)問(wèn) http://www.webrick.org/

8、寫(xiě)一個(gè)HelloRoR的Web程序
打開(kāi)rorweb\app目錄,可以看到四個(gè)子目錄
controllers
helpers
models
views
一看就知道是什么作用了吧:)

仍在rorweb目錄,運行 ruby script\generate controller HelloRoR 可以看到如下的創(chuàng )建信息
      exists  app/controllers/
      exists  app/helpers/
      create  app/views/hello_ro_r
      exists  test/functional/
      create  app/controllers/hello_ro_r_controller.rb
      create  test/functional/hello_ro_r_controller_test.rb
      create  app/helpers/hello_ro_r_helper.rb

創(chuàng )建一個(gè)app/views/hello_ro_r目錄及三個(gè)文件

打開(kāi) hello_ro_r_controller.rb 進(jìn)行編輯,增加內容后全部如下:

ruby 代碼 
  1. class HelloRoRController < ApplicationController   
  2.  def index   
  3.   render_text "Hello RoR World"  
  4.  end  
  5.  def rails   
  6.   render_text "Hello Rails"  
  7.  end  
  8. end  

訪(fǎng)問(wèn) http://localhost:3000/hello_ro_r/ 就可以看到Hello RoR World結果了
訪(fǎng)問(wèn) http://localhost:3000/hello_ro_r/rails 就可以看到Hello Rails結果了

注意是 hello_ro_r 不是HelloRoR,默認是小寫(xiě),并寫(xiě)大小寫(xiě)之間用_分隔了,要注意一下,如果要進(jìn)行對應,就全部小寫(xiě)建立應用,如:
運行 ruby script\generate controller helloror ,這樣就是生成 helloror_controller.rb 了,然后訪(fǎng)問(wèn) http://localhost:3000/helloror/

其它:1.8.4與1.8.5的區別
1.8.4
win32-clipboard (0.4.0)
win32-eventlog (0.4.1)
win32-process (0.4.2)
windows-pr (0.5.1)
1.8.5
win32-clipboard (0.4.1)
win32-eventlog (0.4.2)
win32-process (0.5.1)
windows-pr (0.5.3, 0.5.1)

1.8.5的升級:gem install rails
Bulk updating Gem source index for: http://gems.rubyforge.org
Install required dependency activesupport? [Yn]  y
Install required dependency activerecord? [Yn]  y
Install required dependency actionpack? [Yn]  y
Install required dependency actionmailer? [Yn]  y
Install required dependency actionwebservice? [Yn]  y
Successfully installed rails-1.1.6
Successfully installed activesupport-1.3.1
Successfully installed activerecord-1.14.4
Successfully installed actionpack-1.12.5
Successfully installed actionmailer-1.2.5
Successfully installed actionwebservice-1.1.6
Installing ri documentation for activesupport-1.3.1...
While generating documentation for activesupport-1.3.1
... MESSAGE:   Unhandled special: Special: type=17, text="<!-- HI -->"
... RDOC args: --ri --op F:/OpenSource/RoR/Ruby/lib/ruby/gems/1.8/doc/activesupport-1.3.1/ri --quiet lib
(continuing with the rest of the installation)
Installing ri documentation for activerecord-1.14.4...
Installing ri documentation for actionpack-1.12.5...
While generating documentation for actionpack-1.12.5
... MESSAGE:   Unhandled special: Special: type=17, text="<!-- The header part of this layout -->"
... RDOC args: --ri --op F:/OpenSource/RoR/Ruby/lib/ruby/gems/1.8/doc/actionpack-1.12.5/ri --quiet lib
(continuing with the rest of the installation)
Installing ri documentation for actionmailer-1.2.5...
Installing ri documentation for actionwebservice-1.1.6...
Installing RDoc documentation for activesupport-1.3.1...
Installing RDoc documentation for activerecord-1.14.4...
Installing RDoc documentation for actionpack-1.12.5...
Installing RDoc documentation for actionmailer-1.2.5...
Installing RDoc documentation for actionwebservice-1.1.6...

9、中文截取問(wèn)題測試
http://my.opera.com/sawpad/blog/show.dml/235183
從以上地址拿到程序放到 rorweb\lib\ 目錄下

它的示例里有問(wèn)題,我回復了它,可以在程序里調用如下,湊合著(zhù)用,至少不會(huì )亂碼:

ruby 代碼

 

 

  1. u = USCutter.new("GBK")   
  2. u1 = USCutter.new("GBK")   
  3. u2 = USCutter.new("GBK")   
  4. s = "we love 中文截取問(wèn)題"  
  5. s1 = u.cut(s,0,10)   
  6. s2 = u1.cut(s,0,11)   
  7. s3 = u2.cut(s,0,12)   
  8. puts s1   
  9. puts s2   
  10. puts s3  

記得JavaEye上線(xiàn)時(shí)也是亂碼問(wèn)題,現在解決了的,原來(lái)我給Robbin寫(xiě)過(guò)用JavaScript來(lái)解決亂碼的問(wèn)題,不知道Robbin后來(lái)如何解決的,搜了一下,沒(méi)有發(fā)現解決方案?

10、接下來(lái)就是連接數據庫做一個(gè)完整的開(kāi)發(fā)之類(lèi)的,待續。。。

本站僅提供存儲服務(wù),所有內容均由用戶(hù)發(fā)布,如發(fā)現有害或侵權內容,請點(diǎn)擊舉報。
打開(kāi)APP,閱讀全文并永久保存 查看更多類(lèi)似文章
猜你喜歡
類(lèi)似文章
RubyGems簡(jiǎn)介
gollum筆記
Ridmine 安裝手記
在windows下搭建ruby on rails開(kāi)發(fā)環(huán)境
cocoapods的安裝 遇到的坑 Error installing pods:activesupport requires Ruby version >= 2.2.2 | App Store經(jīng)
Ruby on Rails 學(xué)習資料
更多類(lèi)似文章 >>
生活服務(wù)
分享 收藏 導長(cháng)圖 關(guān)注 下載文章
綁定賬號成功
后續可登錄賬號暢享VIP特權!
如果VIP功能使用有故障,
可點(diǎn)擊這里聯(lián)系客服!

聯(lián)系客服

欧美性猛交XXXX免费看蜜桃,成人网18免费韩国,亚洲国产成人精品区综合,欧美日韩一区二区三区高清不卡,亚洲综合一区二区精品久久