<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:blogger='http://schemas.google.com/blogger/2008' xmlns:georss='http://www.georss.org/georss' xmlns:gd="http://schemas.google.com/g/2005" xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-8741851794030969410</id><updated>2024-08-29T05:48:07.355+09:00</updated><category term="Mac"/><category term="Tips"/><category term="カスタマイズ"/><category term="トラブル"/><category term="CSS3"/><category term="HTML5"/><category term="Linux"/><category term="MySQL"/><category term="Objective-C"/><category term="Windows"/><category term="Xcode"/><category term="iOS"/><category term="iPhone"/><category term="アップデート"/><category term="オープンソース"/><category term="キーボード"/><category term="ショートカット"/><title type='text'>気まぐれノート</title><subtitle type='html'>とあるシステムエンジニアの技術と趣味の雑記帳</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://pettyconan.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8741851794030969410/posts/default?redirect=false'/><link rel='alternate' type='text/html' href='http://pettyconan.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>petty.conan</name><uri>http://www.blogger.com/profile/14601583544008596841</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>11</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-8741851794030969410.post-8987748472023924945</id><published>2013-01-08T01:23:00.000+09:00</published><updated>2013-01-08T01:23:44.430+09:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="iOS"/><category scheme="http://www.blogger.com/atom/ns#" term="iPhone"/><category scheme="http://www.blogger.com/atom/ns#" term="Objective-C"/><category scheme="http://www.blogger.com/atom/ns#" term="Xcode"/><title type='text'>iPhoneアプリの作成時にやっておきたいプロジェクトの設定</title><content type='html'>Xcode の操作方法は 4.5.2 のものです。&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;1. デバッグログ マクロ&lt;/b&gt;&lt;br /&gt;
プロジェクトのプリコンパイルヘッダ(.pch)に次のようなマクロを仕込みます。&lt;br /&gt;
&lt;pre style=&quot;background-color: #d9d2e9; font-size: small;&quot;&gt;#ifdef DEBUG
    #define LOG(...)     NSLog(__VA_ARGS__);
    #define LOG_METHOD   NSLog(@&quot;%s&quot;, __func__);
    #define LOG_POINT(_x) NSLog(@&quot;Point : %.3f,%.3f&quot;, _x.x, _x.y );
    #define LOG_SIZE(_x)  NSLog(@&quot;Size : %.3f,%.3f&quot;, _x.width, _x.height );
    #define LOG_RECT(_x)  NSLog(@&quot;Rect : %.3f,%.3f / %.3f,%.3f)&quot;, _x.origin.x, _x.origin.y, _x.size.width, _x.size.height);
#else
    // Disable Logging
    #define LOG(...) ;
    #define LOG_METHOD ;
    #define LOG_POINT(_x) ;
    #define LOG_SIZE(_x) ;
    #define LOG_RECT(_x) ;
