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

gcc + gdb on CUIで半生を過してきた(時々、Visual studioあり)私にとって、Visual Studio Code ですら十分に面倒くさいです。

が、そうも言ってられないので、腰をすえて環境作りをしています。
今回は、Visual Studio CodeでC/C++プログラミング を参考にさせて頂きました。

とにかく、

  • c_cpp_properties.json (IntelliSense設定)
  • tasks.json (Build設定)
  • launch.json (Debugger設定)

の3つを作らなければならないらしいです。

とりあえず、私固有の情報としては、

$ which gdb
/mingw64/bin/gdb

$ which gcc
/mingw64/bin/gcc

くらいですね。

あと関係あるかどうか不明ですが、[拡張機能]→"Code Runner"→歯車 →"拡張機能の設定"

から、Code-runner: Run in Terminal のチェックを入れて

適当な"setting.jsonで編集"をクリックして、

"code-runner.executorMap": {

"c": "cd $dir && gcc -g -fexec-charset=CP932 $fileName -o $fileNameWithoutExt && $dir$fileNameWithoutExt",

を付け加えろ、と記載されたので、その通りにしました。

とりあえずデバッガは動いているようです。

以上

 

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

dockerをバージョンアップしたら、"docker-compose up -d" で、こんなエラーがでるようになった。
After upgrading docker, I got this error when I tried "docker-compose up -d".

 Error response from daemon: invalid mount config for type "volume": invalid mount path: 'db_data' mount path must be absolute

で、よく分からんのだけど
And I'm not sure.

volumes:
# - db_data   ← これをコメントアウトしたら動くようになった (I commented this out and it works now).
- ./control:/go/src/work # マウントディレクトリ指定
expose:
- 5432 # 兄弟コンテナから5432でアクセスできるようにする
ports:
- "8910-8911:5432"
tty: true # コンテナの起動永続化
db_data:
image: busybox
volumes:
- /data/db

もう、よく分からんけど動けばいいので。
I'm not sure anymore, but I just need to execute it.

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

(昨日の続きです)

(Continuation from yesterday)

外付けGPUを買い揃えて、Go言語の並列処理機能を使ったら、なんとかならないかなぁ、と考えています。

I'm wondering if I can do that with buying an external GPU and using the parallel processing features of the Go language.

予算としては、10万円くらいまでなら、なんとか出せるかなぁ、と思っています。

As for my budget, I think I can manage to spend up to about 100,000 yen.

もし、PCベースで、飛沫シミュレーション(あるいは、同程度のヘビーな物理シミュレーション)を試みている個人、法人、あるいは研究機関の方がいらっしゃったら、ご一報下さい。

If you are an individual, corporation, or research institute that is attempting to do a PC-based droplet simulation (or a similarly heavy physical simulation), please let me know.

色々とご相談させて頂きたいと思います。

I would like to discuss various issues with you.

-----

くしゃみ一つの物理現象で、スパコンを必要とするのですから、SAO(ソードアート・オンライン)の世界を、コンピュータリソースで作ることは、はっきりいって不可能でしょう。

A single physical phenomenon such as a sneeze requires a supercomputer, so it is clearly impossible to create the world of SAO (Sword Art Online) with computer resources.

まあ、物理現象は、簡易モデルを適用すれば良い、というなら可能性はあるもしれませんが・・・いや、それでも厳しいだろうなぁ。

Well, if the physical phenomena are good enough to apply a simple model, then there might be a possibility, but... No, it would still be tough.

仮想空間の全事象の現象をリアルタイムでコンピュータに計算させ続けるなんて、

I can't believe I'm letting a computer calculate the physics of all the events in virtual space in real time, even if we

■現在のスパコンを数千から数万台をかき集めて、

- scrape together thousands or tens of thousands of current supercomputers.

■国内の全電力を投入しても

- put all the power in the country

『小さな学校1つの空間に、生徒50人くらい』の仮想空間を作るのが限界じゃないかな、という気がしています。

I feel that the limit is to create a virtual space with "about 50 students in a small school space".

「知性を持つ人工知能」の方が、まだ実現の可能性がある、と思う。

I think "real-intelligent artificial intelligence" is still more feasible.

あるいは、空間モデルの物理計算は「人間の脳」を使うという方法もあると思いますが ―― もの凄く危険そうです。

Alternatively, I suppose you could use the "human brain" to calculate the physics of the spatial model -- but that sounds very dangerous.

半導体と違って、脳のシナプスは、微弱な電気で簡単に破壊できるからです。

This is because, unlike semiconductors, synapses in the brain can be easily destroyed by weak electricity.

なにしろ、ほっといても加齢で自壊していくくらいヤワなしろものですから(で、認知症に至る)。

After all, it is such a fragile thing that even if left alone, it will destroy itself with age (and lead to dementia).

それはさておき。

That aside.

-----

さて、私が今取り組んでいる「人間の感情を活用したシステム」の研究のコアは、とても簡易な感情の関数を組み込んだ人間エージェントです。

Now, the core of my current research on "human emotion-based systems" is a human agent that incorporates a very simple and straightforward emotion function.

これをシミュレーションの仮想空間の中に、大量にばら撒いて自由に動かし続けています。

These are scattered in large numbers in the virtual space of the simulation and kept moving freely.

人間エージェントとは、ぶっちゃけえ言えば、ゲームプレーヤーに操作されないキャラクター「ノンプレヤーキャラクター(NPC)」です。

A human agent is, to put it bluntly, a non-player character (NPC), a character that is not controlled by the game player.

研究発表をするたびに、聴講者から『そのNPCは、誰の感情をリファレンスしているのですか?』と良く質問されますが、私の答は、いつも同じです。

Whenever I give a research presentation, I am often asked by the audience, "Whose emotions is the NPC referencing? My answer is always the same.

「それは、私(江端)です」―― と。 いえ、これは本当の話です。

"It's me" ----- This is the truth story.

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

『Word, Latexなどを使わないでMarkdownだけで本を作りたい』で、がんばっています。

Visual Studio Code(VSC)は、Golangでは上手く動かなくてイライラしてたのですが、Markdown用のエディタとしては優秀です。

今日、VSCから、いきなりPDFを作ったり、目次を追加したりできることが分かりましたので、メモを残しておきます。

  • PDFの作成

拡張機能(Ctrl+Shift+x)から、

をインストールして、Markdownの編集画面の上で右クリック

これで、PDFファイルが作成される

  • 目次の作成

拡張機能(Ctrl+Shift+x)から、

をインストールして、Markdownの編集画面の上で右クリック

これで、目次が作成される

  • 目次に見出し番号をつける
  1. ctrl + , で設定を開いて「markdown-toc」で検索
  2. 「Detect And Auto Set Section」と「Ordered List」にチェック

  • Headerを消してページ番号だけ残す

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

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

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

踊るバズワード ~Behind the Buzzword(15)STEM教育(3)

STEMを取り入れた「夏休みの自由研究」型パッケージ教育のすすめ

Dancing Buzzword - Behind the Buzzword (15) STEM education(3)

Recommendations for STEM-infused "free research for summer vacation"-type package education"

 

-----

先日参加した学会のパネルディスカッションで「デジタルツイン」の話が出てきました。

The "digital twin" came up in a panel discussion at an academic conference I attended the other day.

私、人間の感情を活用したシステムについての検討をしていましで、そのディスカッションに加わろうとしたのですが、質問のタイミングを逸しました。

I'm working on a system that utilizes human emotions, and I tried to join the discussion, but I missed the timing of the question.

今でも、ちょっと悔しいです。

I still regret it.

その原因の大部分は、『英語のパネルディスカッションに割り込むのは、結構な勇気がいる』ということです。

A large part of the reason for this is that 'it takes a lot of courage to break into a panel discussion in English.

パネラーが、"Sorry, I don't understand what you are saying"と、申し訳なさそう言うのを聞くと

When I heard a panelist say apologetically, "Sorry, I don't understand what you are saying.

―― その後一週間くらいは、自己嫌悪と恥しさで、布団の中で転がり回ることになります。

For a week, I'll be rolling on my bed in self-loathing and shame.

まあ、それはさておき。

-----

今回のコラムの中で、私、「(くしゃみの)飛沫の3Dシミュレーション」の計算量の試算を行って、その膨大な計算量に愕然としました。

In this column, I estimated the amount of computation for a "3D simulation of (sneeze) droplets" and was astonished at the huge amount of computation.

日本のスーパーコンピュータは、今回のコロナ禍において、非常に説得力のある可視化シミュレーションを多数提供してくれました。

The Japanese supercomputer provided many very convincing visualization simulations against the corona disaster.

今回、スパコンの貢献度は非常に大きいものだったと思います。

I think the contribution of the supercomputer was very significant this time.

しかし、スパコンを使えない、貧乏なエンジニアの私も、『自宅のパソコンで、(スケールダウンしてもいいから)このシミュレーションやってみたい』と思っています。

However, even I, a poor engineer who cannot use a supercomputer, would like to try this simulation on my home computer (even if I have to scale it down).

(続く)

(To be continued)

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

先日、制御用デバイスを、個人的に、長期に渡って(3年間以上)貸与して頂いていた会社の社長さんから、

The other day, the president of a company to which I had been personally loaned a control device for a long period of time (more than three years) mailed me. The subject was,

『機材返却をお願いできないでしょうか』

"Could you please return the devices?"

というメールが来ました。

私、これまでも品番の問い合わせなどのタイミングで、度々返却を申し出ていたので、ちょっとビックリしました。

I was a little surprised, since I have often offered to return them when inquiring about part numbers.

その日のうちに、江端家のシステムの一部を解体して、お借りしていた全品を返却しました。

Later that day, I dismantled part of the Ebata family's system and returned all the devices I had borrowed.

まあ、ジャンク屋で拾った機器がまだいくつか残っているので、あまり心配はしていません。

Well, I'm not too worried as I still have a few devices left that I picked up at the junk shop.

-----

世界的な半導体不足の影響で、色々な製品の製造遅延が発生していることは知っていたのですが、私のような個人にまでお願いがくるとは ――

I are aware that the global shortage of semiconductors has caused delays in the production of various products. However, in light of the fact that even an individual like me is being asked to do this.

本当に、半端ではなく危機的状況なのだな、と実感しました。

I realized that they were really in a critical situation.

-----

『そういえば、私が連載の寄稿をさせて頂いているEE Times Japanは、まさしく半導体業界の情報サイトだったなぁ』と思い出しました。

I was reminded that EE Times Japan, to which I am a regular contributor, is really an information site for the semiconductor industry.

こんな日記をリリースしたら、担当のMさんに殴られないまでも、イヤミの一つくらいは言われるかもしれない、とも思いましたが ――

I thought that if I released such a diary, Ms. M, who is in charge of my columns, might at least give me a hard time, if not beat me up.

でも、『叱られたら、叱られたで、また日記が書けるな』と思いましたので、リリースしちゃいます。

But I thought, 'If I get scolded, I can write the next diary,' so I'm releasing this.

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

芝村裕吏さんの「マージナル・オペレーション(改)」を、本日、全部読み終えてしまいました。

I finished reading all of "Marginal Operation (Revision)" by Yuri Shibamura today.

私は、夜中に、ヘッドライトを付けて読書しながらのウォーキングをしているのですが、『あ、もう家についたか』と思えるほど集中できる本は、やっぱり良いと思います。

I've been walking with my headlights on while reading at night, and I think it's good to have a book that makes me concentrate so much, with saying "Oh, I'm home already".

この本の舞台は、中国、ミャンマー、ラオス、タイです。

The book is set in China, Myanmar, Laos, and Thailand.

この付近の地政学の勉強をさせて貰っています。

I've been studying the geopolitics of this area.

挿絵(イラスト)もいいけど、地図を付けてくれると嬉しい。

Illustrations (pictures) are nice, but it would be nice if they could add a map.

戦場の配置図があれば、さらに嬉しい ――

A schematic of the battlefield would be even better.

と、図面至上主義の特許明細書量産機の研究員(私)は思っています。

The researcher (me) of a patent specification mass production machine with drawing supremacy thinks so.

-----

この本を読んで、つくづく思ったことは、中国という国の「気の毒さ」です。

After reading the books, I really felt sorry for the country of China.

今、GoogleMAPを開きながら、眺めているのですが、中国の広大さに、今さらながら驚いています。

I'm looking at Google MAP right now, and I'm still amazed at the vastness of China.

地続きの延々と続く国境線の、かなりの部分が紛争地帯です ―― その国境線の長さに眩暈(めまい)がしそうになりました。

I was almost dizzy from the length of the border line, which is a long stretch of land, much of which is disputed territory.

基本的に、『隣接する隣国とは敵対関係』を原則とする地政学的見地から見ると、こんな広大な領土を統治するのは、さぞ大変だろうと思います。

From a geopolitical point of view, which is basically based on the principle of "hostile relations with neighboring countries," I think it must be very difficult to govern such a vast territory.

いわゆる欧米型の民主主義(人権主義)の価値観をそのまま取り入れたら、国として成り立たないだろうなぁ、と実感できます。

If they were to adopt the so-called Western values of democracy (human rights), they would not be able to survive as a country, I think.

-----

我が国も80年ほど前に、同じようなことを「海洋と大陸」でやろうとして、ものの見事に転けました。

About 80 years ago, our country tried to do the same thing with oceans and continents, and failed spectacularly.

(「大東亜共栄圏」とか「絶対国防圏」でググってみて下さい)

(Google "Greater East Asia Co-Prosperity Sphere" or "Absolute National Defense Sphere.")

そういえば、ドイツも同じころに、ヨーロッパ(こちらは「大陸」)で展開して、やっぱり転けました。

By the way, Germany also expanded in Europe (this is a "continent") around the same time, and also failed.

「大きいこと/広いこと」は、基本的に「面倒なこと」だと思います。

"I think that "big/expansive" is basically "troublesome".

そういえば、以前後輩に教えて貰たのですが『兵站に必要な距離の合計ある値を越えると、戦争に負ける』のだそうです。

By the way, one of my juniors once told me that if the total distance required for logistics exceeds a certain value, the country comes to lose the war.

広くて長い戦線を維持するのって、膨大なコストが必要になると思います。

Maintaining wide and long fronts and borders is a huge cost.

-----

比して、江端家は、監視カメラ2台とセンサとラズパイで、領土を維持しています。

In comparison, the Ebata family maintains their territory with two surveillance cameras, sensors, and a Raspberry Pi.

しかも全部自前で、運用者は一人です。

And it's all self-supporting, with only one operator.

「小さいこと」は、基本的に「安くてラク」です。

Being small is basically being cheap and easy.

『小市民バンザイ』

"Hooray for petit bourgeois"

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

この週末は、資料の構成を考える予定だったのですが、気がついたら、dockerと格闘しているハメになりました。

This weekend I was supposed to be working on the structure of my new book, but I found myself struggling with docker.

3年前に動いた環境で再現を試みたのですが「動かない」。

I tried to reproduce it in an environment that worked three years ago, but it "didn't work".

で、動かない原因を探ってみると、世界で2人くらいしか同じトラブルに遭遇していない。

So I tried to find out why it didn't work, and found that only about two people in the world had encountered the same problem.

(正確には、「そのトラブルをネットにアップしている人数が2人」ですが)。

(To be precise, "the number of people posting that trouble on the Internet is two.)

こういう問題に遭遇した場合の最善手は『諦める』です。

The best thing to do when encountering such a problem is to "give up".

膨大な時間が消費された上に、高い確率で解決しないからです。

This is because it consumes an enormous amount of time and has a high probability of not being resolved.

それでも、それが「仕事」である場合には逃げられない場合もあるのですが、「娯楽」や「趣味」の範疇であれば、とっとと「逃亡」することが肝要です。

If it is your "job," you may not be able to escape. However, if it is a "pastime" or a "hobby," it is essential to "escape" as soon as possible.

-----

ところが、この合理的な行動を妨害する心理的な作用があります ―― 「サンクコスト」といいます、

However, there is a psychological effect that interferes with this rational behavior -- it's called "sunk cost".

サンクコストとは、投資を回収できないコストのことです。

Sunk cost is the cost of not being able to recover an investment.

費やした労力やお金、時間などが、今後の意思決定に影響を与えること ―― 赤字を垂れ流し続けながらも、撤収できないこと ―― を、サンクコスト効果といいます。

The sunk cost effect refers to the fact that the effort, money, time, etc. spent will affect future decision making -- the inability to exit while continuing to incur a deficit.

-----

もっとも日常的に現われるサンクコストは、「受験浪人」「資格試験」です。

The most common sunk costs are "exam wasters" and "qualification wasters".

「売れない芸人、アイドル」くらいなら個人の責任と言えますが、「高速増殖炉」ともなると、1日あたりの維持費が5500万円、廃炉に費用が1500億円と言われています。

"If you're an unsuccessful comedian, it's your own fault. However, "The cost of maintaining a fast breeder reactor is said to be 55 million yen per day, and the cost of decommissioning it is 150 billion yen.

当然、それらは、私たちの血税から捻出されたものです。

Of course, they have been funded by our blood tax.

今日、私は、これらの是非については語りません。

Today, I will not talk about the pros and cons of these.

しかし、私たちが為政者であったとしたら、これだけのコストをかけたものを「捨てる」という判断が、どれほど怖いことあるかは、想像できるかと思います。

However, if we were politicians, we can imagine how scary it would be to make the decision to "throw away" something that has cost us so much.

それに、まあ、ぶっちゃけ、研究員なんぞ、「サンクコストの製造装置」といっても、いいくらいです。

And, well, frankly speaking, researchers can be called a "sunk cost machine".

-----

という訳で、「娯楽」や「趣味」の範疇であっても、週末を使い果たしてしまう私は、存在自体が「サンクコスト」と言えそうです。

So, even if it is in the category of "entertainment" or "hobby", my existence itself is a "sunk cost" as I lose time on weekends.

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

新しいデバイス(スマホ、PC)を使う時に、ワクワクしていたのはいつごろまでだったかな、と思いながら、社用スマホの交換作業を行っていました。

I was replacing a company phone, wondering how long it had been since I was excited to use a new device (smartphone or PC).

充電を2時間経過すると、使いものにならなくなったので、会社に『バッテリー交換』を依頼していました。

After two hours of charging, it became useless, so I had to ask the company to 'replace the battery'.

しかし、『使用期間を越えているので、機器交換にしてくれると、こっちも面倒がなくて助かる』というニュアンスの回答がきましたので、それに応じました。

However, I received a nuanced response that said, "Since it is beyond the period of use, it would be helpful if you could replace the equipment so that we don't have to deal with it," so I agreed.

バッテリー交換をする、ということは、『社用スマホ』という超ド級の秘密情報を含むデバイスを第三者に預ける、ということになります。

When I replace the battery, I am entrusting my "company phone," a device that contains highly confidential information, to a third party.

当然、その守秘義務に関する契約が、想像を絶するほど面倒なものになる ―― ということは、想像に難くありません。

Of course, it is not hard to imagine that the confidentiality agreement would be unimaginably cumbersome.

これって、SDGs的にどうなの? とは思わなくはありませんが ――

From the SDGs viewpoint , what does this means ? I thought, however,

まあ、私の古いスマホは、完全初期化された後、バッテリー交換されて、タリバンが支配する地域などで、有効活用されるのだろう、と思っています ―― 廃車後の日本車と同様に。

Well, I'm sure my old phone will be fully initialized and the battery will be replaced and put to good use in areas controlled by the Taliban -- just like Japanese cars after they are scrapped.

-----

なにしろ、社用スマホは、会社のシステムと連携するデバイスですから、複雑なセキュリティ用ソフトをインストールしなければならず、3種類のパスワードを合計30回くらいは入力する必要がありました。

At any rate, since the company phone is a device that is linked to the company system, I had to install complicated security software and had to enter three different passwords a total of about 30 times.

正直、かったるかった、です。

To be honest, it was a bit of a chore.

加えて、私、スマホにトコトン興味がないので、基本的に前と同じ機種を選んで、以前のスマホのレプリカを作成していただけでした。

In addition to that, I, I, I'm not really interested in smartphones, so I basically just chose the same model as before and made a replica of my previous phone.

-----

本当にしつこいのですが、本気で『ガラケー復活しないかなぁ』と思っています。

I know I'm being really persistent, but I'm seriously wondering if flip phones will ever come back.

小さいし、耐用年数長いし、操作が単純だし、充電時間が短い。

It is small, has a long service life, is simple to operate, and takes a short time to charge.

動画や音楽、リモート会議は、PCかタブレットで十分です。

For video, music, and remote meetings, a PC or tablet will suffice.

LINEは、テキストが表示されれば十分ですし、スタンプなんぞいらん。

For LINE, it's enough to display text, and I don't need stamps.

ただ、『スマホの使用を前提とするサービスの研究開発をしている研究員』としては、『かなり矛盾していることを言っている』という自覚はあります。

However, as a "researcher working on the research and development of services based on the use of smartphones," I am aware that I am saying things that are quite contradictory.

-----

今回の交換の際、うっかりとして、電話帳の移行をすっかり忘れてしまいました。

During this replacement, I inadvertently forgot to migrate the phonebook.

いえ、今回は故意ではなく、私の過失です。

No, this time it was not intentional, it was just my fault.

そんでもって、現在、通話履歴だけで対応していますが ―― 困ったことに、『全然困っていない』です。

So, I'm currently using only the call history -- and the trouble is, I'm not having any trouble at all.

メールとLINEだけで、十分、生活できています。

Email and LINE are enough for my life.