<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
   <title>Yusukebe::Tech</title>
   <link rel="alternate" type="text/html" href="http://yusukebe.com/tech/" />
   <link rel="self" type="application/atom+xml" href="http://yusukebe.com/tech/atom.xml" />
   <id>tag:yusukebe.com,2008:/tech//2</id>
   <updated>2008-03-10T15:23:45Z</updated>
   <subtitle>Perl勉強中 ツッコミ歓迎</subtitle>
   <generator uri="http://www.sixapart.com/movabletype/">Movable Type Publishing Platform 4.01</generator>


<entry>
   <title>myapp_server.pl をリバースプロキシの後ろに置くときは</title>
   <link rel="alternate" type="text/html" href="http://yusukebe.com/tech/archives/20080311/002345.html" />
   <id>tag:yusukebe.com,2008:/tech//2.2371</id>
   
   <published>2008-03-10T15:23:45Z</published>
   <updated>2008-03-10T15:23:45Z</updated>
   
   <summary> using_frontend_proxy: 1   をつけないとポート番号とかがuri_forででて嫌よ。   tomyhero++ ...</summary>
   <author>
      <name>yusukebe</name>
      <uri>http://yusukebe.com</uri>
   </author>
   <category term="catalyst" />
   
   <content type="html" xml:lang="ja" xml:base="http://yusukebe.com/tech/">
      <![CDATA[<pre>
using_frontend_proxy: 1
</pre>
<p>
  をつけないとポート番号とかがuri_forででて嫌よ。
  tomyhero++
</p>]]>
      
   </content>
</entry>

<entry>
   <title>Gearman を使って時間がかかる処理をキューにして worker にやらせてみた</title>
   <link rel="alternate" type="text/html" href="http://yusukebe.com/tech/archives/20080307/010509.html" />
   <id>tag:yusukebe.com,2008:/tech//2.2364</id>
   
   <published>2008-03-06T16:05:09Z</published>
   <updated>2008-03-06T16:05:09Z</updated>
   
   <summary>   Web から時間のかかる処理をキューとしてやらせたくて、TheSchwartz を使おうかと思っているが、   とりあえず Gearman で挙動を確かめ...</summary>
   <author>
      <name>yusukebe</name>
      <uri>http://yusukebe.com</uri>
   </author>
   <category term="gearman" />
   <category term="perl" />
   
   <content type="html" xml:lang="ja" xml:base="http://yusukebe.com/tech/">
      <![CDATA[<p>
  Web から時間のかかる処理をキューとしてやらせたくて、TheSchwartz を使おうかと思っているが、
  とりあえず Gearman で挙動を確かめてみた。
  といっても、ほとんど ZIGOROu さんのコードを参考にさせてもらいました
  →<a href="http://labs.cybozu.co.jp/blog/yamaguchi/2007/04/gearman.html">log4ZIGOROu : Gearmanを使ってみた</a>
  目的は時間のかかる処理を Gearman がキューとして受け付けて、順番に処理していく様子を眺めたかったので、
</p>
<ul>
  <li>worker は なんか文字列を受け取って、10秒待ってから、log.txt というファイルに受け取った文字列と共に今の時刻を追加で書き込む</li>
  <li>client は 実行されると dispatch_background メソッドを使って結果を受け取るのを待たずにタスクをディスパッチする。この場合にタスクへの引数は実行された時刻</li>
</ul>
<p>
  というサンプルにしてみた。まずは worker 。
</p>
<pre class="prettyprint">
!/usr/bin/perl

use strict;
use warnings;

use Gearman::Worker;
use Storable;
use IO::File;

my $worker = Gearman::Worker-&gt;new;
$worker-&gt;job_servers(qw|localhost|);
$worker-&gt;register_function(
    sum =&gt; sub {
        my $job = shift;
        sleep(10);
        &amp;work( $job-&gt;arg );
    }
);
$worker-&gt;work while 1;

sub work {
    my $client_time = shift;
    my $text        = &quot;client:$client_time worker:&quot; . time();
    my $io          = IO::File-&gt;new();
    $io-&gt;open( 'log.txt', 'a' ) or die $!;
    $io-&gt;print(&quot;$text\n&quot;);
    $io-&gt;close;
}

</pre>
<p>
  次に client のソース。
</p>
<pre class="prettyprint">
#!/usr/bin/perl

use strict;
use warnings;

use Gearman::Client;
use Gearman::Task;

my $client = Gearman::Client-&gt;new;
$client-&gt;job_servers(qw|localhost|);

$client-&gt;dispatch_background( &quot;sum&quot;, time(), {} );

</pre>
<p>
  gearmand を立ち上げて、worker も実行。
  そんでおもむろに client を適当に連射。
  するとちゃんとキューとして受け付けて10秒待ってから書き込んでくれてる様子。
</p>

<pre class="prettyprint">
client:1204818581 worker:1204818591
client:1204818599 worker:1204818609 #連射スタート
client:1204818600 worker:1204818619
client:1204818601 worker:1204818629
client:1204818601 worker:1204818639
client:1204818602 worker:1204818649
client:1204818602 worker:1204818659
client:1204818603 worker:1204818669
client:1204818668 worker:1204818679 #連射終わる
client:1204818715 worker:1204818725
</pre>
<p>
  次は TheSchwartz を使ってみる。
</p>]]>
      
   </content>
