Nov 19, 2017

How to iPhone X from 6S (6S から Xへの移行)

My new iPhone X arrived yesterday and I have moved from 6S to X. There were some problems. But I want to show you how to solve them .
(私の新しいiPhone Xが昨日届きました。私は6SからXに移行しました。いくつかの問題がありました。 しかし、私はあなたにそれらを解決する方法を示したいと思います。)

Step 1. Backup Chat log of LINE app to iCluod. Its size is small, 30 MB.
Step 2. Backup iPhone 6s by iTunes with the Encrypt option.
Step 3. Seal a protective film on iPhone X. This is very difficult to avoid a small slant angle and small air bubbles.
Step 4. Power off iPhones, move a micro USIM ard from 6s to X.
Step 5. First Power on X, I followed the guidance, but I couldn't restore the backup of 6s on iTunes. The reason was the difference of IOS version. 6s was the newest of 11.1.2, but X was old 11.1. 
Step 6. Activate X as a new device, then update IOS to the newest 11.1.2 by Settings App. Then Reset X with erasing all content. The next is Return to the activation.  I followed the guidance, and I could restore the backup of 6s on iTunes. It seemed many apps are automatically installed from the App store.
Step 7. I set devide name, mail accounts and my google account. I moved LINE account.
Step 8. Setup Apple pay.
Step 9. Check and test many apps and adress book and photos.
Step 10. Backup iPhone X by iTunes with the Encrypt option. But if PC/Mac has no space for the new backup, we should delete old backups by EDIT/PREFERENCE/DEVICE menu or empty trash files or delete photos.

It took 3 hours with all steps.






Nov 7, 2017

バフェット爺さんのようにまず一億円稼ごう

How to make your first million the Warren Buffett way という記事がありました。
要約を紹介します。


  1. 早期に投資家精神を
  2. 複利で増やせ
  3. 不要な借金をするな
  4. どうしても借りるなら少額を低利子で
  5. 質素に暮らせ
  6. 一生学び続ける
  7. 友達を選べ
  8. チャンスを逃すな





Nov 6, 2017

日本・アメリカ・中国

日本の歴史を振り返ると、次の法則が見えてくる。

「日本政府が単独で中国に進出しようとするとアメリカから干渉され、日本政府のトップは失脚する。」

1. 満洲事変、満州国建国、国際連盟を脱退から太平洋戦争を経てアメリカに敗戦
2. 日中国交正常化を果たした田中角栄首相がロッキード事件で失脚
3. 小沢一郎民主党幹事長が小沢訪中団を組織し中国を訪問するも陸山会事件で失脚

Oct 27, 2017

いろいろな核融合研究

いろいろいろな核融合研究を紹介したリンク
It's the 21st Century. Where's My Fusion Reactor? 2013

Proposal of a compact lightweight fusion reactor (小型軽量核融合炉の提案)

We propose a new fusion reactor which is not a conventional plasma compression system, but, small, lightweight, inexpensive.

(Japanese: 従来のプラズマ圧縮方式ではない、小型、軽量、安価な新しい核融合炉)


[Construction (構造)]

Prepare a positive electrode and a negative electrode inside a vacuum container.

(Japanese: 真空容器内部に正極と負極を用意する。)

The positive electrode is made of nickel and has a hydrogen occlusion performance. Also, the positive electrode protrudes from the vacuum container. However, the positive electrode is electrically insulated from the vacuum container. Platinum is thinly coated on the protruding surface. The platinum film is pressurized with hydrogen gas. Platinum acts as a catalyst, separates hydrogen gas into hydrogen atoms, hydrogen atoms separate into protons and electrons and they penetrate into nickel. The number of hydrogen atoms, that is, the number of moles of protons is about 10% with respect to the number of moles of nickel.

(Japanese: 正極はニッケルでできており水素吸蔵性能を持たせる。また、正極は真空容器からはみ出している。ただし、正極は真空容器と電気的に絶縁されている。はみ出し表面にはプラチナが薄くコーティングされている。このプラチナ膜に、水素ガスが加圧されている。プラチナは触媒として働き水素ガスを水素原子に分離し水素原子は陽子と電子に分離してニッケル内部に浸透していく。ニッケルのモル数に対して水素原子つまり陽子のモル数は10%程度とする。)

Before operation, the vacuum vessel is sufficiently swept by a vacuum pump. During operation, the gas that can be generated inside is hydrogen gas. As the internal hydrogen gas becomes an obstacle to nuclear fusion, the vacuum pump continues to sweep. The swept hydrogen gas is again pressurized to the positive electrode.

