2022/02,江端さんの忘備録

SIM契約している会社から、「クレジットカードが使えない」との連絡があり、ネット銀行経由で、カード会社に問い合わせをしていたところ、

The company with which I have a SIM contract informed me that my credit card was not working. So I was inquiring with my credit card company via my online bank.

They said to me,

『カード状況をお調べしたところ、お客さまのデビットカード情報が闇サイト内で取引された可能性があると情報共有がありました』

"When we checked the status of the card, we were informed that the customer's debit card information may have been traded on a black site"

『そのため、不正利用未然防止として当社からカードのネット決済を停止しており、そのため決済が行えなかったようです』

"In order to prevent fraudulent use of the card, we have stopped the online payment of the card, so it seems that the payment could not be made"

と言われてしまいました。

一応、過去の履歴を調べて、不正利用の跡はなかったようなので、一安心しています。

In the meantime, I checked my past history and found no evidence of unauthorized use, so I am relieved.

そして、カード会社の対応も「これで良い」とは思うのですが、

And I'm sure the credit card company will be "fine" with this, however I came to think that,

―― 連絡なしにいきなりカードを無効にされる、って、どうなの?

"What if they suddenly deactivate my card without contacting me?"

とも思ってしまいました。

もし、私が、海外出張中に停止されたら、大パニックになっただろうと思います。

If my credit card had been suspended while I was on an overseas business trip, I would have panicked.

「気を付けなければいけない」と思いつつ、何をどう気をつければ良いのか、よく分かりません。

I think, "I should be careful," but I don't really know what and how to be careful about.

とりあえず、カードの再発行手続をして、その旨をSIMの会社にも連絡しておきました。

Anyway, I went through the process of reissuing the card and contacted the SIM company about it.

-----

ちなみに、上記のやりとり、全部「チャット」でした。

By the way, all of the above exchanges were in "chat".

ネット銀行は、原則、相談(クレームも含む)の電話対応はありません。

As a rule, online banks do not provide telephone support for consultations (including complaints).

本当に今回の一件も『スマホ/PCで、リアルタイムでチャットができない人間は、お呼びではありません』の世界でした。

It really was a world of 'if you can't chat in real time on your phone/PC, you are not wanted'

しかし『人間に対して、声を出して要求やクレームが言えない』という窓口システムには、どうしても不安が伴います。

However, there is a certain amount of anxiety associated with a contact system where we cannot make requests or complaints aloud to a real person.

とは言え、なんだかんだといっても、ネット銀行は便利です。

On the other hand, for what it's worth, online banking is convenient, so I think,

―― そのうち、社会(大衆)の方が、それ(チャットやチャットボット)に対応していくのかな?

-- I wonder if society (the masses) will eventually respond to it (chat and chatbots)?

とか思っています。

-----

トラブルもあるようですが、GIGAスクール構想は、子どもたちが生きていく上で、必須の教育だと実感しました。

Although there seems to be some trouble, I realized that the GIGA school concept is an essential education for children to live by.

で、私たちシニアの対応は、やっぱりこちらになると思います。

「『無様に泣き叫ぶシニア』になる勇気」 ―― これが、私たちに残された老後戦略なのです。

So, I think the behavior of us will be this way, as seniors.

2022/02,江端さんの忘備録

私の経験上、ある事を出来るようにするための最も早い方法は、「始めてしまう」ことです。

In my experience, the fastest way to be able to do something is to start doing it.

この「始めてしまう」は、有名な問題解決手段で、よく言われるようでして、私の知る限り最も過酷な事例は、windowsNTの開発ストーリです。

This "getting started" is a well-known and oft-quoted means of problem solving, and the toughest example I know of is the development story of windows NT.

開発リーダーのデビッド・カトラーさんは、開発メンバーに、WindowsNTの開発を、「開発中のWindowsNT」を使ってやらせたという話は、あまりにも有名です。

The story is so well known that David Cutler, the development leader, had his development team members work on Windows NT using the "developing WindowsNT".

開発中にカーネルパニックするOSを使うのですから、現場からは四六時中、悲鳴の嵐です。その悲鳴の中で行われるプロジェクト開発など考えるだけでゾッとします

In development period, the "OS" in developing are used by the development members. Of courser, they were in screaming stream. I don't want to think of the situation at all.

-----

そこまでシビアなことは要求しないまでも、私もこのアプローチを試みます。今、まさに、実施中です。

I will try this approach, even though I don't require it to be that severe. This is exactly what I'm doing right now.