</entry>

<entry>
   <title>Imager::DTPの縦書きにおける「ー」問題のその場しのぎ的対処</title>
   <link rel="alternate" type="text/html" href="http://yusukebe.com/tech/archives/20080221/124041.html" />
   <id>tag:yusukebe.com,2008:/tech//2.2359</id>
   
   <published>2008-02-21T03:40:41Z</published>
   <updated>2008-02-21T03:40:41Z</updated>
   
   <summary>   Imager::DTPの縦書きは便利だけど「ー」がうまく「｜」の方向になってくれない。   なので回転させてリフレクトさせた。   場所がずれるのでかなり...</summary>
   <author>
      <name>yusukebe</name>
      <uri>http://yusukebe.com</uri>
   </author>
   <category term="imager" />
   <category term="perl" />
   
   <content type="html" xml:lang="ja" xml:base="http://yusukebe.com/tech/">
      <![CDATA[<p>
  Imager::DTPの縦書きは便利だけど「ー」がうまく「｜」の方向になってくれない。
  なので回転させてリフレクトさせた。
  場所がずれるのでかなり適当に調整、ぶっちゃけ勘＞＜
  ちなみに<a href="http://serif.hatelabo.jp/bc8f7f7cc511e49477ac52273262f506da1a03fa/a976880dfa64d385f420c439a3f9db309f7f7468">こんな問題</a>です。
</p>

<pre class="prettyprint">
--- Letter.pm.org       2008-02-21 00:36:56.000000000 +0900
+++ Letter.pm   2008-02-21 12:29:39.000000000 +0900
@@ -4,6 +4,7 @@
 use Imager;
 use Imager::Matrix2d;
 use vars qw($VERSION);
+use utf8;

 $VERSION = '0.05';

@@ -67,12 +68,28 @@
                $self-&gt;getFont()-&gt;transform(matrix=&gt;$m);
        }
        # draw letter - using Imager::String method
+       my $font = $self-&gt;getFont;
+       my $x = $o{x} + $self-&gt;getLeftBearing();
+       my $y = $o{y} + $self-&gt;getGlobalAscent() - $self-&gt;getAscent();
+       if($self-&gt;getText() eq &quot;ー&quot; ){
+           my $m1 = Imager::Matrix2d-&gt;rotate(degrees =&gt; 270);
+           my $m2 = Imager::Matrix2d-&gt;reflect(axis =&gt; 'x');
+           my $matrix = $m1 * $m2;
+           $font-&gt;transform(matrix =&gt; $matrix);
+           my $bbox = $font-&gt;bounding_box( string =&gt; $self-&gt;getText(),
+                                           size=&gt;$font-&gt;{size});
+           $x = $x + $bbox-&gt;total_width / 2;
+           $y = $y - $self-&gt;getAscent() + $self-&gt;getAscent() / 4;
+       }else{
+           my $matrix = Imager::Matrix2d-&gt;rotate(degrees =&gt; 0);
+            $font-&gt;transform(matrix =&gt; $matrix);
+       }
        $o{target}-&gt;string(
                %{$o{others}},
-               x =&gt; $o{x} + $self-&gt;getLeftBearing(),
-               y =&gt; $o{y} + $self-&gt;getGlobalAscent() - $self-&gt;getAscent(),
+               x =&gt; $x,
+               y =&gt; $y,
                text =&gt; $self-&gt;getText(),
-               font =&gt; $self-&gt;getFont(),
+               font =&gt; $font,
                utf8 =&gt; 1, vlayout =&gt; 0, align =&gt; 0
        ) or die $o{target}-&gt;errstr;
        # draw baseline position - for debug

</pre>]]>
      
   </content>
