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

ロシアのウクライナ侵攻以来、小説の中の話が、現実でもちゃんと使えるんだ、ということを実感する日々です。

Since Russia's invasions of Ukraine, I have been realizing that fiction stories in novels can be used properly in real life.

1つ目は、『核抑止力』というものが、それなりに機能しているという事実です。

First of all, the fact is that "nuclear deterrence" is working to a point.

現時点で、ロシアもNATOも、核兵器を使用していません。

At this time, neither Russia nor NATO uses nuclear weapons.

正直、私は、「戦略核」の使用はないとしても、「戦術核」はありえるのではないか、と危惧していましたし、今も危惧し続けています。

Frankly speaking, I have feared and continue to fear that even if "strategic nuclear weapons" are not used, "tactical nuclear weapons" are possible.

-----

2つ目は、新しい"核"兵器としての原発の利用 --- 『原発(原子力発電所)攻撃』です。

Secondly, a new nuclear weapon using nuclear power plants --- "nuclear power plant attack"

今も続く、ロシアによる原発攻撃(*)によって、世界中が震撼しているのはご存知の通りです。

As you know, the world is still shaken by the ongoing Russian attack on nuclear power plants(*).

(*)ロシアは、「ウクライナによる攻撃」と主張

(*) Russia claims "attack by Ukraine

私は、日本国民が、『電力を作り出す原発』が『常時電力を供給し続けなければ、とんでもないことになる』ことを、心底から理解できている、世界唯一の国である、と信じています。

I believe that the Japanese are the only people in the world who truly understand that "nuclear power plants," which produce electricity, "would be in serious trouble if they did not constantly supply power".

もちろん、これは、福島原発事故の、あの「全電源消失」のことです。

Of course, this refers to the "total loss of power" of the Fukushima nuclear accident.

この『原発(原子力発電所)攻撃』というのは、『原爆(原子爆弾)開発』と比べて、おろそしく簡単で、ウルトラ低コストです。

This "attack on nuclear power plants" is ludicrously easy and ultra-low cost compared to "developing atomic bombs".

原子炉本体を攻撃する必要もなく、送電網の破壊だけで足ります -- 『破壊工作員、数人程度』で十分いけるんじゃないかな、思います。

There is no need to attack the reactor itself, only to destroy the power grid -- "a few saboteurs" should be enough.

本当に「想定外」なのですか?(2011-03-29の日記)

-----

このように、戦略核 -> 戦術核 -> 原発攻撃 と -----

Thus, strategic nuclear weapons -> tactical nuclear weapons -> nuclear power plant attack,

私たちは、「核廃絶」どころか、3つめの核兵器を「発見」してしまったのだなぁ、と実感しています。

I realize that we have not "abolished" nuclear weapons, but rather "discovered" a third nuclear weapon.

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

最近、長女が、ロシアによるウクライナ侵攻を見て、真剣に国防を考え出しているようで、大変、興味深いです。

It is very interesting that my senior daughter has recently started to seriously consider national defense after seeing the Russian invasion of Ukraine.

# 正確に言うと『国防』ではなくて『逃亡』ですが。

# To be precise, it's not 'national security' but 'escape'.

―― どこに逃げればいいの?

"Where to escape?"

と、真剣に心配しています。

She is seriously concerned.

-----

「我が国(日本)が、今後、どういう流れで戦争に巻き込まれていくか」 ―― というシミュレーションは、私にとっては、大好物のネタですので、そのいくつかのシナリオを長女に語りました。

Simulations of how our country (Japan) might be drawn into a war in the future are a favorite topic of mine, so I told her about some of the scenarios.

昨夜は、これに加えて、「ロシアから見た正義」と「中国から見た正義」についても解説してみました。

Last night, in addition to this, I also explained "justice from the Russian point of view" and "justice from the Chinese point of view".

―― 彼らには、彼らなりの、戦争をしかけるだけの正当な理由がある

"They have their own, justifiable reasons for starting a war"

という私の話が、長女を、さらに不安にさせているようです。

The stories of mine seemed to make her more anxious.

それはさておき。

Aside from that.

-----

以前、私は、長女と次女の近代歴史知識の乏しさを批判し、逆に論破されたことがあります。