本日の日記は、全てiPadで書いています。正直ストレスで死にそうです。私の大好きな変態IMEであるSKKは使えませんし、そもそもWindowsが使えません(画面分割が精一杯)。emacsのキーバインドが使えないのは当然ですし、翻訳エンジンとの連携もままなりません(そこは、指をつかってやっています)。

I'm writing today's diary entirely on my iPad. To be honest, I'm dying of stress. I can't use SKK, my favorite perverted IME, I can't use Windows (split screen I can use), I can't use emacs key bindings, and I can't work with the translation engine and change between the split windows(I'm using my fingers to do that).

ただ、流石に、入力はブルートゥースのキーボードでやっています。

However, I am using a bluetooth keyboard for input.

『おい、それなら、ノートPC持ち歩くのとかわらんだろう』という人も多いかもしれませんが、江端の読書環境は、もうほとんどiPadに移行しているので、これを外すことはできません。

Many people may say, "Hey, that's no different from carrying a notebook PC," but since Ebata's reading environment has mostly shifted to the iPad, I can't leave it out.

ここにノートPC加えたら、もう移動の持ち物の重量が洒落にならないことになります。

If you add a laptop to the list, the weight of your traveling belongings is no longer a joke.

―― ラクをするために苦労をする

"Struggling to make things easier"

と言うのは、誰にとっても日常なですが、iPadと WindowsノートPCの間には、どう見ても相容れないコンセプトがあるとしか思えません。

This is a daily issue for everyone. However, I think that there is an apparently incompatible concept between iPad and Windows.

前にも述べましたが、文部科学省のGIGAスクール構想で、 iPadがマジョリティになった時に、すでに勝負はついたのです。

というか、これから社会で活躍する子どもたちが、iPadを使うのであれば、それに迎合していくことがシニアの運命です。

And I wrote it before, the winner has already confirmed when iPad because majority of the "GIGA school" project by the MEXT.

「システム管理がしやすく、ユーザに裁量を『与えない』iPad」が、Windowsや、ユーザに開発の裁量を保証するLinux, Andoroidに勝利したのは、(今、考えてみれば)当然と言えます ――  だって子どもに使わせるのですから、管理しやすいデバイスを選ぶのは、当然ですよね。

iPad that cannot give the users free development and management, would be chosen for children naturally, than Windows, Linux and Android that can do. Because they are easy for adults to control IT education of the children.

-----

ともあれ、ストレスを溜めながらこの文章を書いています。

Anyway, I am writing this text with a lot of stress.

仕方がないことです。

However, it cannot be helped.

私のようなシニアが生き残っていく為には、子どもたちに媚びて生きるしかないのですから。

In order to survive my remining life, I cannot do anything except for flattering children.

2022/01,江端さんの忘備録

「氷菓」という小説、アニメについては、これまで色々と記載してきました。

I've written a lot about "Hyouka", the novel and anime.

実際に、歴史の教師は「歴史が重要だ」と言い続けていますが、はっきり言います―― 「古代エジプトのファラオが誰であろうか、その国が滅びようが、それが何だと言うのか」

この中の主要人物である、「福部里志」は、あらゆる知識・雑学に精通している趣味人として描かれています。

The main character in this story, Satoshi Fukube, is portrayed as a hobbyist who is well versed in all kinds of knowledge and miscellaneous topics.

そして、

He calls himself a "database", with saying

『データベースは結論を出せない』

"The database cannot reach to conclusions"

と、自分の知識を、推論や予測に上手に使えないことを、自虐的に語ります。

and self-deprecates his inability to use his knowledge for reasoning and prediction.

しかし、これは、データベースに対する、(世間一般の)典型的な誤解です。

However, this is a typical misunderstanding of databases (by the public).

-----

データベースは、膨大な知識の記憶媒体だけ、というものではありません。

A database is not just a storage medium for vast amounts of knowledge.

データベースには、特定の複雑な条件にヒットするテーブルを、超高速で引っ張り出してくることができる機能があります ―― というか、それができないのであれば、「データベース」の名に値しません。

Databases have the ability to pull up tables that hit certain complex criteria at very high speed -- or rather, if they can't do that, they don't deserve the name "database".

# select * from passenger_log where riding_user IN ( select user_id from request_log_view where passenger_log.departure_time < time_before) ;

『出発時刻がバスの発車時刻としたリクエスト要求出しているユーザを特定し、その経路ルートのポイントを全て上げろ』

"Identify the users whose departure time is after the departure time of the bus, and raise all points on their travel route"

という条件を、数千万にも及ぶテーブルから、(SQL文などで)サクッと出すことができるような、

from tens of millions of tables (using SQL statements, etc.).

