移転ãã¾ãã
ä»å¾ã¯ã¡ã¢ãå«ãKazuho's Weblogã«æ¸ãã¦è¡ããã¨æãã¾ãã
OSSã®éçºã¢ãã«ãããã®ã¾ã¾ç¤¾å ã«æã¡è¾¼ãã®ã¯æ¢ããã»ããããï¼ãããã¯ã³ã¼ãã¬ãã¥ã¼ã®è©±ï¼
以å以ä¸ã®ããã«ãã¤ã¼ããã話ã ãã©ãOSSã®éçºã¢ãã«ã社å éçºã«ãã®ã¾ã¾æã¡è¾¼ãã®ã¯å±éºã
ãã¼ã éçºã®å ´åãç°¡åã«ã³ã¡ã³ãè¿ããªããããªPRéãããæç¹ã§è² ãã ã¨æã£ã¦ããç¡é§ãªã³ã¼ããçç£ãããªãããäºåã«è¨è¨ãè©°ããä½æ¥ããã¹ã / âéãªã¬ãã¥ã¼ - ✘╹◡╹✘â http://htn.to/by5or1
https://twitter.com/kazuho/status/431602421068877824
ä»æ¥ä¸è¬çã«æ³å®ããããOSSã®éçºã¢ãã«ãã¯Eric S. Raymondã®æåãªã¨ãã»ã¼ã§ããã伽藍とバザールãã«ãã£ã¦è§£èª¬ãããã¨ããã®ããã¶ã¼ã«ãã§ããã
ããã¶ã¼ã«ãã¢ãã«ã«ããã¦ã¯ãå¤ãã®æ¹åææ¡ã®ä¸ããæåã¨èããããå®è£ ãåãå ¥ããããã³ãã¥ããã£ã§å ±æãããããã«ãªããåã¨ãã»ã¼ããå¼ç¨ãããªãã
ããµãããã£ã¦ã¿ãã¨ãLinux ã®ææ³ãæåã®åä¾ã¯ GNU Emacs ã® Lisp ã©ã¤ãã©ãªã¨ Lisp ã³ã¼ãã¢ã¼ã«ã¤ãã®éçºã«ã¿ããã¨ãã§ãããEmacs ã® C ã®ã³ã¢é¨åããã®ä» FSF ãã¼ã«ã¿ãããªãä¼½è建ç¯æ¹å¼ã«ããã¹ãã¨ãLisp ã³ã¼ãã®ãã¼ã«ã®é²åã¯æµåçã§ããããã¦ã¼ã¶ä¸»å°ã§è¡ããããã¢ã¤ãã¢ããããã¿ã¤ãã»ã¢ã¼ãã¯ãå®å®ããæçµå½¢ã«è½ã¡çãã¾ã§ 3 åã 4 åãæ¸ãç´ãããã®ãããã£ã¡ã ãã ã£ãã
ä»æ¥çã«è¨ãæãããªãããã¾ããããã©ã³ããpull-requestã®ä¸ããæè¯ã®ãã®ãé¸æãããã¨ãããã¨ã
ããã¯ãã¨ã³ã¸ãã¢ãªã³ã°ãªã½ã¼ã¹ã潤沢ã«ããããããæ¡ããã¨ãã§ããã¢ããã¼ããããã¦ãæåããOSSã¯å¿ ãã¨ã³ã¸ãã¢ãªã³ã°ãªã½ã¼ã¹ã潤沢ã«ãªãã®ã§ï¼æåããOSSã®å ´åãåé¡ããã£ããç´ããã¨ãã人ãå¤æ°ããããï¼ãOSSã®éçºã¢ãã«ã¨ãã¦ã¯ããã¶ã¼ã«ãã¢ãã«ããã¾ãæ©è½ããããã«è¦ããã
ãããã社å éçºã«ããã¦ã¯ãéãããã¨ã³ã¸ãã¢ãªã³ã°ãªã½ã¼ã¹ãã§ããã ãå¹çããæ´»ç¨ãããã¨ãæ±ãããããå¥ã®è¨ãæ¹ãããã¨ãã¨ã³ã¸ãã¢ããç¡é§ãªä½æ¥ããããå¯è½æ§ãæ¸ãããã¨ãèããã¹ãã ããããã¯ãã¶ã¼ã«ã¢ãã«ã¨ã¯ç¸åããã
ã³ã¼ãã¬ãã¥ã¼ã®è©±ã¯ãã®å ·ä½ä¾ã§ãã£ã¦ã社å ã§ã®ã°ã«ã¼ãéçºã«ããã¦ãã«ãªã¯ã¨ã¹ãã®è©ä¾¡ï¼ãã³ã¼ãã¬ãã¥ã¼ï¼ã§è¨è¨ã®åé¡ãææããã¨ããã¢ããã¼ãã¯ãå®è£ å®äºå¾ã«è¨è¨ã®è©ä¾¡ãè¡ããã¨ã«ãªãã¨ããæå³ã§ãæç´ããçºçããå ´åã®æ失ã大ãããªããã¡ã
ããããããå®è£ éå§åã«è¨è¨ã¬ãã¥ã¼ããããªã©ãã¦ãç¡é§ãªã³ã¼ãã£ã³ã°ä½æ¥ãæ¸ãããã¨ãèããã¹ãã
åè:
テストファーストなGitワークフローについて - kazuhoのメモ置き場
https://twitter.com/t_wada/status/443945356665962496ã®ã¹ã¬
MacBookã®CPUã¯ããã¯ã表示ããæ¹æ³(Intel Power Gadget)
Intel Power Gadgetãã¤ã³ã¹ãã¼ã«ããã¨ãæå ã®Macã®CPUã¯ããã¯ãGPUã¯ããã¯ã表示ãããã¨ãã§ããã以ä¸ã¯åãã¼ã«ãMacBook Pro(Early 2013; 2.4GHz Core i7)ã§å®è¡ãã¦ããç»é¢ã ããè² è·ããããéã«å®æ ¼ã®2.4GHzãä¸åã3.2GHzã§åä½ãã¦ãããã¨ãåããã
å®æ ¼ããéãé度ã§åãã¦ãã®ãè¦ããã®ãããããããã¢ããªå ¨é¨çµäºãã¦ãé«ãã¯ããã¯æ°ï¼ï¼é«ãæ¶è²»é»åï¼ã«å¼µãä»ãã¦ãããããå ´åã¯ãåèµ·åããæ¹ãããããªã®æã¡ãè¯ããªãããããããããã¼ã«ãããã¦ããã¨ç¢ºèªã§ãã¦ä¾¿å©ã
WebSocketsã§ã®éä¿¡å¦çã«é¢ãã注æç¹ï¼CLOSINGã¹ãã¼ãã¨closeã¤ãã³ãã«é¢ããçåï¼
WebSocketsã®æ¥ç¶ç¶æ ã«ã¯ãCONNECTING / OPEN / CLOSING / CLOSEDã®ã¹ãã¼ããå®ãããã¦ããã
ä¸æ¹ãCLOSINGç¶æ ã¸ã®é·ç§»ã«å¯¾å¿ããã¤ãã³ãã¯åå¨ãããCLOSEç¶æ ã¸é·ç§»ããéã«closeã¤ãã³ããçºçããã¨ããã¦ããã
ã¤ã¾ãããcloseã¤ãã³ããæ¥ãã¾ã§ã¯éä¿¡ã§ãããã¼ãã£ã¦ãªã³ã¼ããæ¸ãã¦ãã¨ãæ£å¸¸ç³»ãªã®ã«send()ã§ä¾å¤çºçããå¯è½æ§ãããã
ãªã®ã§ãé¢åã ãã©ã
if (ws.readyState == 1) { ws.send(...); }
ã®ãããªã¬ã¼ããå ¥ããå¿ è¦ããã*1ããããã¯ãws.readyState == CLOSING ç¶æ ã«ãªã£ããcloseã¤ãã³ãã®ãã³ãã©ãå¼ã³åºããããªã©ããã¼ãæ¸ãå¿ è¦ãããã
ã¨ã以ä¸ã®çµè«ã«è³ã£ããã§ããããã£ã¦ã¾ãã§ããããï¼ãï¼èè
以ä¸ãè¦æ ¼ããã®å¼ç¨ã
CONNECTING (numeric value 0)
ããThe connection has not yet been established.
OPEN (numeric value 1)
ããThe WebSocket connection is established and communication is possible.
CLOSING (numeric value 2)
ããThe connection is going through the closing handshake, or the close() method has been invoked.
CLOSED (numeric value 3)
ããThe connection has been closed or could not be opened.
When the WebSocket closing handshake is started, the user agent must queue a task to change the readyState attribute's value to CLOSING (2). (If the close() method was called, the readyState attribute's value will already be set to CLOSING (2) when this task runs.)
When the WebSocket connection is closed, possibly cleanly, the user agent must queue a task to run the following substeps:
ãã1. Change the readyState attribute's value to CLOSED (3).
ãã(ç¥)
ãã3. Create an event that uses the CloseEvent interface, with the event type close, ...
*1:å ¨äºéãªãããã³ã«ãªã®ã§ãelseç¯ã¯ä¸è¦ã§åé¡ãªãã¯ã
DRY(don't repeat yourself)ãããããªããããã®å¤æåºæºã«ã¤ãã¦
ãéå°ãªDRYãæè¡çè² åµãçããã¿ãããªå 容ã®è¨äºãæ¸ããããããã¾ãè¨èªåã§ããªãããéå°ãªé£äºå¶éãå¥åº·ãæãªããç¨åº¦ã®å 容ã«æãä¸ããããã ãã©ããããªããããªããã ãâ¦
@methane å®è£ ã«ãããDRYã¿ãããªãã®ãèãã¦ãã¦ãããããã¨åè ã®DRYã¨ããã®ãã©ãã«ä½ç½®ã¥ãããããã¯ããããªããã§ãããã¨ã«ããæé»ç¥ã¿ãããªãã®ãéå°ã«å¢ããDRYã¯è¯ããªããããã¨ãããããªè©±ãªãã§ã
ã¨ãã@moriyoshitããã®ãã¤ã¼ãï¼1, 2ï¼ãè¦ãããã®ã§ãåã®èãæ¹ãã³ã¡ã³ããmoriyoshitããã®èãããåé¡ã¨ã¯ãããã¦ãããã
DRYåã®å罪ã¨ã¯ä½ãï¼
åã®ç解ã§è¨ãã¨ãå ±éããã³ã¼ãçãDRYåãããã¨ã«ã¯ä»¥ä¸ã®å¤åãããããã
- 循環的複雑度ã¯å¤åããªã
- ã³ã¼ã«ã°ã©ãã¯è¤éåãã
- ã¢ã¸ã¥ã¼ã«ãã¾ããDRYåãè¡ãã¨ãã¢ã¸ã¥ã¼ã«éã®ä¾åé¢ä¿ãè¤éåãã*1
- é¢æ°å ã®è¤é度ã¯ä½ä¸ãã
éå°ãªDRYåãè¡ãããèæ¯ã¨ãã¦ã¯ã第ï¼ç¹ã®è°è«ãè¦è½ã¨ãããã¡ãªããããªãããã¨æã£ã¦ãã
ã§ã¯ã©ããã¹ããï¼
ä¸è¨ã®ï¼ç¹ããã
- é¢æ°å ã®è¤é度ã®ä½ä¸ã«ããã¡ãªããããã³ã¼ã«ã°ã©ãã®è¤é度ã®ä¸æã«ãããã¡ãªãããä¸åãå ´åã®ã¿ãDRYåãè¡ã
- ã¢ã¸ã¥ã¼ã«éã®è¤éæ§ä¸æãæãããããDRYåã¯ã§ããã ãå±æçã«è¡ã*2
ãåºæ¬çãªæéã«ãã¦ãã¾ãã
ã¯ãã¼ãºãã½ã¼ã¹ãªnode.jsã©ã¤ãã©ãªã®ä¾åé¢ä¿ãdedupeãã話
node.jsã§éçºãã¦ãã¨ã社å ã§ä½ã£ã¦ãã©ã¤ãã©ãªã®ä¾åé¢ä¿ããã¡ããã¡ããã¦ãããã¨ãããã¾ãããã
app --+--> libA ----> libB | +--> libB
ã¿ãããªãããããã¨ãlibBãnpmã«ç»é²ãããã¢ã¸ã¥ã¼ã«ã§ããã°npm dedupeã³ãã³ãä¸çºã§libBãã²ã¨ã¾ã¨ãã«ãã¦ããããã©ãgitã«ç»é²ããã¦ãã¤ã ã¨ãã¦ãããªãï¼ã®ã¯以前も書いたï¼ãã§ãã¾ããã£ã±ãä¸ä¾¿ã ãã代æ¿çããããã©ãããè¯ãããããã®ã§ãã±ã±ã£ã¨æ¸ããã
force-dedupe-git-modules - npm
ãã®ã³ãã³ã使ãã¨ãgithub.comã®ãã©ã¤ãã¼ãã¬ãã¸ããªãGitHub Enterpriseã«ç½®ãã¦ããnpmå½¢å¼ã®ç¤¾å ã©ã¤ãã©ãªã«ã¤ãã¦ãå¼·å¶çã«dedupeããããã¨ãã§ããã
ç°¡åã
ãããã¯ãã©ã³ãå ã®å¤æ´ãç¡è¦ãã¦git bisectããæ¹æ³
merge commitã«ã¤ãã¦ã¯1st parentã®ã¿ããã©ããªããgit bisectããããã¨ã£ã¦ããã¾ãããï¼ (åç §: テストファーストなGitワークフローについて - kazuhoのメモ置き場)
ããããã¨ãã1st parent以å¤ã«å±ããcommitãgit bisect skipããã®ãã©ããã£ãããããã«æ¸ããã®ããªã¨æã£ã¦ãã®ã§ããã以ä¸ã®ãããããä¸çªãããã
$ git bisect skip $(comm -23 <(git rev-list HEAD | sort) <(git rev-list --first-parent HEAD | sort))
thanks to: ひろせ31 on Twitter: "@kazuho comm -2 -3 <(cat A|sort) <(cat B|sort) とか?", Masakazu Takahashi on Twitter: "@kazuho 訂正。comm -23 A B でした"