</entry>

<entry>
   <title>yourfilehostの裏API</title>
   <link rel="alternate" type="text/html" href="http://yusukebe.com/tech/archives/20071227/013225.html" />
   <id>tag:yusukebe.com,2007:/tech//2.2312</id>
   
   <published>2007-12-26T16:32:25Z</published>
   <updated>2007-12-26T16:32:25Z</updated>
   
   <summary>   yourfilehostには非公開の裏APIがあって、それを利用すると主に動画のサムネイルがとってこれて便利。   動画、例えばURLだと http://...</summary>
   <author>
      <name>yusukebe</name>
      <uri>http://yusukebe.com</uri>
   </author>
   <category term="hacks" />
   <category term="module" />
   <category term="perl" />
   <category term="yourfilehost" />
   
   <content type="html" xml:lang="ja" xml:base="http://yusukebe.com/tech/">
      <![CDATA[<p>
  yourfilehostには非公開の裏APIがあって、それを利用すると主に動画のサムネイルがとってこれて便利。
  動画、例えばURLだと
</p>
<pre>
http://www.yourfilehost.com/media.php?cat=video&file=guns_dont_kill_people.flv
</pre>
<p>
  というのがあるとする。そこにアクセスしてHTMLを覗く。
  Flashの動画プレーヤーに引数を渡しているobjectタグの子要素paramタグでname属性がmovieのvalue属性値にヒントがみつかった。
  そこが query param 形式になっていてるので、video= から始まるqueryをとってきて逆にdecodeしてみると、長いが
</p>
<pre>
http://www.yourfilehost.com/video-embed.php?vidlink=&cid=a5f6dd20981c6b3a69e949b289613b07&adult=&cat=video&file=guns_dont_kill_people.flv&family=off&videoembed_id=http://liveu-s-64.vo.llnwd.net/yourfilehost/unit1/flash8/a5/a5f6dd20981c6b3a69e949b289613b07.flv?e=1198692000&rs=50&ri=768&h=0b513647b3d06f0eabfea8987d10dbed
</pre>
<p>
  というURLになる。ここがAPIのアクセスポイント。
  ここにアクセスしてみると、query param 形式でいろいろとその動画の情報を取得できる。
  photo=**********.jpg というのもあってサムネイルのURLもとってこれる！
  Web::Scraperでスクレイプして、CGIモジュールで解析するのがおそらくスマート。
  でもいちいちやってたらめんどいので、モジュール作りました。
  テストをworemacxさんに書いてもらったよ。woremacx++;
  以下にソースを張っておきます＆CodeReposのここに置いておく→
  <a href="http://coderepos.org/share/browser/lang/perl/WWW-YourFileHost">/lang/perl/WWW-YourFileHost - CodeRepos::Share - Trac</a>
</p>

<pre class="prettyprint">
package WWW::YourFileHost;

use warnings;
use strict;
use Carp;
use URI;
use Web::Scraper;
use URI::Escape;
use LWP::UserAgent;
use CGI;

our $VERSION = '0.01';

sub new {
    my ( $class, %opt ) = @_;
    my $self = bless { %opt }, $class;
    $self-&gt;_scrape;
    $self;
}

sub _scrape {
    my $self = shift;
    my $url = $self-&gt;{url} || croak &quot;url param is requred&quot;;
    croak &quot;url is not yourfilehost link&quot;
    unless $url =~ m!yourfilehost.com/media.php\?!;

    my $s = scraper {
    process '//object[@id=&quot;objectPlayer&quot;]' =&gt;
        process '//param[@name=&quot;movie&quot;]', 'value' =&gt; '@value';
    };

    my $res = $s-&gt;scrape( URI-&gt;new($url) );
    croak &quot;video information is not found&quot; unless $res-&gt;{value};
    $res-&gt;{value} =~ m/&amp;video=(.*?)&amp;/;
    my $api_url = uri_unescape($1);
    
    my $ua = LWP::UserAgent-&gt;new();
    $res = $ua-&gt;get($api_url);
    croak &quot;&quot; unless $res-&gt;is_success;
    my $query = CGI-&gt;new($res-&gt;content);
    $self-&gt;{query} = $query;
}

sub photo {
    my $self = shift;
    return $self-&gt;{query}-&gt;param(&quot;photo&quot;);
}

sub video_id {
    my $self = shift;
    return $self-&gt;{query}-&gt;param(&quot;video_id&quot;);
}

sub embed {
    my $self = shift;
    return $self-&gt;{query}-&gt;param(&quot;embed&quot;);
}

1;

__END__

=head1 NAME

WWW::YourFileHost - Get video informations from YourFileHost

=head1 VERSION

This document describes WWW::YourFileHost version 0.0.1

=head1 SYNOPSIS

    use WWW::YourFileHost;

    my $url = 
    &quot;http://www.yourfilehost.com/media.php?cat=video&amp;file=hoge.wmv&quot;;
    my $yourfilehost = WWW::YourFileHost-&gt;new( url =&gt; $url );
    print $yourfilehost-&gt;photo . &quot;\n&quot;;
    print $yourfilehost-&gt;video_id . &quot;\n&quot;;
    print $yourfilehost-&gt;embed . &quot;\n&quot;;

=head1 AUTHOR

Yusuke Wada  C&lt;&lt; &lt;yusuke (at) kamawada.com&gt; &gt;&gt;


=head1 LICENCE AND COPYRIGHT

Copyright (c) 2007, Yusuke Wada C&lt;&lt; &lt;yusuke@kamawada.com&gt; &gt;&gt;. All rights reserved.

This module is free software; you can redistribute it and/or
modify it under the same terms as Perl itself. See L&lt;perlartistic&gt;.

</pre>]]>
      
   </content>