『複数検索条件を同時に走らせて、それを別の観点の情報として提出させることができる機能』を有するものが『データベース』です。

A database is one that has the ability to run multiple search conditions simultaneously and extract information from different perspectives.

もちろん、これは、「推論」でも「予測」でもなく、もちろん「結論」でもありません。

Of course, this is not an " estimation " or a " prediction ", and of course not a " conclusion".

しかし、時として、データベースの持つポテンシャルは、「それ以上の何か」なのです。

Sometimes, however, the potential of a database is "something more".

-----

しかし ―― 私もそんなことを真面目に論じたい訳ではありません。

Of course, this is not an " estimation " or a " prediction ", and of course not a " conclusion ".

一般的に「データベース」とは、広い知識に与えられる人の称号(尊称)で、良い、と思っています。

Generally speaking, "database" is a title (a title of respect) given to a person's broad knowledge, which is no problem, I think.

なんで、こんなことを書いているかというと、最近、また、データベースの構築をやっていて、そんでもって、バックグラウンドで「氷菓」を視聴していたものですから。

The reason why I'm writing this is because I've been working on building a database again recently, and I've been watching "Hyouka" in the background.

2022/01,江端さんの忘備録

Amazon Primeで「東京原発(*)」という映画をやっています ―― これは、いいです。笑えます。

There's a movie on Amazon Prime whose title is "Tokyo Nuclear Power Plant (*)" -- it's good. It's funny.

(*)広瀬さんの著書「東京に原発を」とは別のコンテンツです。

(*)This is a separate content from Mr.Hirose's book "Nuclear Power Plants in Tokyo".

是非、軽い気持ちで見てください。

Please watch it with a light heart.

なんなら、ラジオのように音声だけで聞いても十分楽しめます。

If you want, you can listen to the audio alone, like a radio, and enjoy it fully.

とは言え、これが2004年に制作されていたことを知って、衝撃を受けています。

Nevertheless, I was shocked to learn that this movie was produced in 2004.

まるで「2011年に何が起こるのか」を予知して作られたような、映画になっています。

It's as if the movie was made with a foreknowledge of what will happen in 2011.

-----

いきなり、話が変わりますが、我が家は、基本的に読売新聞を購読しています。

This is a sudden change of subject, but our family basically subscribes to the Yomiuri Shimbun.

私は、読売新聞の論調が基本的に『嫌い』なのですが、「テクニカルライティング」で書かれているという、その一点のみで購読を続けています。

I basically 'dislike' the tone of the Yomiuri Shimbun, but I continue to subscribe to it for one reason only: The articles are written in 'technical writing' style.

(私の日本の各新聞社に対する偏見一覧はこちら)

(Click here for a list of my biases against each newspaper in Japan)

最近、読売新聞は「震災・原発事故後の原子力政策"推し"」の記事で、正直ウザいですが ―― 知っておかなければならない情報として、第一面はしっかり読んでいます。

Recently, the Yomiuri Shimbun has been annoying me with its articles on the "push" for nuclear power policy after the earthquake and nuclear accident, however I read the front page of the paper as I need to know the information.

―― 「カーボンニュートラル」を奇貨として、復権を狙っているあの「もんじゅ」の亡霊たちの話が、ワンサカ登場しています

"The ghosts of Monju are making a comeback, using "carbon neutrality" as an oddity, and their stories are popping up all the time"

あいつら(原子力利権関係者)って、絶対的な意味において『不死身なんだな』、と、心の底から感嘆しています。

From the bottom of my heart, I marvel at how immortal they (the nuclear interests) are in an absolute sense.

-----

ところで、最近、私、「COVID-19ワクチンの接種を推奨する(ようにも読める)コラム」を寄稿しています。

By the way, I recently contributed columns recommending (or so it seems) the use of the COVID-19 vaccine.

そんでもって、どこぞの掲示板に、私(江端)のことを、

And I've been reading about me (Ebata) on some forums.

―― 政府関係者(私のことらしい)が、一般市民を装って寄稿している

"A government agent (apparently that's me) contributing under the guise of an ordinary citizen"

と記載されていて、かなり笑いました(嫁さんと2人で大爆笑でした)。

I laughed quite a bit when I saw it written (my wife and I were laughing hysterically).

正直、「政府の回しもの」で喰っていけるのであれば、喜んで、何でも書くつもりですが ―― が、政府は今まで一度も声をかけてくれませんでした。

To be honest, I would be happy to write anything if I could make a living as a "government agent" -- but the government has never approached me before.

多分、理由はこの辺です。

Maybe this is the reason.

-----

もし、私が、「政府の回し者」であったとしたら、

If I were a "government agent,"

