最終更新: yamanobori_old 2015年11月06日(金) 07:18:30履歴
>> program = "puts 'hello world'" => "puts 'hello world'" >> eval program hello world >> program.bytes.map {|byte| byte.to_s(2).rjust(8,'0')} => ["01110000", "01110101", "01110100", "01110011", "00100000", "00100111", "01101000", "01100101", "01101100", "01101100", "01101111", "00100000", "01110111", "01101111", "01110010", "01101100", "01100100", "00100111"] >> program.bytes.map {|byte| byte.to_s(2).rjust(8,'0')}.join.to_i(2) => 9796543849500706521102980495717740021834791 >> number = program.bytes.map {|byte| byte.to_s(2).rjust(8,'0')}.join.to_i(2) => 9796543849500706521102980495717740021834791 >> number.to_s(2).scan(/.+?(?=.{8}*\z)/) => ["1110000", "01110101", "01110100", "01110011", "00100000", "00100111", "01101000", "01100101", "01101100", "01101100", "01101111", "00100000", "01110111", "01101111", "01110010", "01101100", "01100100", "00100111"] >> number.to_s(2).scan(/.+?(?=.{8}*\z)/).map {|string| string.to_i(2).chr }.join => "puts 'hello world'" >> program = number.to_s(2).scan(/.+?(?=.{8}*\z)/).map {|string| string.to_i(2).chr }.join => "puts 'hello world'" >> eval program hello world => nil
出典 | アンダースタンディング コンピュテーション――単純な機械から不可能なプログラムまで |
著者 | Tom Stuart |
訳者 | 笹田 耕一 |
監訳 | 笹井 崇司 |
出版社 | オライリージャパン |
require 'win32ole' ie = WIN32OLE.new('InternetExplorer.Application') ie.visible = true ie.navigate("http://www.pragprog.com")
require 'win32ole' ie = WIN32OLE.new('InternetExplorer.Application') ie.visible = true ie.gohome
require 'dl/import' module User32 extend DL::Importer dlload 'user32.dll' extern "int MessageBoxA(long,const char*,const char *,int)" end MB_OKCANCEL = 1 User32.MessageBoxA(0,"OK?","Please Confirm",MB_OKCANCEL)
c:\>assoc .rb=RubyScript .rb=RubyScript c:\>ftype RubyScript="C:\ruby\bin\ruby.exe" %l %* RubyScript="C:\ruby\bin\ruby.exe" %l %* c:\>set PATHEXT=.rb;%PATHEXT%環境変数にパスを追加することを忘れずに。
記法 | 種類 | 式展開 | Perlでは |
%!hoge! %Q!hoge! | 文字列リテラル | 有効 | qq// |
%q!hoge! | 文字列リテラル | 無効 | q// |
%x!command! | バッククォート文字列 | 有効 | qx// |
%r!regexp! | 正規表現リテラル | 有効 | m!! |
%w!foo bar! | 配列 | 無効 | qw// |
%W!foo bar! | 配列 | 有効 | ? |
%s!hoge! | シンボル | 無効 | - |
require 'English'
$ERROR_INFO | $! |
$ERROR_POSITION | $@ |
$FS | $; |
$FIELD_SEPARATOR | $; |
$OFS | $, |
$OUTPUT_FIELD_SEPARATOR | $, |
$RS | $/ |
$INPUT_RECORD_SEPARATOR | $/ |
$ORS | $\ |
$OUTPUT_RECORD_SEPARATOR | $\ |
$INPUT_LINE_NUMBER | $. |
$NR | $. |
$LAST_READ_LINE | $_ |
$DEFAULT_OUTPUT | $> |
$DEFAULT_INPUT | $< |
$PID | $$ |
$PROCESS_ID | $$ |
$CHILD_STATUS | $? |
$LAST_MATCH_INFO | $~ |
$IGNORECASE | $= |
$ARGV | $* |
$MATCH | $& |
$PREMATCH | $` |
$POSTMATCH | $' |
$LAST_PAREN_MATCH | $+ |
- require 'tk'ができなかった。->apt-get install libtcltk-ruby で解決
- require 'mechanize'ができない
- apt-get install ruby1.9.1-full
- gem install mechanize
- スクリプトに以下を追加
reuire 'require 'rubygems' gem 'mechanize' require 'mechanize'
apt-get install vim-gnome
apt-get install rubygems1.9.1
gem install vim-ruby
vim-ruby-install.rb
vi .vim/indent/ruby.vim
apt-get install rubygems1.9.1
gem install vim-ruby
vim-ruby-install.rb
vi .vim/indent/ruby.vim
最終行のインデント設定を有効にする
http://www.ruby-lang.org/ja/man/archive/snapshot/
server.rbを自動起動する
http://localhost:10080へアクセス
refeの作成.Ruby逆引きハンドブックP72参照
server.rbを自動起動する
http://localhost:10080へアクセス
refeの作成.Ruby逆引きハンドブックP72参照
# -*- coding: windows-31J -*- require 'win32ole' module Worksheet def [] y,x cell = self.Cells.Item(y,x) if cell.MergeCells cell.MergeArea.Item(1,1).Value else cell.Value end end def []= y,x,value cell = self.Cells.Item(y,x) if cell.MergeCells cell.MergeArea.Item(1,1).Value = value else cell.Value = value end end def pick_range str self.UsedRange.Cells.each do |cell| if cell.Value.to_s =~ /#{str}/ return cell end nil end end def right_range range cell = self.Cells.Item(range.Row,range.Column + 1) if cell.MergeCells cell.MergeArea.Item(1,1) else cell end end def up_range range n = (range.Row.to_i) -1 n = !n ? 1 : n cell = self.Cells.Item(n,range.Column) if cell.MergeCells cell.MergeArea.Item(1,1) else cell end end def left_range range cell = self.Cells.Item(range.Row,(range.Column.to_i) -1) if cell.MergeCells cell.MergeArea.Item(1,1) else cell end end def down_range range cell = self.Cells.Item(range.Row + 1,range.Column) if cell.MergeCells cell.MergeArea.Item(1,1) else cell end end end begin xl = WIN32OLE.new('Excel.Application') book = xl.Workbooks.Open("File.xls") begin sheet = book.Worksheets.Item("費用") sheet.extend Worksheet target = sheet.pick_range("ニセコいこいの村") up = sheet.up_range(target) right_range = sheet.right_range(target) down = sheet.down_range(target) left = sheet.left_range(target) sheet.Rows(target.Row).Insert #上に1行追加 sheet.Rows(down.Row).Insert #下に1行追加 book.Save ensure book.Close end ensure xl.Quit end
このページへのコメント
The romantic comedy starring Zoe Kazan, which hasn't got a theatrical release, has been made available for rent at $5 on the movie's official site
Celine Trapeze Luggage Leather Bag 2013 Rose http://celinehermesbags.com/celine-trapeze-luggage-leather-bag-2013-rose-cl11505-p-31468.html
4ZHH7a Im grateful for the blog post.Thanks Again. Want more.
fuRZZJ Awesome article post.Much thanks again. Keep writing.
Ruby - Yamanobori_old鐃緒申Memo - Seesaa Wiki鐃淑ワ申鐃緒申鐃緒申鐃緒申 for 鐃緒申鐃殉¥申鐃夙フワ申鐃緒申 ≪潟若 吾若 http://www.pslcbi.com/moncler2014.html
KmAqAO <a href="http://pjbiyiommoha.com/">pjbiyiommoha</a>, [url=http://hxvtplwlqsmw.com/]hxvtplwlqsmw[/url], [link=http://laafqhugbpyu.com/]laafqhugbpyu[/link], http://gltfesrhgpgs.com/