


江端智一のホームページ
我が家では、毎年、e-Tax(https://www.e-tax.nta.go.jp/)で確定申告で医療費還付処理を行っています。
Our family uses e-Tax (https://www.e-tax.nta.go.jp/) to process medical expense refunds on our tax return each year.
嫁さんが、医療費の領収書をキチンと纏めていて、それを私がエクセルファイルに書き込んでいます。
My wife is neatly compiling the medical receipts and I am writing them into an excel file.
エクセル書き込みは、頭を使わないので、NetFlixを見ながら作業できますが、結構な時間がかかります。
Excel writing takes quite a bit of time, although I can work on it while watching NetFlix since I don't have to use my brain.
(その上、提供されるエクセルファイルは、目的不明なセル保護がかかっいて、修正作業すらままならない、という使い難さです)
(In addition, the provided Excel file template is so difficult to use that it is impossible to even make corrections due to cell protection of unknown purpose)
嫁さんと私が、この面倒な処理をしているのは、還付金が結構な金額になるからです。
My wife and I are going through this tedious process because the refund is quite large.
やっていない人は、『随分、もったいないことをしている』と思いますよ、マジで。
If you are not doing it, I think you are wasting a lot of money, seriously.
-----
それにしても、e-Taxを始めとして、行政システムの使い難さは、全く改善されていません。
Nevertheless, the difficulty of using e-Tax and other administrative systems has not improved at all.
それどころか、酷くなっているとすら思えます。
On the contrary, they even seem to be getting worse.
例えば、
For example,
『ほぼ隔年でICカードリーダの読み取りアプリが変わる』
'Almost every other year, IC card reader reading apps change.'
という現状を、なんとかして貰えないものでしょうか。
Can they do something about this situation?
その業務を専門にしている人ならともかく、「e-Taxで確定申告」のターゲットユーザは、
Aside from those who specialize in that business, the target users of "Tax Returns with e-Tax" are
―― 一年で、一回だけ、e-Taxシステムを起動する、一般人
"The average person who activates the e-Tax system only once a year"
ということを分かっているのかな、と疑問に思うことがあります。
I sometimes wonder if they understand this fact.
-----
もちろん、ユーザのPCのOSの変更などに対応していくことや、最新のセキュリティ対策に万全を尽さればならないのは理解できます。
Of course, I understand the need to keep up with changes in user PC operating systems and to take all possible measures to ensure the latest security measures.
また、カードリーダがPC付随のデバイスであるから、全操作をWebで一本化するのが難しい、等のシステム的な理由も理解はできます。
It is also understandable that there are systemic reasons such as the card reader being a device attached to the PC, making it difficult to centralize all operations on the Web.
しかし、これでは、『e-Taxによる確定申告を増やして、アナログ提出を少なくして人件費を削減する』という、元々の目標が達成できないのではないでしょうか。
However, this would not achieve the original goal of 'reducing labor costs by increasing the number of tax returns filed by e-Tax and reducing the number of analog submissions.
私ですら、『面倒くさいから、印刷して提出しようか』と考えたくらいです。
Even I thought, 'It's too much trouble, let's print it out and submit it.
-----
まあ、私の場合、"e-Tax"は、ゲームのようなものと考えるようにしています。
Well, in my case, I try to think of "e-Tax" as a kind of game.
『電子提出完了 = ラスボス撃破』とでも思わないと、やっていられません。
I would not be doing this if I didn't think, 'Electronic submission complete = Rust Boss defeated'.
私の場合、アイテム(PC周辺装置等に関するIT知識)を持っているから、『勇者』として戦えますが、―― "e-Tax"ゲームの中で『勇者』をやれる人は、あまり多くないと思います。
In my case, I can fight as a "hero" because I have some items (IT knowledge about PC peripherals, etc.), but - I don't think there are many people who can play "hero" in the "e-Tax" game.
『ただ、ITメディアで彼(江端のこと)の連載追うの本当にみづらすぎて、もしかしたらITメディアとの契約上むずかしいのかもと思いつつも・・・』
という投稿(苦情)を読みました。
記事の最初のここ(↓)をクリックすると、私の記事のバックナンバー、または、その中の連載のバックナンバーが出てきます。

私の睡眠時間確保の為にも、各テーマのバックナンバーを一通り読んだ後で質問して頂けると ―― 「私」が助かります。
あ、それと、これ(江端さんへ電子メールを出す前に)もご一読下さい。
https://teratail.com/questions/370090?nli=619ad631-d4fc-405f-a649-44670a040506#reply-502318
もの凄く助かりました。
nobonoboさんに心からの感謝を
C:\Users\ebata\goga\3-10

/*
いっせいブロードキャストをするのに一般的に使われているのはPubSubと呼ばれる方式です。
サブスクライブを複数あらかじめおこなっておき、パブリッシュでメッセージを送ると
複数のサブスクライブ先に同じメッセージを配信するというものです。
おそらくこの方式は発見済みで、想像するに複数のサブスクライブ先をループで巡って
複数回送信することでブロードキャスト相当を実現するのではなく、もっと真に
ブロードキャストしたいということが質問者さんの意図なのかなと。
そういうものを実現するのに「sync.Cond」という標準ライブラリ機能があります。
これの活用方法は実はちゃんとした実例が見つけにくいです。たいてい前者のやり方で済まして
しまっているのと、sync.Condの挙動は若干わかりづらいです。
すこし解説は端折りますが、以下のように記述することで実現できると思います。
ポイントは
タイミングだけをsync.CondのBroadcastで伝える
複数のタスクには共有メモリを通して渡したいメッセージを伝えます
送る方も受ける方も排他ロックを併用するのがCondの使い方でロック期間であれば
共有メモリをコンフリクトなくアクセスできます
この方法はPubSubにくらべ、共有メモリをすべてのgoroutineタスクに伝播したか
どうかを保証する仕組みがないです
つまり、この方法は「低頻度のイベントを大量のタスクに配信」するか、もしくは
「最新の値さえ受け取れればOK」という用途向けです。
*/
package main
import (
"fmt"
"log"
"sync"
"time"
)
type BroadCaster struct {
cond *sync.Cond
id int64
msg string
}
func (bc *BroadCaster) Send(msg string) {
bc.cond.L.Lock()
defer bc.cond.L.Unlock()
bc.id++
bc.msg = msg
bc.cond.Broadcast()
}
func (bc *BroadCaster) Recv(last int64) (int64, string) {
bc.cond.L.Lock()
defer bc.cond.L.Unlock()
for bc.id == last {
bc.cond.Wait()
}
return bc.id, bc.msg
}
var (
broadcaster = &BroadCaster{
cond: sync.NewCond(&sync.Mutex{}),
}
)
func task(i int) {
log.Println("task:", i, " start")
defer log.Println("task:", i, " stop")
last := int64(0)
for {
id, msg := broadcaster.Recv(last)
last = id
log.Println("task:", i, msg)
}
}
func main() {
for i := 0; i < 3; i++ {
go task(i)
}
for i := 0; i < 3; i++ {
time.Sleep(1 * time.Second)
broadcaster.Send(fmt.Sprintf("hello, world: %d", i))
}
time.Sleep(1 * time.Second)
}
Keyword sync.Cond, sync.Broadcast,
今回のロシア軍によるウクライナ侵攻(ここでは、各種メディアに合わせて「侵攻」を使います)に関して、
With regard to the recent Russian military invasion of Ukraine (we use "invasion" here, in keeping with the various media outlets), there is an opinion that
―― 到底、勝目のない戦争。国内の犠牲者が出るだけだから、早くウクライナは降伏すべきである
"A war that cannot possibly be won. Ukraine should surrender as soon as possible, as it will only result in domestic casualties"
という意見があります。
かつて、日本も同じような状況になったことがあります。
Japan has had similar situations.
太平洋戦争時、我が国の最高戦争指導会議は、この判断(無条件降伏)ができませんでした。
During the Pacific War, our Supreme War Leadership Council was unable to make this decision (unconditional surrender).
その結果、多数の非戦闘員(民間人)が殺害され、国土を原爆の実証実験に使われました。
As a result, many non-combatants (civilians) were killed and our country was used to demonstrate the atomic bomb.
そのように考えた場合、このような「降伏優位論」には、一定の説得力があります。
When considered in this light, such a "surrender superiority theory" has a certain persuasiveness.
-----
しかし、その一方で、
However, on the other hand,
(今回のウクライナ侵攻ではなくて)前回のクルミア半島併合の時のシナリオを、我が国を使ったユースケースとして考えてみると、
If I consider the scenario of the previous annexation of the Kurmian peninsula (instead of the current invasion of Ukraine) as a use case with our country,
■「北海道の在留ロシア人がロシアへの併合を希望している」から、
- "The Russians living in Japan in Hokkaido want to annex Hokkaido to Russia.
■ロシア大統領が『北海道をロシアに併合する』と宣言して、
- The Russian president declares, "Hokkaido will be annexed to Russia.
■一方的に軍事侵攻をしてきて、
- Unilateral military invasion of Hokkaido
■北海道より北部の我が国の領土を実効占拠した
- They effectively occupy our territory north of Hokkaido.
としたら、
, and when we were told the following
『到底、勝目のない戦争。国内の犠牲者が出るだけだから、日本は、北海道をロシアに譲るべきだ』
"It's a war that can never be won. Japan should cede Hokkaido to Russia because it will only result in domestic casualties."
と言われて、私たちは、納得するでしょうか。
Will we be convinced ?
-----
私、絶対的な意味において、愛国者ではありませんが、それでも、
I'm not a patriot in the absolute sense of the word, but I thought,
―― 命をかけて戦える
"I can fight for my life."
と思いました。
私の場合、「愛国心」なんかなくったって、「理不尽に対する激怒」で戦えます。
For me, though I don't need "patriotism" to fight, I can fight with "rage against unreason".
-----
上記のユースケースは、私が思いついたもので、多分、あまり妥当なものではないと思います。
The above use case is just something I came up with and probably not very good.
誰か、これような「我が国を使ったユースケース」で上手く説明してくれる方、いらっしゃいませんか?
Can someone please explain well with a "use case using our country" like this?
そういうことを考えている人は、沢山いると思うんです。
I think there are a lot of people who are thinking about that.
C:\Users\ebata\goga\3-23に格納されている(絶対忘れると思ったので、アップしておく)
対向サーバは、〜/go_template/tests/server23.go
【Golang】structのField名で気をつけるところ
「小文字で始まるField名は外部パッケージからのアクセスできない」 って、どんな言語仕様なんだ・・・
いや、privateとかpublicなんぞ使うよりずっといいって思うよ。
でも、こんなことでvscodeから怒られているとは思わなかったよ。
ソースコードが長くなってくれば、ソースコードを分割するのは当然ですが、Golangでは、この「当たり前」の情報が全然見つからなくて、本当に困っています。
これまで出てきたエラー一覧
「もう、これだから、新しい言葉を覚えるのは嫌なんだよ」と、何十回目かの泣き言を言っています。C/C++で1000万くらいのスレッドが、サクっと作れれば、別にGolangでなくたって・・・と思うのですが、ないものをねだっても仕方がありません。
こちらの記事(https://leben.mobi/go/configuration_and_package/start-go/)を丸パクリさせて頂きました(ちょっとだけ変えています)。
$ tree
.
├── hello
│ ├── greet.go
│ └── hello.go
└── main.go
てな構造でディレクトリを掘って、ファイルを作ってください。
で、
$ go mod init m ← "m"でもなんでも、好きな文字列を(ここでは"m"とします)
go: creating new go.mod: module m
go: to add module requirements and sums:
go mod tidy
下↓が必要はどうかは不明
$ go mod edit -replace=m/hello=../hello
として、
.
├── go.mod
を作ります。
$ more main.go
package main
import (
"fmt"
"m/hello" // ← ここ重要
)
func main() {
fmt.Println(hello.SayHello()) // パッケージ名 + 最初が大文字の関数
fmt.Println(hello.Greet())
}
$ more hello/hello.go
package hello // ← ここ重要
func SayHello() string { // 最初は大文字
return "Hello World!"
}
$ more hello/greet.go package hello // ← ここ重要 func Greet() string { // 最初は大文字 return "How are you?" }
とすると、
$ go run main.go
Hello World!
How are you?
と、ちゃんと、動くようになりました。
が、全然消せない。
私は、これまで、母の胃ろう器具交換のサポートの為に、4ヶ月ごとに、一人で帰省してきました。
I have been returning home alone every four months to support my mother in changing her gastroduodenal appliance.
そして、帰省の度に、コンビニで売られている「ゴルゴ13」などのマンガを1冊づつ購入していました。
And every time I returned home, I would buy one copy each of "Golgo 13" and other manga sold at convenience stores.
-----
先日、母の四十九日の法要の為に、家族全員で実家に帰省しました。
Recently, my entire family returned to my parents' home for my mother's 49th day memorial service.
そこで、長女が、私が購入したマンガを読んでいました。
There, my senior daughter was reading a comic book I had purchased.
長女は、
She was muttering,
「『ルールは常に征服者の都合で決まる』・・・か」
"'The rules are always determined by the convenience of the conqueror.'..."
と、呟いていました。
(*)ゴルゴ13 Vol.191 1万キロの狙撃
(*)Golgo 13 Vol.191 10,000 km Sniper
-----
社会人1年生の、長女の琴線に触れたようです。
It seems to have tugged at the heartstrings of her, a first-year working adult.