</entry>

<entry>
   <title>PerlでYouTubeのGData検索をする</title>
   <link rel="alternate" type="text/html" href="http://yusukebe.com/tech/archives/20071217/214419.html" />
   <id>tag:yusukebe.com,2007:/tech//2.2303</id>
   
   <published>2007-12-17T12:44:19Z</published>
   <updated>2007-12-17T12:44:19Z</updated>
   
   <summary>   CDTubeのYouTue検索は正規表現のスクレイピングで対応していたが、   HTMLの構造が変わったのか、とってこれなくなった。   よってGData...</summary>
   <author>
      <name>yusukebe</name>
      <uri>http://yusukebe.com</uri>
   </author>
   <category term="per" />
   <category term="youtube" />
   
   <content type="html" xml:lang="ja" xml:base="http://yusukebe.com/tech/">
      <![CDATA[<p>
  CDTubeのYouTue検索は正規表現のスクレイピングで対応していたが、
  HTMLの構造が変わったのか、とってこれなくなった。
  よってGDataに移行。
  APIキーなくても情報をとってこれるんだね。例
</p>
<pre class="prettyprint">
#!/usr/bin/perl

use strict;
use warnings;
use utf8;
use URI::Escape;
use XML::Atom::Feed;
use URI;

my $query = &quot;ダーリン 桑田 佳祐&quot;;
my $url = &quot;http://gdata.youtube.com/feeds/api/videos?vq=&quot; .
    URI::Escape::uri_escape_utf8($query);
my $feed = XML::Atom::Feed-&gt;new(URI-&gt;new($url));
my @entries = $feed-&gt;entries;
die &quot;&quot; unless $entries[0];
my $video_id;
foreach my $link ( $entries[0]-&gt;link ) {
    my $href = $link-&gt;href;
    if($href =~ m!www.youtube.com/watch\?v=(.*)$!){
        $video_id = $1;
    }
}

print $video_id;

</pre>
]]>
      
   </content>
</entry>