このコラムの寄稿や、

This column, or

このコラムの寄稿で、

This column

一発でクビだったと思うんですが ―― いかでしょうか?

would have made me be fired in a heartbeat, I think. What do you think of that?

2022/01,江端さんの技術メモ

AmazonJSをインストールしたら、新規投稿画面に、こんなものが出てくるようになった。

さて、これに手を入れるべきか否か? 自動更新に任せて暫く放置するか。
色々手を入れて、wordpressが立ち上がらなくなった時は青冷めたしなぁ。

とりあえずターゲットのコードだけ書き出しておきます。

% pwd
/home/kobore/www/wp/wp/wp-content/plugins/amazonjs/js
% more tinymce-plugin.js
(function() {
        tinymce.PluginManager.add( 'amazonjs', function( editor, url ) {
                editor.addButton('amazonjs', {
                        title: amazonjsAdmin.mce.buttonTitle,
                        image: url + '/../images/amazon-icon.png',
                        onclick: function () {
                                editor.windowManager.open({
                                        title: amazonjsAdmin.mce.dialogTitle,
                                        url: amazonjsAdmin.mce.dialogUrl,
                                        width: $(window).width() * 0.9,
                                        height: $(window).height() * 0.9,
                                        id: 'amazonjs-insert-dialog'
                                });
                        }
                });
        });
})();
%

どうも原因が見あたらないのですが、

https://postgresweb.com/err-wordpress-failed-to-load-plugin-url

を見て、思い当たることがありあした。私も、chromoに"uBlock origin"という広告表示ブロックプラグインを入れていました。

これを一時外してみたら、メッセージが消えて、

が出てきました。まだ、リンクには失敗していますが、とりあえず第一の問題点は越えたか、と。

2022/01,江端さんの忘備録

ご存知かもしれませんが、私、"墓"というものに対するこだわりが、絶無です。

As you may know, I have never been particular about "graves".

こちらの『パリの平家物語』を御一読頂ければ、ご理解頂けると思います。

If you read "The Tale of the Heike in Paris", you will understand what I mean.

あの時に、

At the time,

『朽ちていく墓標の、なんという悲しく惨めなことか―― あんなもの、ない方がマシだ』

"What a sad and miserable thing a decaying gravestone is -- It is better to have no grave at all.

という、最初の思いが生まれたと思います。

I think that was the first thought that came to my mind.

-----

大抵の民間墓地は50年もすれば、埋め立てされて、跡形もなくなります(更地になる)。

Most private cemeteries will be reclaimed and there will be no trace of them after 50 years. And the land will be cleared.

100年以上も墓地として存在し続けることは、かなりのレアケースで、残るのは、歴史的景勝地にある著名な有名人の墓くらいです。

It is quite rare for a cemetery to exist for more than 100 years, and the only ones that remain are the graves of famous celebrities in historical scenic spots.

そこに本人の遺骨が入っているのかどうかも、かなり怪しいものです。

It is also very doubtful that the person's remains are in there.

『私たちの今、住んでいる土地が、元墓地だった』という可能性は、無視できない程度には高いです。

The possibility that the land we now live on was once a cemetery is too high to ignore.

つまり ―― 墓とは、しょせんは、その程度のものなのです。

In other words -- a grave is just that -- a grave.

それでも、「家族、親族が集るためのランドマーク」という意義はあると思います。

Still, I think it has the significance of being a landmark for families and relatives to gather.

しかし、そのランドマークの有効期間は、間違いなく著作権(70年)より短かいし、下手すると特許権(20年)よりも短いかもしれません。

However, the validity period of the landmark is definitely shorter than copyright (70 years), and maybe even shorter than patent right(20 years).

-----

で、ここから、先日、ちょっと笑った話です。

So, here's a story that made me laugh a little the other day.

私は、すでに墓(というか"穴"?)を購入済みで、(葬儀はどうなるか不明ですが)遺骨の行き先だけは決まっています。

I have already purchased a grave (or is it a "hole"?). I don't know what the funeral will be like, but I do know where the remains will go.

で、先日から、大学病院への献体を検討しているという話を家族でしている時に、

The other day, when we were discussing with my family that we were considering donating our bodies to a university hospital, I said to them,

江端:「献体すれば、大学の集合墓地に埋葬してくれるらしいよ」

Ebata: "I heard that if I donate my body, they will bury me in the university's cemetery.

という話をしたら、

嫁さんに、

My wife was very upset and said to me

「なんだとぉ。私と一緒の墓には入れん、と言うのか?」

""What? You don't want to be in the grave with me, is that it?"

