「FIELDS」を含む日記 RSS

はてなキーワード: FIELDSとは

2023-05-15

[]20ドル払ったら解決するのかなぁ

User

LOAD DATA INFILEでCSVを分割して読み込むことは可能なのでしょうか。そのときautoincrementのidがあった場合はどうしたらよろしいでしょうか。

ChatGPT

はい、LOAD DATA INFILEステートメント使用してCSVファイルを分割して読み込むことは可能です。CSVファイルを分割するには、LOAD DATA INFILEステートメントファイル名の部分にワイルドカード使用することができます

以下は、例としてMySQLデータベースでのLOAD DATA INFILEステートメント使用方法です。

LOAD DATA INFILE 'path/to/files/file*.csv'
INTO TABLE your_table
FIELDS TERMINATED BY ','
LINES TERMINATED BY '\n'
(col1, col2, col3); -- 列のリスト

上記の例では、path/to/files/ディレクトリ内のfile*.csvというパターンに一致するすべてのCSVファイルが読み込まれます。また、FIELDS TERMINATED BY句とLINES TERMINATED BY句を使用して、フィールドと行の区切り文字指定していますさらに、col1, col2, col3のように列のリスト指定することで、CSVファイル対応する列とテーブルの列をマッピングします。

autoincrementのidがある場合、LOAD DATA INFILEステートメントでは自動的に次の値を生成することはできません。そのため、CSVファイル内に明示的にid列が存在する場合は、id列を指定して読み込む必要がありますid列がCSVファイル存在しない場合は、テーブル定義id列をautoincrementに設定しておく必要があります。その場合データベース自動的に新しい値を生成します。

例えば、以下のようなテーブル定義があるとします。

CREATE TABLE your_table (
  id INT AUTO_INCREMENT PRIMARY KEY,
  col1 VARCHAR(50),
  col2 VARCHAR(50),
  col3 VARCHAR(50)
);

この場合、LOAD DATA INFILEステートメントid列を省略することで、自動的に新しい値が生成されます

LOAD DATA INFILE 'path/to/files/file*.csv'
INTO TABLE your_table
FIELDS TERMINATED BY ','
LINES TERMINATED BY '\n'
(col1, col2, col3);

このようにして、CSVファイルデータを分割して読み込むことができます。ただし、autoincrementのid列は明示的に指定するか、データベースによって自動的に生成されるようにテーブルを設定する必要があります

結論

SETしないと動かない。

分割するとauto incrementの値が飛ぶ。

結局問題解決になってない。

2023-05-14

ChatGPTにウソ書かれたんで、ここに質問書くわ

LOAD DATA INFILEでCSVを分割して読み込むことは可能なのでしょうか。

そのときauto incrementのidがあった場合はどうしたらよろしいでしょうか。

現象としては、分割して読み込ませるとid連続しないで飛ぶ。

1.csvを読み込ませた最後idが1378だと、次の2.csvに読み込ませたのは2048から始まってる。

CSV一括で読み込ませるしか方法がないのか?

LOAD DATA LOCAL
	INFILE '***.csv' 
	INTO TABLE ***
	FIELDS
		TERMINATED BY '\t'
	LINES
		TERMINATED BY '\n'
(@pref_name, @type, @name, @zip, @address, @tel, @fax, @lat, @lng)
SET
...

2021-01-27

anond:20210127001520

唐突にreviewerがいない、とか何の話だよw

Nature is a weekly international journal publishing the finest peer-reviewed research in all fields of science and technology on the basis of its originality, importance, interdisciplinary interest, timeliness, accessibility, elegance and surprising conclusions.

2018-11-05

MISIAすげえ

何気なくググったらオルフェンズEDライブ動画あったから見たけど歌唱力やべえ

CD音源以上ってどういうことだよ

やすごいのは最初からわかってたわ

MISIAで一番好きな曲は包み込むようにっていうくらい最初インパクトが今でも強いし

当時はなんかすげえ高い声出せるっていうのが売りだったけどいつのまにかそんなこと言われなくなったしそんな売りがなくても普通歌唱力で圧倒できるすごさのある歌手だった

ブリシングは正直いまいちきじゃない

ああそれにしてもオルフェンズの涙いいわ

アニメEDでなぜか飛ばせないEDってあるけどオルフェンズはまさにそれだった

オルフェンズ1期だけは全部みたけど一度も飛ばせなかったわ

まさかガンダムMISIA・・・最初驚いたし

それにしても包み込むようにはやっぱりいいわ

大好き

ぐぐったら

作詞作曲者である島野聡は、自身男性2人組『Love Lights Fields』のメンバーとして活動していた時にこの曲を製作し、レコーディングも試みられていたが、同グループボーカルだった園田利隆歌声で発表する事に納得がいかず断念。いつかこ楽曲を歌いこなせる歌手に巡り会うまでと、封印していたのだという

だって

すげえわ

2018-04-20

鬱っぽくて心療内科に行った話

誰かのためになればいいなぁとは思ったけど、ほぼ自分のために書いた文章というか日記なので読みにくいと思う。ごめんなさい。

最近、鬱っぽいというか夜勤中に精神的余裕がなくなるスピードが早いのと物忘れがひどくなってきたので、心療内科に行ってみたんよ。元々、自分精神的な病気なんかとは関係ないと思ってたんだけど、ツイッターなんかでわかり手さんとか借金玉さんとかのツイートブログ見てたら行ってみるのもありかなぁと思いまして。

心療内科の初診の予約取るのもわりと時間必要だった。電話をすることへのストレス電話をしたらもうあとに引けない気がしたから。でも、仕事中に頭がパンクしそうになった時があってそこでもうダメだと思って勢いで予約の電話をした。

とりあえず、電話に出てくれた看護師の人には鬱っぽくてということで受診の予約をした。

受診当日、逆算思考が苦手なのと方向音痴自分を気遣ったら予約時間の40分以上前に最寄駅に着いてしまったので30分くらい散歩してから病院に向かった。

何というか、最寄駅から病院場所確認して散歩時間を潰している間、ずっと憂鬱だった。怒られるわけじゃないと分かっていても、どんなことを聞かれるんだろうと考えていると頭がずっしりとしてくる。

それで、いよいよ、初受診時間心療内科らしく待合室のソファも診察室の椅子もふかふかだった。

ドクターには具体的に困っていることを聞かれたので前述した通り、夜勤中の精神的余裕の無さと物忘れがひどくなってきていることを伝えた。

それから、鬱の診断を下すための質問をされた。DSM-5とかいう本(世界共通診断基準って言ってた)に沿って質問されて、それによると鬱ではないということで、抑うつという鬱っぽい状態だと思う的なことを伝えられた。

それから、順序が曖昧だけど次にADHDかどうか診断する質問をされた。集中力はあるかとかそういうやつ。それによるとたしか、軽いADHDとのことだった(ADHDに軽いとかあるかどうかわかんないし、もしかしたら自分障害者と認めたくない自分意識邪魔して軽いやつと認知したのかもしれない)。

まぁ、その時点で多少はショックだったんだけど、高校で塾やめたら一気にガタ落ちした成績のこととか集中力の件とか思い返すと、しょうがいかぁという感想

で、たしか次が心理テストでA4の紙に実がなっている木を書かされた。ドラマとか映画で見たやつ!と思いながら、真ん中にこれだと小ちゃいかなぁ…でも大きく書くのめんどくせえしなんでそもそも大きく書かんとあかんのやと思いながら木を書いてリンゴを3つほど付け足した。書いた後にリンゴの味を聞かれたので普通ですかね、と答えた。

診断によると自分は頑固で人の目を気にして抑圧状態になってると言われた。まあ、たしかにーという感じだったのでそうですねーと答えて、ドクターから総合的な見解ADHDとそれによる二次障害抑うつ状態とのことだった。

集中力がなくて仕事がうまく回せてないのをどうにかしないとという話の結果、コンサータが処方された。あー、借金玉さんが言ってた飲んで吐き気と戦いながら仕事するやつかと思いながら、それを2週間分処方してもらった。

それと、ドクターから仕事ストレスを溜め込むのはよくないか自分ブログに書くなり愚痴ノートを作った方がいいとの言葉も頂いた。

で、先月にインターネットのお陰でできた彼女の家に向かうバスの中でぼおーっとEva CassidyのFields of goldを聞いてたらどういうわけか涙が止まらなくなった。どういうわけもなく、自分発達障害であるというショックがそのタイミングで襲ってきたんだろう。彼女には病院に行くとは言ってたけど、「なんの病院?」という質問には答えられず、健康診断の聴力検査でひっかかったか耳鼻科に行くと嘘をついた。

自分障害者であることを家族にも彼女にも、今度新幹線で久しぶりに会いに行く数少ない友達にも言えないなぁと考えるとセンチな気分になってバスの中で泣いてしまった。

重く考えすぎだよなぁとこれを書きながら思いつつも、あと1回くらいは泣きそうだなとも思う。案外、言ってしまえば周りは受け入れてくれるのかもしれないけど、急に「俺、実は発達障害だったんだよね」と知り合いに言われても反応に困るだろうから、とりあえずは言わないでおこうと思う。

それにしてもなー、これからどうしよう。いや、特別どうもしないんだけども。

とりあえず、彼女の家で帰宅を待ちつつ、夕食の献立を考えつつ彼女に貸したスプラトゥーンでもするかなぁ。あ、コンサータ飲んだらウデマエ上がるかな?

2016-07-25

gitにおけるコミットログ/メッセージ例文集100

私はコミットログの書き方に悩む英語の苦手な人間である。実際、似たような人は世の中に結構いるようで、頻出単語を集計したりまとめたものは既にあって役に立つのだけれど、これらはあくま単語の話であり、具体的な文を構成する過程でやっぱり困る部分がかなりあった。

要するに、どういう時にどういう文が使われているのか、ということを示した例文集が欲しいのであるググると他にも「例文集があればいいのに」みたいな声はあるくせして、しかし誰も作ろうとしない。何なんだお前ら。それじゃ私が楽できないじゃないか

仕方なく自分でまとめたので、増田に垂れ流しておく。

はじめに

ここで挙げているコミットログは全て実際のコミットログから転載である。当然ながら各コミットログ著作権はそれぞれの書き手にある。いずれも各英文でググれば出てくるし、フェアユース範囲なら許してくれるだろうと考え名前プロジェクト名は割愛したが、ここにお詫びと感謝を述べておきたい。

抽出条件だが、参考にできそうなコミットログを多く含んでいそうなリポジトリGitHubSTARの多い方からざっと目で見て適当に選び、それぞれ最新コミットから5000件抽出した(あわせて前処理として、コミットログ冒頭のタグ情報は消去した)。

結果として対象としたリポジトリは以下の通り。

atomのみ5400件抽出していたため、計25400件のコミットログベースである。このうち、以下の条件に合致するものは参考例にすべきでないとして一律排除した。

こうして残った8540件を眺めながら、適当に切り出したのがこの用例集である個人的に「うーんこの」と思った表現も、散見される場合は載せた。

ということで、以下用例を羅列していく。

用例集

オプションフラグメニューを追加した
ファイルを追加した
メソッド機能を追加した
実装を別のものへ切り替えた
  • Use args.resourcePath instead of args.devResourcePath
  • Use arrays instead of while loops
  • Use auto instead of repeating explicit class names
  • Use weak pointer instead of manual bookkeeping
  • Change all uses of 'CInt' to 'Int32' in the SDK overlay
  • Change Integer#year to return a Fixnum instead of a Float to improve consistency
新しく何かに対応した/機能上の制約を取り払った
何かを使うようにした
より好ましい実装に改良した
何かを出来ない/しないようにした
  • Don't bail reading a metadata instance if swift_isaMask isn't available
  • Don't exit until the parent asks for an instance
  • Don't include Parent pointer in Nominal/BoundGeneric TypeRef uniquing
  • Don't use MatchesExtension for matching filters
  • Don't use ES6 class for AutoUpdater windows class
  • Don't use MatchesExtension for matching filters
  • Avoid `distinct` if a subquery has already materialized
  • Avoid infinite recursion when bad values are passed to tz aware fields