<entry>
   <title>はてなハイク + Web::Scraper</title>
   <link rel="alternate" type="text/html" href="http://yusukebe.com/tech/archives/20071214/004933.html" />
   <id>tag:yusukebe.com,2007:/tech//2.2300</id>
   
   <published>2007-12-13T15:49:33Z</published>
   <updated>2007-12-13T15:49:33Z</updated>
   
   <summary>   はてなハイクのユーザーになれないから嫉妬している。   PlaggerのEFTも書きたい。 use Web::Scraper; use URI; use ...</summary>
   <author>
      <name>yusukebe</name>
      <uri>http://yusukebe.com</uri>
   </author>
   
   <content type="html" xml:lang="ja" xml:base="http://yusukebe.com/tech/">
      <![CDATA[<p>
  <del>はてなハイクのユーザーになれないから嫉妬している。</del>
  PlaggerのEFTも書きたい。
</p>
<pre class="prettyprint">
use Web::Scraper;
use URI;
use YAML;

my $url = shift || &quot;http://h.hatena.ne.jp/&quot;;
my $entries = scraper {
    process 'li.entry', 'entries[]' =&gt; scraper {
        process 'div.title', 'title' =&gt; 'TEXT';
        process 'span.username &gt; a', 'username' =&gt; 'TEXT';
        process 'span.timestamp &gt; a', 'timestamp' =&gt; 'TEXT', permalink =&gt; '@href';
    };
    result 'entries';
}-&gt;scrape(URI-&gt;new($url));

print Dump($entries);

</pre>]]>
      
   </content>
</entry>

<entry>
   <title>はてなグループの管理画面参加者一覧から参加人数を数えるJavaScript</title>
   <link rel="alternate" type="text/html" href="http://yusukebe.com/tech/archives/20071129/023628.html" />
   <id>tag:yusukebe.com,2007:/tech//2.2282</id>
   
   <published>2007-11-28T17:36:28Z</published>
   <updated>2007-11-28T17:36:28Z</updated>
   
   <summary>   born1981のユーザー数がやたら増えてきて目で数えられないので書いた。 var num = 0; var elements = document.ge...</summary>
   <author>
      <name>yusukebe</name>
      <uri>http://yusukebe.com</uri>
   </author>
   <category term="javascript" />
   
   <content type="html" xml:lang="ja" xml:base="http://yusukebe.com/tech/">
      <![CDATA[<p>
  born1981のユーザー数がやたら増えてきて目で数えられないので書いた。
</p>
<pre class="prettyprint">
var num = 0; var elements = document.getElementsByTagName(&quot;input&quot;); for(var i=0;i&lt;elements.length;i++){ if(elements[i].getAttribute('type') == 'submit'){ num++} }; alert(num);
</pre>]]>
      
   </content>
</entry>

<entry>
   <title>Filter-FindEnclosures/veoh.pl</title>
   <link rel="alternate" type="text/html" href="http://yusukebe.com/tech/archives/20071127/205601.html" />
   <id>tag:yusukebe.com,2007:/tech//2.2278</id>
   
   <published>2007-11-27T11:56:01Z</published>
   <updated>2007-11-27T11:56:01Z</updated>
   
   <summary>   さっき書いたスクリプトを参考にVeohのURLからFLVのパスをEnclosureにセットするPlaggerのassets。CodeReposにうｐした→...</summary>
   <author>
      <name>yusukebe</name>
      <uri>http://yusukebe.com</uri>
   </author>
   <category term="plagger" />
   
   <content type="html" xml:lang="ja" xml:base="http://yusukebe.com/tech/">
      <![CDATA[<p>
  さっき書いたスクリプトを参考にVeohのURLからFLVのパスをEnclosureにセットするPlaggerのassets。CodeReposにうｐした→
  <a href="http://coderepos.org/share/browser/lang/perl/plagger/assets/plugins/Filter-FindEnclosures/veoh.pl">/lang/perl/plagger/assets/plugins/Filter-FindEnclosures/veoh.pl - CodeRepos::Share - Trac</a>。
</p>
<pre class="prettyprint">
# author: yusukebe

sub handle {
    my ($self, $url) = @_;
    $url =~ qr!http://www.veoh.com/videos/.*!;
}

sub find {
    my ($self, $args) = @_;
    my $id = $args-&gt;{url} =~ qr!videos/(.*)! ? $1 : &quot;&quot;;
    $id = $1 if $id  =~ /(.*)\?/;
    return unless $id;
    my $ua = Plagger::UserAgent-&gt;new;
    my $url = &quot;http://www.veoh.com/rest/video/$id/details&quot;;
    my $res = $ua-&gt;fetch($url);
    return if $res-&gt;is_error;
    my $content = $res-&gt;content;
    $content =~ /fullPreviewHashPath=&quot;(.*?)&quot;/;
    my $enclosure = Plagger::Enclosure-&gt;new;
    $enclosure-&gt;url($1);
    $enclosure-&gt;type('video/flv');
    $enclosure-&gt;filename(&quot;$id.flv&quot;);
    return $enclosure;
}

</pre>
]]>
      
   </content>
