2017,江端さんの忘備録

本日は、コラムがリリースされた日なので、日記はお休みです。

Today, new my column is released, so I take a day off.

"Over the AI(13) ---- beyond a reach of our imagination of AI"

Artificial intelligence remains weak ---- "How to make "strong AI" with fear of death

-----

処世術として、良く言われることの一つに

There is a famous "how to get on in the world"

―― 政治、宗教、野球、恋愛については、人と議論してはならない

"Don't discuss politics, religion, baseball and love affair to others"

というものがあり、私は、このフレーズを守って生きています。

I have kept this phrase absolutely.

(まあ、時々、これらのネタについて『書い』てはいるのですが、他人の『議論』はしません)

(Sometimes I write about these issues, however, I never discuss them)

-----

さて、実は、今回のコラムは、EE Times Japan編集部の担当者のMさんより、以下の文章について、削除を依頼されました。

In fact, at this time, Ms.M who is working on my columns at the EE times Japan office, asked me to delete the following lines.

私は、このMさんの判断を「正しい」と思いました。

I could agree with her, because I think that her judgement was really right.

「宗教」については、いらんことは書かないに限ります。

The best thing to do is that "we don't talk about "religion"".

この辺については、Mさんも私もよく分かっているので、「あ・うん」の呼吸で合意しました(と思う)。

Both Ms.M and I know well, so we can come to compromise about this issue easily,

----

ですが、折角書いたので、私の日記の方で復活させてみます。

Now that I've taken the trouble to make the writing, so I want to attempts to revive.

こんな内容でした(英語版は省略します)。

like the following(I omitted the English version).

============= ここから =============

江端:「『あの世』やら『来世』なるものが同時に2つ以上存在する、などと言っている宗教は1つもないのだから、そういう理不尽で不合理な裁判システム(最後の審判)を採用しているシステムは「併存できない」と考える方が自然だろう?」

次女:「確かに」

江端:「さらに腹が立つのが、イスラム教のジハード(聖戦)という概念だ。イスラム教の教義の為の戦争で、 ―― イスラム原理主義者の一部のカルトたちは「自爆テロ」も「ジハード」であると言い張っているんだけど ―― 死んだら、手続、裁判一切不要で、天国(*1)(*2)直行便が確定するんだ」

