Singleton Methodを削除する方法 についてですが、 Objectクラスに用意されているとありがたいですね。

object_ext.rb

   1  class Object
   2    def remove_singleton_method(*args)
   3      (class << self; self end).class_eval do
   4        args.each{|i| send :remove_method, i}
   5      end
   6    end
   7  end

こんな感じ。

posted by Png genki on Mon 23 Feb 2009 at 22:02

方法を探していたのですが、意外と苦戦したのでメモ。

   1  object = new Object
   2  def object.foo; end
   3  object.singleton_methods #=> [:foo]
   4  (class << object; self end).class_eval{send :remove_method, :foo}
   5  object.singleton_methods #=> []

これで行けるようです。instance_eval{undef foo}でも削除はできますが、その場合親クラスのメソッドにもアクセス出来なくなってしまうので、 singleton methodだけを削除する場合には、 メタクラスのインスタンスメソッドをremove_methodするのが良いようです。

posted by Png genki on Mon 23 Feb 2009 at 21:53

カメラ系やメモ系のアプリなんかはユニーク/一意な名前を考えるのに苦労します。で、*.appファイル名と、iPhone上で表示される表示名を変えたいと思ったのでメモメモ。

Store上で表示される名前と*.appファイル名と、iPhone上の表示名が違っても申請が通るかどうか、またどれくらい違ったらokなのか気になるところです。ちなみにStore上とiPhone上の表示名は違うことはよくあるみたいで、Store上ではより長い仕様分かりやすい名前にするのをよく見かけます。

結論:CFBundleDisplayNameを編集すればok

例えばShopping Pink.appというappファイル名で、表示はShoppingとすることが可能です。

Info.plistで:

   1  	<key>CFBundleDisplayName</key>
   2  	<string>Shopping</string>
   3  	<key>CFBundleExecutable</key>
   4  	<string>${EXECUTABLE_NAME}</string>

CFBundleDisplayNameとCFBundleNameの違い

ぐぐったところ、CFBundleNameはQuickLookでindexされる名前??、CFBundleDisplayNameは言語毎にローカライズしたい時に使うプロパティだということがわかりました。

/ Localized versions of Info.plist keys /

NSHumanReadableCopyright = "© __MyCompanyName__, 2008";
CFBundleName = "English MenuBar"; //...and Finder's QuickLook
CFBundleDisplayName = "EnglishApp";
http://forums.macrumors.com/showthread.php?t=537977

Refs

http://eien.seesaa.net/article/27964381.html
http://forums.macrumors.com/showthread.php?t=537977
http://developer.apple.com/documentation/MacOSX/Conceptual/BPInternational/Articles/LocalizingPathnames.html#//apple_ref/doc/uid/20002141-97582-BCIDCGHG

posted by Png satoko on Mon 23 Feb 2009 at 17:13

An Idea for Open Avatar Exchange

I am using GRAVATAR at github.com. It is very interesting service that provides globally recognized avatar image from a hash of email address. What is clever is a service using GRAVATAR can present its user's avatar without not exposing his/her email address.

But the GRAVATAR is not the only provider of such avatars. For example, twitter.com has huge database of mapping from email address to avatar image. There are a lot of services which have such the database.

Imagine twitter.com, facebook, linkedin and so on provide their avatar images by the same manner. We can provide avatar image for every user of which we know his/her email address everywhere and quite easily. This is the principal advantage of this idea.

But what is advantage for provider? That's the obvious question. Answer is inter-service completion of avatar images. In each service, not all users have his/her avatar image. For such users, the service provides disappointing default avatar image. But if there is the open avatar exchange, the service can try to find it in other services instead.

The way to make the exchange is really simple. Provide REST API to map MD5 hash of email address to avatar image. Block accesses from domains you don't want to exchange.

In addition, avatar providers can harvest stats of the sites that are using your avatar image.

posted by Png takiuchi on Mon 23 Feb 2009 at 08:21
Contents
Object#remove_singleton_method
Singleton Methodをundefする
[iPhone] *.appファイル名とiPhone上の表示名:CFBundleDisplayName
An Idea for Open Avatar Exchange
Comments
瀧内元気: MacOS版は以下にあります * [genki/ViMouse](https://githu... '23-1
KingofSmack: Here also good reads for this mobile applicatio... '14-5
Spencer: You don't have to re-compile it, this version w... '14-4
staiano: Any chance we can get a recompile for 10.9? '14-1
dsjf: https://gist.github.com/6bf1bf2c3cbb5eb6e7a7 これ... '13-1
Services from s21g
twpro(ツイプロ)
Twitterプロフィールを快適検索
地価2009
土地の値段を調べてみよう
MyRestaurant
自分だけのレストラン手帳
Formula
ブログに数式を埋め込める数式コミュニティ