オブジェクトの内容や挙動確認やすくした
Assertを追加した
不要コードを除去した
コードを移動した
名前修正した
さなバグタイポ修正した, 警告を潰した
バグや好ましくない挙動修正した
テストコメントドキュメントを追加した
テストを削除した
テストコメント修正した
ドキュメント修正した

表現傾向とまとめ

以上の用例をふまえ、今回の参考ログ8540件から先頭の単語を出現回数で並べると次のようになった。

Add1149
Fix1014
Update584
Remove566
Use382
Don't260
Make228
Move178
Change103
Rename85
Improve76
Avoid68
Allow65
Implement60
Handle58

コミットログの基本形はもちろん動詞 + 名詞である名詞固有名詞複数形、不可算名詞が多いが、単数形場合冠詞は a が使われるか、あるいは省略される。the はまず使われない。

何かを追加した、という表現では非常に広く Add が使われる。メソッドからテストドキュメントに至るまで大概これでまかなえる。

一方、何かを修正した、という表現では広く Fix が使われる。「何か」は typocrash といった単語からメソッド名まで幅広い名詞を取るが、動名詞はあまり取らないのと、that節は取らないのでその点は注意が必要である

Fix は「何かが正しく動くようにした」ことを示し、正しい動作内容が何かを説明しない。そこで正しい動作内容に言及したい場合Make sure が使われる(こちらはthat節が取れる)。ただし Fix よりもニュアンス的に重い表現と思われ、Fix を使わず Make sure ばかり使うのはちょっとキモいのではないかと思う(Ensure はさらに重い表現っぽい)。

また、Fixtypo 以外でのドキュメント修正に対して使われることは稀である。対して Update はドキュメントコメントテストに使われ、本体コード修正に対しては使われない。本体コード修正にあわせてテスト更新したなら Update が使われる。ただ、テスト機構それ自体バグ修正したなら Fix である

無駄な何かを単純に除去したなら Remove を使う。これまでのもの(A)からのもの(B)に切り替えたのであれば Use B instead of A か Change A to B が使われる。新たに何かを利用するようにしたのであれば Use を、利用を取りやめた場合Don't use を使うことが多い。

何かをしないようにしたなら Don't を、内部実装効率化なら Make A + 比較級/形容詞Improve が使われる。

中身の変更を伴わない単なる名前の変更なら Rename A to B、コード機能論理上の場所を移動させたなら Move A to B である

この辺はリファクタリングと呼ばれる行為と思うが、Refactor というぼんやりした動詞はあまり使われず、このように変更内容の種類に応じて動詞が使い分けられている。

余談

コミットログにはWhyを書くべきだ、というのを何かで見かけたので because とか since を使ったログがどの程度あるかを調べたが、8540件のうち22件だった。基本的に短く、シンプルに、一目で意味が取れるログが好まれる傾向がある。例えば get rid of とか2件しか使われておらず、圧倒的に remove である

一方で、シンプル単語だけど開始単語としては使われないものもある。例えば次のような単語である。Expand(9)、Extend(8)、Print(5)、Optimize(5)、Publish(4)、Append(4)、Modify(3)、Manage(2)、Revise(2)、Dump(2)、Insert(2)、Migrate(2)、Enhance(1)、Edit(1) 。いずれもカッコ内は8540件に対する冒頭での登場回数である。結局、より一般的平易な単語で表せたり、Refactor同様に抽象度が高すぎると使われないのだろう。

おわりに

8000件もログを見たおかげで、迷いなくコミットメッセージが思いつくようになったのが個人的には今回書いてて最大の収穫だった。たぶんカンニングペーパーを作る行為それ自体効率のいい学習になるという話と同じだと思う。

このまとめも100以上用例を転載してあるので、それを読むだけでも多少は効果があるんじゃないかと思う。同じようにコミットログ書きたくねぇなぁ英語わっかんねぇなぁと思っている人にとって、何か役に立つところがあれば幸いである。

2014-10-07

Nobel Prize for Physiology or Medicine 2014

Physics の青色ダイオード中村・赤崎・天野の受賞や私戦予備陰謀疑いのほうがさわがしいかもしれませんが,ノーベル生理学・医学賞に関して.

John O' Keefe, May-Britt Moser, Edvard Moser の三名が 2014 年のノーベル生理学・医学賞を受賞した.受賞理由は脳の位置定位系を構成する細胞発見に対してである.“for their discoveries of cells that constitute a positioning system in the brain”. 視覚聴覚,触覚で得た物理的な環境のあるいは自己の位置に関する情報脳内でどのように処理されているだろうか.力学的に考えると,質点と空間座標と時間の成分がありそうなものであるマウス生体での神経科学的な実験で,位置特異的に神経の活動活動電位の頻度)が上昇する細胞海馬でみつかった.最近の in vivo実験で place cell特性や grid cell特性視覚系・運動系との place cell 回路の連絡等がさらに解明され始めている.少し古い神経生理学に関連する著名な科学者では,James GibsonDavid Marr が有名かもしれない.聴覚系での位相から音源位置推定視覚系での網膜および外側膝状体 LGN,一次視覚野,高次視覚野の回路等感覚認知神経科学はよく調べられてきたが,受賞対象の位置定位系は脳内感覚運動統合する上で重要な具体的な情報表現情報処理にせまった分野になっている.

ごくごく戯画化した,脳の作動機構は,神経細胞は他の細胞と同様に細胞膜をもちその内外のイオン組成ポンプチャネルとよばれる細胞膜タンパク質で糖を燃焼してえたエネルギーを元に維持する.神経細胞が同士が突起を多数のばし接触点を多数つくりそこで,膜のイオン電位差をより正にする化学分子放出したり,より負にする化学分子放出したりする.電位差が十分小さくなると多くの神経細胞では電位依存的なナトリウムイオンチャネルが活発に作動し突起を一次元的に減衰せずに伝わっていく活動電位をおこす.多くの神経系での通信と計算実体は,この化学伝達と電気伝導の組合せで,静的な記憶細胞の結合(シナプス synapses)が構成する回路に,シナプス化学伝達特性や回路水準の論理演算やより高度な情報処理の結果であると作業仮説がたっており,具体的な情報処理の神経回路の機構を解明することは重要である

位置定位系の回路を構成する要素の place cell は,脳の大脳海馬とよばれる短期記憶や長期記憶化に重要な部位にあるアンモン角 (Cornu Ammonis)の錐体(神経)細胞 pyramidal neuronである特定場所活動が上昇することが証明されている.脳内空間情報処理で他の細胞とともにどのような回路をなしているか調べるには,place cell への入力と出力,place cell 間の直接的な結合をさらに調べることになる.O'Keefe, Moser 以後も熱心に研究されている神経科学重要問題である海馬に出力する嗅内皮質 entorhinal cortex の格子細胞 grid cell環境スケールに応じた格子を表現するようなユークリッド空間中の格子のような役割を担う細胞),各所の頭方位細胞 head direction cell時間細胞 time cell発見されている.物理学的な情報表現計算必要な神経回路の構成要素がわかりその作動機構がわかってきそうな気がしてくる.21 世紀は,人体生理学のおそらく最大で最後問題である脳の作動機構の同定にかなりせまってきており,先のことはよくわからないが脳のことは今世紀中にはだいたいのことがわかり,計算機もっとよい知能が実装できそうな勢いである.

ノーベル賞は「物理学化学医学生理学文学平和経済(ただし経済分野はスウェーデン国立銀行賞)」の分野で重要な業績を残した個人に贈られる.Physiology or Medicine の分野ではカロリンスカ研究所選考にあたる.ノーベル賞は,ダイナマイトの開発生産ノーベルが残した遺産基金としはじまった.現代では,数学Fields Medal や計算機の Turing Award とならびたつような権威ある賞として,世界中科学の営みに参加する人々・興味ある人々が注目する伝統儀式を続けるお祭りになっている.医学生理学の分野では生理学的に重要機構の解明や臨床応用で人類医学的な福利向上につながる発見などにおくられる.なかなか毎年趣味がよいとおもわれる.繰り返しであるが,選考委員会が示した,今回の授賞は,脳での空間認識の回路で重要な働きをする place cell 場所細胞発見理由である

匿名ダイアリーにこんな言い訳不要かと思うのだけれど,ノーベル賞委員会公式アナウンスメントとFundamental Neuroscience か Principles of Neural Science や関連論文日本語教科書・一般書等を読めばよい.高校生物に毛が生えた教養程度の神経科学の知識しかない劣等の学部生ながら,今回受賞の対象になった O’ Keefe と Moser 夫妻の神経系における自己位置の表現の神経回路の重要細胞というテーマに興味があるので駄文を書いた.

脳科学辞典 場所細胞 http://bsd.neuroinf.jp/wiki/%E5%A0%B4%E6%89%80%E7%B4%B0%E8%83%9E

脳科学辞典 海馬 http://bsd.neuroinf.jp/wiki/%E6%B5%B7%E9%A6%AC

2013-07-24

http://anond.hatelabo.jp/20130724111931

いや、左翼は「軍事的な技術」に関わるもの全てを憎んでるからOSS定義とは真っ向から反する思想だぞ。

OSS定義では、「軍事目的での使用禁止」などの使用条件を設けることは、「使用分野(Fields of Endeavor)に対する差別の禁止」に該当する。

http://ja.wikipedia.org/wiki/%E3%82%AA%E3%83%BC%E3%83%97%E3%83%B3%E3%82%BD%E3%83%BC%E3%82%B9%E3%81%AE%E5%AE%9A%E7%BE%A9

2012-08-13

C#基礎文法最速マスター

1. 基礎
classの作成

