2023,江端さんの技術メモ

「Golangでcsvファイルを読み出す」の記事は多いのですが、特定の行まで引っ張り出す情報があまりないので、メモを残しておきます。

/*
以下のcsvファイル(kai_20220522holyday18.csv)の中身を取り出す
id,age,type,departure_name,departure_number,departure_lat,departure_lng,arrival_name,arrival_number,arrival_lat,arrival_lng
0,43,resident,,,34.173408,131.470684,,,34.155862,131.501246
1,24,resident,,,34.179449,131.482543,,,34.164116,131.471791
2,42,resident,,,34.168739,131.470768,,,34.160989,131.491124
3,21,resident,,,34.169494,131.469934,,,34.173498,131.471351
4,58,resident,,,34.185295,131.47414,,,34.191481,131.49456
5,48,resident,,,34.150778,131.480747,,,34.16536,131.471872
6,56,resident,,,34.16536,131.471872,,,34.174066,131.479312
7,73,resident,,,34.155731,131.500845,,,34.16776,131.472831
8,47,resident,,,34.167237,131.471785,,,34.155775,131.476531
9,21,resident,,,34.154931,131.50468,,,34.156678,131.49581
10,37,resident,,,34.16727,131.472899,,,34.171253,131.471177
11,40,resident,,,34.147241,131.474921,,,34.150675,131.486268
12,67,resident,,,34.173683,131.476347,,,34.173643,131.471027
13,28,resident,,,34.183079,131.484303,,,34.174245,131.474592
14,46,resident,,,34.146154,131.472711,,,34.159611,131.491548
15,25,resident,,,34.162497,131.489283,,,34.147212,131.475984
*/

package main

import (
	"encoding/csv"
	"fmt"
	"log"
	"os"
	"strconv"
)

func main() {
	file, err := os.Open("kai_20220522holyday18.csv") // 先ほど入手した郵便番号データをos.Openで開く
	if err != nil {
		log.Fatal(err)
	}
	defer file.Close()

	r := csv.NewReader(file)
	rows, err := r.ReadAll() // csvを一度に全て読み込む
	if err != nil {
		log.Fatal(err)
	}

	// 行ごとに
	for i, row := range rows {
		if i == 0 {
			continue // CSVのヘッダー行を無視
		}

		age := row[1]

		departure_lat, err := strconv.ParseFloat(row[5], 64)
		if err != nil {
			log.Fatal(err)
		}
		departure_lng, err := strconv.ParseFloat(row[6], 64)
		if err != nil {
			log.Fatal(err)
		}

		arrival_lat, err := strconv.ParseFloat(row[9], 64)
		if err != nil {
			log.Fatal(err)
		}

		arrival_lng, err := strconv.ParseFloat(row[10], 64)
		if err != nil {
			log.Fatal(err)
		}

		fmt.Println(age, departure_lat, departure_lng, arrival_lat, arrival_lng)

	}
}

 

出力結果

C:\Users\ebata\yamaguchi\src_try1\others> go run main5.go
43 34.173408 131.470684 34.155862 131.501246
24 34.179449 131.482543 34.164116 131.471791
42 34.168739 131.470768 34.160989 131.491124
21 34.169494 131.469934 34.173498 131.471351
58 34.185295 131.47414 34.191481 131.49456
56 34.16536 131.471872 34.174066 131.479312
73 34.155731 131.500845 34.16776 131.472831
47 34.167237 131.471785 34.155775 131.476531
21 34.154931 131.50468 34.156678 131.49581
37 34.16727 131.472899 34.171253 131.471177
40 34.147241 131.474921 34.150675 131.486268
67 34.173683 131.476347 34.173643 131.471027
28 34.183079 131.484303 34.174245 131.474592
46 34.146154 131.472711 34.159611 131.491548
25 34.162497 131.489283 34.147212 131.475984

 

2023,江端さんの忘備録

■自分の魅力や能力を、過去の実績で語っても無駄

- Talking about one's attractiveness and abilities in terms of past achievements is useless.

■自分の魅力や能力をを主張したいのであれば、まさに"今"の、"現在進行形"の自分の仕事や学業で見(魅)せなければならない

- If you want to assert your attractiveness and abilities, you must show them through your work and studies in the "present" and "ongoing" state.

―― と。

以前、私の娘に、自分の過去の経歴をメールで送ってきたおっさん(定年後)のことを思い出していました。