(Japanese: 運転前に真空容器は真空ポンプで充分に掃引される。運転中に、内部に発生しうるガスは水素ガスである。内部の水素ガスは、核融合の障害となるため、真空ポンプの掃引は続ける。掃引した水素ガスは、再び正極に加圧される。)

The negative electrode is made of lithium, it is insulated from the vacuum container and in the vacuum container. Since lithium has a low melting point, it is placed on a nonconductor ceramic jar that resists high heat.

(Japanese: 負極はリチウムでできており真空容器と絶縁されて真空容器内部にある。リチウムは融点が低いため、高熱に耐える不導体のセラミックの壺に乗せられている。)

A high voltage of 1.8 million volts is applied to the positive electrode and the negative electrode. High voltage can be easily generated by Cockcroft · Walton circuit. The high voltage may be a pulse of weak current. Earth is taken so that electrons are hardly emitted from the lithium of the negative electrode. From the positive electrode, protons are radiated, pushing through the vacuum, acquiring kinetic energy of 1.8 MeV, and colliding with lithium. A nuclear reaction of protons and lithium occurs. Hydrogen that failed to react dissolves in lithium. That is, not only lithium but also protons accumulate in the negative electrode. When this proton reacts with the hydrogen coming from the positive electrode, it becomes deuterium. In any case, a complicated nuclear reaction occurs at the negative electrode.

(Japanese: 正極と負極には、180万ボルトの高電圧をかける。高電圧はコッククロフト・ウォルトン回路で容易に発生できる。高電圧は微弱電流のパルスでよい。負極のリチウムから電子が放射され難いようにアースをとる。正極からは、陽子が放射され、真空中を突き進み、1.8 MeVの運動エネルギーを獲得し、リチウムと衝突する。陽子とリチウムの核反応が起きる。反応を起こせなかった水素はリチウムに溶け込む。つまり負極はリチウムだけでなく、陽子がたまっていく。この陽子が正極から来た水素と反応すれば重水素になる。いずれにしろ、負極では複雑な核反応が発生する。)

Some electrons may be radiated from the negative electrode and react with the positive electrode in a nuclear reaction.
(Japanese: 一部の電子が負極から放射され正極と核反応をする可能性がある。)

Inside the container, some protons and electrons recombine to form hydrogen atoms. Hydrogen atoms form hydrogen molecules. This hydrogen gas is swept by a vacuum pump.
(また容器内では、一部の陽子と電子が再結合して水素原子となる。水素原子は水素分子を形成する。この水素ガスは真空ポンプで掃引される。)

According to the nuclear reaction simulation program (with source code), the nuclear energy (COP) generated for the input high voltage power is 11 to 12 times. Using the generated nuclear energy as a heat source, electricity can be generated with efficiency of 30%. Independent continuous operation is possible if 1/3 of the generated power is re-applied to a high voltage of 1.8 million volts. The remaining two thirds of electricity can be supplied outside the equipment. Also, the remaining 70% of waste heat can be used for heating, steam engine, etc. That is, the present apparatus can be a compact, lightweight, inexpensive fusion reactor.
(Japanese: 核反応のシミュレーションプログラム(ソースコード公開)によれば、投入された高電圧の電力に対して発生する核エネルギー(COP)は、11倍から12倍である。発生する核エネルギーを熱源として30%の効率で発電ができる。発生した電力の1/3を180万ボルトの高電圧に再投入すれば、独立した連続運転ができる。余った2/3の電力は装置の外に供給できる。また、残りの70%の廃熱は、暖房や蒸気機関等に利用することができる。つまり、本装置は小型、軽量、安価な核融合炉になりうる。)

Whether this device succeeds or not depends on whether the positive electrode can stably emit protons.
(Japanese: この装置が成功するかどうかは、正極が安定的に陽子を放射できるかどうかにかかっている。)

Reference(参照)






Oct 20, 2017

How to use reCAPTCHA V2 in PHP

How to use reCAPTCHA V2 in PHP
(PHP プログラムでの reCAPTCHA V2 の利用法)

I got the mail from Google. It said "reCAPTCHA V1" will be turned off on March 31, 2018.
(Google から、reCAPTCHA V1 が 2018-03-31に終了するので V2へ移行して欲しいと連絡メールが届いた)

This is my implment of reCAPTCHA V2.
(以下は、reCAPTCHA V2の私の実装です)

xxxx.php // sample PHP code for  reCAPTCHA V2

//See https://developers.google.com/recaptcha/docs/verify
//See https://www.google.com/recaptcha/admin#site/999999999
//Key Settings : Label: www.mydomain.com, Domains: www.mydomain.com, Owners: myname@gmail.com
$publickey = "9AAAAAAAAAAAAAAA_AAAAAA"; // you got this from the signup page
$privatekey = "9BBBBBBBBBBBBBBBB-BBBBBBBBBBBBBB";