と凄まれました ―― 『俺の酒が飲めん、と言うのか』というノリで。

like "You don't want to drink with me"

私は、「いえいえ、一緒に入って、末永く一緒に過していきたいです」と、丁重にお返事させて頂きました。

I politely replied, "No, no, I want to join you and spend many years together.

私が、嫁さんと一緒の墓に入りたいのは本当です。なんか、楽しいことができそうな気がして。

It is true that I want to be in the same grave with my wife. I feel like we could have a lot of fun.

例えば、土壌を科学反応させて真冬に桜を満開させたり、常温核融合反応を実現して墓地一帯を吹き飛したり、とか。

For example, we can make cherry blossoms bloom in the middle of winter by scientifically reacting the soil, or blow up an entire cemetery by achieving a room temperature nuclear fusion reaction.

-----

ただ、『伴侶、舅や姑と同じ墓に入るのは、死んでも嫌』という人は、一定数(あるいは相当数)いると思うのです。

However, I think there are a certain number of people (or a significant number of people) who say, 'I don't want to be in the same grave as my spouse, father-in-law, or my mother-in-law, even if I die.

これを理解するには、『大っ嫌いな上司と、同じ墓に入る』というような、思考実験をされてみると良いかと思います。

To understand this, I suggest you try a thought experiment like "I'm going to the same grave as the boss I hate so much.

考えただけで、吐きそうになりました。

I felt like I was going to throw up just thinking about it.

こういう問題も含めて『ぶっちゃけ"墓"なんてろくなもんじゃねえ』という考え方には、それなりに説得力があると思うんです。

Including these issues, I think there is a certain persuasiveness to the idea that "graves" are the worst.

2022/01,江端さんの技術メモ

私は普段、PostgreSQLを使っています。主な理由は、PostGISを使いたいからですが、サーバとして立ち上げる必要があるので、そこそこ面倒くさいです。

dockerでPostGISを入れたPostgreSQL環境構築

1つのアプリケーションだけで使えれば良い、と割り切るのであれば、SQLite3が便利だと聞きましたので、golangでちょっと使ってみました。

golangで、SQLiteを使ってDB構築の手を抜く

アプリで使えて、SQL文が使えるようにするために、SQLite3をインストールしてみました。忘れないうちに、手順を記録しておきます。

https://www.sqlite.org/

で、

をダウンロードして解凍して、c:\sqlite3を作って、ここの中に放り込む。

で、あとは、c:\sqlite3にパスを通しておく。

これで環境構築は完了です。

あとは、csvファイルからDBを作ってみます。

まず適当なディレクリを掘ります。

https://people.sc.fsu.edu/~jburkardt/data/csv/csv.htmlあたりから、サンプルのcsvファイル("biostats.csv","cities.csv"あたり)をダウンロードして、ちょっと加工しました(空白とか、ダブルコーテーションを削除)。

biostats.csv
cities.csv

をクリックしてダウンロードする。

これで、このデイレクトリの中に、test_dbというデータベースファイルができます。
この中には、2つのデータベース、 biostats, cities が入っています。
これらのDBは、原則としてSQL文が使える(みたい)です。

"sqlite> .exit" で、コマンドプロンプトに戻れます。

で、もって、 "sqlite3 test_db" でDBをSQL文で使えるようになります。

あと、日本語を使えるようにする問題が、未解決ですが、まあなんとかなるでしょう。

取り敢えず、今日のところは、ここまで。

以上

2022/01,江端さんの技術メモ

私が普段使っているDBは、PostgreSQLを使っているのですが、構築手順が面倒くさいし、なによりDBサーバ立てるのを省略したかったです。

ですので、SQLiteを使ってDB構築の手を抜くことにしました。

今日のところは、mattn/go-sqlite3 に _example/simple/simple.go というサンプルファイルがあったので、これを動くことを確認するところまでやりました。

/*
	C:\Users\ebata\kese\gonet-html\1-1
	go get github.com/mattn/go-sqlite3

	どういう訳か、VSCodeのデバッグでトレースができなかったので、fmt.Println("----->10") と入れて確認をしている。
	このプログラムは、

*/

package main

import (
	"database/sql"
	"fmt"
	"log"
	"os"

	_ "github.com/mattn/go-sqlite3"
)

