Mac Archive
Where’s 1password, Safari4?
Are you excited to get a new iPhone 3GS? I dunno.. But I got excited because Safari 4 is already pushed out to the world..! Not sure it’s good yet, but it has HTML5 thing, it has CSS-animation thing, lots of features of futures.
But well, if you wanna use Safari, you need a 1password! The following procedure still works with Safari 4. Only difference is that since Safari 4 comes as build 5530.17, you need to set MaxBundleVersion as 5531 or something.
CrunchGear: Want to enable 1password in the Safari 4 Beta? Here’s how.
So far it works well with me too!
P.S.
I just tweeted that 1password doesn’t work on Safari 4, then I got a message from 1password..!
@beatak Grab my latest beta for Safari 4 compatibility: Preferences > Updates > enable betas > Check Now.
I’ll try that too. Pretty cool!
- Comments: 0
- Trackbacks: 0
jsgrep (Mac OS X only!)
After Mac OS X 10.4, Mac has Spotlight, which is automatic metadata indexing for your data. By using its metadata, you can do grep, but only for JavaScript files. The command called mdfind (Meta Data FIND) does the job for you. I wrote a shell script, not to remember all the tedious options.
#!/bin/sh /usr/bin/mdfind "kMDItemContentTypeTree == 'public.source-code' && kMDItemFSName == '*.js' && kMDItemTextContent == '$1'"
It’s just verbose, but easy to understand, right? So, what if you want to do the same thing for… Ruby? Just find a ruby script you’re using, or make “test.rb” on your home directory. do “mdls test.rb”, which will probably give you something like follows:
% mdls test.rb
kMDItemContentCreationDate = 2009-04-XX XX:XX:XX -XXXX
kMDItemContentModificationDate = 2009-04-XX XX:XX:XX -XXXX
kMDItemContentType = "public.ruby-script"
kMDItemContentTypeTree = (
"public.ruby-script",
"public.shell-script",
"public.script",
"public.source-code",
"public.plain-text",
"public.text",
"public.data",
"public.item",
"public.content"
)
kMDItemDisplayName = "test.rb"
kMDItemFSContentChangeDate = 2009-04-XX XX:XX:XX -XXXX
kMDItemFSCreationDate = 2009-04-XX XX:XX:XX -XXXX
kMDItemFSCreatorCode = ""
kMDItemFSFinderFlags = 0
kMDItemFSHasCustomIcon = 0
kMDItemFSInvisible = 0
kMDItemFSIsExtensionHidden = 0
kMDItemFSIsStationery = 0
kMDItemFSLabel = 0
kMDItemFSName = "test.rb"
kMDItemFSNodeCount = 0
kMDItemFSOwnerGroupID = 20
kMDItemFSOwnerUserID = 501
kMDItemFSSize = 13
kMDItemFSTypeCode = ""
kMDItemKind = "Ruby Source File"
kMDItemLastUsedDate = 2009-04-XX XX:XX:XX -XXXX
kMDItemUsedDates = (
2009-04-XX XX:XX:XX -XXXX
)
So it should be like…
mdfind "kMDItemContentTypeTree == 'public.ruby-script' && kMDItemFSName == '*.rb' && kMDItemTextContent == 'SEARCH_QUERY'"
mdfind gives you many advantages of metadata search. You should definitely give a shot.
- Comments: 0
- Trackbacks: 0
システム起動時に xampp のサービスを開始させる
- 2009-01-13 (Tue)
- Mac
以前は、開発者たるもの全てのソフトはソースから作るべし!なんて思っていましたが、さすがに何年もやってると、継続してメンテされるソフトウェアパッケージのありがたみもよくわかるようになってきました。
しばらく前から xampp をローカル開発用によく使っています。最近アップデートされていないのが少し心配ですが、インストールは簡単だし、よく出来ていると思います。ただ実際に使ってみると少し手を加えた方が使いやすいので、自分が銜える変更などを備忘録としてまとめておきます。
今回は起動時に xampp パッケージのソフトをシステム起動時に全部稼働させる、ということを扱います。
ダブルクリックできるようなアプリケーションは、Classic OS でやっていたのと、まぁ何となく似ているように、GUI (システム環境設定) から設定できますね?
ここでは、そうではなくて、いわゆるコマンドラインから立ち上げるアプリケーションを扱います。なおこの方法を使えばは他のサービス系のソフトウェアでも同じように応用できます。
Mac OS X では、10.4 (Tiger) から launchd というサービス管理機構が組み込まれ、10.5 (Leopard) では従来型の rc を廃止しました。
launchd は、起動スクリプトと、設定ファイル (.xml) で制御します。英語が出来る方は developer.apple.com: System Startup Programming Topics: Creating a Startup Item をどうぞ。僕のこのエントリは基本的に Creating a Startup Item 以上の情報はありませんので。
/Library/StartupItemsに起動項目となる directory を作成
起動項目に任意の名前を付けます。今回は/Library/StartupItems/XamppBootという directory を作りました。- (1) の中に起動スクリプトを書く
親ディレクトリと同じ名前のシェルスクリプト (/Library/StartupItems/XamppBoot/XamppBoot) です。もう写経で。start|stop|restart の各項目は、xampp の起動スクリプトへのパス(と引数)が含まれています。#! /bin/sh
. /etc/rc.common
StartService() { /Applications/xampp/xamppfiles/mampp start }
StopService() { /Applications/xampp/xamppfiles/mampp stop }
RestartService() { /Applications/xampp/xamppfiles/mampp restart }
RunService "$1" - (1) の中に設定ファイルを書く
Mac OS X ではおなじみ .plist 形式の設定ファイル (/Library/StartupItems/XamppBoot/StartupParameters.plist) 。description と message はあんまり大事じゃないと思う。Provides で指定される文字列が、システム全体でユニーク(一意)な値でないと行けないはず。requires などは先に上げた資料を参考のこと。<?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>Description</key> <string>xampp startup items</string> <key>Messages</key> <dict> <key>restart</key> <string>restarting xampp service</string> <key>start</key> <string>Starting xampp service</string> <key>stop</key> <string>Stopping xampp service</string> </dict> <key>OrderPreference</key> <string>Late</string> <key>Provides</key> <array> <string>XamppDeamon</string> </array> <key>Requires</key> <array> <string>Network</string> </array> <key>Uses</key> <array> <string>Network</string> </array> </dict> </plist> - permission を確認する
全てディレクトリ/ファイルは root:wheel の所有で 755 パーミッションで。
全て設定がうまく行っていたら、コマンドラインの起動項目管理アプリである SystemStarter を使って起動、停止、再起動が
sudo /sbin/SystemStarter start XamppDeamon sudo /sbin/SystemStarter restart XamppDeamon sudo /sbin/SystemStarter stop XamppDeamon
という風にできるようになります。お試しあれ。
- Comments: 0
- Trackbacks: 0
configure your Sandbox with Scheme
- 2008-11-20 (Thu)
- Mac
Mac OS X – from the server room to your desktop
[EN] / JA
BSD’s Jordan talks about inside Mac OS X. People just talk about the (future) release date of Snow Leopard, but I think more interesting thing is that… On page 29, as Sandbox Profiling language, they use Scheme!
EN / [JA]
FreeBSD の著名な開発者 Jordan Hubbard が Mac OS X の内部についてプレゼンテーションをし、その中で次期リリースについてふれらているのが話題になっていますが、僕はそれよりも、29ページ目にある、Sandbox Profiling 言語として使用されている Scheme に注目したいですね。
- Comments: 0
- Trackbacks: 0
- Search
- Feeds
- Meta
- Links
- Ads!
-