if(isset($_POST['g-recaptcha-response'])){
  $url = "https://www.google.com/recaptcha/api/siteverify";
  $data = array('secret' => $privatekey, 
     'response' => $_POST['g-recaptcha-response'], 
     'remoteip' => $_SERVER["REMOTE_ADDR"]);
  $content = http_build_query($data);
  $content_length = strlen($content);
  $options = array('http' => array(
    'method' => 'POST',
    'header' => "Content-Type: application/x-www-form-urlencoded\r\n"
."Content-Length: $content_length",
    'content' => $content));
  //Send https-post to the recaptcha server
  $response = file_get_contents($url, false, stream_context_create($options));
  $answers = json_decode($response);
  if($answers->{'success'}){
// OK recaptcha, 
        header("Location: http://www.mydomain.com/nextpage.php");
  }else{
        // ERROR recaptcha
$err_mess = T_ERROR_CAPTCHA_TEST
           ."(reCAPTCHA said: " . $answers->{'error-codes'} . ")";
        header("Location: http://www.mydomain.com/error.php?err_mess=".urlencode($err_mess);
  }
}
......
echo "<head>\n";
...........
echo "<script src='https://www.google.com/recaptcha/api.js'></script>\n";
echo "</head>\n";
echo "<body>\n";
...........
echo "<form method=\"POST\" action=\"xxxx.php\">\n";
echo "<div class=\"g-recaptcha\" data-sitekey=\"".$publickey."\"></div>\n";
echo "<input type=submit name=check_CAPTCHA_stage value=\"".T_SUBMIT."\">\n";
echo "</form>\n";
...........
echo "</body>\n";
............

Oct 13, 2017

PRIUSで実際に出ているエンジン出力

自分の車は、トヨタのプリウスです。
LDA付きレーダークルースコントロールが付いているため、
高速道路では、速度を 80 km/h に設定して、
左側走行車線をまったりと走行します。
自動ブレーキ付きの半自動運転ですので、
安全安心、快適で疲れ知らずです。

ハイブリッド車は、エンジンとモーターの両方で走行できますが、
モーターの入力電力は、エンジンでの発電、
または、ブレーキによる回生に由来しますので、
全体を平均すると、
ガソリンを燃やしたエンジンの動力エネルギーで走行しています。

80 km/h 定速走行では、燃費が 30 km/l 以上
(市原IC松本IC間往復実測値)になります。
このときの平均エンジン出力は、どれだけか概算してみます。

まず、ガソリンの熱量を上げておきます。

ガソリン発熱量 7,972 kcal/l
カロリーkwh 変換 1 kcal = 0.00116222 kwh
  7,972 * 0.00116222 = 9.26521784
ガソリン発熱量 9.265 kwh/l

prius 定速走行速度 80 km/h 燃費 30 km/l
  80 / 30 = 2.666
このときの一時間消費ガソリン 2.666 l/h
  2.666*9.265 = 24.700
このときの一時間ガソリン発熱量 24.7 kwh/h
エンジン熱効率 40% (トヨタのカタログ値)
(ガソリンの熱から機械動力への変換率で世界最高レベル)
  24.7*40/100 = 9.88
エンジン出力 9.88 kw
馬力 kw 換算 1 ps = 0.735499 kw
  9.88 / 0.735499 = 13.4330570129939
エンジン出力 13.4 ps

以上から、定速走行速度 80 km/h では、平均エンジン出力 13.4 ps と判ります。

もっと早く走行したいとして、世界の高速道路 120km/h で、机上計算してみます。

物理法則で風圧は風速の二乗に比例するので、
速度を1.5倍の120km/hとすれば燃費は
 30/(1.5*1.5) = 13.33 km/l
に悪化する可能性が高い、これを仮定して計算します。

  120 / 13.33 = 9.002
120km/hでの一時間消費ガソリン 9.002 l/h
  9.002*9.265 = 83.403
120km/hでの一時間ガソリン発熱量 83.4 kwh/h
エンジン効率 40%
  83.4*40/100 = 33.36
エンジン出力 33.36 kw

以上から、定速走行速度 120 km/h では、km/hエンジン出力 33.36 ps と求まります。

  33.36/13.4 = 2.489
  1.5*1.5 = 2.25
ですから、風圧は風速の二乗に比例するより少し多くの出力になります。

すなわち、35馬力のエンジンがないと、120km/hで巡航できないとわかります。
逆に言うと 35馬力で良いなら、500cc程度小型のエンジンでもよいのです。

実際のプリウスの最大エンジン出力は、98 ps です。
かなり余裕があるため、日本の道路での加速性能に不満はありません。
そして、150 km/h 以上で巡航できそうです。