#endif
&lt;/pre&gt;
見たまんまですが、これらのログマクロはデバッグビルド時のみで有効で、リリースビルド時にはログ出力コードは生成されません。リリース時には不要なデバッグ用の冗長なログ出力用です。&lt;br /&gt;
例外情報などのリリースビルド時にもログを出力する場合は、普通に NSLog を使います。&lt;br /&gt;
&lt;br /&gt;
LOG_METHOD は呼び出しをトラッキングしたいメソッドの先頭に記述するマクロで、NSLog にいちいちメソッド名を記述する手間を省きます。&lt;br /&gt;
LOG_POINT,&amp;nbsp;LOG_SIZE,&amp;nbsp;LOG_RECT は CGPoint, CGSize, CGRect を読みやすい書式で出力します。（標準の書式だとデバッグコンソール上で読みづらいので）&lt;br /&gt;
他に LOG_COLOR みたいなのがあっても良いかもしれませんね。&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;2. ARC(Automatic Reference Counting)を使う場合は .m ファイルにおまじないを入れておこう&lt;/b&gt;&lt;br /&gt;
&lt;pre style=&quot;background-color: #d9d2e9; font-size: small;&quot;&gt;#if !__has_feature(objc_arc)
#error This code needs compiler option -fobjc-arc
#endif
&lt;/pre&gt;
&lt;div&gt;
ARC対応のソースはARCを無効にした状態でコンパイルしても普通にコンパイルが通ってしまいますが、当然ながらメモリリークを起こします。&lt;br /&gt;
ARCを前提としたプロジェクトを作成して、そのプロジェクト内だけでソースを使用しているうちは問題にはなりませんが、このソースを別のARC無効なプロジェクトで再利用しようとすると、うっかりメモリリークを起こしかねません。&lt;br /&gt;
このような事故を未然に防ぐために、上記のおまじないを組み込んでおくと安心です。&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;3. プロジェクト内でARCなソースと非ARCなソースを混在させる場合の設定&lt;/b&gt;&lt;br /&gt;
ことの発端はARCを有効にしたプロジェクトで &lt;a href=&quot;http://www.inappsettingskit.com/&quot;&gt;InAppSettingsKit&lt;/a&gt; を使おうと思ったら、このソースがARC非対応であったために大量の &quot;not available in automatic reference counting mode&quot; というエラーが発生してプロジェクトがビルドできなかったという経験です。&lt;br /&gt;
&lt;br /&gt;
ARCの有効／無効は、ソース毎にコンパイル時のオプション &lt;span style=&quot;color: #38761d;&quot;&gt;-fobjc-arc&lt;/span&gt;, &lt;span style=&quot;color: #38761d;&quot;&gt;-fno-objc-arc&lt;/span&gt; で指定します。&lt;/div&gt;
Xcode のプロジェクト設定でソース毎にコンパイルオプションを指定する事ができるため、ここで上記のオプションを個別に指定することでプロジェクト内にARC対応/非対応のソースを混在させることができます。&lt;br /&gt;
&lt;br /&gt;
Xcode のナビゲータでプロジェクトを選択し、プロジェクトのTARGETを選択後に &quot;Build Phases&quot; を選択します。&lt;br /&gt;
&quot;Build Phases&quot; のペインに &quot;Compile Sources&quot; というセクションがあるので、該当するソースの&amp;nbsp;&quot;Compiler Flags&quot; の欄をダブルクリックして上記のコンパイラオプションを指定します。&lt;br /&gt;
(Xcodeのペインが３分割の場合、コンパイラオプションを指定するための &quot;Compiler Flags&quot; のヘッダが右隅に追いやられて &quot;C.&quot; としか表示されていなくて発見しにくいです)&lt;br /&gt;
&lt;br /&gt;
最初の例の場合、ARCが有効なプロジェクトの中にARC非対応のソース(InAppSettingsKit)が混ざっているため、InAppSettingKit のソース全ての Compiler Flags に&amp;nbsp;&quot;-fno-objc-arc&quot; を指定します。&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;4. TODOコメントを警告として出力する&lt;/b&gt;&lt;br /&gt;
プロジェクトの &quot;Build Phase&quot; で設定できます。&lt;br /&gt;
プロジェクト &amp;gt; ターゲット と選択したあとに &quot;Build Phase&quot; ペインを開きます。&lt;br /&gt;
ここの &quot;Run Script&quot; というセクションを設定しますが、デフォルトではこのセクションがないため、右下にある &quot;+ Add Build Phase&quot; をクリックして &quot;Add Run Script&quot; を選択します。&lt;br /&gt;
追加した &quot;Run Script&quot; セクションに以下のシェルスクリプトを記述します。&lt;br /&gt;
&lt;pre style=&quot;background-color: #d9d2e9; font-size: small;&quot;&gt;KEYWORDS=&quot;(TODO|FIXME|DEBUG):|\?\?\?:|\!\!\!:&quot;
find ${SRCROOT} \( -name &quot;*.h&quot; -or -name &quot;*.m&quot; \) -print0 | \
xargs -0 egrep --with-filename --line-number --only-matching &quot;($KEYWORDS).*\$&quot; | \
perl -p -e &quot;s/($KEYWORDS)/ warning: \$1/&quot;
&lt;/pre&gt;
※その他のフィールドはデフォルトのまま&lt;br /&gt;
すると、コンパイル時に TODO コメントを拾って警告として出力してくれます。&lt;br /&gt;
上記のスクリプトは出典のオリジナルに少し手を加え、 DEBUG: という記述も警告として出力するようにしています。&lt;br /&gt;
&lt;br /&gt;
TODO コメントは Xcode のファンクションメニューでも確認できるのですが、コンパイル時に警告として出力しておく事で、常にプロジェクト全体の TODO コメントが把握できるのでわりと便利です。&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;【出典】&lt;/b&gt;&lt;br /&gt;
この情報は下記のブログを参考にしました。&lt;br /&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;http://program.station.ez-net.jp/special/objective-c/llvm/arc/enable-file.asp&quot;&gt;ファイル毎に ARC の有効・無効を設定する&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://d.hatena.ne.jp/h_mori/20110720/1311190752&quot;&gt;Xcode4のTODOタグを警告に出力する&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
これらの情報を公開していただいている Tomohiro Kumagai 氏、h_mori 氏に感謝します。</content><link rel='replies' type='application/atom+xml' href='http://pettyconan.blogspot.com/feeds/8987748472023924945/comments/default' title='コメントの投稿'/><link rel='replies' type='text/html' href='http://pettyconan.blogspot.com/2013/01/iphone.html#comment-form' title='0 件のコメント'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8741851794030969410/posts/default/8987748472023924945'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8741851794030969410/posts/default/8987748472023924945'/><link rel='alternate' type='text/html' href='http://pettyconan.blogspot.com/2013/01/iphone.html' title='iPhoneアプリの作成時にやっておきたいプロジェクトの設定'/><author><name>petty.conan</name><uri>http://www.blogger.com/profile/14601583544008596841</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8741851794030969410.post-519920705337738987</id><published>2012-12-22T04:28:00.002+09:00</published><updated>2012-12-22T04:31:32.500+09:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Linux"/><category scheme="http://www.blogger.com/atom/ns#" term="Tips"/><category scheme="http://www.blogger.com/atom/ns#" term="カスタマイズ"/><title type='text'>Linux(bash)プロンプトの色付けとホスト名の管理</title><content type='html'>&lt;br /&gt;
SSH などで Linux を使っていると開発サーバや本番機など、いろいろなサーバを渡り歩きますが、たくさんウィンドウを開いていたりSSH を渡り歩きすぎると時々自分がどこにいるのか見失ってしまいます。&lt;br /&gt;
&lt;br /&gt;
私の場合、自分が管理する運用環境では自分がどこにいるのかをすぐに識別できるようにするため、特に本番環境にいる時の注意喚起のためにサーバに応じてプロンプトの色を変えるように設定しています。&lt;br /&gt;
&lt;br /&gt;
プロンプトに色をつけるには ~/.profile などで設定するというのはよく見かけますが、私の場合には &lt;b&gt;&quot;ホストの設定として全ユーザに適用する&quot;&lt;/b&gt; 必要があるため、少し違うやり方をします。&lt;br /&gt;
&lt;br /&gt;
/etc/profile.d というディレクトリに prompt.sh (これは任意の名前)という次のスクリプトを作成します。&lt;br /&gt;
&lt;br /&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
# prompt setting&lt;br /&gt;
if [ &quot;$PS1&quot; ]; then&lt;br /&gt;
&amp;nbsp; export PS1=&quot;\[\033[0;33m\][\u@\h(dev01) \W]\[\033[0;37m\]\\$ &quot;&lt;br /&gt;
fi&lt;/blockquote&gt;
&lt;br /&gt;
/etc/profile.d に任意の名前でシェルスクリプトを記述しておくとシェルの起動時に自動的に実行されるため、全てのユーザに適用されます。&lt;br /&gt;
私の場合は基本 bash だけなので prompt.sh だけですが、 csh にも対応するには prompt.csh というファイルも作成しておきます。&lt;br /&gt;
&lt;br /&gt;
ログインするとプロンプトは次のようになります。&lt;br /&gt;
&lt;br /&gt;
&lt;div&gt;
&lt;span style=&quot;color: #bf9000;&quot;&gt;[user@sv001(dev01) ~]&lt;/span&gt;$&amp;nbsp;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
このまま、スーパーユーザにスイッチしても&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #bf9000;&quot;&gt;[root@sv001(dev01) ~]&lt;/span&gt;#&amp;nbsp;&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
となり、色設定が必ず適用されます。&lt;/div&gt;
&lt;div&gt;
私の場合は開発系を&lt;span style=&quot;color: #bf9000;&quot;&gt;黄色&lt;/span&gt;、本番系を&lt;span style=&quot;color: #cc0000;&quot;&gt;赤色&lt;/span&gt;にすることで、リモートのホストに接続している状態であることと特に本番機に接続している状態を注意喚起する事を目的としています。&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
よく忘れるカラーコードは次の通り。&lt;/div&gt;
&lt;div&gt;
昔の8bit機のカラーコードと同じなら覚えやすいのだけどなぁ・・・（笑）&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
\033[0;30m　： Black&lt;/div&gt;
&lt;div&gt;
\033[0;31m　： Red&lt;/div&gt;
&lt;div&gt;
&lt;div&gt;
\033[0;32m　： Green&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;div&gt;
\033[0;33m　： Yellow&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;div&gt;
\033[0;34m　： Blue&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;div&gt;
\033[0;35m　： Magenta&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;div&gt;
\033[0;36m　： Cyan&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;div&gt;
\033[0;37m　： Light Gray&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;div&gt;
\033[0;30m　： Black&lt;/div&gt;
&lt;div&gt;
\033[1;31m　： Dark Gray&lt;/div&gt;
&lt;div&gt;
\033[1;32m　： Light Green&lt;/div&gt;
&lt;div&gt;
\033[1;33m　：&amp;nbsp;Light&amp;nbsp;Yellow&lt;/div&gt;
&lt;div&gt;
\033[1;34m　：&amp;nbsp;Light&amp;nbsp;Blue&lt;/div&gt;
&lt;div&gt;
\033[1;35m　：&amp;nbsp;Light&amp;nbsp;Magenta&lt;/div&gt;
&lt;div&gt;
\033[1;36m　：&amp;nbsp;Light&amp;nbsp;Cyan&lt;/div&gt;
&lt;div&gt;
\033[1;37m　： White&lt;/div&gt;
&lt;div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
カラーコードに40番台を指定すれば背景の指定となります。&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;div&gt;
プロンプトに (dev01) というリテラル文字を設定しているのはサーバの論理名です。&lt;/div&gt;
&lt;div&gt;
サーバの名前の付け方も人それぞれですが、僕の場合はサーバ名には sv001 などの連番を付与し、別名として論理名を付けて管理する方式を好んでいます。&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
以前はホスト名には db01 などの役割に応じた名前を付けていたのですが、運用してみるといくつか不便を感じることがありました。&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
・ハードウェアトラブルのために急遽、別のサーバで代替機を立てた際や、インフラの見直しで複数の役割を持つサーバができてしまった際に名前と役割が乖離してしまった。&lt;/div&gt;
&lt;div&gt;
・役割に応じて命名していると別のシステムと名前がよく重複する。&lt;/div&gt;
&lt;div&gt;
・ハードウェアの移動などで再構築するたびに名前が変わるので、資産管理の棚卸しなどの際にいちいちシリアル番号を追いかけなければならない。&lt;/div&gt;
&lt;div&gt;
・ホスト名を考えるのにわりと悩む&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
これらの教訓から、&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
・ホストの正式名は sv001 などの連番で付与して未来永劫変更しない。&lt;/div&gt;
&lt;div&gt;
・ホストの役割はその時々で変わるものなので別名で対応する。&lt;/div&gt;
&lt;div&gt;
　別名の解決には /etc/hosts や内部DNSと上記のプロンプトの表記で対応する。&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
この方式にすることで、ホスト名に関する悩みはだいぶなくなりました。&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://pettyconan.blogspot.com/feeds/519920705337738987/comments/default' title='コメントの投稿'/><link rel='replies' type='text/html' href='http://pettyconan.blogspot.com/2012/12/linuxbash.html#comment-form' title='0 件のコメント'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8741851794030969410/posts/default/519920705337738987'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8741851794030969410/posts/default/519920705337738987'/><link rel='alternate' type='text/html' href='http://pettyconan.blogspot.com/2012/12/linuxbash.html' title='Linux(bash)プロンプトの色付けとホスト名の管理'/><author><name>petty.conan</name><uri>http://www.blogger.com/profile/14601583544008596841</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8741851794030969410.post-8310515526627694696</id><published>2012-12-09T17:37:00.002+09:00</published><updated>2013-01-08T01:33:43.174+09:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Mac"/><category scheme="http://www.blogger.com/atom/ns#" term="Tips"/><category scheme="http://www.blogger.com/atom/ns#" term="Windows"/><category scheme="http://www.blogger.com/atom/ns#" term="ショートカット"/><title type='text'>離席時などに画面をロックするショートカット for Win And Mac</title><content type='html'>知っていると少しだけ便利なプチ Tips です。&lt;br /&gt;
&lt;br /&gt;
エンジニアに限りませんが仕事でPCを操作しているのであれば、ちょっとした離席時にも常に画面をロックしておくのは習慣にしたいものです。&lt;br /&gt;
でも操作が面倒だとついつい忘れてしまったり、わかっていてもそもそも億劫ですよね。&lt;br /&gt;
Windows も Mac も実はショートカットキー 一発でスクリーンをロックできるのですが、意外と知られていないようなのでプチTipsとして共有します。&lt;br /&gt;
&lt;br /&gt;
&lt;div style=&quot;background-color: white;&quot;&gt;
Windows : Windowsキー + L &amp;nbsp; &amp;nbsp;(Lock の L と覚えませう）&lt;br /&gt;
Mac : Option + Command + Eject&lt;/div&gt;
&lt;br /&gt;
何度か試せば、これならば容易に習慣にできることでしょう。&lt;br /&gt;
&lt;br /&gt;
せっかくのスクリーンロックでも、スクリーンセイバーからの復帰時にパスワードを要求しないように設定していたり、そもそもアカウントにパスワードを設定しないないとかは論外です(笑)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
話は変わりますが、ショートカットキーつながりということで。&lt;br /&gt;
メイン機を Mac に乗り換えて早１年半、いまだにMacのショートカットが覚えきれずに苦慮していますが、Mac の App Store にある CheatSheet というアプリがわりと重宝しているので紹介します。&lt;br /&gt;
どんなアプリかというと、Command キーを押しっぱなしにしているとそのアプリで利用できるショートカットをポップアップで一覧表示してくれるアプリです。&lt;br /&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;a href=&quot;http://cheatsheetapp.com/Landing/&quot;&gt;http://cheatsheetapp.com/Landing/&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
Mac のショートカットの暗記でお悩みの方はぜひお試しあれ。&lt;br /&gt;
&lt;br /&gt;</content><link rel='replies' type='application/atom+xml' href='http://pettyconan.blogspot.com/feeds/8310515526627694696/comments/default' title='コメントの投稿'/><link rel='replies' type='text/html' href='http://pettyconan.blogspot.com/2012/12/for-win-and-mac.html#comment-form' title='0 件のコメント'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8741851794030969410/posts/default/8310515526627694696'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8741851794030969410/posts/default/8310515526627694696'/><link rel='alternate' type='text/html' href='http://pettyconan.blogspot.com/2012/12/for-win-and-mac.html' title='離席時などに画面をロックするショートカット for Win And Mac'/><author><name>petty.conan</name><uri>http://www.blogger.com/profile/14601583544008596841</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8741851794030969410.post-1023738599021212925</id><published>2012-01-17T20:20:00.000+09:00</published><updated>2012-01-17T20:20:07.158+09:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Mac"/><category scheme="http://www.blogger.com/atom/ns#" term="トラブル"/><title type='text'>MacOS X Lion : メール添付されたzipが開けない・・・ Thunderbird が原因だった</title><content type='html'>Stuffit Expander は優秀。パスワード付き zip でも lha でも、ほとんどのアーカイブを解凍してくれて重宝します。Macユーザにとっては MUST HAVE なツールですね。&lt;br /&gt;
&lt;br /&gt;
MacとWindowsのzipファイルの互換性は過去の話かと思いきや、Windowsで作成され、メールに添付されたzipファイルが開けないという問題に遭遇しました。&lt;br /&gt;
Stuffit は「アーカイブが破損している可能性があります」と報告し、コマンドラインのunzipで展開しようとしても「End-of-central-directory signature not found」zipファイルではない、と言われる。&lt;br /&gt;
&lt;br /&gt;
仕事のメールでじっくり調べている時間もないので、とりあえずWin機を起動してそちら側で添付ファイルを解凍していたが、自宅にいないとこれはできないので何かと不便。&lt;br /&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;br /&gt;
最初はzipの互換性の問題かと思い、The Unarchiver や WinZip for Mac などいくつかの解凍ソフトを試すがどれもNG。&lt;br /&gt;
一時は AppStore で有償のアーカイバ買わなきゃダメか？ とまで思った。&lt;br /&gt;
&lt;br /&gt;
ふと思いつき、メールの添付ファイルをWebメーラからダウンロードしてみたらあっさり解凍できた。&lt;br /&gt;
メーラは Thunderbird を使用しているが、Thunderbird には添付ファイルのエンコード名の扱いによって添付ファイルが壊れることがあるらしい。&lt;br /&gt;
&lt;br /&gt;
&lt;h3 class=&quot;title&quot; style=&quot;background-color: white; color: #5d5d5d; font-family: Verdana; font-size: 12px; margin-bottom: 0px; margin-top: 0px; padding-bottom: 15px; padding-left: 0px; padding-right: 0px; padding-top: 20px; text-align: left;&quot;&gt;
出典 :&amp;nbsp;&lt;a class=&quot;title&quot; href=&quot;http://toyoblog-a.seesaa.net/article/128781780.html&quot; style=&quot;border-bottom-style: none; border-color: initial; border-image: initial; border-left-style: none; border-right-style: none; border-top-style: none; border-width: initial; color: #3366cc; margin-bottom: 0px; margin-top: 0px; text-decoration: none;&quot;&gt;[ソフトウェア]Thunderbirdの添付ファイル不具合&lt;/a&gt;&lt;/h3&gt;
&lt;br /&gt;
これは少し古いバージョンの話なのと、今回の添付ファイル名には日本語は使われていないので同じ原因であるかどうかは怪しいところ。&lt;br /&gt;
ただ、メーラの相性によって Thunderbird で添付ファイルが壊れることがあるのだけは事実。&lt;br /&gt;
Thunderbird を使用していて上記のエラーに遭遇したら、一度他のメールクライアントやWebメーラなどで添付ファイルを落としてみましょう。&lt;br /&gt;
&lt;br /&gt;
あ、でも Win機も Thunderbird だけど、こっちはファイル壊れていなかったな。&lt;br /&gt;
プラットフォームか文字セットの設定に依存しているっぽい。&lt;br /&gt;
ん〜、MacとWindowsの障壁はまだまだ無くならないようです。&lt;br /&gt;
&lt;br /&gt;</content><link rel='replies' type='application/atom+xml' href='http://pettyconan.blogspot.com/feeds/1023738599021212925/comments/default' title='コメントの投稿'/><link rel='replies' type='text/html' href='http://pettyconan.blogspot.com/2012/01/macos-x-lion-zip-thunderbird.html#comment-form' title='0 件のコメント'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8741851794030969410/posts/default/1023738599021212925'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8741851794030969410/posts/default/1023738599021212925'/><link rel='alternate' type='text/html' href='http://pettyconan.blogspot.com/2012/01/macos-x-lion-zip-thunderbird.html' title='MacOS X Lion : メール添付されたzipが開けない・・・ Thunderbird が原因だった'/><author><name>petty.conan</name><uri>http://www.blogger.com/profile/14601583544008596841</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8741851794030969410.post-1214537345861293504</id><published>2012-01-05T23:31:00.000+09:00</published><updated>2012-01-05T23:31:08.574+09:00</updated><title type='text'>NGINX で MySQL に保存されている redmine のアカウント情報を元にBASIC認証する</title><content type='html'>まだ実施していないけど、実現するために必要そうな情報をちょいメモ。&lt;br /&gt;
&lt;br /&gt;
＜やりたいこと＞&lt;br /&gt;
nginx でBASIC認証をしたいが、認証情報は redmine のアカウント情報(MySQL)をソースとしたい。&lt;br /&gt;
&lt;br /&gt;
＜背景＞&lt;br /&gt;
redmine を導入したプロジェクト管理サーバに jenkins も導入。&lt;br /&gt;
jenkins の管理画面や ant により生成した javadoc やテストレポートなどの静的なファイルもプロジェクト管理サーバで閲覧できるようにしたい。&lt;br /&gt;
当然、これらのファイルにも認証をかけたいが、アカウント情報はredmineのものを使いたい。&lt;br /&gt;
public にこれらのドキュメントを配置しても良いが、静的なコンテンツのために rails のリソースを使うのはもったいないので、これらは nginx で直接返すようにしたい。&lt;br /&gt;
&lt;br /&gt;
＜Apacheの場合＞&lt;br /&gt;
mod_auth_mysql を以下のように設定すればよいらしい&lt;br /&gt;
&lt;pre&gt;Auth_MySQL                      On
Auth_MySQL_Socket               /var/run/mysqld/mysqld.sock
Auth_MySQL_Host                 localhost
Auth_MySQL_User                 [redmineのデータベースユーザ名]
Auth_MySQL_Password             [redmineのデータベースパスワード]
Auth_MySQL_DB                   [redmineのデータベース名]
Auth_MySQL_Password_Table       users
Auth_MySQL_Username_Field       login
Auth_MySQL_Password_Field       hashed_password
Auth_MySQL_Encryption_Types     SHA1Sum
Auth_MySQL_Empty_Passwords      Off
AuthType Basic
AuthName &quot;Authorization Realm&quot;
Require valid-user
&lt;/pre&gt;
&lt;div&gt;
出典 :&amp;nbsp;&lt;a href=&quot;http://www.dabits.net/archives/87&quot;&gt;Redmineのアカウントを使って、Subversionの認証を行う on debian lenny&lt;/a&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
＜NGINXの場合＞&lt;/div&gt;
&lt;div&gt;
nginx には mod_auth_mysql はない。&lt;/div&gt;
&lt;div&gt;
替わりに &lt;a href=&quot;http://web.iti.upv.es/~sto/nginx/&quot;&gt;mod_auth_pam&lt;/a&gt; と &lt;a href=&quot;http://pam-mysql.sourceforge.net/&quot;&gt;pam_mysql&lt;/a&gt; を使えばいけそう。&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
http://web.iti.upv.es/~sto/nginx/&lt;/div&gt;
&lt;div&gt;
http://pam-mysql.sourceforge.net/&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://pettyconan.blogspot.com/feeds/1214537345861293504/comments/default' title='コメントの投稿'/><link rel='replies' type='text/html' href='http://pettyconan.blogspot.com/2012/01/nginx-mysql-redmine-basic.html#comment-form' title='0 件のコメント'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8741851794030969410/posts/default/1214537345861293504'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8741851794030969410/posts/default/1214537345861293504'/><link rel='alternate' type='text/html' href='http://pettyconan.blogspot.com/2012/01/nginx-mysql-redmine-basic.html' title='NGINX で MySQL に保存されている redmine のアカウント情報を元にBASIC認証する'/><author><name>petty.conan</name><uri>http://www.blogger.com/profile/14601583544008596841</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8741851794030969410.post-6174585595754597480</id><published>2011-11-03T01:15:00.002+09:00</published><updated>2011-11-11T15:54:39.613+09:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="MySQL"/><category scheme="http://www.blogger.com/atom/ns#" term="アップデート"/><category scheme="http://www.blogger.com/atom/ns#" term="トラブル"/><title type='text'>MySQL を 5.5 にアップデートしたら起動しなくなっちまった</title><content type='html'>&lt;div&gt;
&lt;br /&gt;
&lt;div style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;
CentOS 5にインストールした MySQL を 5.0.67 から 5.5.17 にアップデートしたら起動しなくなったので解決方法をメモ。&lt;/div&gt;
&lt;div style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;
（いきなりバージョン飛ばし過ぎというツッコミはおいておいて・・・）&lt;/div&gt;
&lt;div style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;
まずは基本、mysql.log を確認。&lt;/div&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
&lt;div style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;
111102 23:44:11 [Note] Plugin &#39;FEDERATED&#39; is disabled.&lt;/div&gt;
&lt;div style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;
/usr/libexec/mysqld: Table &#39;mysql.plugin&#39; doesn&#39;t exist&lt;/div&gt;
&lt;div style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;
111102 23:44:11 [ERROR] Can&#39;t open the mysql.plugin table. Please run mysql_upgrade to create it.&lt;/div&gt;
&lt;/blockquote&gt;
&lt;div style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;
だそうで。&lt;/div&gt;
&lt;div style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;
とりあえず言われた通りに mysql_upgrade してみるけどサーバに接続できないと怒られる。だからそのサーバが起動しないんだって！&lt;/div&gt;
&lt;div style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;
試行錯誤の結果、 my.cnf の設定が原因であることが判明。&lt;/div&gt;
&lt;div style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;
サーバの文字コード設定が&amp;nbsp;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #990000;&quot;&gt;default-character-set&lt;/span&gt;&amp;nbsp;から&amp;nbsp;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #990000;&quot;&gt;character-set-server&amp;nbsp;&lt;/span&gt;に変更されています。&lt;/div&gt;
&lt;div style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;
実はこの変更は MySQL 5.0 からされていたようですが（知らなかった・・・汗）、MySQL 5.5.3 で非推奨のパラメータが全て廃止された（エラーになるようになった）ために起動しなくなったのでした。&lt;/div&gt;
&lt;div style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;
下記のブログが参考になりました。MySQL 5.5.3 での主な変更点がまとめられています。&lt;/div&gt;
&lt;div style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;
&lt;a href=&quot;http://d.hatena.ne.jp/sakaik/20100414/mysql533#tb&quot;&gt;MySQL 5.5.3-m3, 5.5.4-m3 同時リリース - sakaikの日々雑感～(T)編&lt;/a&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;
「え？ そこ？」 という感じだが、サーバの文字コード指定の記述を修正したら mysqld_safe が起動するようになった。ついでに FADERATED エンジンも使わないので無効にしておく。&lt;/div&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
&lt;div style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;
[mysqld]&lt;/div&gt;
&lt;div style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;
character-set-server=utf8&lt;/div&gt;
&lt;div style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;
skip-federated&lt;/div&gt;
&lt;/blockquote&gt;
&lt;div style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;
その後、mysql_upgrade を実行し、セーフブートから通常の起動に変更して無事にアップデート完了。&lt;/div&gt;
&lt;div style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;
ちなみに、アップデート後に my.cnf のサーバ文字コードの設定の記述を default-character-set に戻して mysqld を起動してみたら、ログには以下のようなエラーが出力された。&lt;/div&gt;
&lt;div style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
&lt;div style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;
111103 &amp;nbsp;0:19:50 [ERROR] /usr/libexec/mysqld: unknown variable &#39;default-character-set=utf8&#39;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;
111103 &amp;nbsp;0:19:50 [ERROR] Aborting&lt;/div&gt;
&lt;/blockquote&gt;
&lt;div&gt;
&lt;div style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;
今度はちゃんと設定がおかしい旨のメッセージが出力されている。&lt;/div&gt;
&lt;/div&gt;
&lt;div style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;
テーブルのアップグレードチェックでエラーとなった場合は、default-character-set に関するエラーメッセージが出力されずに mysqld がシャットダウンしてしまうようなので要注意です。&lt;/div&gt;
&lt;div style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;
&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #666666;&quot;&gt;（2011/11/11：追記）&lt;/span&gt;&lt;br /&gt;
MySQL 5.5.3-m3 で廃止された変数やオプションは&amp;nbsp;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #990000;&quot;&gt;default-character-set&lt;/span&gt;&amp;nbsp;だけではありません。&lt;br /&gt;
その他の廃止された変数やオプションを指定している場合は、これらも対応しなければなりません。&lt;br /&gt;
&lt;br /&gt;
下記のブログで廃止になった変数とオプションがまとめられています。&lt;br /&gt;
&lt;br /&gt;
&lt;a href=&quot;http://d.hatena.ne.jp/sakaik/20100414/mysql533obsol&quot;&gt;[mysql]MySQL 5.5.3-m3 で廃止になった変数やオプションなどを整理しました&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://pettyconan.blogspot.com/feeds/6174585595754597480/comments/default' title='コメントの投稿'/><link rel='replies' type='text/html' href='http://pettyconan.blogspot.com/2011/11/mysql-55_03.html#comment-form' title='0 件のコメント'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8741851794030969410/posts/default/6174585595754597480'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8741851794030969410/posts/default/6174585595754597480'/><link rel='alternate' type='text/html' href='http://pettyconan.blogspot.com/2011/11/mysql-55_03.html' title='MySQL を 5.5 にアップデートしたら起動しなくなっちまった'/><author><name>petty.conan</name><uri>http://www.blogger.com/profile/14601583544008596841</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8741851794030969410.post-1629712290007639300</id><published>2011-11-02T18:15:00.001+09:00</published><updated>2011-11-02T18:16:44.745+09:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Mac"/><category scheme="http://www.blogger.com/atom/ns#" term="カスタマイズ"/><category scheme="http://www.blogger.com/atom/ns#" term="キーボード"/><title type='text'>Mac のキーボード操作に慣れない・・・</title><content type='html'>Mac を使い始めて3ヶ月くらい絶つけれど、いまだにキーボード操作に馴染めない・・・&lt;br /&gt;
Mac のキーボード操作での主な不満点。&lt;br /&gt;
&lt;ul&gt;
&lt;li&gt;コマンドキーが遠い。Ctrl キー系の操作になれているので、やはりこちらの方がよい。&lt;/li&gt;
&lt;li&gt;上記に関連するが、Ctrl + カーソル移動キーで単語移動してくれない。というか、デスクトップが切り替わるので鬱陶しい。&lt;br /&gt;Option + カーソル移動キーで単語移動するけど、Option キーもこれまた遠いし小さい。&lt;/li&gt;
&lt;li&gt;ターミナルでコマンドキーがメタキーになってくれない。&lt;br /&gt;emacs 使いとしては致命的。編集中にコピーリージョンを指定しようとして command + w をタイプすると、ウィンドウが閉じてしまい、全ての編集が水泡に帰す。 orz。&lt;/li&gt;
&lt;li&gt;外部キーボード(ELECOMのTK-FBP014。Apple用のASCII配列 Bluetooth キーボード）のキー配列がこれまた違う。&lt;br /&gt;ASCII配列であるのはOKだけど、補助キーの配置が全く異なってる上に小さい。というか、スペースバー長すぎない？&lt;/li&gt;
&lt;/ul&gt;
などなど。&lt;br /&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
キーボードをカスタマイズしてしまうと他の標準的なマシンを触れなくなってしまうので控えていたのだけれど、注意力が散漫になってしまって生産性が悪いので、あきらめてカスタマイズすることにしよう。&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
少し調べたら &lt;a href=&quot;http://pqrs.org/macosx/keyremap4macbook/index.html.ja&quot;&gt;KeyRemap4 MacBook&lt;/a&gt; というソフトが便利そうなのでこれを試そう。&lt;/div&gt;
&lt;div&gt;
補助キーがボトルネックなので、少なくとも普段の操作でこれらのキーを使わなくても良いようにしないと効率が悪いが、そうなるともはや Mac ではなくなるな・・・笑&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://pettyconan.blogspot.com/feeds/1629712290007639300/comments/default' title='コメントの投稿'/><link rel='replies' type='text/html' href='http://pettyconan.blogspot.com/2011/11/mac.html#comment-form' title='0 件のコメント'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8741851794030969410/posts/default/1629712290007639300'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8741851794030969410/posts/default/1629712290007639300'/><link rel='alternate' type='text/html' href='http://pettyconan.blogspot.com/2011/11/mac.html' title='Mac のキーボード操作に慣れない・・・'/><author><name>petty.conan</name><uri>http://www.blogger.com/profile/14601583544008596841</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8741851794030969410.post-8271599722360186348</id><published>2011-10-29T18:38:00.000+09:00</published><updated>2011-10-30T01:27:36.198+09:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Mac"/><title type='text'>Mac OS X (Lion) のファインダーで隠しファイルを表示する</title><content type='html'>Mac OS X (Lion) のファインダーは、デフォルトではライブラリなどのフォルダが表示されない。&lt;br /&gt;
開発をしているとたまにこれらのフォルダーにアクセスする必要があるので、その方法を調べた。&lt;br /&gt;
やり方は大きく2つ。以下はいずれもターミナルからコマンド入力をして使う。&lt;br /&gt;
&lt;br /&gt;
&lt;h2 style=&quot;font-size: 16px;&quot;&gt;


1. chflags で不過視属性を変更する&lt;/h2&gt;
&lt;div style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;
ファイルやフォルダの不過視属性は chflags によって変更できる。&lt;/div&gt;
&lt;div style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;
(chflags は BSD 4.4以降の標準コマンドらしい)&lt;/div&gt;
&lt;div style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;
ls でファイル属性を確認するためには、-lO(大文字) オプションをつける。&lt;/div&gt;
&lt;div style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
$ ls -lO&lt;br /&gt;
total 24&lt;br /&gt;
drwx------+ &amp;nbsp;6 user &amp;nbsp;staff &amp;nbsp;- &amp;nbsp; &amp;nbsp; &amp;nbsp; 204 10 29 17:27 Desktop&lt;br /&gt;
drwx------+ 14&amp;nbsp;user&amp;nbsp; staff &amp;nbsp;- &amp;nbsp; &amp;nbsp; &amp;nbsp; 476 10 19 20:30 Documents&lt;br /&gt;
drwx------+ 27&amp;nbsp;user&amp;nbsp; staff &amp;nbsp;- &amp;nbsp; &amp;nbsp; &amp;nbsp; 918 10 28 14:15 Downloads&lt;br /&gt;
drwx------@ 56&amp;nbsp;user&amp;nbsp; staff &amp;nbsp;hidden 1904 10 13 16:09 Library&lt;br /&gt;
drwx------+ &amp;nbsp;8 tuser&amp;nbsp;staff &amp;nbsp;- &amp;nbsp; &amp;nbsp; &amp;nbsp; 272 &amp;nbsp;9 13 18:38 Movies&lt;br /&gt;
drwx------+ &amp;nbsp;8&amp;nbsp;user&amp;nbsp; staff &amp;nbsp;- &amp;nbsp; &amp;nbsp; &amp;nbsp; 272 &amp;nbsp;9 &amp;nbsp;2 02:59 Music&lt;br /&gt;
drwx------+ 15&amp;nbsp;user&amp;nbsp; staff &amp;nbsp;- &amp;nbsp; &amp;nbsp; &amp;nbsp; 510 10 21 15:42 Pictures&lt;br /&gt;
drwxr-xr-x+ &amp;nbsp;5&amp;nbsp;user&amp;nbsp; staff &amp;nbsp;- &amp;nbsp; &amp;nbsp; &amp;nbsp; 170 &amp;nbsp;8 27 00:43 Public&lt;br /&gt;
drwxr-xr-x &amp;nbsp; 7&amp;nbsp;user&amp;nbsp; staff &amp;nbsp;- &amp;nbsp; &amp;nbsp; &amp;nbsp; 238 10 13 14:31 www&lt;/blockquote&gt;
&lt;div style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;
&lt;/div&gt;
&lt;div style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;
Library フォルダが hidden となっているのがわかる。&lt;/div&gt;
&lt;div style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;
不過視属性を解除するには、以下のようにする。&lt;/div&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
$ chflags nohidden Library&lt;/blockquote&gt;
&lt;br /&gt;
&lt;div style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;
ファインダーで確認してみると、無事「ライブラリ」フォルダが表示される。&lt;/div&gt;
&lt;div style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;
必要なフォルダのみ表示する事ができるので、chflags を使う方がオススメ。&lt;/div&gt;
&lt;div style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;
また、自分で作成したファイルやフォルダを不過視にすることもできる。&lt;/div&gt;
&lt;div style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;
&lt;br /&gt;
ちょっと気になったので、ついでに tar や zip のアーカイブで nohidden 属性が維持されるのか試してみた。&lt;br /&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
tar : nohidden 属性は展開後も維持されていた。&lt;br /&gt;zip : nohidden 属性は維持されず、すべて可視ファイルとなった。&lt;/blockquote&gt;
tar では chflags の属性も維持されているがこれはBSD固有の機能なので、他のプラットフォームで展開した場合に属性が維持される保証はない。&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;h2 style=&quot;font-size: 100%;&quot;&gt;



2. defaults で Finder で全てのファイルを表示するように設定する&lt;/h2&gt;
Mac では、Windows のレジストリに相当するものとして defaults がある。&lt;br /&gt;
ターミナルから defaults コマンドを使用して、ファインダーの設定で全てのファイルを表示するように設定する。&lt;br /&gt;
Macで隠しファイルを表示する方法についてググると、ほとんどこの方法が説明されている。&lt;br /&gt;
&lt;br /&gt;
&lt;table border=&quot;1&quot;&gt;
  &lt;tbody&gt;
&lt;tr&gt;&lt;th&gt;domain&lt;/th&gt;&lt;td&gt;com.apple.finder&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;th&gt;key&lt;/th&gt;&lt;td&gt;AppleShowAllFiles&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;th&gt;value&lt;/th&gt;&lt;td&gt;TRUE : 全てのファイルを表示&lt;br /&gt;
FALSE : 隠しファイルは表示しない&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;br /&gt;
全てのファイルを表示するように設定する例&lt;br /&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
$ defaults write com.apple.finder AppleShowAllFiles TRUE&lt;br /&gt;
$ killall Finder&lt;/blockquote&gt;
設定の変更後に、設定を適用するために killall でファインダーを再起動する。&lt;br /&gt;
&lt;br /&gt;
ただしこの方法では、&lt;br /&gt;
&lt;ul&gt;
&lt;li&gt;&amp;nbsp;隠しておいても良いフォルダも全て表示されてしまい、ファインダーのリストが長くなってしまう。&lt;/li&gt;
&lt;li&gt;デスクトップ上のシステムファイルもアイコンで表示されてしまい、デスクトップが散らかってしまう。&lt;/li&gt;
&lt;/ul&gt;
&lt;br /&gt;
&lt;div style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;
といった欠点があるので、chflags を使う方がオススメ。&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;h2 style=&quot;font-size: 100%;&quot;&gt;


補足：ファイル選択ダイアログでの不過視ファイルの表示切り換え&lt;/h2&gt;
&lt;div&gt;
ファイル選択ダイアログでは、ショートカットキーの「&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #990000;&quot;&gt;Command + Shift + . (ピリオド)&lt;/span&gt;」 で不過視ファイルの表示のON/OFFを切り替える事ができる。&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://pettyconan.blogspot.com/feeds/8271599722360186348/comments/default' title='コメントの投稿'/><link rel='replies' type='text/html' href='http://pettyconan.blogspot.com/2011/10/mac-os-x-lion.html#comment-form' title='0 件のコメント'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8741851794030969410/posts/default/8271599722360186348'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8741851794030969410/posts/default/8271599722360186348'/><link rel='alternate' type='text/html' href='http://pettyconan.blogspot.com/2011/10/mac-os-x-lion.html' title='Mac OS X (Lion) のファインダーで隠しファイルを表示する'/><author><name>petty.conan</name><uri>http://www.blogger.com/profile/14601583544008596841</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8741851794030969410.post-230965144228129136</id><published>2011-09-08T15:33:00.000+09:00</published><updated>2011-10-26T20:17:11.213+09:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="CSS3"/><category scheme="http://www.blogger.com/atom/ns#" term="HTML5"/><title type='text'>オンラインでHTML5を試せるサイトとHTML5実力テスト</title><content type='html'>&lt;div&gt;
オンラインでHTML５, CSS, JavaScript をコーディング、テストできる。&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;a href=&quot;http://jsdo.it/&quot;&gt;jsdo.it - Share JavaScript, HTML5 and CSS&lt;/a&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
これはなかなか面白い。&lt;/div&gt;
&lt;div&gt;
作成したコードは公開・共有されるのでたくさんの例を参照できるほか、他人の作成したコードをフォークしてアレンジすることもできる。&lt;/div&gt;
&lt;div&gt;
HTML5関連の学習にはうってつけのサイト。&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
ちなみに、同サイトでは「HTML5実力テスト」も実施している。&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;a href=&quot;http://jsdo.it/event/html5cat/2011/summer/&quot;&gt;HTML5実力テスト&lt;/a&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
さっそく受けてみたところ、HTML/CSSコースで51点(C)、JavaScriptコースで39点(D)という結果に終わった。&lt;/div&gt;
&lt;div&gt;
う〜む、実践経験がないとはいえ、正直もう少し欲しかった。実践を積まねば・・・&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://pettyconan.blogspot.com/feeds/230965144228129136/comments/default' title='コメントの投稿'/><link rel='replies' type='text/html' href='http://pettyconan.blogspot.com/2011/09/html5html5.html#comment-form' title='0 件のコメント'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8741851794030969410/posts/default/230965144228129136'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8741851794030969410/posts/default/230965144228129136'/><link rel='alternate' type='text/html' href='http://pettyconan.blogspot.com/2011/09/html5html5.html' title='オンラインでHTML5を試せるサイトとHTML5実力テスト'/><author><name>petty.conan</name><uri>http://www.blogger.com/profile/14601583544008596841</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8741851794030969410.post-7631398097251898733</id><published>2011-05-27T02:22:00.003+09:00</published><updated>2011-10-30T02:39:26.993+09:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="オープンソース"/><title type='text'>Eric S.Raymond 「伽藍とバザール」 19の指摘（訓示）</title><content type='html'>&lt;div&gt;
&lt;iframe frameborder=&quot;0&quot; marginheight=&quot;0&quot; marginwidth=&quot;0&quot; scrolling=&quot;no&quot; src=&quot;http://rcm-jp.amazon.co.jp/e/cm?t=pettyconan-22&amp;amp;o=9&amp;amp;p=8&amp;amp;l=as1&amp;amp;asins=4274064506&amp;amp;ref=tf_til&amp;amp;fc1=000000&amp;amp;IS2=1&amp;amp;lt1=_blank&amp;amp;m=amazon&amp;amp;lc1=0000FF&amp;amp;bc1=000000&amp;amp;bg1=FFFFFF&amp;amp;f=ifr&quot; style=&quot;float: right; height: 240px; width: 120px; margin-left:20px;&quot;&gt;&lt;/iframe&gt;
&lt;div&gt;「&lt;a href=&quot;http://www.amazon.co.jp/gp/product/4274064506/ref=as_li_tf_tl?ie=UTF8&amp;amp;tag=pettyconan-22&amp;amp;linkCode=as2&amp;amp;camp=247&amp;amp;creative=1211&amp;amp;creativeASIN=4274064506&quot;&gt;オープンソースプロジェクトの管理と運営&lt;/a&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; height=&quot;1&quot; src=&quot;http://www.assoc-amazon.jp/e/ir?t=pettyconan-22&amp;amp;l=as2&amp;amp;o=9&amp;amp;a=4274064506&quot; style=&quot;border: none !important; margin: 0px !important;&quot; width=&quot;1&quot; /&gt;」という本を読んでいたときに、 OSF(Open Source Initiative)の生みの親である Eric S.Raymond が書いたオープンソースのソフトウェア開発に関する論文 「&lt;a href=&quot;http://ja.wikipedia.org/wiki/%E4%BC%BD%E8%97%8D%E3%81%A8%E3%83%90%E3%82%B6%E3%83%BC%E3%83%AB&quot;&gt;伽藍とバザール&lt;/a&gt;&amp;nbsp;(The Cathedral and the Bazaar)」[1999年 O&#39;Reilly &amp;amp; Associates 出版] &amp;nbsp;（&lt;a href=&quot;http://firstmonday.org/htbin/cgiwrap/bin/ojs/index.php/fm/article/view/1472/1387&quot;&gt;原文&lt;/a&gt;）での指摘19点がまとめられていた。&lt;br /&gt;
どれもとても共感できる内容なのでメモ。&lt;/div&gt;&lt;/div&gt;
&lt;ol style=&quot;clear: both;&quot;&gt;
&lt;li&gt;すべての優れたソフトウェアは、開発者の必要性から始まる&lt;/li&gt;
&lt;li&gt;優秀なプログラマは何を書けばよいのかを知り、偉大なプログラマは何を書き直せば（再利用すれば）よいのかを知っている&lt;/li&gt;
&lt;li&gt;「捨てるつもりで書きなさい。どうせ捨てることになるのだから」 (Fred Brooks 「The Mythical Man-Month （人月の神話）」 第11章&lt;/li&gt;
&lt;li&gt;態度がよければ、面白い問題が寄ってくる&lt;/li&gt;
&lt;li&gt;あるプログラムに興味を失ったら、それを有能な後継者に託すことが最後の義務である&lt;/li&gt;
&lt;li&gt;ユーザを共同開発者として遇することが、コードのすみやかな改良と効果的なデバッグのための早道である&lt;/li&gt;
&lt;li&gt;早期に、かつ頻繁にリリースし、顧客の意見に耳を傾けよ&lt;/li&gt;
&lt;li&gt;十分な数のベータテスタと共同開発者がいれば、ほとんどの問題は、すぐに原因が明らかになり、修正方法が自明のことになる&lt;/li&gt;
&lt;li&gt;優れたデータ構造と凡庸（ぼんよう）なコードは、その逆の組み合わせよりずっとうまくいく&lt;/li&gt;
&lt;li&gt;ベータテスタを最も貴重な資源として遇すれば、最も貴重な資源になって応えてもらえる&lt;/li&gt;
&lt;li&gt;優れたアイデアが浮かばないときは、ユーザの優れたアイデアをもらうことが次善の策である。ときには、後者のほうが優れていることもある&lt;/li&gt;
&lt;li&gt;最も斬新で衝撃的なソリューションは、問題のとらえ方が間違っていることに気づいたときに生まれることが少なくない&lt;/li&gt;
&lt;li&gt;（設計における）完璧さとは、もう追加するものがない状態ではなく、もう取り去るものがない状態である&lt;/li&gt;
&lt;li&gt;どんなツールも期待された場面で力を発揮するが、真に偉大なツールは予想もされなかった場面で力を発揮する&lt;/li&gt;
&lt;li&gt;いかなる種類のゲートウェイソフトウェアを書くときも、できるだけデータストリームを乱さないように注意せよ。受信者に強制されない限り、絶対に情報を捨ててはならない&lt;/li&gt;
&lt;li&gt;言語が&lt;a href=&quot;http://ja.wikipedia.org/wiki/%E3%83%81%E3%83%A5%E3%83%BC%E3%83%AA%E3%83%B3%E3%82%B0%E5%AE%8C%E5%85%A8&quot;&gt;チューリング的完璧&lt;/a&gt;にほど遠いときは、&lt;a href=&quot;http://ja.wikipedia.org/wiki/%E7%B3%96%E8%A1%A3%E6%A7%8B%E6%96%87&quot;&gt;構文的砂糖（糖衣構文、シンタックスシュガー）&lt;/a&gt;をまぶすと救われることがある&lt;/li&gt;
&lt;li&gt;セキュリティシステムの堅固さは、守るべき秘密の堅固さを上回らない。擬似秘密に用心せよ。&lt;/li&gt;
&lt;li&gt;面白い問題を解決するには、面白いと思える問題を探すことから始めよ&lt;/li&gt;
&lt;li&gt;少なくともインターネット程度には優れた媒体があり、強制によらずに指導することを知っている開発調整者がいるなら、頭数は少ないより多いほうがよい&lt;/li&gt;
&lt;/ol&gt;
No.13, 14 あたりはとくに納得。でも実践はできていない・・・&lt;br /&gt;
本はまだ読みかけなので、感想などはまた後日。</content><link rel='replies' type='application/atom+xml' href='http://pettyconan.blogspot.com/feeds/7631398097251898733/comments/default' title='コメントの投稿'/><link rel='replies' type='text/html' href='http://pettyconan.blogspot.com/2011/05/eric-sraymond.html#comment-form' title='0 件のコメント'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8741851794030969410/posts/default/7631398097251898733'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8741851794030969410/posts/default/7631398097251898733'/><link rel='alternate' type='text/html' href='http://pettyconan.blogspot.com/2011/05/eric-sraymond.html' title='Eric S.Raymond 「伽藍とバザール」 19の指摘（訓示）'/><author><name>petty.conan</name><uri>http://www.blogger.com/profile/14601583544008596841</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8741851794030969410.post-7170838109126356396</id><published>2011-05-23T03:41:00.003+09:00</published><updated>2011-05-23T05:16:48.271+09:00</updated><title type='text'>ブログはじめました</title><content type='html'>エンジニアという職業柄、ほぼ毎日のようにいろいろな問題にハマってる。そんな時、先人のブログにはいつも大変お世話になっている。&lt;br /&gt;
少なからず自分も問題解決はしているので、まずは自分のための健忘録として、そしていつも自分がお世話になっているように、自分の情報が誰かの役に立つことでもあれば、とブログをはじめてみることにした。&lt;br /&gt;
技術系の内容を中心に、思いのままにその他の趣味やいろいろなつぶやきなども投稿してみよう。&lt;br /&gt;
&lt;div style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;とはいえ、もともと読むのも書くのもとっても遅く、かなりの筆不精な性格。投稿頻度がものすごく低くなることは目に見えているのだが、どうなることやら・・・&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://pettyconan.blogspot.com/feeds/7170838109126356396/comments/default' title='コメントの投稿'/><link rel='replies' type='text/html' href='http://pettyconan.blogspot.com/2011/05/blog-post.html#comment-form' title='0 件のコメント'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8741851794030969410/posts/default/7170838109126356396'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8741851794030969410/posts/default/7170838109126356396'/><link rel='alternate' type='text/html' href='http://pettyconan.blogspot.com/2011/05/blog-post.html' title='ブログはじめました'/><author><name>petty.conan</name><uri>http://www.blogger.com/profile/14601583544008596841</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry></feed>