func main() {
	os.Remove("./foo.db")

	fmt.Println("----->10")

	db, err := sql.Open("sqlite3", "./foo.db")
	if err != nil {
		log.Fatal(err)
	}
	defer db.Close()

	sqlStmt := `
	create table foo (id integer not null primary key, name text);
	delete from foo;
	`
	_, err = db.Exec(sqlStmt)
	if err != nil {
		log.Printf("%q: %s\n", err, sqlStmt)
		return
	}

	fmt.Println("----->9")

	tx, err := db.Begin()
	if err != nil {
		log.Fatal(err)
	}

	fmt.Println("----->8")

	stmt, err := tx.Prepare("insert into foo(id, name) values(?, ?)")
	if err != nil {
		log.Fatal(err)
	}
	defer stmt.Close()
	for i := 0; i < 100; i++ {
		_, err = stmt.Exec(i, fmt.Sprintf("こんにちわ世界%03d", i))
		if err != nil {
			log.Fatal(err)
		}
	}
	tx.Commit()

	fmt.Println("----->7")

	rows, err := db.Query("select id, name from foo")
	if err != nil {
		log.Fatal(err)
	}
	defer rows.Close()
	for rows.Next() {
		var id int
		var name string
		err = rows.Scan(&id, &name)
		if err != nil {
			log.Fatal(err)
		}
		fmt.Println(id, name)
	}

	fmt.Println("----->6")

	err = rows.Err()
	if err != nil {
		log.Fatal(err)
	}

	fmt.Println("----->5")

	stmt, err = db.Prepare("select name from foo where id = ?")
	if err != nil {
		log.Fatal(err)
	}
	defer stmt.Close()
	var name string
	err = stmt.QueryRow("3").Scan(&name)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Println(name)

	fmt.Println("----->4")

	_, err = db.Exec("delete from foo")
	if err != nil {
		log.Fatal(err)
	}

	fmt.Println("----->3")

	_, err = db.Exec("insert into foo(id, name) values(1, 'foo'), (2, 'bar'), (3, 'baz')")
	if err != nil {
		log.Fatal(err)
	}

	fmt.Println("----->2")

	rows, err = db.Query("select id, name from foo")
	if err != nil {
		log.Fatal(err)
	}
	defer rows.Close()
	for rows.Next() {
		var id int
		var name string
		err = rows.Scan(&id, &name)
		if err != nil {
			log.Fatal(err)
		}
		fmt.Println(id, name)
	}

	fmt.Println("----->1")

	err = rows.Err()
	if err != nil {
		log.Fatal(err)
	}

	fmt.Println("----->0")

}

もう一つのサンプルコード

https://qiita.com/geniusmaaakun/items/b3cb44de3b10a526be98 を参照させて頂き、微小修正

package main

/*
C:\Users\ebata\kese\gonet-html\1-1-1
sqliteをインストールする際の手順の確認

# ドライバのインストール
go get github.com/mattn/go-sqlite3

*/

import (
	"database/sql"
	"fmt"
	"log"
	"os"

	//インポート _にしないとコンパイルエラーになる。使用しない為
	_ "github.com/mattn/go-sqlite3"
)

var DbConnection *sql.DB

type Person struct {
	Name string
	Age  int
}

