最近Twitterクライアントとして Termtter を使っています。 適度に見づらいのが、かえって邪魔にならなくて良い感じです。

発言中のURLを開くときに、$ab のような識別子を指定して開くプラグインを作りました。

open.rb

   1  USAGE
   2  > open $dq
   3  open 1st URI in $dq
   4  > open $dq 2
   5  open 2nd URI in $dq

posted by Png genki on Sat 15 Aug 2009 at 04:22 with 4 comments

iPhoneに限った話ではないのですが。メモ:

via
http://discussions.apple.com/thread.jspa?messageID=8157595

CGRect → NSValue

CGRect rect = CGRectMake(x,y,w,h);
NSValue *rectValue = [NSValue valueWithCGRect:rect];

NSValue → CGRect

CGRect rect = [someNSValue CGRectValue];

posted by Png satoko on Wed 12 Aug 2009 at 22:18

調べてわかったのですが、複数パラメータを持つメソッドのSELは作成できるのですが(下記)、UIButtonなどのtarget-action設定時にパラメータを渡す事はできないようです。

-(void)methodWithNoArguments;
SEL noArgumentSelector = @selector(methodWithNoArguments);

-(void)methodWithOneArgument:(id)argument;
SEL oneArgumentSelector = @selector(methodWithOneArgument:); // notice the colon here

-(void)methodWIthTwoArguments:(id)argumentOne and:(id)argumentTwo;
SEL twoArgumentSelector = @selector(methodWithTwoArguments:and:); // notice the argument names are omitted

ちなみに、自分でSELのメソッドを呼び出すときには、パラメータを渡す事は可能:

-performSelector:
-performSelector:withObject:
-performSelector:withObject:withObject:

senderでごにょごにょ

できないと言っても、if(sender == _myButton) {} とか sender.tag をうまく使って、誰が呼出し元かや、intを渡す事は可能なようです。

Refs

posted by Png satoko on Wed 12 Aug 2009 at 20:51

ファイル共有のために、DAVを設定する方法のメモです。 手軽さ重視で SSL + Basic認証を。

  1. まずは mod_ssl, mod_dav, mod_dav_fsをインストール。
  2. a2enmodで有効化
  3. sites-available/webdav 等の名前で設定を作る

中身はこんな感じ。

   1  <IfModule mod_ssl.c>
   2  <VirtualHost *:443>
   3    ServerName dav.yourserver.com
   4    ServerAdmin webmaster@dav.yourserver.com
   5    DocumentRoot "/path/to/dav"
   6    
   7    <IfModule mod_dav.c>
   8      DAVMinTimeout 600
   9      DAVLockDB "/var/lock/dav/DAVLock"
  10      <Location />
  11        DAV On
  12        SSLRequireSSL
  13        AuthType Basic
  14        AuthName "DAV Server"
  15        AuthUserFile "/etc/apache2/dav.passwd"
  16        Require valid-user
  17      </Location>
  18    </IfModule>
  19  
  20    # 以下略

/path/to/dav と /var/lock/dav を作成し、www-dataに所有権を設定しておきます。

posted by Png genki on Fri 7 Aug 2009 at 13:08

昨日書いた、gem serverをIE8から見るとヒドイことになる現象を解決しました。

どうやら、gem serverに問題があるようでした。

gem serverのコード(/usr/lib/ruby/site_ruby/1.8/rubygems/server.rbあたり)を見てみると、

gemのバージョンが1.3.3以降だと、40行目くらいに

   1    SEARCH = <<-SEARCH
   2        <form class="headerSearch" name="headerSearchForm" method="get" action="/rdoc">
   3          <div id="search" style="float:right">
   4            <span>Filter/Search</span>
   5            <input id="q" type="text" style="width:10em" name="q"/>
   6            <button type="submit" style="display:none" />
   7          </div>
   8        </form>
   9    SEARCH

という検索窓をつけるためのHTMLが書かれているところがあります。

これのbuttonタグの書き方がIE8だとうまくいかないらしく(というか、FxとChromeがよきにはからってくれている?)、

   1    SEARCH = <<-SEARCH
   2        <form class="headerSearch" name="headerSearchForm" method="get" action="/rdoc">
   3          <div id="search" style="float:right">
   4            <span>Filter/Search</span>
   5            <input id="q" type="text" style="width:10em" name="q"/>
   6            <button type="submit" style="display:none"></button>
   7          </div>
   8        </form>
   9    SEARCH
</button>できちんと閉じてあげないといけないみたいです。

修正後のgem serverをIE8で見ると、こんな感じです。

ie8_fix.bmp

きちんと表示できるようになって、うれしいです。

普段、全くIE使わないですけど。

posted by Png y_tsuda on Thu 6 Aug 2009 at 05:44