I was reminded of an old man (retired) who once emailed my daughter about his past career.

仕事やら海外赴任や自分の職歴やらの情報が書かれていて ―― この私ですら、その内容に"ドン引き"しました。

It contained information about my job, overseas assignments, his work history, etc. - even I was "taken aback" by the contents.

本件、娘から相談されたので、私が穏便な対応策(個人情報保護に関する事項)を娘にアドバイスして、事なきに至ったようですが。

Since my daughter consulted me on this matter, I advised her on how to deal with the matter (matters related to the protection of personal information) in a calm manner. After that it seemed to be resolved.

シニアの『"昔の武勇伝"ハラスメント』を叩き壊すのに、十分な、脅威(恐怖)だっただろうと思います。

-----

―― 自分のシニアを放置し続けると、どんどん自分を見苦しくすることになる

"If you continue to neglect "your old", you will make yourself look worse and worse"

ということを、私に実感させてくれた事件でした。

This was an matter who made me realize that.

しかし、『シニアになると、ジュニアの頃のパフォーマンス』が発揮できなくなるのは、本当です。

However, it is true that 'as you become a senior, you cannot perform as well as you did as a junior.

ですから、『過去の自分の栄光にすがりつきたい』『他の人に、過去の自分のスゴさを理解して貰いたい』というシニアの気持ちは、よく分かるのです。

Therefore, I understand the senior's desire to 'hang on to his past glory' and 'have others understand how great he was in the past.

-----

その点、私は、コラムなどで『過去の自分の栄光』を語れるフィールドがあって、かなり幸せだなぁ、と思っています。

In that respect, I am quite happy to have a field where I can talk about my 'past glory' in my columns and so on.

故に、今、私は、最大の感謝と忖度(そんたく)を込めて叫びます。

Therefore, I now want to exclaim with the utmost gratitude and condescension.

『EE Times Japan 編集部 万歳 !』

"Long live the editors of EE Times Japan!"

2023,江端さんの忘備録

昨日、留学生の一人から、「名前を日本語(カタカナとひらがな)で表記してくれ」、と頼まれました。

Yesterday, one of the international students asked me to write his name in Japanese (katakana and hiragana).

―― は?

"What?"

と思いましたよ。

I thought it.

外国人なら、自分の名前を外国語表記しても許されるだろう、と思っていました。

I thought that if I were a foreigner, I would be allowed to write my name in a foreign language.

それに、カタカナとひらがな表記の強要は、ちょっと外国の人に失礼ではないかな、と思うのですよ。

Besides, I think that forcing people to write in katakana and hiragana is a bit rude to people from other countries.

-----

ところが、日本の法律では、日本語表記が必須となっているのですよ ―― 例えば「特許法」。

However, Japanese law requires Japanese notation -- for example, "Patent Law".

例えば、特開昭55-043192の発明者は、

For example, the inventors of JP Shou 55-043192 was

『レ-ム・ゲゼルシヤフト・ミツト・ベシユレンクテル・ハフツング』さん

Mr. "Rehm Gesellschaft Mitut Beschurenkutter Haftung".

となっています。

この名前なら、なんとなく「ドイツ人」かな、と思えますし、ドイツ語は、日本語発音がしやすいのいいのですが ――

I think this name sounds somewhat "German," and German is easy to pronounce in Japanese, but--

中東、アフリカ、そして、東南アジア(日本を除く)の国々の人は、そもそも、ローマ字的に表記されていないので、文字から発音を推測することが、全くできないのです。

People in the Middle East, Africa, and Southeast Asia (excluding Japan) cannot guess the pronunciation from the letters because they are not written in the Roman alphabet.

-----

で、私は、文字を読んで日本語変換するのを諦めて、

And I gave up reading the letters and converting them to Japanese, and said

『ゆっくりと名前を発音してみてくれないかな?』

"Would you try to pronounce you name as slowly as you can ?"

といって、その音声を、そのまま、カタカナで書き下してみました。

I wrote down the sound in katakana as it is.

『あのさ、もし書類に記載する必要があるなら、私が、今、ここで書き込むよ?』

'You know what, if you need me to fill out the paperwork, I'll write it right here, right now'

と申し出たのですが、彼は「日本語の勉強にもなるから、自分でやる」と言いました。

I offered to do it, but he said he would do it himself because it would help him learn Japanese.

立派な心掛けだと思います。

I think it is an admirable mindset.

-----

