netstat -anl

[vagrant@localhost test]$ php -S 192.168.35.10:8000
[Fri Apr 5 08:52:04 2019] Failed to listen on 192.168.35.10:8000 (reason: Address already in use)

netstat -anl

[vagrant@localhost test]$ netstat -anl
Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address Foreign Address State
tcp 0 0 127.0.0.1:25 0.0.0.0:* LISTEN
tcp 0 0 192.168.35.10:8000 0.0.0.0:* LISTEN
tcp 0 0 0.0.0.0:111 0.0.0.0:* LISTEN
tcp 0 0 0.0.0.0:37780 0.0.0.0:* LISTEN
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN
tcp 0 64 192.168.35.10:22 192.168.35.1:54547 ESTABLISHED
tcp 0 0 192.168.35.10:22 192.168.35.1:54544 ESTABLISHED
tcp 0 3520 192.168.35.10:22 192.168.35.1:50521 ESTABLISHED
tcp 0 0 192.168.35.10:22 192.168.35.1:51478 ESTABLISHED
tcp 0 0 192.168.35.10:22 192.168.35.1:51485 ESTABLISHED
tcp 0 0 192.168.35.10:8000 192.168.35.1:54691 TIME_WAIT
tcp 0 0 192.168.35.10:8000 192.168.35.1:54692 TIME_WAIT
tcp 0 0 ::1:25 :::* LISTEN
tcp 0 0 :::443 :::* LISTEN
tcp 0 0 :::3306 :::* LISTEN
tcp 0 0 :::111 :::* LISTEN
tcp 0 0 :::8080 :::* LISTEN
tcp 0 0 :::80 :::* LISTEN
tcp 0 0 :::39668 :::* LISTEN
tcp 0 0 :::22 :::* LISTEN
udp 0 0 0.0.0.0:68 0.0.0.0:*
udp 0 0 0.0.0.0:42054 0.0.0.0:*
udp 0 0 127.0.0.1:967 0.0.0.0:*
udp 0 0 0.0.0.0:111 0.0.0.0:*
udp 0 0 0.0.0.0:944 0.0.0.0:*
udp 0 0 :::33848 :::*
udp 0 0 :::56935 :::*
udp 0 0 :::5353 :::*
udp 0 0 :::111 :::*
udp 0 0 :::944 :::*
Active UNIX domain sockets (servers and established)
Proto RefCnt Flags Type State I-Node Path
unix 13 [ ] DGRAM 8502 /dev/log
unix 2 [ ACC ] STREAM LISTENING 11210 public/cleanup
unix 2 [ ACC ] STREAM LISTENING 6744 @/com/ubuntu/upstart
unix 2 [ ACC ] STREAM LISTENING 11270 private/tlsmgr
unix 2 [ ACC ] STREAM LISTENING 11274 private/rewrite
unix 2 [ ACC ] STREAM LISTENING 11278 private/bounce
unix 2 [ ACC ] STREAM LISTENING 11282 private/defer
unix 2 [ ACC ] STREAM LISTENING 11286 private/trace
unix 2 [ ACC ] STREAM LISTENING 11290 private/verify
unix 2 [ ACC ] STREAM LISTENING 11294 public/flush
unix 2 [ ACC ] STREAM LISTENING 11298 private/proxymap
unix 2 [ ACC ] STREAM LISTENING 11302 private/proxywrite
unix 2 [ ACC ] STREAM LISTENING 11306 private/smtp
unix 2 [ ACC ] STREAM LISTENING 11310 private/relay
unix 2 [ ACC ] STREAM LISTENING 11314 public/showq
unix 2 [ ACC ] STREAM LISTENING 11318 private/error
unix 2 [ ACC ] STREAM LISTENING 11322 private/retry
unix 2 [ ACC ] STREAM LISTENING 11326 private/discard
unix 2 [ ACC ] STREAM LISTENING 11330 private/local
unix 2 [ ACC ] STREAM LISTENING 11334 private/virtual
unix 2 [ ACC ] STREAM LISTENING 11338 private/lmtp
unix 2 [ ACC ] STREAM LISTENING 11342 private/anvil
unix 2 [ ACC ] STREAM LISTENING 11346 private/scache
unix 2 [ ] DGRAM 7122 @/org/kernel/udev/udevd
unix 2 [ ACC ] STREAM LISTENING 9985 /var/lib/mysql/mysql.sock
unix 2 [ ACC ] STREAM LISTENING 8580 /var/run/rpcbind.sock
unix 3 [ ] STREAM CONNECTED 72333
unix 3 [ ] STREAM CONNECTED 72332
unix 2 [ ] DGRAM 72329
unix 3 [ ] STREAM CONNECTED 72251
unix 3 [ ] STREAM CONNECTED 72250
unix 2 [ ] DGRAM 72247
unix 2 [ ] DGRAM 71574
unix 3 [ ] STREAM CONNECTED 66767
unix 3 [ ] STREAM CONNECTED 66766
unix 2 [ ] DGRAM 66763
unix 3 [ ] STREAM CONNECTED 63845
unix 3 [ ] STREAM CONNECTED 63844
unix 2 [ ] DGRAM 63841
unix 3 [ ] STREAM CONNECTED 63730
unix 3 [ ] STREAM CONNECTED 63729
unix 2 [ ] DGRAM 63726
unix 2 [ ] DGRAM 40479
unix 2 [ ] STREAM CONNECTED 18047
unix 2 [ ] STREAM CONNECTED 16398
unix 2 [ ] DGRAM 12216
unix 2 [ ] DGRAM 11375
unix 3 [ ] STREAM CONNECTED 11349
unix 3 [ ] STREAM CONNECTED 11348
unix 3 [ ] STREAM CONNECTED 11345
unix 3 [ ] STREAM CONNECTED 11344
unix 3 [ ] STREAM CONNECTED 11341
unix 3 [ ] STREAM CONNECTED 11340
unix 3 [ ] STREAM CONNECTED 11337
unix 3 [ ] STREAM CONNECTED 11336
unix 3 [ ] STREAM CONNECTED 11333
unix 3 [ ] STREAM CONNECTED 11332
unix 3 [ ] STREAM CONNECTED 11329
unix 3 [ ] STREAM CONNECTED 11328
unix 3 [ ] STREAM CONNECTED 11325
unix 3 [ ] STREAM CONNECTED 11324
unix 3 [ ] STREAM CONNECTED 11321
unix 3 [ ] STREAM CONNECTED 11320
unix 3 [ ] STREAM CONNECTED 11317
unix 3 [ ] STREAM CONNECTED 11316
unix 3 [ ] STREAM CONNECTED 11313
unix 3 [ ] STREAM CONNECTED 11312
unix 3 [ ] STREAM CONNECTED 11309
unix 3 [ ] STREAM CONNECTED 11308
unix 3 [ ] STREAM CONNECTED 11305
unix 3 [ ] STREAM CONNECTED 11304
unix 3 [ ] STREAM CONNECTED 11301
unix 3 [ ] STREAM CONNECTED 11300
unix 3 [ ] STREAM CONNECTED 11297
unix 3 [ ] STREAM CONNECTED 11296
unix 3 [ ] STREAM CONNECTED 11293
unix 3 [ ] STREAM CONNECTED 11292
unix 3 [ ] STREAM CONNECTED 11289
unix 3 [ ] STREAM CONNECTED 11288
unix 3 [ ] STREAM CONNECTED 11285
unix 3 [ ] STREAM CONNECTED 11284
unix 3 [ ] STREAM CONNECTED 11281
unix 3 [ ] STREAM CONNECTED 11280
unix 3 [ ] STREAM CONNECTED 11277
unix 3 [ ] STREAM CONNECTED 11276
unix 3 [ ] STREAM CONNECTED 11273
unix 3 [ ] STREAM CONNECTED 11272
unix 3 [ ] STREAM CONNECTED 11269
unix 3 [ ] STREAM CONNECTED 11268
unix 3 [ ] STREAM CONNECTED 11266
unix 3 [ ] STREAM CONNECTED 11265
unix 3 [ ] STREAM CONNECTED 11209
unix 3 [ ] STREAM CONNECTED 11208
unix 3 [ ] STREAM CONNECTED 11206
unix 3 [ ] STREAM CONNECTED 11205
unix 2 [ ] DGRAM 11167
unix 2 [ ] DGRAM 8661
unix 3 [ ] STREAM CONNECTED 8461
unix 3 [ ] STREAM CONNECTED 8460
unix 3 [ ] DGRAM 7139
unix 3 [ ] DGRAM 7138