func main() {

	os.Remove("./example.sql") // これを入れないと、DBが太り続ける

	//1
	//DBを開く  なければ作成される
	DbConnection, _ := sql.Open("sqlite3", "./example.sql")
	//終わったら閉じる
	defer DbConnection.Close()
	//DB作成 SQLコマンド
	cmd := `CREATE TABLE IF NOT EXISTS person(
        name STRING,
        age  INT)`

	//実行 結果は返ってこない為、_にする
	_, err := DbConnection.Exec(cmd)

	//エラーハンドリング
	if err != nil {
		fmt.Println("エラー")
		log.Fatalln(err)
	}

	//ターミナル
	//sqlite3
	//.table
	//SELECT * FROM tablename;
	//で確認

	//2 CRUD処理
	//Create
	//データを追加
	//VALUES (?, ?)  値は後で渡す。セキュリテイの関係でこのようにする方がいい
	//SQLインジェクション 悪意あるコマンドでDBが操作されてしまうのを防ぐ ?でエスケープしてくれる
	cmd = "INSERT INTO person (name, age) VALUES (?, ?)"
	//実行
	//レコードを取得する必要のない、クエリはExecメソッドを使う
	//第二引数からは、コマンド?部の値
	_, err = DbConnection.Exec(cmd, "Nancy", 20)
	if err != nil {
		log.Fatalln(err)
	}

	_, err = DbConnection.Exec(cmd, "Mike", 20)
	if err != nil {
		log.Fatalln(err)
	}

	_, err = DbConnection.Exec(cmd, "Tom", 55)
	if err != nil {
		log.Fatalln(err)
	}

	//Update
	//データの更新 Mike が存在する場合
	cmd = "UPDATE person SET age = ? WHERE name = ?"
	_, err = DbConnection.Exec(cmd, 25, "Mike")
	if err != nil {
		log.Fatalln(err)
	}

	//Read
	//Get  All
	//マルチセレクト
	//データ全てをループで表示
	//Queryは全て取得する
	cmd = "SELECT * FROM person"
	rows, _ := DbConnection.Query(cmd)
	defer rows.Close()
	//structを作成
	var pp []Person

	//取得したデータをループでスライスに追加 for rows.Next()
	for rows.Next() {
		var p Person
		//scan データ追加
		err := rows.Scan(&p.Name, &p.Age)
		if err != nil {
			log.Println(err)
		}
		pp = append(pp, p)
	}
	err = rows.Err()
	if err != nil {
		log.Fatalln(err)
	}
	//表示
	for _, p := range pp {
		fmt.Println(p.Name, p.Age)
	}

	//特定のデータを取得
	cmd = "SELECT * FROM person where age = ?"
	//age = 20にして実行
	//QueryRowは最初の一件だけ取得する。

	//row := DbConnection.QueryRow(cmd, 20)
	//row := DbConnection.QueryRow(cmd, 25)
	row := DbConnection.QueryRow(cmd, 55)

	var p Person
	err = row.Scan(&p.Name, &p.Age)
	if err != nil {
		//データがなかったら
		if err == sql.ErrNoRows {
			log.Println("No row")
			//それ以外のエラー
		} else {
			log.Println(err)
		}
	}
	fmt.Println(p.Name, p.Age)

	//Delete
	//データの削除  全て
	cmd = "DELETE FROM person WHERE name = ?"
	_, err = DbConnection.Exec(cmd, "Nancy")
	if err != nil {
		log.Fatalln(err)
	}

	//マルチセレクト  テーブルもSQLインジェクション対策
	//こちらを推奨
	//データを構造体に入れて表示
	//テーブルはSQLインジェクション対策が使えない
	tableName := "person"
	//テーブル名指定は?が使えない為、%sを使う。
	//後に対応されるかも?
	cmd = fmt.Sprintf("SELECT * FROM %s", tableName)
	rows1, _ := DbConnection.Query(cmd)
	defer rows1.Close()
	var pp1 []Person
	//パターンとして覚える
	for rows1.Next() {
		var p Person
		//データを構造体に追加
		err := rows1.Scan(&p.Name, &p.Age)
		if err != nil {
			log.Println(err)
		}
		//ppに追加
		pp1 = append(pp1, p)
	}
	//まとめてエラーチェック
	err = rows1.Err()
	if err != nil {
		//エラーなら終了
		log.Fatalln(err)
	}
	for _, p := range pp1 {
		fmt.Println(p.Name, p.Age)
	}
}

 

未分類

インターネット登録で、「臓器提供意志登録カード」を作ってくれるようです。

■インターネットでの登録方法

(Step.1) https://www.jotnw.or.jp/faq/?category=001001にアクセス

あとは、流れのままに必要事項を入力して、ボタンを押せば「仮登録」が終わります。

最後に、

仮登録が完了しました。
(公社)日本臓器移植ネットワークからIDの入った登録カードを送付します。