I once criticized my daughters for their lack of modern historical knowledge, and was rebutted.

「いや、『四人組』とか『文革』とか、嫌な話がテンコ盛りでしょう?」(2017-04-15 の日記)

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

一方、嫁さんの方は、近年「忠臣蔵」のドラマが放送されていないことに、重大な危機感を感じているようです。

On the other hand, my wife feels a serious sense of crisis over the fact that no "Chushingura" dramas have been broadcast in recent years.

『日本人から、「忠臣蔵」の精神が失われたら、どうするんだ』と。

"What if the spirit of Chushingura is lost from the Japanese people?"

私は、こちらについては、心底"どーでもいい"と思っています。

I am truly "not concerned" about this.

しかし、以前『徒党を組んだ地方浪人による、テロ事件』と語った時に、もの凄く怒られたので、黙っています。

However, my wife was extremely angry with me when I told her that it was "a terrorist attack by local ronin who formed a clique," so I have kept my mouth shut.

-----

私たちは、自分なりの価値観で、その価値観を他人にも理解して欲しいと考えますが ――

We have our own set of values, and we want others to understand those values, but--

結局のところ、そういう試みの多くは、『無駄』に終わります。

After all, such attempts will be in vain.

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

golangを使った、postgresqlのinsertの方法

/*

こんな感じで、DBとTableを作りました

create database agent_db;

create table LocMessage(
	ID     int,
	Lat    double precision,
	Lng    double precision,
	TYPE   varchar(10),
	POPUP  int,
	RealId int,
	PersonState      int,
	BikeState        int,
	StartStationLat  double precision,
	StartStationLng  double precision,
	GoalStationLat   double precision,
	GoalStationLng   double precision,
	StartStationName varchar(40),
	GoalStationName  varchar(40)
);

ちなみに、全部小文字になるみたいですねえ。
agent_db=# select * from locmessage;
 id |  lat   |  lng  |   type   | popup | realid | personstate | bikestate | startstationlat | startstationlng | goalstationlat | goalstationlng | startstationname | goalstationname
----+--------+-------+----------+-------+--------+-------------+-----------+-----------------+-----------------+----------------+----------------+------------------+-----------------

*/

package main

import (
	"database/sql"
	"log"

	_ "github.com/lib/pq"
)

func main() {

	db, err := sql.Open("postgres",
		"user=postgres password=password host=localhost port=15432 dbname=agent_db sslmode=disable")
	if err != nil {
		log.Fatal("OpenError: ", err)
	}
	defer db.Close()

	//_, err = db.Exec("insert into locmessage(id,lat,lng,type,popup,realid,startstationlng ) VALUES(1, 139.0, 38.0, 'PERSON',1,1,222.222);")
	// _, err = db.Exec("insert into locmessage(id,lat) VALUES(a, b);")
	//ins, err := db.Prepare("insert into locmessage(id,lat,lng,type,popup,realid,startstationlng ) VALUES(?,?,?,?,?,?,?)")
	ins, err := db.Prepare("insert into locmessage(id,lat,lng,type,popup,realid,startstationlng ) VALUES($1,$2,$3,$4,$5,$6,$7)")
	if err != nil {
		log.Fatal("db.Exec Error: ", err)
	}

	a := 1
	b := 139.02
	c := 38.02
	dd := "Tomoichi"
	e := 1
	f := 1
	g := 333.333

	//ins.Exec("1", "139.0", "38.0", "BIKE", "1", "1", "222.222")
	//ins.Exec(1, 139.01, 38.01, "BIKE", 1, 1, 222.222)
	//ins.Exec(1, 139.0, 38.0, 1, 1, 1, 222.222)
	ins.Exec(a, b, c, dd, e, f, g)

}

とりあえず、これでデータベースの書き込みはできるみたい。

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

「オリジナル原稿購読希望」をされる方が、止まりません。

The "original manuscript subscription applicants" are coming even now.

―― 『とある宗教団体』を直撃する内容

今ごろになって、『もし、期待外れだったら、どうしよう』と心配になってきました。

By now, I'm starting to worry, 'What if it's a disappointment for them?'

