Entries from 2009-05-12 to 1 day

Perl, Pythonで1以上100未満の『2個の素数の積』である整数を列挙する

1以上100未満の『2個の素数の積』である整数をワンライナーで列挙する - すぎゃーんメモの続き。 普通にスクリプトを書くとどうなるか。 Perl モジュールを使うとなるとやはりMath::Big::Factorsが便利。 #!/opt/local/bin/perl use strict; use warnings; u…

1以上100未満の『2個の素数の積』である整数をワンライナーで列挙する

from 素数だの積だのよくわかんねっちゃ - 牌語備忘録 -pygo CPANモジュール使ってしまうと、こうかなぁ。 perl -MMath::Big::Factors=factors_wheel -le'map@{[factors_wheel$_]}-2||print,1..99'$ perl -MMath::Big::Factors=factors_wheel -le'map@{[fact…

GAE/J でファイルをアップロードする方法を学ぶ

Google App Engine(Java版)でファイルをアップロードするためにはどうすればいいのか?を色々試しながら勉強してみる。 まず、最もシンプルにこんなHTMLとサーブレットを書いてみる。 <html> <head></head> <body> <form action="upload" method="post" enctype="multipart/form-data"> <input type="file" name="data"></td> <input type="submit"></td> </form> </body> </html> package hoge.fuga…