rubykaigi lightning talks twym episode2
DESCRIPTION
Ruby会議2009 Lightning Talks 前説 IRC メッセージ表示機能付きタイマー "TwYM" ( 日本語 + English )TRANSCRIPT
Kuniaki IGARASHI/igaiga2009.7.18 @日本Ruby会議’09
Lightning Talkswarm-up (episode 2)
前説 (後編)
自己紹介self-introduction
LT応募
I put up LT submission,
LTRejectbut it was rejected.
orzSIGH...
中の人から
メールI got a mail from staff.
タイマー運営したら前説で2分半x2日
時間をやろう“We would give you 2'30"
talk on 2 dayson timer administration.”
\ よろこんで!! /
\ Yes,sir!! /
前説2日目←イマココ
Hence the talk in today too.←Here and now
いがいが高専カンファレンス運営してます。
twitter:igaiga555
LTタイマー運営係, 前説係I’m igaiga,
LT Timer operator,here for warm up talk.
最初に大事なことFirst, I’m talking
the most important thing.
Special Thanks toSASADA Koichiさん
よしだむさんあまのりょーさん
咳さんmootohさん
さとうようぞうさんTimer作成でお世話になりました
もう1つ
and,
高専関係者以外でも参加OK!基調講演人工衛星開発新規人工塩基対創製
高専Conferencein Tokyo 2009.11.7
Keynote speechArtificial satellite developmentCreation of Unnatural Base Pairs of DNA
昨日のおさらい
Let’s look back overthings in yesterday.
タイマーつくりましたTwYM
Timer with Your Messageshttp://code.google.com/p/twym/
I made the timernamed “TwYM”.
IRC messages を表示
TimerIRC/ustreammessages
The main feature isdisplaying IRC messages.
(・∀・)イイ!時は★ or ☆ or *starを文中に入れてIRCへ投稿
inspired by Hatena Star
Let’s drop a line with a star( *star or ★ or ☆ )when you feel good.
gihyo.jpRubyKaigi2009 Special Report大和田純, 白土慧今回新たに「発表に対して☆を投票する」
機能が追加され,ますますLTを盛り上げてくれる存在となりました。」
It have been a tool making a fun LT time more.
今日は仕組みについてI’m talking about
how to run it, today.
TwYMRequirementsMac OS X LeopardQuartz Composerruby 1.8.6 / 1.8.7
Quartz Composermacに標準で入ってる
グラフィカルなデモを作成できる開発環境
It is a framework provided as part of the Xcode in mac for processing
and rendering graphical data.
TwYM QC code
問題はどうやってIRCからQCへ
データを送りこむかHow do we input datas
from IRC into QuartzComposer?
QC は外から入力できる形式が非常に限られている
QC can receivea few protocols from outside.
最初のバージョンの通信方式
The transmission processin the first version.
IRC (ustream chat)
nadoka(ruby IRC bot)
YAMLRSSQuartzComposer
問題点一定時間発言をまとめて
1つのRSSにする→発言からの表示遅延が最大20秒
ProblemIt make a RSS from some messages.
→ Displaying delay is 20secs(maximum) from writing.
どげんかせんといかん
How do it resolve?
使えそうなpatch(部品)をみつけた
Network ReceiverLeopardあたりで入ったみたい
I found a patch might resolve the problem.
別の Network Broadcasterからデータを受け取れる
Network ReceiverThis patch receives the text sent on the local network by the Network Broadcaster patch.
Network Broadcaster
Network BroadcasterThis patch sends text over the local
network using UDP broadcasting or multicasting. The sent text can be received by compositions on other computers using the Network Receiver patch.
つまりこいつらはUDPできゃっきゃうふふ
通信している
NetworkBroadcaster
NetworkReceiver
UDP
They talk each other using UDP in kissy-kissy love.
どんなフォーマットで送ってるのか調査
NetworkBroadcaster
NetworkReceiver
UDP
What format do they use?
“Apple”って送る場合は“\0\0\0A\0\0\0p\0\0\0p\0\0\0l\0\0\0e”
って送ればいいよ
http://arrifana.org/blog/2007/11/leopards-quartz-composer-and-network-events/
You should send“\0\0\0A\0\0\0p\0\0\0p\0\0\0l\0\0\0e”when you want to send “apple”.
やってみた
Ruby QCNetwork Receiver
UDP
I did it.
Ruby Coderequire 'socket'socket = UDPSocket.open()socket.connect("225.0.0.0", 50001) # address , portsocket.send("\0\0\0A\0\0\0P\0\0\0P\0\0\0L\0\0\0E", 0)
NetworkReceiver
\0\0\0[英字]で送れることが判明
We have got a knowledgethey use \0\0\0[X] format.
・・・日本語は?
How about multi-byte characters like Japanese?
さらに調査
I researched more.
UTF-32BE(BE:BigEndian)で送ればいいよ
http://arrifana.org/blog/2007/11/leopards-quartz-composer-and-network-events/
You should use UTF32-BE.
UTF-32BE・・・?どんなライブラリを
使えばいい?Which libraryshould we use?
Ruby1.9は組み込みライブラリkconvでUTF-32BEに変換できる!!
キタ━━━( )━(ω・́ )━(・ω・́)━(`・ω・́)シャキーン━━!!
ruby1.8.6の場合は外部ライブラリのrbuconvを使えばおkhttp://www.yoshidam.net/Ruby_ja.html
kconv in Ruby1.9can translate to UTF-32BE.
OK━━━( )━(ω・́ )━(・ω・́)━(`・ω・́)good job━━!!
ruby1.9.1 code# -*- coding: utf-8 -*-require 'socket'require 'kconv'socket = UDPSocket.open()socket.connect("225.0.0.0", 50001)str_u32BE = Kconv.kconv('いがいが', Kconv::UTF32, Kconv::UTF8)socket.send(str_u32BE, 0)
http://igarashikuniaki.net/tdiary/20090420.html
NetworkReceiverへは
UTF-32BEで送れることが判明
"\0\0\0A"はUTF-32BEでASCII範囲を指定してたのね
We have got a knowledgethey use UTF-32BE.
IRC (ustream chat)
nadoka(ruby IRC bot)
UDP(UTF-32BE)
QuartzComposer
今後の課題Ruby1.9対応 nadokaの対応で難航中GitHubで公開したいデザインを凝りたい
Next featureInto Ruby1.9
Release in GitHubMore cool design
nadokaのRuby1.9対応How will run nadoka in Ruby1.9.
・正規表現中のエンコード対応'¥xXX' → '¥u00XX'
Translate expression in regular expression.・Exception `ArgumentError' at /usr/local/lib/ruby/1.9.1/monitor.rb:140 - wrong number of arguments (1 for 2)→Timeout#extend_object(obj)
【急募】対応してくれる人【help-wanted column】
People who can run nadoka in Ruby1.9
LT the 2nd day次世代数値演算ライブラリDecimalという再発明の意義 (斎藤ただし, 筑波大学情報学類
科目等履修生)Morumotto, a jruby-based OpenID service using visual authentication
(Han Kessels, Hanamaru K.K.)Ruby on Arduino (高野光弘, 日本UNIXユーザ会)
Monitoring the sun with Ruby (Benjamin Smith, Enphase Energy)RomanticRuby!(Rubyでギャルゲー) (久保優子, 株式会社万葉)
rubyrep - database replication that doesn't hurt (developed in ruby) (Arndt Lehmann, TUV Rheinland Japan Ltd.)
BABY - 初心者のためのグラフィックライブラリ (黒田 拓, 北海道大学 大学院理学院)Facing your daemons (Kenneth Kalmer)
Rubyでの(力技)でのネットワーク運用 (植村優一(u-ichi), NTTcommunications)rubyによるお手軽CDN作成のすすめ (荒木靖宏, Debian Project)
ActiveLdap (須藤功平, 株式会社クリアコード)