laravelにpdfのモジュールを入れよう

[vagrant@localhost tea]$ php artisan -V
Laravel Framework 5.8.11
[vagrant@localhost tea]$ ls
app composer.lock package.json resources tests
artisan composer.phar phpunit.xml routes vendor
bootstrap config public server.php webpack.mix.js
composer.json database readme.md storage
[vagrant@localhost tea]$ php composer.phar require barryvdh/laravel-dompdf
Using version ^0.8.4 for barryvdh/laravel-dompdf
./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)
Package operations: 5 installs, 0 updates, 0 removals
– Installing sabberworm/php-css-parser (8.1.0): Downloading (100%)
proc_open(): fork failed – Cannot allocate memory
The archive may contain identical file names with different capitalization (which fails on case insensitive filesystems)
Unzip with unzip command failed, falling back to ZipArchive class

Installation failed, reverting ./composer.json to its original content.
The following exception is caused by a lack of memory or swap, or not having swap configured
Check https://getcomposer.org/doc/articles/troubleshooting.md#proc-open-fork-failed-errors for details

PHP Warning: proc_open(): fork failed – Cannot allocate memory in phar:///home/vagrant/local/app/laravel/tea/composer.phar/vendor/symfony/console/Application.php on line 952

Warning: proc_open(): fork failed – Cannot allocate memory in phar:///home/vagrant/local/app/laravel/tea/composer.phar/vendor/symfony/console/Application.php on line 952

[ErrorException]
proc_open(): fork failed – Cannot allocate memory

require [–dev] [–prefer-source] [–prefer-dist] [–no-progress] [–no-suggest] [–no-update] [–no-scripts] [–update-no-dev] [–update-with-dependencies] [–update-with-all-dependencies] [–ignore-platform-reqs] [–prefer-stable] [–prefer-lowest] [–sort-packages] [-o|–optimize-autoloader] [-a|–classmap-authoritative] [–apcu-autoloader] [–] []…

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

Adobe Acrobat Reader DCを入れよう

PDFのmeta情報・プロパティ情報は必要ですよね。
Adobe Acrobat Reader DCをインストールしたいと思います。

うむ。。

これでプロパティを開くと、誰が作っているかがすぐにわかってしまいますね。

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をミスすことをタイポエラーという。

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

Embed SWF content in HTML

Can embed SWF content in HTML content within an AIR application in the same way as embedding in a browser. To embed SWF content, use object tags or embed tags, or use both tags.

If you have transparency enabled in the NativeWindow object that displays HTML and SWF content, AIR does not display SWF content when the window mode (wmode) used to embed the content is set to the value window. To display SWF content in transparent window HTML pages, set the wmode paramenter to opaque or transparent. The default value of wmode is window, so if you do not specify a value, the content may not be displayed.

<object type="application/x-shockwave-flash" width="100%" height="100%">
	<param name="movie" value="test.swf"></param>
	<param name="wmode" value="opaque"></param>
</param>

Carp::Always, Devel::KYTProf, Devel::REPL, Carp::REPL

Carp::Always
– エラーやスタックトレースの可視化
– useするだけ
warnまたはdieが出た時に、スタックトレースを引数付きで表示

Devel::KYTProf
– SQLの可視化
– useするだけ

Devel::REPL
– プロンプトで構文や式の動作を確認
– re.plコマンド

Carp::REPL
– プログラムの途中でプロンプトを起動
– dieしたところで使うなら、 perl -MCarp::REPL script.plまたはuseするだけ
– rep関数を使って任意の場所で起動

うーん、これは困った。。ログ出力か。。

Perl debug

#!/usr/bin/perl --

use strict;
use warnings;

my $message = 'Hello';
my @nums = (1, 2, 3);
my %scores = (math => 80, english => 77);

my $twice = twice(5);

$DB::single = 1;

for my $num (@nums){
	if ($num == 2) { $DB::single = 1}
	print "$num\n";
}

sub twice {
	my $num = shift;

	return $num * 2;
}

[vagrant@localhost cgi-bin]$ perl -d app.cgi

Loading DB routines from perl5db.pl version 1.32
Editor support available.

Enter h or `h h’ for help, or `man perldebug’ for more help.

main::(app.cgi:6): my $message = ‘Hello’;
DB<1> q

-dオプションでデバッガの起動ということだが、うむ、イマイチよくわからん。
q でデバック終了。
n でシングルステップ

違う例で見てみる。

#!/usr/bin/perl —

use strict;
use warnings;

my $num = 3;
for(my $i=1;$i<=3;$i++){ print $num*$i."\n"; } [/perl]

[vagrant@localhost cgi-bin]$ perl app.cgi
3
6
9
[vagrant@localhost cgi-bin]$ perl -d app.cgi

Loading DB routines from perl5db.pl version 1.32
Editor support available.

Enter h or `h h’ for help, or `man perldebug’ for more help.

main::(app.cgi:6):      my $num = 3;
  DB<1> n
main::(app.cgi:9):      }
  DB<1> n
main::(app.cgi:7):      for(my $i=1;$i<=3;$i++){
  DB<1> n
main::(app.cgi:8):              print $num*$i.”\n”;
  DB<1> n
3
main::(app.cgi:8):              print $num*$i.”\n”;
  DB<1> n
6
main::(app.cgi:8):              print $num*$i.”\n”;
  DB<1> n
9
Debugged program terminated.  Use q to quit or R to restart,
  use o inhibit_exit to avoid stopping after program termination,
  h q, h R or h o to get additional info.
  DB<1> q

なるほど、1行ずつ見ていくのね。

.swf

.sft is an extension attached to a video file created by the animation creation software for the Web “Flash” sold by Macromedia.
In order to play .swf format files, playback software called “Flash Player” is required.

セッション作成とセッションインスタンス取得

session_start();
$_SESSION['key']="orange";
echo $_SESSION['key'];

うん、ここらへんは基本ですね。

セッション削除はunset

session_start();
$_SESSION['key']="orange";
echo $_SESSION['key'];

unset($_SESSION['key']);
echo $_SESSION['key'];

[Mon Apr 22 23:18:28 2019] PHP Notice: Undefined index: key in /home/vagrant/local/app/test/index.php on line 8

まあ、この辺の応用でしょうね。

session

A session is a sequence of action taken by accessing a Web site.
One session from accessing the website to leaving the site or closing the browser.

The web server has a unique ID for each session, even if it is a Web system that spans multiple pages by using this.
It is possible to save and keep information for each user.

The most typical way to use this session is a web page. The most commonly used function is login/logout.

Think of one session from logging in to logging out. In the meantime, save status such as user ID and password.