ん?listenになってる??ランダムでポートが使われているってこと??

「上記コマンドで該当のPIDをを見つけ、killすれば解決する?」
[vagrant@localhost test]$ lsof -i:192.168.35.10:8000
-bash: lsof: コマンドが見つかりません

なにいいいいいいいいいい

DB hash

With a hash table, the portion of the bucket stays on disk, halving the load on memory during the search.
Arrays need to use contiguous free space in memory. When reading a large table, it is very difficult to secure a sufficient continuous area. In the case of a hash table, you can choose the key you want to use.

indexのことか?しかし、ビューハッシュとはなんだ。。。

Hashing

Hashing is the generation of random numbers from certain data. The feature of this function is to output the same hashed value from any value, and it is impossible to derive the original data from the hashed value. The hash function is used for user authentication etc.

Know as a hash function, hash algorithms such as MD5 and SHA1 can now examine the output with brute force to get the original input.

$password = "password";
echo sha1($password) . "<br>";
echo md5($password) . "<br>";
echo hash('sha256', $password) . "<br>";

svgをcanvasで表示する

<!doctype html>
<html>
<head>
	<title>title</title>
</head>
<body>
	<canvas id="c" width="200" height="200"></canvas>
</body>
<script>
	var img = new Image();
	img.src = 'http://www.w3.org/Icons/SVG/svg-logo-v.svg';
	img.onload = function(){
		var c = document.getElementById('c');
		var ctx = c.getContext('2d');
		ctx.drawImage(img, 0, 0, 200, 200);
	}
