<?xml version="1.0" encoding="utf-8"?>
<feed
    xmlns="http://www.w3.org/2005/Atom"
    xmlns:at="http://www.sixapart.com/ns/at"
    xmlns:icbm="http://postneo.com/icbm"
    xmlns:rvw="http://purl.org/NET/RVW/0.2/"
    xml:lang="en">
    <title>Chagama Lab</title>
    <link rel="self" type="application/atom+xml" title="Chagama Lab (Atom)" href="http://kosugi-tomo.vox.com/library/posts/page/1/atom.xml" />
    <link rel="alternate" type="text/html" title="Chagama Lab" href="http://kosugi-tomo.vox.com/library/posts/page/1/"/> 
    <link rel="service.post" type="application/atom+xml" title="Chagama Lab" href="http://www.vox.com/services/atom/svc=post/collection_id=6a00cdf39c8282cb8f00cdf39c8284cb8f" /> 
    <link rel="service.subscribe" type="application/atom+xml" title="Chagama Lab" href="http://kosugi-tomo.vox.com/library/posts/atom.xml" />    
    <link rel="next" type="application/atom+xml" title="Chagama Lab" href="http://kosugi-tomo.vox.com/library/posts/page/2/atom.xml" /> 
    <link rel="last" type="application/atom+xml" title="Chagama Lab" href="http://kosugi-tomo.vox.com/library/posts/page/4/atom.xml" />  
    <generator uri="http://www.vox.com/">Vox</generator>
    <updated>2008-07-06T01:15:27Z</updated> 
    <author>
        <name>KOSUGI Tomo</name>
        <uri>http://kosugi-tomo.vox.com/?_c=feed-atom-full</uri>
    </author> 
    <id>tag:vox.com,2006:6p00cdf39c8282cb8f/</id>  
    
    <entry>
        <title>Yaiku - Yet Another Jaiku Mobile</title>   
        <link rel="alternate" type="text/html" title="Yaiku - Yet Another Jaiku Mobile" href="http://kosugi-tomo.vox.com/library/post/yaiku.html?_c=feed-atom-full" />  
        <link rel="service.post" type="application/atom+xml" title="Yaiku - Yet Another Jaiku Mobile" href="http://kosugi-tomo.vox.com/library/post/yaiku.html?_c=feed-atom-full#comments" /> 
        <link rel="service.edit" type="application/atom+xml" title="Yaiku - Yet Another Jaiku Mobile" href="http://www.vox.com/atom/svc=post/asset_id=6a00cdf39c8282cb8f00fad68f777b0005" />              <id>tag:vox.com,2008-06-11:asset-6a00cdf39c8282cb8f00fad68f777b0005</id>
        <published>2008-06-11T03:52:30Z</published>
        <updated>2008-07-06T01:15:27Z</updated>
    
        <author>
            <name>KOSUGI Tomo</name>
            <uri>http://kosugi-tomo.vox.com/?_c=feed-atom-full</uri>
        </author>
    
        
        <content type="html" xml:base="http://kosugi-tomo.vox.com/?_c=feed-atom-full">
            <![CDATA[
                <div xmlns="http://www.w3.org/1999/xhtml" xmlns:at="http://www.sixapart.com/ns/at">
        
    
    
    

    
    
    

    
    
    

    
    
    

    
    
    

    
    
    

    
    
    

    
    
    
<div at:enclosure="asset" at:xid="6a00cdf39c8282cb8f00fa967de5f80003" at:format="medium" at:align="right"
    class="enclosure enclosure-right enclosure-medium photo-enclosure" 
     style="text-align: center; float: right;">
<div class="enclosure-inner"
    
        style="padding: 9px; border: 1px solid; width: px; margin: 0 0 20px 20px;"
    >
    <div class="enclosure-list">
        <div class="enclosure-item photo-asset last">
    
            <div class="enclosure-image">
        
                <a href="http://kosugi-tomo.vox.com/library/photo/6a00cdf39c8282cb8f00fa967de5f80003.html"><img src="http://a0.vox.com/6a00cdf39c8282cb8f00fa967de5f80003-200pi" alt="Yaiku Toppage (for PC)" title="Yaiku Toppage (for PC)" /></a>
        
            </div>
            <div class="enclosure-meta">
                <div class="enclosure-asset-name"><a href="http://kosugi-tomo.vox.com/library/photo/6a00cdf39c8282cb8f00fa967de5f80003.html" title="Yaiku Toppage (for PC)">Yaiku Toppage (for PC)</a></div>
            </div>
    
        </div>
    </div>
</div>
</div><!-- end enclosure -->
<p>






Google に買われつつも微妙に奮わない <a href="http://jaiku.com">Jaiku</a> の API を使ってケータイ版を作ってみた．</p><p>Jaiku のケータイ版といえば既に <a href="http://m.jaiku.com">m.jaiku.com</a> が official で提供されているが，例によって Cookie が使えない端末では (当然) ログインもできず，割と昔から Cookie に対応している au に至っても &quot;domain=.jaiku.com&quot; を解釈できないのか，サブドメインが異なるユーザページでセッションが切れてしまいやはり使いものにならない．</p><p>まぁ，こういうのは往々にして Cookie に対応していない端末の方が悪いわけで，小賢しい小手先の対策に労力を割くのは本質的ではないし，何よりセッション回りでの「制限回避」は安全性を犠牲にしかねない．</p><p>しかし自分の au 端末でも Jaiku したいという矛盾と戦いつつ，まぁ，その，なんだ．とりあえず作ってしまった．あはは．</p><hr /><p>特徴</p>
    
    
    

    
    
    

    
    
    

    
    
    

    
    
    

    
    
    

    
    
    

    
    
    
<div at:enclosure="asset" at:xid="6a00cdf39c8282cb8f00fad69057130004" at:format="medium" at:align="right"
    class="enclosure enclosure-right enclosure-medium photo-enclosure" 
     style="text-align: center; float: right;">
<div class="enclosure-inner"
    
        style="padding: 9px; border: 1px solid; width: px; margin: 0 0 20px 20px;"
    >
    <div class="enclosure-list">
        <div class="enclosure-item photo-asset last">
    
            <div class="enclosure-image">
        
                <a href="http://kosugi-tomo.vox.com/library/photo/6a00cdf39c8282cb8f00fad69057130004.html"><img src="http://a3.vox.com/6a00cdf39c8282cb8f00fad69057130004-200pi" alt="Yaiku Toppage (for mobile)" title="Yaiku Toppage (for mobile)" /></a>
        
            </div>
            <div class="enclosure-meta">
                <div class="enclosure-asset-name"><a href="http://kosugi-tomo.vox.com/library/photo/6a00cdf39c8282cb8f00fad69057130004.html" title="Yaiku Toppage (for mobile)">Yaiku Toppage (for mobile)</a></div>
            </div>
    
        </div>
    </div>
</div>
</div><!-- end enclosure -->







<ul><li>日本のケータイ特有の絵文字を使ってアイコンを表示・投稿できる (m.jaiku.com にはない feature)</li><li>API 提供されていないコメント投稿機能がある (Jaiku API 使いには公然っぽいけど) </li><li>contacts の add/remove が可能 (6/17 追加)<br /></li></ul><p><br /><hr />利用手順</p><ol><li>Yaiku を利用する Jaiku ユーザ名を決める</li><li>Jaiku ユーザ用の API Key を Jaiku から取得する</li><li>Yaiku のトップページに PC でアクセスして，ユーザ名と API Key を入力してケータイ用 URL を得る (要 javascript)</li><li>URL にケータイでアクセスし，ブックマークする</li><li>以降はブックマーク経由でアクセスする<br /></li></ol><p>Yaiku では Jaiku の API を利用しているので，ユーザ毎に提供される API Key が必要となる．事前に Jaiku にログインした状態で <a href="http://api.jaiku.com/key">http://api.jaiku.com/key</a> から API Key を取得しておく．</p><p>続いて <a href="http://phoneme.homelinux.org/yaiku/">http://phoneme.homelinux.org/yaiku/</a> にアクセスして，フォームにユーザ名と API Key を入力すると，しばらくした後にそのユーザ専用の Yaiku URL が生成・表示される．</p><p>得られた URL でケータイからアクセスできる．簡単 ! (でもない)</p><p><br /><hr />諸注意</p><ul><li>Yaiku が取得した username と API Key は *.jaiku.com への API リクエストのために用いられる．</li><li>API 応答以外 (HTML 内) の情報を取得するために用いる場合もある</li><li>API Key はサーバ内のデータベースに暗号化して保存される (管理者が casual に閲覧することはない)<br /></li></ul><p>Yaiku URL は自分だけのものなので慎重に管理されたい．これが盗まれてしまうと他人が Yaiku 上で貴方に成り代わって発言できてしまう (場合によってはそれ以上の操作が可能になる可能性がある)．これが，前述の「制限回避」による避けられない代償となるのでリスクを理解した上で利用されたい．</p><ul><li>Yaiku 上で可能な全ての操作を行われる</li><li>URL から API Key を得ることはできない</li><li>URL から Jaiku のパスワードを得ることはできない (そもそも Yaiku は Jaiku のパスワードを取得していない)<br /></li></ul><p>Yaiku URL は生成される度に異なり，古い URL は都度破棄されるので，現在の URL に危険を感じた場合は URL を再取得して頂きたい．</p><p>また，ケータイからアクセスして，設定メニューから「Yaiku URL を無効にする」にチェックを入れて &quot;Logout&quot; することでサーバ上からユーザ情報を完全に削除できる (現時点では未実装 (えー</p><p><strong><span style="color: #ff9933">※</span></strong> 6/12 追記 - Logout を実装した</p><hr /><p>所感</p><p>Jaiku の API がひどい．使って貰おうという気が全く感じられない．これじゃ誰もアプリ作らないし流行るはずもないと痛感する．</p><p><a href="http://groups.google.com/group/twitter-development-talk/web/api-documentation">Twitter の API ドキュメント</a> と <a href="http://devku.org/docs">Jaiku のそれ</a>を見比べると泣けてくる．だいたい devku.org って何だよ．これ本当に official なのか?</p><p>ドキュメント通りに組んでも投稿できないし，コメント投稿 API は見当たらないし overview も取得できないし (API 見つけたけど)，ユーザ情報取得したら friends がダラダラくっついて来るし，あーもう．</p><p>Jaiku ちゃんとしろ!!</p><hr /><p>その他</p><p><a href="http://fixdap.com/p/yaiku/">fixdap</a> でタスク管理をしているので，意見・要望等はこちらからどうぞ．</p><p>みんなもっと Jaiku やるといいよ!!</p>   <p style="clear:both;"> 
    <a href="http://kosugi-tomo.vox.com/library/post/yaiku.html?_c=feed-atom-full#comments">Read and post comments</a>   |   
    <a href="http://www.vox.com/share/6a00cdf39c8282cb8f00fad68f777b0005?_c=feed-atom-full">Send to a friend</a> 
</p>

                </div>
            ]]>
        </content> 
    <category term="jaiku yaiku" scheme="http://kosugi-tomo.vox.com/tags/jaiku+yaiku/" label="jaiku yaiku" /> 
    </entry> 
    
    <entry>
        <title>Carbon Emacs + AquaSkk + C-j + etc.</title>   
        <link rel="alternate" type="text/html" title="Carbon Emacs + AquaSkk + C-j + etc." href="http://kosugi-tomo.vox.com/library/post/carbon-emacs-aquaskk-c-j-etc.html?_c=feed-atom-full" />  
        <link rel="service.post" type="application/atom+xml" title="Carbon Emacs + AquaSkk + C-j + etc." href="http://kosugi-tomo.vox.com/library/post/carbon-emacs-aquaskk-c-j-etc.html?_c=feed-atom-full#comments" /> 
        <link rel="service.edit" type="application/atom+xml" title="Carbon Emacs + AquaSkk + C-j + etc." href="http://www.vox.com/atom/svc=post/asset_id=6a00cdf39c8282cb8f00fae8bc2256000b" />          <id>tag:vox.com,2008-05-23:asset-6a00cdf39c8282cb8f00fae8bc2256000b</id>
        <published>2008-05-23T19:28:35Z</published>
        <updated>2009-02-10T22:24:29Z</updated>
    
        <author>
            <name>KOSUGI Tomo</name>
            <uri>http://kosugi-tomo.vox.com/?_c=feed-atom-full</uri>
        </author>
    
        
        <content type="html" xml:base="http://kosugi-tomo.vox.com/?_c=feed-atom-full">
            <![CDATA[
                <div xmlns="http://www.w3.org/1999/xhtml" xmlns:at="http://www.sixapart.com/ns/at">
        <p>よく分かってないけど一応メモ．</p><p>環境:<br /><ul><li>AquaSKK-3.6</li><li>CarbonEmacs-Tiger-20080120 (バイナリパッケージ版)<br /></li></ul><br />問題:<br /><ul><li>C-j の入力が AquaSkk に食われてしまい，C-q C-j 等が効かなくて不便．</li><li>(setq mac-pass-control-to-system nil) とすると一応 C-j を Emacs に渡せるが，今度は AquaSkk による変換中の C-g や C-h まで Emacs に食われてしまい使いものにならない :-(</li><li>ddskk とやらを使えば (setq mac-pass-control-to-system nil) で AquaSkk を完全にスルーして上記の問題を解決できる? ようだが要コンパイルとか困る (ヘタレ)．<br /></li></ul><br />そもそも自分は native な SKK 使いではないので入力モードの切り替えは Cmd + SPC で十分なのだから，単に AquaSkk の C-j だけを殺せればそれで事足りるはず．<a href="http://www.google.com/search?q=AquaSkk%20%E3%82%AD%E3%83%BC%E3%83%90%E3%82%A4%E3%83%B3%E3%83%89">カスタマイズ方法を調べてみた</a>．</p><p>というわけで皆がやっている通り ~/Library/AquaSkk/config を用意してみたが，単に無効にすることはできないようで，kakutei-key &quot;&quot; などと記述しても意図通りの挙動にならない．ではどこか別のキーに割り当てれば良いのだが，できるだけ他に影響のないキーにしたい．で，元々 toggle-input-method がバインドされていた C-¥ に (何となく) 割り当ててみた．何となくというだけあって，何か効いていないような感じだ (今まで通り toggle してしまう) が，とりあえず&#160; C-j は Emacs に渡るようになり，変換中の C-h 等も問題ないのでこれで良しとしよう．</p><blockquote><pre style="font-family: monospace;"> toggle-kana-key&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &quot;q&quot;<br />&#160;toggle-katakana-key&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &quot;¥C-q&quot;<br />-kana-mode-key&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &quot;¥C-j&quot;<br />+kana-mode-key&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &quot;¥C-¥¥&quot;<br />&#160;latin-mode-key&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &quot;l&quot;<br />&#160;jisx0208-latin-mode-key&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &quot;L&quot;</pre><p><br /></p></blockquote>   <p style="clear:both;"> 
    <a href="http://kosugi-tomo.vox.com/library/post/carbon-emacs-aquaskk-c-j-etc.html?_c=feed-atom-full#comments">Read and post comments</a>   |   
    <a href="http://www.vox.com/share/6a00cdf39c8282cb8f00fae8bc2256000b?_c=feed-atom-full">Send to a friend</a> 
</p>

                </div>
            ]]>
        </content> 
    <category term="emacs" scheme="http://kosugi-tomo.vox.com/tags/emacs/" label="emacs" /> 
    <category term="mac" scheme="http://kosugi-tomo.vox.com/tags/mac/" label="mac" /> 
    <category term="skk" scheme="http://kosugi-tomo.vox.com/tags/skk/" label="skk" /> 
    </entry> 
    
    <entry>
        <title>why python runtime don&#39;t use __len__? (2)</title>   
        <link rel="alternate" type="text/html" title="why python runtime don&#39;t use __len__? (2)" href="http://kosugi-tomo.vox.com/library/post/why-python-runtime-dont-use-__len__-2.html?_c=feed-atom-full" />  
        <link rel="service.post" type="application/atom+xml" title="why python runtime don&#39;t use __len__? (2)" href="http://kosugi-tomo.vox.com/library/post/why-python-runtime-dont-use-__len__-2.html?_c=feed-atom-full#comments" /> 
        <link rel="service.edit" type="application/atom+xml" title="why python runtime don&#39;t use __len__? (2)" href="http://www.vox.com/atom/svc=post/asset_id=6a00cdf39c8282cb8f00fa96763e780002" />          <id>tag:vox.com,2008-05-19:asset-6a00cdf39c8282cb8f00fa96763e780002</id>
        <published>2008-05-19T13:17:22Z</published>
        <updated>2008-05-19T13:17:22Z</updated>
    
        <author>
            <name>KOSUGI Tomo</name>
            <uri>http://kosugi-tomo.vox.com/?_c=feed-atom-full</uri>
        </author>
    
        
        <content type="html" xml:base="http://kosugi-tomo.vox.com/?_c=feed-atom-full">
            <![CDATA[
                <div xmlns="http://www.w3.org/1999/xhtml" xmlns:at="http://www.sixapart.com/ns/at">
        <p>前回の続き．<br />これでいけた．</p><blockquote><p>class Proxy:<br />&#160;&#160;&#160; def __init__(self, obj):<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; self.__dict__[&#39;_obj&#39;] = obj</p><p>&#160;&#160;&#160; def __getattr__(self, name):<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; return getattr(self._obj, name)</p><p>&#160;&#160;&#160; def __setattr__(self, name, value):<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; setattr(self._obj, name, value)<br /></p></blockquote><p><br /><blockquote><p>a = Proxy(10)<br />str(a)&#160;&#160; #=&gt; &#39;10&#39;<br />repr(a) #=&gt; &#39;10&#39;<br />a + 3&#160;&#160; #=&gt; 13<br />long(a) #=&gt; 10L</p><p>b = Proxy([])<br />b.append(10)<br />b.append(20)<br />b.pop() #=&gt; 20<br />repr(b)&#160; #=&gt; &#39;[10]&#39;<br />len(b)&#160;&#160; #=&gt; 1</p><p>class A(object):<br />&#160; def __len__(self):<br />&#160;&#160;&#160; return 3<br />c = Proxy(A())<br />len(c) #=&gt; 3<br /></p></blockquote><br />Proxy(10) + 3 とかも効くのは凄い．<br />というか 6.5 章でズバリ解説されていた (死亡)．<br />古い形式の class って推奨していいのかなー．</p>    <p style="clear:both;"> 
    <a href="http://kosugi-tomo.vox.com/library/post/why-python-runtime-dont-use-__len__-2.html?_c=feed-atom-full#comments">Read and post comments</a>   |   
    <a href="http://www.vox.com/share/6a00cdf39c8282cb8f00fa96763e780002?_c=feed-atom-full">Send to a friend</a> 
</p>

                </div>
            ]]>
        </content> 
    <category term="python" scheme="http://kosugi-tomo.vox.com/tags/python/" label="python" /> 
    </entry> 
    
    <entry>
        <title>why python runtime don&#39;t use __len__?</title>   
        <link rel="alternate" type="text/html" title="why python runtime don&#39;t use __len__?" href="http://kosugi-tomo.vox.com/library/post/why-python-runtime-dont-use-__len__.html?_c=feed-atom-full" />  
        <link rel="service.post" type="application/atom+xml" title="why python runtime don&#39;t use __len__?" href="http://kosugi-tomo.vox.com/library/post/why-python-runtime-dont-use-__len__.html?_c=feed-atom-full#comments" /> 
        <link rel="service.edit" type="application/atom+xml" title="why python runtime don&#39;t use __len__?" href="http://www.vox.com/atom/svc=post/asset_id=6a00cdf39c8282cb8f00fae8ba91d0000b" />          <id>tag:vox.com,2008-05-18:asset-6a00cdf39c8282cb8f00fae8ba91d0000b</id>
        <published>2008-05-18T19:01:23Z</published>
        <updated>2008-05-19T02:38:37Z</updated>
    
        <author>
            <name>KOSUGI Tomo</name>
            <uri>http://kosugi-tomo.vox.com/?_c=feed-atom-full</uri>
        </author>
    
        
        <content type="html" xml:base="http://kosugi-tomo.vox.com/?_c=feed-atom-full">
            <![CDATA[
                <div xmlns="http://www.w3.org/1999/xhtml" xmlns:at="http://www.sixapart.com/ns/at">
        <p>べ，別に GAE やら何とかのために Python やってるんじゃないんだからね!! ///</p><p>Python クックブック 9.1 章 (weaving) を試していて困った／疑問を持った話．<br />とりあえず 9.1 章のような継承 (name-mangling) は考えずに，再現する最小のコードをば．</p><blockquote><p>class Proxy(object):<br />&#160; def __init__(self, obj):<br />&#160;&#160;&#160; object.__setattr__(self, &#39;obj&#39;, obj)</p><p>&#160; def __getattribute__(self, name):<br />&#160;&#160;&#160; return object.__getattribute__(self, &#39;obj&#39;).__getattribute__(name)<br /></p></blockquote><p><br />すると，こんな感じで動く．</p><blockquote><p>a = Proxy(10)<br />str(a)&#160;&#160;&#160;&#160;&#160;&#160; #=&gt; &#39;&lt;__main__.Proxy object at 0x677d0&gt;&#39;<br />repr(a)&#160;&#160;&#160;&#160;&#160; #=&gt; &#39;&lt;__main__.Proxy object at 0x677d0&gt;&#39;<br />a.__str__()&#160; #=&gt; &#39;10&#39;<br />a.__repr__() #=&gt; &#39;10&#39;<br /></p></blockquote><p><br />ううむ，若干期待と異なる挙動を見せる (全て &#39;10&#39; が返って欲しい)．</p><p>更に．</p><blockquote><p>b = Proxy([])<br />b.append(10)<br />b.pop()&#160;&#160;&#160;&#160;&#160; #=&gt; 10<br />repr(b)&#160;&#160;&#160;&#160;&#160; #=&gt; &#39;&lt;__main__.Proxy object at 0x67910&gt;&#39;<br />b.__repr__() #=&gt; &#39;[]&#39;<br />len(b)&#160;&#160;&#160;&#160;&#160;&#160; #=&gt; TypeError: object of type &#39;Proxy&#39; has no len()<br />b.__len__()&#160; #-&gt; 0<br />hasattr(b, &#39;__len__&#39;) #=&gt; True</p></blockquote><p>うは，__len__ がある (見える) のに len 使えないのかー＞＜</p><p>別に，組み込みオブジェクトを使ったからというわけではなく，通常のオブジェクトを使っても同じ挙動を見せる．</p><blockquote><p>class A(object):<br />&#160; def __len__(self):<br />&#160;&#160;&#160; return 3</p><p>c = A()<br />len(c) #=&gt; 3</p><p>d = Proxy(c)<br />len(d)&#160;&#160;&#160;&#160;&#160; #=&gt; TypeError: object of type &#39;Proxy&#39; has no len()<br />d.__len__() #=&gt; 3<br />hasattr(d, &#39;__len__&#39;) #=&gt; True<br /></p></blockquote><p><br />単に __len__ の有無を見ているわけじゃなさそうだなぁ．</p><p>ちなみに，9.1 章に載っている inspect を用いたコードだと，組み込みオジェクトの殆どのメソッドを ismethod で inspect できずに b.append すらも失敗する．</p><p>これだったら普通に Synchronize<span id="__firefox-findbar-search-id" style="padding: 0pt; background-color: yellow; color: black; display: inline; font-size: inherit;"></span>List とか欲しいなぁ．</p>    <p style="clear:both;"> 
    <a href="http://kosugi-tomo.vox.com/library/post/why-python-runtime-dont-use-__len__.html?_c=feed-atom-full#comments">Read and post comments</a>   |   
    <a href="http://www.vox.com/share/6a00cdf39c8282cb8f00fae8ba91d0000b?_c=feed-atom-full">Send to a friend</a> 
</p>

                </div>
            ]]>
        </content> 
    <category term="python" scheme="http://kosugi-tomo.vox.com/tags/python/" label="python" /> 
    </entry> 
    
    <entry>
        <title>alt, meta and cmd keys</title>   
        <link rel="alternate" type="text/html" title="alt, meta and cmd keys" href="http://kosugi-tomo.vox.com/library/post/alt-meta-and-cmd-keys.html?_c=feed-atom-full" />  
        <link rel="service.post" type="application/atom+xml" title="alt, meta and cmd keys" href="http://kosugi-tomo.vox.com/library/post/alt-meta-and-cmd-keys.html?_c=feed-atom-full#comments" /> 
        <link rel="service.edit" type="application/atom+xml" title="alt, meta and cmd keys" href="http://www.vox.com/atom/svc=post/asset_id=6a00cdf39c8282cb8f00f48cf2db4c0002" />                <id>tag:vox.com,2008-04-28:asset-6a00cdf39c8282cb8f00f48cf2db4c0002</id>
        <published>2008-04-28T18:48:16Z</published>
        <updated>2008-04-28T18:52:52Z</updated>
    
        <author>
            <name>KOSUGI Tomo</name>
            <uri>http://kosugi-tomo.vox.com/?_c=feed-atom-full</uri>
        </author>
    
        
        <content type="html" xml:base="http://kosugi-tomo.vox.com/?_c=feed-atom-full">
            <![CDATA[
                <div xmlns="http://www.w3.org/1999/xhtml" xmlns:at="http://www.sixapart.com/ns/at">
        
    
    
    

    
    
    

    
    
    

    
    
    
<div at:enclosure="asset" at:xid="6a00cdf39c8282cb8f00e398ef16f40005" at:format="medium" at:align="right"
    class="enclosure enclosure-right enclosure-medium photo-enclosure" 
     style="text-align: center; float: right;">
<div class="enclosure-inner"
    
        style="padding: 9px; border: 1px solid; width: px; margin: 0 0 20px 20px;"
    >
    <div class="enclosure-list">
        <div class="enclosure-item photo-asset last">
    
            <div class="enclosure-image">
        
                <a href="http://kosugi-tomo.vox.com/library/photo/6a00cdf39c8282cb8f00e398ef16f40005.html"><img src="http://a4.vox.com/6a00cdf39c8282cb8f00e398ef16f40005-200pi" alt="DELL jp109" title="DELL jp109" /></a>
        
            </div>
            <div class="enclosure-meta">
                <div class="enclosure-asset-name"><a href="http://kosugi-tomo.vox.com/library/photo/6a00cdf39c8282cb8f00e398ef16f40005.html" title="DELL jp109">DELL jp109</a></div>
            </div>
    
        </div>
    </div>
</div>
</div><!-- end enclosure -->
<p>


IBM PC/AT 由来のキーボード (以下「PC キーボード」) には大抵 &quot;Z&quot; と &quot;X&quot; の下側に ALT キーが付いていて，装飾キーの一つとして機能する．Windows では ALT + F4 や CTRL + ALT + DEL を使わない日は無いし，メニューバーへのアクセスにも使えるので個人的には大変重宝している．</p><p>端末エミュレータや Emacs 系のアプリケーションでは ALT キーを META キーとして機能させることができる (あるいはデフォルトでそのように設定されている)．Windows では ALT + F 等の入力がメニューに奪われてしまうため意図通りに機能しないこともあったり特別な設定を要することもあるが，TeraTerm や xyzzy, Eclipse 等は通常の ALT キーとのコンビネーションを META として解釈し，単独で ALT を押し離すとメニューバーにキーボードフォーカスが移るという気の効いた仕組みになっている．Putty の場合はそもそもメニューバーが存在しない．</p><p><br />META キーとは <a href="http://eintr.net/systems/sun/kbd-type5c-mouse-type5/pi/3.jpg">Sun 由来のキーボード</a>に付いている装飾キーらしく，位置も PC キーボードの ALT と同じ場所なので PC キーボードに於ける META キーを ALT キーとして扱うのは妥当と言えるだろう (Sun キーボードには META の外側に ALT が付いているのだが，どのような用途で使われていたのかは知らない)．そもそも昔は他に当てるキーがなかったわけだし，ALT キーの外側に Windows キーが付くようになっても，それらを META キーとして使う習慣のある人を見たことがない (というか Windows キーは ALT よりも更にシステムグローバルな機能が最初から割り当てられているし，おいそれと使うものではないという印象)．</p>
    
    
    

    
    
    
<div at:enclosure="asset" at:xid="6a00cdf39c8282cb8f00f48cf2db2e0002" at:format="medium" at:align="right"
    class="enclosure enclosure-right enclosure-medium photo-enclosure" 
     style="text-align: center; float: right;">
<div class="enclosure-inner"
    
        style="padding: 9px; border: 1px solid; width: px; margin: 0 0 20px 20px;"
    >
    <div class="enclosure-list">
        <div class="enclosure-item photo-asset last">
    
            <div class="enclosure-image">
        
                <a href="http://kosugi-tomo.vox.com/library/photo/6a00cdf39c8282cb8f00f48cf2db2e0002.html"><img src="http://a6.vox.com/6a00cdf39c8282cb8f00f48cf2db2e0002-200pi" alt="HHK Lite" title="HHK Lite" /></a>
        
            </div>
            <div class="enclosure-meta">
                <div class="enclosure-asset-name"><a href="http://kosugi-tomo.vox.com/library/photo/6a00cdf39c8282cb8f00f48cf2db2e0002.html" title="HHK Lite">HHK Lite</a></div>
            </div>
    
        </div>
    </div>
</div>
</div><!-- end enclosure -->
<p>
ここで強調しておきたいのは ALT キーの位置で，冒頭で述べた通り &quot;Z&quot; と &quot;X&quot; の下にあるキーが ALT であり META であるべきだ．Windows キーの位置にあるキーは利用頻度の高い装飾キーとしては使いづらい．</p><p>


ややこしいのが Sun 由来の HHK で，やはり内側に META，外側に ALT と書かれたキーが配置されている．PC に繋ぐと外側の ALT と書かれた方のキーを ALT として認識する上に，HHK Lite 以前のモデルは外側の ALT の挙動をカスタマイズできないときた．泣ける．Sun の文化は知らないが，IBM PC の世界では ALT とは (以下略)．PC で HHK を使う連中は内側を ALT/META として使っていると信じて疑っていないのだがどうだろう．</p><p><br />
    
    
    

    
    
    

    
    
    

    
    
    
<div at:enclosure="asset" at:xid="6a00cdf39c8282cb8f00e398f46db70004" at:format="medium" at:align="right"
    class="enclosure enclosure-right enclosure-medium photo-enclosure" 
     style="text-align: center; float: right;">
<div class="enclosure-inner"
    
        style="padding: 9px; border: 1px solid; width: px; margin: 0 0 20px 20px;"
    >
    <div class="enclosure-list">
        <div class="enclosure-item photo-asset last">
    
            <div class="enclosure-image">
        
                <a href="http://kosugi-tomo.vox.com/library/photo/6a00cdf39c8282cb8f00e398f46db70004.html"><img src="http://a7.vox.com/6a00cdf39c8282cb8f00e398f46db70004-200pi" alt="MacBook" title="MacBook" /></a>
        
            </div>
            <div class="enclosure-meta">
                <div class="enclosure-asset-name"><a href="http://kosugi-tomo.vox.com/library/photo/6a00cdf39c8282cb8f00e398f46db70004.html" title="MacBook">MacBook</a></div>
            </div>
    
        </div>
    </div>
</div>
</div><!-- end enclosure -->



更に Mac が困る．最近の Mac のキーボードには Option キーに小さく &quot;alt&quot; と書かれているのだが，これは明らかに Cmd キーを META キーと見立てた Sun 系の流れを汲むもので，その ALT は ALT であって ALT ではない．にも関わらず Cmd キーに主要なショートカット (Cmd + C, X, V, W, N, O, P, Q, S, ...) を割り当てる Mac 文化のため，本来であれば Cmd に与えられるべき META の座が Option に追いやられてしまった．これが悲劇を生む．</p><p>大体，端末エミュレータや Emacs 系アプリを使っている時に Mac 由来の Cmd 系ショートカトを必要とすることなどまずない (いや，実は Cmd + V だけ微妙に要るかも…)．そういうアプリの利用時は Mac を Mac として使っているわけではないからだ．にも関わらず Terminal も iTerm も Eclipse も本来の Cmd バインドを優先して META を Option に追い遣ることしか考えていない．VMware Fusion が最悪で，ゲストで Windows を操作しているにも関わらず Option に Alt をマップしやがる!! 正気か?</p><p>一方，Carbon Emacs がデフォルトで Cmd を META に割り当てていて非常に助かっている．Cmd + V 問題は Kill-Ring をクリップボードと連動させることで回避していた．素晴らしい．そういえば Chicken of the VNC も Windows を操作する際に Cmd が Alt にマップされていたと記憶している．</p><p>META を Cmd に割り当てるべく iTerm をリビルドして使っている人もいるようだが，個人的には任意のアプリで Cmd と Option を入れ替えるようなユーティリティがあれば全て解決すると思う．どなたかご存知ないだろうか．</p>    <p style="clear:both;"> 
    <a href="http://kosugi-tomo.vox.com/library/post/alt-meta-and-cmd-keys.html?_c=feed-atom-full#comments">Read and post comments</a>   |   
    <a href="http://www.vox.com/share/6a00cdf39c8282cb8f00f48cf2db4c0002?_c=feed-atom-full">Send to a friend</a> 
</p>

                </div>
            ]]>
        </content> 
    <category term="keyboards mac" scheme="http://kosugi-tomo.vox.com/tags/keyboards+mac/" label="keyboards mac" /> 
    </entry> 
    
    <entry>
        <title>Link Manipulator</title>   
        <link rel="alternate" type="text/html" title="Link Manipulator" href="http://kosugi-tomo.vox.com/library/post/link-manipulator.html?_c=feed-atom-full" />  
        <link rel="service.post" type="application/atom+xml" title="Link Manipulator" href="http://kosugi-tomo.vox.com/library/post/link-manipulator.html?_c=feed-atom-full#comments" /> 
        <link rel="service.edit" type="application/atom+xml" title="Link Manipulator" href="http://www.vox.com/atom/svc=post/asset_id=6a00cdf39c8282cb8f00e398ca969f0003" />                <id>tag:vox.com,2007-12-22:asset-6a00cdf39c8282cb8f00e398ca969f0003</id>
        <published>2007-12-22T02:54:59Z</published>
        <updated>2007-12-22T16:48:21Z</updated>
    
        <author>
            <name>KOSUGI Tomo</name>
            <uri>http://kosugi-tomo.vox.com/?_c=feed-atom-full</uri>
        </author>
    
        
        <content type="html" xml:base="http://kosugi-tomo.vox.com/?_c=feed-atom-full">
            <![CDATA[
                <div xmlns="http://www.w3.org/1999/xhtml" xmlns:at="http://www.sixapart.com/ns/at">
        <p>きっかけは <a href="http://myminicity.com/">MyMiniCity</a> というサービスで，アクセス数に応じて自分の街が発展するという性質から Twitter 上にやたらと MyMiniCity へのリンクが貼られるようになった．個人的には興味がないのでスルーしていたが，そのうち巧妙な釣り文句と共に TinyURL を噛ませたリンクが貼られるようになって，迂闊に踏んでしまうとどうも悔しい．悔しいので対策することにした．</p>

    
    
    
<div at:enclosure="asset" at:xid="6a00cdf39c8282cb8f00e398ca8a810004" at:format="extra-large" at:align="center"
    class="enclosure enclosure-center enclosure-extra-large photo-enclosure" 
     style="text-align: center;">
<div class="enclosure-inner"
    
        style="padding: 9px; border: 1px solid; width: px; margin: 10px auto;"
    >
    <div class="enclosure-list">
        <div class="enclosure-item photo-asset last">
    
            <div class="enclosure-image">
        
                <a href="http://kosugi-tomo.vox.com/library/photo/6a00cdf39c8282cb8f00e398ca8a810004.html"><img src="http://a1.vox.com/6a00cdf39c8282cb8f00e398ca8a810004-500pi" alt="sample: a post includes link to MyMiniCity
" title="sample: a post includes link to MyMiniCity
" /></a>
        
            </div>
            <div class="enclosure-meta">
                <div class="enclosure-asset-name"><a href="http://kosugi-tomo.vox.com/library/photo/6a00cdf39c8282cb8f00e398ca8a810004.html" title="sample: a post includes link to MyMiniCity
">sample: a post includes link to MyMiniCity
</a></div>
            </div>
    
        </div>
    </div>
</div>
</div><!-- end enclosure -->

<p>TinyURL のリンクを自動 decode している人は多いと思うが，自分も <a href="http://kosugi-tomo.vox.com/library/post/tinyurl-decoder-1.html">自作 decoder</a> を利用しているので，別途ページ中のリンクを走査して MyMiniCity らしきリンクをどうにかする Greasemonkey script を書けば解決するだろう．サクっと書いた．</p>
<blockquote dir="ltr" style="MARGIN-RIGHT: 0px"><pre>// myminicity link detector<br />// (毎回 RegExp をコンパイルしているのは見逃して＞＜)<br />var anchors = node.getElementsByTagName(&#39;a&#39;);<br />for (var n = 0, len = anchors.length; n &lt; len; ++n) {<br />&#160; var anchor = anchors[n];<br />&#160; if (anchor.href.match(/^http:\/\/[^\.]+\.myminicity\.com\b/))<br />&#160;&#160;&#160; anchor.textContent = &#39;&lt;MyMiniCity Link&gt;&#39;;<br />}</pre></blockquote>
<p></p>

    
    
    
<div at:enclosure="asset" at:xid="6a00cdf39c8282cb8f00e398ca8eae0005" at:format="extra-large" at:align="center"
    class="enclosure enclosure-center enclosure-extra-large photo-enclosure" 
     style="text-align: center;">
<div class="enclosure-inner"
    
        style="padding: 9px; border: 1px solid; width: px; margin: 10px auto;"
    >
    <div class="enclosure-list">
        <div class="enclosure-item photo-asset last">
    
            <div class="enclosure-image">
        
                <a href="http://kosugi-tomo.vox.com/library/photo/6a00cdf39c8282cb8f00e398ca8eae0005.html"><img src="http://a6.vox.com/6a00cdf39c8282cb8f00e398ca8eae0005-500pi" alt="sample: a post applied the detector" title="sample: a post applied the detector" /></a>
        
            </div>
            <div class="enclosure-meta">
                <div class="enclosure-asset-name"><a href="http://kosugi-tomo.vox.com/library/photo/6a00cdf39c8282cb8f00e398ca8eae0005.html" title="sample: a post applied the detector">sample: a post applied the detector</a></div>
            </div>
    
        </div>
    </div>
</div>
</div><!-- end enclosure -->

<p>こいつを decoder script の後に動くようにしておけば偽装 MyMiniCity リンクもイチコロだぜ!! と思いきや，どうもうまく動かない．それもそのはずで，TinyURL decoder は tinyurl.com に対して decode 要求を行う際に GM_xmlhttpRequest による非同期通信を利用しており，decoder script が終了して更に myminicity link detector が終了してから実際の decode が行われる可能性もある．後続の処理を確実に動かすためには GM_xmlhttpRequest の onload ハンドラ内で行うしかないが，TinyURL decoder 内部に MyMiniCity 依存の処理を加えるのは気が引ける．</p>
<p>ところで，TinyURL 以外の URL 短縮サービスで MyMiniCity リンクが貼られることもあって，できればこれらも対応したい．最近は xrl.us という URL をよく見かける．他にも urltea.com, qurl.com, z.la など数えるとキリがないが，これらの中には明示的な decode 手段を用意していないものが多い．encode 用 API は用意されているが，decode はブラウザ任せとういか，実際に短縮 URL にリクエストしてみてリダイレクト時の location レスポンスヘッダを参照するしかない場合がある．GM_xmlhttpRequest は (自分の知る限り) リダイレクトに自動追随してしまうのでリダイレクト時の location レスポンスヘッダを参照することは恐らくできない．困ったものだ．</p>
<p>というか，decode API はともかく URL 短縮サービスは TinyURL のような Preview Mode を必ず備えているべきだと思うのだがどうよ．危なくね?</p>
<p>閑話休題，他の URL 短縮サービスに対応するとしても，要はどれもページ内のリンクを走査して何かを処理するというところは同じなので，その部分をうまく plugin 化できないものだろうか．AutoPagerize.addFilter のようにハンドラを登録して順次処理してくれる感じで．問題は前述の通り非同期処理を挟む可能性があるので単純にループでハンドラを回すだけでは目的は達成できない．</p>
<p>ハンドラが 3 つある場合は，このような処理をしたいわけだ: </p>
<blockquote dir="ltr" style="MARGIN-RIGHT: 0px"><pre>if (should_do_1) {<br />&#160; GM_xmlhttpRequest({<br />&#160;&#160;&#160; onload: function(r) {<br />&#160;&#160;&#160;&#160;&#160; do_1();<br />&#160;&#160;&#160;&#160;&#160; if (should_do_2) {<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; GM_xmlhttpRequest({<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; onload: function(r) {<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; do_2();<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; if (should_do_3) {<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; GM_xmlhttpRequest({<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; onload: function(r) {<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; do_3();</pre></blockquote>
<p>else の場合も同様に次のハンドラへ処理を渡す．</p>

    
    
    
<div at:enclosure="asset" at:xid="6a00cdf39c8282cb8f00e398ca7c220002" at:format="large" at:align="right"
    class="enclosure enclosure-right enclosure-large photo-enclosure" 
     style="text-align: center; float: right;">
<div class="enclosure-inner"
    
        style="padding: 9px; border: 1px solid; width: px; margin: 0 0 20px 20px;"
    >
    <div class="enclosure-list">
        <div class="enclosure-item photo-asset last">
    
            <div class="enclosure-image">
        
                <a href="http://kosugi-tomo.vox.com/library/photo/6a00cdf39c8282cb8f00e398ca7c220002.html"><img src="http://a2.vox.com/6a00cdf39c8282cb8f00e398ca7c220002-320pi" alt="sample: desirable execution order" title="sample: desirable execution order" /></a>
        
            </div>
            <div class="enclosure-meta">
                <div class="enclosure-asset-name"><a href="http://kosugi-tomo.vox.com/library/photo/6a00cdf39c8282cb8f00e398ca7c220002.html" title="sample: desirable execution order">sample: desirable execution order</a></div>
            </div>
    
        </div>
    </div>
</div>
</div><!-- end enclosure -->

<p>というわけで，できた．<br />ページ内のリンクを走査し，登録されたハンドラ群に処理を渡すだけの Link Manipulator と，Link Manipulator の plugin として動作する TinyURL decoder と xrl.us decoder (これらは一つにまとめた)，そして MyMiniCity のリンクを検出してアンカーテキストを置き換える detector を作った．detector は Twitter/Favotter 上で動作し，アンカーテキストを置き換えずに post そのものを非表示にすることもできる (今のところ要ソース修正 ;-)．decoder は xrl.us → TinyURL といった二重 decode にも一応対応した．もちろん AutoPagerize 対応．</p>
<ul>
<li><a href="http://phoneme.homelinux.org/gm/link-manipulator.user.js">Link Manipulator</a>&#160;(管理用 script. 必須)</li>
<li><a href="http://phoneme.homelinux.org/gm/LM/shorten-url-expander.user.js">Shorten URL Expander</a>&#160;(各種短縮 URL 展開 plugin)</li>
<li><a href="http://phoneme.homelinux.org/gm/LM/anti-myminicity.user.js">Anti MyMiniCity</a>&#160;(MyMiniCity リンク検出 plugin)</li></ul>
<p>非同期処理が前提なので，スクリプトの実行順序に対して sensitive なのが玉に瑕．AutoPagerize → Link Manipulator → plugin scripts の順で並んでいないと意図通りに動かない (間に別のスクリプトが入るのは問題ないが)．MyMiniCity のリンクをどうにかする場合は，事前に decoders を動かしておく必要がある．</p>
<p>TODO: </p>
<ul>
<li>decode 結果のキャッシュとクリア</li>
<li>plugin 毎に処理するノードをカスタマイズできないか</li>
<li>TinyURL, xrl.us 以外の短縮 URL 展開対応 → z.la に対応した (12/23)</li></ul>
<p>というか，いまさら TinyURL ネタかよ :-(</p>   <p style="clear:both;"> 
    <a href="http://kosugi-tomo.vox.com/library/post/link-manipulator.html?_c=feed-atom-full#comments">Read and post comments</a>   |   
    <a href="http://www.vox.com/share/6a00cdf39c8282cb8f00e398ca969f0003?_c=feed-atom-full">Send to a friend</a> 
</p>

                </div>
            ]]>
        </content> 
    <category term="greasemonkey" scheme="http://kosugi-tomo.vox.com/tags/greasemonkey/" label="greasemonkey" /> 
    <category term="twitter" scheme="http://kosugi-tomo.vox.com/tags/twitter/" label="twitter" /> 
    <category term="tinyurl" scheme="http://kosugi-tomo.vox.com/tags/tinyurl/" label="tinyurl" /> 
    </entry> 
    
    <entry>
        <title>Favotter Favor</title>   
        <link rel="alternate" type="text/html" title="Favotter Favor" href="http://kosugi-tomo.vox.com/library/post/favotter-favor.html?_c=feed-atom-full" />  
        <link rel="service.post" type="application/atom+xml" title="Favotter Favor" href="http://kosugi-tomo.vox.com/library/post/favotter-favor.html?_c=feed-atom-full#comments" /> 
        <link rel="service.edit" type="application/atom+xml" title="Favotter Favor" href="http://www.vox.com/atom/svc=post/asset_id=6a00cdf39c8282cb8f00e398c6b7fb0005" />            <id>tag:vox.com,2007-12-11:asset-6a00cdf39c8282cb8f00e398c6b7fb0005</id>
        <published>2007-12-11T03:51:31Z</published>
        <updated>2007-12-12T17:05:55Z</updated>
    
        <author>
            <name>KOSUGI Tomo</name>
            <uri>http://kosugi-tomo.vox.com/?_c=feed-atom-full</uri>
        </author>
    
        
        <content type="html" xml:base="http://kosugi-tomo.vox.com/?_c=feed-atom-full">
            <![CDATA[
                <div xmlns="http://www.w3.org/1999/xhtml" xmlns:at="http://www.sixapart.com/ns/at">
        <p><a href="http://favotter.matope.com/">
    
    
    
</a>
    
    
    

    
    
    

    
    
    
<div at:enclosure="asset" at:xid="6a00cdf39c8282cb8f00e398c6bea80003" at:format="small" at:align="right"
    class="enclosure enclosure-right enclosure-small photo-enclosure" 
     style="text-align: center; float: right;">
<div class="enclosure-inner"
    
        style="padding: 9px; border: 1px solid; width: px; margin: 0 0 20px 20px;"
    >
    <div class="enclosure-list">
        <div class="enclosure-item photo-asset last">
    
            <div class="enclosure-image">
        
                <a href="http://kosugi-tomo.vox.com/library/photo/6a00cdf39c8282cb8f00e398c6bea80003.html"><img src="http://a0.vox.com/6a00cdf39c8282cb8f00e398c6bea80003-120pi" alt="Favotter Favor: screenshot" title="Favotter Favor: screenshot" /></a>
        
            </div>
            <div class="enclosure-meta">
                <div class="enclosure-asset-name"><a href="http://kosugi-tomo.vox.com/library/photo/6a00cdf39c8282cb8f00e398c6bea80003.html" title="Favotter Favor: screenshot">Favotter Favor: screenshot</a></div>
            </div>
    
        </div>
    </div>
</div>
</div><!-- end enclosure -->



<a href="http://favotter.matope.com/">Favotter</a> 上から fav るための Greasemonkey Script. </p><p>install すると，favotter 上の各 post の下に星が出てきてクリックすると fav れる．既 fav かどうかは調べていないので，とりあえず全て白い星が表示される．fav った後は unfav もできる．</p><p>ついでに Twitter 上への permalink も設置する．</p><p>install: <a href="http://phoneme.homelinux.org/gm/favotter-favor.user.js">favotter-favor.user.js</a></p>   <p style="clear:both;"> 
    <a href="http://kosugi-tomo.vox.com/library/post/favotter-favor.html?_c=feed-atom-full#comments">Read and post comments</a>   |   
    <a href="http://www.vox.com/share/6a00cdf39c8282cb8f00e398c6b7fb0005?_c=feed-atom-full">Send to a friend</a> 
</p>

                </div>
            ]]>
        </content> 
    <category term="greasemonkey" scheme="http://kosugi-tomo.vox.com/tags/greasemonkey/" label="greasemonkey" /> 
    <category term="twitter" scheme="http://kosugi-tomo.vox.com/tags/twitter/" label="twitter" /> 
    </entry> 
    
    <entry>
        <title>Tinyurl Decoder</title>   
        <link rel="alternate" type="text/html" title="Tinyurl Decoder" href="http://kosugi-tomo.vox.com/library/post/tinyurl-decoder-1.html?_c=feed-atom-full" />  
        <link rel="service.post" type="application/atom+xml" title="Tinyurl Decoder" href="http://kosugi-tomo.vox.com/library/post/tinyurl-decoder-1.html?_c=feed-atom-full#comments" /> 
        <link rel="service.edit" type="application/atom+xml" title="Tinyurl Decoder" href="http://www.vox.com/atom/svc=post/asset_id=6a00cdf39c8282cb8f00e398a8cffa0005" />          <id>tag:vox.com,2007-09-15:asset-6a00cdf39c8282cb8f00e398a8cffa0005</id>
        <published>2007-09-15T12:19:49Z</published>
        <updated>2007-09-15T12:21:35Z</updated>
    
        <author>
            <name>KOSUGI Tomo</name>
            <uri>http://kosugi-tomo.vox.com/?_c=feed-atom-full</uri>
        </author>
    
        
        <content type="html" xml:base="http://kosugi-tomo.vox.com/?_c=feed-atom-full">
            <![CDATA[
                <div xmlns="http://www.w3.org/1999/xhtml" xmlns:at="http://www.sixapart.com/ns/at">
        <p>なんか，自分が AutoPagerize をインストールした数日後 (7/10) に新しいバージョンがリリースされていて，あまつさえ addFilter なんつー機能が増えているジャマイカ．なんてことに二ヶ月くらい気付かなかった．</p><p>ので de-tinyurl も追随しました．</p><p><a href="http://phoneme.homelinux.org/gm/detinyurl.user.js">detinyurl.user.js</a><br /><ul><li>AutoPagerize.addFilter を利用して，力技対応をやめた．</li><li>query string 付き URL の decode がおかしかったのを修正 (なぜ気付かない?</li></ul> </p>   <p style="clear:both;"> 
    <a href="http://kosugi-tomo.vox.com/library/post/tinyurl-decoder-1.html?_c=feed-atom-full#comments">Read and post comments</a>   |   
    <a href="http://www.vox.com/share/6a00cdf39c8282cb8f00e398a8cffa0005?_c=feed-atom-full">Send to a friend</a> 
</p>

                </div>
            ]]>
        </content> 
    <category term="url" scheme="http://kosugi-tomo.vox.com/tags/url/" label="url" /> 
    <category term="greasemonkey" scheme="http://kosugi-tomo.vox.com/tags/greasemonkey/" label="greasemonkey" /> 
    <category term="uri" scheme="http://kosugi-tomo.vox.com/tags/uri/" label="uri" /> 
    <category term="tinyurl" scheme="http://kosugi-tomo.vox.com/tags/tinyurl/" label="tinyurl" /> 
    <category term="autopagerize" scheme="http://kosugi-tomo.vox.com/tags/autopagerize/" label="autopagerize" /> 
    </entry> 
    
    <entry>
        <title>Ustream Watchlist View</title>   
        <link rel="alternate" type="text/html" title="Ustream Watchlist View" href="http://kosugi-tomo.vox.com/library/post/ustream-watchlist-view.html?_c=feed-atom-full" />  
        <link rel="service.post" type="application/atom+xml" title="Ustream Watchlist View" href="http://kosugi-tomo.vox.com/library/post/ustream-watchlist-view.html?_c=feed-atom-full#comments" /> 
        <link rel="service.edit" type="application/atom+xml" title="Ustream Watchlist View" href="http://www.vox.com/atom/svc=post/asset_id=6a00cdf39c8282cb8f00e3989774970005" />              <id>tag:vox.com,2007-07-26:asset-6a00cdf39c8282cb8f00e3989774970005</id>
        <published>2007-07-26T02:59:19Z</published>
        <updated>2007-07-26T03:10:24Z</updated>
    
        <author>
            <name>KOSUGI Tomo</name>
            <uri>http://kosugi-tomo.vox.com/?_c=feed-atom-full</uri>
        </author>
    
        
        <content type="html" xml:base="http://kosugi-tomo.vox.com/?_c=feed-atom-full">
            <![CDATA[
                <div xmlns="http://www.w3.org/1999/xhtml" xmlns:at="http://www.sixapart.com/ns/at">
        <p><a href="http://ustream.tv/">Ustream.tv</a> が流行っている．<a href="http://bulknews.net/tmp/ustream2.html">bulknews.net</a> や <a href="http://bulkneets.net/tmp/ustream2.html">bulkneets.net</a> が特殊な需要を喚起し，新ジャンル「他宅警備員」まで生まれる始末．周囲の Twitterist も，利権的にナニなものを垂れ流したり勤務中の姿を晒したりひたすらキーボードを打つ手元が映されたり (パスワードとか打ったらヤバくね!?)，今後の動向から目が離せない．</p>
    
    
    

    
    
    

    
    
    

    
    
    
<div at:enclosure="asset" at:xid="6a00cdf39c8282cb8f00e3989749fb0004" at:format="medium" at:align="right"
    class="enclosure enclosure-right enclosure-medium photo-enclosure" 
     style="text-align: center; float: right;">
<div class="enclosure-inner"
    
        style="padding: 9px; border: 1px solid; width: px; margin: 0 0 20px 20px;"
    >
    <div class="enclosure-list">
        <div class="enclosure-item photo-asset last">
    
            <div class="enclosure-image">
        
                <a href="http://kosugi-tomo.vox.com/library/photo/6a00cdf39c8282cb8f00e3989749fb0004.html"><img src="http://a3.vox.com/6a00cdf39c8282cb8f00e3989749fb0004-200pi" alt="Watchlist-view2" title="Watchlist-view2" /></a>
        
            </div>
            <div class="enclosure-meta">
                <div class="enclosure-asset-name"><a href="http://kosugi-tomo.vox.com/library/photo/6a00cdf39c8282cb8f00e3989749fb0004.html" title="Watchlist-view2">Watchlist-view2</a></div>
            </div>
    
        </div>
    </div>
</div>
</div><!-- end enclosure -->



    
    
    

    
    
    

    
    
    

    
    
    
<div at:enclosure="asset" at:xid="6a00cdf39c8282cb8f00e3989759000005" at:format="medium" at:align="right"
    class="enclosure enclosure-right enclosure-medium photo-enclosure" 
     style="text-align: center; float: right;">
<div class="enclosure-inner"
    
        style="padding: 9px; border: 1px solid; width: px; margin: 0 0 20px 20px;"
    >
    <div class="enclosure-list">
        <div class="enclosure-item photo-asset last">
    
            <div class="enclosure-image">
        
                <a href="http://kosugi-tomo.vox.com/library/photo/6a00cdf39c8282cb8f00e3989759000005.html"><img src="http://a0.vox.com/6a00cdf39c8282cb8f00e3989759000005-200pi" alt="Watchlist-view1" title="Watchlist-view1" /></a>
        
            </div>
            <div class="enclosure-meta">
                <div class="enclosure-asset-name"><a href="http://kosugi-tomo.vox.com/library/photo/6a00cdf39c8282cb8f00e3989759000005.html" title="Watchlist-view1">Watchlist-view1</a></div>
            </div>
    
        </div>
    </div>
</div>
</div><!-- end enclosure -->
<p>





まぁそれはさて置き，自分でも Ustream 向けの何か作ってみたくて手を動かしてみた．自分の Watchlist (の 1 ページ目) を他宅警備する Greasemonkey Script. インストールすると，ログイン中の Ustream に &quot;Watchlist View&quot; というメニューが表示されるので，押すと GM_xmlhttpRequest を使って自分の Watchlist ID 群を拾ってその場で Flash を並べる．</p><p><a href="http://phoneme.homelinux.org/gm/ustream.watchlist-view.user.js">ustream.watchlist-view.user.js</a><br />GM_xmlhttpRequest を使用しているので (いや，使用不使用に関わらず)，ソース熟読の上で利用されたい :P</p><p> といった矢先，Ustream のリニューアルと同時にアクセス制限が施された (というか，作成中にリニューアルされたので class や id 属性がいきなり変わってビビった)．今のところ，単一 IP アドレスから 4～5 streams しか開けないようだ．ちぇー．いきなり無意味になったし :-(．</p><p>いつぞやの Twitter のように劇的な負荷対策劇と共に制限を取っ払って欲しいと願ってやまない．ユーザは勝手なものだなぁ．</p><p>TODO<br /><ul><li>スライダー付けたい</li><li>制限食らった Flash は内蔵リロードボタンが効かないので別途リロードボタンを付けたい</li><li>&quot;Live!&quot; な show だけ表示するとか</li></ul> </p>   <p style="clear:both;"> 
    <a href="http://kosugi-tomo.vox.com/library/post/ustream-watchlist-view.html?_c=feed-atom-full#comments">Read and post comments</a>   |   
    <a href="http://www.vox.com/share/6a00cdf39c8282cb8f00e3989774970005?_c=feed-atom-full">Send to a friend</a> 
</p>

                </div>
            ]]>
        </content> 
    <category term="ustream greasemonkey firefox" scheme="http://kosugi-tomo.vox.com/tags/ustream+greasemonkey+firefox/" label="ustream greasemonkey firefox" /> 
    </entry> 
    
    <entry>
        <title>Greasemonkey script execution environment 2</title>   
        <link rel="alternate" type="text/html" title="Greasemonkey script execution environment 2" href="http://kosugi-tomo.vox.com/library/post/greasemonkey-script-execution-environment-2.html?_c=feed-atom-full" />  
        <link rel="service.post" type="application/atom+xml" title="Greasemonkey script execution environment 2" href="http://kosugi-tomo.vox.com/library/post/greasemonkey-script-execution-environment-2.html?_c=feed-atom-full#comments" /> 
        <link rel="service.edit" type="application/atom+xml" title="Greasemonkey script execution environment 2" href="http://www.vox.com/atom/svc=post/asset_id=6a00cdf39c8282cb8f00d41450cfb83c7f" />          <id>tag:vox.com,2007-07-22:asset-6a00cdf39c8282cb8f00d41450cfb83c7f</id>
        <published>2007-07-22T04:56:20Z</published>
        <updated>2007-07-24T03:51:49Z</updated>
    
        <author>
            <name>KOSUGI Tomo</name>
            <uri>http://kosugi-tomo.vox.com/?_c=feed-atom-full</uri>
        </author>
    
        
        <content type="html" xml:base="http://kosugi-tomo.vox.com/?_c=feed-atom-full">
            <![CDATA[
                <div xmlns="http://www.w3.org/1999/xhtml" xmlns:at="http://www.sixapart.com/ns/at">
        <p><a href="http://kosugi-tomo.vox.com/library/post/greasemonkey-script-execution-environment.html">前回</a>の続き．「初心者向け Javascript 勉強会」の Greasemonkey に関する資料が公開されているブログエントリの<a href="http://yoshiori.org/blog/2007/07/_javascript.php#comment-10252">コメント欄</a>にて補足的なやりとりが見られる．どうやら Greasemonkey から提供された window オブジェクトはスクリプト間で共有されるらしい．確認してみよう．ようやく Firebug の &quot;console&quot; を覚えたのでソレで．</p><blockquote><p>console.log(&#39;script a&#39;);<br />a = 10<br />window.b = 11;<br />if (typeof a != &#39;undefined&#39;) console.log(a);<br />if (typeof b != &#39;undefined&#39;) console.log(b);<br />if (typeof c != &#39;undefined&#39;) console.log(c);<br />if (typeof d != &#39;undefined&#39;) console.log(d);<br /></p></blockquote><p>もう一つ．</p><blockquote><p>console.log(&#39;script b&#39;);<br />c = 20;<br />window.d = 21;<br />if (typeof a != &#39;undefined&#39;) console.log(a);<br />if (typeof b != &#39;undefined&#39;) console.log(b);<br />if (typeof c != &#39;undefined&#39;) console.log(c);<br />if (typeof d != &#39;undefined&#39;) console.log(d);<br /></p></blockquote><p>コンソールには &quot;script 1&quot; → &quot;10&quot; → &quot;11&quot; → &quot;script 2&quot; → &quot;11&quot; → &quot;20&quot; → &quot;21&quot; の順で表示された．window オブジェクトに定義したプロパティが引き継がれていることが分かる．script 2 側で &quot;10&quot; が表示されていないことから，Global オブジェクト != window オブジェクトであることも分かる (スコープチェイン中で a が未定義であることが前提)．</p><p>で，ひとつ重要な事柄が．どうやら Opera の UserJS というもので Greasemonkey と似たようなことができるらしく，こちらでは機能が設けられた目的の違いから Greasemonkey のような保護が効かないようだ．つまり，<span style="color: #cc6600"><strong>スクリプトを Opera 対応させたい場合は匿名関数で wrap した方が良い</strong></span>，ということになる (その他，様々な cross browser hack も必要になるのだろう)．恐らく，スピーカの方もこの件を伝えたかったのだと思う．</p><p>以上，今朝 Twitter で「<a href="http://twitter.com/_tad_/statuses/161749032">グリモンスクリプト中の匿名関数は時代遅れのバッドノウハウ</a>」と，やや刺激的に紹介されてしまったのでビビって補足している次第 (まぁでも間違ってないよな)．ぶはは ;D</p>    <p style="clear:both;"> 
    <a href="http://kosugi-tomo.vox.com/library/post/greasemonkey-script-execution-environment-2.html?_c=feed-atom-full#comments">Read and post comments</a>   |   
    <a href="http://www.vox.com/share/6a00cdf39c8282cb8f00d41450cfb83c7f?_c=feed-atom-full">Send to a friend</a> 
</p>

                </div>
            ]]>
        </content> 
    <category term="javascript" scheme="http://kosugi-tomo.vox.com/tags/javascript/" label="javascript" /> 
    <category term="firefox" scheme="http://kosugi-tomo.vox.com/tags/firefox/" label="firefox" /> 
    <category term="greasemonkey" scheme="http://kosugi-tomo.vox.com/tags/greasemonkey/" label="greasemonkey" /> 
    <category term="twitter" scheme="http://kosugi-tomo.vox.com/tags/twitter/" label="twitter" /> 
    </entry> 
</feed>


