YouTubeã§ãæ°ã«å ¥ãã«å ¥ããåç»ã®ã¿ã¤ãã«ãä¸è¦§åãã¦è¦ãããªã£ãã®ã§ã YouTube Data APIçµç±ã§ãã¼ã¿ãåå¾ãã¦è¡¨ç¤ºããNode.jsã¹ã¯ãªãããä½ã£ã¦ã¿ãã APIã¸ã®ã¢ã¯ã»ã¹èªä½ã¯ãµã¯ãã¨ã§ããã®ã ãã©ã è¤æ°ãã¼ã¸ãã¼ã¿ãéåæã§åå¾ããããã¼ã®ã³ã³ããã¼ã«ã§è¦å´ããã Node.jsã¹ã¯ãªãããæ¸ãæã¯æ¯åãã®ããã¼ã³ã³ããã¼ã«ã§ã¤ã¾ã¥ãã®ã ãã©ã æ £ãã®åé¡ãªã®ã ãããã ä»åã¯caolan/asyncã©ã¤ãã©ãªã®ãããã§ä½ã¨ã解決ã§ããæãã async - Documentation ä½æããã¹ã¯ãªããã®å 容ãç´¹ä»ãã¤ã¤ã éåæå¦çãä¸ç¹å®åæ°å®è¡ããéã®ãã¿ã¼ã³ã«ã¤ãã¦èãã¦ã¿ããã YouTubeã®APIã«ã¢ã¯ã»ã¹ããæºå ä»åã®ã¹ã¯ãªããã¯YouTubeã®APIãå©ç¨ããããã Googleã®ãããããã¼ãµã¤ãã§ã¢ããªã±ã¼ã·ã§ã³ç»é²ãå¿ è¦ã¨ãªãã
ããããNode.jsã¹ã¯ãªããä½æã«ãæ £ãã¦ããã®ã§ã ç°¡åãªWebã¢ããªä½æã«ææ¦ãã¦ã¿ãã MeteorãMEAN.jsãSails.jsãªã©è²ã ãã£ã¦è¿·ã£ããã©ã ã¾ãã¯ã·ã³ãã«ã«Expressã使ã£ã¦ã¿ãã MongoDBã³ã¬ã¯ã·ã§ã³ã«ä¿åãããæ å ±ã Webãã¼ã¸ä¸ã«ä¸è¦§è¡¨ç¤ºããã¹ã¯ãªãããã Node.js+Express+MongoDBã§ä½æããã ãã³ãã¬ã¼ãã«ã¯ä»¥åå©ç¨ãããã¨ã®ããEctã使ãã æéãã©ã¼ãããã«ã¯Momentã使ãã ãã¼ã¢ã³åã«ã¯PM2ã使ã£ãã Momentæ¬å®¶ãµã¤ã: Moment.js | Home ECTãã³ãã¬ã¼ãã¨ã³ã¸ã³æ¬å®¶ãµã¤ã: ectjs.com PM2ã®Githubãã¼ã¸: github.com ä½æã®æµã ããã¸ã§ã¯ãã®åæåå¦çï¼ $ npm init $ npm install express --save-dev $
ãµã¼ããéããã©ã©ããç´ãã°ãããåãããªããã調æ»ãã¦ããã¼ã㨠Tomcatã®ã§ããã¢ã¯ã»ã¹ãã°ãã¡ã¤ã«ã渡ãããã®ã§ã ã¨ãããããã¼ã¿ãã¼ã¹ã«å ¥ãã¦èª¿æ»ãã¦ã¿ãã¹ã㨠ãã°ãã¡ã¤ã«ã®å 容ãããã¼ã¿ãã¼ã¹ã«åãè¾¼ãã¹ã¯ãªãããæ¸ãã¦ã¿ãã Node.jsã®Streamãå ¨ç¶ç解ãã¦ãªãã£ãã®ã§ãããåå¼·ã«ãªã£ãã åãè¾¼ã¿ã¹ã¯ãªãããä½æãã ãã°ãã¡ã¤ã«ã¯åè¡ãä¸è¨ã®ãããªãã©ã¼ãããã«ãªã£ã¦ããã¨ããï¼ ï¼IPã¢ãã¬ã¹ï¼ - - [ï¼ã¢ã¯ã»ã¹æ¥æï¼] "ï¼HTTPã¡ã½ããåï¼ ï¼ãªã¯ã¨ã¹ãURLï¼ ï¼HTTPãããã³ã«ãã¼ã¸ã§ã³ï¼" ï¼ã¹ãã¼ã¿ã¹ã³ã¼ãï¼ ï¼ã³ã³ãã³ãé·ï¼ ãããä¸è¨ã®ãããªãã¼ãã«ã«åãè¾¼ãã¨ãããï¼PostgreSQLï¼ HTTPãããã³ã«ãã¼ã¸ã§ã³ä»¥å¤ãåãè¾¼ãæ³å®ã CREATE TABLE tomcat_access_logs( id serial no
Javascriptã©ã¤ãã©ãªã®ä¸ã§ãã Underscore.jsã大å¤æ°ã«å ¥ã£ã¦ããã Underscore.js eachãfilterãmapãreduceç ãªã¹ãæä½ããããæä½é¢é£ã®é¢æ°ã 100以ä¸å«ã¾ããã¦ã¼ãã£ãªãã£ã©ã¤ãã©ãªã§ã ä»ã®è¨èªã«ãã£ã¦Javascriptã«ããã£ããããã®ã«ãªã ã¨æããããªãã®ãããå ·åã«ç¨æãã¦ããã¦ããã ä½æ¥å¹çåã®ããã®ä¸æ¬å¦çã«ã¯æ¬ ãããªãã©ã¤ãã©ãªã ã ä»åã¯Underscore.jsã«å«ã¾ããcountByé¢æ°ã使ã£ã¦ æåå¥åºç¾åæ°åå¾é¢æ°ãä½ã£ã¦ã¿ãã charCounteré¢æ°ãä½ã æåã®åºç¾åæ°ãåãã£ã¦å¬ããç¶æ³ã¨ããã®ãæããã¦ã©ãã»ã©ããã®ãã ã¡ãã£ã¨çåã¯ããã 誰ãã®å½¹ã«ç«ã¤ãã¨ãç¥ã£ã¦æ¸ãã¦ã¿ãã charCounterã¨ããååã§é¢æ°ãä½æããã var _ = require("underscor
ã©ããèªååãããªãå®å ¨èªååãããããã ã¨ãããã¨ã§ä»åã¯ä½æããGruntã¹ã¯ãªããã Windowsã®èµ·åæãæ¯æ¥ã®æ±ºã¾ã£ãæéã«å®è¡ã§ããããã« ã¿ã¹ã¯ã¹ã±ã¸ã¥ã¼ã©ã«ç»é²ããæ¹æ³ãç´¹ä»ããã ãã®è¨äºã¯Gruntãå®è¡ããç°å¢ãæ´ã£ã¦ãããã¨ãåæã¨ãã¦ããã®ã§ã æªã¤ã³ã¹ãã¼ã«ã®æ¹ã¯ä¸è¨ã®è¨äºãåèã«ãã¦ããã ãããï¼ blog.honjala.net ã¿ã¹ã¯ã¹ã±ã¸ã¥ã¼ã©ã®åºæ¬çãªä½¿ãæ¹ã¯ä¸è¨ã®ãã¼ã¸ã« 詳ããæ²è¼ããã¦ããï¼ https://121ware.com/qasearch/1007/app/servlet/relatedqa?QID=015385 ã¿ã¹ã¯ã¹ã±ã¸ã¥ã¼ã©ã¯ãã¹ããæå®ããã°è²ã 㪠ããã°ã©ã ãå®è¡ãã¦ãããã®ã ãã©ã Gruntã¹ã¯ãªãããå®è¡ããå ´åã¯ã¡ãã£ã¨å·¥å¤«ããå¿ è¦ãããã ãµã³ãã«ã¨ãã¦ãä¸è¨ã®ãã㪠å§æ¥æéããã£ããã¯ã¼ã¯ã«éç¥ããç°¡åãªG
å æ¥iPad miniã¨iPhone 6sãå°å ¥ãã¦ããã ãã¡ã®å¤ãã«ã¼ã¿ã¼ã2æ¥ééãããã§åèµ·åããªã㨠éä¿¡ãé ããªã£ã¦ãããã«ç¹ãããªããªãããã«ãªã£ãã ã©ãããæ°ããiPadã¨iPhoneã¯Wi-fiç°å¢ã ã¨ã¬ã·ã¬ã·éä¿¡ããããã§ã ã«ã¼ã¿ã¼ã®ãã£ããããã«è¶ ãã¦ãã¾ãã¿ããã ã ã«ã¼ã¿ã¼ãæ°ããããã°ããã«è§£æ±ºããããªè©±ã ãã ã¨ãããã1æ¥1ååèµ·åããã°å¿«é©ã«ä½¿ãããããªã®ã§ã ã«ã¼ã¿ã¼ãåèµ·åããã¹ã¯ãªãããæ¸ãã¦ã¿ãã 幸ããã¡ã®ã«ã¼ã¿ã¼ã¯Webãã©ã¦ã¶ã§æä½ã§ãã管çç»é¢ãæã£ã¦ããã BASICèªè¨¼ã§ãã°ã¤ã³ãã¦ç¹å®ã®URLãå©ãã¨åèµ·åã§ããã®ã§ã httpã¢ã¯ã»ã¹ããã¹ã¯ãªãããæ¸ãã¦æ¯æ©å®è¡ãããããã« å®æå¦çã®è¨å®ããã¦ããã°èªååã§ãããã ã ã¤ãã§ã«ãã¡ããã¨å®æå¦çãå®è¡ããã¦ãã確èªã§ããããã« åèµ·ååã«ãããããåèµ·åãã¾ãããã¨ããéç¥ã
ã³ãã¥ãã±ã¼ã·ã§ã³ã¨ããã®ã¯ãªããªãé£ãããã®ã§ã ãæ¥ãã§ç¢ºèªãããããè³æãã§ãããå ±æãã©ã«ãã«å ¥ãã¦ãããé£çµ¡ãã¦ãã ã¨å¼·ãã«ä¼ãã¦ãã è³æã¯ã¨ã£ãã«ã§ãã¦ãã®ã« ããå¾ã§é£çµ¡ããã¤ããã ã£ãã ã®ã ããã¡ãã£ã¨ç¢ºèªãã¦ããé£çµ¡ããã¤ããã ã£ãã ã®ã ä»ã¡ã¼ã«æ¸ãã¦ãã ã®ã§ã ä¸æ¬å ç·ããããã ãã§è¯ãã®ã«ãªããªãé£çµ¡ãããããªããã¨ãããã ãããªã¹ãã¬ã¹ãã«ãªè¡ãéã㯠ããã®ãããï¼ãã¨æ¯åæããççºãããããã ãã¼ã«ã使ã£ã¦è§£æ±ºã®ä»çµã¿ãç¨æãã¦ãã¾ãã«éãã ã¨ãããã¨ã§ä»åã¯æå®ãããã©ã«ããç£è¦ãã¦ã ãã¡ã¤ã«ã追å ããããæ´æ°ããããããã èªåã§éç¥ãã¦ãããã¹ã¯ãªãããã¤ãã£ã¦ã¿ããã 以åå¥ã®è¨äºã§ç´¹ä»ããNode.jsã®ã¿ã¹ã¯ã©ã³ãã¼ãGruntã使ãã° å²ã¨ç°¡åã«ãã¡ã¤ã«ç£è¦ãã¼ã«ãä½ããã¨ãã§ããã blog.honjala.net ãgrunt-
ååæ¸ããNode.jså ¥éè¨äºã®ç¶ãã blog.honjala.net ååããå¼ãç¶ãã ããã«ããã°ã©ã ã®åå¼·ç¡ãã§èªååã§ãããã¨ãå¢ãããã ãã¨ãã ããã«ä»é¨ç½²ã®ãã³ããã°ã©ãã«èªååãã¼ã«ã使ããã¦èªåã¸ã®ä½æ¥ä¾é ¼ãæ¸ãããã ããã¤ãã¼ãã«å°ããã¤æ å ±ãã¾ã¨ãã¦ããã Node.jsãç´¹ä»ããã ãã§ã¯ããJavascriptâ¦é£ãããããã¤ãããããã ã¨ãªããããªã®ã§ã ä»åã¯ããã°ã©ãã³ã°è¦ç´ æå°éã§ä½¿ããGruntãç´¹ä»ããï¼ Gruntã¨ã¯ Grunt: The JavaScript Task Runner Node.jsä¸ã§åããã¿ã¹ã¯ã©ã³ãã¼ã¨ããã«ããã¼ã«ã¨ãå¼ã°ãããã®ã§ã Gruntfileã¨å¼ã°ãããã¡ã¤ã«ã«å®è¡ããããã¨(ã¿ã¹ã¯)ãæ¸ãã¦ããã ã³ãã³ããå®è¡ããã¨æå®ããã¿ã¹ã¯ãå®è¡ãã¦ãããã Javascriptã§ããã°ã©ã ãæ¸ãã®ã¨ä½ãã¡ã
ããã¾ã§ããã¤ãã®è¨äºã§Node.jsã使ã£ãã¹ã¯ãªãããè¼ãã¦ãããã èªååã®ããã®ã¹ã¯ãªãããæ¸ãã¦åããç°å¢ã¨ã㦠Node.jsã¯æ軽ã ãéããè²ã ã©ã¤ãã©ãªã¯æã£ã¦ãã¦ããã ãªããªãè¯ãç°å¢ã ã¨æãã¦ããã Webç³»ã®ä»äºããã¦ããã°Javascriptã¯ããç¨åº¦è¦ªãã¿ã®ããè¨èªã ãããã GruntãGulpã®ãããªWebé¢é£ä½æ¥ãèªååãã æ©è½æºè¼ã®ã¿ã¹ã¯ã©ã³ãã¼ã¾ã§ç¨æããã¦ããã å®è¡ç°å¢ãã¤ã³ã¹ãã¼ã©ããã¦ã³ãã¼ããã¦ã¤ã³ã¹ãã¼ã«ããã° ããã±ã¼ã¸ç®¡çãã¼ã«ä»ãã§å ¥æãããã¨ãã§ããã®ã§ã ããã«éçºãå§ãããã¨ãã§ããã éåæå¦çãå¾æãªãµã¼ãã¢ããªã±ã¼ã·ã§ã³ãä½ãããã®ç°å¢ã¨ã㦠紹ä»ããããã¨ãå¤ããã©ããã®æ軽ã«å°å ¥ã§ã㦠Javascriptã§ãµã¯ãã¨ã¢ããªãä½ããã¨ããã ãã§ãååã«ä¾¡å¤ãããã¨æãã ãã³ããã°ã©ããä»äºãå¹çåããããã«ããã°ã©ã
ããéçºããã¸ã§ã¯ãã§ã éæè¡ç³»ã®ã¡ã³ãã¼ã«ãé²æãç¥ã£ã¦ããã¦ããããããã®ã®ã ããåãSubversionå ¥ãããã¨ãããªãã¸ããªãã°ãè¦ããã¨ãã£ã¦ãè¦ããã«ãªãã ãã¡ãã¡ä¼ããã®ãé¢å大å¤ããã ã£ãã®ã§ã Subversionã«ã³ãããããã£ããã¡ãã»ã¼ã¸å 容ããªã¢ã«ã¿ã¤ã 㧠ãã£ããã¯ã¼ã¯ã«æµããä»çµã¿ãä½ã£ã¦ãã£ãã www.chatwork.com ãã£ããã¯ã¼ã¯ã¯ãã¼ã éã§ã®ããã¨ãã«ä½¿ã£ã¦ããã®ã§ãããã«æµãã¦ãããã¨ããããã ã ãã£ããã¯ã¼ã¯ã¯ãã¬ãã¥ã¼çãªããAPIãå ¬éãã¦ããã¦ããã®ã§ã developer.chatwork.com APIçµç±ã§ã¡ãã»ã¼ã¸æ稿ãè¡ãã¹ã¯ãªããã¨ã Subversionã®ããã¯æ©è½ãçµã¿åããããã¨ã§å®ç¾ãããã¨ãã§ããã Node.jsã§ãã£ããã¯ã¼ã¯ã®APIã«ã¢ã¯ã»ã¹ããã¹ã¯ãªãããä½æãã ä»åã¯Node.jsã§ã¹ã¯ãª
ã¨ããWebéçºããã¸ã§ã¯ã㧠WBS(Excel製)ã«æ¸ããããæ©è½ãã¨ã®éçºæ å½ã»éå§æ¥ã»ææ¥ã»äºå®å·¥æ°ã ãã®ã¾ã¾Redmineã®ãã±ããã¨ãã¦ç»é²ããã¨ããã æä½æ¥ã§ãã£ãããããæéã®ããããããªä½æ¥ããã£ãã®ã§ã Redmineã®APIçµç±ã§ãã±ãããä¸æ¬ç»é²ã§ããã¹ã¯ãªãããä½æããã ååBit.ly APIã«ã¢ã¯ã»ã¹ããã¹ã¯ãªãããä½ã£ã¦çµæ§æ¥½ããã£ãã®ã§ã ä»åãNode.jsã§ä½æãã¦ã¿ãã blog.honjala.net Redmineã®APIã¯ã管çè 権éãæã£ãã¦ã¼ã¶ã¼ã§ 許å¯ããã°ããã¨ã¯ã¦ã¼ã¶ã¼ãã¨ã«APIãã¼ãçºè¡ã㦠REST APIã使ããããã«ãªã£ã¦ããã ä»åã®ããã«ãã±ãããç»é²ããã ãã§ãªãã ã¦ã¼ã¶ã¼æ å ±ãåå¾ãããããªAPIãç¨æããã¦ãããããªã®ã§ã é²æãåæãããæãªããã«ä½¿ãããã ã APIã®è©³ç´°ã¯ä¸è¨ã®æ¬å®¶ãµã¤ãã詳ãã: w
ããã«ã¡ã¯ãããã³ãã¨ã³ãã¨ã³ã¸ãã¢ã®ãã¼ãã§ãã æ®æ®µã¯ç°å¢æ§ç¯ã§ãã使ã£ã¦ããªãNode.jsã§ããªãªã¸ãã«ã®ã³ãã³ããä½ã£ã¦ã¿ã¾ãããä»åã¯ãã®æ¹æ³ããç´¹ä»ãããã¨æãã¾ããç°¡åã«æ¥½ãããã®ã§ããã²è©¦ãã¦ã¿ã¦ãã ããã ä»åã®ç°å¢ ã¾ãã¯ä»åã®ç°å¢ããç´¹ä»ãã¾ãã ç°å¢ Node.js v4.2.0 npm v2.14.7 Node.jsã¯å°ãåã«ã¡ã¸ã£ã¼ã¢ãããã¼ããã¦5以ä¸ã®ãã¼ã¸ã§ã³ãåºã¦ãã¾ããã4ãã¾ã ã¾ã ãµãã¼ãããã¦ããã®ã§ãä»åã¯4ã使ã£ã¦ããã¾ãã5ã§ãåé¡ããã¾ããã ä½ãæ¹ é©å½ãªãã©ã«ãåãã¤ãã¦ä¸ã«index.jsãä½ããnpm initãã¾ãã app âââ index.js âââ package.json index.js ã¾ããä¸è¨ã®2è¡ãå é ã«è¨è¿°ãã¾ãã #!/usr/bin/env node 'use strict'; 1è¡ç®ã§ã¯ãnodeã®
ãã¼ã / ãã㯠/ node.jsããéå ¬éã®Google Spreadsheetãæä½ããnpm
node.jsã§ã®é¢æ°å¼ã³åºã éåæå¦ç node.jsã¯non-blockingå¦çãè¡ããããé¢æ°ã«ãã£ã¦ã¯ããã°ã©ãã®æå³ããªãé çªã§å¦çãå®è¡ããããã¨ãããã¾ãã 次ã®ä¾ãã¿ã¦ãã ãããããã°ã©ã ã®éå§ãconsole.logã§åºåå¾ããã¡ã¤ã«ãèªã¿è¾¼ãã§å 容ãåºåã æå¾ã«ããã°ã©ã çµäºãconsoke.logã§åºåãã¦ãã¾ãã //app.js var fs = require('fs'); console.log("start"); //ãã¡ã¤ã«èªã¿è¾¼ã¿ fs.readFile("hello.txt","utf-8",function(err,data) { console.log(data); }); console.log("finish"); ä¸è¨ããã°ã©ã ãèªåã®ç°å¢ã§å®è¡ããçµæã¯æ¬¡ã®ããã«ãªã£ã¦ã¾ãã startã¨finishã表示ããããã¡ã¤ã«å 容ã¯æå¾ã«è¡¨
node.jsã«ã¯ãã¡ã¤ã«ç£è¦ãè¡ããAPIãfs.watch()ãããfs.watchFile()ããããã¾ããããªãã ããã ããããããã©ãããã£ãããã¾ãã ãåèãNode.js ã® fs.watch() 㨠fs.watchFile() ã®éã â ã¦ã£ãç ®ããã° ãããã£ãã¡ã³ãã¯ãµã¤é¨åã綺éºã«ã©ãããã¦ãã¡ã¤ã«ç£è¦ãæ軽ã«è¡ããããã«ããã¢ã¸ã¥ã¼ã«ããchokidarãã§ãã ãµã³ãã« ã¹ã¯ãªãããèµ·åããã«ã¬ã³ããã£ã¬ã¯ããª(åãã£ã¬ã¯ããªãå«ã)ãç£è¦ãã¦ããã¡ã¤ã«ã®è¿½å ãåé¤ãç·¨éãªã©ãè¡ããããéç¥ãã¾ãã var chokidar = require('chokidar') var watcher = chokidar.watch('.', { //watch対象ãã£ã¬ã¯ããªorãã¡ã¤ã« ignored: /[/\]./, //ç¡è¦ãã対象 persistent:
ã¡ãã£ã¨node.jsã§APIãµã¼ãä½ããã¨ã㦠express4ã«ä¸ãããããããã¨ä½¿ãæ¹ãå¤ãã£ã¦ããã®ã§ åå¿é²çã«æ¸ãã¦ããã¾ãã expressã§ã®ããã¸ã§ã¯ãã®ä½ãæ¹ ãããè¦ãªããããã®ã確å®ã https://www.npmjs.org/package/express express3ã®å ´å express3ã¾ã§ã¯ $ npm install -g express # ã°ãã¼ãã«ã«expressã³ãã³ãå ¥ã㦠$ express appName # expressã³ãã³ãã§ã²ãªå½¢ä½æ .. $ node app.js # ã¢ããªã±ã¼ã·ã§ã³èµ·å ãããªæãã§expressããã¸ã§ã¯ããä½ãã¾ãããã express4ããçµæ§å¤æ´ããã¦ãã¾ãã express4ã®å ´å express4ã§ã¯ã²ãªå½¢ãä½ãã³ãã³ããæ¬ä½ããåé¢ããã¾ããã ã¾ãã¢ããªã±ã¼ã·ã§ã³ã®èµ·åæ¹æ³ãå¤æ´ããã¦
ãªãªã¼ã¹ãé害æ å ±ãªã©ã®ãµã¼ãã¹ã®ãç¥ãã
ææ°ã®äººæ°ã¨ã³ããªã¼ã®é ä¿¡
å¦çãå®è¡ä¸ã§ã
j次ã®ããã¯ãã¼ã¯
kåã®ããã¯ãã¼ã¯
lãã¨ã§èªã
eã³ã¡ã³ãä¸è¦§ãéã
oãã¼ã¸ãéã
{{#tags}}- {{label}}
{{/tags}}