(*1)コーラン0節から24節の江端的解釈→『至福の楽園の中に住み、永遠の若さを保ち、24時間、飲み放題食い放題サービスを受けながら、美しい美女たちを自分の回りにはべらせ続けられる』(https://ja.wikipedia.org/wiki/天国 (イスラーム))

(*2)イスラム教の開祖の一人によるコーラン第55章への言及→『天女達(フーリー)は、天国に来たイスラーム信者の男性のセックスの相手し、一人につき72人のフーリーが相手をする。彼女たちは永遠の処女であり、セックスを行い処女膜が破れてもすぐさま再生する』(https://ja.wikipedia.org/wiki/フーリー)

次女:「・・・」

江端:「こんな理不尽(で下品)な話があると思うか? もしパパが、そんな馬鹿げたテロの巻き添えで殺されたら、パパは、たった一人でも、その「天国」なるところに報復テロを仕掛けにいくぞ(*3)」

(*3)こういう俗物で下品な天国のイメージで、カルト化した信者(特に若人)の自爆テロへの心理的しきい値を下げさせていることは事実のようです。しかし、本来、イスラム教とは、、唯一神のもとでの人間の完全フラットな平等と自由と、世界平和を説く宗教で ―― そして、イスラム教徒のほとんどは、そういう方々です。

次女:「ちょ、ちょっと。パパ、怖いよ。うん、「パパは『あの世』とか『来世』を信じていない」でいいよ」

============= ここまで =============

2023,江端さんの忘備録

私は、高度経済成長期の日本(の後半)と、その後の凋落を観測し続けてきました。

I have continued to observe Japan (in the second half of its high economic growth period) and its subsequent decline.

特に、オイルショック(1973年)あたりの物価の高騰については、子どもながら『何かとんでもないことが起こっているんだ』と実感したものです。

In particular, the sharp rise in prices around the oil crisis (1973) made me realize, even as a child, that something terrible was happening.

 

 

それでも、『なんとなく、そのように感覚していた』というレベルを越えません。

Still, it does not go beyond the level of 'somehow I had a sense of it that way.

-----

今、私は、物価高を『実感』として感じています。

I am now 'really feeling' the high prices.

- トーストのパンが小さい

- Toast bread is small.

- ほうれんそうの値段の乱高下が激しい

- The price of spinach is wildly fluctuating.

- 長ネギ、玉ネギが手に入らないことが多い

- Onions and leeks are often unavailable

- 最近、『鶏モモ』ではなく『ささみ』ばかりを食べている

- Lately, I have been eating only "white meat" instead of "chicken thighs".

-----

という訳で、私、新しいダイエットを提唱してみたいと思います。

Therefore I would like to advocate a new diet.

―― インフレダイエット

"Inflation diet"

世界経済と連動する"ダイエット"としては、多分、世界初ではないかと自負しています。

I am proud to say that this is probably the first "diet" in the world that is linked to the global economy.

さあ、反論のある奴は、かかってこい。

 

2016,江端さんの忘備録

本日はコラムがリリースされた日なので、日記はお休みです。

Today, a new column is released, so I take a day off.

"Let's turn the world by "Number" Diet (28)

Now I would like to ask you "do you really need your diet".

ダイエットシリーズ、最終回です。

This is the final of the series.

-----

総括 ――

Summary are,

(1)「楽々ダイエット」なるものは存在しない。

(1) "Easy diet" does not exist.

(2)「喰い過ぎれば太り、喰い控えれば痩せる」に一切の例外なし。

(2) The principle of "if too eating, being fat, if less eating, losing weight" is absolute.

―― です。

さあ、反論のある奴は、かかってこい。

Come on , Guy with a rebuttal.

1年分のデータと、データに裏づけられた仮説検証のシミュレーションコードと、その計算結果で、丁重にお出迎え致します。

Respectfully we will pick you up, with one year's worth of data,simulation program of hypothesis testing that has been backed by data, and the result of the calculation.

2023,江端さんの忘備録

私たちは、多様性を認めなければならない世界に生きていますが、多様性を個人が理解するというのは難しく、社会が認めるのはさらに難しいです。

We live in a world that must recognize diversity, but it is difficult for individuals to understand diversity, and even more difficult for society to recognize it.

マイノリティーの人々は、世間の無理解に対する根気強い、長期間(四半世紀から100年オーダ)の闘いが必要となります。

Minorities will need a persistent, long-term (quarter century to century order) struggle against public incomprehension.

しかし、個人が(×社会が)多様性を認める手っ取り早い方法があります。

However, there is a quick way for individuals (x society) to recognize diversity.

マイノリティの当事者になることです。

It is to be a minority party.

-----

仕事の出張帰りの新幹線の中、3席シートの通路側に座っていた時のことです。

I was sitting on the aisle side of a three-seat seat on the Shinkansen bullet train on my way home from a business trip.

窓際の席に座っている、私と同程度の年齢のごっつい風体の男性が、数枚のスナップ写真を熱心に見ていました。

A burly-looking man about my age, seated by the window, was looking intently at several snapshots.

私がトイレに立ったとき、たまたま、その写真が目に入りました。

When I stood up to use the restroom, I happened to see that picture.

それは、その男性とアイドルコスチュームで装ったティーン風の女の子が、笑顔で一緒に写っている写真でした。

It was a picture of the man and a teen-like girl dressed in an idol costume, smiling together.

女の子がアイドルコスチュームさえ着ていなければ、明らかに親子、という感じの写真でした。

If only the girls weren't wearing idol costumes, they were clearly parent and child.

『新幹線に乗って、アイドルを追っかけるおっさん』というのは、もはや珍しい存在ではありません ―― アニメとか小説の中では。

The "old man on a bullet train, chasing after idols" is no longer an uncommon existence -- in anime and novels in my mind.

しかし、現実に生身の人間を見ると、ちょっとビックリというかビビってしまう ―― これは、私の人間としての器の小ささと言えましょう。

However, when I see a live person in real life, I am a bit surprised or scared -- this is my small human capacity, I guess you could say.

アイドルとのツーショットのスナップ写真を眺める中年から初老の男性を、一月に1回見るくらいの頻度があれば、私も「引く」ことはなくなると思うのですが。

If I could see a middle-aged to early-aged man looking at snapshots of himself with his idols once a month, I would not "put off" as often.

しかし、それには、これからも長い時間が必要になるだろう、と思いました。

But it will take a long time from now, I thought.

-----

で、思ったんですよ。

And I thought that,

この多様性を理解するためには、私自身が『アイドルの追っかけ』に参入しなければならない、と。

In order to understand this diversity, I have to enter the "idol chase" myself.

というわけで、一応、人生のToDoリストには入れているのですが、現時点では、そのリストの最下位くらいです。

So, in a nutshell, I have it on my to-do list for life, but at this point, it is about at the bottom of that list.

『"紅天女"なんぞに、どれだけのコストと時間をかけているんだ?』と

2017,江端さんの忘備録

ガラスの仮面に出てくる「大都芸能」は、大丈夫なんだろうか ――

"Daito-Performing Arts Co." in a comic "Mask of glass" is O.K. isn't it?

と、いらん心配をしています。

I am worried about unnecessary.

まず、海外展開の場面が出てこない。

First of all, scenes of overseas expansion do not come out.

アイドルビジネスに参入している様子もない。

No appearance of entering idle business.

インターネットへのコンテンツビジネスも、まったくやっている様子ないし。

He seems not to be interested in the Internet content business at all.

"紅天女"などという、大衆受けしそうにない舞台演劇に、こともあろうに、社長が固執している。

As the case may be, the president sticks to a stage play which is unlikely to be popular, "Red Milky Woman".

というか、そもそも「芸能プロダクション」なんてビジネスが、今時立ち行くのか?

To begin with, will "entertainment production" go well now ?

-----

『"紅天女"なんぞに、どれだけのコストと時間をかけているんだ?』と ――

"How much money and time are you spending on "Red Milky Woman"? "

よく、株主は怒り出さないなぁ、と思う。

Why do shareholders get angry ?

私が株主なら、速水真澄の解任動議を発議する。

If I were a shareholder, I would make a motion to dismiss "Masumi Hayami".

2023,江端さんの技術メモ

package main

import (
	"fmt"
)

// (1)
var m = make(map[int]int)  // (2)をコメントアウトするならこっちを使う

func main() {

	// (2)
	//m := map[int]int{} // (1)をコメントアウトするならこっちを使う

	m[3124] = 9
	m[1992] = 2
	m[2020] = 3

	// キーのみ取り出す
	for key := range m {
		fmt.Println(key)
	}

	//3124
	//1992
	//2020

	fmt.Println()

	// キーと値
	for key, value := range m {
		fmt.Println(key, value)
	}
	fmt.Println()

	//1992 2
	//2020 3
	//3124 9

	// 値のみ必要な場合
	for _, value := range m {
		fmt.Println(value)
	}

	//9
	//2
	//3

	fmt.Println()

	// ループの回数を数える
	i := 0
	for key, value := range m {
		fmt.Println(key, value)
		i++
	}

	//3124 9
	//1992 2
	//2020 3

	fmt.Println()
	fmt.Println("delete(m, 1992)")
	delete(m, 1992)
	for key, value := range m {
		fmt.Println(key, value)
	}

	//delete(m, 1992)
	//2020 3
	//3124 9


	fmt.Println()
	fmt.Println("add as m[2999] = 2")
	m[2999] = 2
	for key, value := range m {
		fmt.Println(key, value)
	}

	//add as m[2999] = 2
	//3124 9
	//2999 2
	//2020 3

	_, ok := m[100]
	if ok {
		fmt.Println("OK")
	} else {
		fmt.Println("NG")
	}

	// NG

	_, ok = m[2999]
	if ok {
		fmt.Println("OK")
	} else {
		fmt.Println("NG")
	}

	// OK

	fmt.Println(m)
	// map[2020:3 2999:2 3124:9]

	m[2020]++

	fmt.Println(m)
	// map[2020:4 2999:2 3124:9]



}

2023,江端さんの技術メモ

研究室の学生さんたちに負荷テストに協力してもらっています。

今、"cannot parse invalid wire-format data" のエラーでGTFS_HUBのダウンを確認しました。

PrumeMobileの方は、そのままにして、GTFS_HUBの再起動をかけました。

(以下、後日対応)

2023,江端さんの忘備録

最近、この問題でずっと困っていました。

Recently, I have been in trouble about this problem.

repeated read on failed websocket connection (一応解決)

金曜日の日深夜(正確には土曜日の未明)に『これで動くはず』というコードを仕込んで、動くことを祈りながら、床につきました。

Last Friday midnight(early Saturday morning to be precise), I completed the code that "should be worked" I expected and went to bed.

あの時点で、プログラムを走らせたら、そのデバッグに取り組み始めて、完全に徹夜作業になって、結果として、体調を崩すという確信があったからです。

If I would try to execute the program, I should have started debugging for all night, and I confirmed that I was convinced that I would get sick.

ですから、土曜日の朝、2箇所程度の修正で動いた時は、本当に嬉しかった。

Therefore, I was very happy that I confirmed the program worked well with just two modifications.

このプログラムを、AWS(正確には、廉価版AWSであるAmazon Lightsail)にアップして稼動実験を続けていました。

I uploaded this program to AWS (correctly, Amazon Lightsail, a low-cost version of AWS) and continued the test run.

取り敢えず、サーバ稼動することが確認できxたので、月曜日に同僚やゼミ生に協力して貰って、負荷テストをしたいと思っています。

Anyway, I could confirm that this program is working as a server, I am going to ask my workers and students to do the test run.

-----

このサーバ化は、実は仕事でもなく、単に興味でやっています。

The reason I am trying to make the server, is not for work but for my interest.

誰に命じられたという訳でもなく、私の直感が『将来、これでラクできる』と言っているだけですが。

No one ordered me to do that, it is just that my intuition is telling me "this wil make my work easier in the future"

2023,江端さんの忘備録

NHK BS1スペシャル『ウクライナ大統領府 軍事侵攻・緊迫の72時間 完全版』を、嫁さんと3日がかりで見ました。

My wife and I watched the NHK BS1 special "The Ukrainian Presidency: Military Invasion, 72 Hours of Tension, Complete Version" over three days.

江端家の夕食は、"NHKニュース7"をベースに動いています。

The Ebata family's dinner is based on "NHK News 7.

その前後の時間を使って、嫁さんと一緒に別の番組を見ることにしています。

I use the time before and after to watch another program with my wife.

今回は、それが、3回分になったということになります。

In this case, we divided the program into 3 times.

-----

『現実にあったこととは思えない、もの凄い内容の映画を見たようだ』

It's like watching a movie with a lot of great content that I can't believe happened in real life."

という嫁さんに私も完全に同意しています。

I completely agree with my wife's opinions.

淡々と語られる72時間の出来事に呆然とし、

The events of the past 72 hours, told in a matter-of-fact manner, astonished me,

過剰な演出も、音楽もなく、作られた『愛』や『正義』が語られることなく、

There is no excessive staging, no music, no talk of made-up "love" or "justice",

それでも、番組の最後の方は、私も涙を抑えきれませんでした ―― 嫁さんはいわずもがなです。

Still, by the end of the program, I couldn't hold back my tears either -- not to mention my wife's.

-----

嫁さん:「日本が軍事侵攻されたら、パパも戦う?」

Wife: "If Japan is invaded militarily, will you fight too ?"

江端:「戦うと思う。私の場合、戦う理由に『愛国心』なんぞは1%もなく、ただ単に『腹が立つ』が100%になると思うけど」

『到底、勝目のない戦争。国内の犠牲者が出るだけだから、日本は、北海道をロシアに譲るべきだ』

Ebata: "I think I will fight. In my case, the reason for fighting is not even one percent 'patriotism,' but only 100 percent 'I'm angry.

嫁さん:「それで十分でしょう」

Wife: "That should be enough."

江端:「ただ私の場合、武器を装備したら2kmも行軍できないと思うから、サイバー戦の方に配置して貰いたいけど」

Ebata: "But in my case, I don't think I can march 2km when equipped with weapons, so I will ask to place me in cyber warfare."

ぶっちゃけ、戦争や権力への反抗心を持たない若者なんて ―― 『そんな若者なら、とっととやめちまえ!』と言いたいくらいです。

-----

この番組、アメリカか、イギリス、またはフランスあたりが制作されたものかと思っていたら、なんと、制作は、我が国のNHKでした。

I thought this program was produced in the U.S., the U.K., or France, but to my surprise, it was produced by Japan's NHK.

なんか嬉しかったです。制作された方々全てに、お昼御飯をおごりたい気持ちです。

I was kind of happy. I feel like buying lunch for everyone involved in the production.

NHKニュース、NHK語学プログラム、NHKニュース(地震速報、災害)、そして、NHKドキュメントで、少なくとも私は、NHK受信料の元を取っているという自覚があります。

With NHK News, NHK language programs, NHK News (earthquake bulletins, disaster), and NHK Documents, I am at least aware that I am getting my money's worth for the NHK subscription fee.

このような高い品質のドキュメンタリーが提供され続ける限り、私は、これからもNHKの言い値で、NHK受信料を払わさせて頂く所存です。

As long as NHK continues to provide documentaries of such high quality, I will continue to pay NHK subscription fees as NHK wants

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

C:\Users\ebata\goga\1-10>のI_hate_go_server.md が本体です。

1. Golangのサーバなんか大嫌い

このドキュメントは、絶対的な意味において「無保証」です

Golangで作るサーバは、HandleやらHandlerやら、ハンドル、ハンドルとうるさい! と叫びたくなること、甚しいです。

さすがに、C言語のfork()まで戻りたいとは思えませんが、『あれは、あれで、何をやっているのか分かった』とは言えました。

で、もう正しい理解かどうかは、無視して、もう、誰の話も聞かん! 江端はこういう風に理解すると決めた!! ことを記載しておきます。

2. サーバ側の江端の理解

2.1. http.Handle()は、ブラウザに入力するURLと、index.htmlの場所を教えるものである

http.Handle("/", http.FileServer(http.Dir(".")))

は、https://xxx.xxx/ でアクセスできて(http://xxx.xxx/yyyy のように"yyyy"はない)、index.htmlが、goのサーバのプログラムと同じディレクトリ(".")にいる、と宣言するもの。

http.Handle("/tomo", http.FileServer(http.Dir("./js")))

であれば、https://xxx.xxx/tomo でアクセスできてindex.htmlが、goのサーバのプログラムと同じディレクトリのしたのjs("./js")にいる、と宣言するもの。

2.2. "http.HandleFunc()"は、クライアントがやってくるごにに一つづつ立ち上があるfork()のようなものである→大嘘でした(現在修正検討中) 

具体的には、こちらを読んで頂くと良いと思います。

repeated read on failed websocket connection (一応解決)

要するにwebブラウザ(クライアント)からのアクセスがあれば、この関数がfork()の用に立ち上って、Webブラウザとの面倒を見る。→大嘘でした

面倒見ません。

まず第一に、http.HandleFunc()の誤解がありました。私は、これを、fork()のようにプロセスかスレッドを発生さるものと思っていましたが、これは、一言で言えば、単なるコールバック関数でした。

乱暴に言えば、Webからアクセスがあると、func()というファンクションに吹っ飛ばされる、という現象を発生させる"だけ"で、それ意外のことは何にもしてくれないのです。

これは、index.htmlの内容をクライアントの押しつけるfork()関数と考えれば足る。→大嘘でした

(後で述べるが)これで、

http://localhost:8080 

でアクセスできるようになる

http.ServerFileというのは、実装されているので、わざわざ main.goに書く必要はない。

一方、

http.HandleFunc("/chat", HandleClients)

は、

func HandleClients(w http.ResponseWriter, r *http.Request) { 
    //色々
}

で定義されている、コードをfork()のように立ち上げるものである、と考えれば足る。→大嘘でした(現在修正検討中) 

単にその関数に飛んでいくだけです(但し、ソケット情報を付けてくれます)

"/chat"とは何か?

(後で述べるが)これで、

http://localhost:8080/chat 

でアクセスできるようになる

2.3. "http.ListenAndServe(":8080", nil)"は、「localhost:8080をサーバにするぞ」を実行するものである

上記の関数は、"/"やら、"/chat"やらの(相対的)なパスを指定しているが、これは、サーバのアクセスするアドレスとポートを決定するものである。

err := http.ListenAndServe(":8080", nil)
if err != nil {
	log.Fatal("error starting http server::", err)
	return
}

で、これを宣言することで、サーバとして使えるようになる。

ちなみに、(":8080", nil)の"nil"は、上記のhttp.ServerFile()と、http.HandleFunc()を使うぜ、の意味になる(直接編集することもできるらしい)。

2.4. upgrader.Upgrade(w, r, nil)は、HTTP通信からWebSocket通信に更新してくれるものである

これは"github.com/gorilla/websocket"が提供してくれるもので、HTTP通信(一方通行)からWebSocket通信(相互通行)に更新してくれる便利なものらしい。

websocket, err := upgrader.Upgrade(w, r, nil)
if err != nil {
	log.Fatal("error upgrading GET request to a websocket::", err)
}

こうしてしまえば、websocket.ReadJSON()やら、websocket.WriteHSON()やらが、バカスカ使えるようになる。

2.5. これは何だろう

http.Handle("/static/", http.StripPrefix("/static", http.FileServer(http.Dir("static"))))

まあ、"/static/" は、通信コネクションでいいして、http.StripPrefix("/static", http.FileServer(http.Dir("static")))については、「/static」をhttp.FileServer()が捜索するURLから除く という意味です。

2.6. 乱暴に纏めると

http.HandleFunc()と、http.ListenAndServe()の』2つだけ覚えておけば、いいんじゃない?、と思う。

3. クライアント側の江端の理解

3.1. Dialer構造体のdial関数は、サーバとの接続要求をするものである

一般的にクライアントはWebブラウザなんだけど、これをgolangのプログラムからwebsocketでアクセスしようとする場合は、こんな感じになる。

var addr = flag.String("addr", "0.0.0.0:8080", "http service address")

func bus(bus_num int) {
    var bus BUS

    ///////////// 描画処理ここから ////////////////
    _ = websocket.Upgrader{} // use default options

    flag.Parse()
    log.SetFlags(0)
    u := url.URL{Scheme: "ws", Host: *addr, Path: "/echo2"}
    log.Printf("connecting to %s", u.String())

    c, _, err := websocket.DefaultDialer.Dial(u.String(), nil)
    if err != nil {
        log.Fatal("dial:", err)
    }
    defer c.Close()

まず、グローバルで、以下のようにサーバを場所を書いておく。

var addr = flag.String("addr", "0.0.0.0:8080", "http service address")

(よく分からないんだけど)以下のような書き方でwebsocket(のインスタンス?)が作れるらしい。

 _ = websocket.Upgrader{} // use default options

以下で、/echo2を使うぜ、の宣言

    u := url.URL{Scheme: "ws", Host: *addr, Path: "/echo2"}

で、以下で、websocket用のソケットができるらしい。

    c, _, err := websocket.DefaultDialer.Dial(u.String(), nil)

この後はc.ReadJSON()やら、c.WriteJSON()やらを使い倒す、ことができるようになります。

4. 江端の理解 その他について

4.1. flag.Parse()って何?

var addr = flag.String("addr", "0.0.0.0:8080", "http service address")

を"固定するもの"でいいのかな? → 間違っています。→ golang でコマンドライン引数を使う

4.2. log.SetFlags(0)って何?

import "log"
で、logを使う場合に、logの設定をリセットするもの、で良さそうです。

以上

内容間違っていたら、優しくご指摘下さい。