zshのselect文で文字化け(未解決)
bashだと
$ bash --version GNU bash, version 4.1.5(1)-release (i486-pc-linux-gnu) Copyright (C) 2009 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html> This is free software; you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law.
$ select i in あああ いいい ううう; do > echo $i > break > done 1) あああ 2) いいい 3) ううう #? 3 ううう
ok
んで、問題のzsh
$ echo $ZSH_VERSION 4.3.10
$ select i in あああ いいい ううう; do select> echo $i select> break select> done 1) あああ 2) ぃ�ぃ�ぃ� 3) ぃ�ぃ�ぃ� ?# 3 ううう
※実際には「�」は「�」と表示されている。
/(^o^)\
メモ
マニュアル zsh: 6 Shell Grammar
なるほど、わからん
apt-cacheで指定パッケージに依存しているパッケージを探す
ググると
whatdepends コマンドと書かれていることが多い!?
$ apt-cache whatdepends HOGE
こんな感じで。しかーし、これはエラーになってしまう。
$ apt-cache whatdepends HOGE E: Invalid operation whatdepends
ヘルプを見てみる
$ apt-cache --help | grep 'dependency' depends - Show raw dependency information for a package rdepends - Show reverse dependency information for a package
rdepends コマンドを使えばいいみたい
$ apt-cache rdepends HOGE HOGE Reverse Depends: ... ...
ちなみに
apt のバージョンは
$ apt-cache --help apt 0.7.25.3ubuntu9.5 for i386 compiled on May 30 2011 05:38:30 ...
Python で実体参照のデコード。アポストロフィーの場合…
はまったorz
アポストロフィーの文字実体参照(')は XHTML1.0 からだとか…
>>> import htmlentitydefs >>> htmlentitydefs.name2codepoint['apos'] Traceback (most recent call last): ... KeyError: 'apos'
とりあえず
これでいいのかな
>>> from xml.sax.saxutils import unescape >>> unescape('' " & < >') '' " & < >' >>> unescape('' " & < >', {''': '\'', '"': '"'}) '\' " & < >'
Opera Extensions の管理画面を呼び出す Opera Action
今更って感じですが
管理画面を開く(デフォルトでは「e ctrl shift」)
Manage, "extensions"
別ウィンドウで管理画面を開く(機能しない。今後に期待)
Manage extensions
サイドパネルで開く(現時点では使い物にならない。今後に期待)
Focus panel, "extensions" | Hide panel, -1 | Set alignment, "hotlist", 0
ニコニコ生放送の予定をGoogleカレンダーに登録するブックマークレット
注意点
ブックマークレット
放送開始時刻を登録する版
開場時刻を登録する版
javascript:(function(){try{var c=document,a,b,d;d=location.toString();if(d.indexOf("http://live.nicovideo.jp/watch/lv")!=0&&d.indexOf("http://live.nicovideo.jp/gate/lv")!=0)throw"This URL is not supported";String.prototype.trim=function(){return this.replace(/^\s*|\s*$/g,"")};a=c.querySelector("div.infobox > h2").textContent.trim();b=c.querySelector("div.kaijo").textContent.trim();if(!a[0]||!a[1]||!b)throw"Cannot get enough info";a=a.split("\n");a[1]=a[1].trim().replace(/^\(|\)$/g,"");b=b.replace(/[^\d]/g,"");b=b.slice(0,8)+"T"+b.slice(8,12)+"00";window.open("https://www.google.com/calendar/render?action=TEMPLATE&text="+encodeURIComponent(a[0])+"&dates="+b+"/"+b+"&details="+encodeURIComponent(a[0]+"\n"+a[1]+"\n"+c.location.href),"_blank")}catch(e){alert("Error:\n"+e)}})();
dbus-python の proxy method? を拡張したい??
タイトル、あってるかな???
Python (というかプログラミング全般)の知識が、遅延学習に次ぐ遅延学習で…
ホントに基礎だけでもおさえておかないと厳しいかも
本題
Tomboy をハードに使っていまして、操作は dbus-python を使ったオレオレツールで行っています。
dbus-python + Tomboy の基本操作はこんな感じです。
>>> import dbus >>> bus = dbus.SessionBus() >>> obj = bus.get_object('org.gnome.Tomboy', '/org/gnome/Tomboy/RemoteControl') >>> tomboy = dbus.Interface(obj, 'org.gnome.Tomboy.RemoteControl') >>> >>> tomboy.SearchNotes(u'ほげ', True) dbus.Array([dbus.String(u'note://tomboy/****')], signature=dbus.Signature('s'))
んで、メソッドも充実しているのですが…
よく使う項をまとめて GetNoteURI なるメソッドを追加しようと思い立ったのです(`・ω・´)
よく理解出来ていないけれど __new__ を使って
class dbusTomboy(object): def __new__(self): bus = dbus.SessionBus() obj = bus.get_object('org.gnome.Tomboy', '/org/gnome/Tomboy/RemoteControl') return dbus.Interface(obj, 'org.gnome.Tomboy.RemoteControl') def GetNoteURI(self, NoteTitle): """ ... (略) ... """ pass
しかし、
>>> tomboy = dbusTomboy()
>>> tomboy.GetNoteURI(u'ほげ')
とすると
dbus.exceptions.DBusException: org.freedesktop.DBus.Error.UnknownMethod: Method "GetNoteURI" with signature "s" on interface "org.gnome.Tomboy.RemoteControl" doesn't exist
と怒られるorz
>>> type(tomboy.SerchNotes) <type 'instance'> >>> print tomboy.SerchNotes.__doc__ A proxy method which will only get called once we have its introspection reply. >>> dir(tomboy) ['__class__', '__dbus_object_path__', '__delattr__', '__dict__', '__doc__', '__format__', '__getattr__', '__getattribute__', '__hash__', '__init__', '__module__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__', '__weakref__', '_dbus_interface', '_obj', 'bus_name', 'connect_to_signal', 'dbus_interface', 'get_dbus_method', 'object_path', 'proxy_object', 'requested_bus_name']
むむむ
ちょっと単純に考えてたなー。擬似拡張でいいから tomboy.GetNoteURI() を使えるようにしたい。
しかし、何を学べばいいのか分からない(((( ;゚д゚))))
各 Web ブラウザのダウンロードフォルダを変更
Chromium*1 の場合
ツールバーのレンチ > Preferences で Chromium Preferences を開く。
Under the Hood タブの Downloads の項に Download location がある。そこで任意の場所を指定。
ついでに Ask where to save each file before downloading は外しておく。
Firefox*2 の場合
ツールバーの Edit > Preferences で Firefox Preferences を開く。
General タブの Downloads の項に Save files to がある。そこで任意の場所を指定。
ついでに DownloadHelper*3 も設定する
Tools > DownloadHelper > Preferences で Preferences を開く。
Services タブの Download タブに Strage directory という項があるので、そこで任意の場所を指定する。