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

発明王エジソンの格言に

In the aphorism of Edison, the king of inventors,

「人生に失敗した人の多くは、諦めたときに自分がどれほど成功に近づいていたか気づかなかった人たちだ」

'Most people who fail in life are those who didn't realise how close they were to success when they gave up.'

というものがあります。

私、半世紀を生きてきて分かったことがあります。

I, having lived for half a century, know what I know.

―― エジソン、バカ

"Edison, you idiot"

-----

「諦めないこと」は大切なことかもしれませんが、「諦めないこと」には、膨大な時間やコスト、そして、回りの人へのインパクト ―― 自分だけでなく、回りの人を不幸にする ―― という負のコストがあります。

'Not giving up' may be important, but 'not giving up' has a negative cost in terms of enormous time, cost and impact on those around you - making not only you but also those around you unhappy.

特に、自分へのインパクトは『自分の"心"を殺し、最悪、自分を殺す(自死)』ことです。

Especially, one of the impact to me, is "destory my mind, and to the worst, kill myself".

「始めること」は簡単なんです。

'Getting started' is easy.

ところが、それを「諦めること」は、その100倍以上も難しく、苦しい。

However, 'giving it up' is 100 times more difficult and painful than "getting started".

それが、「サンクコストの呪い」です。

That is the 'curse of sunk costs'.

「諦めること」は、「始めること」より難しく、それ故に、価値があります。

'Giving up' is harder than 'getting started' and, therefore, more worthwhile.

バカなエジソンは、それに気がつかなったようですが、私は、それを知っています。

Stupid Edison didn't seem to realise it. I, however, know that.

-----

最近、カルトに関する本を、片っ端から読んでいます。

I have recently been reading a lot of books on cults

カルト教団を脱退できない人の心理に、「サンクコストの呪い」があることが分かってきました。

The 'curse of sunk costs' has been found to be a psychological factor in people's inability to leave cults.

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

「最初に学ぶプログラミング言語」と聞いて、一瞬"?"と思ってしましました。

When I heard the phrase "The first programming language we should study", I thought "what?".

確かにプログラミングに関しては、現時点で、「体系的な教育法」というのは、ないかもしれません。

Certainly, in the case of programming language, there is no systematic education at the present.

私の場合、一番最初に学んだ言語はBASICでした。

For me, I studied "BASIC" for the first time.

次に覚えたのはPascalで、その次がAssembler、で、その次がCでした。

Next, I learned "Pascal" and the next is "Assembler", and the next is "C"

私の見解ですが、プロセスやらスレッドやらは考える必要はなく、プログラムポイントは1つだけの方が良いと思います。

In my opinion, "processes" and "threads" is no needed, and it is better to have only one programme point.

コンパイルとかライブラリとか、そういう面倒なことも、最初は関わらなくてすむなら、なお良いかなぁ、と。

It is rather good that we don't have to study annoying something like compiling, libraries.

オブジェクトとかの概念も、最初は覚えない方がいいと思う。

I think that no need to learn the concept of objects.

いずれにしても、適当に、その場面に応じて、プログラム言語を使ってきた私には、この件については、何も語れそうにありません。

Anyway, I, who used several programming languages as appropriate and case by case, am not proper person to talk about this issue.

-----

というか、「学ぶプログラミング言語」というフレーズに馴染めません。

Or rather, I am not familiar with the phrase 'programming language to learn'.

「プログラミング言語」は「使うもの」です。

'Programming languages to use' is right.

「使う」プロセスで、必要に応じて仕方なく「学ぶ」ことがある、とは思いますが ――

I suppose there are times when the process of 'using' forces you to 'learn' by necessity, however,

目的のないプログラミングの学習は、必ず行き詰まります。「必ず」です。

Learning programming without a purpose will always fail. Absolutely.

ですが、プログラミングの経験のない人は、プログラムで何ができるのかを知りません。

But people with no programming experience do not know what they can do with a programme.

そういう人に、『目的を持ってプログラミングをやれ』というのは、もう滅茶苦茶な話なのです。

To tell such people to 'do programming with a purpose' is already a mess.