その後、私が彼の日本での名付け親になったような気分になりました。

After that, I felt like I was his godparent in Japan.

2023,江端さんの忘備録

関東に来てから、私、ずっと蕎麦が好きです。

I have always loved soba since I came to Kanto area.

関東の蕎麦は、たいてい美味しいです。

Soba in the Kanto region is usually delicious.

駅に併設されている蕎麦屋(立食いソバ)も、ちゃんと美味しい。

―― 小田急の乗客の多くに愛され続けている「名代 箱根そば」について、熱く語れる女子高校生

The soba restaurant (even if it is a stand-up buckwheat noodle shop) attached to the station is also properly delicious.

-----

昨日、スーパー銭湯のレストランで食した「肉汁つけソバ」が美味しかったので、自分で作って、嫁さんに振る舞ってみました。

Yesterday, I enjoyed the "buckwheat noodles with gravy" that I had at a restaurant in a super public bathhouse, so I cooked it myself and served it to my wife.

参考にしたレシピはこちらです。

Here is the recipe I used as a reference.

『昨日に比べると味が薄い』と感じたので、つけ汁の素材を少しずつ増していきながら、味見をし続けました。

I kept tasting, gradually increasing the amount of ingredients in the dipping sauce, because I felt it was 'less flavorful than yesterday'.

その内、訳が分からなくなってきて、ある時点から味の修正ができなくなってしまいました。

Eventually, I lost the taste, and at some point I couldn't modify the taste.

料理にも「ポイント・オブ・ノーリターン」があります。

Cooking also has a "point of no return".

(脳死判定に使わている用語でしたが、最近は温暖化対策などでも使われているようです)

(The term used to be used for brain death determination, but recently it seems to be used for global warming countermeasures, etc.)

まあ、そこそこ美味しかったですし、嫁さんにも好評だったので、また作ってみようと思います。

Well, it was delicious there, and my wife loved it, so I will cook it again.

-----

今日の話は、次のコラムの前フリに使う予定のネタです。

Today's story is the one I plan to use as a preamble to my next column.

2023,江端さんの忘備録

人生を有意義に生きる方法として「やるべきことではなくて『やらないこと』を決める」という意見を、最近見かけます。

I have recently seen the opinion that one way to live a meaningful life is to decide "what not to do" instead of what to do.

また、「すでに完成しているものを、再度自力で作ること」を『車輪の再発明』という言い方をして、再三、エンジニア(特にソフトウェアエンジニア)に警告がされてきました。

Engineers (especially software engineers) have been warned again and again about "reinventing the wheel," a term that refers to "taking something that has already been completed and making it again on your own.

上記に対して、私の態度は昔から一貫しています。

My attitude toward the above has always been consistent.

―― ふうん

"hmm"

です。

-----

今日、講義で、紙とエンピツを使って、最短経路問題であるダイクストラ法と、修正ラベル法を解いていました。

Today, in lecture, we were solving Dijkstra and modified label methods as the shortest path problem, using paper and an empit.

久々に、その解法の美しさに感動していました。

After a long time, I was impressed by the beauty of the solution.

私は、ダイクストラ法も、ワーシャルフロイド法も、自力でコーディグしていたくらいです。

I had even coded both the Dijkstra and Warchal Floyd methods on my own.

ワーシャル-フロイド法 サンプルプログラム

ですが、このような経路問題アルゴリズムなど、ネットに山ほど落ちていますし、フリーのライブラリも充実しています。

However, there are plenty of such routing problem algorithms and others on the Internet, and there are also extensive free libraries.

GISをDIYで作ろう―PostGISを使い倒す

私のやっていることは、典型的な『車輪の再発明』です ―― だから、これは「無駄」なのでしょう。

What I am doing is typical 'reinventing the wheel' -- so I guess this is 'futile'.

-----

しかし、私は、それらのアルゴリズムを自力でコーディングしていたので、自由に改造ができました。

However, I had coded those algorithms on my own and was free to modify them.

その改造のおかげで、100万人都市の、飛び込み自殺による列車ダイヤの大混乱から収束までの経緯を5分間で計算するアルゴリズムを考案して、査読論文を一本通しました。

Thanks to that modification, I devised an algorithm to calculate how a city of one million people went from train schedule havoc caused by a suicide jump to convergence in five minutes, and got one peer-reviewed paper through.

また、私が、「やるべきことではなくて『やらないこと』を決める」てなことをしてしまったら、私がこれまで続けてきた日記やコラムは、その時点で、「即、終了」となってしまうでしょう。