とメッセージが出てきます。登録カードが届いたら速やかに署名と署名年月日を自筆で書き、本登録手続き(本サイト上の本登録画面にIDとパスワード(江端のパスワードは"最初は大きい最高の私")を行ってください。


ここから3日後、郵送で、こんなものが届きました。

でもって、仮登録した時に送付されてきたメールを開きます。

これで登録は終りです。

あとは、カードに必要記載事項(署名年月日、本人署名(自筆)、家族署名(自筆)←家族と同居されていない場合は空欄でもいいそうです)を記入して、記載した面に、保護シート ↓

で張り付ければ、完了です。

送付されてくるカードが、プラスチック製だといいな、と思っていたのですが・・・まあ、保護シートがあるから、ある程度の硬さは担保できると思いますが。

どうせなら、VISAとかMasterとかJCBを付けて、日常的に使用できるようにしておくと良いんじゃないかと。デートでの支払いの時に、このカードを彼氏/彼女に見せることで、さりげなく自慢ができるようにする、てなアプローチは「あり」だと思います。

ちなみに、

というように、移植臓器のマッチングの可能性は恐しく低いです ―― もちろんタイミングの問題もあるのですが、(私、勘違いしていたのですけど)希望すれば、誰でもいつでも臓器を提供できる訳ではないようです。

臓器提供適応基準となる年齢」があることを知り、軽くショックを受けています。
『そうかぁ、私の臓器にも"旬"があるのね』と、「結婚適齢期」と同程度の概念として「臓器適齢期」というものがあると知って、がっくりしています(考えてみれば、そりゃそうだよな、とも思えるのですが)。

まあ、そうだとしても、提供登録者が増えるのは良いことだと思います。母数が増えれば、確率は上がるのですから

では、最後に注意を一つ。

嫁さん:「このカード、どこに保管しておこうか?」

私:「いやいや、持ち歩かんと意味ないだろう? 必要なのは、死亡直後の私たちの遺体なんだから」

以上

2022/01,江端さんの忘備録

昨年、社用スマホのバッテリー寿命で、交換をしたのですが、新型コロナウイルス接触確認アプリ(COCOA)のイストールを忘れていたことに気がついて、今、慌ててインストールしました。

Last year, I had to replace the battery of my company phone due to its lifespan, but I realized that I had forgotten to install the new coronavirus contact confirmation application (COCOA), so I hurriedly installed it now.

このCOCOAですが、これまで何度も不具合が報告されており、『ダメじゃん』という感じになっているような気がします。

This COCOA has been reported to have many problems, and I feel that it is becoming a 'no-no'.

加えて、感染接触の報告が全然こなければ、興味も薄れるというものです。

In addition, if we don't receive any reports of infected contacts, we will lose interest.

そこで、『テスト感染』というテストモードを作ることを提案します。

Therefore, I propose that we create a test mode called "Test Infection".

例えば、仮想新型ウイルス『例:江端株(テスト用)』というものを使えるようにして、私が、街中を歩き回ることによって、濃厚接触者に、その感染情報が広がるようにするのです。

For example, I can use a virtual new type of virus, such as the Ebata strain (for testing), and spread the information about the infection to my close contacts as I walk around the city.

なんなら、ゲーム性を持たせて、『江端株(テスト用)感染クーポン』というものを発行しても良いかもしれません。

If we want, we can make it game-like and issue "Ebata stock (for testing) infection coupons".

これは、COCOAの使用率を上げる、ということの他に、フィールドテストの検証(バグ出し)などでも使える、というメリットがあります。

In addition to increasing the usage rate of COCOA, this has the advantage that it can be used for field test verification (bug detection).

―― てなことは、多分、デジタル庁も、厚生労働省だって考えたはずです

"I'm sure the Digital Agency and the Ministry of Health, Labor and Welfare have thought of this as well"

この程度のアイデアが出て来ていなければ、"無能"と言っちゃいますよ、私は。

If they hadn't come up with this level of idea, I'd call them "incompetent".

-----

分っているんです。

However, I know well.

このような、仮想新型ウイルス『江端株(テスト用)』みたいなテストモードを作れば ――

If they create a test mode like this, a virtual new virus called "Ebata strain (for testing)," and they use the virus as a tool for testing,

それを「コロナ濃厚感染」と勘違いしてしまう人が、少なからずいて、結果として、それが社会に混乱を与える大騒ぎになってしまう、ということを。

There are more than a few people who mistake it for a "concentrated corona infection," and as a result, it becomes a socially confusing fuss.

で、すでにシステム開発サイドには、このようなテストモードとテストモードを実施するチームが、存在していると思うのですが ――

So, I think there is already a team on the system development side that implements this kind of test mode and test mode...

問題は、一般の人へのCOCOAへの興味への低下です。

The problem is the declining interest of the general public in COCOA.

これは、悩ましい問題だと思います。

I think this is a vexing problem.

-----

テストモードの希望者を、集うというのはどうでしょうか?

How about gathering those who want to be in test mode?

事前に本人をテストして、適性を確認をする必要がありそうですが、それもレジストリ(登録)の手続が大変そうです。

It may be necessary to test the person beforehand to confirm his or her suitability, but it also seems that the registry (registration) process will be difficult.

ならば、政府から『テスト対象企業』を選択して要請する、という手もあります。

If this is the case, the government could select and request companies to be tested.

そこの従業員(の社用スマホ)には、無条件にテストモード対応のCOCOAがインストールされるとしてしまい、運用・管理も、その会社に丸投げする、というものです。

The idea is that the employees of the company (their company phones) will be unconditionally installed with COCOA that supports the test mode, and the operation and management will be thrown to the company.

そうですね ―― グループ含めて従業員10万人以上の、『デジタルで食っていくぜ』を宣言している大手企業であれば ――

Yes, if a major company with more than 100,000 employees, including group companies, has declared "we are going with digital services",

たぶん政府も要請しやすいんじゃないかな、と思うんですが、いかがでしょう?

I think it would be easier for the government to make a request, don't you think?