-----

という訳で、この件に関して、私は語るべき言葉がありません。

Therefore, I have no words to say on this matter.

ただ、私は、今なお「プログラミング教育」は、失敗する運命にあるんだろうなぁ、という悲観論は取り下げていません。

However, I have not dropped my pessimism that 'programming education' is still probably doomed to fail.

未分類

func numGoroutine() {
	for {
		fmt.Println("======>numGoroutine", runtime.NumGoroutine())
		time.Sleep(1 * time.Second) // 1秒待つ
	}
}

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

今回の、総理大臣のコロナ感染は不幸なできごとですが、現時点で軽症であるというのは、幸いなことです。

The Prime Minister's corona infection is an unfortunate incident, but it is fortunate that the disease is mild at the moment.

これによって、政府中枢のオンラインによる命令指揮系統が、きちんと確立するのであれば、メリット・デメリットは、イーブンに持ち込めると思います。

If this incident become a triger of making online chain of command at the center of goverment, I think the advantages and disadvamtages is going to be even.

現場に出なければ、全く仕事にならないという職業もありますが、政府行政、官僚機構というのは、リモートワークが進めやすい職場ではないか、と思います。

Some works need to go on-site, however, I think the goverment admisstion and bureaucracy are workplaces where remote working can be easily promoted.

もちろん、政治というのが、要領、印象、パワハラ、業務命令、根回し、怒号、泣き落とし、恫喝(どうかつ)、懇願、妥協、人脈、という『腹芸』から構成されるのは、よく分かっています。

Of course, I know well that politics is made up of the 'tricks of the gut' - the art of the gut, impressions, power harassment, work orders, laying the groundwork, shouting, crying wolf, bluster, pleading, compromise, and connections.

その『腹芸』が、密室や料亭でアルコールを投入しなければ、実施できない ―― というのは「甘え」でしょう。

It would be "naive" to think that this 'belly art' can only be carried out in a closed room or at a ryotei with alcohol.

これからは、『リモートワークで腹芸ができてこそ、一流の政治家であり、官僚である』という時代にしていかなければなりません。

We need to move to an era where 'you are a first-class politician and bureaucrat only if you can work remotely and play with 'belly art'.

-----

そういうことになると、私たちITエンジニアの市場も広がるんですよ。

When that happens, the market for us IT engineers will expand.

例えば、AI技術を使った、『腹芸アシストシステム』です。

An example is the 'Belly Art Assist System', which uses AI technology.

会議システムとは別の画面に

On a separate screen from the conference system,

-「泣落し」のセリフがでてくるとか、

- the lines "weeping drop" are popped-up.

- パワハラにならない恫喝のアドバイスが出てくるとか、

- the advice on non-power-harassing threats will be given

ワクワクするような楽しいシステムが、山のように頭に浮んできます。

A mountain of exciting and fun systems come to mind.

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

csvファイルではなく、直接Golangからブラウザにデータを叩き込む方法

の続編です。

Golangから送り込んできたデータを、chartjs-plugin-streaming(リアルタイムストリーミングデータ向け Chart.js プラグイン)で表示してみました。

まず、main13.go(プログラム本体)とindex.htmlのあるディレクトリに、4つのjsファイルを放り込んでおきます。

main13.goの内容

// main13.go

package main

import (
	"flag"
	"fmt"
	"log"
	"math/rand"
	"net/http"
	"time"

	"github.com/gorilla/websocket"
)

var upgrader = websocket.Upgrader{}

type GetLoc struct {
	ID    int     `json:"id"` // ここだけを使ってデータを運んでいる
	Lat   float64 `json:"lat"`
	Lng   float64 `json:"lng"`
	TYPE  string  `json:"type"` // "PERSON","BUS","CONTROL
	POPUP int     `json:"popup"`
	//Address string  `json:"address"`
}