プログラムclass記述します。たとえばSampleという名前classを作る場合、Sample.csファイル内に次のように書きます。(C#場合ファイル名とクラス名は同一でなくても良い。複数のクラスを書いても良い)

public class Sample {

}
Mainメソッドの作成

プログラムclass内のMainメソッドの先頭から実行されます。Mainメソッドは次のように書きます

public class Sample {

    public static void Main( String[] args ) {
         // 処理を書く
     }

}
Console.WriteLineメソッド

文字列を表字するメソッドです。

Console.WriteLine( "Hello world" );
コメント

コメントです。

// 一行コメント

/*
   複数行コメント
 */
変数の宣言

変数の宣言です。変数の宣言時にはデータ型を指定します。

// 変数
int num;
データ型

データ型です。C#データ型には値型と参照型とがあります。以下は値型のデータ型です。

// int(整数)型
int num;
// char(文字)型
char c;
// float(単精度浮動小数点)型
float val;
// double(倍精度浮動小数点)型
double val;
// bool(論理)型
bool flag;
// DateTime(日付)型
DateTime date;

以下は参照型のデータ型です。

// StringString s;
// 配列String[] array;
プログラムのコンパイル

プログラムコンパイルするには、コマンドラインで以下のようにします。

csc Sample.cs
プログラムの実行

プログラムを実行するには、コマンドラインで以下のようにします。

.net framework on Windows場合

Sample.exe

Mono.frameworkの場合

mono ./Sample.exe
2. 数値
数値の表現

int、float、double型の変数に数値を代入できます。int型には整数だけ代入できます。float、double型には整数でも小数でも代入できます

int i = 2;
int i = 100000000;

float num = 1.234f;

double num = 1.234;
四則演算

四則演算です。

num = 1 + 1;
num = 1 - 1;
num = 1 * 2;
num = 1 / 2;

商の求め方です。割る数と割られる数が両方とも整数場合計算結果の小数点以下が切り捨てられます

num = 1 / 2;  // 0

割る数と割られる数のどちらかが小数場合計算結果の小数点以下が切り捨てられません。

num = 1.0 / 2;    // 0.5
num = 1 / 2.0;    // 0.5
num = 1.0 / 2.0;  // 0.5

余りの求め方です。

// 余り
mod = 4 % 2
インクリメントとデクリメント

インクリメントとデクリメントです。

// インクリメント
 ++i;

// デクリメント
 --i;
3. 文字列
文字列の表現

文字列ダブルクォートで囲みます

String str = "abc";
文字列操作

各種文字列操作です。

// 結合
String join = "aaa" + "bbb";

// 分割
String[] record = "aaa,bbb,ccc".Split( "," );

// 長さ
int length = "abcdef".Length();

// 切り出し
"abcd".Substring( 0, 2 )   // abc

// 検索
int result = "abcd".IndexOf( "cd" ) // 見つかった場合はその位置、見つからなかった場合は-1が返る
4. 配列
配列変数の宣言

配列です。

// 配列の宣言
int[] array;
配列の生成

配列の生成です。配列の生成時には要素数を指定するか、初期データを指定します。

int[] array;

// 要素数を指定して配列を生成
array = new int[5];

// 初期データを指定して配列を生成
array = new int[] { 1, 2, 3 };

// 宣言と同時に配列を生成
int[] array2 = new int[5];
配列の要素の参照と代入

配列の要素の参照と代入です。

// 要素の参照
array[0]
array[1]

// 要素の代入
array[0] = 1;
array[1] = 2;
配列の要素数

配列の要素数を取得するには以下のようにします。

array_num = array.Length;
配列のコピー

配列の要素を別の配列コピーするには以下のようにします。

int[] from = new int[] { 1, 2, 3 };
int[] to = new int[5];

from.CopyTo(to, 0);
5. 制御文
if文

if文です。

if ( 条件 )
{

}
if ~ else文

if ~ else文です。

if ( 条件 )
{

}
else
{

}
if ~ else if 文

if ~ else if文です。

if ( 条件 )
{

}
else if ( 条件 )
{

}
while文

while文です。

int i = 0;
while ( i < 5 )
{
    
    // 処理
    
    ++i;
}
for文

for文です。

for ( int i = 0; i < 5; ++i )
{
    // 処理
}
for-each文

for-each文です。配列の各要素を処理できます

int[] fields = new int[] { 1, 2, 3 };

foreach (int field in fields)
{
    // 処理
}
6. メソッド

C#では関数メソッドと言いますメソッドを作るには次のようにします。戻り値を返却するにはreturn文を使います

static int sum( int num1, int num2 )
{
    int total;

    total = num1 + num2;

    return total;
}
9. ファイル入出力

ファイル入出力です。ファイル入出力を行うには、プログラムの先頭に以下を記述します。

using System.IO;

以下がファイル入力の雛形になりますファイルオープンや読み込みに失敗した場合catch節に処理が移ります

String filename = "text.txt";
StreamReader reader = null;
try
{
    reader = new StreamReader(filename);

    String line;
    while ((line = reader.ReadLine()) != null)
    {

    }

}
catch (IOException e)
{
    // エラー処理:

}
finally
{
    if (reader != null)
    {
        try
        {
            reader.Close();
        }
        catch (IOException e) { }
    }
}

またはC#ではusing ステートメントと言うものがあり、この様にも書ける

String filename = "text.txt";
using (StreamReader reader = new StreamReader(filename))
{
    try
    {

        String line;
        while ((line = reader.ReadLine()) != null)
        {
            // 読み込んだ行を処理
        }

    }
    catch (IOException e)
    {
        // エラー処理:

    }
}

usingをつかうとCloseがなくなったことからわかるようにusing(){}を抜けるとき自動的にDisposeメソッドを呼び出し、オブジェクトを廃棄する。その分コードスッキリするが、使いにくい場面もあるので考えて使うこと。

以下がファイル出力の雛形になりますファイルオープンや書き込みに失敗した場合catch節に処理が移ります

String filename = "text.txt";
StreamWriter writer = null;

try
{
    writer = new StreamWriter(filename));

    writer.WriteLine("abc");
    writer.WriteLine("def");
    writer.WriteLine("fgh");

}
catch (IOException e)
{
    // エラー処理:

}
finally
{
    if (writer != null)
    {
        writer.Close();
    }
}

こちらもusingを使って書ける。が、割愛する。

知っておいたほうがよい文法

C#でよく出てくる知っておいたほうがよい文法の一覧です。

繰り返し文の途中で抜ける

繰り返し文の途中で抜けるにはbreak文を使用します。

for ( i = 0; i < 5; ++i ) {

    if ( 条件 ) {
        break;    // 条件を満たす場合、for文を抜ける。
    }

}
繰り返しの残り部分の処理をスキップする

残りの部分処理をスキップし、次の繰り返しに進むにはcontinue文を使用します。

for ( i = 0; i < 5; ++i ) {

    if ( 条件 ) {
        continue;    // 条件を満たす場合、残りの部分処理をスキップし、次の繰り返しに進む。
    }

}
例外処理

例外を投げるにはthrow文を使用します。

throw new Exception( "Error messsage" );

例外処理をするにはtrycatch文を使用します。

try {

    // 例外が発生する可能性のある処理

} catch ( Exception e ) {

    // 例外発生時の処理

}

2012-07-31

アグリコラ WMデッキ誤訳訂正と補足

