nemomemo

2015-08-24

2013-05-05

文字列が数値かどうか判定するStringハック

はじめに

june29 2014/02/21 19:29

  ご参考 http://taro-tnk.hatenablog.com/entry/2012/12/17/001552

どうもありがとうございます!!

この記事はいつのまにか正規表現で数値を判定することが目的になっているので、文字列が数値かどうか判定したい方は上記の記事を参考にすると良いです!

Integer(5) ハイ!

チャレンジ記録 (元の記事)

=begin
    self =~ /^\d+$/
=end

これはすごい!

合わせて読みたい:メタプログラミングRuby

※2014/2/21 追記

mrkn様よりコメントいただいてやりなおしました!

mrkn 2013/05/08 10:06

  "abc\n12345\ndef".number? #=> 4

=begin
    self =~ /\A\d+\Z/
=end
※2014/2/21 追記(2回目)

kou様よりコメントいただいて出直してきました!

=begin
    self =~ /\A-?\d+\Z/
=end
※2014/2/21 追記(3回目)

ぬ様よりコメントいただいて3度目の正直ました!

class String
  def number?
    self =~ /\A-?\d+(.\d+)?\Z/
  end
end

次回予告

(名無しさん) 2014/02/21 17:26

  '0xdeadbeaf'.number?

EnnuimaZEnnuimaZ 2014/02/21 17:34

  16進数は to_i できないからぃぃかな って ぉもった…!

kou 2014/02/21 17:36

  "0x80".to_i(16) # => 128

kou 2014/02/21 17:40

  "1X0".number? # => 0

「ドットを忘れるとはどっと疲れが」

「10進数だけが数値と思うなよ」

の二本立てでお送りします。乞うご期待!

rails g で SECURITY WARNING が出た時の対処法

現象

