[javascript] Chrome ã® JavaScript å¦çç³» v8 ã OSX ã«å ¥ãã¦ã¿ã
ãµãã« Chrome ã® JS å¦çç³»ãã³ãã³ãã©ã¤ã³ããå®è¡ããããªã£ãã®ã§å
¥ãã¦ã¿ããã¨ã«ããã
ï¼Chrome ã®ã³ã³ã½ã¼ã«ããããããããªãã¨ããã°ãããªãã®ã ãã©â¦ãï¼
v8 ã®ãã«ãã«ã¯ SCons ã¨ãããã«ããã¼ã«ãå¿
è¦ãããã®ã§ãããå
¥ããå¿
è¦ãããã
ã¾ããSCons ã®ã¤ã³ã¹ãã¼ã«ã«ã¯ Python ãå¿
è¦ã
ã¾ã Python ãã
ãã¶ã OSX 10.7.4 ã«ã¯ããã©ã«ã㧠python ãå ¥ã£ã¦ããã®ã§ãæ°ãã«å ¥ãç´ãå¿ è¦ã¯ãªãã
$ python --version Python 2.7.1
次㫠SCons
SCons ã®ã½ã¼ã¹ã¯ä»¥ä¸ããåã£ã¦ããã
scons-2.1.0.tar.gz
ä½æ¥ãã£ã¬ã¯ããªï¼ããã§ã¯ ~/srcï¼ã«æã£ã¦ãã¦ã»ããã¢ããããã
$ mv ~/Downloads/scons-2.1.0.tar.gz ~/src $ cd ~/src $ tar zxvf scons-2.1.0.tar.gz $ cd scons-2.1.0 $ sudo python setup.py install
æå¾ã« v8
git ãã v8 ãã¯ãã¼ã³ããã
$ cd ~/src $ git clone https://github.com/v8/v8.git
SCons ã§ãã«ãã
$ cd v8
$ scons sample=shell
ãã«ããçµãã㨠~/src/v8 以ä¸ã« shell ã¨ããå®è¡ãã¡ã¤ã«ãåºæ¥ã¦ãããããã v8 ã®å¦çç³»ã
ãã®ã¾ã¾ã ã¨ä½¿ãã¥ããã®ã§ãã·ã³ããªãã¯ãªã³ã¯ /usr/bin/v8 ãä½ã£ã¦ããã
sudo ln -s ~/src/v8/shell /usr/bin/v8
ããã§ã©ãããã§ã v8 ã¨å©ãã°å¼ã¹ãããã«ãªãã
ãããªæãã§åãã
$ v8 V8 version 3.12.15 (candidate) [sample shell] > print('hello, world!'); hello, world! > ^C
æãããã¨ã㯠^C ã§æããããã
ãã¡ã¤ã«ãæå®ãã¦å®è¡ãããã¨ãå¯è½ã
$ echo 'print("from test.js");' > test.js $ v8 test.js from test.js
[vim][web+db] Vi(m) ã³ãã³ãã®è¦æ¸
ãWEB+DB PRESS 62ãã®ç¹éãLinux ã®åºç¤ç¥èããèªãã§ã
ãã¼ã«ãã³ã§ãã§ãã¯ãã¦ãããè¦ãã¦ãããããã¨ãããã°ã«ãæ¸ãã¦ããã
è¦ãã¦ããããã³ãã³ãã®ä¸è¦§
ã³ãã³ã | 解説 |
---|---|
ZZ | ä¿åãã¦çµäº |
w | 次ã®åèªã«ç§»å |
b | åã®åèªã«ç§»å |
^ | è¡é ã«ç§»å |
$ | è¡æ«ã«ç§»å |
Ctrl+f | 1ãã¼ã¸é²ã |
Ctrl+b | 1ãã¼ã¸æ»ã |
gg | ãã¡ã¤ã«ã®å é ã«ç§»åï¼1G ã§ãããï¼ï¼ |
% | 対å¿ããæ¬å¼§ã«ç§»å |
p | åã®æ¤ç´¢çµæã«ç§»åï¼N ã§ãããï¼ï¼ |
o | 1ã¤ä¸ã«æ°ããè¡ã追å ãã¦ããã¹ãå ¥åï¼o ã¯ä½ã®ç¥ï¼Overï¼ï¼ |
O | 1ã¤ä¸ã«æ°ããè¡ã追å ãã¦ããã¹ãå ¥å |
dw | ã«ã¼ã½ã«ä½ç½®ãã1åèªåé¤ ï¼ä¼¼ããããªã³ãã³ãã¨ã㦠d^ ã d$ ããããd ã¯ãã£ã¨ Delete ã®ç¥ã ãªãï¼ |
cw | ã«ã¼ã½ã«ä½ç½®ãã1åèªå¤æ´ ï¼c 㯠Change ã ãªãï¼ |
yw | ã«ã¼ã½ã«ä½ç½®ãã1åèªã³ãã¼ ï¼y 㯠Yank 㧠Emacs ã¨ãã£ãããç¾å¨è¡ã丸ã ã³ãã¼ããã«ã¯ yyãï¼ |
p | ã³ãã¼ããã®ãè¡åä½ã§ãªãå ´åã¯ãã«ã¼ã½ã«ä½ç½®ã®1ã¤å¾ãã«ãã¼ã¹ãã ã³ãã¼ããã®ãè¡åä½ã®å ´åã¯ãã«ã¼ã½ã«è¡ã®ä¸ã«ãã¼ã¹ãã |
P | ã³ãã¼ããã®ãè¡åä½ã§ãªãå ´åã¯ãã«ã¼ã½ã«ä½ç½®ã«ãã¼ã¹ãã ã³ãã¼ããã®ãè¡åä½ã®å ´åã¯ãã«ã¼ã½ã«è¡ã®ä¸ã«ãã¼ã¹ãã |
dw, cw, yw ã¯ä¼¼ããã®å士
cw, yw ã dw åæ§ã«å¾ãã® w ã ^ ã $ ã«å¤ããã¨æåãå¤ãããã¿ããªä¼¼ããããªåä½ãããã
ãã¼ã¹ãï¼p, Pï¼ã®éã
- ã³ãã¼ããã®ãè¡åä½ã®å ´åã¯ãp, P 㯠a, i ã«å¯¾å¿ãã¦ããã
- ã³ãã¼ããã®ãè¡åä½ã®å ´åã¯ãp, P 㯠o, O ã«å¯¾å¿ãã¦ããã
ããããã°ãa 㯠After ã®é æåãªãã ãããï¼
i ã Insert ã ããã«ã¼ã½ã«ä½ç½®ã«æ¿å
¥ã§ãa ã After ã ããå¾ãã«æ¿å
¥ã¨èããã¨è¦ãããããªã
æåã®ç½®æ
æååã®ç½®æ㯠s ã³ãã³ãã§è¡ãã
ãã©ã¼ãããã¯ã:ç¯å²s/from/to/[gc]ã
ãç¯å²ãã¯å
¨è¡ã表ã % ããn è¡ç®ãã m è¡ç®ã表ã n,m ã使ããã
ãªãã·ã§ã³ c 㯠confirm ã®ç¥ã§ãç½®æã1ã¤1ã¤ç¢ºèªãããã¨ãã«ä½¿ãã
ã¢ã³ãã¥
ç´ç²ãª vi ã§ã¯ã¢ã³ãã¥ã¯1åããå®è¡ã§ãã¾ããããVim ã§ã¯è¤æ°åã¢ã³ãã¥ãå®è¡ã§ããããã«ãªã£ã¦ãã¾ãã
vi ã§è¤æ°åã¢ã³ãã¥ãããã¨ãã¯ã©ãããããããã ããï¼
åæ°ãæå®ã㦠u ãå¼ãã ãã¯ã§ããªãã®ã ãããã
[css] ãã¶ã¤ã³ã微修æ£
ãã©ã³ãã®ãµã¤ãºã¨å¤§ãããã¬ã¤ã¢ã¦ãã®å¹
ãåºãåãããã«ããã
ããã§å°ãè¦ããããªãããªï¼
before
.day { font-size: 80%; } #simple-header { max-width: 910px; } h1 { max-width: 910px; } .hatena-body { max-width: 910px; }
after
.day { font-size: 100%; } #simple-header { max-width: 1100px; } h1 { max-width: 1100px; } .hatena-body { max-width: 1100px; }
max-width 㯠none ã«ããã¨ã¡ãã£ã¨åºãããå°è±¡ã ã£ãã®ã§ã1100px ã«ãã¦ãããã
Mac Book Air ã« postgresql ãã¤ã³ã¹ãã¼ã«
homebrew ã§å ¥ããã
$ brew install postgresql
9.1.3 ãå
¥ã£ãã
$ brew list postgresql /usr/local/Cellar/postgresql/9.1.3/bin/vacuumlo /usr/local/Cellar/postgresql/9.1.3/bin/vacuumdb /usr/local/Cellar/postgresql/9.1.3/bin/reindexdb /usr/local/Cellar/postgresql/9.1.3/bin/psql ... é·ãã®ã§ 以ä¸çç¥ ...
ã§ã psql ãå©ãã¦ã¿ãã¨ãhomebrew ã§å
¥ããã®ã§ã¯ãªãããã©ã«ãã§å
¥ã£ã¦ãã psql ãè¦ã«è¡ã£ã¦ããããã ã
$ psql --version psql (PostgreSQL) 9.0.5 contains support for command-line editing
ãã®åé¡ã«å¯¾å¦ããããã®ã¹ã¯ãªãããããã®ã§ãããããã£ã¦ãã¦å®è¡ã
curl http://nextmarvel.net/blog/downloads/fixBrewLionPostgres.sh | sh
ãã£ã¦ããã¨ã¨ãã¦ã¯ãããã©ã«ãã§å
¥ã£ã¦ãã psql 㨠postgres ããããã£ã¬ã¯ããªã«archive ãã£ã¬ã¯ããªãä½ãã
ãªãªã¸ãã«ã®ãã¡ã¤ã«ç¾¤ãããã«ç§»åããã代ããã« homebrew ã§å
¥ãããã®ãã³ãã¼ãã¦ããããã ã
ï¼psql ãã¯ã©ã¤ã¢ã³ã㧠postgres ããµã¼ãããããï¼
ãã㧠homebrew ã§å ¥ããã®ãè¦ã«è¡ã£ã¦ãããããã«ãªã£ãã
$ psql --version psql (PostgreSQL) 9.1.3 contains support for command-line editing
DB ãµã¼ãã®åæåã
$ initdb /usr/local/var/postgres
ãµã¼ãã®èµ·åã
$ postgres start -D /usr/local/var/postgres
ã¯ã©ã¤ã¢ã³ãããã¢ã¯ã»ã¹ã§ããã確èªã
$ psql -l
æ¯åãµã¼ããèµ·åãããã®ã¯é¢åãªã®ã§ããã°ã¤ã³æã«èªåèµ·åããããã«è¨å®ããã
ã¾ã㯠plist ã ~/Library/LaunchAgents ã¸ã³ãã¼ã
$ cp /usr/local/Cellar/postgresql/9.1.3/homebrew.mxcl.postgresql.plist ~/Library/LaunchAgents/
plist ã¯ã¢ããªã±ã¼ã·ã§ã³ã®è¨å®ãã¡ã¤ã«ã§ã
LaunchAgents ã¯ãã°ã¤ã³ããã¦ã¼ã¶ã®æ¨©éã§èµ·åæã«ããã°ã©ã ãå®è¡ããããã®æ©è½ã®ãã¨ãããã
ï¼Daemon ã¨ã¯éã£ã¦åå¥ã®ã¦ã¼ã¶ãã¨ã«åãããµã¼ãããã°ã©ã ã®ãã¨ã Agent ã£ã¦ããã¿ãããï¼
launchctl ã§ã³ãã¼ãã plist ãèªã¿ãã¾ããã
$ launchctl load -w ~/Library/LaunchAgents/homebrew.mxcl.postgresql.plist
ããã§èªåèµ·åãããããã«ãªã£ãâ¦ãä¸äº OK ã ã£ãã®ã ãã©ããªãããã¡ã¿ããã
ãlaunchctl listããã¦ã¿ã㨠PID ãã-ãã«ãªã£ã¦ãã®ã§åãã¦ãªãããã ã
plist ã®å
容ãééã£ã¦ãã®ããªï¼ãããããªâ¦ã³ãã¼ããã ããªãã ãã©ãªãã
$ cat ~/Library/LaunchAgents/homebrew.mxcl.postgresql.plist <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <dict> <key>KeepAlive</key> <true/> <key>Label</key> <string>homebrew.mxcl.postgresql</string> <key>ProgramArguments</key> <array> <string>/usr/local/bin/postgres</string> <string>-D</string> <string>/usr/local/var/postgres</string> <string>-r</string> <string>/usr/local/var/postgres/server.log</string> </array> <key>RunAtLoad</key> <true/> <key>UserName</key> <string>gan2</string> <key>WorkingDirectory</key> <string>/usr/local</string> <key>StandardErrorPath</key> <string>/usr/local/var/postgres/server.log</string> </dict> </plist>
ããâ¦ãªãã array ã®ããããããããâ¦ã
array ã®ä¸ã¯ postgres ã®ãã¹ã¨å¼æ°ã並ã¹ããã¦ããããã ãã©ã
/usr/local/var/postgres ãªãã¦ãã£ã¬ã¯ããªã¯ãªããã
postgresql ãªããããããã£ã¡ãããªãããªï¼ã¨ãããã¨ã§ -D 㨠-r ã®ããä¸ã«ãã postgres ã postgresql ã«ä¿®æ£ã
ã§ãã£ã¦åèªã¿è¾¼ã¿ããã¦ã¿ãã
$ launchctl unload -w ~/Library/LaunchAgents/homebrew.mxcl.postgresql.plist $ launchctl load -w ~/Library/LaunchAgents/homebrew.mxcl.postgresql.plist
ãã£ãï¼ããã§åãããã«ãªã£ãããã§ãããã§ããã
[emacs][ruby] Emacs ãã rbenv ã§å ¥ãã ruby ãå¼ã³åºããªã
- Terminal ã§ãwhich rubyãããã¨ã/Users/gan2/.rbenv/shims/rubyãã¨è¡¨ç¤ºãããã
- Emacs ã§ãM-! which rubyãããã¨ã/usr/bin/rubyãã¨è¡¨ç¤ºãããã
åãããã®éããä½ã¨ããããã¨æã£ã¦ããããé¡ãã ãã Emacs ã§ã rbenv ã®æ¹ãè¦ã«è¡ã£ã¦ä¸ããã
PATH ãããããã®ã§ç¢ºããã¦ã¿ãã
- Terminal ã§ãecho $PATHãããã¨ã/Users/gan2/.rbenv/shimsããã/usr/binããããå ã«ãããããããã
- Emacs ã§ãM-! echo $PATHãããã¨ã/usr/binãã®æ¹ãå ã«ãããããã ãããããããªããã ã
ã/Users/gan2/.rbenv/shimsããã/usr/binãããåã«ããããã«ãªãã°è§£æ±ºããã¯ãã ã
ããã£ã¦ã¿ãã¨ããã®è¾ºãã®åé¡ã¯ exec-path 㨠PATH ã®è¨å®ã§å¯¾å¦ã§ããããããã¨ãåãã£ãã
ã§ãçä¼¼ãã¦å¹¾ã¤ã試ãã¦ã¿ãã®ã«åé¡ã解決ããªãã
(setq exec-path (cons (expand-file-name "~/.rbenv/shims") exec-path)) ; => ("/Users/gan2/.rbenv/shims" "/usr/bin" "/bin" "/usr/sbin" "/sbin" "/Applications/Emacs_Carbon.app/Contents/MacOS/libexec" "/Applications/Emacs_Carbon.app/Contents/MacOS/bin" "~/bin" "/usr/local/bin" "/usr/X11R6/bin") (setenv "PATH" (concat (expand-file-name "~/.rbenv/shims:") (getenv "PATH"))) ; => "/Users/gan2/.rbenv/shims:/usr/bin:/bin:/usr/sbin:/sbin:~/bin:/usr/local/bin:/usr/X11R6/bin"
ä¸è¨ã®è¨å®ã§ãexec-pathãPATH ã¨ãã« "/Users/gan2/.rbenv/shims" ãå
é ã«ãã¦ããã
ã§ããM-! echo $PATHãã§ã¯å
é ã«æ¥ãªãã
ã©ãã M-! ãåç
§ãã¦ãã PATH ã¯ãTerminal ã® PATH ã¨ã getenv ã§è¦ãã PATH ã¨ãéããã®ã®ããã ã
ã¡ãªã¿ã«ã以ä¸ã C-x C-e ããã¨ã/Users/gan2/.rbenv/shims/rubyããåºåãããã
(apply 'call-process "which" nil t nil '("ruby"))
ãã¼ãããã£ãããªããªã¼ã
[js] JsTestDriver ãåããªãâ¦
ããã¹ãé§å JavaScriptããè²·ã£ãã®ã§èªãã§ããã®ã ãã©ããã®æ¬ãéãã¦ä½¿ã JsTestDriver ãåããªãã¦å°ã£ã¦ããã
ã»ããã¢ããã¯åé¡ãªãçµãã£ã¦ãã¦ããã¹ããã¡ã¤ã«ãå¿ è¦ã¨ããªãç¶æ ã§ã¯åé¡ãªãåä½ããã
$ java -jar ~/bin/JsTestDriver-1.2.1.jar --port 4224
ã§ãèå¿ã®ãã¹ããã¡ã¤ã«ãå¿
è¦ã¨ããå ´åã¯åããªãï¼
ãjava.net.ConnectionException: Connection refusedãã£ã¦ä¾å¤ãåºãã
ãããããã¹ãã«ã¯ã¾ãã£ãã使ããªããããªããâ¦ã
$ java -jar ~/bin/JsTestDriver-1.2.1.jar --tests all java.net.ConnectException: Connection refused java.lang.RuntimeException: java.net.ConnectException: Connection refused at com.google.jstestdriver.HttpServer.fetch(Unknown Source) at com.google.jstestdriver.JsTestDriverClientImpl.listBrowsers(Unknown Source) at com.google.jstestdriver.ThreadedActionsRunner.run(Unknown Source) at com.google.jstestdriver.ActionRunner.runActions(Unknown Source) at com.google.jstestdriver.JsTestDriverServer.main(Unknown Source) Caused by: java.net.ConnectException: Connection refused at java.net.PlainSocketImpl.socketConnect(Native Method) at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:351) at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:213) at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:200) at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:432) at java.net.Socket.connect(Socket.java:529) at java.net.Socket.connect(Socket.java:478) at sun.net.NetworkClient.doConnect(NetworkClient.java:163) at sun.net.www.http.HttpClient.openServer(HttpClient.java:395) at sun.net.www.http.HttpClient.openServer(HttpClient.java:530) at sun.net.www.http.HttpClient.<init>(HttpClient.java:234) at sun.net.www.http.HttpClient.New(HttpClient.java:307) at sun.net.www.http.HttpClient.New(HttpClient.java:324) at sun.net.www.protocol.http.HttpURLConnection.getNewHttpClient(HttpURLConnection.java:970) at sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.java:911) at sun.net.www.protocol.http.HttpURLConnection.connect(HttpURLConnection.java:836) at com.google.jstestdriver.HttpServer.fetch(Unknown Source) ... 4 more
公式の GettingStartedãè¦ã¦ã¿ãã¨ãåãããã«ããã£ã¦ãã人ãããã
ã§ãããã¨ãã£ã解決çãåºã¦ãã¦ããªãã¿ããã
ãã®æ¬ã®åèãåºãã®ã¯2009å¹´ã§ãå½æã® JsTestDriver ã®ãã¼ã¸ã§ã³ã 1.2.1ã
2012å¹´5æç¾å¨ã®ææ°ãã¼ã¸ã§ã³ã¯ 1.3.4 ã§2年以ä¸çµã£ã¦ããã®ã§ããããªãã°ããã£ã¨æ®ã£ã¦ããã¨ã¯èãã¥ããã
ãªã«ãè¦è½ã¨ãã¦ããã¨æãã®ã ãã©â¦ã
追è¨
解決ããï¼ä½¿ãæ¹ãåéããã¦ããã¿ããã
ã--testsããã¤ãã®ã¨ã¤ããªãã®ã¯ã©ã¡ããå®è¡ãããå¿
è¦ãããã
ã--testsãã¤ããªãã®ã¯ãã©ã¦ã¶ããã£ããã£ã§ãããã©ããã®ç¢ºèªç¨ã ã¨æã£ã¦ãããã©éã£ã¦ããã
ã©ã£ã¡ãåãããªãã¨ãããªããã¤ãã¦ãªãã®ããµã¼ãèµ·åç¨ã§ãã¤ãã¦ãæ¹ããã¹ãã®å®è¡ç¨ã¨ããå½¹å²ã¿ããã