Skip to main content

Correlation between NASDAQ price, Corn and Gold(Corr=0.945)

 I wrote Python code which shows Correlation between NASDAQ price, Corn and Gold(Corr=0.945). Corn and Gold are best mix I have found. https://gist.github.com/Kouhei-Takagi/a1a9b073f6cd6dacb7eb1ea871d8fd3c I changed some important parts. https://gist.github.com/Kouhei-Takagi/5becaf7c3a24d63ac9c56856e81297f2

The PHP language

2020/6/14.  The PHP language


Recently, I am learning PHP language.
PHP language is server-side language, and it is useful for web watching.

I wrote below code for web-watching to take the Mensa Japan exam.
(I am already Mensa member.)(And I don’t know this code will work well.)
Below code notifies with LINE app, so if you want to use it, you have to get permission from LINE development.
And you need to set some settings on your smartphone.

This is only test code, and if you want to use this code, you need some knowledge about Information technology.
And if you can use Linux crontab, this code runs every time.

I know you don’t need to take Mensa Japan exam.
This is just sample for getting a ticket which is difficult to get online.

First, I tried to use e-mail, but the e-mail’s security setting is too difficult.
So, I changed to use LINE app.
I took few weeks for writing below code, programming is so hard… Of course it is fun.

I started learning programming 2.5 years ago…
It was long time, but I got reached very far place from it…

(Code) *** is your LINE token.

<?php

$url = 'https://mensa.jp/exam/'; 
$filename = '/home/pi/Desktop/Mensa-exam-judge.txt'; 

$input = file_get_contents($url);
$prv = file_get_contents($filename);

$match1 = mb_strstr($input, '関東地方</h3>');
$match1 = str_replace(array(" ", " "), "", $match1);
$match1_1 = mb_strstr($match1, '</p>', true);
//var_dump($match1_1);

$match2 = mb_strstr($prv, '関東地方</h3> ');
$match2 = str_replace(array(" ", " "), "", $match2);
$match2_1 = mb_strstr($match2, '</p>', true);
//var_dump($match2_1);

if($match1_1 != $match2_1){

echo "NO";

define('LINE_API_URL'  ,'https://notify-api.line.me/api/notify');
define('LINE_API_TOKEN’,’***’);

function post_message($message){

    $data = http_build_query( [ 'message' => $message ], '', '&');

    $options = [
        'http'=> [
            'method'=>'POST',
            'header'=>'Authorization: Bearer ' . LINE_API_TOKEN . "\r\n"
                    . "Content-Type: application/x-www-form-urlencoded\r\n"
                    . 'Content-Length: ' . strlen($data)  . "\r\n" ,
            'content' => $data,
            ]
        ];

    $context = stream_context_create($options);
    $resultJson = file_get_contents(LINE_API_URL, false, $context);
    $resultArray = json_decode($resultJson, true);
    if($resultArray['status'] != 200)  {
        return false;
    }
    return true;
}
post_message("Mensa Exam!+ ${url}");

$fp = fopen($filename, 'w');
fwrite($fp, $input);
fclose($fp);


}else {
    
echo "YES";

}
?>

Popular posts from this blog

Cheaper work

2016/12/29. Cheaper works: Hard competition makes expensive work cheaper. In Japan, there are some people who thinks there are a lot of workers, and they are exchangeable easily. This thought can't stand on human populations decreasing society. And in this society, the flow that provides products cheaper and cheaper cannot keep. Now, Japanese society is standing on that thought, and Japanese system hardly stands. This is by the patience of Japanese. When the breaking point of Japanese system comes, the counter of patience will keeps long time. And I think that communism never comes in Japan. Because Karl Marx doesn't think about human populations decreasing...

None feedback

2016/12/29. None feedback from others in Japanese company Feedback is not always visible or sound , especially the fact of feedback is hidden by various suits. And in Japanese company, I often see the scene that ignorance to the people who did careless mistakes. Others don't say anything about the careless mistakes in front of the person, but in background, others speak ill of the person. This is none feedback. None feedback from others is very bad feedback, but in Japanese company, it is often. Why none feedback happens? In my experience, there are some reasons. When the person who made mistakes is upper than others, others want the person to fall out. When the person is equal level to others, others want the person not to promote. When the person is lower level, others want to make the person the targets for inner circle. I rethink that none feedback in company is bad signal for organization... None feedback happens when the company is bad statements!!!