2013-04-01から1ヶ月間の記事一覧

ホームの日本語フォルダ名フォルダを英語名に変換

homeのダウンロード、ビデオ、画像、音楽、って日本語フォルダ名のため cdで移動するとき大変不便w;*1 日本語フォルダ名の別名として、 英語フォルダ名の両方が付いていたらいいんですけど 付いてないので英語に変換しておく 日本語フォルダ名から英語フォ…

「オリエント急行の殺人」読了

確かに名作でした。 前半、中盤、後半と なんとなく予想していた犯人と犯行方法が みごとに裏切られていってのラスト 映像で役者さんが演技してるの見たい>< しかし有名な作品だしテレビでやってると思うんですけど 食わず嫌いでポワロ関連の映像作品は余…

「第57回 Ruby/Rails勉強会@関西」で「mrubyでの整数の割り算」について発表してきた

発表してきました。 なので以下に発表資料のorg-modeを書いておきます^^; あと演習する予定だった問題の回答 (ってか、さすがに30分では演習してもらうのは無理なので、演習1.1のudiv実装部分のコード説明のみで終わりました) GitHub - murasesyuka/mruby…

A Tour of Go 70 Exercise: Web Crawler

演習: ウェブクローラ( web crawler )を並列化する。 なにはともあれ、あ、つぅぁー、おぶ、ごぉー完走w= package main import ( "errors" "fmt" //dbgfmt "fmt" "sync" ) type Fetcher interface { // Fetch returns the body of URL and // a slice of …

A Tour of Go 69 Exercise: Equivalent Binary Trees

演習: Walk 関数を実装、 Same 関数をテストする。 またまた、答え見た>< ってか、チャネルの戻り値にtrue/false帰ってくること、どこか書いてた? package main import ( "code.google.com/p/go-tour/tree" "fmt" ) func walkImpl(t *tree.Tree, ch chan…

A Tour of Go 60 Exercise: Rot13 Reader

演習: ROT13 換字式暗号をすべてのアルファベットの文字に適用します。 良く解らなかったので、答え見ながら書いた*1。Google Code Archive - Long-term storage for Google Code Project Hosting. package main import ( "io" "os" "strings" ) type rot13…

「五匹の子豚」読了

だめだ、最後まで犯人が解らなかったよ。 すっごい、おもしろい>< 五匹の子豚 (ハヤカワ文庫―クリスティー文庫)posted with amazlet at 13.04.05アガサ・クリスティー 早川書房 売り上げランキング: 43,581Amazon.co.jpで詳細を見る

A Tour of Go 59 Exercise: Images

演習:Image 型を定義して、 必要なメソッド を実装し、 pic.ShowImage を呼び出す。 よし出来た。オラわくわくして来たぞo(^o^o)(o^o^)o 最後の画像ジェネレーターの値 v は、 color.RGBA{v, v, 255, 255} のものと一致します。 上記は意味不明だったので無…

A Tour of Go 59 Exercise: Images (fix compile error, but not run ?)

演習:Image 型を定義して、 必要なメソッド を実装し、 pic.ShowImage を呼び出す。 なんとかコンパイルエラーは騙せたけど、エラーも含めて何も出力もされないw; Google Code Archive - Long-term storage for Google Code Project Hosting.を見る限り、…

A Tour of Go 59 Exercise: Images (compile error)

演習:Image 型を定義して、 必要なメソッド を実装し、 pic.ShowImage を呼び出す。 以下のようにRectangleが未定義とエラーになる。 何故?なんだ>< prog.go:5: imported and not used: "image" prog.go:12: undefined: Rectangle prog.go:17: undefined…

A Tour of Go 55 Exercise: Errors

演習:以前実装した Sqrt 関数を error の値を返すように修正。 注意: Error メソッド中で、 fmt.Print(e) を呼び出すことは、無限ループにプログラムが陥ることでしょう。 もちろん無限ループの実装を最初に書きましたよw; package main import ( "fmt" …

A Tour of Go 47 Advanced Exercise: Complex cube roots

演習:ニュートン法を使った複素数( complex )の立方根の計算を実装 package main import ( "fmt" "math/cmplx" ) func square(x complex128) complex128 { return x*x } func cube(x complex128) complex128 { return x*x*x } func enough(x,y complex128 )…

A Tour of Go 43 Exercise: Fibonacci closure

演習:fibonacci 関数を実装。 package main import "fmt" // fibonacci is a function that returns // a function that returns an int. func fibonacci() func() int { a,b := 1,1 return func() int { r := a a,b = b,a+b return r } } func main() { f …

A Tour of Go 40 Exercise: Maps

演習:WordCount 関数を実装して、文字列をカウント。 WordCountの仕様が最初問題読んでも良く解らんかった。 実行結果のテストから仕様理解したけどw; package main import ( "code.google.com/p/go-tour/wc" "strings" ) func WordCount(s string) map[s…

A Tour of Go 35 Exercise: Slices

演習:Pic 関数を実装して、生成画像を下に表示。 二次元のslice作るのに手間取った。 ってか良く解らんかったw; package main import "code.google.com/p/go-tour/pic" func Pic(dx, dy int) [][]uint8 { img := make([][]uint8, dy) for i := range img …

A Tour of Go 23 Exercise: Loops and Functions

演習:ニュートン法を使った平方根の計算を実装 package main import ( "fmt" //"math" ) func square(x float64) float64 { return x*x } func abs(x float64) float64 { ret := 0.0 if x >= 0 { ret = x } else { ret = -x } return ret } func enough(x,y…