</script>
</html>

これはsvgなんだが、HTMLタグで行きたいね。。

HTMLタグ→SVG画像作成→Canvasで画像化?
んーん、苦戦。。

foreignObject

SVG elements make it possible to include external XML namespaces with graphic content rendered by different user agents. External graphic content included is subject to SVG conversion and composition.

<svg width="400px" height="300px" viewBox="0 0 400 300" xmlns="http://www.w3.org/2000/svg">
	<desc>The svg tag can write code and draw an image. Compared with bitmap data such as JPEG and PNG, even if it is enlarged, it can be displayed in a beautiful state without blurring.</desc>
	<switch>
		<foreignObject width="100" height="50" requiredExtensions="http://www.w3.org/1999/xhtml">
		<body xmlns="http://www.w3.org/1999/xhtml">
			<p>Here is a paragraph that requires word wrap</p>
		</body>
	</foreignObject>

	<text font-size="10" font-family="Verdana">
		<tspan x="10" y="10">Here is a paragraph that</tspan>
		<tspan x="10" y="20">requires word wrap.</tspan>
	</text>
</switch>
</svg>

<svg width="960px" height="1280px" viewBox="0 0 960 1280" xmlns="http://www.w3.org/2000/svg">
	<style>
	h1 {
		color:red;
	}
	</style>
	<g>
		<foreignObject x="0" y="0" width="100%" height="100%" requiredExtensions="http://www.w3.org/1999/xhtml">
		<body xmlns="http://www.w3.org/1999/xhtml">
			<p>Hello, world!</p>
		</body>
	</foreignObject>
</g>
</svg>

ん? どういこと?

font faceでの書体一覧を検証する

参考サイト:http://www.jp-ia.com/_web/face.html
AR Pペン行楷書体L, AR Pペン楷書体L, AR P勘亭流H, AR P古印体B, AR P行楷書体H… Wingdings 2, Wingdings 3

大量にあるので、中心的な書体をピックアップしたいと思う

あれ、メイリオない?

-ゴシック体
-明朝体
-sanserif

さて、これをtinyMCEに実装したい
stack overflowに書いてありそう。。
https://stackoverflow.com/questions/15499198/how-to-add-a-new-font-in-tinymce-editor

あ、ここにサンプルがある
https://codepen.io/anon/pen/przvoq

tinymce.init({
  selector: 'textarea',
  height: 500,
  plugins: 'code',
  toolbar: 'undo redo | fontsizeselect fontselect',
  content_css: ['//fonts.googleapis.com/css?family=Indie+Flower'],
  font_formats: 'Arial Black=arial black,avant garde;Indie Flower=indie flower, cursive;Times New Roman=times new roman,times;'
});

そうですね、やりたいのはこういうことです。

font face=””でフォントを指定する

とりあえず、明朝、ゴシックで比較

<p>通常フォント</p>
<p><font face="MS P明朝">通常フォント</font></p>
<p><font face="MS Pゴシック">通常フォント</font></p>
<p><font face="Impact">font test</font></p>

全然違いますね~

しかし、これデザイナーの領域だな。。。