私は、「この内容なら大丈夫」と勝手に判断したもので、そんなに、凄い内容とは思っていなかったものなのです。

I had judged on my own that the content would be OK. and I did not think it would be that great.

(但し、編集部は"削除"を、嫁さんは"休載"を、要求する内容ではあったようですが)

(However, it seems that the editorial department demanded "deletion" and the wife demanded "suspension of publication.)

―― この教団に関する本(教義も含む)を数冊読めば、誰でも分かる程度の内容

"Enough for anyone to read a few books on this cult (including its doctrines)"

です。

―― 宗教団体のネタにコメントすると、面倒くさいことになる

(応募者が0人が、連続2日を経過した段階で、配布を予定しております) の要件が満たさていません。

(After zero applicant after two consecutive days, I will publish it. ) is not satisfied now.

この週末に編集作業を進めますが、リリースはもう少しお待ち頂くかもしれません。

I will work on editing this weekend, but may have to wait a little longer for release.

悪しからずご了承下さい。

Please understand that I apologize.

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

最近、自分が老害の側に立っているなぁ、と実感します。

Lately, I realize that I am standing on the side of the old man, that menas, problems caused by the elderly (esp. gerontocracy, and elderly people's control over the young)

なるべく、若い人の考える発想や感性に『手を出さないように』と心がけているのですが、これが、なかなか難しいです。

I am trying not to touch youth ideas and sensibility, however, it is hard for me.

ご存知とは思いますが、私は、社会的な正しさや、常識と言われているものに対して、『本当にそうだろうか?』と疑義を呈することを、仕事のネタにしています。

As you know, one of my businesses is to make questions against the social and political correctness.

そして、その正しさや常識を、『数字』を使ってひっくり返す、という趣旨のコラムの連載を続けています。

So I continue to write a series of columns with the aim of using "numbers" to to turn the correctness and common sense upside down.

つまり、

It means,

―― (主に、若い人の考えがちな)アイデアを、その場で叩き潰すことができるだけのネタが、頭の中に満載されている

"I have a lot of logics to knock down the ideas that young people tend in my mind"

のです。

しかも、そのネタとは、具体的な数値がスラスラ出てくる、という状況です。

To make the worst, I can show them using many specific numbers.

-----

私は、自慢をしている訳ではないのです。

I am not trying to brag.

「年齢を重ねる」ということは、こういう経験や計算をする時間が「長かった」という、それだけのことです。

"Getting older" menas that I have had "more time" to have these experiences and calculation. That is all.

シニアは、生きている期間が長いだけで『強い』のです ―― これが、権力です。

Senior is stronger, because of their life time. This is power.

-----

私は、若いころに、様々なアイデアや理想を、年上の人に叩き潰されてきました。

When I was youth, several ideas and ideals of mine had been broken by seniors.

年上の人のロジックは、常に完璧でした。ですので、私は常に挫折を続けてきました。

Their logics were always perfect, and I had to continue to lose.

それ故、私が、「人の言うことを聞かない能力」という観念に到達するまでには、随分時間がかかったものです。

Therefore, it took me a long time to arrive at the cencept of "the ability not to listen to others".

柔軟で、頭が良く、コミュニケーションが高い若者、いわゆる「有能な若者」は、簡単に『老害』の餌食にされる傾向が強いです。

Flexible, smart, and communicative young people, the so-called "competent young people", tend to be easily preyed upon by the "old".

私は、『潰される側』と『潰す側』の両方で、この事実を知っています。

I know this reality from the side of 'crushed side' and the 'crusher side'.

-----

ですから、今の私に必要なものは、

So, I think that what I have to have is

『知っていることを、沈黙し続ける能力』

'The ability to remain silent about what I know.'

です。

そして、その能力を最大限発揮する最も簡単なアプローチは『議論をしない』ということです。

And the easiest approach to maximize that ability is to 'not argue'.

今の私には、『"お互いに分かり合わない"努力』が求められていると、実感しています。

I realize that I am now required to make an effort to "not understand each other.

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

(Step.1) vscodeでmarkdownを使って本文を書いて、PDF(A4サイズ)にする

vscodeに以下の拡張機能は絶対に入れる

Visual Studio CodeのMarkdown編集から、いきなりPDFを作ったり、目次を追加したりできる件

vscodeでMarkdownを使って文章を書いている時、図面のコピペを文書の中にサクっと入れることができるアドイン "Paste Image"

(Step.1) SAIやPowerPointを使って、表紙と裏表紙を描いて、PDF(A4サイズ)にする

(Step.3) ConcatPDF(GUI)を使って、上記をマージして、書籍の名前のファイル名に保存する

(Step.4) 「江端さんの本屋さん」へアップロードする

新しいファイルをドラッグして、完了

ちなみに、以前のバージョンを購入して頂いた方は、最新版を無料で御提供する旨を、メッセージに追加(現在は、『メールでご連絡下さい』としているが、自動的にやる方法があるのか? 現在調査中)。

 

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

昨日、以前自分で作ったはずの、Go言語のFuzzy推論ライブラリを探していました。

Yesterday, I was searched "fuzzy reasoning library with Golang" that I had made before.

ついでに、Go, Fuzzyでサーチエンジンをかけたのですが、"Go"、"Fuzzing"というWordで大量ヒットして、驚いています。

In addition, I ran a search engine, and I was surprised to find a large number of hits on the word "Go", "Fuzzing".

―― ここに至って、まさかのファジィ推論の復権? それもGolangで?

"Returning to 'Fuzzy Reasoning' ? with Golang? Now?"

と、思ったのですが、全く違う話でした。

I was foolish to think even for a moment.

-----

GolangのFuzzing機能とは、『プログラムの機能が想定していない入力を与える事でバグを発見するアプローチ』で、「プログラムのバグ発見用テストツール」ということのようです。

Golang's Fuzzing function is "an approach to finding bugs by providing input that is not expected by the program's functionality," and it is a "testing tool for finding bugs in programs.

fuzz: 警察(名詞)

fuzz: police (noun)

fuzzy: あいまいな(形容詞)

fuzzy: ambiguous (adjective)

名詞と形容詞で、これほど意味の変ってくる単語も珍しいなぁ、と思っています。

I think it is rare to change the meanings of word just between noun and adjective like this.

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

私の未来予想は、これまで、ダイナミックに外れてきました。

My future predictions has been out of mark dynamically.

ですので、皆さんは、私の言うことは、あまり信じない方がいい、と、かなり本心から思っています。

So I am sorry that you don't have to believe what Ebata says no much from the bottom of my heart,

と逃げをうった上で申し上げますが、

And I'm going to say this with an evasive answer.

―― ロボットによる介護は、(少なくとも、私のフェーズでは)ダメなんじゃないかな

"I think robotic caregiving is a no-go (at least in my phase)"

と、思うのです。

もっとも、これは「完全人型ロボット」という意味で、パワードスーツの方向は希望はあると思っていますが。

However it is the case of "full humanoid robot", on the other hand, I think that "powered suite" has a little hopes.

-----

最近、私がショックを受けたパラダイムは、『マッチョ介護』です。

The paradigm that has shocked me recently is 'macho caregiving'.

『ITや制御やロボットがナンボのもんだ。これが正解だ』

"IT, control, and robot are meaningless. The 'macho caregiving' is right answer".

と、頭をぶん殴られるほどの衝撃を受けました。

I was so shocked that I was hit over the head.

父と母が亡くなり、今後の介護フェーズは、私たち夫婦の問題に移行します。

Through the death of my father and mother, the caregiving phase is going to move to my wife and me.

その準備としては、お金や設備などもありますが、介護をする側になることを考えれば「マッチョ」は分かりやすく、おそらくはかなりコストパフォーマンスなアプローチです。

For the preparation, we will need money and devices, however, for the side of the caring , "macho" is easy to understand and a cheaper strategy.

被介護者になるリスクを減らすという観点でも、良いアプローチと思います。

From the viewpoint of risk management to avoid being a care receiver, this is a good approach.

-----

こういう考え方が出て来たのは、これを作ってからです。

This paradigm has come to me, since I made the following device.

部屋に鉄棒を作ってみた

今の私は、(ずるい方法の)懸垂20回、ぶらさがり時間は60秒を軽く越えることができます。

Now I can do 20 sneaky pull-ups and keep my body hanging over 60 seconds.

さらに、最近は、他のメニューも加えて、全身運動に工夫をするようにしています。

These days, I have added new menus for full body exercise.

―― まだ間に合うかもしれない

"It might be not too late"

と思い、現在は、筋トレ専用のスポーツジムなどの巡回ツアーを開催しています。

So, I am organizing a tour of gyms and other facilities for muscle training.

-----

ただ、月額費用、2万円/月は、ちょっと高いんですよね。

However, \20K yen/month is too expensive for me.

普通のフィットネスセンターは、人数が多いし、市民運動センターは遠い。

Ordinal fitness club has many members, and the civic exercise center is far from my house.

モチベーションも「介護」一択です。

My motivation of muscle training is just for "caregiving".

マッチョな体になって、女性にモテたい、という心理は、私の人生で、1ナノ秒も登場したことがありません。

I have never wanted to have a macho body and be popular with the woman at all in my life.

(そもそも、私は、"マッチョ = バカ"という、酷い偏見を持っていた人間でした。今は、"尊敬"、"有用"にパラダイムシフトしています)

(To begin with, I thought "Macho is stupid" that is terrible prejudice. Now I change my mind to "respect" or "useful")

加えて、私は「"引きこもり"大好き人間」です。

In addition, I am a "recluse lover".

-----

先ずは、人間を運搬できるだけの筋力と、ぎっくり腰対策ができる程度のトレーニングを、『自宅』でできないものか模索しています。

So, I am searching how to get muscle to move a person, and avoid "strained back" just in my house.

上記の鉄棒のように、自宅を加工するのはことはO.K.で、工作は大好きなので、その方向から、皆さんのアドバイスを頂けると、大変助かります。

Like the the above "iron bar", I love DIY making or modifying my house, so I appreciate if you give me some advices.

よろしくお願い致します。

Thank you for your help in advance.

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

最近、スペルチェックをvscodeにやらせていて、emacsでのリロードを何度もやっているのだけど、これが中々に面倒で、これを一発でできないものか、色々調べた結果です。

方針: 面倒なので、".emacs" だけの記載で終了したい
操作:<F5>押すだけ
判ったこと: ".emacs"の最後に追記すると動かない(私の環境だけかもしれないが) → ".emacs"の真ん中あたりに突っ込んだ。

;;;; バッファを一発でリロードする (.emacsの最後に記載したら動かなかったので、真ん中くらいに移動)

(defun revert-buffer-no-confirm (&optional force-reverting)
  (interactive "P")
  ;;(message "force-reverting value is %s" force-reverting)
  (if (or force-reverting (not (buffer-modified-p)))
      (revert-buffer :ignore-auto :noconfirm)
    (error "The buffer has been modified")))

;; reload buffer
(global-set-key (kbd "<f5>") 'revert-buffer-no-confirm)
;;(global-set-key "\C-c\C-r" 'revert-buffer-no-confirm)
;;(global-set-key "\M-r" 'revert-buffer-no-confirm)
;(global-set-key "\C-c\C-m" 'revert-buffer-no-confirm)

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

こっちはPythonで書いたファジィ(Fuzzy)推論コードです。



# -*- coding: utf-8 -*-
# 上記の一行がないと、コメント分の和文も全部エラーになる 

# シンプルファジィ推論プログラム ver0.0 2015年12月15日
# シンプルファジィ推論プログラム ver0.1 2023年04月20日 print文の仕様変更対応

# メンバーシップ関数は、前件部、後件部ともに3つに固定した単純なもの
# 推論方式は、単純なmin-max重心法のみ



class condition_MF:
    
    center = 0
    width =  100
    PV ="LESS"

    def __init__(self, center, width, PV):
        self.center = center
        self.width = width
        self.PV = PV

    # x,yは、メンバーシップ関数上の座標を示す
    def func(self, x):
        if (self.PV == "LESS"):
            if (x <= self.center - self.width):
                y = 1.0
            elif (x <= self.center):
                y = - 1.0 / self.width * (x - self.center)
            else:
                y = 0.0        
        elif (self.PV == "ZERO"):
            if (x <= self.center - self.width):
                y = 0.0
            elif (x <= self.center):
                y = 1.0 / self.width * (x - self.center) + 1.0
            elif (x <= self.center + self.width):
                y = -1.0 / self.width * (x - self.center) + 1.0
            else:
                y = 0.0       
        elif (self.PV == "MORE"):
            if (x <= self.center):
                y = 0.0
            elif (x <= self.center + self.width):
                y = 1.0 / self.width * (x - self.center)
            else:
                y = 1.0
        
        return y

class action_MF:
    center = 0 # 値はダミー
    width =  100 # 値はダミー
    PV ="ZERO" # 値はダミー
    y = 0.0 # 最大値で更新されていく
    x = 0.0 # 値はダミー

    def __init__(self, center, width, PV):
        self.center = center
        self.width = width
        self.PV = PV

        if (self.PV == "LESS"):
            self.x = self.center - self.width
        elif (self.PV == "ZERO"):
            self.x = self.center
        elif (self.PV == "MORE"):
            self.x = self.center + self.width
        else:
            print ("error")

    # yを最大値で更新していく
    def func_Max(self,b):
        self.y = max(b, self.y)

    # X座標を返す
    def func_X(self):
        return self.x

    # (最大値で更新された、最後の)Y座標を返す
    def func_Y(self):
        return self.y

temp_High = condition_MF(20.0, 10.0, "MORE") # 温度が高い
temp_Middle = condition_MF(20.0, 10.0, "ZERO") #温度が普通
temp_Low = condition_MF(20.0, 10.0, "LESS")# 温度が低い

humi_High = condition_MF(50.0, 20.0, "MORE") # 湿度が高い
humi_Middle = condition_MF(50.0, 20.0, "ZERO") #湿度が普通
humi_Low = condition_MF(50.0, 20.0, "LESS")# 湿度が低い

switch_High = action_MF(0.0, 1.0, "MORE") # エアコンの温度設定を上げる("+1"にする)
switch_Middle = action_MF(0.0, 1.0, "ZERO")# エアコンの温度設定に何もしない("0"にする)
switch_Low = action_MF(0.0, 1.0, "LESS") # エアコンの温度設定を下げる("-1"にする)


# 入力値(温度27度、湿度57%)
t = 35.0
h = 80.0

# (1)「もし、温度が高くて、湿度が高ければ、エアコンの温度設定を下げる」
a1 = min(temp_High.func(t),humi_High.func(h))
print (a1)
switch_Low.func_Max(a1) 

print ("Low") 
print (switch_Low.func_Y()) 

# (2)「もし、温度が普通で、湿度が高ければ、何もしない」
a2 = min(temp_Middle.func(t),humi_High.func(h))
switch_Middle.func_Max(a2) 

print ("Middle") 
print (switch_Middle.func_Y()) 

# (3)「もし、温度が高くて、湿度が普通なら、エアコンの温度設定を下げる」

a3 = min(temp_High.func(t),humi_Middle.func(h))
switch_Low.func_Max(a3) 
print ("Low") 
print (switch_Low.func_Y()) 

# (4)「もし、温度が低くて、湿度が低ければ、エアコンの温度設定を上げる」
a4 = min(temp_Middle.func(t),humi_Low.func(h))
switch_High.func_Max(a4) 
print ("High") 
print (switch_High.func_Y()) 

# (5)(追加)もし温度が普通で、湿度が普通なら、何もしない
a5 = min(temp_Middle.func(t),humi_Middle.func(h))
switch_Middle.func_Max(a5) 
print ("Middle") 
print (switch_Middle.func_Y()) 

# 重心値を求める
# (ルールが推論空間を網羅していないと、ゼロ割が発生することがあるので注意)

reasoning =  (switch_High.func_X() * switch_High.func_Y()  + switch_Middle.func_X() * 
switch_Middle.func_Y()  + switch_Low.func_X() * switch_Low.func_Y()) / (switch_High.func_Y()  + switch_Middle.func_Y()  + switch_Low.func_Y())

print ("\n reasoning")
print (reasoning)

元ネタはこちら(クリックするとページに飛びます)。

ファジィ推論