ubuntu lucidにnode.jsを入れる方法

lucidにはまだnode.jsのパッケージがないのでどこかにパッケージないかなと思って、探してたらあった。

http://wiki.mediatemple.net/w/Installing_Node.js_on_Ubuntu

コマンドだけ並べると

sudo aptitude update
sudo aptitude install python-software-properties
sudo add-apt-repository ppa:chris-lea/node.js
sudo aptitude update
sudo aptitude install nodejs

インストールが終わったら nodejs ってコマンドが使えるようになるのであとは好きなように。

Titaniumメモ

Ti.UIとTitanium.UIの違い

TiはTitaniumの略でどちらも同じ

Titanium SDK 1.4でTi.API.infoがちゃんとログを表示しない

下記URLのlogger.pyを入れると治る
http://developer.appcelerator.com/blog/2010/07/introducing-titanium-mobile-1-4.html

iTunes 10を入れるとTitaniumがiTunesを見つけられない

下記URLのprereq.pyを入れると治る
http://developer.appcelerator.com/blog/2010/09/quick-patch-itunes-10-detection-using-1-4.html

@masuidriveさんによるTips集

http://code.google.com/p/titanium-mobile-doc-ja/wiki/Tips
ここに書いてあるrakeファイルを入れるとかなり効率が上がる

Ti.UI.createWindowのurlパラメータで作ったwindowでtransitionが効かない

bongoleが書いたソースでうまく行く(今のところ)
http://developer.appcelerator.com/question/6481/window-transition-and-url

@masuidriveさんが作ってくれたAPIドキュメント

http://tidocs.com
インクリメンタルサーチが使えて公式より使いやすい

Ti.UI.createButtonで作成したボタンをdisableにできない

Ti.UI.createButton呼び出し時にenabledを指定しないと後からenabledをfalseにできないっぽい。

var btn1 = Ti.UI.createButton({ title: 'ok' });
btn1.enabled = false; // falseを入れてもボタンをdisableにできない。

var btn2 = Ti.UI.createButton({ title: 'ok', enabled: true});
btn2.enabled = false; // disableにできる。

iOS4以上でバックグラウンド動作させない

http://developer.appcelerator.com/question/40081/ios4---make-app-not-run-in-background
PROJECT_HOME/build/iphone/Info.plist を PROJECT_HOME/Info.plist にコピーして以下の設定を追加する

<key>UIApplicationExitsOnSuspend</key>
<true/>

JRubyのspinup時間はどこまで速くできるのかやってみた

rubygems, rack, rails, sinatra等を使わないとどこまで速くなるのかやってみた。
使ったのは最新のJRuby1.5.0のnightlyビルドと以下のサーブレット

package org.bongole;

import java.io.IOException;
import java.util.ArrayList;
import java.util.logging.Logger;

import javax.servlet.http.*;
import org.jruby.Ruby;
import org.jruby.RubyInstanceConfig;
import org.jruby.exceptions.RaiseException;
import org.jruby.javasupport.JavaEmbedUtils;
import org.jruby.runtime.builtin.IRubyObject;
import org.jruby.util.ClassCache;

@SuppressWarnings("serial")
public class SimpleJRubyServlet extends HttpServlet {
	
	private ClassCache classCache = JavaEmbedUtils.createClassCache(Thread.currentThread().getContextClassLoader());
	private Logger logger = Logger.getLogger(this.getClass().getName());
	 
	public void doGet(HttpServletRequest req, HttpServletResponse resp)
			throws IOException {
		Ruby runtime = JavaEmbedUtils.initialize(new ArrayList(), createRuntimeConfig());
		runtime.getGlobalVariables().set("$resp", JavaEmbedUtils.javaToRuby(runtime, resp));
		runtime.evalScriptlet("$resp.content_type = 'text/plain'; $resp.writer.println('Hello, World from JRuby')");		
	}
	
    private RubyInstanceConfig createRuntimeConfig() {
        RubyInstanceConfig config = new RubyInstanceConfig();
        config.setClassCache(classCache);
        return config;
    }
}

結果:

ここまでシンプルにしても、現状5,6秒くらいはかかるってことか。。。
id:urekatさんの実験によるとsinatraとrackで8,9秒ってところだからがんばってもあと3秒くらいしか縮まないのか。なるほど。