11/20オープンアワー@片平堂告知
11/20にオープンアワーを片平堂オフィスで行います。
久しぶりに開催します。事務所の入っているマンションが、現在震災からの復旧工事でうるさい可能性があります。予めご了承ください。
詳細は以下をご覧ください。お気軽にどうぞ。
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- -
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
オープンアワー@片平堂
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- -
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
・日時
11/20(火) 7:30〜12:00
出入りは自由にどうぞ、参加、退出の時間もご自由に
・場所
片平堂 http://katahirado.jp/about.html
http://maps.google.co.jp/maps?q=%E4%BB%99%E5%8F%B0%E5%B8%82%E9%9D%92%E8%91%89%E5%8C%BA%E6%9C%AC%E7%94%BA1-12-2&hl=ja&ie=UTF8&ll=38.266118,140.879188&spn=0.009822,0.019076&hnear=%E5%AE%AE%E5%9F%8E%E7%9C%8C%E4%BB%99%E5%8F%B0%E5%B8%82%E9%9D%92%E8%91%89%E5%8C%BA%E6%9C%AC%E7%94%BA%EF%BC%91%E4%B8%81%E7%9B%AE%EF%BC%91%EF%BC%92%E2%88%92%EF%BC%92&gl=jp&t=m&z=16&brcurrent=3,0x5f8a2826f0704f57:0x1a70d9b7c411e4c2,0,0x5f8a2826f7863c8b:0xb250301829f18379&layer=c&cbll=38.266095,140.879316&panoid=J1zVp0HV6Q8VdhAdZGdgiA&cbp=12,0,,0,0
入り口は、歯科がある2階にあがる階段と利休が入っているビルの間です。
奥にエレベーターがあります。
・費用
100円/学生の方無料(主に飲み物代、学生の方は学生と分かるものをお持ちください。片平と面識のある方は不要です)
・内容
読書、プログラミングなど各自やりたいことを行う活動です。
・参加方法
ふらっときていただいて構いません。連絡不要です。
連絡しないと気が済まないという方は、メールなりTwitterなりFacebookなりで連絡ください。
・必要な物
ノートPC、書籍など各自必要だと思うものをご持参ください。
・電源
使用可能です。
・その他
備え付けの飲み物、食べ物は好きなだけどうぞ。
おいてある書籍も自由にお使いください。
http://f.hatena.ne.jp/yuichi_katahira/20110710145316
http://f.hatena.ne.jp/yuichi_katahira/20110710145314
備え付けのハンガーもご自由にどうぞ。
http://f.hatena.ne.jp/yuichi_katahira/20120508065750
飲食持ち込みもOKです。朝食なう、おやつなうも問題ありません。
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- -
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
宜しくお願いします:-)
103
ファイルのアイコンを取得する
一つ前のエントリーでは端折っていたが、ファイルのアイコンを取得するのが目的で、pathをあれこれやってあれってなったのであんなエントリーを残した。
せっかくなのでアイコン取得もメモ。
pathをStringでアイコン取得する場合。
//_fullPath はこんなのが来てる。 @"file://localhost/directory/index.html"; NSString *filePath = [[_fullPath stringByReplacingOccurrencesOfString:@"file:/localhost" withString:@""] stringByReplacingPercentEscapesUsingEncoding:NSUTF8StringEncoding]; return [[NSWorkspace sharedWorkspace] iconForFile:filePath];
とかやる。前のエントリーのは、このケースでいうとfile://localhostを置換しようとしているのに、実際にはここに渡って来る前の文字列生成処理で、file:/localhostが渡ってきてた&decodeも抜けてたという話。
NSURLでアイコンを取得
//_fullPath はこんなのが来てる。 @"file://localhost/directory/index.html"; NSURL *fileUrl = [NSURL URLWithString:_fullPath]; NSImage *image=nil; [fileUrl getResourceValue:&image forKey:NSURLEffectiveIconKey error:NULL]; return image;
file:/localhost状態の文字列をNSURLにして、アイコン取得できなくて、StringでもNSURLでもアイコンが取得出来ないなあと調べたら、file:/localhostになっちゃってるじゃないかというのが、前回のエントリの真相でした。
file://localhost/...を使っているのは、アプリがWebViewメインのものなので、このほうが都合がいいため。
file://localhost/directory/といったURL文字列にstringByAppendingPathComponent:を使うと・・・
やっちゃ駄目って書いてあるからやるほうが悪いんですが・・
stringByAppendingPathComponent:のリファレンスには下記のように書いてあります。
Note that this method only works with file paths (not, for example, string representations of URLs).
file pathsでだけ動くと書いてありますが、表題のようにfile://localhost/....となっている文字列で実行してみると・・・
NSString *baseURLString = @"file://localhost/directory/"; NSString *fullPath = [baseURLString stringByAppendingPathComponent:@"index.html"]; NSLog(@"%@",fullPath); // file:/localhost/directory/index.html
file:/localhost/... というように、file:の後の//が/に削られてしまいます。
stringByAppendingPathComponent:は使用せず、stringByAppendingString:を使うとか、
NSString *baseURLString = @"file://localhost/directory/"; NSString *fullPath = [baseURLString stringByAppendingString:@"index.html"]; NSLog(@"%@",fullPath); // file://localhost/directory/index.html
ただ、stringByAppendingString:を使った場合だと、当然ながらpathを考慮されているわけではないです。
例えばpathComponentsを格納した配列から取り出して、個別に連結するといった場合には"/"を自前処理する必要があります。
文字列に%20であるとかが含まれれば、stringByReplacingPercentEscapesUsingEncoding:も必要です。
NSURLのインスタンスにして処理したほうがいいでしょう。
NSString *baseURLString = @"file://localhost/directory/"; NSURL *baseURL = [NSURL URLWithString:baseURLString]; NSString *fullPath = [[baseURL URLByAppendingPathComponent:@"index.html"] absoluteString]; NSLog(@"%@",fullPath); // file://localhost/directory/index.html
WebViewでsetFrameをアニメーションさせようとしたら記述量が多かった
NSAnimatablePropertyContainer プロトコルのanimatorを使えば下記のような感じに書ける↓
https://developer.apple.com/library/mac/#samplecode/BasicCocoaAnimations/Listings/MainWindowController_m.html
しかしWebViewでanimatorメソッドを使ってみたら、エラーでproxyオブジェクトがselectorを呼べなかった。
ので、下記サイトのようにNSViewAnimationを明示的に生成して処理した。
http://xcatsan.blogspot.jp/2008/12/window_28.html
animatorメソッド使用で、setFrame:display:とか呼ぶ場合は、暗黙的に処理してくれるので、変更前のNSRectとかいらないが、NSViewAnimationでsetFrameをアニメーションさせる場合は、変更前のNSRect,変更後のNSRectをNSValueに変換したやつを用意して,NSViewAnimationStartFrameKey,NSViewAnimationEndFrameKeyをKeyにもつNSDictionaryを生成する必要がある。
記述量がいきなり増えますね。
第27回Rails勉強会@東北
https://www.facebook.com/events/295738007193281/
参加してきました。
参加者5名。
今回もRailsCastsを手を動かして皆でやっていった感じです。
やったのは、Deviseなどの認証系ライブラリを使わず認証をスクラッチで作るやつです。
認証↓
http://railscasts.com/episodes/250-authentication-from-scratch-revised
認証に権限をつける↓
http://railscasts.com/episodes/385-authorization-from-scratch-part-1
参加の皆様お疲れ様でした。
jQuery の複数バージョンを同時使用する
http://stacktrace.jp/jquery/with_other_lib.html#other_version
noConflictの引数にtrue渡せばいいと。
<html> <head> <script type="text/javascript" src="jquery-1.2.6.js"></script> <script type="text/javascript" src="jquery-1.4.2.js"></script> <script type="text/javascript"> // $ 関数および jQuery関数の上書きを元に戻します。 var $j = jQuery.noConflict(true); // $ は jQuery ver1.2.6を参照します。 alert($.fn.jquery); // => 1.2.6 // jQuery は jQuery ver1.2.6を参照します。 alert(jQuery.fn.jquery); // => 1.2.6 // $j は jQuery ver1.4.2を参照します。 alert($j.fn.jquery); // => 1.4.2 </script> </head> <body></body> </html>
noConflictって他のライブラリとの併用だけでなく、jQueryの複数バージョンもOKだったんですね。
1.8.2で実装を確認してみました。
//............................................ // Map over jQuery in case of overwrite _jQuery = window.jQuery, // Map over the $ in case of overwrite _$ = window.$, //...................................... jQuery.extend({ noConflict: function( deep ) { if ( window.$ === jQuery ) { window.$ = _$; } if ( deep && window.jQuery === jQuery ) { window.jQuery = _jQuery; } return jQuery; }, //......................... // Expose jQuery to the global object window.jQuery = window.$ = jQuery; //........................
true渡すと window.$だけじゃなく、window.jQueryも _jQueryに保持されている古いjQueryオブジェクトを参照するようにしてますね。