久しぶりにRailsで開発しているのですが、なんとなーくIE8を開いてて、これまたなんとなーくgem serverを使ってドキュメントを見ようとしたのです。

すると、トップ画面が「これはひどい」と言わざるを得ないくらいひどいことになりました。

ちなみに、gemのバージョンは、1.3.5です。

まず、他のブラウザの場合

Firefox 3.5

firefox35.bmp

きれいに表示されます

Google Chrome 2

chrome2.bmp

きれいに表示されます

そして、問題のIE8はというと...

Internet Explorer 8

ie8.bmp

これはひどい

僕がひどいのか、gem serverがひどいのか、IE8がひどいのか・・・。

追記 2009/08/06

解決しました

posted by Png y_tsuda on Wed 5 Aug 2009 at 11:50

Can't exec "xcodebuild": No such file or directory at /opt/local/bin/scan-build line 830.

いつの間にかscan-buildでエラーが出るようになってしまったみたいで、ちょっと困りました。解決したので、自分用にメモ。

"xcodebuild"はXcodeのコマンドラインツール

scan-buildは悪くないらしい...というので考えたら、少し前に古いverのXcodeを削除してしまったので、最新のxcodebuildが$PATHに通っていないのが原因ぽい。

「xcodebuild」は、Xcodeで作成されたプロジェクトをコンパイルするコマンドラインツールだ
http://slashdot.jp/~hylom/journal/459704

で .zshrcに新しいxcodebuildへのPathを追加

   1  export PATH=/Developer3.1b2/usr/bin:$PATH

するとscan-buildが無事できるようになりました!
で、いつものようにscan-build xcodebuildをやってみたのだけれど、またエラー:

   1  scan-build xcodebuild  
   2  === BUILDING NATIVE TARGET ShoppingList OF PROJECT ShoppingList WITH THE DEFAULT CONFIGURATION (Release) ===
   3  
   4  Checking Dependencies...
   5  2009-08-05 06:00:35.063 xcodebuild[5232:10b] _XCDistributedBuildHostInfoTask encountered an error: Error Domain=NSPOSIXErrorDomain Code=2 UserInfo=0x36ebf70 "Operation could not be completed. No such file or directory"
   6  error: There is no SDK with the name or path 'iphoneos2.2'
   7  ** BUILD FAILED **

引数なしでscan-buildすると、プロジェクトで設定されているiPhone OS2.2を選択してbuildしようとしてエラーになっているみたいです。

scan-buildの-sdkオプション

scan-build -k -V xcodebuild -configuration Debug -sdk iphonesimulor2.2.1
http://studiot.jp/blog/?p=64

上を参考に-sdkオプションを適用してやると:

   1  scan-build xcodebuild -sdk iphoneos2.2.1

大量のエラーぽいものを出しながらビルド成功+バグなし。
怪しいので3.0にしてみたらエラーも出なくて、ちゃんとバグを発見してくれました:

   1  scan-build xcodebuild -sdk iphoneos3.0 

posted by Png satoko on Tue 4 Aug 2009 at 21:50

I've preferred FLTK for easy development of GUI tool. It has function to treat OpenGL easily, but it doesn't provide box but only window as "Fl_Gl_Window". If you need OpenGL in the box, since it is not supplied as its package, so thus you must use the "Fl_Gl_Box".

簡単なGUI toolを作るときには、ながらくFLTKを愛用してきました。 特にOpenGLを簡単に利用できるので、ちょっとした実験には最適です。 しかし、FLTKのパッケージには、OpenGL用にWindowを作るものはあるのですが、Box (Windowの中に配置される子Windowのようなもの)はありませんでした。そのような状況では、Fl_Gl_Boxを使う必要があります。

Unfortunately, it had been lost in the internet space (the original author of the library had used GeoCities and the site had been vanished), but I found it here.

残念ながら、Fl_Gl_Boxの配布サイトは消えてしまったようです。 しかし、幸運にも Fl_Gl_Boxのソースを以下に発見しました。

http://www.gnu-science.org/phpBB3/viewtopic.php?f=7&t=45#p1268

I'm feeling lucky :-)

ラッキーですね。

posted by Png takiuchi on Tue 4 Aug 2009 at 20:20

CMakeList.txt file tends to have piles of options and seems very complicated. For such situations, you can display configurable options by typing this command.

   1  % cmake -L

You will get very clear result. It's a preferable feature of CMake.

posted by Png takiuchi on Mon 3 Aug 2009 at 07:11

At first, you download files of Collada from here

http://sourceforge.net/projects/collada-dom/

It includes collada-dom, but you must build it before using.

To build the package, you must unpack the zip and move to dom/ directory. And

   1  % make
   2  % make install

That's all.

posted by Png takiuchi on Sun 2 Aug 2009 at 18:44