ランダムな数値・文字列

echo '乱数1回目:'.rand().'¥n';
echo '乱数2回目:'.rand().'¥n';
echo '乱数3回目:'.rand().'¥n';

乱数1回目:897666718¥n乱数2回目:2106848809¥n乱数3回目:1545861839¥n

範囲指定した乱数

$min = 3;
$max = 10;

echo '乱数1回目:'.rand($min, $max).'¥n';
echo '乱数2回目:'.rand($min, $max).'¥n';
echo '乱数3回目:'.rand($min, $max).'¥n';

mt_rand関数はメルセンヌ・ツイスタと呼ばれる擬似乱数列生成器を使用しており高速に乱数を生成できる

echo mt_rand().'<br>';
echo mt_rand().'<br>';
echo mt_rand().'<br>';
$min = 0;
$max = 100;

echo mt_rand($min, $max).'<br>';
echo mt_rand($min, $max).'<br>';
echo mt_rand($min, $max).'<br>';

ランダムな文字列を生成する
ASCIIコードで指定された引数から文字を返すchr関数を併用して文字列を生成する

$rand_str = chr(mt_rand(65,90)).chr(mt_rand(65,90)).chr(mt_rand(65,90)).chr(mt_rand(65,90)).chr(mt_rand(65,90)).chr(mt_rand(65,90));

echo $rand_str;

配列の要素をランダムに取得

$fruits = ['apple'=>'100円', 'orange'=>'80円', 'melon'=>'300円', 'banana'=>'120円', 'pineapple'=>'350円'];

$rand_key = array_rand($fruits, 3);

print_r($rand_key);

ランダムな英数字の作成

$str = '1234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPUQRSTUVWXYZ';
$str_r = substr(str_shuffle($str), 0, 10);

echo $str_r;

uniqid関数を使用したランダム文字列

$str_r = uniqid(rand(), true);
echo $str_r;

md5関数は32文字の16進数からなるハッシュを取得する

$str_r = md5(uniqid(rand(), true));
echo $str_r;

build, compile

ソースコードインストール時は、build、コンパイルを経てインストールとなる。
こちらはお馴染みですね。

$ ./configure # 設定
$ make # build
$ sudo make install # インストール実行

C言語、C++をコンパイルするには、GNU Compiler Collection, GCCのインストールが必要
コンパイル → オブジェクトファイル → リンク → コマンド
↑コンパイルからリンクまでの一連の流れがビルド

ubuntuにgcc, makeが入っているか確認します。
vagrant@vagrant-ubuntu-trusty-64:~/bitcoin$ gcc –version
gcc (Ubuntu 4.8.4-2ubuntu1~14.04.4) 4.8.4
Copyright (C) 2013 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

vagrant@vagrant-ubuntu-trusty-64:~/bitcoin$ make –version
GNU Make 3.81
Copyright (C) 2006 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE.

This program built for x86_64-pc-linux-gnu

hello.c を作る

#include <stdio.h>
	main(){
		printf("hello world.\n");
	}

vagrant@vagrant-ubuntu-trusty-64:~/bitcoin$ ls
hello.c
vagrant@vagrant-ubuntu-trusty-64:~/bitcoin$ gcc hello.c
vagrant@vagrant-ubuntu-trusty-64:~/bitcoin$ ls
a.out hello.c
vagrant@vagrant-ubuntu-trusty-64:~/bitcoin$ ./a.out
hello world.

makefile

hello : hello.c
	gcc -o $@ $<

clean :
	rm -f hello

vagrant@vagrant-ubuntu-trusty-64:~/bitcoin$ ls
a.out hello.c Makefile
vagrant@vagrant-ubuntu-trusty-64:~/bitcoin$ make
gcc -o hello hello.c
vagrant@vagrant-ubuntu-trusty-64:~/bitcoin$ ls
a.out hello hello.c Makefile
vagrant@vagrant-ubuntu-trusty-64:~/bitcoin$ ./hello
hello world.