func echo2(w http.ResponseWriter, r *http.Request) {
	conn2, err := upgrader.Upgrade(w, r, nil) //conn2でwebsocketを作成
	if err != nil {
		log.Println("websocket connection err:", err)
		return
	}
	defer conn2.Close()

	for {
		gl2 := new(GetLoc)
		gl2.ID = rand.Intn(20) // ここで乱数を発生されて、javascriptで受信させる
		gl2.Lat = 181.0        // 不要な定数
		gl2.Lng = 181.0        // 不要な定数
		gl2.TYPE = "BUS"       // 不要な定数
		gl2.POPUP = 101        // 不要な定数

		err := conn2.WriteJSON(&gl2) // JavaScriptの onmessageに向けて送信する
		if err != nil {
			log.Println("ReadJSON:", err)
			break
		}
		fmt.Println("echo2:", gl2)
		time.Sleep(time.Second * 3) // 3秒単位で送信する
	}

}

var addr = flag.String("addr", "0.0.0.0:5000", "http service address") // テスト

func main() {
	http.Handle("/", http.FileServer(http.Dir(".")))

	http.HandleFunc("/echo2", echo2)

	log.Println("server starting...", "http://localhost:5000")
	log.Fatal(http.ListenAndServe("localhost:5000", nil)) // サーバと立てる
}

index.htmlの内容

<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>test</title>

</head>

<script type="text/javascript" src="moment.js"></script>
<script type="text/javascript" src="Chart.js"></script>
<script type="text/javascript" src="chartjs-plugin-streaming.js"></script> 



<script>  
    var ws;

    // websocketのオープン(この段階で接続完了)
    ws = new WebSocket('ws://localhost:5000/echo2')  // ユーザ登録画面

    ws.onopen = function (event) {
    }

    ws.onmessage = function (event) {
        // 送られてきたデータを受信して、JSON形式に変更
        var obj = JSON.parse(event.data);
        console.log("obj:",obj);
        console.log("obj.id:",obj.id);
        aa = obj.id;
    }
</script>  

<body BGCOLOR="black" text="white"  STYLE="overflow: hidden;">

	<center>
	  <font size="5">Waking Time(min.) <br></font> <!-- 意味のない表示 -->
	  <font size="5"> 歩行時間(分)</font> <!-- 意味のない表示 -->
	</center>
	
    <canvas id="myChart" width="100" height="85"></canvas>


<script>  
    var ctx = document.getElementById('myChart').getContext('2d');
			var chart = new Chart(ctx, {
				type: 'line',
				data: {
					datasets: [{
                        data: [],  // 1つめ
                        borderColor: "rgba(255,0,0,1)",
                        backgroundColor: "rgba(0,0,0,0)",  
                        lineTension: 0,
                        label: 'Time',
					}]
				},
				options: {
					scales: {
						xAxes: [{
                            type: 'realtime',
                            realtime: {
                                duration: 30000, // 300000ミリ秒(5分)のデータを表示 (コメントアウトすると早く動く)
                                onRefresh: function(chart) {
                                    chart.data.datasets.forEach(function(dataset) {
                                        dataset.data.push({
                                            x: Date.now(),
                                            //y: (Math.floor(Math.random()*16)+30) //30-45の乱数(整数)
                                            y: aa, // この"aa"が、送られてきたデータ
                                        });
                                    });
                                }
                            }

                        }],
                        yAxes: [{
					        ticks: {
					        	max: 20,
					        	min: 0
        					}
                        }]
					}
				}
			});

</script>

</body>
</html>

# go run main.go
として、ブラウザから、http://localhost:5000 で実施すると、以下のような表示がでてきます。

以上

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

csvファイル形式でデータを送るのではなく、プログラムから直接データを放り込むプログラム

 

// main13.go

package main

import (
	"flag"
	"fmt"
	"log"
	"net/http"
	"time"

	"github.com/gorilla/websocket"
)

var upgrader = websocket.Upgrader{}

type GetLoc struct {
	ID    int     `json:"id"`
	Lat   float64 `json:"lat"`
	Lng   float64 `json:"lng"`
	TYPE  string  `json:"type"` // "PERSON","BUS","CONTROL
	POPUP int     `json:"popup"`
	//Address string  `json:"address"`
}