>重要なのは、可読性、視認性、判読性を意識しながらの「TPOに合わせたフォント選び」
なるほど、テイストによって分けるのは理解できる。。
まず、どんな文字があるのか知らないといけない。。

tinyMCEに絵文字を追加する

TinyMCEに絵文字を追加したい

公式ドキュメント:TinyMCE Emoticons plugin
https://www.tiny.cloud/docs/plugins/emoticons/
これ↓を追加すればよい??

tinymce.init({
  selector: "textarea",  // change this value according to your HTML
  plugins: "emoticons",
  toolbar: "emoticons"
});

早速行きます。

<!DOCTYPE html>
<html>
<head>
	<script
  src="https://code.jquery.com/jquery-3.3.1.slim.js"
  integrity="sha256-fNXJFIlca05BIO2Y5zh1xrShK3ME+/lYZ0j+ChxX2DA="
  crossorigin="anonymous"></script>
	<script src="tinymce/js/tinymce/tinymce.min.js"></script>
	<script>
  tinymce.init({
    mode : "specific_textareas",
    editor_selector : "mceEditor",
    plugins: "emoticons",
    toolbar: "emoticons",
    init_instance_callback: function (editor) {
      editor.on('change', function (e) {
          $('#preview_area').html(editor.getContent());
      });
    }
  });
</script>
	
</head>
<body>
	<h1>テキストを入力してください</h1>
    <textarea id="myTextArea" class="mceEditor">TinyMCE Editor</textarea>
    <div style="border:1px solid; width:200px; height:200px;" id="preview_area"></div>
</body>
</html>

すくな!?デフォルトだと16種類しかない!? うーむ、困ったぞー これ、tinyMCEのバージョンが最新なら、絵文字の種類も増えるとかある??

ああああああああああ、なるほど、emoticonsのimgフォルダに入っている画像を使ってるのね。
utf-8の絵文字、👿👹👺などをパレットで選べるようにしたいですねー

database backup

Database backup includes fullbackup, differential backup and incremental backup. This name is given in terms of “what data to back up”.

full backup
The easiest and the basis of all backups is a full backup. It literally backs up all the data held by the system at one point in time. Therefore, with this backup file, it is possible to recover all the data at that time.

This is a story, but if it is always possible to take a full backup during an active backup, the backup operation will be extreamly simple. Because, as mentioned above, data recovery will end easily if it is this.

Disadvantages of full backup
Cost1: It takes a long time to backup
The backup takes a long time to back up all the data in the system. Although some reductions can be made by excluding data that does not change, such as read-only files, it is necessary to include them in the backup target, since the core business data is usually change daily.

Cost: The load on resources is large
The fact that the data to be backed up is large means that a large number of read operations occur on the disk where the data is stored during the backup. Therefore, backup processing consumes a large amount of resources, including disk and server CPUs, and, if backup is performed via a network, network connections. Threfore, parallel execution of other processes during backup is not a pratical operation. A full backup consumes the most resources of the backup.

Cost: need to stop service
In general, shut down the software such as DBMS and stop the service before acquiring a full backup. This is because you must obtain backups while maintaining data integrity. However, there are not many systems that can stop service frequently.

Differential backup
Differential backup, as the name suggests, is a method of backup only the changes from the previous full backup.

Using differential backup increases the recovery procedure by one, but instead reduces the time required for backup because the data requried for daily backup is smaller. The impact on resources is also reduced accordingly.

Incremental backup
The thrd backup method is incremental backup. This is a smart version of the differential backup without any waste. Earlier, with differential backup files, there were many files that were unnecessary for recovery. That is because the information contained in these files is the same. If this redundancy is eliminated, the data to be backuped up will be less and the backup time will be shorter.

Perlで日付を表示

Time::Pieceを使う方法

#!/usr/bin/perl --
use Time::Piece;

my $t = localtime;
print $t->ymd;

上手くいかない。。

unixのdateコマンドを使用

#!/usr/bin/perl --

print qx(date "+%Y/%m/%d %H:%M:%S");

ちゃんと表示はされます。

2019/04/02 09:00:25

#!/usr/bin/perl --

my ($sec, $min, $hour, $mday, $mon, $year) = (localtime(time))[0..5];
print "Content-type:text/html\n\n";
printf("%d/%02d/%02d %02d:%02d:%02d\n", $year + 1900, $mon + 1, $mday, $hour, $min, $sec);

こちらも行けますねー