makeはカレントディレクトリにmakefileがあるとそれに従って動く

bitcoin coreのmaikefile
https://github.com/bitcoin/bitcoin/blob/master/Makefile.am

WINDOWS_PACKAGING = $(top_srcdir)/share/pixmaps/bitcoin.ico \
  $(top_srcdir)/share/pixmaps/nsis-header.bmp \
  $(top_srcdir)/share/pixmaps/nsis-wizard.bmp \
  $(top_srcdir)/doc/README_windows.txt

OSX_PACKAGING = $(OSX_DEPLOY_SCRIPT) $(OSX_FANCY_PLIST) $(OSX_INSTALLER_ICONS) \
  $(top_srcdir)/contrib/macdeploy/$(OSX_BACKGROUND_SVG) \
  $(OSX_DSSTORE_GEN) \
  $(top_srcdir)/contrib/macdeploy/detached-sig-apply.sh \
  $(top_srcdir)/contrib/macdeploy/detached-sig-create.sh

OSXとwindowsだとビルド方法やパッケージが異なるなるのかな。

センサー技術

震度センサー
圧力・気圧センサー
電流センサー
雨量・水位センサー
風量センサー
マイクロホン
人感センサー
開閉センサー
CCD/CMOSイメージセンサー
二酸化炭素センサー
GPS
電子コンパス
湿度・温度センサー
ジャイロセンサー
照度センサー

スーパーコンピュータ

Sequoia (supercomputer)
– IBMが開発
– 速度: 20.13 PFLOPS
– 目的:核兵器、天文学、エネルギー、ヒトゲノム、気候変動

神威・太湖之光(Sunway TaihuLight)
– 江蘇省無錫市の国立スーパーコンピューターセンターにあるスーパーコンピュータ
– 速度:93 PFLOPS ※理論性能:125.4359PFlops

Summit(OLCF-4)
– IBM, NVIDIA, Mellanox Technologies
– 処理速度:200 PFLOPS
– アーキテクチャ: ヘテロジニアス、4,608 ノード、9,216 CPU (POWER9)、27,648 GPU

ヤベーことになってるな。これ。
しかし、なんでこんなに差がついてるんだ。

Cloud term what does SaaS mean?

What is SaaS?

SaaS is an abbreviation of “Software as a Service”.

Refers to software provided in the cloud. Instead of installing the software on the user side, the vendor (provider) side runs the software, and the user leverages the functionality of the software via the network. Can think of what has been sold as packaged products up to now as available via the Internet.

Examples include email services such as Gmail, blog services, and services such as Salesforce. It is is useful in the sense that you can achieve the purpose immediately, but if you have low degrees of freedom and you want to use your own program, you need to use PaaS or IaaS as described.

Typography error

“Typography error”
It is abbreviated as “Typo”. The code doesn’t move because of a typo.

e.g.
get hello/index のところを get hello/indox などとtypingをミスすことをタイポエラーという。

タイポグラフティエラー対策??
うーん、正直よくわかりませんな。。

モダンな開発環境とは何か?

とにかく今のプロジェクトのクオリティを上げることが最優先、と考えていたが、思っていたより直ぐに「モダンな開発環境とは何か?」という問いに直面してしまった。

自分なりに整理してみる。
まず、技術トレンドに乗っている
これが大事では。レガシーなシステムは切り離して、トレンドを忠実に追うこと。そのためには、まずそういう環境に身を置くことが大事。ちゃんと技術トレンドに沿っているエンジニアと一緒に仕事をしないといけない。
– 言語はpython
– クラウドはaws
– mac

積み重ねだと思うが、結構大事かも。

次に、、、
積極的に新しい技術を学んでいけ
やっぱりこれは大事なんじゃないか。。と思い始めた。

結果的にそれが価値に繋がるのでは。

最近思うのは、競争相手は中国やインドなどのエンジニアだということ。働き方改革など悠著な事を言っている場合ではありませんね。