</entry>

<entry>
   <title>VeohのFLVをダウンロードするPerlスクリプト</title>
   <link rel="alternate" type="text/html" href="http://yusukebe.com/tech/archives/20071127/173908.html" />
   <id>tag:yusukebe.com,2007:/tech//2.2276</id>
   
   <published>2007-11-27T08:39:08Z</published>
   <updated>2007-11-27T08:39:08Z</updated>
   
   <summary>   Veohって動画共有サイトのビデオ、FLVファイルをダウンロードするスクリプト書いた。   「google videoやyoutubeとかの動画を落として...</summary>
   <author>
      <name>yusukebe</name>
      <uri>http://yusukebe.com</uri>
   </author>
   
   <content type="html" xml:lang="ja" xml:base="http://yusukebe.com/tech/">
      <![CDATA[<p>
  <a href="http://www.veoh.com/">Veoh</a>って動画共有サイトのビデオ、FLVファイルをダウンロードするスクリプト書いた。
  「<a href="http://hanagasira.s25.xrea.com/php/video.php">google videoやyoutubeとかの動画を落として保存。</a>」ってサイトがソース公開という神なことをしてくれていたので、解析する手間が省けた。どうもです。
  これからPlaggerのFilter-FindEnclosuresのassetsを書く予定。
</p>
<pre class="prettyprint">
#!/usr/bin/perl

use strict;
use warnings;
use LWP::UserAgent;
use HTTP::Request;

my $url = $ARGV[0];
my ( $id, $flv_url, $file_name );
$id = $1 if $url =~ m|videos/(.*)|;
$id = $1 if $id  =~ /(.*)\?/;
die unless $id;

my $ua       = LWP::UserAgent-&gt;new( keep_alive =&gt; 1 );
my $rest_url = &quot;http://www.veoh.com/rest/video/$id/details&quot;;
my $content  = $ua-&gt;get($rest_url)-&gt;content;
$flv_url = $1 if $content =~ /fullPreviewHashPath=&quot;(.*?)&quot;/;
return unless $flv_url;
warn &quot;$url =&gt; $id.flv\n&quot;;
$ua-&gt;request( HTTP::Request-&gt;new( GET =&gt; $flv_url ), &quot;$id.flv&quot; );

</pre>]]>
      
   </content>
</entry>

<entry>
   <title>YAML.pmはマージがきかない</title>
   <link rel="alternate" type="text/html" href="http://yusukebe.com/tech/archives/20071106/143738.html" />
   <id>tag:yusukebe.com,2007:/tech//2.2261</id>
   
   <published>2007-11-06T05:37:38Z</published>
   <updated>2007-11-06T05:38:43Z</updated>
   
   <summary>   YAML.pm は Merge Key に対応してない。   おそらく、YAML1.0 spec だからだと思われる。   YAML の Merge Ke...</summary>
   <author>
      <name>yusukebe</name>
      <uri>http://yusukebe.com</uri>
   </author>
   <category term="cpan" />
   <category term="yaml" />
   
   <content type="html" xml:lang="ja" xml:base="http://yusukebe.com/tech/">
      <![CDATA[<p>
  YAML.pm は Merge Key に対応してない。
  おそらく、YAML1.0 spec だからだと思われる。
  YAML の Merge Key については以下を参照。
</p>
<ul>
  <li><a href="http://yaml.org/type/merge.html">Merge Key Language-Independent Type for YAML?Version?1.1</a></li>
  <li><a href="http://redhanded.hobix.com/bits/yamlSMergeKey.html">RedHanded ≫ YAML's Merge Key</a></li>
</ul>]]>
      
   </content>