アグリコラのWMデッキについては、Table Games in the Worldで和訳が公開されている( http://www.tgiw.info/2012/03/wm5.html から辿れる。)。WMデッキについては公式の和訳が存在しないことから、このような有志による和訳の公開は貴重であり、アグリコラファンの1人として最大の感謝の意を示したい。

しかしながら、公開されている英語版のテキストとつき合わせて見たときに、上記和訳にはいくつかの点で致命的な誤訳があり、また、いくつかのカードについては補足が必要であることに気づいた。

そのため、上記和訳には感謝を示しつつも、日本アグリコラファンがより適切なプレイングを楽しめるよう、誤訳の指摘と補足を執筆することにした。なお、筆者がブログを持ち合わせていないために、このような匿名ダイアリーで指摘をさせていただくことになった非礼をお詫びしたい。

以下、αデッキから順に見ていく。

αデッキ http://www.tgiw.info/2012/01/wm1.html

★WM010 Klosterbewohner 修道院生活者

原文:「At the end of the game, you receive 1 Bonus point for each of the 5 columns of your farmyard that is either all rooms, all fields or all in the same pasture.」

誤「得点計算とき自分の農場の縦5マスの列を見て、5マス全てが部屋か、5マス全てが畑か、5マスのうち3マスが同じ牧場に属していたら、1列につき1点を得る」

正「得点計算とき自分の農場の各列(縦3マス)を見て、3マス全てが部屋か、3マス全てが畑か、3マス全てが同じ牧場に属していたら、1列につき1点を得る。」

【補足】縦1列は3マスである。3マス全てが部屋か、畑か、同じ牧場に属していれば、そのような列1つにつき1点(最大で5点になる)ということ。

★WM011 Bauunternehmer 建築業

【補足】増改築、大進歩コストとして支払うべき資材のうち最大1つを食料で代用できるという意味コストと無関係の手元の資材をこの機会に食料1に代えておける、ということではない。

★WM025 Pate 教父

原文:「Whenever you use an Action space orthogonally adjacent to an occupied "Family growth" Action space from stage 2 or stage 5, you receive 1 Grain immediately before.」

【補足】occupiedとあるので、「家族を増やす」のアクションスペースが既に埋まっている場合に限定されるようである

βデッキ http://www.tgiw.info/2012/01/wm2.html

★WM005 Imker 養蜂

【補足】厩は「逆さま」ではなく横向けに倒して置く。というかあのコマを逆さまには置けない(笑)

★WM008 Bread Carrier パン運び

原文:「Once any player has built an Oven, place 1 Food on the remaining Round spaces. At the start of these rounds, you receive the Food. (If an Oven has already been built, place the Food immediately. If multiple Ovens are built, you only receive the Food once.)」

誤:「次にかまどを作ったら、残っているラウンドスペース全てに食料1ずつ置く。各ラウンドのはじめに、この食料を得る(すでにかまどをもっていたら、かまどがいくつあってもすぐに食料1ずつ置く。「かまど」とは○○かまどという名前の、パンを焼く進歩カード)」

正:「誰かが暖炉を作ったら、それ以降のラウンドスペース全てに1つずつ食料を置く。各ラウンドのはじめに、この食料を得る(すでに暖炉ができていたらすぐに食料を並べる。複数の暖炉が作られても、食料を置くのは一度だけ)」

【補足】Ovenは「かまど(Fireplace)」ではなく「暖炉である(大きい進歩としては「レンガの暖炉(Clay Oven)」と「石の暖炉(Stone Oven)」がある)。また、暖炉を作るプレイヤーは誰でもよい。井戸で起動する「水運び」(I262)の暖炉である

★WM035 Postmann 郵便

【補足】直後にそのアクションスペースを使ったプレイヤーが回収しなかった場合には、置かれた資材はそのままそこに残る。誰かが回収するまで、そこを使ったプレイヤーに購入権が与えられる。

(参照:http://play-agricola.com/Agricola/Cards/index.php?id=1068

★WM054 Schubkarrenschieber 手押し車使い

【補足】この職業自体には、資材が累積するスペースに複数ある資材のうちの1つだけを取って他を残しておく、という能力はない。あくまでも、1つしか累積がなかった場合の救済措置であるもっとも、キノコ探し(I196)やかご(E34)のように資材の一部を残しておく能力別にあって、その効果で結局1つしか資材を取らなかった、という場合には、この職業効果は発動する。

なお、5人プレイ時に葦が累積する葦石木のアクションスペースについては、葦の累積個数にかかわらず、全体で最低3つの資材を取ることとなるから、この職業効果は発動しない。

(参照:http://play-agricola.com/Agricola/Cards/index.php?id=1885

★WM102 Widder 雄羊

【補足】追加で繁殖するのは、6,8,10,12ラウンドの「終了時」である

γデッキ http://www.tgiw.info/2012/02/wm3.html

★WM004 Sparbacker 即席パン屋

原文:「Whenever you build a Baking Improvement with the bread symbol, you receive 1 Grain before building the Improvement. Whenever you build an Oven, pay 1 Building resource less of your choice. (An Oven is a Baking Improvement with "Oven" in the name.)」

誤:「すべての暖炉を資材どれか1つ少なく作ることができる。パンを焼くアクションのたびに、その直前に小麦1をストックから手に入れる。(パンを焼くアクションにはパンのマークが付いています暖炉(「○○暖炉」という名前進歩カード)を使うのもパンを焼くアクションです)」

正:「あなたがパンのマークのついた進歩プレイするたびに、その直前に小麦1を共通のストックから手に入れる。すべての暖炉を、好きな資材1つ少なく作ることができる」

【補足】パンを焼く進歩カードプレイ(・購入)するたびに起動する。「炭焼き」(E182)と同じ。

★WM036 Chefkoch シェフ

原文:「Each round, instead of placing your first Family member on an Action space, you may place it on this card and receive 2 Food and 1 Guest token to place that round. (You may not do this if you will be placing more people after your first without another player placing in between.)」

誤:「~(最初家族を置いた直後にこのカードを使うことはできない)」

正:「~(あなた最初家族とそれ以降の家族連続して置ける状況では、この効果を使うことはできない)」

【補足】最後の括弧は、「遅寝(Late Sleeper)」(G037)のように、他の全プレイヤーの手番が終了するまで自分の手番がスキップされる状況でこの効果が使えると強すぎるため、それを回避する趣旨で設けられたルールである

(参照:http://play-agricola.com/Agricola/Cards/index.php?id=505

★WM061 Hintertur 裏口

原文:「Immediately place a person that is not already placed on an Action space on the "After Family Growth also 1 Minor Improvement" Action space even if it is occupied by you or another player and take that action.」

誤:「~ほかのプレイヤーがそのアクションスペースに家族を置いていてもよい。~」

正:「~誰か(あなたでもよい)がそのアクションスペースに家族を置いていてもよい。~」

【補足】自分自身が既にそのアクションスペースを使っている場合にも使える。

★WM104 Schilfzich 葦栽培

【補足】「得点計算の直前に葦をボーナス点に換えられる」ということの意味は、かご製作所のボーナス点を計算する前にこれらの葦を消費してしまうことにある。

δデッキ http://www.tgiw.info/2012/03/wm4.html

★WM019 Familienplaner 家族計画

【補足】誤:「子孫」→正:「新生児

★WM020 Hofschulabsolvent 農業学校卒業生

【補足】収穫「の開始時」のたびに

★WM023 Waldbauer 森の農夫

【補足】「労働から帰宅の間に」に相当する原文は「between the Work and Returning home phase」であり、労働フェイズ帰宅フェイズの間、すなわち「全員が家族を置いた後」を意味する。「曲芸師」(I269)や「営農家」(K289)と同様。

★WM056 Armenhaus 救貧院

【補足】捨ててもよい物乞いカードは、直前の食糧供給フェイズに受け取ったものに限らない(以前の収穫の食糧供給フェイズに受け取ったものでもよい。)。

★WM110 Gerateschuppen 物置小屋

【補足】誤:「柵」→正:「厩」(stable)

εデッキ http://www.tgiw.info/2012/03/wm5.html

★WM037 Stalleinrichter 厩作り

【補足】「厩作り」という名前カードは他に存在する(E208)。「厩務員」という名前はどうだろうか。

★WM039 Pfandleiher 質屋

原文:「At any time, you may convert all the printed Victory points (if any) of an Improvement in front of you to 3 Food per point. After, you may not return or remove the Improvement and you no longer receive its Victory points. If Pawnbroker gets turned face down or discarded, you still lose the points.」

誤:「~食料を取ったカードは戻したり取り除いたりしない~」

正:「~これ以降、その進歩カードを返却したり取り除いたりすることはできなくなる~」

【補足】例えば「かまど」を3食糧に変換したら、その「かまど」を返して「調理場」にアップグレードすることができなくなる。

★WM055 Holzarbeiter 木こり

【補足】「木こり」という名前カードは他に存在する(E176)。「木工職人」という名前はどうだろうか。

★WM064 Lagerfeuer キャンプファイヤー

【補足】「この木材はいつでも共通のストックに戻すことができ、戻したラウンドが終わるまでの間に家畜を何頭でも食料にできる」というのは、戻したラウンドに限り(その終了時までは)家畜を食料に変換できる、という意味である

★WM065 Begrenzungssteine 境界

【補足】たとえば次の盤面なら「ほかの畑1ヵ所のみと接している畑」が3つで2点。

畑 畑 畑 牧 牧
家 畑 空 牧 牧
家 家 家 牧 牧

5点(「ほかの畑1ヵ所のみと接している畑」が5以上)取るためにはこういった配置が必要

家 牧 畑 空 畑
家 畑 畑 畑 畑
家 家 畑 空 畑

(参照:http://play-agricola.com/Agricola/Cards/index.php?id=637

★WM070 Aufziehmann ゼンマイ人形

原文:「Clockwork Man counts as 1 Occupation and 1 Minor Improvement.」

誤:「このカードは小さな進歩ではなく職業とみなす」

正:「このカードは小さい進歩であると同時に職業としてもカウントする」

【補足】1枚目の職業を出す前にこのカードプレイすると、「職業」のアクションスペースでの食料の支払いが無料ではなくなることに注意。

★WM105 Rotherhampflug ロザラムの鋤

原文:「Whenever you use the "Plow 1 Field" Action space, you may Plow 2 fields if they are not diagonally or orthogonally adjacent to each other instead of 1.」

誤:「家族コマで「畑1を耕す」のアクションを行い、実際に畑1だけを耕すたびに、すぐさらに畑2を耕せる。~」

正:「「畑1を耕す」のアクションを行うたびに、畑1の代わりに畑2を耕すことができる。~」

【補足】追加は畑1

2012-07-28

シェル操作課題 SQLによる解答例

シェル操作課題 (cut, sort, uniq などで集計を行う) 設問編 - Yamashiro0217の日記の解答例です。MySQL 5.5です。

準備
mysql> CREATE TABLE log (
    ->   id          BIGINT PRIMARY KEY AUTO_INCREMENT,
    ->   server_host VARCHAR(30),
    ->   access_time DATETIME,
    ->   user_id     INT,
    ->   access_url  VARCHAR(191)
    -> );
Query OK, 0 rows affected (0.00 sec)

mysql> LOAD DATA LOCAL INFILE 'log.csv'
    -> INTO TABLE log
    -> FIELDS TERMINATED BY ','
    -> (server_host, @unixtime, user_id, access_url)
    -> SET access_time = FROM_UNIXTIME(@unixtime);
Query OK, 9 rows affected (0.01 sec)
Records: 9  Deleted: 0  Skipped: 0  Warnings: 0
問1 このファイルを表示しろ
mysqlSELECT server_host, access_time, user_id, access_url
    -> FROM log;
+-------------+---------------------+---------+--------------+
| server_host | access_time         | user_id | access_url   |
+-------------+---------------------+---------+--------------+
| server1     | 2012-07-27 13:25:24 |      30 | /video.php   |
| server2     | 2012-07-27 13:25:10 |      20 | /profile.php |
| server3     | 2012-07-27 13:25:15 |       7 | /login.php   |
| server1     | 2012-07-27 13:25:05 |       8 | /profile.php |
| server2     | 2012-07-27 13:26:45 |      35 | /profile.php |
| server2     | 2012-07-27 13:25:10 |      20 | /profile.php |
| server3     | 2012-07-27 13:26:45 |      30 | /login.php   |
| server4     | 2012-07-27 13:27:05 |      12 | /video.php   |
| server1     | 2012-07-27 13:27:45 |       7 | /video.php   |
+-------------+---------------------+---------+--------------+
9 rows in set (0.00 sec)
問2 このファイルからサーバー名とアクセス先だけ表示しろ
mysqlSELECT server_host, access_url
    -> FROM log;
+-------------+--------------+
| server_host | access_url   |
+-------------+--------------+
| server1     | /video.php   |
| server2     | /profile.php |
| server3     | /login.php   |
| server1     | /profile.php |
| server2     | /profile.php |
| server2     | /profile.php |
| server3     | /login.php   |
| server4     | /video.php   |
| server1     | /video.php   |
+-------------+--------------+
9 rows in set (0.00 sec)
問3 このファイルからserver4の行だけ表示しろ
mysql> CREATE INDEX log_ix1 ON log (server_host);
Query OK, 0 rows affected (0.01 sec)
Records: 0  Duplicates: 0  Warnings: 0

mysqlSELECT server_host, access_time, user_id, access_url
    -> FROM log
    -> WHERE server_host = 'server4';
+-------------+---------------------+---------+------------+
| server_host | access_time         | user_id | access_url |
+-------------+---------------------+---------+------------+
| server4     | 2012-07-27 13:27:05 |      12 | /video.php |
+-------------+---------------------+---------+------------+
1 row in set (0.00 sec)

インデックスを作らなかった場合は減点します。

問4 このファイルの行数を表示しろ
mysqlSELECT COUNT(*)
    -> FROM log;
+----------+
| COUNT(*) |
+----------+
|        9 |
+----------+
1 row in set (0.00 sec)
問5 このファイルサーバー名、ユーザーIDの昇順で5行だけ表示しろ
mysqlSELECT server_host, access_time, user_id, access_url
    -> FROM log
    -> ORDER BY server_host, user_id
    -> LIMIT 5;
+-------------+---------------------+---------+--------------+
| server_host | access_time         | user_id | access_url   |
+-------------+---------------------+---------+--------------+
| server1     | 2012-07-27 13:27:45 |       7 | /video.php   |
| server1     | 2012-07-27 13:25:05 |       8 | /profile.php |
| server1     | 2012-07-27 13:25:24 |      30 | /video.php   |
| server2     | 2012-07-27 13:25:10 |      20 | /profile.php |
| server2     | 2012-07-27 13:25:10 |      20 | /profile.php |
+-------------+---------------------+---------+--------------+
5 rows in set (0.00 sec)
問6 このファイルには重複行がある。重複行はまとめて数え行数を表示しろ
mysqlSELECT COUNT(DISTINCT server_host, access_time, user_id, access_url)
    -> FROM log;
+---------------------------------------------------------------+
| COUNT(DISTINCT server_host, access_time, user_id, access_url) |
+---------------------------------------------------------------+
|                                                             8 |
+---------------------------------------------------------------+
1 row in set (0.00 sec)

COUNT関数の中にDISTINCTを書けるのは覚えておくと便利です。

問7 このログのUU(ユニークユーザー)数を表示しろ
mysqlSELECT COUNT(DISTINCT user_id)
    -> FROM log;
+-------------------------+
| COUNT(DISTINCT user_id) |
+-------------------------+
|                       6 |
+-------------------------+
1 row in set (0.00 sec)
問8 このログアクセス先ごとにアクセス数を数え上位1つを表示しろ
mysqlSELECT access_url, COUNT(*)
    -> FROM log
    -> GROUP BY access_url
    -> ORDER BY COUNT(*) DESC
    -> LIMIT 1;
+--------------+----------+
| access_url   | COUNT(*) |
+--------------+----------+
| /profile.php |        4 |
+--------------+----------+
1 row in set (0.00 sec)
問9 このログのserverという文字列をxxxという文字列に変え、サーバー毎のアクセス数を表示しろ
mysqlSELECT REPLACE(server_host, 'server', 'xxx'), COUNT(*)
    -> FROM log
    -> GROUP BY server_host;
+---------------------------------------+----------+
| REPLACE(server_host, 'server', 'xxx') | COUNT(*) |
+---------------------------------------+----------+
| xxx1                                  |        3 |
| xxx2                                  |        3 |
| xxx3                                  |        2 |
| xxx4                                  |        1 |
+---------------------------------------+----------+
4 rows in set (0.00 sec)
10 このログユーザーID10以上の人のユニークユーザーIDユーザーIDソートして表示しろ
mysqlSELECT DISTINCT user_id
    -> FROM log
    -> WHERE user_id >= 10
    -> ORDER BY user_id;
+---------+
| user_id |
+---------+
|      12 |
|      20 |
|      30 |
|      35 |
+---------+
4 rows in set (0.00 sec)
個人的な感触

2011-11-08

Thunderbird から Outlook 2007 にメールを移行

やー。面倒でした。

古い情報だと Outlook Express を経由しろと書いてあるので、後継であるらしいWindows Live Mail を経由して(Windows Live Mail からエクスポートする方法で)

Outlook に移行したのだが、どういうわけか宛名が文字列として移行されてしまい、xxx@example.com というメールアドレスの移行ができなかったんです

で eml → msg もしくは pst 形式への変換ソフトを探すのですが、無料ものが見つからなくてあんまり情報もありませんでした。が、ありましたよ!お兄さん。

これなら、msg ⇔ eml の相互変換ができますです

MrMAPI.exe

http://mfcmapi.codeplex.com/

ヘルプはっときますね。

====

MAPI data collection and parsing tool. Supports property tag lookup, error translation,
   smart view processing, rule tables, ACL tables, contents tables, and MAPI<->MIME conversion.
MrMAPI currently knows:
  3916 property tags
   801 dispids
    35 types
    58 guids
   148 errors
    27 smart view parsers

Usage:
   MrMAPI -?
   MrMAPI [-Search] [-Dispids] [-Number] [-Type <type>] <property number>|<property name>
   MrMAPI -Guids
   MrMAPI -Error <error>
   MrMAPI -ParserType <type> -Input <input file> [-Binary] [-Output <output file>]
   MrMAPI -Flag <flag value> [-Dispids] [-Number] <property number>|<property name>
   MrMAPI -Rules [-Profile <profile>] [-Folder <folder>]
   MrMAPI -Acl [-Profile <profile>] [-Folder <folder>]
   MrMAPI [-Contents | -HiddenContents] [-Profile <profile>] [-Folder <folder>] [-Output <output directory>]
          [-Subject <subject>] [-MessageClass <message class>] [-MSG] [-List]
   MrMAPI -ChildFolders [-Profile <profile>] [-Folder <folder>]
   MrMAPI -XML -Input <path to input file> -Output <path to output file>
   MrMAPI -FID [fid] [-MID [mid]] [-Profile <profile>]
   MrMAPI -MAPI | -MIME -Input <path to input file> -Output <path to output file> [-CCSFFlags <conversion flags>]
          [-RFC822] [-Wrap <Decimal number of characters>] [-Encoding <Decimal number indicating encoding>]
          [-AddressBook] [-Unicode] [-Charset CodePage CharSetType CharSetApplyType]

All switches may be shortened if the intended switch is unambiguous.
For example, -T may be used instead of -Type.

   Help:
   -?   Display expanded help.

   Property Tag Lookup:
   -S   (or -Search) Perform substring search.
           With no parameters prints all known properties.
   -D   (or -Dispids) Search dispids.
   -N   (or -Number) Number is in decimal. Ignored for non-numbers.
   -T   (or -Type) Print information on specified type.
           With no parameters prints list of known types.
           When combined with -S, restrict output to given type.
   -G   (or -Guids) Display list of known guids.

   Flag Lookup:
   -Fl  (or -Flag) Look up flags for specified property.
           May be combined with -D and -N switches, but all flag values must be in hex.

   Error Parsing:
   -E   (or -Error) Map an error code to its name and vice versa.
           May be combined with -S and -N switches.

   Smart View Parsing:
   -P   (or -ParserType) Parser type (number). See list below for supported parsers.
   -B   (or -Binary) Input file is binary. Default is hex encoded text.

   Rules Table:
   -R   (or -Rules) Output rules table. Profile optional.

   ACL Table:
   -A   (or -Acl) Output ACL table. Profile optional.

   Contents Table:
   -C   (or -Contents) Output contents table. May be combined with -H. Profile optional.
   -H   (or -HiddenContents) Output associated contents table. May be combined with -C. Profile optional
   -Su  (or -Subject) Subject of messages to output.
   -Me  (or -MessageClass) Message class of messages to output.
   -Ms  (or -MSG) Output as .MSG instead of XML.
   -L   (or -List) List details to screen and do not output files.

   Child Folders:
   -Chi (or -ChildFolders) Display child folders of selected folder.

   MSG File Properties
   -X   (or -XML) Output properties of an MSG file as XML.

   MID/FID Lookup
   -Fi  (or -FID) Folder ID (FID) to search for.
           If -FID is specified without a FID, search/display all folders
   -Mid (or -MID) Message ID (MID) to search for.
           If -MID is specified without a MID, display all messages in folders specified by the FID parameter.

   MAPI <-> MIME Conversion:
   -Ma  (or -MAPI) Convert an EML file to MAPI format (MSG file).
   -Mi  (or -MIME) Convert an MSG file to MIME format (EML file).
   -I   (or -Input) Indicates the input file for conversion, either a MIME-formatted EML file or an MSG file.
   -O   (or -Output) Indicates the output file for the convertion.
   -Cc  (or -CCSFFlags) Indicates specific flags to pass to the converter.
           Available values (these may be OR'ed together):
              MIME -> MAPI:
                CCSF_SMTP:        0x02
                CCSF_INCLUDE_BCC: 0x20
                CCSF_USE_RTF:     0x80
              MAPI -> MIME:
                CCSF_NOHEADERS:        0x0004
                CCSF_USE_TNEF:         0x0010
                CCSF_8BITHEADERS:      0x0040
                CCSF_PLAIN_TEXT_ONLY:  0x1000
                CCSF_NO_MSGID:         0x4000
                CCSF_EMBEDDED_MESSAGE: 0x8000
   -Rf  (or -RFC822) (MAPI->MIME only) Indicates the EML should be generated in RFC822 format.
           If not present, RFC1521 is used instead.
   -W   (or -Wrap) (MAPI->MIME only) Indicates the maximum number of characters in each line in the
           generated EML. Default value is 74. A value of 0 indicates no wrapping.
   -En  (or -Encoding) (MAPI->MIME only) Indicates the encoding type to use. Supported values are:
              1 - Base64
              2 - UUENCODE
              3 - Quoted-Printable
              4 - 7bit (DEFAULT)
              5 - 8bit
   -Ad  (or -AddressBook) Pass MAPI Address Book into converter. Profile optional.
   -U   (or -Unicode) (MIME->MAPI only) The resulting MSG file should be unicode.
   -Ch  (or -Charset) (MIME->MAPI only) Character set - three required parameters:
           CodePage - common values (others supported)
              1252  - CP_USASCII      - Indicates the USASCII character set, Windows code page 1252
              1200  - CP_UNICODE      - Indicates the Unicode character set, Windows code page 1200
              50932 - CP_JAUTODETECT  - Indicates Japanese auto-detect (50932)
              50949 - CP_KAUTODETECT  - Indicates Korean auto-detect (50949)
              50221 - CP_ISO2022JPESC - Indicates the Internet character set ISO-2022-JP-ESC
              50222 - CP_ISO2022JPSIO - Indicates the Internet character set ISO-2022-JP-SIO
           CharSetType - supported values (see CHARSETTYPE)
              0 - CHARSET_BODY
              1 - CHARSET_HEADER
              2 - CHARSET_WEB
           CharSetApplyType - supported values (see CSETAPPLYTYPE)
              0 - CSET_APPLY_UNTAGGED
              1 - CSET_APPLY_ALL
              2 - CSET_APPLY_TAG_ALL

   Universal Options:
   -I   (or -Input) Input file.
   -O   (or -Output) Output file or directory.
   -F   (or -Folder) Folder to scan. Default is Inbox. See list below for supported folders.
           Folders may also be specified by path:
              "Top of Information Store\Calendar"
           Path may be preceeded by entry IDs for special folders using @ notation:
              "@PR_IPM_SUBTREE_ENTRYID\Calendar"
           MrMAPI's special folder constants may also be used:
              "@12\Calendar"
              "@1"
   -Pr  (or -Profile) Profile for MAPILogonEx.
   -M   (or -MoreProperties) More properties. Tries harder to get stream properties. May take longer.
   -No  (or -NoAddins) No Addins. Don't load any add-ins.
   -On  (or -Online) Online mode. Bypass cached mode.
   -V   (or -Verbose) Verbose. Turn on all debug output.

Smart View Parsers:
    1 Additional Ren Entry IDs Ex
    2 Appointment Recurrence Pattern
    3 Conversation Index
    4 Entry Id
    5 Entry List
    6 Extended Folder Flags
    7 Extended Rule Condition
    8 Flat Entry List
    9 Folder User Fields Stream
   10 Global Object Id
   11 Property
   12 Property Definition Stream
   13 Recipient Row Stream
   14 Recurrence Pattern
   15 Report Tag
   16 Restriction
   17 Rule Condition
   18 Search Folder Definition
   19 Security Descriptor
   20 SID
   21 Task Assigners
   22 Time Zone
   23 Time Zone Definition
   24 Web View Persistence Object Stream
   25 Nickname Cache
   26 Encode Entry ID
   27 Decode Entry ID

Folders:
    1 Calendar
    2 Contacts
    3 Journal
    4 Notes
    5 Tasks
    6 Reminders
    7 Drafts
    8 Sent Items
    9 Outbox
   10 Deleted Items
   11 Finder
   12 IPM_SUBTREE
   13 Inbox
   14 Local Freebusy
   15 Conflicts
   16 Sync Issues
   17 Local Failures
   18 Server Failures
   19 Junk E-mail

Examples:
   MrMAPI PR_DISPLAY_NAME

   MrMAPI 0x3001001e
   MrMAPI 3001001e
   MrMAPI 3001

   MrMAPI -n 12289

   MrMAPI -t PT_LONG
   MrMAPI -t 3102
   MrMAPI -t

   MrMAPI -s display
   MrMAPI -s display -t PT_LONG
   MrMAPI -t 102 -s display

   MrMAPI -d dispidReminderTime
   MrMAPI -d 0x8502
   MrMAPI -d -s reminder
   MrMAPI -d -n 34050

   MrMAPI -p 17 -i webview.txt -o parsed.txt

2011-03-09

2011年版】Wordpressお薦めプラグインまとめのまとめ+ソーシャルプラグイン

これからWordpressを始める方、あるいは始めている方が

Wordpressプラグインを探す際に便利になるかな、と思いまとめてみました

2010年以降のみのまとめ及びエントリーに絞っています。

(1)基本的なプラグイン

(2)SEOこだわり派プラグイン

(3)仕事系お役立ちプラグイン

(4)中級者から上級者向けのマニアックプラグイン

(5)ソーシャルプラグインの紹介記事


(1)基本的なプラグイン

2011年版!絶対にインストールしたWordPressプラグイン45個|Vanilla Rock

http://vanilla-rock.com/blog/wordpress/45-absolutely-install-wordpress-plugin/

ある程度、基本的なものからメジャーなものまで揃っています。

Wordpressを始めた人が最初に見ておくと、何かと便利かと思います。



WordPressブログを作ったら入れるべき27個のプラグイン|AUTHORITY SITE

http://www.authority-site.com/2010/04/wordpress/27-wordpress-plugin.html

記事内やサイドバー内で、PHPを扱うことができるものなどの紹介。



使用中のおすすめWordPressプラグイン15個 | Webクリエイターボックス

http://www.webcreatorbox.com/tech/recommended-wordpress-plugin/

フォーム用キャプチャプラグインReally Simple CAPTCHAや、

管理画面に行かなくてもタイトルや本文、カテゴリー名などを編集できるFront-end Editorなどの紹介。



WordPressプラグイン 必須なものから便利なちょっとしたものまで(Webデザインレシピ

http://webdesignrecipes.com/my-favorite-wordpress-plugins/

記事中の画像を1枚だけ取得してサムネイル表示してくれるPost Thumb Revisitedや、

携帯電話から記事を投稿できるKtai Entryなどの紹介。



(2)SEOこだわり派プラグイン

あまり知られていないかもなSEO関連のWordPressプラグイン集:phpspot開発日誌

http://phpspot.org/blog/archives/2011/03/seowordpress_1.html

かなりマニアックSEOに関するまとめです検索対策にこだわりたい方向けです



(3)仕事系お役立ちプラグイン

クライアントに頼まれやすい機能を補えるWordPressプラグインいろいろ-かちびと.net

http://kachibito.net/wordpress/plugins-for-commercial.html

アップロードした画像を一括で記事内に挿入できる、File Galleryや、

管理画面TOPメモを加えるQuickNotes on WP Dashboardなどの紹介。



特集記事や新着記事を見栄えよくスライドショーしてくれるWordPressプラグインまとめ « Web制作覚え書き

http://webdevtoolsoboegaki.wordpress.com/2010/06/22/%E7%89%B9%E9%9B%86%E8%A8%98%

E4%BA%8B%E3%82%84%E6%96%B0%E7%9D%80%E8%A8%98%E4%BA%8B%E3%82%92%E8%A6%8B%E6%A0%84%

E3%81%88%E3%82%88%E3%81%8F%E3%82%B9%E3%83%A9%E3%82%A4%E3%83%89%E3%82%B7%E3%83%A7%E3%83%BC/

イメージをフェードイン・アウトしてくれるプラグインWordPress Content Slideなどの紹介。

URLが長いので繋げてアクセスするか、記事名で検索するかしてください)



WordPressサイトを構築した際に活用したプラグイン5個+α - id:HolyGrailid:HoryGrailの区別がつかない日記

http://d.hatena.ne.jp/HolyGrail/20110228/1298889864

会員登録時に必要な項目を追加する、Cimy User Extra Fieldsなどの紹介。



(4)中級者から上級者向けのマニアックプラグイン

WordPress 3.0対応のとっても便利なプラグイン集|コリス

http://coliss.com/articles/blog/wordpress/plugin/best-plugins-for-wordpress-3.html

管理画面のメニューに好きなアイテムを追加できるFavorites Menu Manager

や、投稿編集ページにカスタムフィールドHTMLを挿入できるInsertMeta ShortCodeなどの紹介。



(5)ソーシャルプラグインの紹介記事


WP Social Bookmarking Light | NINXIT-BLOG

http://www.ninxit.com/blog/2010/06/13/wp-social-bookmarking-light/

はてぶ、FacebookTwitter他、表示させたいものは各々で選択可



WordPressTwitterコメントシステムプラグインリリース!– [Mu]ムジログ

http://musilog.net/webdesign/wordpress/twitter-anyware-comment-system.php

みんなのTwitterからの言及コメントを表示できます



RTしてくれたTwitterの呟きがコメント欄に全文表示されるプラグインBackType Connect”がとても良い!

[WordPress] [Twitter] [net] | No Second Life

http://www.ttcbn.net/no_second_life/archives/1144

1つ上のと同じような機能です、お好みでどうぞ。


WordPresプラグインTwitter tools」のバージョンアップ版のインストールと設定、使い方を日本語解説!:WordPressアマモ

http://www.amamoba.com/wordpress/twitter-tools2.html

記事の投稿と同時に、Twitterポストするタイププラグイン

2008-11-23

http://anond.hatelabo.jp/20081122230757

とても簡単な話で、Jane Plantのキャリア地質学からその延長の環境科学に関するものであって医学ではない。

それは日本語出版元のサイトでもわかるし

http://www.komichi.co.jp/bd/4-7705-0200-1.html

インペリアル大学教授としての執筆リストでもそれは裏付けられる

http://www3.imperial.ac.uk/people/jane.plant/publications

出版元に「2005年 英国王立医学協会(Royal Society of Medicine) 終身会員」とあるが、

インペリアル大学サイト

http://www3.imperial.ac.uk/people/jane.plant

では 2005 FRSM とある。Fellow ということ。

http://www.rsm.ac.uk/membersh/catmem.php

によれば、会員は Fellow か 学生か 準会員か、しかないので、

Those holding medical, dental, veterinary or higher scientific qualifications; or in senior positions in healthcare and related fields.

にあてはまれば会員となれる。Jane Plantは地質学環境科学で十分にこれをクリアする。だって大学教授長年やってるんだもん。

「終身」については、偉いのではなくて、単に老い先短いと会費を一括払いして節約できるというだけ。「王立医学協会」って、要は学会だからねぇ。

http://www.rsm.ac.uk/membersh/rates.php#life

本人の健康宣伝目的個人サイトでも、経歴的にはこれはあきらかで、健康法の話はまったく関係ない。

http://www.cancersupportinternational.com/janeplant.com/science.asp

http://www.cancersupportinternational.com/janeplant.com/prof.asp

過去多くの実績があり、キャリアを築き上げてきた学者が、ほぼ一線の研究からは引退するタイミング

奇妙健康本を自分キャリアを利用して売り始めました、という以上のものではない。

最初の健康本を出してから2年ほどで RSM に終身で入会しているが、 RSMが拒否する理由はない、という以上のことはないだろう。

日本健康本業界的には、背景が見えないで英語情報にあたらない人たち相手に、話を歪めて宣伝しているわけだな。

2008-10-18

real street angels から mechanize を使って動画を取ってきてEmacsで見てみるよ

せっかく書いたから匿名でのせてみるよ

使い方は

  • 動画を取ってきたいよ
    • config.yamlユーザとかを設定するよ
    • ids.txt に取ってきたいIDを書くよ
    • sangels.bat を実行するよ
  • Emacs動画を見たいよ
    • sangels.el を load するよ
    • M-x sangels だよ

必要なものを gem で取ってくるにはこうすればいいよ

  • gem install -r log4r
  • gem install -r -v 0.6 hpricot
  • gem install -r mechanize

長すぎてelispが消えたから続きがあるよ

sangels.bat - 起動用バッチファイル

@echo off
setlocal
set WD=%~dp0
cd /d %WD%

ruby get_movies.rb
ruby get_images.rb
ruby create_m3u.rb

ruby

config.yaml - 設定ファイル
user: ユーザID
password: パスワード
ids_file: ids.txt
done_file: ids_done.txt
movies_dir: movies

log4r_config:
  pre_config:
    global: INFO
  loggers:
    - name: app
      type: Log4r::Logger
      level: INFO
      outputters:
        - STDOUT
        - FILE
  outputters:
    - name: STDOUT
      type: Log4r::StdoutOutputter
      formatter:
        type: Log4r::PatternFormatter
        pattern: "%d [%l] %C - %M"
        date_pattern: "%H:%M:%S"
    - name: FILE
      type: Log4r::FileOutputter 
      filename: "#{LOGDIR}/sangels.log"
      formatter:
        type: Log4r::PatternFormatter
        pattern: "%d [%l] %C - %M"
        date_pattern: "%Y-%m-%d %H:%M:%S"
get_movies.rb
require 'fileutils'
require 'logger'
require 'mechanize'

BASEDIR = File.dirname($0)
require "#{BASEDIR}/util"
require "#{BASEDIR}/sangels"

$config = load_config(BASEDIR)
prepare_logger(BASEDIR)
$log = new_logger("get_movies")
WWW::Mechanize.log = new_logger("mechanize")
WGet.log = $log

class IDFile
  def initialize(file)
    @file = file
    unless File.exist?(@file)
      Fileutils.touch(@file)
    end
  end

  def ids(contains_comment = nil)
    File.open(@file) {|io|
      io.to_a.map {|x|
        x.chomp
      }.select {|x|
        if x.empty?
          nil
        elsif contains_comment
          true
        else
          not /^\s*\#/ =~ x
        end
      }
    }
  end

  def add(id)
    ids = ids(true)
    unless ids.any? {|x| x == id}
      write(ids + [id])
    end
  end

  def delete(id)
    ids = ids(true)
    if ids.any? {|x| x == id}
      write(ids - [id])
    end
  end

  def write(ids)
    File.open(@file, "w") {|io|
      ids.each {|x| io.puts x}
    }
  end
end


$log.info("BEGIN #{$0} ================")
exit_code = 0
begin
  ids_file = IDFile.new($config.ids_file)
  done_file = IDFile.new($config.done_file)
  movies_dir = $config.movies_dir
  wget = WGet.new

  sangels = SAngels.new
  sangels.login($config.user, $config.password)
  ids_file.ids.each {|id|
    begin
      movies = sangels.movies(id)
    rescue SAngels::Movies::InvalidMoviesError
      $log.warn("invalid movie id: #{id}")
      next
    end
    dir = File.expand_path(id, movies_dir)
    movies.each {|link|
      wget.retrieve(link.href, dir)
    }
    expected = movies.movie_links.map{|x| File.basename(x.href)}
    actual = Dir.glob("#{dir}/*").map {|x| File.basename(x)}
    if (expected - actual).empty?
      done_file.add(id)
      ids_file.delete(id)
    end
  }
rescue => e
  $log.error(e)
  exit_code = 1
end

$log.info("END #{$0} (#{exit_code}) ================")
exit exit_code
get_images.rb
require 'fileutils'
require 'logger'
require 'mechanize'
require 'ostruct'

BASEDIR = File.dirname($0)
require "#{BASEDIR}/util"
require "#{BASEDIR}/sangels"

$config = load_config(BASEDIR)
prepare_logger(BASEDIR)
$log = new_logger("get_images")
WWW::Mechanize.log = new_logger("mechanize")
WGet.log = $log

$log.info("BEGIN #{$0} ================")
exit_code = 0
begin
  movies_dir = $config.movies_dir
  sangels = SAngels.new
  sangels.login($config.user, $config.password)
  thumbnails = sangels.thumbnails

  Dir.glob("#{movies_dir}/*").each {|dir|
    next unless File.directory? dir
    id = File.basename(dir)

    url = thumbnails.url(id)
    unless url
      $log.warn("#{id} is not found")
      next
    end
    path = File.expand_path("00_thumbnail#{File.extname(url)}", dir)
    next if File.exist? path

    $log.info("retrieving #{url}")
    thumbnail = thumbnails.get_file(id)
    File.open(path, "wb") {|io| io.write(thumbnail)}
  }
rescue => e
  $log.error(e)
  exit_code = 1
end

$log.info("END #{$0} (#{exit_code}) ================")
exit exit_code
create_m3u.rb
BASEDIR = File.dirname($0)
require "#{BASEDIR}/util"

$config = load_config(BASEDIR)
movies_dir = $config.movies_dir
Dir.glob("#{movies_dir}/*") {|dir|
  next unless File.directory? dir
  name = File.basename(dir)
  files = Dir.glob("#{dir}/*.wmv").sort

  File.open("#{movies_dir}/#{name}.m3u", "w") {|io|
    files.each {|file|
      io.puts "#{name}/#{File.basename(file)}"
    }
  }

  File.open("#{dir}/00_movies.m3u", "w") {|io|
    files.each {|file|
      io.puts "#{File.basename(file)}"
    }
  }
}
sangels.rb
require 'mechanize'
require 'hpricot'

BASEDIR = File.dirname($0)
require "#{BASEDIR}/util"

class SAngels
  HOST = "real2.s-angels.com"
  LOGIN_URL = "http://#{HOST}/member/"
  INFO_URL = "http://#{HOST}/teigaku/item.php"
  THUMBNAILS_URL = "http://#{HOST}/teigaku/"
  THUMBNAIL_URL = "http://#{HOST}/images/default/thumb/"

  def initialize()
    @agent = WWW::Mechanize.new
  end

  def login(user, password)
    login_form = @agent.get(LOGIN_URL).forms.find {|form|
      form.fields.any? {|field| field.name == "frmLoginid"}
    }
    login_form.frmLoginid = user
    login_form.frmPw = password
    @agent.submit(login_form)
  end

  def movies(id, no_validate = nil)
    Movies.new(@agent, id, !no_validate)
  end

  def thumbnails
    Thumbnails.new(@agent)
  end

  class Thumbnails
    def initialize(agent)
      @agent = agent
      doc = Hpricot(@agent.get_file(THUMBNAILS_URL))
      elems = doc.search("div[@class=realthum]/a")
      @links = Hash(
        elems.map {|elem|
          href = elem["href"]
          id = $1 if /ID=(.+)/ =~ href
          url = elem.search("img")[0]["src"]
          [id, url]
        })
    end

    def get_file(id)
      @agent.get_file(url(id))
    end

    def url(id)
      @links[id]
    end

    def exist?(id)
      url(id)
    end
  end

  class Movies
    class InvalidMoviesError < StandardError
    end

    def initialize(agent, id, no_validate)
      @agent = agent
      @id = id
      if !no_validate &amp;&amp; !valid?
        raise InvalidMoviesError
      end
    end

    def info_page_url
      "#{INFO_URL}?ID=#{@id}"
    end

    def info_page
      @agent.get(info_page_url)
    end

    def movies_page
      @agent.click(info_page.links.find {|link| /P=10/ =~ link.href})
    end

    def movie_links
      movies_page.links.select {|link|
        /wmv$/ =~ link.href
      }.sort {|a, b|
        File.basename(a.href) <=> File.basename(b.href)
      }
    end

    def valid?
      info_page.uri.to_s == info_page_url
    end

    def each(&amp;block)
      orig_links = movie_links
      orig_links.each {|orig_link|
        link = movie_links.find {|l| File.basename(l.href) == File.basename(orig_link.href)}
        block.call(link)
      }
    end
  end
end
util.rb
require 'log4r'
require 'log4r/yamlconfigurator'
require 'singleton'
require 'fileutils'
require 'ostruct'

def Hash(a)
  Hash[*a.flatten]
end

def load_config(basedir)
  OpenStruct.new(File.open("#{basedir}/config.yaml") {|io| YAML.load(io)})
end

def new_logger(name)
  Log4r::Logger.new("app::#{name}")
end

def prepare_logger(basedir, logdir = nil)
  logdir ||= basedir
  Log4r::YamlConfigurator["LOGDIR"] = logdir
  Log4r::YamlConfigurator.load_yaml_file("#{basedir}/config.yaml")
end

class NullObject
  include Singleton
  def method_missing(message, *arg)
    NullObject.singleton
  end
end

class WGet
  class << self
    attr_accessor :log
    def initialize
      super
      @log = NullObject.singleton
    end
  end
  
  def log
    self.class.log
  end

  def retrieve(url, dir)
    FileUtils.mkdir_p(dir)
    file = File.expand_path(File.basename(url), dir)
    if File.exist?(file)
      log.info("already retrieved #{url}")
      return true
    end

    tmp = "#{file}.part"
    log.info("retrieving #{url}")
    ret = system("wget", "-c", "-O", tmp, url)
    if ret
      log.info("retrieving succeeded #{url}")
      File.rename(tmp, file)
    else
      if $? == 0x020000 # Ctrl-C
        exit($?)
      else
        log.error("retrieving failure #{url} (#{$?})")
      end
    end
    return ret
  end
end

2008-10-12

[][]Grass

Table of Contents: ||||||

オープンソースソフトウェアGISOpen Source software and GISOpen Source software and GIS 1 (6)
オープンソース概念Open Source concept1 (2)
オープンソースGISとしてのGRASSGRASS as an Open Source GIS3 (2)
ノースカロライナサンプルデータセットThe North Carolina sample data set 5 (1)
この本の読み方How to read this book5 (2)
GIS概念GIS conceptsGIS concepts 7 (14)
一般的なGIS原理General GIS principles 7 (6)
地理空間データモデルGeospatial data models 7 (4)
GISデータシステムの構成Organization of GIS data and system11 (2)
機能functionality
地図投影法と座標系Map projections and coordinate systems 13 (8)
地図投影原理Map projection principles13 (3)
一般的な座標系とdatumsCommon coordinate systems and datums 16 (5)
GRASSをはじめようGetting started with GRASSGetting started with GRASS 21 (32)
第一歩First steps21 (16)
GRASSダウンロードインストールDownload and install GRASS 21 (2)
データベースコマンド構造Database and command structure 23 (3)
GRASS6のためのグラフィカルユーザインタフェイス: Graphical User Interfaces for GRASS 6: 26 (1)
QGISgis.mQGIS and gis.m
ノースカロライナを用いてGRASSを開始Starting GRASS with the North Carolina 27 (3)
データセットdata set
GRASSデータディスプレイ3D可視化GRASS data display and 3D visualization30 (4)
プロジェクトデータ管理Project data management34 (3)
新しいプロジェクトGRASSを開始Starting GRASS with a new project37 (7)
aのための座標系の定義Defining the coordinate system for a 40 (4)
新しいプロジェクトnew project
空間投影されていないxy座標系Non-georeferenced xy coordinate system 44 (1)
座標系の変換Coordinate system transformations44 (9)
座標系のリストCoordinate lists 45 (2)
ラスタベクトル地図投影Projection of raster and vector maps 47 (1)
GDAL/OGRツールで、再投影Reprojecting with GDAL/OGR tools 48 (5)
GRASSデータモデルデータの交換GRASS data models and data exchange53 (30)
ラスタデータRaster data54 (16)
GRASS2Dの、3DラスタデータモデルGRASS 2D and 3D raster data models 54 (2)
領域の統合と境界Managing regions and boundaries raster map resolution
ジオコードされたラスタデータインポートImport of georeferenced raster data58 (8)
スキャンされた歴史地図インポートとジオコーディングImport and geocoding of a scanned66 (3)
ラスタデータエクスポートRaster data export 69 (1)
ベクトルデータVector data70 (13)
GRASSベクトルデータモデルGRASS vector data model70 (3)
ベクトルデータインポートImport of vector data73 (5)
xy CAD描画のための座標変換Coordinate transformation for xy CAD drawings 78 (2)
ベクトルデータエクスポートExport of vector data80 (3)
ラスタデータを使うWorking with raster data 83 (86)
ラスタ地図を表示、管理Viewing and managing raster maps 83 (22)
ラスタデータの表示と、カラーテーブルの割り当てDisplaying raster data and assigning a color table 83 (3)
ラスタ地図に関するメタデータを管理Managing metadata of raster maps 86 (2)
ラスタ地図クエリプロファイルRaster map queries and profiles88 (2)
ラスタ地図統計Raster map statistics90 (1)
ラスタ地図ズームと、部分集合の生成Zooming and generating subsets from91 (1)
簡単なラスタ地図の生成Generating simple raster maps92 (2)
再分類と再スケーリングReclassification and rescaling of94 (3)
ラスタ地図raster maps
ラスタ地図タイプの記録と値の置換Recoding of raster map types and value replacements 97 (2)
カテゴリベルの割り当てAssigning category labels99 (4)
マスキングとノーデータ値の取り扱いMasking and handling of no-data values 103(2)
ラスタ地図の計算Raster map algebra 105(10)
整数と浮動小数点データInteger and floating point data107(1)
基本的な計算Basic calculations 108(1)
“if"状態を使うWorking with ``if'' conditions109(1)
r.mapcalcのNULL値の取り扱いHandling of NULL values in r.mapcalc 110(1)
r.mapcalcでMASKを作成Creating a MASK with r.mapcalc 111(1)
特別なグラフ演算子Special graph operators112(1)
相対的座標での近傍演算Neighborhood operations with relative coordinates113(2)
ラスタデータの変換と内挿Raster data transformation and interpolation 115(11)
離散的ラスタデータ自動ベクトルAutomated vectorization of discrete raster data115(3)
連続フィールドの等値線の描画を生成Generating isolines representing continuous fields 118(1)
ラスタデータのリサンプリングと内挿Resampling and interpolation of raster data 119(5)
ラスタ地図オーバーレイマージOverlaying and merging raster maps 124(2)
ラスタデータの空間分析Spatial analysis with raster data126(29)
近傍分析とクロスカテゴリー統計Neighborhood analysis and cross-category statistics126(7)
ラスタフィーチャのバッファリングBuffering of raster features 133(2)
コストサーフェイスCost surfaces135(5)
地勢と分水界分析Terrain and watershed analysis 140(13)
ランドスケープ構造解析Landscape structure analysis 153(2)
ランドスケーププロセスモデリングLandscape process modeling 155(11)
文学的、地下水モデルHydrologic and groundwater modeling155(3)
浸食と宣誓証言モデルErosion and deposition modeling158(8)
ラスタベースモデルと解析に関するまとめFinal note on raster-based modeling and analysis166(1)
ボクセルデータを使うWorking with voxel data166(3)
ベクトルデータを使うWorking with vector data 169(94)
地図の表示とメタデータ管理Map viewing and metadata management169(4)
ベクトル地図を表示Displaying vector maps 169(3)
ベクトル地図メタデータ維持Vector map metadata maintenance172(1)
ベクトル地図属性管理とSQLサポートVector map attribute management and SQL support173(14)
GRASS6でのSQLサポートSQL support in GRASS 6 174(7)
サンプルSQLクエリ属性変更Sample SQL queries and attribute modifications 181(4)
地図再分類Map reclassification 185(1)
複数の属性があるベクトル地図Vector map with multiple attribute tables: layers 186(1)
ベクトルデータデジタルDigitizing vector data 187(5)
位相データデジタル化の一般原理General principles for digitizing topological data187(2)
GRASSでの対話的なデジタイジンInteractive digitizing in GRASS189(3)
ベクトル地図クエリ統計Vector map queries and statistics192(4)
地図クエリMap queries192(2)
ベクトルオブジェクトに基づくラスタ地図統計Raster map statistics based on vector objects194(2)
ポイントベクトル地図統計Point vector map statistics196(1)
幾何学操作Geometry operations196(20)
位相的な操作Topological operations 197(6)
バッファリングBuffering203(1)
フィーチャの抽出と境界のディゾルブFeature extraction and boundary dissolving204(1)
ベクトル地図を修理Patching vector maps 205(1)
ベクトル地図インターセクディングとクリッピングIntersecting and clipping vector maps206(3)
ベクトル幾何の変換と3Dベクトルの作成Transforming vector geometry and creating 3D vectors 209(2)
点からのコンベックスハルとトライアンギュレーションConvex hull and triangulation from points 211(1)
同じ位置の掘り出し物の複数のポイントFind multiple points in same location212(2)
一般的な多角形境界の長さLength of common polygon boundaries214(2)
ベクトルネットワーク分析Vector network analysis216(11)
ネットワーク分析Network analysis 216(5)
直線的な参照システム(LRS)Linear reference system (LRS)221(6)
ラスタへのベクトルデータ変化Vector data transformations to raster227(3)
空間的な内挿と近似Spatial interpolation and approximation230(19)
内挿方法を選択Selecting an interpolation method230(5)
RSTによる内挿と近似Interpolation and approximation with RST 235(2)
RSTパラメタの調整: テンションスムージングTuning the RST parameters: tension and smoothing 237(4)
RSTの精度を評価Estimating RST accuracy241(3)
セグメント化処理Segmented processing 244(3)
RSTとのトポグラフィー分析Topographic analysis with RST247(2)
ライダーポイントクラウドデータを使うWorking with lidar point cloud data249(8)
ボリュームに基づくは内挿Volume based interpolation 257(6)
3番目の変数の追加: 高度のある降水量Adding third variable: precipitation with elevation 258(3)
ボリュームとボリューム-時間内挿Volume and volume-temporal interpolation 261(1)
地球統計学とスプライGeostatistics and splines262(1)

2008-06-17

http://anond.hatelabo.jp/20080617011655

おいらの趣味

数理パズルとか、詰み将棋とかなんだけど、キモいのかな?

まぁ映画とかも見るけどねぇ。

ところで

http://anond.hatelabo.jp/20080617011655

ベイジアンネットワークってハァハァできるもんなの?

ベイジアンネットワークって、本で確率グラフモデルの章が

あったとしたら一番最初にでてくるやつでしょ?

手元の本ではそこから Markov Random Fields にいったり

Factor Graph にいったりしている。

ってかベイジアンネットワークって結構致命的欠陥っつーか、

こいつぁだめだぁって場合が多かったような気がするけど、

手元に Mitchell 本がないので忘れた。

突っ込むともっと一杯発展があるのかな。

結構基礎が詰まっているから勉強したけど、

ベイジアンネットワークそのものをあまり使ったことがないのでハァハァできる気がしない。

2007-07-13

KEREM SHALOM, Israel, July 11 ?? Real life has a way of intruding into the airy absolutes of the Israeli-Palestinian conflict. Each side may deny the other’s historical legitimacy, or plot the other’s demise, but somehow, the gritty business of coexistence marches on.

Skip to next paragraph

Enlarge This Image

Rina Castelnuovo for The New York Times

An Israeli man signaled for a truck to move toward Gaza at Sufa on Wednesday. Commerce continues despite the Hamas takeover.

The New York Times

For the past month, since the Islamic militants of Hamas took over the Gaza Strip, Israel has kept the main commercial crossing point at Karni shuttered, squeezing the life out of the limp Gazan economy. Israel bans contact with Hamas, and Hamas seeks Israel’s destruction, making border crossing etiquette more precarious than elsewhere.

Yet at this small crossing near the Egyptian border on Wednesday, between mortar attacks by Hamas and other militants, about 20 truckloads of milk products, meat, medicines and eggs passed from Israel into Gaza, part of the effort to keep basic commodities reaching the 1.5 million Palestinians of the largely isolated strip. Most of the supplies are not humanitarian relief, but are ordered by Palestinian merchants from Israeli suppliers, relying on contacts built up over years.

The mechanics of the crossover manage to answer Israel’s security needs while avoiding contact with Hamas. At Kerem Shalom, Israeli trucks transfer their goods to what Israeli military officials describe as a “sterile” Palestinian truck. Driven by a carefully vetted Palestinian driver, the truck never leaves the terminal, carrying the goods to the Palestinian side, where they are transferred onto ordinary Palestinian trucks that drive into Gaza.

Kerem Shalom, which means “vineyard of peace,” is surrounded by fences and concrete barriers. It can process only about 20 trucks a day, so it is reserved for products that require refrigeration.

The hardier goods, which make up the bulk of the supplies, go through another crossing, at Sufa, to the north. About 100 Israeli trucks a day come from Israel, swirling up clouds of dust before dumping thousands of tons of dry products, bales of straw and crates of fruit on “the platform,” a fenced-in patch of baked earth. At 3 p.m. the Israeli suppliers leave. Like drug dealers picking up a “drop,” the Gaza merchants send in trucks from a gate on the other side and take the products away.

Other products make their way into Gaza with virtually no human interaction. At the fuel depot at Nahal Oz, Israeli tankers pour diesel, gasoline and cooking gas into Gaza through pipes that run beneath the border. And even at Karni, the main crossing that closed for normal operations on June 12, the Israelis have adapted a 650-foot-long conveyor belt, which was previously used for gravel, to send in grain.

“It is better all around from a security point of view that commodities go in,” said Maj. Peter Lerner of the Coordination and Liaison Administration, the Israeli military agency that deals with the civilian aspects of the Gaza border. “More despair doesn’t serve anyone.”

Israeli officials cite security reasons for having shut Karni, the only crossing equipped to send containers into Gaza, or to handle exports out of the strip. “Karni was based on the concept of two sides operating together,” said Col. Nir Press, the head of the coordination agency.

Colonel Press noted that in April 2006, a vehicle loaded with half a ton of explosives got through three of four checkpoints on the Palestinian side of Karni, and was stopped at the last security position by members of the American-backed Presidential Guard, loyal to the Palestinian president, Mahmoud Abbas of Fatah.

But the Presidential Guard is no longer there, having been routed, along with all other Fatah forces in Gaza, by Hamas.

Instead, the military wing of Hamas and other Palestinian factions have been firing mortar shells at Kerem Shalom. On Tuesday, 10 of them landed in and around the terminal as two trucks of milk were passing. The crossing was closed for the rest of the day. [Another barrage of mortar shells hit areas around Kerem Shalom on Thursday.]

Hamas suspects that Israel wants to use Kerem Shalom to replace the Rafah crossing on the Egypt-Gaza border, which has been closed since June 9. The Palestinians had symbolic control at Rafah. At Kerem Shalom, Israel can better supervise who ?? and what ?? is going in and out of the strip.

“Kerem Shalom is a military post, a place from which Israeli tanks begin their incursions into Gaza,” said Fawzi Barhoum, a Hamas spokesman, justifying the mortar attacks. “How can we consider it a safe and legitimate crossing to replace Rafah?”

But when it comes to food, rather than principle, Hamas is proving itself pragmatic as well. On Sunday, Palestinian merchants, trying to press Israel to reopen Karni, told the Israelis that Hamas had barred the import of Israeli fruit. But by Wednesday, the Israeli fruit was ordered again. “Hamas does not want to lose the private sector,” a Gaza businessman explained.

Tellingly, the exposed Sufa crossing, through which most of the food comes, has not been attacked with mortars so far. Without Karni, however, and with the smaller crossings operating on a one-way basis, Gaza can barely subsist. With hardly any raw materials going in, and no products from Gazan farms, greenhouses and factories so far allowed out, Gaza’s tiny industrial base is on the verge of collapse.

Hamas officials say they want to start negotiations with Israel about reopening the formal crossings. Major Lerner said that Hamas had “a few things to do” first, including recognizing Israel’s right to exist and freeing Gilad Shalit, the Israeli soldier captured and taken to Gaza in a raid more than a year ago.

But the ultimate test of pragmatism may come in September when the Hebrew calendar enters what is known in Jewish law as a “shmita” year. Then the fields of Israel are supposed to lie fallow, and observant Jews seek agricultural products grown elsewhere. Before the Hamas takeover, Israel’s rabbis had reached agreements with Palestinians to import vegetables from Gaza, Major Lerner said. Given the needs of both sides, it may still happen.

2007-05-16

http://anond.hatelabo.jp/20070516174930

きみがそんな書き込みをするから見に言っちゃったじゃないか。

そして思わず' -- で検索しちゃったじゃないか。

・・・まさか、こんなレベルで。。

Database Results Error
Description: [Microsoft][ODBC dBase Driver] クエリ式 '(タイトル LIKE '%' --%' AND タイトル読 LIKE '%%' AND 記事種別 LIKE '%%') ORDER BY 雑誌ID ASC,開始 ASC' の 構文エラー 
Number: -2147217900 (0x80040E14)
Source: Microsoft OLE DB Provider for ODBC Drivers

One or more form fields were empty. You should provide default values for all form fields that are used in the query. 

しかも日本語ラム名だよ!!

くそテキストがたまに日本語名でやってるのあるけど、ほんとにやりやがった!

やっぱりLike検索なんだろうなとは思ったよ。

しかもソースみたらSQLそのまま乗ってるし。

SELECT * FROM 雑誌 WHERE (タイトル LIKE '%::タイトル::%' AND タイトル読 LIKE '%::タイトル読::%' AND 記事種別 LIKE '%::記事種別::%') ORDER BY 雑誌ID ASC,開始 ASC

入力してない項目にまで検索を掛けているのはどういうわけか。

もちろんindexなんて貼ってるわけないんだろうな。

aspか。なんか懐かしいな。

すげぇ、なんかこのiisパッチも当ててなさそう。

可哀相だからここまでにしておく。これ増田の良心。

おまえらも絶対insertとか流すんじゃないぞ?

2007-04-13

ASPファイル受信

'/** Requestオブジェクトから受信したデータを取り出します。
' * @return byte配列を格納した連想配列を返します。
' */
Function getRequestItem()

  If Request.TotalBytes <= 0 Then
    getRequestItem = Null
    Exit Function
  End If

  Dim data
  Dim separator
  Dim dataArray
  Dim buffer
  Dim filePath
  Dim fileName
  Dim ix
  Dim stringIndex
  Dim myCrLf
  Dim items
  Dim itemName

  myCrLf = convertAsc(vbCrLf)
  Set items = Server.CreateObject("Scripting.Dictionary")

  data = Request.BinaryRead(Request.TotalBytes)
  data = LeftB(data, UBound(data) - 3) & myCrLf

  separator = MidB(data, 1, InStrB(1, data, myCrLf) + 1)

  dataArray = SplitB(data, separator)

  For ix = 2 To UBound(dataArray) Step 1
   '1行読み込み
    buffer = MidB(dataArray(ix), 1, InStrB(1, dataArray(ix), myCrLf) - 1)

   'アイテム名の取得
    stringIndex = InStrB(1, buffer, convertAsc("name="))
    If stringIndex > 0 Then
      itemName = convertUnicode(MidB(buffer, stringIndex + 6, InStrB(stringIndex, buffer, ChrB(34)) - stringIndex))
     Else
      itemName = ""
    End If

   'ファイル名の取得
    stringIndex = InStrB(1, buffer, convertAsc("filename="))
    If stringIndex > 0 Then
      filePath = MidB(buffer, stringIndex + 10, InStrB(stringIndex, buffer, ChrB(34)) - stringIndex)
      fileName = RightB(filePath, LenB(filePath) - LastInStrB(0, filePath, convertAsc("\")))
     Else
      fileName = ""
    End If

   'データ部の取得、改行コードの切り捨て
    buffer = RightB(dataArray(ix), LenB(dataArray(ix)) - InStrB(1, dataArray(ix), myCrLf & myCrLf) - 3)
    buffer = LeftB(buffer, LenB(buffer) - 2)

    items.Item(itemName) = parseBytes(buffer)
  Next

  Set getRequestItem = items
  Set items = Nothing

End Function

'/** 文字列の最後尾から指定文字を検索します。
' * @param Start 検索する開始文字位置を指定します。
' * @param String1 検索対象の文字列を指定します。
' * @param String2 検索する文字列を指定します。
' */
Function LastInStrB(ByRef Start, ByRef String1, ByRef String2)

  Dim ix
  Dim lastIndex
  Dim searchLength

  searchLength = LenB(String2)
  lastIndex = LenB(String1) - searchLength + 1
  If Start > 0 And Start < lastIndex Then
    lastIndex = Start
  End If
  For ix = lastIndex To 1 Step -1
    If MidB(String1, ix, searchLength) = String2 Then
      LastInStrB = ix
      Exit Function
    End If
  Next

  LastInStrB = 0

End Function

'/** アスキー文字列に変換します。
' * @param String 対象の文字列を指定します。
' */
Function convertAsc(Byref String)

  Dim ix
  Dim ascii

  ascii = ""
  For ix = 1 To Len(String) Step 1
    ascii = ascii & ChrB(AscB(Mid(String, ix, 1)))
  Next

  convertAsc = ascii

End Function

'/** Unicode文字列に変換します。
' * @param AscString 対象のアスキー文字列を指定します。
' */
Function convertUnicode(Byref AscString)

  Dim ix
  Dim unicode

  unicode = ""
  For ix = 1 To LenB(AscString) Step 1
    unicode = unicode & Chr(AscB(MidB(AscString, ix, 1)))
  Next

  convertUnicode = unicode

End Function

'/** バイナリ対応版Split関数です。
' * @param String 対象の文字列を指定します。
' * @param Delimiter 区切り文字を指定します。
' */
Function SplitB(Byref String, Byref Delimiter)

  Dim ix
  Dim lastIndex
  Dim searchLength
  Dim start
  Dim datas()
  Dim dataIndex

  dataIndex = 1
  start = 1
  delimiterLength = LenB(Delimiter)
  lastIndex = LenB(String) - delimiterLength + 1

 '最初から1文字ずつ繰り返します。
  For ix = 1 To lastIndex Step 1
   'データを比較します。
    If MidB(String, ix, delimiterLength) = Delimiter Then
     'データを取り出せたら配列に格納します。
      ReDim Preserve datas(dataIndex)
      datas(dataIndex) = MidB(String, start, ix - start)
      dataIndex = dataIndex + 1
      start = ix + delimiterLength
    End If
  Next

  SplitB = datas

End Function

'/** Byte配列を返す関数です。
' * @param data 対象のデータを指定します。
' */
Function parseBytes(Byref data)

  Const adLongVarBinary = 205
  Dim recordset

  If LenB(data) <= 0 Then
    parseBytes = CByte(0)
    Exit Function
  End If

  Set recordset = Server.CreateObject("ADODB.Recordset")
  recordset.Fields.Append "UpLoadBinary", adLongVarBinary, LenB(data)
  recordset.Open
  recordset.AddNew
  recordset.Fields("UpLoadBinary").AppendChunk data
  recordset.Update

  parseBytes = recordset.Fields("UpLoadBinary").Value
  recordset.Close
  Set recordset = Nothing

End Function
 
ログイン ユーザー登録
ようこそ ゲスト さん