サクサク読めて、アプリ限定の機能も多数!
トップへ戻る
大谷翔平
whitebell.hatenablog.com
grep -l PATTERN [FILE]
しょうがないからCONSTRAINTで変な値は弾くようにしておいた。 CREATE TABLE tbl ( col DEFAULT NULL, CONSTRAINT ct_col CHECK (col IN (0, 1) OR col IS NULL) ); とはいってもNULLも含めた3値論理にしてあるけど。 追記 05/06 10:33 このカラムにインデックス張るの忘れてたので、CREATE INDEXしておく。実際に検索するときはWHERE col = 1がほとんどで、WHERE col != 1とかWHERE col IS NOT NULLみたいなインデックスを使わない検索はまず使わない。
via 自分の全FollowingをLast Update日付毎にソートするPerl Script - smokeymonkey@ついったー部 - はてなグループ::ついったー部 これを見て、自分でも書いてみた。そのまま書いてもアレなので、Web::Scraperでスクレイピングするのと違って、私のはAPIを叩く版。UTF-8で出力してるので、Windowsな人はコマンドプロンプトからファイルにリダイレクトするとか、ファイルに書き出すようにするとか、パイプでiconvに繋ぐとか。まあ、適当に。 #!/usr/bin/perl use strict; use warnings; use DateTime::Format::HTTP; use Encode qw/encode/; use HTTP::Request; use LWP::UserAgent; use XML::XPath; my
tumblrのAPIでごにょごにょしようモジュール。インスパイア元→Net::Tumblr - fubaはてな。あっちの実装のがシンプルです。私のは見た目から汚い。 長いので続きを読む記法。 package Net::Tumblr; use warnings; use strict; use version; our $VERSION = qv('0.0.1'); use base qw/Class::Accessor::Fast/; __PACKAGE__->mk_accessors(qw/email password generator ua/); use Carp qw/croak/; use LWP::UserAgent; my $api = { read => sub { sprintf 'http://%s.tumblr.com/api', shift }, write =>
via. 2007-08-11 - きしだのはてな Rubyわかりません>< かわりにPerlです>< Javaは読めないしコンパイルできる環境もないので、きちんとした移植じゃないけど。もう少し手を入れれば登場回数順にソートもできるけど、めどいのでパス。 #!/usr/bin/perl use strict; use warnings; use LWP::Simple; use XML::XPath; use Encode; my $uid = shift or die "Input your TwiiterID\n"; my $xml = get "http://twitter.com/statuses/friends/$uid.xml"; my $m_xp = XML::XPath->new(xml => $xml); my $m_nodeset = $m_xp->find('/use
via. 正規表現からその正規表現にマッチするような例を生成する - www.textfile.org Perlでもたしかそんな感じのことやってくれるモジュールがあったよねー、と思ってちょっと探してみたらやっぱりもうあったり。 pcreフルスペックじゃないけど、実用上はこれだけあればわりと使えるよね。 String-Random-0.22 - Perl module to generate random strings based on a pattern - metacpan.org 関係のない追記 じつはこのモジュール、こういうことやってくれるモジュールがあるってことは知ってたんだけど、ブックマークしてなくて、探すのにちょっと手間取るというちょっとしたお話があったりして。たぶん前にどこかのblogで見て、まず自分のはてブをチェックして見つからないので、http://kobesearch
Stage6とYouTubeに対応させてみた。タイトルも勝手に引っ張ってきます。YouTubeのダウンロード部分はhttp://video.qooqle.jp/dl/のPHPによる実装を参考にしました。はてなー的には、あとビデオキから検索できるGoogle VideoとAmeba Visionでも使えるようにするべきかな。そのうち書きます。 追記 [22:46] Google Videoも対応、のハズ。コードを読むと分かるけど思いっきり力技なやり方でdirty hackにも程があるって感じです。1個しか試してないからもしかしたらダメぽかも。ファイル名に使えなさげな文字は弾いてるけど、漏れがあるかもしれない。あと、CP932固定はまずいかな。Windowsじゃない人はCP932を適当に書き換えてください。次はAmeba Visionか。 追記 [01/06 00:04] Amaba Visi
前にこの記事で無名スカラーのリファレンスを取得する方法を書いたら、id:fbisさんがブクマコメントでmy $anon_scalar_ref = \q{anonymous}; じゃだめなのかな?と書いていたんですが、これに関してちょっと。 結論から言うと、id:fbisさんの示した例ではダメです。というか、時と場合にもよるけど、ダメな場合があります。 my $anon_scalar_ref = \do{$anon_scalar = 'bar'}; my $const_ref = \q{foo}; $$anon_scalar_ref = 'fuga'; $$const_ref = 'hoge'; ようはこういう場合。あとで代入したいときに、無名スカラーへのリファレンスは代入できるんですが、定数へのリファレンスは代入不可能なんですね。こういう理由があるので、先のエントリで書いたような手法が必要
続・myとourがよくわからん - はこべにっき ♨ ちょっとうまく説明できるかどうかわからないけど挑んでみる。読ませてもらってるbloggerさんのためになるならやってみるだけの価値はあるよね。 最初に。 まずコードは以下のようなもの。 use strict; use warnings; { package foo; my $name = 'foo'; sub get_name { return $name } } my $name = 'main'; print "$name\n"; print foo::get_name(), "\n"; これを実行すると、 foo mainスコープを抜けた後も、&foo::get_nameはスコープ内のレキシカル変数にアクセスできる。 リファレンスカウントを覗こう。 こういうときに役立つのがこれ、[http://search.cpan.org/di
myとourがよくわからん - はこべにっき ♨ myで宣言した変数はパッケージじゃなくてスコープに対して所属しているから、シンボルテーブルを覗いて見つかったら逆に問題なんじゃないだろうか。で、一番外側にあるスコープはファイルそのものだから、宣言した行からあと、スコープを抜けるまで、つまりファイルの最後まで存在してる*1。ourは可視範囲に関してはmyと同じだけど、こっちはパッケージに所属するものだから、シンボルテーブルに入ってる=名前空間を覗けば見える。…だったと思うけど、よくわからない。偉い人ならもっと詳しくわかるだろうけど。 追記 ごちゃごちゃ言うよりも、コード書いたほうが早いか。Perlishならきっとコードで分かり合えるはず。 use strict; use warnings; package main; my $foo; our $hoge; # 完全な名前は$main::ho
Japanese Traditional Colors Photoshopで使えたら便利だよねと思って、誰か作るだろうなとは思ったけど、とりあえず作って、記事を書こうと思ったら案の定先を越されてるというのはネタにもならないので面白くないや。一応あげておくけどね。caramel*vanillaさんのと違うのは、多分オリジナルと同じ順に並んでるハズってくらい。あ、あとRGB16進の数値も名前に入れてあります。「漢字 (よみ) #abcdef」みたいな感じに。 download どうぞご利用ください。*1 *1:この台詞を言いたいが為だけに作ったと言っても過言ではないのがアレゲ
\98000 あんまりこういうものに手を出すつもりはなかったんですが。 アグネスタキオンが死ぬほど刺さるタイプで沼に引きずり込まれました。とりあえずURAファイナルズは勝ちました1。 そのうちタキオンに勝負服着せてあげたいし温泉にも行きたい。 とりあえずウマ娘やってタキオンのシナリオのReport『告白』まで読んで。 追記 20210725 なんのかんの言いつつ温泉も行った2し固有勝負服も着せた3し、固有二つ名「超光速のプリンセス」も取った4。アグネスタキオンほんと沼すぎる。 PS Vita対応ADV『ウマ娘』アグネスタキオン√を忘れるな|ハチミツ|note #アグネスタキオン(ウマ娘)のイラスト・マンガ作品 - pixiv ひかりより速くゆるやかな、くらやみの速さはどれくらい ~アグネスタキオン育成シナリオの特異性と「狂気」について|浅木原忍|note 2021/06/12 add ht
このページを最初にブックマークしてみませんか?
『Whitebell::HatenaBlog』の新着エントリーを見る
j次のブックマーク
k前のブックマーク
lあとで読む
eコメント一覧を開く
oページを開く