</entry>

<entry>
   <title>iPod用h264を作るときのdebian(？)等のffmpegのオプションは -vlevel じゃなくて -level</title>
   <link rel="alternate" type="text/html" href="http://yusukebe.com/tech/archives/20071104/221216.html" />
   <id>tag:yusukebe.com,2007:/tech//2.2257</id>
   
   <published>2007-11-04T13:12:16Z</published>
   <updated>2007-11-04T15:25:15Z</updated>
   
   <summary>   iPod toch 向けにffmpegを使用しH.264の映像作って、転送しようと思ったら、全部 iTunes に怒られてどうしたもんだなと思ったら、同じ...</summary>
   <author>
      <name>yusukebe</name>
      <uri>http://yusukebe.com</uri>
   </author>
   <category term="ffmpeg" />
   
   <content type="html" xml:lang="ja" xml:base="http://yusukebe.com/tech/">
      <![CDATA[<p>
  iPod toch 向けにffmpegを使用しH.264の映像作って、転送しようと思ったら、全部 iTunes に怒られてどうしたもんだなと思ったら、同じように悩んでいる人がいた。
</p>
<ul>
  <li><a href="http://d.hatena.ne.jp/shimibow/20060914/1158237089">P::P::Filter::FFmpegでエンコードした動画がiTunes 7でiPodへ転送できない - SHIMIBOW’S HATENA DIARY</a></li>
</ul>
<p>
  なるほど、-coder 0 -vlevel 13 というオプションが必要なんだな。
  ところが、<a href="http://www.debian-multimedia.org/">debian-multimedia</a>経由で入れたdebianのFFmpegでは vlevel というオプションがないといわれる。
  で、いろいろ調べた結果。-vlevel じゃなくて -level でいいらしい。
</p>
<pre>
 -coder 0 -level 13 
</pre>
<p>
  これで、無事 iPod touch でH264見れました。
</p>]]>
      
   </content>
</entry>

<entry>
   <title>もってけエロYAML</title>
   <link rel="alternate" type="text/html" href="http://yusukebe.com/tech/archives/20071019/185159.html" />
   <id>tag:yusukebe.com,2007:/tech//2.2238</id>
   
   <published>2007-10-19T09:51:59Z</published>
   <updated>2007-10-19T09:53:03Z</updated>
   
   <summary>   CodeReposの   lang/perl/plagger/assets/plugins/Filter-EntryFullText/   以下に、エロY...</summary>
   <author>
      <name>yusukebe</name>
      <uri>http://yusukebe.com</uri>
   </author>
   <category term="coderepos" />
   <category term="plagger" />
   
   <content type="html" xml:lang="ja" xml:base="http://yusukebe.com/tech/">
      <![CDATA[<p>
  CodeReposの
</p>
<blockquote>
  lang/perl/plagger/assets/plugins/Filter-EntryFullText/
</blockquote>
<p>
  以下に、エロYAMLあげたよ。
  Browseだとここ→<a href="http://coderepos.org/share/browser/lang/perl/plagger/assets/plugins/Filter-EntryFullText">/lang/perl/plagger/assets/plugins/Filter-EntryFullText - CodeRepos::Share - Trac</a>
</p>]]>
      
   </content>
</entry>