func echo2(w http.ResponseWriter, r *http.Request) {
	conn2, err := upgrader.Upgrade(w, r, nil) //conn2でwebsocketを作成
	if err != nil {
		log.Println("websocket connection err:", err)
		return
	}
	defer conn2.Close()

	for {
		gl2 := new(GetLoc)
		gl2.ID = 101
		gl2.Lat = 181.0
		gl2.Lng = 181.0
		gl2.TYPE = "BUS"
		gl2.POPUP = 101

		err := conn2.WriteJSON(&gl2)
		if err != nil {
			log.Println("ReadJSON:", err)
			break
		}
		fmt.Println("echo2:", gl2)
		time.Sleep(time.Second * 1)
	}

}

var addr = flag.String("addr", "0.0.0.0:5000", "http service address") // テスト

func main() {
	http.Handle("/", http.FileServer(http.Dir(".")))

	http.HandleFunc("/echo2", echo2)

	log.Println("server starting...", "http://localhost:5000")
	log.Fatal(http.ListenAndServe("localhost:5000", nil))
}

index.htmlはこちら

<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>test</title>

</head>
<body>
    <form>
    </form>

    <script>  

        var ws;

        // websocketのオープン(この段階で接続完了)
        ws = new WebSocket('ws://localhost:5000/echo2')  // ユーザ登録画面

        ws.onopen = function (event) {
		    }

        ws.onmessage = function (event) {

          // データをJSON形式に変更
          var obj = JSON.parse(event.data);
          console.log("obj:",obj);
        }
   
    </script>
</body>
</html>

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

私は、「映像の世紀」というNHKドキュメンタリー番組が好きです。

I like the NHK program whose title is "The 20th Century on Film"

今もコーディングしながら、NHKプラス(インターネットでのNHK放送)で、「映像の世紀バタフライエフェクト」を見ながら、コーディングとしています。

Now, white watching "The Century on Film -- butterfly effect" by the "NHK plus" (Internet VOD service), I am coding.

今は、4つほどの番組がアップされているようです。

Now four programs seem to be uploaded.

「太平洋戦争 "言葉"で戦った男たち」というという番組を見ています。

I am watching the program of "The Pacific War: Men Who Fought with Words".

この番組は、米軍が速攻養成した日本語情報士官の話です。

This program is about the US military's fast-track training of Japanese-language intelligence officers.

(1)この学校がコロラド州のボルダーにあったこと、(2)文法無視で、ひたすら読み書きのみで、1年間で日本語が使えるように教育した、という話に興味を引きつけられています。

I am fascinated by the story that (1) the school was located in Boulder, Colorado, and (2) the school ignored grammar and educated the students to use Japanese in one year by solely reading and writing.

私には、米国赴任時に、日本米を手に入れるために隔週でボルダーに通っていた(片道100km先)思い出があり、文法無視の速習語学勉強法にも驚いています。

I have memories of going to Boulder every other week (100 km away each way) to get Japanese rice when I worked in the US, and I was amazed at the grammar-ignoring, rapid-fire language study method.

もちろん、これらの(1)(2)は、番組の本質ではありませんので、興味のある方は、NHKプラスの登録を検討して、番組を見てみて下さい。

I have memories of going to Boulder every other week (100 km away each way) to get Japanese rice when I worked in the US. And I was also amazed at the grammar-ignoring, rapid-fire language study method.

-----

ところが、我が家では、この「映像の世紀」は評判が悪いです。

In the Ebata's, however, the 'The Century on Film' is not popular.

特に、次女は、この番組のテーマソングを聞くと、気分が悪くなるそうです。

In particular, the second daughter feels sick when she hears the programme's theme song.

(YouTubeに飛びます)

次女の学校の先生がこの番組のファンだったようです。

The teacher at my second daughter's school was a fan of the program.

その先生は、学校で、この番組を生徒に見せ続け、次女のトラウマにしてしまったようです。

The teacher kept showing the program to his students at school and the second daughter was traumatized.

-----

私にとっても、「映像の世紀」は、子どもに見て欲しい番組No.1ですが、トラウマにさせたら、逆効果です。

In my mind, "The Century of File" is the No.1 program I want my children to watch, however, it would be counteroffensive if they were to be traumatized by it.

