Ruby ã® Ubuntu 12.4 ã¸ã®ã¤ã³ã¹ãã¼ã«
Virtual Box ã« Ubuntu 12.4 ãå ¥ãã¦ãããã« rbenv ã§å種Ruby ãã¤ã³ã¹ãã¼ã«ããã®ã§ããã®æ¹æ³ã®ã¡ã¢ã
sudo aptitude install libssl-dev libyaml-dev libreadline-dev zlib1g-dev sudo aptitude install libncurses5-dev libgdbm-dev tk-dev # for maglev sudo aptitude install build-essential # for java sudo aptitude install openjdk-7-jre-headless openjdk-7-jdk # for git sudo aptitude install git-all # for rbenv sudo aptitude install rbenv # for ruby-build cd git clone git://github.com/sstephenson/ruby-build.git cd ruby-build ./install.sh # install all rubies ls -1 /usr/local/share/ruby-build/ | xargs -idir basename dir| xargs -iversion rbenv install version
rbenv versions # 以ä¸ãåºåçµæ 1.8.7-p352 1.8.7-p357 1.8.7-p358 1.8.7-p370 1.9.1-p378 1.9.2-p180 1.9.2-p290 1.9.2-p318 1.9.2-p320 1.9.3-dev 1.9.3-p0 1.9.3-p125 1.9.3-p194 1.9.3-preview1 1.9.3-rc1 2.0.0-dev jruby-1.6.3 jruby-1.6.4 jruby-1.6.5 jruby-1.6.5.1 jruby-1.6.6 jruby-1.6.7 jruby-1.6.7.2 maglev-1.0.0
ã¡ã¿ããã°ã©ãã³ã°Rubyèªæ¸ä¼ 第2å
ï¼æï¼æ¥ã«ã¡ã¿ããã°ã©ãã³ã°Rubyèªæ¸ä¼ãå®æ½ãã¾ããã
ã¡ã¿ããã°ã©ãã³ã°Ruby ã®ä¸ã§ãã«ã¬ã³ãã¯ã©ã¹ã¨ããç¨èªã説æããã¦ãã¾ãããã
説æãåããã«ããããã«æããã®ã§æ°ãã«æ´çãã¦ãããã¨æãã¾ãã
ã«ã¬ã³ãã¯ã©ã¹ã¨ã¯ãdef method_name args ... end ã®ãããªæ¸ãæ¹ã§ãã¡ã½ãããå®ç¾©ãããå ´æã®ãã¨ã§ãã
ã«ã¬ã³ãã¯ã©ã¹ã¯æ¬¡ã®ããã«èãããã¨ãã§ãã¾ãã
- ã¯ã©ã¹ã®ã³ã³ããã¹ãã§ããã°ãç¾å¨ã®ã¯ã©ã¹
- ãªãã¸ã§ã¯ãã®ã³ã³ããã¹ãã§ããã°ãself ã®ãªãã¸ã§ã¯ãã®ç¹ç°ã¯ã©ã¹
ã¯ã©ã¹ã®ã³ã³ããã¹ãã«é·ç§»ããæ¹æ³ã¯æ¬¡ã®ï¼éãããããã®å ´åã¯ãã®ã¯ã©ã¹ãã«ã¬ã³ãã¯ã©ã¹ã«ãªãã¾ãã
- class ã¾ã㯠module ãã¼ã¯ã¼ãã§ã¯ã©ã¹ï¼ã¢ã¸ã¥ã¼ã«ï¼ããªã¼ãã³ãã
- class_eval ã§ã¬ã·ã¼ãã®ã¯ã©ã¹ããªã¼ãã³ãã
éã«ãªãã¸ã§ã¯ãã®ã³ã³ããã¹ãã«é·ç§»ããã«ã¯ãinstance_eval ã使ããã¨ã«ãªãã¾ãããã®å ´åã¯ãã®ãªãã¸ã§ã¯ãã®ç¹ç°ã¯ã©ã¹ãã«ã¬ã³ãã¯ã©ã¹ã«ãªãã¾ã
ã¤ã¾ãã instance_eval ã®ä¸ã® def ã¯ãã®ãªãã¸ã§ã¯ãã®ç¹ç°ã¡ã½ããå®ç¾©ã«ãªãã¾ã
ã¯ã©ã¹ã®ã³ã³ããã¹ãã¸ã®é·ç§»ã®ä¸ã§ç¹ã«ãclass <
# (1) ãããã¬ãã«ã®ã¡ã½ããå®ç¾©ï¼ Object ã«å®ç¾©ãããï¼ def toplevel_method end # (2) ã¯ã©ã¹ã®ã³ã³ããã¹ãã§ã®ã¡ã½ããå®ç¾© # ã¯ã©ã¹A ã®ã¤ã³ã¹ã¿ã³ã¹ã¡ã½ããã¨ãã¦å®ç¾©ããã class A def instance_method1 end end # (3) class_eval ãå©ç¨ãã¦ã¯ã©ã¹ã®ã³ã³ããã¹ãã§ã¡ã½ããå®ç¾© # ã¯ã©ã¹A ã®ã¤ã³ã¹ã¿ã³ã¹ã¡ã½ããã¨ãã¦å®ç¾©ããã A.class_eval do def instance_method2 end end # (4) ç¹ç°ã¯ã©ã¹ã®ã³ã³ããã¹ãã§å®è¡ããããã®è¨æ³ <
LiveCoding 㧠解説
cuzic ã§ãã
ããå é±ã®ãã¨ã§ãããLiveCoding#10 ã«åå ãã¦ããããçªç¶ 解説ãä¾é ¼ããã解説ãã¦ãã¾ããã
ã¤ãã³ãå 容ã¯ãyhara ãã㨠nari ããã®ãããã®ã¼ã¯ãã³ã¼ãã£ã³ã°ããã®ãã¿ããªã§è¦ããï¼ã¿ãããªãã®ã§ãæè¿ã¯ sixeight ãããä¸å¿ã«é常ã«ç±æ°ãæã£ã¦å®æ½ããã¦ãã¾ãã
LiveCoding#10 ã§ã¯ãããã®å¤ãªè¨èªä½è ãyhara ããã¨ããæ¥æ¬ã®ã¬ã¼ããã¸ã³ã¬ã¯ã·ã§ã³çã®æ¨©å¨ã nari ãããæå¼·ã¿ãã°ãçµãã§ãæ°ããè¨èªããããï¼ï¼åã§å®è£ ããã¨ãããã®ã§ããã
yhara ããã®æ´æ°ãæååãå«ãã¦ãã¹ã¦ãé åã§è¡¨ç¾ããã¨ããæ°è¨èªã«ã¯ã¡ãã£ã¨ãã®ã¢ãæããã¾ããã
å¤ãªè¨èªã«ã¯ããããã¨ããã¾ãããããã¾ã§éå®ãããã¨ããçºæ³ã«ã¯ã³ã£ãããã¾ããã
ï¼ï¼åæéãããã¨ã¯ãããã¡ããã¨ãã¹ããæ¸ããªããã³ã¼ããæ¸ãã¦ããç¹ãæéãåãã¾ãããèªåã®ã¹ã¿ã¤ã«ã¸ã®ãã ãããæãã¾ãã
ã¬ã¼ãã¼ã¸ã³ã¬ã¯ã·ã§ã³ã«ã¤ãã¦ã¯åºæ¬çãªåçãªã©ã¯ä¸éãåå¼·ãããã¨ã¯ãããã®ã®ãå®éã®ã³ã¼ãã«ã¤ãã¦ã¯ãã¡ããã¨è¦ã¦åå¼·ãããã¨ãªã©ã¯ãã¾ããªãã£ãã®ã§ãä»åã®ä¼ç»ã®ããã«ã³ã³ãã¯ããªã¬ã¼ããã¸ã³ã¬ã¯ã·ã§ã³å®è£ ãå®éã«ä½æãã¦ããã¨ãããè¦ããã¨ãã§ããã®ã¯ã大å¤åå¼·ã«ãªãã¾ããã
ç§ã®è§£èª¬ã«ã¤ãã¦ã§ãããçªç¶ã®ä¾é ¼ã§æºåã足ãããèãè¦ããã£ãé¨åããã£ããã¨æãã®ã§ãããå¤ãã®æ¹ãã好è©ããã ãã¦ããããã§ãããã£ãã§ãã
Ruby ã§ã¯ã©ã¹å®ç¾©ã® DSL ä½æ
cuzic ã§ãã
ä»æ¥ã Ruby ã®è©±é¡ã§ãã
çç±ã¯ãªãã®ã§ããã大林さんの昔出した課題ã®ãããªåé¡ã«åãçµãã§ã¿ã¾ããã
ç®æ¨ã¯ã
A = AttrClass :accessor, :with_default => 1 do def initialize puts "initialized" end def do_something puts "do_something" end end a = A.new #=> intialized p a.accessor #=> nil a.accessor = "some value" p a.accessor #=> "some value" p a.with_default #=> 1 a.with_default = 2 p a.with_default #=> 2 a.do_something #=> do_something
ã¨ãªããã㪠AttrClass ã¡ã½ãããå®ç¾©ãããã¨ã§ãã
ã¤ã¾ããAttrClass ã¡ã½ããã®å¼ã³åºããä¸è¨ã®ã³ã¼ãã¨ç価ã«ãªãããã«ãããã¨ãããã¨ã§ãã
class A attr_accessor :accessor attr_accessor :with_default def initialize @with_default = 1 puts "initialized" end def do_something puts "do_something" end end
ããã¯ãã£ã¦ã¿ãã¨ãæ¯è¼çç°¡åã«ã§ãã¾ããã
次ã®ãããªã¡ã½ããå®ç¾©ã«ãªãã¾ãã
def AttrClass *symbols, &block Class.new do |klass| symbols.each do |sym| case sym when Symbol attr_accessor sym when Hash klass.class_eval do sym.each do |key, value| attr_accessor key end end Module.new do new_original = klass.method :new define_method :new do |*args, &block| obj = new_original.call *args, &block sym.each do |key, value| obj.__send__ "#{key}=", value end obj end extend_object klass end end end klass.class_eval &block klass end end
ãã¤ã³ãã¯ãClass#class_eval ã使ã£ã¦ãClass ã®ã³ã³ããã¹ãã§ãããã¯ãè©ä¾¡ãã¦ãããã¨ããnew ã¯ã©ã¹ã¡ã½ãããåå®ç¾©ãã¦ãã¤ã³ã¹ã¿ã³ã¹å¤æ°ã®åæåãè¡ã£ã¦ããã¨ããã§ããããã
ããã使ãã°ãã¢ã¯ã»ãµãªã©ãå¤ãã¯ã©ã¹å®ç¾©ãããç°¡æ½ã«æ¸ãã¾ãã
Rubyã®ããã¥ã¡ã³ãã¼ã·ã§ã³ YARDç·¨ãï¼ï¼ï¼
cuzic ã§ãã
WMI ã§ããããã¨ããããã£ãªã©ã観å¯ãã¦ãã¦ãDescription ã¨ãã Qualifier ã§ãã® WMI ã¯ã©ã¹ã®ããããã£ã«é¢ãã詳細ãªèª¬æãå¾ããããã¨ã«æ°ãã¤ãã¾ããã
ç°¡åãªä¾ã¨ãã¦ã¯ã
require 'win32ole' loc = WIN32OLE.new("WbemScripting.SWbemLocator") service = loc.ConnectServer service.SubclassesOf("", 131072).each do |klass| desc = klass.Qualifiers_.Item("Description") rescue nil puts "#{klass.Name} #{desc}\n" if desc end
ã¨ããã¨ããã¾ãã¾ãª WMI ã¯ã©ã¹ã®èª¬æã表示ã§ãã¾ãã131072 (= 0x20_000)
ããããã£ãã¡ã½ãããã¡ã½ããã®å¼æ°ãªã©ã«ã¤ãã¦ãDescription ã® Qualifier ãè¨å®ããã¦ãããããããã¥ã¡ã³ãã¨ãã¦ãååãªæ å ±ãå¾ããã¾ãã
ããã§ãRuby ã®ããã¥ã¡ã³ãä½ææ¹æ³ã«ã¤ãã¦å¦ã¶ããã®é¡æã¨ã㦠WMI ã® Description ã® Qualifier ã使ãã¨ããã¢ã¤ãã¢ãæãã¤ãã¦ã¿ã¾ããã
ã¾ãã¯ãRuby ã®ãªãã¡ã¬ã³ã¹ããã¥ã¢ã«ã¨ãã¦ä½¿ããã¦ãã bitclust ãå©ç¨ãã¦ãããã¥ã¡ã³ãã®ä½æãæ¤è¨ãã¦ã¿ãã®ã§ãããã©ããæ¨æºã©ã¤ãã©ãªãåæãããªã®ããããæ¹ãããåããã¾ããã§ããã
次ã«ãRuby ã§ãã使ããã¦ããããã¥ã¡ã³ãä½æãã¼ã«ã§ãã RDoc ãæ¡ç¨ãããã¨æã£ãã®ã§ããããã©ã¡ã¼ã¿å¼æ°ã®èª¬æã®æ¸ãæ¹ãªã©ãããåãããªãã£ãããattr_reader ã¨ãã¨ãã¡ã½ããå®ç¾©ãããæãã«åºå¥ãã¦è¡¨ç¤ºããããã£ãã®ã§ãããããæ¹ãè¦ã¤ãããã¾ããã§ããã
次ã«è©¦ããã®ã¯ãRDoc ã®å¾ç¶ï¼ï¼ï¼ã® YARD ã§ããYARD ã使ãã¨ãããããã¨ãä¸éãã§ããããªä¸ãæ¸ãæ¹ãç§ã«ã¨ã£ã¦ããããªãç解ã§ããã®ã§ããã«æ°ã«å ¥ãã¾ããã
## # Caption ããããã£ã¯ããªãã¸ã§ã¯ãã«ã¤ãã¦ã®ç°¡åãªèª¬æ (1 è¡åã®æåå) ã§ãã # @return [string] Caption attr_reader :Caption
ã®ããã«ã@return ãã@param ã®ãã㪠JavaDoc ã®æ¸ãæ¹ã¯è¦æ £ãã¦ãã¦ããããªãã¤ãã¦ããã¾ãã
ããã§ãYARD ã使ã£ã¦ WMI ã®ããã¥ã¡ã³ããä½æãã¦ã¿ã¾ãããここã«ããã¦ã¿ã¦ãã¾ãã
YARD ã使ã£ã¦ã¿ã¦ãæã£ããã¨ã¯ã
- ããã©ã«ãã®è²åãã¨ãã¯ãã£ãããã¤ããªããããã§ãè¦ããã
- ã«ã¹ã¿ãã¤ãºã¯æè»ãããããã¥ã¡ã³ããããããã¨æ¸ããã¦ãã¦ãæ¢æ±ãã価å¤ãããããã§ãã
- çæãã¨ã¦ãé ããä»åã¯ããªãã®åéããã£ãããããããã¾ãããï¼ï¼å以ä¸ããã£ã¦ã³ã£ãããã¾ããã
ã¨ãã£ãã¨ããã§ãã
YARDã¯æ¡å¼µæ§ãã«ã¹ã¿ãã¤ãºã容æãããªå°è±¡ãªã®ã§ããã®ãããã«ã¤ãã¦ãæ¢æ±ãã¦ãããããªãã¨æãã¾ããã
ããã°ã©ãã³ã°ã®å¿çå¦ â èªäº
cuzic ã§ãã
大æã«è²·ã£ã¦ããæ¬ã§ããããã°ã©ãã³ã°ã®å¿çå¦ ãèªã¿çµãã¾ããã
- ä½è : ã¸ã§ã©ã«ãã»M.ã¯ã¤ã³ãã¼ã°,æ¨ææ³,ä¹ éé,è§ç°åä¿,ç½æµå¾é
- åºç社/ã¡ã¼ã«ã¼: æ¯æ¥ã³ãã¥ãã±ã¼ã·ã§ã³ãº
- çºå£²æ¥: 2005/02
- ã¡ãã£ã¢: åè¡æ¬
- è³¼å ¥: 4人 ã¯ãªãã¯: 54å
- ãã®ååãå«ãããã° (61件) ãè¦ã
æã«ãèªã¿çµããæ¬ãªãã ãã©æè¿ã¾ãèªã¿ãããªãæã£ã¦èªã¿è¿ããã®ã§ãã
å°è±¡ã«æ®ã£ãæç« ãç®æ¡æ¸ãã§å¼ç¨ãã¾ãã
- ããã°ã©ã ãåããªããªããå®è¡å¹çã¨ãé©å¿åã¨ãéçºè²»ç¨ã¨ããã£ã尺度ã¯ãªãã®æå³ãæããªã
- ãã£ãã·ã£ã¼ã®åºæ¬å®çãã·ã¹ãã ã¯ç¹å®ã®ç°å¢ã«ããé©å¿ãã¦ããã°ããã»ã©ãæ°ããç°å¢ã«ã¯é©å¿ãã«ãããªãã
- ãã¾ãªãå¤ãã®ç®¡çè·ã¯ãã¹ã¦ãæ±ãããããæè¯ã®è£½åãå¾ãããã«æ¸å½ãªãã¬ã¼ããªããè¦åºããã¨ã®éè¦æ§ãç解ãã¦ããªããã ããããã¯ãã¹ã¦ã®ããã¿ã¼ã«ã¯ãã¼ã ã©ã³ãæã¦ã¨å½ãããã¹ã¦ã®ãããã£ã¼ã«ã¯ãã¹ã¦ã®ããã¿ã¼ãä¸æ¯ã«ã¨ãã¨å½ããã°ããã¥ã¼ã¨ã¼ã¯ã»ã¤ã³ãã¼ãºã®ç£ç£ãåã¾ããã¨æããåç¶ã§ããã
- å½¼ãã®ãã¾ãã«å¤ãããã¾ã ã«ãæªè çºè¦æ¹å¼ãã«ãã ãã£ã¦ãããããã¯ééããªã人ã ãçã®åå ãé ãããã«ä»åããã
- ãã¼ã½ã³å¹æãå©ç¨ããã¨ãããã¦å¤§ããªå®éç価å¤ããããã¨ãããã¨ãç¥ã£ããï¼ä¸ç¥ï¼ç§ã¯ç®¡çã®å¿çå¦ã«é¢ããï¼ã¤ã®åºæ¬åçãçºè¦ãããããã¯ã人ã ã«æ³¨æãåãã管çè ã¯ããçµæãå¾ããã¨ãããã¨ã ã£ãã
- ãããä¸ãã®ããã°ã©ãã³ã°ç®¡çè ã¯ã¨ããçµç¹å³ãé度ã«ä¿¡é ¼ããèªåãã¡ãç¾å ´ã«ããã¨ãã«å®ã«ãã¾ãæ´»ç¨ãã¦ããããéå ¬å¼ãªæ©æ§ã軽è¦ããããããã ã
- éå ¬å¼çæ©æ§ã¯å¿ ãåå¨ããããããç解ããã«ç©äºãå¤æ´ããã®ã¯å±éºã ãï¼ä¸ç¥ï¼ãã°ãã°ãããããã¨ã¯ç©ççãªé ç½®ãæãããã¨ã«ããèµ·ããã
- ãæææåãã®ããã°ã©ãã³ã°ã®çã®åé¡ç¹ã¯ãå¥ã®ã¨ããããçãããï¼ä¸ç¥ï¼èªåã®ããã°ã©ã ãèªåã®ã¨ã´ã®å»¶é·é¨ã ã¨æ¬æ°ã§æã£ã¦ããããã°ã©ãã¯ããã®ããã°ã©ã ã«å«ã¾ãã誤ããå ¨é¨è¦ã¤ãã¦ãããã¨é å¼µããã¨ãªã©ããªãã§ããããï¼ä¸ç¥ï¼ç¡è¦ãããã®ãªãå®å ¨ãªå¤±æã§ãªãã£ãå ´åã«ã¯ãèªç¥çä¸ååã®è§£æ¶ã¯ãã£ã¨å®¹æã§ããã誤ããããã«ãããã¨ãè¦è½ã¨ãããããã°ããã
- èªåã¯èªåã®ããã°ã©ã ã調ã¹ãè½åããªããã¨ãããã¨ã«æ°ã¥ããæåã®ããã°ã©ãã¯ãããããã¸ã§ã³ã»ãã©ã³ã»ãã¤ãã³ãã®äººã§ãããå½¼ã®ç¥äººãã¡ãä¼ããã¨ããã«ããã°ãå½¼ã¯çµ¶ããèªåãããã«ä¸æãããªããã°ã©ãããå説ããããã£ã¡ã ã人ã«ããã°ã©ã ãæ¼ãä»ãã¦ã¯ãé²ãã§ééããä¸æãªã¨ãããè¦ã¤ãã¦ãããã¨é ¼ãã§ããã¨ããã
- ã¨ã´ã¬ã¹æ¹å¼ã®å©ç¹ã¯èª¤ãã®æ¤åºã ãã§ã¯ãªããã¨ãããã¨ã§ãããï¼ä¸ç¥ï¼ããã°ã©ã ãä»æ§ã«åãï¼ä¸ç¥ï¼æç¨æéã®å¤åãå°ãããªãï¼ä¸ç¥ï¼ä»äºãã©ã®ç¨åº¦é²ãã§ãããã«ã¤ãã¦ã®ç¾å®çãªè©ä¾¡ãå¾ããããªããï¼ä¸ç¥ï¼ããã°ã©ã ã®é©å¿åãé«ã¾ããï¼ä¸ç¥ï¼ããã°ã©ã ãèªãå´ã®äººã«ã¨ã£ã¦ãæçã
- ããå½¼ã誰ãã®ã¨ããã«å©è¨ãæ±ãã«ãã£ã¦ããªãã¦é¦¬é¹¿ãªãã¹ããã£ã¦ããã®ã ããªã©ã¨å²ãããã¨ããã°ãå½¼ã¯æ¬¡åã«ã¯å©è¨ãæ±ãããã¨ã¯ããªããªãå¯è½æ§ãé«ããã ããã誰ããå½¼ã®ã¨ããã«ãã£ã¦ãã¦ãããã°ã©ã ãè¦ã¦ãããªããã¨é ¼ãã ã¨ããã°ãå½¼ã¯ãããèªåã®è½åã«å¯¾ããçµç·¯ã¨åãåã£ã¦èªããããããããèªåã®æ¹ããå©è¨ãæ±ããã¨ãã«ããã¾ãè å¨ãæããªãããã«ãªãã ããã
- ã°ã«ã¼ãã¾ã¨ãã¦ã®ç§»ç±ã¯ç¨ãªãã¨ã§ã¯ãªããçµå¶è ãã¡ã¯ããã«ãã種ã®é°è¬ãçãããããã®ã ãããã®ãããªç§»ç±ã¯éæ¹ããªãç©è³ªçå©çã«é£ããã¦ã§ã¯ãªãããããä¸ç·ã«åããã¨ã«ãã£ã¦å¾ãããæºè¶³æãæãç¶ããããã¨ãã欲æ±ã«ãã£ã¦èµ·ããã®ããµã¤ãã§ããã
- ãã¼ã ã®ã¡ã³ãã¼ãèªåãããã£ãä»»åã¯å£ã£ããã®ã ã¨ããææ ãæ¼ã殺ãã¦ããå ´åãããã¯ãã¼ã ã®ä»äºã«é©ãã»ã©ã®å®³ãåã¼ãå¯è½æ§ããããã¨ã´ã¬ã¹æ¹å¼ã¯ããææ ãåãããå¾åãæã¤ã
- ã°ã«ã¼ãã®ç®æ¨ã«é¢ããçã®ã³ã³ã»ã³ãµã¹ãéæããã«ã¯ãã°ã«ã¼ãèªèº«ã«ç®æ¨ãè¨å®ããã以ä¸ã«ããæ¹æ³ã¯ãªãã
- ç®æ¨è¨å®ã«åå ãããã¨èªä½ãåå人ããã¼ã ã®ä½æ¥ç®æ¨ãçã«åãå ¥ãããã®çµæã¨ãã¦çç£æ§ãé«ã¾ããã©ããã«ã¤ãã¦ã®éè¦ãªæ±ºå®è¦å ã«ãªã£ã¦ããããã«è¦åããããã
- æ大ã®å±éºã¯ããã¼ã¸ã£ã¼ããããã°ã©ãã³ã°é¢ä¿ã®è·ä½ãçµã¦æé²ãã¦ãã人ç©ã§ãã£ã¦ããã¼ã ãåé¡ãã¾ã è¦ã¦ãããªããã¡ã«ãããããã¤ãã®ã¬ãã«ã¾ã§æ±ºãã¦ãã¾ããã¨ãããã¨ããå ´åã§ãããããã»ã©ãã¼ã ã®æ欲ãåãããããã¡ã¯ããã ã®ã³ã¼ãã¼ãããã¨æãããã¦ãã¾ãããå£ã¯ãªãã
- ä»äºã®æ¦è¦ããããã©ãããæå³ãæã¤ããã¨ããè¦ç¹ãã示ãå¿ è¦ããããããã°ã©ãã¯åã«ä½ããããã§ã¯ãªãããªãããããã®ããç¥ãããã¨æããã®ã ã
- ããã°ã©ãã³ã°çµé¨ã®ãªã人ç©ãããã°ã©ãã³ã°ãã¼ã ã®ç®¡çè ã¨ãã¦ä»»å½ãããã¨ããã¨ããã®ä»»å½ã«ãããªã¼ãã¼ãèªåã¯æè¡çãªãã¨ã«ã¤ãã¦ã¯è½åããªããã¨ãããã¨ãç©æ¥µçã«ã¾ãã¯æé»ã«èªããªãéãããã©ãã«ãçºçãããå½¼ããªãããææªã®ãã¨ã¯ãã¼ã ã®èªå以å¤ã®ã¡ã³ãã¼ã¨ããã°ã©ãã³ã°è½åã競ããã¨ãããã¨ã§ããã
- è¿è¦ç¼çãªãªã¼ãã¼ãèªä¿¡ã®ãªããªã¼ãã¼ã¯çµå¶å±¤ããããã°ãã«ã¯åããããã£ã¦ãããã¨ãå ¨é¨ç´æããã®ãæåã®éã ãã¨æãããããããªããã ãçµå±ã®ã¨ãããçµå¶å±¤ãæãã§ããã®ã¯æããããç´æãªã®ã ã
- ã¯ããè¦æã®ãªã¼ãã¼ã ãããæåã¸ã®çã®ãã£ã³ã¹ãæ¡ã£ã¦ããã
- 人ã¯ä»äººã®ç©æ¥µçå¼·åããã£ã¦ããããã£ã¨ãã°ãããã¾ããã£ã¨ããå¦ã¶
- 大é¨åã®ããã°ã©ãã¯ãè½åã身ã«ã¤ãã¦ããã«ã¤ãã¦ãèªåã®ç¥èãçãããªããããªä»äºã«ä¸æºãåããã¯ããããã ãããããã¸ã§ã¯ãã®é·æã«ãããå®å®ãé¡ããªãã管çè ã¯ããã¸ã§ã¯ããä¸ç¨®ã®ããã°ã©ãå å·¥ãã©ã³ãã¨ãã¦æ©è½ããããã«ä»çµã¾ãªããã°ãªããªãã
- ããããããã°ã©ããããããã®ãªã人ç©ã ã¨ãããªããå½¼ãã§ãããããæ©ã追ãåºãã
- ããã°ã©ã éçºã®é²æç¶æ³ãå¤æããã¨ããã®ã¯ãããã¦ä¸»è¦³çãªä»äºã§ãããããï¼ã¤ã®ããã°ã©ã ã«ã¤ãã¦ã©ãã»ã©ã®é²å±ããã£ãããã¨ããï¼ç¹ã ããè¦ã¦ããã¾ãã¾ãªæè¦ãåºã¦ããå¯è½æ§ãããã
- ããã°ã©ãã³ã°ããã¸ã§ã¯ãã«ããã¦ãé²æç¶æ³ã®è©ä¾¡ã«å å¨ããå¿çå¦çè½ã¨ãç©´ãåé¿ãããã¨æããªããä½æ¥ãããã¨ã¨ãã®è©ä¾¡ã¨ãããªãããã®å½¢ã§åé¢ãããã¨ãå¿ è¦ã§ããã
- 人ã ã¯ç®¡çè å´ããããã¸ã§ã¯ãã®çã®ç¶æ ã«é¢ããæ å ±ããã¯ããããå½¼ããèãããã¨æã£ã¦ããçããä¸ããããã«ãã¨å§åãæãããã¦ããããã§ããã
- ã©ããªããã°ã©ã ã«ããæã注æããããæéã«é¢ãã¦é©åãªã¬ãã«ã¨ãããã®ãããããã®ã¬ãã«ãè¶ ãã¦ããã°ããã¨ã¯ããã®ã¬ãã«ã«å±ããªããã¨ã«ãããã£ã¨ããã®éã«ãã¨ããã¨ãªã®ã ã
- ãã¾ããããããã¯ã¹ã±ã¸ã¥ã¼ã«ãç®æ¨ã¨ãã¦åå¨ãããã¨èªä½ããå²ãå½ã¦ãããæéãã«å½±é¿ãããã¨ãç¥ã£ããä»äºãå²ãå½ã¦ãããæéä¸æ¯ã¾ã§ä¼¸ã³ããããããªãçç±ã¯ä»ã«ãç®æ¨ããã£ã¦ããããã¹ã±ã¸ã¥ã¼ã«ã¨æ¯ã¹ãã¨ããã©ã®ç¨åº¦éè¦ã§ãããæããã«ããã¦ããªããã¨ããã¨ããã«ããã®ã ã
- ããã°ã©ãã³ã°ã®æ¢åµãã¡ã¯ãï¼ä¸ç¥ï¼ï¼å¸¸äººã«ã¯ã¡ãã£ã¨ç解ããããã»ã©æ·±ãï¼ãã®ä»äºèªä½ã«æºè¶³ããã¼ããããã ããã®ç¨®ã®è«çºè¦ã®å¤©æã¯è«ãè¦ã¤ãã£ããã¨ããããä¿®æ£ããã®ã¯ãã¾ãä¸æã§ãªãå¯è½æ§ãããã
- ããããã¯ãããããã°ã©ãã«ãªãããã«ã¯ãã¨ãããåæ ãæã¡å»ºã¦ãã«ã¯ãã¨ã¯ä¼¼ã¦ãããã¨ãããã¨ã«æ°ã¥ãã ããããã®çãã¯ãäºãã«èªãåããã¨ã¨ãåæ§ã大åã«ãããã¨ã§ããã
- ç§ã¯èªåã®æéãæ確ãªä»æ§ãçºè¦ãã人ã«ä¼ããã¨ããæ¹åã«åãã¦ä½¿ãã®ããã£ã¨ãæå¹ã ãããã¨ããçµè«ã«éãããããã¦ç¢ºãã«ãã®ãã¼ãã¯ããã«æ³¨ç®ãåããçµç¹ã«ã¨ã£ã¦å¤§åç©«ããããããã®ã¨ãªã£ãã
- ç¥è½ã¯æ§æ ¼ãä½æ¥ç¿æ £ãããã³è¨ç·´ã¨ãã£ãè¦ç´ ã¨æ¯ã¹ã¦ããã®åé¡ã«ã¨ã£ã¦ã®éè¦æ§ãä½ãããã«æãããããããã¦ãããã®è¦ç´ ã¯ç¥è½ã¨éã£ã¦äººçã«ããããã®å¾ã®çµé¨ã«ãã£ã¦å¤ããå¾ããã®ã ãã ããåé¡ã¯ããã°ã©ããé¸ã¶ãã¨ããã¯ãããè²ã¦ããã¨ã«ããã
- æ大ã®ææ¦ã¯åµé çæèã«ããã®ã§ã¯ãªããæ³åçã³ãã¥ãã±ã¼ã·ã§ã³ã«ãããã¤ã¾ãããããã®èããããããç¬èªã®ã¹ã¿ã¤ã«ãæã£ãã»ãã®äººã ã«ç解å¯è½ãªããã«è¡¨ç¾ããã¨ãããã¨ãéè¦ãªã®ã ã
- éé以å¤ã®è¤ç« ã«ãã£ã¦ããã°ã©ãã«åæ©ä»ããä¸ãããã¨ãå¯è½ãããããªãã®ã ãä»äºã«ç´å¾ã®ããä»ä¸ããæ½ãããã®æéçä½è£ã¨ããè¨ç»æ®µéã§ä½ã»ã©ãã®è²¬ä»»ãåæ ãããã¨ã¨ããã£ãé¸æè¢ãããã
- å¦ç¿ã«ãããé²å£ã¯ãã§ã«å å¨åãã¦ããã®ããµã¤ãã§ãããã ããå¹³åçãªæ人ã¯å¥½ããªãããããã¦ããã¨ããå°ãã®ãã¨ãããã¼ããªããä½ãããã¾ããå¦ç¿ããã«ã¯èªåã®ç¥ããªããããå¦ã¶ä¾¡å¤ã®ããä½ããåå¨ãããã¨ãããã¨ãæ¿èªããå¿ è¦ããããããã®ããã°ã©ãã«ã¨ã£ã¦ããããæ¿èªãããã¨ã¯èªåã®å°ä½ãä¸ãããã¨ã«ãªããå½¼ãçã®å¼·ããæã£ãçã®ãããã§ãã·ã§ãã«ã¯å¼±ã¿ãèªèªããã¨ãã¦ãä½ã失ãã¯ããªããã¨ãããã¨ãç解ã§ããã»ã©ã«ææã§ãªãéãã¯ãã§ããã
- ããã°ã©ãã³ã°æ¥ã¯ãã©ããªæ¥ç¨®ãããã£ã¨ã絶ãããå¦ç¿ã«ä¾åãã¦ãããã®ã ã
- åé²ãããã¨é¡ãããã°ã©ãã«ã¨ã£ã¦ãèªåãå¿ è¦ã¨ããæè²ãå ¬å¼çãªæè²ã¨ç®¡çè ã®ãæ æ²ã«ã ãæ±ãã¦ããã®ã§ã¯ä¸ååã§ããã
- å¦ã³æ¹ãå¦ã¶ç¬¬ä¸æ©ã¯ãèªåã®è³ç£ã¨è² åµã«ã¤ãã¦ç¥ããã¨ãè¨ãæããã°ãå·±ãç¥ããã¨ãã«ããã
- ããã°ã©ããªã誰ã§ãå¿ã®å¥¥åºã§ã¯ããã°ã©ã ã¯åãã ãã§ã¯ä¸æºè¶³ã§ãããããã¨ã¯å¥ã®æå³ã§ãã¡ããã¨ãã¦ãããªããã°ãªããªãã®ã ãã¨ãããã¨ãç¥ã£ã¦ããã
- ããã°ã©ãã³ã°è¨èªã«ããã¦ãç©äºã表ç¾ãããããã誤ããæå°éã«ã¨ã©ããã®ã«æå¹ãªè¦ç´ ã®ãã¡ã§ãããã£ã¨ãéè¦ãªãã®ã®ï¼ã¤ã¯ãèªç¶ããã§ããã
- ããã°ã©ãã³ã°è¨èªããæèéç¨ãåã«ã¯ããæ§è³ªãæã£ã¦ãããã¨ã«ãããããã§ã¯ãããããã¯åç´ãªæå¶å¹æã«ã¤ãã¦è¿°ã¹ã¦ããã®ã§ã¯ãªããããã°ã©ã ããã¼ã¿ã®æ§æã«é¢ãã大è¦æ¨¡ãªå¹æã®ãã¨ããã£ã¦ããã
Windows ã§ããããã¡ã¤ã«ã¨æ ¼é
cuzic ã§ãã
ä»æ¥ã¯ããããã¨äºæ ããã£ã¦ãããªããä¹ ãã¶ãã«ããããã¡ã¤ã«ï¼.bat ã®ãã¡ã¤ã«ï¼ãä½ã£ã¦ãã¾ããã
ç§ã¯ MS-DOS => Windows3.1 => Windows95 ã¨ãæ£å½ãªé²åã®æ´å²ãæ©ãã§ãã人éãªã®ã§ããã¡ããæã¯ããããã¡ã¤ã«ã使ã£ã¦ãã¾ããã
ï¼ã¨ã¯ãããWindows 3.1 ã®é ã¯ã»ã¨ãã© MS-DOS ã°ãã使ã£ã¦ãããï¼
EDLIN ï¼vim ã® ex ã¢ã¼ãã®ãããªã©ã¤ã³ã¨ãã£ã¿ï¼ã§ããããã¡ã¤ã«ãªã©ãä½ã£ã¦ãããããã®ãã¡ EDIT ï¼ç§ã«ã¨ã£ã¦ã¯SEDIT ã ã£ããï¼ã®ãããªã¹ã¯ãªã¼ã³ã¨ãã£ã¿ãç»å ´ãã¦ã¨ã¦ã使ãããããªã£ã¦æåãããã®ã§ãã
ãã£ããåãã®æ話ã¯ç½®ãã¦ããã¨ãã¦ããã®é 㯠ERRORLEVEL ãé§ä½¿ããããããã¡ã¤ã«ã製ä½ãã¦ããã®ã§ããããããä»ã¨ãªã£ã¦ã¿ãã¨ãã¾ã£ããæãåºããªãã®ã§ãå®å ¨ã«ï¼ããå¦ç¿ãããã¡ã«ãªã£ã¡ããã¾ããï¼ãããï¼ã
ããã¨ããã¾ãã«ãå¿ãã¦ããä¸ã«ãå¥å¦ãªæåã«ãããã³ã£ãããã¾ããã
åå¿é²çã«ãããããæ¸ãä¸ã§å¤§äºãªãã¨ãæ¸ãã¦ããã¾ãã
- 空ç½ã "" ã®ã¯ãªã¼ãã¯ã·ã§ã«ã§ã¯ãªããå®è¡ããã³ãã³ãã解éãã
- ã¨ã¹ã±ã¼ã㯠^
ä¾ï¼
C:\Documents and Settings\cuzic> echo ^(^-^) (-)
- ãã¡ã¤ã«ã渡ãã¨ãã¯ãDOSå½¢å¼ã®ãã¡ã¤ã«åã空ç½ã便å©
â C:\Documents and Settings\cuzic> type "C:\Documents and Settings\cuzic\ntuser.ini" à C:\Documents and Settings\cuzic> type C:\Documents^ and^ Settings\cuzic\ntuser.ini ã 空ç½ã¯ãtype ã³ãã³ãã«ãããã¡ã¤ã«ã®åºåãã¨ãã¦è§£éããã¾ã â C:\Documents and Settings\cuzic> type C:\Docume~1\cuzic\ntuser.ini ãDOSå½¢å¼ã®ãã¡ã¤ã«åã¯æå¹
- é£ç¶ãã¦ãã³ãã³ããå®è¡ããã¨ãã¯ã& ã§ã¤ãªããã¨ã§ãã
-
- && ã ã¨ãåã®ã³ãã³ããæ£å¸¸å®è¡ã®å ´åã®ã¿ã|| ã ã¨å¤±æã®å ´åã®ã¿ã«å®è¡ã§ãã¾ã
-
- ãªãã¤ã¬ã¯ãã®ä½ç½®ã¯ããããå¤ããããã¿ãã
â C:\Documents and Settings\cuzic> echo hoge > tmp C:\Documents and Settings\cuzic> type tmp hoge â C:\Documents and Settings\cuzic> > tmp echo hoge C:\Documents and Settings\cuzic> type tmp hoge â C:\Documents and Settings\cuzic> echo > tmp hoge C:\Documents and Settings\cuzic> type tmp hoge
-
-
- ä¸çªå é ã§æ¸ãã®ããåããããããã¦ãæ´è½ããã
-
- ä¸è¨ããã & ãå«ãæååãç°å¢å¤æ°ã«æ ¼ç´ããã¦ã表示ããã®ã¯é£ãã
à set satc=Sex & The City ã ( set satc=Sex ) & The City ã¨è§£éãããThe ã³ãã³ããè¦ã¤ãããªããã à set satc=Sex ^& The City echo %satc% ã ( echo Sex ) & The City ã¨è§£éããã¾ã à set satc=Sex ^^& The City ã ( set satc=Sex ^ ) & The City ã¨è§£éããã¾ã â set satc=Sex ^^^& The City echo %satc% ã echo Sex ^& The City ã¨è§£éããã¾ã
ï¼è£è¶³ï¼
ããã«ã¯ãªã¼ããã¤ããã¾ã¾ã«ãªããã
set satc="Sex & The City" echo %satc% "Sex & The City"
ã¨ãããã¨ãã§ãã¾ãã
ã©ããããã«ã¯ãªã¼ãã§å²ã¾ãã㨠& ã®è§£éã¯ææ¢ãããããã§ãã
- start ã³ãã³ãã®æåã¯ããããã¨è¬ã
- 32bit GUI ã¢ããªã®å ´åï¼ã»ã¨ãã©ã®ã¤ãããã®å®è¡ãã¡ã¤ã«ï¼ã¯å¦ççµäºãå¾ ããã«ããã³ããã«æ»ãããããã§ãªããã°ï¼DOS ã³ãã³ãã®å ´åãªã©ï¼çµäºãå¾ ã¡ã¾ã
- 空ç½ã ^ ã§ã¨ã¹ã±ã¼ããã¦ãã空ç½ãå«ããã¡ã¤ã«ã¯æ¸¡ãã¾ãã
- 第ï¼å¼æ°ã "" ã§ã¯ãªã¼ãããã¦ããã¨ãã³ãã³ããæå³ãã¦ããã¨ãã¦ããã¦ã¤ã³ãã¦ã¿ã¤ãã«ã¨ãã¦è§£éããã¾ãã
à start "C:\Program Files\Microsoft Office\OFFICE11\EXCEL.EXE" â start "" "C:\Program Files\Microsoft Office\OFFICE11\EXCEL.EXE"
ãããã®æ§æ解æã«ã¤ãã¦ã¯ ここã«ã¾ã¨ã¾ã£ã¦ãã¾ããããªãã¨ãã«ãªã¹ããã¦æå³ãããã¾ããã