<entry>
   <title>KwikiでKwiki::HatenaAuthなどを使う時の注意</title>
   <link rel="alternate" type="text/html" href="http://yusukebe.com/tech/archives/20070929/155657.html" />
   <id>tag:yusukebe.com,2007:/tech//2.2219</id>
   
   <published>2007-09-29T06:56:57Z</published>
   <updated>2007-09-29T06:58:02Z</updated>
   
   <summary>   ErogeekのHPをKwikiで作ってるんだけど、   Kwiki::HatenaAuthとかではまる点がいくつかあったのでメモ。   Yappoさんに...</summary>
   <author>
      <name>yusukebe</name>
      <uri>http://yusukebe.com</uri>
   </author>
   <category term="kwiki" />
   <category term="perl" />
   
   <content type="html" xml:lang="ja" xml:base="http://yusukebe.com/tech/">
      <![CDATA[<p>
  <a href="http://erogeek.org/">ErogeekのHP</a>をKwikiで作ってるんだけど、
  Kwiki::HatenaAuthとかではまる点がいくつかあったのでメモ。
  Yappoさんにいろいろ教えてもらいました。yappo++
</p>
<p>
  まず、Kwiki::HatenaAuthを使う場合は、Kwiki::Theme::Hatenaを使った方が無難。
  次に、Kwiki::Edit::HatenaAuthRequiredを有効にしたい場合、
  config.yamlに必ず
</p>
<pre>
hatenaauth_required_pages:
- hoge
</pre>
<p>
  というようにhatenaauth_required_pagesを設定しておかないとエラーがでる。
  yamlの書き方は「-」の先頭には空白があってはいけない。
  ちなみにこれで指定したページは、はてな認証でログインした状態では<b>なく</b>てもEditできるという意味。俺は逆に捉えていた。
</p>
<p>
  また、Hatena仕様にしてかつKwiki::CoolURIを使ったときに、日本語のタイトルページを作ると、
  本文だけが文字化けるという現象が起こる。これは、何故か、はてなキーワードを本文の中に入れると解決する。いろいろバッドノウハウがあるがKwikiはなかなか楽しい。
</p>]]>
      
   </content>
</entry>

<entry>
   <title>ImagerでRGBの画像をグレースケール(モノクロ調)に変換する</title>
   <link rel="alternate" type="text/html" href="http://yusukebe.com/tech/archives/20070920/165941.html" />
   <id>tag:yusukebe.com,2007:/tech//2.2211</id>
   
   <published>2007-09-20T07:59:41Z</published>
   <updated>2007-09-20T08:00:46Z</updated>
   
   <summary>   自分用メモ。   簡単っぽいんだけど、やり方がわからなくて、やっとできた。   ImagerでRGBの画像をモノクロ調に変換するやりかた。   こんだけ。...</summary>
   <author>
      <name>yusukebe</name>
      <uri>http://yusukebe.com</uri>
   </author>
   <category term="imager" />
   <category term="perl" />
   
   <content type="html" xml:lang="ja" xml:base="http://yusukebe.com/tech/">
      <![CDATA[<p>
  自分用メモ。
  簡単っぽいんだけど、やり方がわからなくて、やっとできた。
  ImagerでRGBの画像をモノクロ調に変換するやりかた。
  こんだけ。
</p>
<pre class="prettyprint">
#!/usr/bin/perl
use strict;
use warnings;
use Imager;

my $file = 'picture.jpg';
my $image = Imager-&gt;new-&gt;read(file =&gt; $file);
$image = $image-&gt;convert(preset=&gt;'grey');
$image-&gt;write(file =&gt; 'output.jpg');

</pre>]]>
      
   </content>
</entry>

<entry>
   <title>URIの正規化</title>
   <link rel="alternate" type="text/html" href="http://yusukebe.com/tech/archives/20070916/195156.html" />
   <id>tag:yusukebe.com,2007:/tech//2.2202</id>
   
   <published>2007-09-16T10:51:56Z</published>
   <updated>2007-09-16T13:42:52Z</updated>
   
   <summary>   ドメイン名そのものだったり拡張子がついていないURLがある。   そして、その中でも末尾に「/」がついていないものに「/」をつけたい。   例えば、 ht...</summary>
   <author>
      <name>yusukebe</name>
      <uri>http://yusukebe.com</uri>
   </author>
   <category term="cpan" />
   <category term="perl" />
   <category term="uri" />
   
   <content type="html" xml:lang="ja" xml:base="http://yusukebe.com/tech/">
      <![CDATA[<p>
  ドメイン名そのものだったり拡張子がついていないURLがある。
  そして、その中でも末尾に「/」がついていないものに「/」をつけたい。
</p>
<p>
  例えば、
</p>
<pre>
http://www.perl.com
</pre>
<p>
  を
</p>
<pre>
http://www.perl.com/
</pre>
<p>
  という具合に。こういうのをURIの正規化と呼ぶのかな？
  Perlでそれをやる場合はURIモジュールでできる。
</p>
<pre class="prettyprint">
my $u = URI-&gt;new(&quot;http://www.perl.com&quot;);
print $u-&gt;canonical;
# result : http://www.perl.com/
</pre>]]>
      
   </content>
</entry>

</feed>