彼女たちは、彼女たちなりのやり方で、独自の価値観を作っていくと信じましょう。

What we have to do, is to believe they create their values in their own way.

もっとも、「李登輝」も知らず「文革」も語れない自分の子どもたちが心配ではありますが、そこは私たちはガマンするしかないのです。

However, I am worried about my children, who do not know "Li Teng-hui" and cannot talk about the "Cultural Revolution", but we have no choice but to be patient.

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

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

訳あって、今、ビジネスホテルに、パソコン(デスクトップ)を持ち込んで作業をしています。

For some reason, I am now working in a business hotel with my computer (desktop).

ホテルでも有線LANが使えるので、大変助かっています。

I can use wire LAN, so it is very helpful.

原稿書いたり、資料作ったりしているのですが、一つ問題がありまして、LANのアドレス体系が自宅の環境と違うのです。

I am writing documents, and making materials, however there is one problem. The LAN address system is different from my home environment.

いや、「今どき、プログラムにIPアドレスハードコピーするのどうよ」と言われると、何も言えないんですけどね。

No, I can't say anything if you say, "How about hard-copying the IP address into the program nowadays?".

実験用プロトとは言え、TLS対応にしなければならないと面倒が増えます。

Even though it is an experimental prototype, it becomes more cumbersome if it has to be TLS-compliant.

別の鍵つくっても直ぐに捨てなければならないしなぁ~、仕方ないなぁ~、これではコーディングできないなぁ~、残念だなぁ~

Even if I made another key, I'd have to throw it away immediately... I can't help it... I can't code with it... It's a pity...

という訳で、今は、NetFlix見ています。

So now I am watching the NetFlix.

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

私、今月のコラム執筆の為に、統一教会の経典「原理原本」の解説を読んでいました(その概要を、今月のコラムに掲載する予定です)。

For the purpose of writing this month's column, I read some commentaries on the Unification Church's scripture, the Original Book of Principle.

さらに、昨日は、統一教会のマインドコンロールから、家族を救出するまでのドキュメンタリーが記載された本を読んでいました(昔、読んだようにな気がします)

In addition, I read a documentary book about the rescue of families from the Unification Church's mind control.(I think that I read it a long time ago)

-----

あたらめて、統一教会のマインドコントロール(洗脳)は非常に強力で、なかなか解除できないものである、というのが良く分かりました。

Once again, I could understand that the Unification Church's mind control(brainwashing) was very powerful and difficult to break.

この洗脳を、非信者の視点から語るのは容易です。

I think that it is easy to speak about this brainwashing from the view of non-believer.

「原理原本」の内容が、目も眩むほどナンセンスだからです。

This is because the content of the "original principles" is blinding nonsense.

ただ、それは、「私が、統一教会の信者でない」から、そう思えるのです。

However, it seems that way because "I am not a member of the Unification Church".

もし、そうでなかったら、統一教会の教えを否定する者を『すべでサタンである』と考えてしまうのは、無理がないかもしれません。

If this were not the case, it might not be unreasonable to consider those who deny the Unification Church's teachings to be 'they are all Satan'.

-----

この、洗脳状態にある信者の気持ちを理解する方法はないか、と考えいたのですが、昨夜、一つ思いつきました。

I was thinking how to understand the believer's feeling under the mind control, and I came up with one last night.

―― この世界は2次元の平面世界であって、地動説など間違っている

"This world is a two-dimensional flat world, and geocentric theories are wrong"

と、言われたらどうでしょうか(実際に、現在も、そう信じている人がいます)。

What if you are said that (and indeed, some people still believe this to this day)?

「アンチ・コペルニクス・パラダイム」です。

It is the 'Anti-Copernican Paradigm'.

-----

親族やカウンセラーに取り囲まれて、

Surrounded by relatives and counsellors,

『江端! どうして、大地が動くなんてナンセンスな考え方ができるんだ!』

"Ebata! How can you think nonsense about the earth moving!"

『地球が動いていれば、お前だって無事でいられる訳がないだろう!』

"If the earth is moving, you won't be safe either!"