rails new したあとに rails g とかすると

        SECURITY WARNING: No secret option provided to Rack::Session::Cookie.
        This poses a security threat. It is strongly recommended that you
        provide a secret to prevent exploits that may be possible from crafted
        cookies. This will not be supported in future versions of Rack, and
        future versions will even invalidate your existing user cookies.

        Called from: /Users/imaz/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/actionpack-3.2.8/lib/action_dispatch/middleware/session/abstract_store.rb:28:in `initialize'.

これが出る件

対処方法

  • RailsRackの相性が悪くて発生する。
    • もう対応が入っているので、GemfileでRailsのバージョンを最新にして bundle update すると解決する。

2013-03-17 はてなダイアリー、*いっこのタイトルつけないと編集できないのね。

PHPUnitを手元で動かしてみたくなった 〜環境設定編〜

手元の環境でPHP+PHPUnit動かしてみる

$ php -v
PHP 5.3.15 with Suhosin-Patch (cli) (built: Aug 24 2012 17:45:44) 
Copyright (c) 1997-2012 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2012 Zend Technologies

もともと入っていた。XCodeと一緒に入るのかな。

リポジトリを作る

PHPUnitを使う

$ php composer.phar install
Could not open input file: composer.phar
  • まあそうなりますよね
Composerを使う
$ curl -s http://getcomposer.org/installer | php
#!/usr/bin/env php
Some settings on your machine make Composer unable to work properly.
Make sure that you fix the issues listed below and run this script again:

The detect_unicode setting must be disabled.
Add the following to the end of your `php.ini`:
    detect_unicode = Off

A php.ini file does not exist. You will have to create one.
If you can not modify the ini file, you can also run `php -d option=value` to modify ini values on the fly. You can use -d multiple times.
    • PHP.iniがありません……とか、なんとか…?
    • オプションをつけろと言われている
$ curl -s http://getcomposer.org/installer | php -d detect_unicode=Off
#!/usr/bin/env php
All settings correct for using Composer
Downloading...

Composer successfully installed to: /Users/imaz/work/php/composer.phar
Use it: php composer.phar
$ ls
composer.json composer.phar hello.php

なんか入ったっぽい!

$ php composer.phar install
Loading composer repositories with package information
Installing dependencies
Nothing to install or update
Generating autoload files
  • いけた! これで使えるのかな?
    • 使えないですよねあきらかになんか足りない。installしてない。
$ php composer.phar update
Loading composer repositories with package information
Updating dependencies (including require-dev)
  - Installing symfony/yaml (v2.2.0)
    Downloading: 100%         

  - Installing phpunit/php-text-template (1.1.4)
    Downloading: 100%         

  - Installing phpunit/phpunit-mock-objects (1.2.3)
    Downloading: 100%         

  - Installing phpunit/php-timer (1.0.4)
    Downloading: 100%         

  - Installing phpunit/php-token-stream (1.1.5)
    Downloading: 100%         

  - Installing phpunit/php-file-iterator (1.3.3)
    Downloading: 100%         

  - Installing phpunit/php-code-coverage (1.2.9)
    Downloading: 100%         

  - Installing phpunit/phpunit (3.7.18)
    Downloading: 100%         

phpunit/php-code-coverage suggests installing ext-xdebug (>=2.0.5)
phpunit/phpunit suggests installing phpunit/php-invoker (>=1.1.0,<1.2.0)
Writing lock file
Generating autoload files

brewとかgemとか思い出しながら適当にupdateしてみたら入った!

ローカルインストールなのでphpunitコマンドは入っていない。

探ったら↓の感じで使えそう!

$ ./vendor/phpunit/phpunit/phpunit.php --version
PHPUnit 3.7.18 by Sebastian Bergmann.

良いネー!

次やること

  • ローカルでコマンドのalias切ったりできたっけ?
  • PHPUnitうごかす

2012-12-22

jQueryを使ったJavaScriptのディープコピー

多次元配列をコピーしたい時

array2d = [[1,2],[3,4,5],[6,7]];
a = b = array2d;

for(i=0; i<=2; i++){console.log(i,a[i],b[i]);}
// 0 [1, 2] [1, 2]
// 1 [3, 4, 5] [3, 4, 5]
// 2 [6, 7] [6, 7]

b[1][0] = 1111;

for(i=0; i<=2; i++){console.log(i,a[i],b[i]);}
// 0 [1, 2] [1, 2]
// 1 [1111, 4, 5] [1111, 4, 5]  ←両方変わってる
// 2 [6, 7] [6, 7]

そこでコレ

jQuery.extend(true, {}, array2d)
array2d = [[1,2],[3,4,5],[6,7]];
a = b = jQuery.extend(true, {}, array2d);

for(i=0; i<=2; i++){console.log(i,a[i],b[i]);}
// 0 [1, 2] [1, 2]
// 1 [3, 4, 5] [3, 4, 5]
// 2 [6, 7] [6, 7]

b[1][0] = 1111;

for(i=0; i<=2; i++){console.log(i,a[i],b[i]);}
// 0 [1, 2] [1, 2]
// 1 [1111, 4, 5] [1111, 4, 5]  ←両方変わってる
// 2 [6, 7] [6, 7]

間違えた

array2d = [[1,2],[3,4,5],[6,7]];
a = jQuery.extend(true, {}, array2d);
b = jQuery.extend(true, {}, array2d);

for(i=0; i<=2; i++){console.log(i,a[i],b[i]);}
// 0 [1, 2] [1, 2]
// 1 [3, 4, 5] [3, 4, 5]
// 2 [6, 7] [6, 7]

b[1][0] = 1111;

for(i=0; i<=2; i++){console.log(i,a[i],b[i]);}
// 0 [1, 2] [1, 2]
// 1 [3, 4, 5] [1111, 4, 5]  ←片方しか変わってない
// 2 [6, 7] [6, 7]

jQuery.extend とは

http://api.jquery.com/jQuery.extend/

jQuery.extend( [deep], target, object1 [, objectN] )

deep If true, the merge becomes recursive (aka. deep copy).

target The object to extend. It will receive the new properties.

object1 An object containing additional properties to merge in.

objectN Additional objects containing properties to merge in.

こっちですねえ。1.1.4からディープコピー用のパラメータが追加になっています。

2012-10-01

package.json に socket.io を書いて npm install したらエラーが発生したのでメモ

関連しそうなリンク

バージョンアップ

  • 使用してるもの
$ node -v
v0.6.16

できた

$ node -v
v0.8.11
$ rm -fr node_modules
$ npm install
npm WARN package.json ennui-node@0.0.1 No README.md file found!
npm http GET https://registry.npmjs.org/socket.io/0.9.10
npm http 304 https://registry.npmjs.org/socket.io/0.9.10
 :
エラー無く終了
    • 将来npmに加えるにはREADME.mdいれろよという話

エラーログ

$ npm install
npm http GET https://registry.npmjs.org/socket.io/0.9.10
npm http 304 https://registry.npmjs.org/socket.io/0.9.10
npm http GET https://registry.npmjs.org/socket.io-client/0.9.10
npm http GET https://registry.npmjs.org/policyfile/0.0.4
npm http GET https://registry.npmjs.org/redis/0.7.2
npm http 304 https://registry.npmjs.org/socket.io-client/0.9.10
npm http 304 https://registry.npmjs.org/redis/0.7.2
npm http 304 https://registry.npmjs.org/policyfile/0.0.4
npm http GET https://registry.npmjs.org/hiredis
npm http GET https://registry.npmjs.org/uglify-js/1.2.5
npm http GET https://registry.npmjs.org/ws
npm http GET https://registry.npmjs.org/xmlhttprequest/1.4.2
npm http GET https://registry.npmjs.org/active-x-obfuscator/0.0.1
npm http 304 https://registry.npmjs.org/hiredis

> hiredis@0.1.14 preinstall /Users/imaz/work/js/joyent/node_modules/socket.io/node_modules/redis/node_modules/hiredis
> make || gmake

cd deps/hiredis && make static
cc -std=c99 -pedantic -c -O3 -fPIC  -Wall -W -Wstrict-prototypes -Wwrite-strings -g -ggdb net.c
cc -std=c99 -pedantic -c -O3 -fPIC  -Wall -W -Wstrict-prototypes -Wwrite-strings -g -ggdb hiredis.c
npm http 304 https://registry.npmjs.org/ws
npm http 304 https://registry.npmjs.org/xmlhttprequest/1.4.2
npm http 304 https://registry.npmjs.org/active-x-obfuscator/0.0.1
npm http 304 https://registry.npmjs.org/uglify-js/1.2.5
npm http GET https://registry.npmjs.org/zeparser/0.0.5
npm http GET https://registry.npmjs.org/options
npm http GET https://registry.npmjs.org/commander
npm http GET https://registry.npmjs.org/tinycolor
cc -std=c99 -pedantic -c -O3 -fPIC  -Wall -W -Wstrict-prototypes -Wwrite-strings -g -ggdb sds.c
cc -std=c99 -pedantic -c -O3 -fPIC  -Wall -W -Wstrict-prototypes -Wwrite-strings -g -ggdb async.c
ar rcs libhiredis.a net.o hiredis.o sds.o async.o
node-waf configure build
Setting srcdir to                        : /Users/imaz/work/js/joyent/node_modules/socket.io/node_modules/redis/node_modules/hiredis 
Setting blddir to                        : /Users/imaz/work/js/joyent/node_modules/socket.io/node_modules/redis/node_modules/hiredis/build 
Checking for program g++ or c++          : /usr/bin/g++ 
Checking for program cpp                 : /usr/bin/cpp 
Checking for program ar                  : /usr/bin/ar 
Checking for program ranlib              : /usr/bin/ranlib 
Checking for g++                         : ok  
Checking for node path                   : ok /Users/imaz/.node_libraries 
Checking for node prefix                 : ok /usr/local 
'configure' finished successfully (0.047s)
Waf: Entering directory `/Users/imaz/work/js/joyent/node_modules/socket.io/node_modules/redis/node_modules/hiredis/build'
[1/3] cxx: hiredis.cc -> build/Release/hiredis_1.o
[2/3] cxx: reader.cc -> build/Release/reader_1.o
In file included from /usr/local/include/node/node.h:61,
                 from ../reader.cc:2:
/usr/local/include/node/uv.h:64:33: error: uv-private/uv-unix.h: No such file or directory
In file included from /usr/local/include/node/node.h:61,
                 from ../hiredis.cc:2:
/usr/local/include/node/uv.h:64:33: error: uv-private/uv-unix.h: No such file or directory
In file included from /usr/local/include/node/node.h:61,
                 from ../hiredis.cc:2:
/usr/local/include/node/uv.h:243: error: ISO C++ forbids declaration of ‘uv_buf_t’ with no type
/usr/local/include/node/uv.h:243: error: typedef ‘uv_buf_t’ is initialized (use __typeof__ instead)
/usr/local/include/node/uv.h:243: error: ‘uv_alloc_cb’ was not declared in this scope
/usr/local/include/node/uv.h:244: error: ‘uv_buf_t’ has not been declared
/usr/local/include/node/uv.h:250: error: ‘uv_buf_t’ has not been declared
/usr/local/include/node/uv.h:313: error: ISO C++ forbids declaration of ‘UV_REQ_PRIVATE_FIELDS’ with no type
/usr/local/include/node/uv.h:314: error: expected ‘;’ before ‘}’ token
/usr/local/include/node/uv.h:314: error: expected `;' before ‘}’ token
/usr/local/include/node/uv.h:329: error: expected constructor, destructor, or type conversion before ‘int’
/usr/local/include/node/uv.h:333: error: ‘UV_REQ_PRIVATE_FIELDS’ does not name a type
/usr/local/include/node/uv.h:336: error: ISO C++ forbids declaration of ‘UV_SHUTDOWN_PRIVATE_FIELDS’ with no type
/usr/local/include/node/uv.h:337: error: expected ‘;’ before ‘}’ token
/usr/local/include/node/uv.h:337: error: expected `;' before ‘}’ token
/usr/local/include/node/uv.h:352: error: ISO C++ forbids declaration of ‘UV_HANDLE_PRIVATE_FIELDS’ with no type
/usr/local/include/node/uv.h:353: error: expected ‘;’ before ‘}’ token
/usr/local/include/node/uv.h:353: error: expected `;' before ‘}’ token
/usr/local/include/node/uv.h:378: error: ‘uv_buf_t’ does not name a type
/usr/local/include/node/uv.h:399: error: ‘UV_HANDLE_PRIVATE_FIELDS’ does not name a type
/usr/local/include/node/uv.h:400: error: ‘uv_alloc_cb’ does not name a type
/usr/local/include/node/uv.h:400: error: ISO C++ forbids declaration of ‘UV_STREAM_PRIVATE_FIELDS’ with no type
/usr/local/include/node/uv.h:401: error: expected ‘;’ before ‘}’ token
/usr/local/include/node/uv.h:401: error: expected `;' before ‘}’ token
/usr/local/include/node/uv.h:428: error: ‘uv_alloc_cb’ has not been declared
/usr/local/include/node/uv.h:437: error: ‘uv_alloc_cb’ has not been declared
/usr/local/include/node/uv.h:460: error: ‘uv_buf_t’ has not been declared
/usr/local/include/node/uv.h:462: error: ‘uv_buf_t’ has not been declared
/usr/local/include/node/uv.h:467: error: ‘UV_REQ_PRIVATE_FIELDS’ does not name a type
/usr/local/include/node/uv.h:471: error: ISO C++ forbids declaration of ‘UV_WRITE_PRIVATE_FIELDS’ with no type
/usr/local/include/node/uv.h:472: error: expected ‘;’ before ‘}’ token
/usr/local/include/node/uv.h:472: error: expected `;' before ‘}’ token
/usr/local/include/node/uv.h:489: error: ‘UV_HANDLE_PRIVATE_FIELDS’ does not name a type
/usr/local/include/node/uv.h:490: error: ‘uv_alloc_cb’ does not name a type
/usr/local/include/node/uv.h:490: error: ‘UV_STREAM_PRIVATE_FIELDS’ does not name a type
/usr/local/include/node/uv.h:536: error: ‘UV_REQ_PRIVATE_FIELDS’ does not name a type
/usr/local/include/node/uv.h:539: error: ISO C++ forbids declaration of ‘UV_CONNECT_PRIVATE_FIELDS’ with no type
/usr/local/include/node/uv.h:540: error: expected ‘;’ before ‘}’ token
/usr/local/include/node/uv.h:540: error: expected `;' before ‘}’ token
/usr/local/include/node/uv.h:577: error: ‘uv_buf_t’ has not been declared
/usr/local/include/node/uv.h:582: error: ‘UV_HANDLE_PRIVATE_FIELDS’ does not name a type
/usr/local/include/node/uv.h:588: error: ‘UV_REQ_PRIVATE_FIELDS’ does not name a type
/usr/local/include/node/uv.h:591: error: ISO C++ forbids declaration of ‘UV_UDP_SEND_PRIVATE_FIELDS’ with no type
/usr/local/include/node/uv.h:592: error: expected ‘;’ before ‘}’ token
/usr/local/include/node/uv.h:592: error: expected `;' before ‘}’ token
/usr/local/include/node/uv.h:717: error: ‘uv_buf_t’ has not been declared
/usr/local/include/node/uv.h:736: error: ‘uv_buf_t’ has not been declared
/usr/local/include/node/uv.h:752: error: ‘uv_alloc_cb’ has not been declared
/usr/local/include/node/uv.h:773: error: ‘UV_HANDLE_PRIVATE_FIELDS’ does not name a type
/usr/local/include/node/uv.h:774: error: ‘uv_alloc_cb’ does not name a type
/usr/local/include/node/uv.h:774: error: ‘UV_STREAM_PRIVATE_FIELDS’ does not name a type
/usr/local/include/node/uv.h:789: error: ‘uv_file’ has not been declared
/usr/local/include/node/uv.h:813: error: ‘uv_file’ has not been declared
/usr/local/include/node/uv.h:822: error: ‘UV_HANDLE_PRIVATE_FIELDS’ does not name a type
/usr/local/include/node/uv.h:823: error: ‘uv_alloc_cb’ does not name a type
/usr/local/include/node/uv.h:823: error: ‘UV_STREAM_PRIVATE_FIELDS’ does not name a type
/usr/local/include/node/uv.h:837: error: ‘uv_file’ has not been declared
/usr/local/include/node/uv.h:860: error: ‘UV_HANDLE_PRIVATE_FIELDS’ does not name a type
/usr/local/include/node/uv.h:878: error: ‘UV_HANDLE_PRIVATE_FIELDS’ does not name a type
/usr/local/include/node/uv.h:898: error: ‘UV_HANDLE_PRIVATE_FIELDS’ does not name a type
/usr/local/include/node/uv.h:920: error: ‘UV_HANDLE_PRIVATE_FIELDS’ does not name a type
/usr/local/include/node/uv.h:942: error: ‘UV_HANDLE_PRIVATE_FIELDS’ does not name a type
/usr/local/include/node/uv.h:985: error: ‘UV_REQ_PRIVATE_FIELDS’ does not name a type
/usr/local/include/node/uv.h:987: error: ISO C++ forbids declaration of ‘UV_GETADDRINFO_PRIVATE_FIELDS’ with no type
/usr/local/include/node/uv.h:989: error: expected ‘;’ before ‘}’ token
/usr/local/include/node/uv.h:989: error: expected `;' before ‘}’ token
/usr/local/include/node/uv.h:1051: error: ‘UV_HANDLE_PRIVATE_FIELDS’ does not name a type
/usr/local/include/node/uv.h:1054: error: ISO C++ forbids declaration of ‘UV_PROCESS_PRIVATE_FIELDS’ with no type
/usr/local/include/node/uv.h:1055: error: expected ‘;’ before ‘}’ token
/usr/local/include/node/uv.h:1055: error: expected `;' before ‘}’ token
/usr/local/include/node/uv.h:1080: error: ‘uv_uid_t’ does not name a type
/usr/local/include/node/uv.h:1081: error: ‘uv_gid_t’ does not name a type
/usr/local/include/node/uv.h:1104: error: ‘UV_REQ_PRIVATE_FIELDS’ does not name a type
/usr/local/include/node/uv.h:1108: error: ISO C++ forbids declaration of ‘UV_WORK_PRIVATE_FIELDS’ with no type
/usr/local/include/node/uv.h:1109: error: expected ‘;’ before ‘}’ token
/usr/local/include/node/uv.h:1109: error: expected `;' before ‘}’ token
/usr/local/include/node/uv.h:1164: error: ‘UV_REQ_PRIVATE_FIELDS’ does not name a type
/usr/local/include/node/uv.h:1172: error: ISO C++ forbids declaration of ‘UV_FS_PRIVATE_FIELDS’ with no type
/usr/local/include/node/uv.h:1173: error: expected ‘;’ before ‘}’ token
/usr/local/include/node/uv.h:1173: error: expected `;' before ‘}’ token
/usr/local/include/node/uv.h:1177: error: ‘uv_file’ has not been declared
/usr/local/include/node/uv.h:1183: error: ‘uv_file’ has not been declared
/usr/local/include/node/uv.h:1186: error: ‘uv_file’ has not been declared
/usr/local/include/node/uv.h:1192: error: ‘uv_file’ has not been declared
/usr/local/include/node/uv.h:1195: error: ‘uv_file’ has not been declared
/usr/local/include/node/uv.h:1210: error: ‘uv_file’ has not been declared
/usr/local/include/node/uv.h:1216: error: ‘uv_file’ has not been declared
/usr/local/include/node/uv.h:1219: error: ‘uv_file’ has not been declared
/usr/local/include/node/uv.h:1222: error: ‘uv_file’ has not been declared
/usr/local/include/node/uv.h:1225: error: ‘uv_file’ has not been declared
/usr/local/include/node/uv.h:1228: error: ‘uv_file’ has not been declared
/usr/local/include/node/uv.h:1229: error: ‘uv_file’ has not been declared
/usr/local/include/node/uv.h:1237: error: ‘uv_file’ has not been declared
/usr/local/include/node/uv.h:1258: error: ‘uv_file’ has not been declared
/usr/local/include/node/uv.h:1264: error: ‘uv_file’ has not been declared
/usr/local/include/node/uv.h:1275: error: ISO C++ forbids declaration of ‘UV_HANDLE_PRIVATE_FIELDS’ with no type
/usr/local/include/node/uv.h:1276: error: expected ‘;’ before ‘char’
/usr/local/include/node/uv.h:1277: error: ISO C++ forbids declaration of ‘UV_FS_EVENT_PRIVATE_FIELDS’ with no type
/usr/local/include/node/uv.h:1278: error: expected ‘;’ before ‘}’ token
/usr/local/include/node/uv.h:1278: error: expected `;' before ‘}’ token
/usr/local/include/node/uv.h:1348: error: storage class specified for ‘uv_hrtime’
/usr/local/include/node/uv.h:1355: error: ‘uv_lib_t’ has not been declared
/usr/local/include/node/uv.h:1356: error: ‘uv_lib_t’ has not been declared
/usr/local/include/node/uv.h:1362: error: ‘uv_lib_t’ has not been declared
/usr/local/include/node/uv.h:1367: error: field ‘tcp’ has incomplete type
/usr/local/include/node/uv.h:1368: error: field ‘pipe’ has incomplete type
/usr/local/include/node/uv.h:1369: error: field ‘prepare’ has incomplete type
/usr/local/include/node/uv.h:1370: error: field ‘check’ has incomplete type
/usr/local/include/node/uv.h:1371: error: field ‘idle’ has incomplete type
/usr/local/include/node/uv.h:1372: error: field ‘async’ has incomplete type
/usr/local/include/node/uv.h:1373: error: field ‘timer’ has incomplete type
/usr/local/include/node/uv.h:1374: error: field ‘getaddrinfo’ has incomplete type
/usr/local/include/node/uv.h:1375: error: field ‘fs_event’ has incomplete type
/usr/local/include/node/uv.h:1381: error: field ‘connect’ has incomplete type
/usr/local/include/node/uv.h:1383: error: field ‘fs_req’ has incomplete type
/usr/local/include/node/uv.h:1384: error: field ‘work_req’ has incomplete type
/usr/local/include/node/uv.h:1408: error: ‘UV_LOOP_PRIVATE_FIELDS’ does not name a type
/usr/local/include/node/uv.h:1412: error: field ‘uv_eio_want_poll_notifier’ has incomplete type
/usr/local/include/node/uv.h:1413: error: field ‘uv_eio_done_poll_notifier’ has incomplete type
/usr/local/include/node/uv.h:1414: error: field ‘uv_eio_poller’ has incomplete type
/usr/local/include/node/uv.h:1416: error: field ‘counters’ has incomplete type
In file included from /usr/local/include/node/node.h:64,
                 from ../hiredis.cc:2:
/usr/include/sys/stat.h:169: error: multiple types in one declaration
/usr/include/sys/stat.h:427: error: expected unqualified-id before string constant
In file included from /usr/include/sys/wait.h:116,
                 from /usr/include/stdlib.h:65,
                 from /usr/include/assert.h:44,
                 from /usr/local/include/node/node.h:65,
                 from ../hiredis.cc:2:
/usr/include/sys/signal.h:412: error: expected unqualified-id before string constant
In file included from /usr/local/include/node/node.h:61,
                 from ../reader.cc:2:
/usr/local/include/node/uv.h:243: error: ISO C++ forbids declaration of ‘uv_buf_t’ with no type
/usr/local/include/node/uv.h:243: error: typedef ‘uv_buf_t’ is initialized (use __typeof__ instead)
/usr/local/include/node/uv.h:243: error: ‘uv_alloc_cb’ was not declared in this scope
In file included from /usr/include/sys/wait.h:117,
                 from /usr/include/stdlib.h:65,
                 from /usr/include/assert.h:44,
                 from /usr/local/include/node/node.h:65,
                 from ../hiredis.cc:2:
/usr/include/sys/resource.h:237: error: expected unqualified-id before string constant
/usr/local/include/node/uv.h:244: error: ‘uv_buf_t’ has not been declared
/usr/local/include/node/uv.h:250: error: ‘uv_buf_t’ has not been declared
In file included from /usr/include/stdlib.h:65,
                 from /usr/include/assert.h:44,
                 from /usr/local/include/node/node.h:65,
                 from ../hiredis.cc:2:
/usr/include/sys/wait.h:254: error: expected unqualified-id before string constant
In file included from /usr/include/stdlib.h:67,
                 from /usr/include/assert.h:44,
                 from /usr/local/include/node/node.h:65,
                 from ../hiredis.cc:2:
/usr/include/alloca.h:35: error: expected unqualified-id before string constant
In file included from /usr/include/assert.h:44,
                 from /usr/local/include/node/node.h:65,
                 from ../hiredis.cc:2:
/usr/include/stdlib.h:134: error: storage class specified for ‘__mb_cur_max’
/usr/include/stdlib.h:144: error: expected unqualified-id before string constant
In file included from /usr/local/include/node/node.h:65,
                 from ../hiredis.cc:2:
/usr/include/assert.h:75: error: expected unqualified-id before string constant
In file included from /usr/local/include/node/node_object_wrap.h:27,
                 from /usr/local/include/node/node.h:67,
                 from ../hiredis.cc:2:
/usr/include/assert.h:75: error: expected unqualified-id before string constant
In file included from /usr/local/include/node/node.h:67,
                 from ../hiredis.cc:2:
/usr/local/include/node/node_object_wrap.h:29: error: expected unqualified-id before ‘namespace’
../hiredis.cc:13: error: expected `}' at end of input
../hiredis.cc:13: error: expected unqualified-id at end of input
../hiredis.cc:13: error: expected `}' at end of input
../hiredis.cc:13: error: expected unqualified-id at end of input
../hiredis.cc:13: error: expected `}' at end of input
../hiredis.cc:13: error: expected unqualified-id at end of input
../hiredis.cc:13: error: expected `}' at end of input
../hiredis.cc:13: error: expected unqualified-id at end of input
../hiredis.cc:13: error: expected `}' at end of input
../hiredis.cc:13: error: expected unqualified-id at end of input
../hiredis.cc:13: error: expected `}' at end of input
../hiredis.cc:13: error: expected unqualified-id at end of input
../hiredis.cc:13: error: expected `}' at end of input
../hiredis.cc:13: error: expected unqualified-id at end of input
../hiredis.cc:13: error: expected `}' at end of input
/usr/local/include/node/uv.h:313: error: ISO C++ forbids declaration of ‘UV_REQ_PRIVATE_FIELDS’ with no type
/usr/local/include/node/uv.h:314: error: expected ‘;’ before ‘}’ token
/usr/local/include/node/uv.h:314: error: expected `;' before ‘}’ token
/usr/local/include/node/uv.h:329: error: expected constructor, destructor, or type conversion before ‘int’
/usr/local/include/node/uv.h:333: error: ‘UV_REQ_PRIVATE_FIELDS’ does not name a type
/usr/local/include/node/uv.h:336: error: ISO C++ forbids declaration of ‘UV_SHUTDOWN_PRIVATE_FIELDS’ with no type
/usr/local/include/node/uv.h:337: error: expected ‘;’ before ‘}’ token
/usr/local/include/node/uv.h:337: error: expected `;' before ‘}’ token
/usr/local/include/node/uv.h:352: error: ISO C++ forbids declaration of ‘UV_HANDLE_PRIVATE_FIELDS’ with no type
/usr/local/include/node/uv.h:353: error: expected ‘;’ before ‘}’ token
/usr/local/include/node/uv.h:353: error: expected `;' before ‘}’ token
/usr/local/include/node/uv.h:378: error: ‘uv_buf_t’ does not name a type
/usr/local/include/node/uv.h:399: error: ‘UV_HANDLE_PRIVATE_FIELDS’ does not name a type
/usr/local/include/node/uv.h:400: error: ‘uv_alloc_cb’ does not name a type
/usr/local/include/node/uv.h:400: error: ISO C++ forbids declaration of ‘UV_STREAM_PRIVATE_FIELDS’ with no type
/usr/local/include/node/uv.h:401: error: expected ‘;’ before ‘}’ token
/usr/local/include/node/uv.h:401: error: expected `;' before ‘}’ token
/usr/local/include/node/uv.h:428: error: ‘uv_alloc_cb’ has not been declared
/usr/local/include/node/uv.h:437: error: ‘uv_alloc_cb’ has not been declared
/usr/local/include/node/uv.h:460: error: ‘uv_buf_t’ has not been declared
/usr/local/include/node/uv.h:462: error: ‘uv_buf_t’ has not been declared
/usr/local/include/node/uv.h:467: error: ‘UV_REQ_PRIVATE_FIELDS’ does not name a type
/usr/local/include/node/uv.h:471: error: ISO C++ forbids declaration of ‘UV_WRITE_PRIVATE_FIELDS’ with no type
/usr/local/include/node/uv.h:472: error: expected ‘;’ before ‘}’ token
/usr/local/include/node/uv.h:472: error: expected `;' before ‘}’ token
/usr/local/include/node/uv.h:489: error: ‘UV_HANDLE_PRIVATE_FIELDS’ does not name a type
/usr/local/include/node/uv.h:490: error: ‘uv_alloc_cb’ does not name a type
/usr/local/include/node/uv.h:490: error: ‘UV_STREAM_PRIVATE_FIELDS’ does not name a type
/usr/local/include/node/uv.h:536: error: ‘UV_REQ_PRIVATE_FIELDS’ does not name a type
/usr/local/include/node/uv.h:539: error: ISO C++ forbids declaration of ‘UV_CONNECT_PRIVATE_FIELDS’ with no type
/usr/local/include/node/uv.h:540: error: expected ‘;’ before ‘}’ token
/usr/local/include/node/uv.h:540: error: expected `;' before ‘}’ token
/usr/local/include/node/uv.h:577: error: ‘uv_buf_t’ has not been declared
/usr/local/include/node/uv.h:582: error: ‘UV_HANDLE_PRIVATE_FIELDS’ does not name a type
/usr/local/include/node/uv.h:588: error: ‘UV_REQ_PRIVATE_FIELDS’ does not name a type
/usr/local/include/node/uv.h:591: error: ISO C++ forbids declaration of ‘UV_UDP_SEND_PRIVATE_FIELDS’ with no type
/usr/local/include/node/uv.h:592: error: expected ‘;’ before ‘}’ token
/usr/local/include/node/uv.h:592: error: expected `;' before ‘}’ token
/usr/local/include/node/uv.h:717: error: ‘uv_buf_t’ has not been declared
/usr/local/include/node/uv.h:736: error: ‘uv_buf_t’ has not been declared
/usr/local/include/node/uv.h:752: error: ‘uv_alloc_cb’ has not been declared
/usr/local/include/node/uv.h:773: error: ‘UV_HANDLE_PRIVATE_FIELDS’ does not name a type
/usr/local/include/node/uv.h:774: error: ‘uv_alloc_cb’ does not name a type
/usr/local/include/node/uv.h:774: error: ‘UV_STREAM_PRIVATE_FIELDS’ does not name a type
/usr/local/include/node/uv.h:789: error: ‘uv_file’ has not been declared
/usr/local/include/node/uv.h:813: error: ‘uv_file’ has not been declared
/usr/local/include/node/uv.h:822: error: ‘UV_HANDLE_PRIVATE_FIELDS’ does not name a type
/usr/local/include/node/uv.h:823: error: ‘uv_alloc_cb’ does not name a type
/usr/local/include/node/uv.h:823: error: ‘UV_STREAM_PRIVATE_FIELDS’ does not name a type
/usr/local/include/node/uv.h:837: error: ‘uv_file’ has not been declared
/usr/local/include/node/uv.h:860: error: ‘UV_HANDLE_PRIVATE_FIELDS’ does not name a type
/usr/local/include/node/uv.h:878: error: ‘UV_HANDLE_PRIVATE_FIELDS’ does not name a type
/usr/local/include/node/uv.h:898: error: ‘UV_HANDLE_PRIVATE_FIELDS’ does not name a type
/usr/local/include/node/uv.h:920: error: ‘UV_HANDLE_PRIVATE_FIELDS’ does not name a type
/usr/local/include/node/uv.h:942: error: ‘UV_HANDLE_PRIVATE_FIELDS’ does not name a type
/usr/local/include/node/uv.h:985: error: ‘UV_REQ_PRIVATE_FIELDS’ does not name a type
/usr/local/include/node/uv.h:987: error: ISO C++ forbids declaration of ‘UV_GETADDRINFO_PRIVATE_FIELDS’ with no type
/usr/local/include/node/uv.h:989: error: expected ‘;’ before ‘}’ token
/usr/local/include/node/uv.h:989: error: expected `;' before ‘}’ token
/usr/local/include/node/uv.h:1051: error: ‘UV_HANDLE_PRIVATE_FIELDS’ does not name a type
/usr/local/include/node/uv.h:1054: error: ISO C++ forbids declaration of ‘UV_PROCESS_PRIVATE_FIELDS’ with no type
/usr/local/include/node/uv.h:1055: error: expected ‘;’ before ‘}’ token
/usr/local/include/node/uv.h:1055: error: expected `;' before ‘}’ token
/usr/local/include/node/uv.h:1080: error: ‘uv_uid_t’ does not name a type
/usr/local/include/node/uv.h:1081: error: ‘uv_gid_t’ does not name a type
/usr/local/include/node/uv.h:1104: error: ‘UV_REQ_PRIVATE_FIELDS’ does not name a type
/usr/local/include/node/uv.h:1108: error: ISO C++ forbids declaration of ‘UV_WORK_PRIVATE_FIELDS’ with no type
/usr/local/include/node/uv.h:1109: error: expected ‘;’ before ‘}’ token
/usr/local/include/node/uv.h:1109: error: expected `;' before ‘}’ token
/usr/local/include/node/uv.h:1164: error: ‘UV_REQ_PRIVATE_FIELDS’ does not name a type
/usr/local/include/node/uv.h:1172: error: ISO C++ forbids declaration of ‘UV_FS_PRIVATE_FIELDS’ with no type
/usr/local/include/node/uv.h:1173: error: expected ‘;’ before ‘}’ token
/usr/local/include/node/uv.h:1173: error: expected `;' before ‘}’ token
/usr/local/include/node/uv.h:1177: error: ‘uv_file’ has not been declared
/usr/local/include/node/uv.h:1183: error: ‘uv_file’ has not been declared
/usr/local/include/node/uv.h:1186: error: ‘uv_file’ has not been declared
/usr/local/include/node/uv.h:1192: error: ‘uv_file’ has not been declared
/usr/local/include/node/uv.h:1195: error: ‘uv_file’ has not been declared
/usr/local/include/node/uv.h:1210: error: ‘uv_file’ has not been declared
/usr/local/include/node/uv.h:1216: error: ‘uv_file’ has not been declared
/usr/local/include/node/uv.h:1219: error: ‘uv_file’ has not been declared
/usr/local/include/node/uv.h:1222: error: ‘uv_file’ has not been declared
/usr/local/include/node/uv.h:1225: error: ‘uv_file’ has not been declared
/usr/local/include/node/uv.h:1228: error: ‘uv_file’ has not been declared
/usr/local/include/node/uv.h:1229: error: ‘uv_file’ has not been declared
/usr/local/include/node/uv.h:1237: error: ‘uv_file’ has not been declared
/usr/local/include/node/uv.h:1258: error: ‘uv_file’ has not been declared
/usr/local/include/node/uv.h:1264: error: ‘uv_file’ has not been declared
/usr/local/include/node/uv.h:1275: error: ISO C++ forbids declaration of ‘UV_HANDLE_PRIVATE_FIELDS’ with no type
/usr/local/include/node/uv.h:1276: error: expected ‘;’ before ‘char’
/usr/local/include/node/uv.h:1277: error: ISO C++ forbids declaration of ‘UV_FS_EVENT_PRIVATE_FIELDS’ with no type
/usr/local/include/node/uv.h:1278: error: expected ‘;’ before ‘}’ token
/usr/local/include/node/uv.h:1278: error: expected `;' before ‘}’ token
/usr/local/include/node/uv.h:1348: error: storage class specified for ‘uv_hrtime’
/usr/local/include/node/uv.h:1355: error: ‘uv_lib_t’ has not been declared
/usr/local/include/node/uv.h:1356: error: ‘uv_lib_t’ has not been declared
/usr/local/include/node/uv.h:1362: error: ‘uv_lib_t’ has not been declared
/usr/local/include/node/uv.h:1367: error: field ‘tcp’ has incomplete type
/usr/local/include/node/uv.h:1368: error: field ‘pipe’ has incomplete type
/usr/local/include/node/uv.h:1369: error: field ‘prepare’ has incomplete type
/usr/local/include/node/uv.h:1370: error: field ‘check’ has incomplete type
/usr/local/include/node/uv.h:1371: error: field ‘idle’ has incomplete type
/usr/local/include/node/uv.h:1372: error: field ‘async’ has incomplete type
/usr/local/include/node/uv.h:1373: error: field ‘timer’ has incomplete type
/usr/local/include/node/uv.h:1374: error: field ‘getaddrinfo’ has incomplete type
/usr/local/include/node/uv.h:1375: error: field ‘fs_event’ has incomplete type
/usr/local/include/node/uv.h:1381: error: field ‘connect’ has incomplete type
/usr/local/include/node/uv.h:1383: error: field ‘fs_req’ has incomplete type
/usr/local/include/node/uv.h:1384: error: field ‘work_req’ has incomplete type
/usr/local/include/node/uv.h:1408: error: ‘UV_LOOP_PRIVATE_FIELDS’ does not name a type
/usr/local/include/node/uv.h:1412: error: field ‘uv_eio_want_poll_notifier’ has incomplete type
/usr/local/include/node/uv.h:1413: error: field ‘uv_eio_done_poll_notifier’ has incomplete type
/usr/local/include/node/uv.h:1414: error: field ‘uv_eio_poller’ has incomplete type
/usr/local/include/node/uv.h:1416: error: field ‘counters’ has incomplete type
In file included from /usr/local/include/node/node.h:64,
                 from ../reader.cc:2:
/usr/include/sys/stat.h:169: error: multiple types in one declaration
/usr/include/sys/stat.h:427: error: expected unqualified-id before string constant
In file included from /usr/include/sys/wait.h:116,
                 from /usr/include/stdlib.h:65,
                 from /usr/include/assert.h:44,
                 from /usr/local/include/node/node.h:65,
                 from ../reader.cc:2:
/usr/include/sys/signal.h:412: error: expected unqualified-id before string constant
In file included from /usr/include/sys/wait.h:117,
                 from /usr/include/stdlib.h:65,
                 from /usr/include/assert.h:44,
                 from /usr/local/include/node/node.h:65,
                 from ../reader.cc:2:
/usr/include/sys/resource.h:237: error: expected unqualified-id before string constant
In file included from /usr/include/stdlib.h:65,
                 from /usr/include/assert.h:44,
                 from /usr/local/include/node/node.h:65,
                 from ../reader.cc:2:
/usr/include/sys/wait.h:254: error: expected unqualified-id before string constant
In file included from /usr/include/stdlib.h:67,
                 from /usr/include/assert.h:44,
                 from /usr/local/include/node/node.h:65,
                 from ../reader.cc:2:
/usr/include/alloca.h:35: error: expected unqualified-id before string constant
In file included from /usr/include/assert.h:44,
                 from /usr/local/include/node/node.h:65,
                 from ../reader.cc:2:
/usr/include/stdlib.h:134: error: storage class specified for ‘__mb_cur_max’
/usr/include/stdlib.h:144: error: expected unqualified-id before string constant
In file included from /usr/local/include/node/node.h:65,
                 from ../reader.cc:2:
/usr/include/assert.h:75: error: expected unqualified-id before string constant
In file included from /usr/local/include/node/node_object_wrap.h:27,
                 from /usr/local/include/node/node.h:67,
                 from ../reader.cc:2:
/usr/include/assert.h:75: error: expected unqualified-id before string constant
In file included from /usr/local/include/node/node.h:67,
                 from ../reader.cc:2:
/usr/local/include/node/node_object_wrap.h:29: error: expected unqualified-id before ‘namespace’
../reader.cc:237: error: expected `}' at end of input
../reader.cc:237: error: expected unqualified-id at end of input
../reader.cc:237: error: expected `}' at end of input
../reader.cc:237: error: expected unqualified-id at end of input
../reader.cc:237: error: expected `}' at end of input
../reader.cc:237: error: expected unqualified-id at end of input
../reader.cc:237: error: expected `}' at end of input
../reader.cc:237: error: expected unqualified-id at end of input
../reader.cc:237: error: expected `}' at end of input
../reader.cc:237: error: expected unqualified-id at end of input
../reader.cc:237: error: expected `}' at end of input
../reader.cc:237: error: expected unqualified-id at end of input
../reader.cc:237: error: expected `}' at end of input
../reader.cc:237: error: expected unqualified-id at end of input
../reader.cc:237: error: expected `}' at end of input
Waf: Leaving directory `/Users/imaz/work/js/joyent/node_modules/socket.io/node_modules/redis/node_modules/hiredis/build'
Build failed:
 -> task failed (err #1): 
	{task: cxx hiredis.cc -> hiredis_1.o}
 -> task failed (err #1): 
	{task: cxx reader.cc -> reader_1.o}
make: *** [all] Error 1
sh: gmake: command not found
npm WARN optional dependency failed, continuing hiredis@0.1.14
npm http 304 https://registry.npmjs.org/zeparser/0.0.5
npm http 304 https://registry.npmjs.org/tinycolor
npm http 304 https://registry.npmjs.org/commander
npm http 304 https://registry.npmjs.org/options

> ws@0.4.21 install /Users/imaz/work/js/joyent/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws
> node install.js

[ws v0.4.21] Attempting to compile blazing fast native extensions.
[ws v0.4.21] Native extension compilation successful!
socket.io@0.9.10 ./node_modules/socket.io
├── policyfile@0.0.4
├── redis@0.7.2
└── socket.io-client@0.9.10 (xmlhttprequest@1.4.2, uglify-js@1.2.5, active-x-obfuscator@0.0.1, ws@0.4.21)