OS X なら公式からインストーラをダウンロードしましょう。
nodeコマンドでnodeのインタプリタを起動。
| var routes = require('./routes'); | |
| // 中略 | |
| app.get('/', routes.index); | |
| app.get('/topics/', routes.topics.index); | |
| app.get('/topics/:topic_id', routes.topics.show); | |
| app.get('/topics/:topic_id/posts/:post_id', routes.topics.post.show); |
| $(function(){ | |
| $("span#search_box").click( | |
| function(){ | |
| if ($("span#search").css("display") == "none"){ | |
| $("span#search").slideDown("nomal"); | |
| } | |
| else { | |
| $("span#search").slideUp("nomal"); | |
| } | |
| }); |
| var toList = function (value) { | |
| return Array.isArray(value) ? value : [value]; | |
| }; | |
| var range = function (from, to) { | |
| var result = []; | |
| for (var i = from; i <= to; i ++) { | |
| result.push(i); | |
| } |
| // [EDIT]========================================[EDIT] | |
| var consumer = { | |
| key: 'YOUR CONSUMER KEY', | |
| secret: 'YOUR CONSUMER SECRET' | |
| }; | |
| // [EDIT]========================================[EDIT] | |
| var rl = require('readline'); | |
| var i = rl.createInterface(process.stdin, process.stdout, null); |
OS X なら公式からインストーラをダウンロードしましょう。
nodeコマンドでnodeのインタプリタを起動。
| function Class (bar) { | |
| this.foo = bar; | |
| } | |
| Class.prototype.method = function () { | |
| return this.foo; | |
| }; | |
| var instance = new Class('baz'), | |
| func = instance.method; |
このチュートリアルでは Storm トポロジーの作り方とそれを Storm クラスタにデプロイする方法を学べます。Java を主な言語として使いますが、Storm が多言語対応であることを示すためにいくつかの例は Python を使います。
このチュートリアルでは storm-starter にある例を使います。このプロジェクトを clone し、例にそって追うことをおすすめします。Read [[Setting up development environment]] and [[Creating a new Storm project]] to get your machine set up.
Storm クラスターはぱっと見 Hadoop クラスターに似ています。Hadoop では「MapReduce ジョブ」を走らせるのに対して、Storm では「トポロジー」を走らせます。「ジョブ」と「トポロジ」は大いに異なります。1つの鍵となる違いは MapReduce ジョブがいつかは終わることに対して、トポロジーは永遠にメッセージを処理し続けます(終了しない限り)。
| var net = require('net'); | |
| net.createServer(function (client) { | |
| var remote = net.connect({ | |
| host: 'koba789.com', | |
| port: 8281 | |
| }); | |
| remote.pipe(client); | |
| var source = client, |
| body { | |
| font-family: Helvetica, arial, sans-serif; | |
| font-size: 14px; | |
| line-height: 1.6; | |
| padding-top: 10px; | |
| padding-bottom: 10px; | |
| background-color: white; | |
| padding: 30px; } | |
| body > *:first-child { |