Also, if I were to decide "what not to do" instead of what I should do, the diaries and columns I have been keeping would be "terminated immediately" at that point.

-----

まあ、私の人生は、無駄が多く、かつ、有意義でもないのでしょう ―― が、それならそれで、私は構いません。

Well, I guess my life is not very meaningful or meaningful -- but that's OK with me.

『本当に、意義のない、無駄な人生を生きてきたなぁ』と、つぶやきながら、私は死んでいくつもりです。

I will die muttering, 'I have truly lived a meaningless and futile life'.

2023,江端さんの技術メモ

公共交通指向型開発(TOD: Transit Oriented Development) - 公共交通機関に基盤を置き、自動車に依存しない社会を目指した都市開発。
「交通隣接型開発」(TAD:‘transit-adjacent development’) 公共交通拠点と隣接して、高密度、大規模開発を行うが、機能上に、互い協調的な開発モードが不足である。

未分類

ちょっと調べてみたところ、使えるみたいです
(いつ入手したのか忘れましたが、倉庫に入っていました)。

2023,江端さんの技術メモ

https://www.marble-lab.com/item_3412.html

を参考にさせていただき、自分用の手順書(マニュアル)を作成。

(Step 1) CSVファイルの作成
1行目に、各列の名前が入っていなければならない。
ファイルはこちら → test_user_list_14.csv

ファイルはこちら → test_user_list_14.csv

(Step 2) Google MAPの立ち上げ

(Step 3) Google MAPの立ち上げ

↓の赤丸をクリック

今は、こっちのインタフェースに、なっているようです。

(Step 4) 「マイプレイス」を選択

(Step 5) 「マイマップ」→「地図を作成」

(Step 6) 「インポート」を選択

(Step 7) ファイル(test_user_list_14.csv)をドラッグ

(Step 8) 緯度、経度を選択

(Step 9) マーカーのタイトルを選択

(Step 10) マーカーの色を変更する(→黒)

(Step 11) マーカーをクリックすると情報が表示される

以上

KeyWord: Google MAP、 マーカー、 アイコン、 csv, エクセル

2023,江端さんの忘備録

我が家の暖房器具は、基本的にはガスまたは石油ファンヒータです。

Our heating system is basically gas or oil fan heaters.

しかし、一台だけアナログの石油ストーブがあります。

However, there is one analog oil heater.

期間限定 個別送料無料】コロナ 石油ストーブ 木造6畳用 RX-2222YHD | 家電・電化製品 | ホームセンター通販【カインズ】

アナログ、とは、いわゆるコンセントのない、自立起動・運用ストーブであり ―― まあ、普通のストーブで、普段は全く使っていません。

Analog, is what is called an unplugged, self-starting and operating stove -- well, a normal stove, but we usually don't use it at all.

東日本大震災(2011年3月11日)の時、大規模なブラックアウト(停電)と、計画停電が発生しました。

During the Great East Japan Earthquake (March 11, 2011), there was a massive blackout and rolling blackouts.

加えて、現在の国内のエネルギー供給状況を考えると、近い未来に「数日~十数日間の停電」は発生するだろうと考えています。

In addition, given the current domestic energy supply situation, I believe that "several to a dozen days of power outages" will occur in the near future.

-----

で、先日、このストーブの実証実験を行ってみた結果、無事に、ストーブの起動と運用を確認したのですが

So, the other day, I conducted a combustion experiment on this stove, and I was able to confirm that the stove was up and operational, without incident, however,

―― 火力が弱すぎる

-- Too little firepower.

■ストーブの上に置いたヤカンの水が沸騰しない

- The water in the kettle on the stove does not boil.

■「対流熱」の効果が発生せず、リビングの温度が上っていかない

- The effect of "convective heat" does not occur and the living room temperature does not rise.

■ストーブに近寄って、直接手をかざして「放射熱」を得ることで精一杯

- What I do my best is to get "radiant heat" by approaching the stove and holding my hand directly over it.

という結果に、正直、呆然としています。

I am honestly stunned by the results.

-----

私が小学生の頃は、このようなストーブしかなく、大学の下宿でもこのタイプのストーブでした。

When I was in elementary school, this was the only type of stove available, and I used the same type of stove in my college boarding house.

そういえば、始めて石油ファンヒータを体験した時、あっと言う間に部屋の温度が上昇し、『魔法か!』と思ったことを思い出しました。

