background preloader

RailsInstaller

RailsInstaller

String str % arg → new_str click to toggle source Format—Uses str as a format specification, and returns the result of applying it to arg. If the format specification contains more than one substitution, then arg must be an Array or Hash containing the values to be substituted. See Kernel::sprintf for details of the format string. static VALUE rb_str_format_m(VALUE str, VALUE arg) { volatile VALUE tmp = rb_check_array_type(arg); if (! str * integer → new_str click to toggle source Copy—Returns a new String containing integer copies of the receiver. "Ho! str + other_str → new_str click to toggle source Concatenation—Returns a new String containing other_str concatenated to str. "Hello from " + self.to_s str << integer → str click to toggle source str << obj → str Append—Concatenates the given object to str. a = "hello "a << "world" a.concat(33) str <=> other_str → -1, 0, +1 or nil click to toggle source <=> is the basis for the methods <, <=, >, >=, and between? str[fixnum, fixnum] → new_str or nil chomp!

Ruby on Rails製のブログCMS「PersonLab 自分でブログを立ち上げようと思ったら、エンジンには何を使うだろうか。MovebleTypeやWordPressが有名ではあるが、有名なものをただ使うのは何となく嫌だと言う人もいる。規模が大きくなりすぎて、コントロール不可能なイメージがあるのだ。 シンプルながら基本機能は抑えたブログエンジン 小規模で、それでいてカスタマイズも容易そうなブログエンジンがある。それがPersonLabだ。 今回紹介するオープンソース・ソフトウェアはPersonLab、個人のアイデンティティを確立できるブログシステムだ。 PersonLabはRuby on Railsで作られたブログエンジンで、中国語がベースになっている。 管理画面 ブログの右上にはユーザのプロフィール画像が表示され、利用しているWebサービスの一覧が表示できる。 管理画面はシンプルながらも使い勝手が良い。 既にあるブログエンジンはとても優秀なものが多い。 ブログエントリー画面 PersonLab Demo huacnlee's personlab at master - GitHub MOONGIFTプレミアムに登録して運営をサポートしてください! Dive Into HTML5 ive Into HTML5 seeks to elaborate on a hand-picked Selection of features from the HTML5 specification and other fine Standards. The final manuscript has been published on paper by O’Reilly, under the Google Press imprint. Buy the printed Work — artfully titled “HTML5: Up & Running” — and be the first in your Community to receive it. Your kind and sincere Feedback is always welcome. The Work shall remain online under the CC-BY-3.0 License. The site is currently maintained by some html5homies. Table of Contents “If you’re good at something, never do it for free.” Copyright MMIX–MMXI Mark Pilgrim

Learning Rails The Learning Rails Online Course is written and produced by Michael Slater and Christopher Haupt, who run BuildingWebApps.com and Webvanta, which provides a hosted CMS based on Ruby on Rails. Michael Slater Michael has been building web applications exclusively with Rails since the fall of 2006. He has led software development teams at Adobe and Fotiva and is a well-known speaker and author. During the years he ran the Microprocessor Report newsletter, Michael presented hundreds of seminars. Christopher Haupt Christopher has been developing Internet-related technology for more than 15 years. Feeds The best way to receive the course materials is by signing up for the course.

Getting started with Heroku Getting started with Heroku This guest post is by Ben Scofield, who is Heroku’s developer advocate, responsible for listening to the tens of thousands of developers deploying their Ruby applications to the cloud. He’s spoken at many conferences around the world, and in 2010 became the co-chair for RailsConf. Introduction Heroku has been in the news a lot lately, and it’s been a popular choice for Ruby application developers for a few years.If you haven’t worked with it before, here’s your chance — it’s designed to be as painless as possible to get going, and to give a powerful, stable, and scalable platform for your code. Setting up If this is your first time working with Heroku, you’ll need to start by setting up an account. Next, you’ll want to create an app (or find an existing one you want to push). $ rails new myapp $ cd myapp After you’ve chosen (or created) your app, you’ll need to make sure it’s tracked in git: $ git init $ git add . $ git commit -m "initial commit" $ heroku create rake

Magazine - Win32OLE 活用法 【第 2 回】 Excel ここまでで、Excel のオブジェクトモデルの概略を理解できました。 これから私たちは、Excel ファイルを実際に扱っていく方法について 学んでいきます。 この章では特に、 既存の Excel ファイルを Ruby でパースする 方法について学びます。 Excel ファイルの全データを出力 この節では、Excel ファイルに含まれる全シートの全セルの値を 出力するスクリプトについて説明します。 私たちは次のことについて学びます。 ファイルの絶対パスの取得方法Excel ファイルの開き方全ワークシートに対して処理を行う方法全行、全列に対して処理を行う方法ブックの閉じ方、始め処理、終わり処理のイディオムセルの値の取得の仕方Excel のセルの型と Ruby の型の関係 それでは、まずはスクリプトを見てみましょう。 excel1.rb 1| require 'win32ole' 2| 3| def getAbsolutePath filename 4| fso = WIN32OLE.new('Scripting.FileSystemObject') 5| return fso.GetAbsolutePathName(filename) 6| end 7| filename = getAbsolutePath("sample1.xls") 8| 9| xl = WIN32OLE.new('Excel.Application') 10| 11| book = xl.Workbooks.Open(filename) 12| begin 13| book.Worksheets.each do |sheet| 14| sheet.UsedRange.Rows.each do |row| 15| record = [] 16| row.Columns.each do |cell| 17| record << cell.Value 18| end 19| puts record.join(",") 20| end 21| end 22| ensure 23| book.Close 24| xl.Quit 25| end このスクリプトでは、Excel 表のデータを Ruby で扱えるように読み出しています。 これだけのスクリプトでも説明すべきことはいろいろとあります。 ここが出力を行う箇所になります。

Kate or Die! | Comics. Queers. Cats. 6.  Flow Control Ahhhh, flow control. This is where it all comes together. Even though this chapter is shorter and easier than the methods chapter, it will open up a whole world of programming possibilities. After this chapter, we'll be able to write truly interactive programs; in the past we have made programs which different things depending on your keyboard input, but after this chapter they will actually different things, too. But before we can do that, we need to be able to compare the objects in our programs. We need... Comparison Methods Let's rush through this part so we can get to the next section, , where all the cool stuff happens. puts 1 > 2 puts 1 < 2 false true No problem. puts 5 >= 5 puts 5 <= 4 true false And finally, we can see if two objects are equal or not using == (which means "are these equal?") puts 1 == 1 puts 2 ! true true Of course, we can compare strings, too. lexicographical ordering , which basically means their dictionary ordering. cat comes before dog in the dictionary, so: true

Magazine - Ruby Library Report 【第 3 回】 O/R マッピング 登録データ [プロジェクト名] RAA:tapkit[作成者] 鈴木 鉄也[URL] 0.5.2[レポート環境] ruby-1.8(cygwin), PostgreSQL 7.4.5 概要 TapKit は EOF (Enterprise Objects Framework) を Ruby で実装した物です。 作者からの声 TapKit は単純な興味から作りました。 特徴を簡潔に述べて頂いて助かりました。 サンプル ユーティリティー TapKit では YAML でマッピング定義であるモデルファイルを記述します。 付属の modeler コマンドでモデルファイルを DB から直接リレーション等の情報を読み取って生成することが出来ます。 $ modeler PostgreSQL modeler-sample.yaml Login database with DBI URL: dbi:Pg:RLR_DB Username: babie Password: Selectable tables - ... 引数で与える adapter 名は MySQL, PostgreSQL, OpenBase, CSV の何れかを指定できます。 "URL:" プロンプトでは DBIの接続文字列を入力します。 最後に、"Select tables:" プロンプトでモデルファイルに書き出すテーブルをカンマ区切りで指定しますが、この時、空白を入れてはいけません。 modeler コマンドは設定ファイル自動生成してくれますが、未だ発展途上のようで、精度は今回のサンプルを用いた限りではイマイチです。 単純な参照 rorm と同じく単純な参照を行ってみましょう。 tapkit-simple.yaml コードの説明に移る前に YAML の各要素について解説します。 設定は大きく分けて 3 つのセクションがあります。 adapter_name TapKit の対応するアダプターを指定します。 connection DB との接続に関するセクションです。 entities エンティティ(テーブル)に関するセクションです。 connection セクションでは以下の情報を記述します。 url 使用する DBI の接続文字列を記入します。 user

Interactive Portal Turret by *r4di0fly3r on deviantART

Related: