ãªããåãããªè¦åºãã§ãããruby 1.9 ã主ã«ä½¿ãããã«ãªã£ã¦ 1 å¹´ã¡ãã£ã¨çµã£ãã®ã§ã1.9 ã®æ°æ©è½ã«æãã¨ããã注æç¹ãªã©ãæ¸ãæ®ããã¨æãã®ã§ããããã« 1 å¹´å¾ã«è¦ãã¨ããããã®ããã¯ãããªãµãã«èãã¦ããªãããªã©ã¨ææ ¨ã«ã²ããäºå®ã§ãã ãããããæã£ã¦ããã¨ãã¼ãã® ruby 1.9 çµé¨ã¯ãã¹ã¦è¶£å³ç¯å²ãªã®ã§ãã¨ã³ã¿ã¼ãã©ã¤ãºã¨ãã·ã¹ãã éç¨ã®åé¡ã¨ãã¯ç¥ãã¾ããããã¨ã¼ã㯠ruby ã®ã³ããã¿ãªã®ã§ãè²ç¼é¡ãããã¨æãã¾ãããããããã YARV VM å®è¡ã«ãªã£ãã¨ãã話ãä¸è¬çã«ã¯ãéããã¨ããæèã§èªããã¾ãã1.8 ã¨æ¯ã¹ãã¨ç¢ºãã«éãã§ããã§ãã1.9 ã°ãã使ãåºãã¨ãªãã¨ãæããªããªãã¯ãã§ããéããªãã¦ç¸å¯¾çãªä¾¡å¤ã§ããããå½ç¶ã§ããã©ãã好æçã«èããã°ãããªãã¨ãæããªãç¨åº¦ã«ãé ãã¦å°ããã¨ãæ¸ã£ããã®ãããããªãã ã³ã³ãã¤ã«ãã§ã¼ãºãæ
ã¯ããã« ãæ°ã¯ã¦ãªããã¯ãã¼ã¯ãã«ãªã£ãã¨ãããã¨ã§ãã¨ã£ã¦ã便å©ã«ãªã£ãã®ã§ãããããã¯ãã¼ã¯ä¸è¦§ãã¼ã¸*1ãè¥å¹² JavaScript ã«æéãæãã£ã¦ããã¿ããã§ãã ã¨ãããã㧠調æ»ãã¦ã¿ããã¨æãã¾ãã調æ»ãã¦ãæ¹åã§ããããªã¨ããã¯å¾ã§çºãã¦ãã¯ã¦ãªã¢ã¤ãã¢ãã«ã§ãç»é²ãããã¨æãã¾ãã ãã®æ¥è¨ã¯èª¿æ»ããªãããéç¨ãæ¸ãã¦ããã¤ããã§ãã æºå ã¾ãã¯ã人ã®ãµã¤ãã® JavaScript ãæ¸ãæãã¦è©¦ãã¦ã¿ãããã®ç°å¢ãä½ãã¾ãã ä½æ¥ç¨ãã£ã¬ã¯ããªãä½ã ã¨ããããããã¼ã ã« HatenaJS ã¨ãããã£ã¬ã¯ããªãä½ãã¾ãã $ mkdir HatenaJS $ cd HatenaJS CocProxy ããã¦ã³ãã¼ããã¦ãã 以ä¸ãã CocProxy ã¨ãããã¼ã«ããã¦ã³ãã¼ããã¦ãã¾ãã http://coderepos.org/share/wiki/CocPr
ããã¯ã¨ã¦ãã¨ã¦ãé©å½ãªèª¬æã§ããSkypeã®Documentã¨å ±ã«è¦ã¦ãã ããã ããã¦æªå®æãªãªãã¡ã¬ã³ã¹ããªãã¡ã¬ã³ã¹ã§ã¯ãªãã¦ããã ã®ãªã¹ãã§ãã ã¤ã³ã¹ãã¼ã«ã¨ä»æ§ ç¾å¨ã¯Windowsãã対å¿ã§ãã¦ã¾ãããLinuxã¯æ°ãåããããMacã¯ã¨ãããããã¼ãã欲ããã ã¤ã³ã¹ãã¼ã«ã¯gemã§ããã¾ããã³ãã³ãã©ã¤ã³ã«ã¦ gem install Ruby4Skype ã¨æã¤ã ãããã¨ãvrubyã®swin.soã«ä¾åãã¦ã¾ãããGemsã«ãã£ãã®ã§ã¯å¾®å¦ã«ãã¼ã¸ã§ã³ãå¤ãã£ãã®ã§èªåçã«ã¤ã³ã¹ãã¼ã«ã¯ããªãããã«ãªã£ã¦ã¾ãã OneClickInstallerã§ã¯æåããå ¥ã£ã¦ã¾ããããªãå ´åã¯èªåã§å ¥ãã¦ãã ããã åºæ¬ require 'skypeapi' SkypeAPI.init SkypeAPI.attachWait loop do Skype
Ruby ã«ã¯ãã¤ãããã¯ãªã³ã«ã¸ã®ã¤ã³ã¿ã¼ãã§ã¼ã¹ãç¨æããã¦ããã®ã§ãããå©ç¨ãã¦ã¿ã¾ãã DL::Importable ãå©ç¨ãããããã¡ã¤ã«ãåèã«ããªããã©ã¤ãã©ãªé¢æ°ã«å¯¾ãã¦ã©ããã¼ã¡ã½ãããå®ç¾©ãã¦ããã¾ãã pasori.rb require 'dl/import' module Pasori extend DL::Importable dlload '/usr/local/lib/libpasori.dylib' typealias 'uint8', 'unsigned char' typealias 'uint16', 'unsigned int' #typealias 'uint16', 'unsigned short int' # libpasori.h extern 'pasori* pasori_open(char*)' extern 'void pasori_
以ä¸ãåèã« Suica ã®ãã¼ã¿ãå ·ä½çã«è§£æãã¦ã¿ã¾ãããã æåã®1ãã¤ãã 0x1B ã ã¨ã¯ã¬ã¸ããå ¥éã0x07 or 0x08ã ã¨å ¥éã0x46ã ã¨ãµã³ã¯ã¹ãã£ã¼ã¸ã®å ¥éã§ã0x16ãèªåæ¹æä¹éã0xC7ã購買ã®ããã§ãã5ãã¤ãç®ããï¼ãã¤ããæ¥ä»ã§ãå é ãã7ããããå¹´ãï¼ããããæãæ®ãï¼ããããæ¥ã®ããã§ããï¼ãããé¢åã§ããããããºã«ã¿ããï¼7ãã¤ãç®ããã®ï¼ãã¤ããå ¥ã£ãé§ ãç¶ãï¼ãã¤ããåºãé§ ãã³ã¼ãã§å ¥ã£ã¦ãã¾ããé§ ã®ã³ã¼ãã¯ãè·¯ç·ã³ã¼ãï¼é§ ã³ã¼ãã®çµåããã§ãæå¿ã«ãããã¼ã¿ãã¼ã¹ãå ¬éããã¦ãã¾ããIC SFCard Fan DB Sreviceããã®ã½ããã§ã¯ã³ã¼ãããã®å¤æã¯ãã¦ãã¾ããã1ï¼ãã¤ãç®ããï¼ãã¤ããæ®éï¼ãªãã«ã¨ã³ãã£ã¢ã³ï¼ã§ãã 160100020e98e376e37d2e2200008000 ãä¾ã¨ãã¦è©³ããè¦ã¦ããã¨ä»¥ä¸ã®ããã«ãª
â pagination (ç°¡åãªãã¼ã¸ç®¡ç) Webã³ã³ãã³ãã§ä¸è¦§è¡¨ç¤ºæã«ãåã®ãã¼ã¸ãã次ã®ãã¼ã¸ãã¨ãã£ããªã³ã¯ãä½ãã®ã¯çµæ§é¢åã§ããããRails ã«ã¯ pagination ã¨ãããã¼ã¸ç®¡çæ©è½ãããããã¸ãã¯(ã³ã³ããã¼ã©)å´ã§ã¯ããã¼ãã«ã®ã¢ãã«ã表ãã·ã³ãã«(å¿ é )ã¨è¡¨ç¤ºæ¡ä»¶çãå¼æ°ã«åãpaginate ãå¼ã³åºãã ãã # controller def list @pages, @items = paginate(:item, :per_page => 20, :order_by => 'itemcode') end æ»ãå¤ã¯ãã¼ã¸ç®¡çãªãã¸ã§ã¯ãã¨æ¤ç´¢çµæã®ã¢ãã«ã®ã¤ã³ã¹ã¿ã³ã¹ã®é åãå¾è ã¯AR::find_allã¨åããã®ã§ãããåè ã®ãã¼ã¸ç®¡çãªãã¸ã§ã¯ãããã¼ã¸ã«é¢ããå種æ å ±ãæã£ã¦ããã®ã§ããã¥ã¼å´ã§ã¯ããã以ä¸ã®ããã«å©ç¨ããã # view <%=
Update: This article is now superceded by a new version that is updated for Rails 2.0 changes. Here we go. Rick Olson helped me figure out how to do bi-directional, self-referential associations using has_many :through. It's not obvious (until you know the trick), so here's how it's done. This example is for modeling digraphs. create_table "nodes" do |t| t.column "name", :string t.column "capacity
MailParser ã¡ã¼ã«ã¡ãã»ã¼ã¸ã解æããã ä½è ã¨ã¿ãã¾ãã²ã <[email protected]> ã©ã¤ã»ã³ã¹ Ruby ã©ã¤ã»ã³ã¹ http://www.ruby-lang.org/ja/LICENSE.txt ã¨åçã æ©è½ ã¡ã¼ã«ãã¡ã¤ã«ããã¼ã¹ããçµæãè¿ãã ã¡ã¼ã«æ§é ã«ããä¾å¤ã¯çºçããªã(ä¾å¤ãçºçããããã¨ãå¯è½)ã ä¸æ£ãªæ§é ã®ã¡ãã»ã¼ã¸ããã£ãå ´åã¯é©å½ã«å¦çããã 0.4 ã§ã¤ãããä½ããªãããã®ã§ã0.3 ã¨ã¯äºæããªãã require "mailparser/obsolete" ããã° 0.3 ã¨åãæ©è½ã使ç¨å¯è½ã ãã¦ã³ãã¼ã http://github.com/tmtm/mailparser ã¤ã³ã¹ãã¼ã« ã¤ã³ã¹ãã¼ã«ã«ã¯ racc ãå¿ è¦ã $ make $ make test # make install 使ç¨ä¾ require "mailpa
Posted by masuidrive Thu, 20 Jul 2006 10:33:00 GMT Ruby on Railsãç°¡åã«ã¢ããªã±ã¼ã·ã§ã³ãæ§ç¯ã§ããä¸ã¤ã®ç¹å¾´ã«ãconvention over configurationã=ãè¨å®ããè¦ç´ããããã¾ãã Railsã¯ã¢ããªãä½ãã®ã¯ç°¡åã§ããããããå ¬éããã®ãã¡ãã£ã¨é¢åã§ããããã§ãRailsã«éããWebãµã¼ãããè¨å®ããè¦ç´ãã«åã£ã¦ãè¨å®ãªãã§ãµã¤ããã¢ããªã±ã¼ã·ã§ã³ãå ¬éã§ããããã«ãã¦ã¿ã¾ãããã è¨å®é ç®ãæ´ãåºã ã¾ããWebãµã¼ãã§ã¢ããªã±ã¼ã·ã§ã³ãå ¬éããå ´åã«å¿ è¦ãªè¨å®é ç®ãæ´ãåºãã¾ãããã¼ãã£ã«ãã¡ã¤ã³ã使ãå ´åã¯ã ãã¡ã¤ã³å DocumentRoot ãã°ãã¡ã¤ã«å CGIã使ããªãScriptAlias ã®4ã¤ãåºæ¬ã«ãªãã¨æãã¾ããè¦ç´ã決ãã ãããã®è¨å®ãèªååããããã®è¦ç´ã決ãã¾ã
[追è¨] ifæ§æã®å¤æ°ã¹ã³ã¼ãã®èª¬æã«ééããããã¾ããæ°ããã¹ã³ã¼ãã¯ä½ããã¾ããã ãçã®ã¾ã£ãã ä¸8/11(å)ã«ã社å åå¼·ä¼ãéãã¦ãPHPã¦ã¼ã¶åãã«Ruby/Railså ¥éãããã¾ããã ãã¤ã¯ãçã®åææ¥ã«4æéãåå¼·ä¼ã£ã¦äºã§ããããªã«äººãéã¾ããªãã ããã¨æã£ã¦ããã®ã§ããããµããéãã¦ã¿ãã28åãåå ããããã³ã£ãããã¾ãããããã ãèå³ãæã£ã¦ããã£ãã®ã¯å¬ãããã©ãããã ãéã¾ããªãè³æã¯ã¡ããã¨ä½ããªãã¨ã»ã»ã»ã»ãã¨ãããã¨ã§ãä½ã£ãè³æãå ¬éãã¾ãããªãã¨Rubyç·¨100ãã¼ã¸ãªã¼ãã¼ãRailsç·¨200ãã¼ã¸ãªã¼ãã¼ã¨ãããªã大ä½ã§ãã RubyKaigiã§ãçºè¡¨è ã®ã¹ã©ã¤ãã®æ¨ªã§IRCã表示ããã¦ããã®ãé¢ç½ãã£ãã®ã§ãåå¼·ä¼ã®åå è ã«ã¯ãLingrã®ãã£ããã«ã¼ã ã«å ¨å¡å ¥ã£ã¦ããã£ã¦ã質åããã¼ããã¨ã®ãçµãã£ãï¼ãã¨ããæ¸ãè¾¼ã¿ããã¦ãããã¾ãããä»
éæã®å¤ã«åºçºãã¦ãæ¥æã®å¤ã¾ã§ãã¹ãã¼ã«ãã£ã¦ãã¾ããã ä»å¹´ã®åãã¹ãã§ãã å®å®¿ã§ããã®ã§ããããç°å¢ãªã©ãªãæ´æ°ã¯ãä¼ã¿ã§ããã ããã宿ã«ãããç°å¢ããã£ãã¨ãã¦ãããã¶ãæ´æ°ã§ããªãã£ãã¨æãã¾ãï¼ï¼¾ï¼¾ï¼ ä»åã®ã¹ãã¼æ è¡ã¯ãé常ã«ãã¼ãã§ãããåºç¤ä½åãªãããã§ãï¼ï¼ï¼ï¼ã ãã¦ãã¾ã ã¾ã ç²ãã®æ®ãä½ã«éããã£ã¦ãæ´æ°éå§ã§ãã ä»æ¥ã¯ãrubyãããFlickr APIããå©ç¨ãã¦ç»åãæ¤ç´¢ããæ¹æ³(ã³ã¼ã)ãç´¹ä»ãã¾ãã ãFlickr APIãã«ã¯ãRESTå½¢å¼ã§å©ç¨ããæ¹æ³ã¨xml-rpcã§å©ç¨ããæ¹æ³ã®2éãã®å©ç¨æ¹æ³ãæä¾ããã¦ãã¾ãã ä»åã¯ãRESTãå©ç¨ããæ¹æ³ãã¤ãã£ã¦ç»åæ¤ç´¢ã«ææ¦ã§ãã ãFlickr APIããå©ç¨ããããã«ã¯ãFlickrã®ã¢ã«ã¦ã³ããå¿ è¦ã§ãããæã¡ã§ãªãæ¹ã¯ããã¡ãããã¢ã«ã¦ã³ããåå¾ãã¦ãã ããã ã¢ã«ã¦ã³ããåå¾ãããããS
â String#scrape ã©ãããåãã¯ããã ããscrAPI ã¯å¼·åã ããããããèªåãã¾ãã«å¾ æãã¦ãéå ·ã使ãããªããï¼ã¨ææ°è¾¼ãã§ããã ãã©ãã©ãã ã決æãã¦ããã®è¤éãªå¼æ°ã«æ¯åæ«æãã¡ãã£ã¦ãæ«æã¤ã¼ãã¡ãã£ã¨ä½¿ãããã ããªã®ã«ãã¼ã¶(Scrape)ç¨ã®ã¯ã©ã¹ãå®ç¾©ããã®ãé¢åãªãã ãããã¿ãããªè¨ã訳ãæ¯åèªåã«ãã¤ã¤ãçµå±ä½¿ãããªãã¦ãªãè³å ãã¨ãä¸ä»£ã®ãåããªãã ãã©ãã¾ãå®éå¼æ°ã«ç¡é§ã«è²ããªæ©è½ãè©°ãè¾¼ã¿éãã¦ãæã¯å¦ããªãããã¨ãããextractorã®srcã¨dstã¯ã©ãè¦ã¦ãç´æçã«éã ããgrepã¿ããã«ä½¿ãããã使ããªã1ã ãªãã¿ãããªæç´ããã¼ãã¦ããããããCSS3ãªgrepã¨ãã¦ä½¿ããã ãã§ããäºã«æ°ä»ãã¦ãYouãStringã¯ã©ã¹ã«å ¥ãã¡ãããªYOï¼ String#scrape ã®å®ç¾© require 'scrapi' class Strin
ã¯ã¦ãªã°ã«ã¼ãã®çµäºæ¥ã2020å¹´1æ31æ¥(é)ã«æ±ºå®ãã¾ãã 以ä¸ã®ã¨ã³ããªã®éããä»å¹´æ«ãç®å¦ã«ã¯ã¦ãªã°ã«ã¼ããçµäºäºå®ã§ããæ¨ããç¥ãããã¦ããã¾ããã 2019å¹´æ«ãç®å¦ã«ãã¯ã¦ãªã°ã«ã¼ãã®æä¾ãçµäºããäºå®ã§ã - ã¯ã¦ãªã°ã«ã¼ãæ¥è¨ ãã®ãã³ãæ£å¼ã«çµäºæ¥ã決å®ãããã¾ããã®ã§ã以ä¸ã®éãã確èªãã ããã çµäºæ¥: 2020å¹´1æ31æ¥(é) ã¨ã¯ã¹ãã¼ãå¸æç³è«æé:2020å¹´1æ31æ¥(é) çµäºæ¥ä»¥éã¯ãã¯ã¦ãªã°ã«ã¼ãã®é²è¦§ããã³æ稿ã¯è¡ãã¾ãããæ¥è¨ã®ã¨ã¯ã¹ãã¼ããå¿ è¦ãªæ¹ã¯ä»¥ä¸ã®è¨äºã«ãããã£ã¦æç¶ãããã¦ãã ããã ã¯ã¦ãªã°ã«ã¼ãã«æ稿ãããæ¥è¨ãã¼ã¿ã®ã¨ã¯ã¹ãã¼ãã«ã¤ã㦠- ã¯ã¦ãªã°ã«ã¼ãæ¥è¨ ãå©ç¨ã®ã¿ãªãã¾ã«ã¯ãè¿·æãããããããã¾ãããã©ãããããããé¡ããããã¾ãã 2020-06-25 è¿½è¨ ã¯ã¦ãªã°ã«ã¼ãæ¥è¨ã®ã¨ã¯ã¹ãã¼ããã¼ã¿ã¯2020å¹´2æ28
http://blog.labnotes.org/category/scrapi/ ruby ã§ã¹ã¯ã¬ã¤ãã³ã°ã㦠web ã®æ å ±ãåå¾ããã®ã«ã¯ãä»ã¾ã§æ£è¦è¡¨ç¾ã xpath ã§ãã£ã¦ãã®ã§ãããã¨é¢åã§ãããã§ããµã¨ scrAPI ã¨ããã¹ã¯ã¬ã¤ãã³ã°ãã¼ã«ããããç¥ã£ãã®ã§ããããããããªã便å©ããã ãã®ãã¼ã«ãããã使ãã¨ãCSS3 ãªã»ã¬ã¯ã¿ãè¨è¿°ãããã¨ã§ãè¦ç´ ãåå¾ãããã¨ãã§ãã¾ãããã¨ãã°ã¨ãããµã¤ãã®ãªã³ã¯ãå ¨é¨åå¾ããããã°ã require 'rubygems' require 'scrapi' require 'open-uri' require 'nkf' require 'pp' $KCODE = 'u' links = Scraper.define do process "a[href]", "urls[]"=>"@href" result :urls e
Perl ã§ã® print debug ã®æ¹æ³ã®ç´¹ä»ããã¼ã (?)ã ã£ãã®ã§ãèªåãããè¡ã£ã¦ã Ruby ã§ã® debug æ¹æ³7ã¤ã«ã¤ãã¦æ¸ãã¦ã¿ã¾ãã p ãåãã®äººãå¤ã Kernel#p ã¡ã½ãããããã使ãã¨ãªãã¸ã§ã¯ãã®å 容ãè¦ãããå½¢ã§åºåãã¦ããã¾ãã >> p ({:foobar => :baz}) {:foobar=>:baz}Object#inspect ã使ãã¨ãp ã§åºåããã¨ãã¨åãæååã String ã¨ãã¦åå¾ã§ãã¾ãã >> puts ({:foobar => :baz}).inspect {:foobar=>:baz}åå¿è ã®é ãã® p ã§ã®åºåã使ãæ¹æ³ãããããªãã¦å°ã£ãè¨æ¶ãâ¦ã pp pp ã¨ããã©ã¤ãã©ãªã使ãã¨ãp ãããããè¦ãããå½¢å¼ã§åºåãã¦ããã¾ãããã¨ãã° >> a = Array.new(10) { {:foobar => :
éå¼ãRubyã¯Rubyã使ã£ã¦ããããäºããããã®æ¹æ³ã調ã¹ãããéå¼ãã®ãªãã¡ã¬ã³ã¹ã§ãã éå¼ãRubyã¯ãã¨ãã¨Wikiã§éç¨ãã¦ãã¾ããããã®ãããæ¬ãµã¤ãã®ã³ã³ãã³ãã¯ç§ä»¥å¤ã®å¤ãã®æ¹ã«ãã£ã¦ä½æã»ç·¨éããããã®ã§ãã 2017å¹´ã«éçHTML(jekyll)ã®ç®¡çã¸ç§»è¡ãã¾ãããã2018å¹´10æããScrapboxã¸ç§»è¡ãã¾ãããã©ãªãã§ãç·¨éããã ãã¾ãã®ã§ããååããã ããæ¹ã¯ãããããé¡ããã¾ãã éå¼ãRuby (https://scrapbox.io/rubytips/éå¼ãRuby)
æ³¨ï¼ Rubyã¯2.1.0ããSemantic Versioningãæ¡ç¨ãã¦ãã¾ãã Ruby 2.1.1, 2.1.2çã¯ãã°ä¿®æ£ãã»ãã¥ãªãã£fixã®ã¿ãå«ãããããªãã¡ã¬ã³ã¹ã¨ãã¦ã¯2.1ã«çµ±ä¸ãã¦ãã¾ãã
class Member < ActiveRecord::Base has_one :favorite end class Favorite < ActiveRecord::Base belongs_to :member end has_one ã§é¢é£ãå®ç¾©ããã¨ã以ä¸ã®ã¡ã½ãããèªåçã«å®ç¾©ããã¾ãã(belongs_to å´ã«ãåæ§ã®ã¡ã½ãããå®ç¾©ããã¾ã)ã (é¢é£å)(force_reload = false) : é¢é£ãããªãã¸ã§ã¯ããåå¾ãã¾ãã (é¢é£å)= : é¢é£ãããªãã¸ã§ã¯ããä»£å ¥ãã¾ãã(èªåçã«DBã¸ä¿åããã¾ã) (é¢é£å).nil? : é¢é£ãããªãã¸ã§ã¯ããåå¨ããªããã¨ã確èªãã¾ãã(ãªããã° true ãè¿ã) build_(é¢é£å)(attributes = {}) : é¢é£ãããªãã¸ã§ã¯ããä½æãã¦è¿ãã¾ãã(DBã¸ã®ä¿åã¯ããã¾ãã) create
ãªãªã¼ã¹ãé害æ å ±ãªã©ã®ãµã¼ãã¹ã®ãç¥ãã
ææ°ã®äººæ°ã¨ã³ããªã¼ã®é ä¿¡
å¦çãå®è¡ä¸ã§ã
j次ã®ããã¯ãã¼ã¯
kåã®ããã¯ãã¼ã¯
lãã¨ã§èªã
eã³ã¡ã³ãä¸è¦§ãéã
oãã¼ã¸ãéã
{{#tags}}- {{label}}
{{/tags}}