I remember the first time I experienced an oil fan heater, the room temperature rose so quickly that I thought, "Is it magic?"

逆に言えば、私達は、快適さの為に、あの頃と比較して、整数倍のエネルギー消費をしている、ということのようです。

Conversely, I seem to be consuming integer times more energy for comfort than we did back then.

しかし、その一方で、石油ファンヒータに内蔵されたセンサとコンピュータが無駄なエネルギー消費を留めている、とも言えるようで、正確な比較はできてないです。

On the other hand, however, it seems that the sensors and computers built into the oil fan heaters are holding back unnecessary energy consumption, and I have not been able to make an accurate comparison.

というのは、今回の燃焼実験では「アナログ石油ストーブの石油消費の速度が、石油ファンヒータよりも早かった」ように思えたからです。

This is because in this combustion experiment, "the rate of oil consumption of the analog oil heater seemed to be faster than that of the oil fan heater.

-----

ともあれ、我が家では、「停電に供えたアナログストーブの準備」は完了し、ホッとしています。

Anyway, I am relieved that the "preparation of analog stoves for power outages" was complete in our home.

『ブラックアウトになったら、ストーブの前に家族が固まって暖を取る』という目処はつきました。

I could get a good prospect of 'When the blackout hits, the family will gather in front of the stove to keep warm'

2023,江端さんの忘備録

現在、私は、PCにSAIをインストールして、マウスを使ってイラストを作っています。

I currently have SAI installed on my PC and use a mouse to create illustrations.

本格的にデジ絵をマスターしたい訳ではないのですが、iPadのibisPaintを使って、リモートワークのホワイトボード代わりに使えないかな、と思っています。

I don't want to master digital painting in earnest, but I am wondering if I can use ibisPaint on my iPad as a whiteboard for remote work.

で、今悩んでいるのは、Apple Penを買うか、廉価版を買うか、です。

So now I am wondering if I should buy the Apple Pen or the lower priced version.

- Apple Pen(第2世代)は、19000円以上

- Apple Pen (2nd generation) is over 19,000 yen

- KINGONEスタイラスペンは、3000円以下

- KINGONE stylus pen is less than 3000 yen

です。

『Apple Pen2本 + αで 、iPadが1台買える』と思うと、Apple Penの購入には、抵抗があります。

I am reluctant to buy an Apple Pen when I think that "two Apple Pens + α can buy one iPad".

調べているうちに、Apple Penのメリットは、筆圧検知らしい、ということが分かってきました。

In the course of my research, I have learned that the advantage of the Apple Pen seems to be pressure detection.

太い線と細い線を、筆圧で変化させられる、という点が、デジ絵を仕事または趣味にしている人には、非常に重要らしいのです。

The ability to change between thick and thin lines with brush pressure is said to be very important for people who are into digital painting as a job or a hobby.

これ、分かります。

I understand this.

現在、私も、SAIを使っていて、実際、線の太さを変えるのに、一度メニューに戻らなければならないのですが、これが、『結構うっとうしい』のです。

I am also currently using SAI and actually have to go back to the menu once to change the line thickness, which is "quite annoying".

-----

という訳で、今、悩んでいます。

So, I am now struggling.

これまで通り、PC + SAI + マウスで絵を作り続けてもいいのですが、

I can continue to create pictures with my PC + SAI + mouse as I have in the past, but

『次女が、iPad + ibisPaint + Apple Pen で、サクサクと、高品質の作品を量産しているのを見ていると、なんか対抗したくなる』

"When I see my second daughter creating high quality works with her iPad, ibisPaint, and Apple Pen, I feel like competing with her"

・・・ではなくて、

is not true.

「絵心ゼロ」の私が、自分のコラムのイラストであれば、自己責任で、自力でイラストを描ける時代になっているのです。

I, who have "zero artistic ability," can now illustrate my own columns on my own, at my own risk.

目の前に、パーソナルなお絵描きの環境があるなら、やれることなら、やるべきでしょう。

If I have a personal painting environment in front of me, I should do what I can.

-----

よし、Apple Penにしよう。

Okay, let's go with the Apple Pen.

ただし"第一世代"の"中古"を探そう(5500円くらいで、手に入りそうです)。

However, I should look for a "used" "first generation" (about 5500 yen).

いつでも、私は、土壇場で意気地がないのです。

At all times, I am a coward at the last minute.