è¿æ³
移転ãã¾ãã
JMeterã試é¨ä¸ã«org.apache.commons.httpclient.NoHttpResponseException(The target server failed to respond)ã¨ãè¨ãããçç±
HTTPãªã¯ã¨ã¹ãè¨å®ã§KeepAliveæå¹ã«ãªã£ã¦ãå ´åããµã¼ãå´ã§æ¥ç¶ãã¿ã¤ã ã¢ã¦ããã¦ãå¯è½æ§ããã¾ããKeepAliveã®ã¿ã¤ã ã¢ã¦ãè¨å®ãè¦ãªããã¦ã¿ãã¨å¹¸ãã«ãªããããã
Rubyãã¹ã¼ãã¼ã¯ã©ã¹ã«ã¡ã½ãããå®ç¾©ããã¦ããæã ãsuperããã
ããã¾ãã¦ããã§ã¨ããããã¾ãï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼
表é¡ã®æ©è½ã¯inheritedã¡ã½ãããå®ç¾©ããã¦ãã¢ã¸ã¥ã¼ã«è¤æ°includeããæãªã©ã«æ¬²ãããªãããã§ããã
def inherited(klass) super if defined?(super) end
ãªã©ã¨ãããã¨ã§å®ç¾ã§ããã
defined?(super)ã¯ã¡ã½ããå¼ã³åºãã§ã¯ãªãã¦å¤ªå¤ããããè¬ã®æ§æã§ã(ref: http://docs.ruby-lang.org/ja/1.9.3/doc/spec=2fdef.html#defined)
Rubyã§ãããã¸ã«ã«ã½ã¼ããã
ä¾åé¢ä¿ãå®ç¾©ããã°ã©ããå
ã«å¦çé 決ããã¨ãã«ä½¿ã£ããããããã§ã、ãã。
gitã®ã³ããããªãã¸ã§ã¯ã(è¤æ°ã®è¦ªãæã¤å¯è½æ§ããã)ã並ã³æ¿ããå¿
è¦ããã£ãã®ã§èª¿ã¹ã。
Rubyã«ã¯ tsortというライブラリが標準添付されているã®ã§ä¾¿å©ï½¡1.7あたりからある模æ§ï½¡
ãããã¸ã«ã«ã½ã¼ãã«ã¯
- ãã¼ãã®éåãåå¾ãã
- ãããã¼ããç¹ãã£ã¦ããå ã®ãã¼ããåå¾ãã
ã¨ãããã¼ã¿æ§é ã«ä¾åããå¦çãå¿ è¦ã§ï½¤ãããç¨æãã¦ããã°tsortããã¾ããã¨ãã£ã¦ããã。
require 'tsort' class Nodes include TSort def tsort_each_node(&block) # ãã¼ããåæãã¦blockã«æ¸¡ãå¦çãå®è£ ãã end def tsort_each_child(node, &block) # node ãç¹ãã£ã¦ããå ã®ãã¼ããåæãã¦blockã«æ¸¡ãå¦çãå®è£ ãã end end nodes = Nodes.new(...) nodes.tsort # ãããã¸ã«ã«ã½ã¼ãããããã¼ãã®é åãåå¾ãã
ã¿ãããªä½¿ãæ¹ã§ã。
ActiveRecordãSTIããæã®ã¯ã©ã¹æ±ºå®ã«ã¼ã«ãèªç±ã«æ±ºãã
åæ
- ActiveRecord 3.2.11
å®è£
ã¯ã©ã¹ã®æ±ºå®ã¯ActiveRecord::Inheritance#instantiate(record)å ã§è¡ã£ã¦ãã®ã§ãããã«ãããå½ã¦ãã°ãããã
ãã ãã¯ã©ã¹ã®æ±ºå®ã¯ãã¼ãæã«ããè¡ãããªãããã§ãåçã«å¤ããã«ã©ã ãå ã«ããSTIãå®ç¾©ããã¨æå³ä¸æç¶æ ã«ãªãã¨ãããªã¹ã¯ããããtypeã«ã©ã ã«æ ¼ç´ãããã¯ã©ã¹åã®ã¿ãå ã«ããã£ã¦ããARã®è¨è¨ã¯å¦¥å½ãªã®ããã
Ruby、method_addeã¿ããã«å®æ°ãå®ç¾©ãããã¨ãããã¯ããã
ãã©ç¡çã£ã½ãã®ã§æ¬ä½æ¹é ãã¦ã¿ã
Module#const_added
ãå®ç¾©ãã¦ããã¦ï½¤å®æ°å®ç¾©ããé¢æ°ã®æ¬ä½ã rb_const_set(VALUE klass, ID id, VALUE val)
ãªã®ã§ï½¤ããã«ç´°å·¥ãã¦å®æ°ã»ããå¾ã« const_added
ãå¼ãã§ããã°OK。
ãã ãrb_const_set
ã¯Rubyèµ·åæã®ã¯ã©ã¹é層åæåæã«ãå¼ã°ããã®ã§ï½¤ãã®éã¯ã¹ã«ã¼ããå¿
è¦ããã。
ã¨ããããã§ããããã¨ããããã ã£ã。
https://github.com/todesking/ruby/commit/ff4112340a149faf18cbe288fee02a419f801bcc
class A def self.const_added(id) puts "#{self}::#{id} added" end end A::X = 10 #=> "A::X added"
Rubyã®æ¹é 、autoconfãã¦configureãã¦makeããã°ç°å¢æ´ãã、ctagsã¨vimã®ã¿ã°ã¸ã£ã³ããããã°ã ãããã³ã¼ã追ããã®ã§ããã¨åå ¥éå£ä½ããããã ã£ã。çããããã£ã¦ã¿ãã¨ããã§ãã。
RailsãActiveRecord+mysql2ãSQLå®è¡æã«warningåºããã¨ã©ã¼ã«ãã
MySQLã®warningã£ã¦ã
- æååãé·ãããããåæã«çããã¦ä¿åãã¦ãããã!
- æ°åã大ããããããé©å½ãªæ°åãä¿åãã¦ãããã!!
- æ°å¤ã¨ãã¦è§£éã§ããªãæååããã£ããã0ã¨ã¿ãªãã¦æ¯è¼ããã!!!
ãªã©ãç¡è¦ããã¨æ»ã¬ç³»ã¡ãã»ã¼ã¸ã§ãããã¨ãå¤ããã ãã©ç¡è¦ãããã¡ãªã®ã§å°ãè ã
insertç³»ã®warningã«ã¤ãã¦ã¯sql_modeã®è¨å®ãå¤ãããã¨ã§ã¨ã©ã¼ã«ã§ãããã ãã©ããã®è¨å®ããªããã¦ãªãã£ãããselectがヤバイã¿ãããªã±ã¼ã¹ããã£ãããã¦ãª(ï¼Â´Ðï½)
ã¨ããããã§ãActiveRecordå´ã§ãã§ãã¯ããã¢ã³ãã¼ããããæ¸ãã¾ãã(for mysql2)ã
1ã¯ã¨ãªå®è¡ãã¨ã«show warningæãã¦ãã®ã§æ¬çªã«ã¯ããããããªãã
Mysql2::Clientããªãªã¼ã¹ãã¼ã¸ã§ã³ã«ã¯warning_countããªãã®ã§â¦â¦ãHEAD使ããã次ãã¼ã¸ã§ã³ãå¾
ã¡ã¾ãããã