"use strict"; function f(n){ if (n <= 0) { return "foo"; } return g(n - 1); } function g(n){ if (n <= 0) { return "bar"; } return f(n - 1); } return f(1e6) === "foo" && f(1e6+1) === "bar";
"use strict"; function f(n){ if (n <= 0) { return "foo"; } return g(n - 1); } function g(n){ if (n <= 0) { return "bar"; } return f(n - 1); } return f(1e6) === "foo" && f(1e6+1) === "bar";
記事内容に間違いや改善等ありましたらコメント欄にてご指摘をお願いしますm(__)m NodeSchoolとは 詳細は公式サイトに書かれていますが要は無料でNodeやそれに関連する技術を学べるオープンソースのツールです。 NodeSchoolという名前なので、なにかしら Node関連のものしかない ように思われがちですが、JavaScriptのみに着目した科目(他にもNoSQL関係だったり、etc)などもあるので、「JavaScriptの勉強をしたい!」という人にもおすすめです! 必要なもの 項目 説明 Node.jsインストールの推奨方法 Node.jsは活発に開発が進んでいるのでバージョンが結構頻繁に変わります。なのでNode.jsのバージョン管理をしてくれるツールのインストールを推奨します。(Rubyで言うrvmのような存在) 現時点(2015/10/27時点)で推奨するNode.js
こんにちは、@yoheiMuneです。 本日は、Log4jsを使ったログの出力やログローテーションをExpressで行う方法をブログに書きたいと思います。 Expressで一番簡単なログファイルの作成 Expressで出力しているコンソールログを一番簡単にログファイルに保存するには、以下のコマンドで実現で来ます。 $ node app.js >> app.log こうすればコンソール出力されてる内容が、app.logというファイルに書き込まれます。 ただ、開発中はこれくらいで良いのですが、リリースして運用する為にはログファイルを分けたり、フォーマットを指定したりしたいので、 ちょっと不十分です。 そこでlog4jsというログ出力モジュールを使って、ログ出力を行いたいと思います。 Log4jsの紹介 Log4jsは、JavaのLog4jのJavaScriptバージョンのモジュールで、柔軟なロ
MEANとは、LAMP(Linux, Apache, MySQL, PHP)に変わる技術としてじわじわと注目されはじめているアーキテクチャです。このアーキテクチャMEAN(MongoDB, Express, AngularJS, Node.js)は、シンプルでかつ強力なアーキテクチャで、現在のJavaを利用したアプリケーション開発とは一線を画すところです。HTML5開発にとってJavaの役割が殆どなくなるというのも注目すべき点だと考えます。MEANで一般的に言われる注目すべき事項は次のところです: JavaScriptフルスタックである データモデルとしてクライアントからデータベースに至までJSON そして、この記事を書こうと思ったきっかけですが、2014/10/5(日) Mozilla Open Web Day in Tokyo | Mozilla Japan でのMEAN解説展示で、様
tl;dr サンプルコードを付けたら記事がかなり長くなってしまったのでご注意下さい。 Node.jsの current master で V8がアップデートされ ES6の Promise が使えるようになりました(要オプションですが)。Promise を使うと Node.jsの非同期処理がどのようになるのか、Stream と Promise を組み合わせた使い方なども含めて紹介します。 1. はじめに Nodeの次期安定版 v0.12は、すぐ出ると言われながら既に v0.10のリリースから1年が過ぎてしまいました。 現在、v0.12の主要な新機能の実装は完了していますが、まだ安定版のリリースに向けて手当できていない部分が残っている感じです。そんな残っている部分の一つだった V8 のアップデートが先週末に行われました。 deps: update v8 to 3.24.40 (3/19現在は
移転しました http://please-sleep.cou929.nu/20121211.html
Seeing things happen the moment they actually do happen, that’s what I like the most. And that’s why I’ve always been searching for a better solution than Ajax. I use Ajax here and there on my own website (which is actually nothing more than a showcase of what you can do with Domotica/Home Automation), but I never really liked it. It always felt like some sort of patch-up while waiting for somethi
Meteorとは? Meteorは、2012年4月に彗星のように登場した、新たなアプリケーションプラットフォームです。この原稿の執筆時で、バージョンは0.3.6とされており、まだまだプレビュー版の域は超えていません。また、現状ではUNIX環境(MacOS Xを含む)でしかうまく動作しないようです。 しかし、Webアプリケーション開発をとことんまで素早く、楽に行えるようにするためのさまざまな仕組みが盛り込まれていることから、登場直後からかなりの注目を集めています(公式サイトには、「1日か2日でプロトタイプを、2~3週間で製品レベルのアプリを構築できるようにする」とあります)。 MeteorはMITライセンスに基づくオープンソースプロジェクトとして、Github上で公開されています。現在4人の開発者がフルタイムで開発に従事しており、1年以内に1.0をリリースする予定だとされています。 M
node.js のような非同期APIを使ったプログラミングに拒絶反応を示すエンジニアが多い理由の一つが、非同期APIと例外処理の相性の悪さだ。 Javascript の場合、例外処理はこんな感じに記述する。 function f(i) { try { throw new Error('an error #'+ i); } catch(e) { console.log('Error caught:', e.message); } } ところが、これに非同期APIが絡むと、とたんに分かりにくくなる。例えば下の例。 function f(i) { try { setTimeout(function() { throw new Error('an error #'+ i); }, 1000); } catch(e) { console.log('Error caught:', e.message)
昨今注目を集めているWebアプリケーションプラットフォームの1つに、「Node.js」 がある。Node.jsはJavaScriptでWebアプリケーションのサーバーサイドプログラムを実装できる技術で、高いスケーラビリティが特徴だ。本記事ではNode.jsの基本的な知識やフレームワーク「express」を用いたWebアプリケーション作成方法を紹介する。また、Webブラウザ上で動作するIDE「Cloud9 IDE」を用いてNode.jsアプリケーションをWindows Azureで実行させる方法についても解説する。 JavaScript、そして非同期・シングルスレッドで注目を浴びるNode.js Node.jsはJavaScriptでWebアプリケーションのサーバーサイドプログラムを実装できる技術で、開発プロジェクトのスタートは2009年と、比較的その歴史は浅い。しかし、ここ数年でプロジェク
eBayが、JavaScriptアプリケーションからSQL文のような形式でデータベースへの問い合わせを記述できるDSL(ドメイン固有言語)のql.ioを発表。オープンソースとして公開しました。 現在、多くのWebアプリケーションが、バックエンドとのデータのやりとりにHTTPをベースにしたAPIを用いています。しかし、WebベースのAPIによってデータを取り出すのは、プログラマにとって実は手間のかかることです。 例えば、キーワードを入力すると関連する商品の名前、詳細、購入者の評価をユーザーに表示する、というWebアプリケーションでは、まずキーワードでデータベースを検索して商品IDを取得し、今度はその商品IDをキーにして名前や概要、評価の情報を取得する、といったように、APIを繰り返し呼び出す必要があります。 ql.ioはこうした内容をSQLのように分かりやすい記述で実現するだけでなく、複数の
また1つ、Node.jsベースのWebアプリケーションフレームワーク「SocketStream」が登場しました。6月23日にロンドンで開催されたHacker Newsのミートアップで発表されたようです(@makoto_inoueさん、情報提供ありがとうございます!)。GitHubのレポジトリにはバージョン0.1のソースコードと、何ができるかというサンプルコードを含む長大なドキュメントが公開されています。 このSocketStreamは、単にまたNode.jsでWebアプリケーションフレームワークが1つ増えたという感じではないようです。従来のものとは、設計がドラスティックに異なっています。 まず、名前から自明なように、WebSocketを基本としていて、SPA(Single Page Application)が作りやすいように設計されています。SPAとは、1ページのHTMLを読み込んだら、後
ここ一ヶ月ぐらいからJavaScriptが注目されているようだ。理由は簡単で、GoogleのJavaScriptエンジンを使ったアプリケーション・サーバーであるnode.jsの性能が高いと主張されているからだ。 地味にブームになりつつあり、Ajaxのようにウェブ開発の現場に定着するかも知れない。多数のブログで紹介がされている。現状のその特徴を振り返りつつ、node.jsが普及するかを考察してみた。 1. JavaScriptは、ブラウザ発の人気スクリプト言語 JavaScriptは、LiveScriptとして1995年にNetscape Navigatorというウェブ・ブラウザに搭載されたのが始まりで、すぐに政治的な理由でJavaScriptに改名された。1996年には、その基本的な文法がECMAScriptとして、ECMA-262とISO/IEC 16262で定義されている。言語仕様が簡
リリース、障害情報などのサービスのお知らせ
最新の人気エントリーの配信
処理を実行中です
j次のブックマーク
k前のブックマーク
lあとで読む
eコメント一覧を開く
oページを開く