もちろん、私は、万有引力の法則(特殊相対論の等価原理)とか、惑星軌道の話とかを、一生懸命説明します。

Of course, I do my best to explain things like the law of universal gravitation (the equivalence principle of special relativity) and planetary orbits.

さらに、私が、GPS衛星の軌道計算方法や、位置測位のプログラムを出しても、全く彼らは理解しようとしません。

Furthermore, when I give them a programme on how to calculate the orbits of GPS satellites and positional positioning, they do not want to understand it at all.

そんな私に対して、親族やカンセラーは観測された自然現象の話で、反論してきます。

My relatives and counsellors argue against me with stories of observed natural phenomena.

彼らは、気の毒そうな目で私は見て、最後には深く溜息を付くでしょう。

They would look at me with a pensive look and finally sigh deeply.

怒りの限界に達した私は、叫びます。

Reaching the limit of my anger, I shout,

『地動説を理解できないお前たちは、みんな、サタンだ!』

"All of you who don't understand geocentrism are Satan!"

と。

-----

私たちが、カルト宗教によるマインドコントロールについて考えるのであれば、

If we are to think about mind control by cults, we must make an imagination,

『地動説を否定され、地動説を押しつけられ、"降参"と言うまで、絶対に開放して貰えない』

"They deny the geocentric theory, they impose the geocentric theory on us, and they will never let us go until we say, 'I give up'."

というくらいの想像まで、私たちの方から近付いていく必要がある、ということです。

It means that we need to approach them.

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

先程、NHKの番組で「自由研究は4年で消えた幻の教科」ということを、知りました。

I have just known from an NHK program, "free research is a phantom subject that disappeared after four years".

算数や国語などと同じ教科だった、ということですね。

It seemed to be same as Math. and Japanese.

現在、81歳以上の方は、自由研究という課題を覚えているそうです。

Some people who are more than 81 years old, remember the "free research" subject.

ところが、高度経済成長に伴い、いわゆる「体系的な教育」つまりパッケージ型教育(詰め込み教育ともいう)にシフトせざるを得なかったことから、廃止に至ったそうです。

However, it was going to be abolished to shift "systematic education", it meant "packed education".

しかし、現場の教師としては『もったいないな』という気持ちがあり、それを夏休みの宿題として残した、という経緯のようです。

As for teachers in class, they felt that it was a "waste" and wanted to leave it as homeworks for the summer vacation.

-----

ただ、1947年当時の自由研究は、教科だったので、教師は、そのメンター(アドバイザー)としての役割もあったようです。

In 1974, "free research" was a subject, so teachers were mentors (or advisors) for the subject.

で、今の夏の自由研究では、そのメンターが、保護者に押しつけられています。

Now for the "free research", the guardians are going to be enforced to be the roles.

で、メンターにさせられた保護者は、かなり胃を痛めているようです。

As a result, the guardians as a mentor come to feel a stomach pain every summer.

それは、自由研究が難しいのではなくて、自由研究のレベルのコントロールが難しいからだそうです。

The reason is that "free research" is not only difficult but also to specific the level-control.

自分の子どもの学年に適合した、研究レポートの「テーマ」と「質」と「量」が分からん、ということのようです。

In conclusion, they cannot know "theme", "quality" and "quantity" of the free research.

-----

以前、"「自由」と名のつくものは多くの人を苦しめる"、という話を書いた記憶があります。

I remember writing the story of "something with the word "free", have people suffer".

教師は、保護者と子どもの両方に、夏休みに入る前に、『自由研究の「過去問』」を配布して上げるべきだよな ―― と思いました。

I think that teachers should deliver the past "free research" to both the children and guardians.

-----

ああ、今年こそ、『夏休みの最後の3日間で、それらしい自由研究レポートを作成する為のEXCEL入門』の執筆しようと思っていたのに、すっかり忘れていました。

Oh, this is the year I was going to write 'Introduction to EXCEL for creating a proper free research report in the last three days of summer holiday', but I completely forgot about it.

『夏休みの最後の3日間で、それらしい自由研究レポートを作成する為のEXCEL入門』