Async Task

“Task” is not about “asynchronous processing”.
“Task” is just a task and it is a structure that someone will process the task.
An asynchronous method is a Task (work procedure manual) created by combining Tasks.
Async void absolute use prohibited(except: UI event handler)

The concept of Task.Run is in a nutshell.
“We consider synchronous series of processing as one task”
If combining asynchronous tasks and combining them into one task is an asynchronous method, you may also want to include synchronous processing as one of the tasks. At that time, it is Task.Run that can be used.

Another use is to write an asynchronous lambda expression in Task.Run. This is just like calling the asynchronous method. The only difference from direct call is that “th asynchronous method is explicitly executed in another context.”

Get file size

Confirm how to get a filesize from php official document.
filesize

$filename = "test.swf";
echo $filename . ": " . filesize($filename) . ' bytes';

want to make the notation of numbers comma separated by 3 digits.

$filename = "test.swf";
echo $filename . ": " . number_format(filesize($filename)) . ' bytes';

Google Cloud Platform

Google Cloud Platform is a cloud computing platform operated by google. It operates on the same infrastructure as end-user services such as Google Search and Youtube. We support from simple websites to complex application development.

うん、これは使っていきたい。

config/app.php

'providers' => [

        /*
         * Laravel Framework Service Providers...
         */
        Illuminate\Auth\AuthServiceProvider::class,
        Illuminate\Broadcasting\BroadcastServiceProvider::class,
        Illuminate\Bus\BusServiceProvider::class,
        Illuminate\Cache\CacheServiceProvider::class,
        Illuminate\Foundation\Providers\ConsoleSupportServiceProvider::class,
        Illuminate\Cookie\CookieServiceProvider::class,
        Illuminate\Database\DatabaseServiceProvider::class,
        Illuminate\Encryption\EncryptionServiceProvider::class,
        Illuminate\Filesystem\FilesystemServiceProvider::class,
        Illuminate\Foundation\Providers\FoundationServiceProvider::class,
        Illuminate\Hashing\HashServiceProvider::class,
        Illuminate\Mail\MailServiceProvider::class,
        Illuminate\Notifications\NotificationServiceProvider::class,
        Illuminate\Pagination\PaginationServiceProvider::class,
        Illuminate\Pipeline\PipelineServiceProvider::class,
        Illuminate\Queue\QueueServiceProvider::class,
        Illuminate\Redis\RedisServiceProvider::class,
        Illuminate\Auth\Passwords\PasswordResetServiceProvider::class,
        Illuminate\Session\SessionServiceProvider::class,
        Illuminate\Translation\TranslationServiceProvider::class,
        Illuminate\Validation\ValidationServiceProvider::class,
        Illuminate\View\ViewServiceProvider::class,

        /*
         * Package Service Providers...
         */

        /*
         * Application Service Providers...
         */
        App\Providers\AppServiceProvider::class,
        App\Providers\AuthServiceProvider::class,
        // App\Providers\BroadcastServiceProvider::class,
        App\Providers\EventServiceProvider::class,
        App\Providers\RouteServiceProvider::class,
        Barryvdh\DomPDF\ServiceProvider::class,

    ],

aliases

'aliases' => [

        'App' => Illuminate\Support\Facades\App::class,
        'Artisan' => Illuminate\Support\Facades\Artisan::class,
        'Auth' => Illuminate\Support\Facades\Auth::class,
        'Blade' => Illuminate\Support\Facades\Blade::class,
        'Broadcast' => Illuminate\Support\Facades\Broadcast::class,
        'Bus' => Illuminate\Support\Facades\Bus::class,
        'Cache' => Illuminate\Support\Facades\Cache::class,
        'Config' => Illuminate\Support\Facades\Config::class,
        'Cookie' => Illuminate\Support\Facades\Cookie::class,
        'Crypt' => Illuminate\Support\Facades\Crypt::class,
        'DB' => Illuminate\Support\Facades\DB::class,
        'Eloquent' => Illuminate\Database\Eloquent\Model::class,
        'Event' => Illuminate\Support\Facades\Event::class,
        'File' => Illuminate\Support\Facades\File::class,
        'Gate' => Illuminate\Support\Facades\Gate::class,
        'Hash' => Illuminate\Support\Facades\Hash::class,
        'Lang' => Illuminate\Support\Facades\Lang::class,
        'Log' => Illuminate\Support\Facades\Log::class,
        'Mail' => Illuminate\Support\Facades\Mail::class,
        'Notification' => Illuminate\Support\Facades\Notification::class,
        'Password' => Illuminate\Support\Facades\Password::class,
        'Queue' => Illuminate\Support\Facades\Queue::class,
        'Redirect' => Illuminate\Support\Facades\Redirect::class,
        'Redis' => Illuminate\Support\Facades\Redis::class,
        'Request' => Illuminate\Support\Facades\Request::class,
        'Response' => Illuminate\Support\Facades\Response::class,
        'Route' => Illuminate\Support\Facades\Route::class,
        'Schema' => Illuminate\Support\Facades\Schema::class,
        'Session' => Illuminate\Support\Facades\Session::class,
        'Storage' => Illuminate\Support\Facades\Storage::class,
        'URL' => Illuminate\Support\Facades\URL::class,
        'Validator' => Illuminate\Support\Facades\Validator::class,
        'View' => Illuminate\Support\Facades\View::class,
        'PDF' => Barryvdh\DomPDF\Facade::class,

    ],

[vagrant@localhost tea]$ php artisan vendor:publish –provider=”Barryvdh\DomPDF\ServiceProvider”
Copied File [/vendor/barryvdh/laravel-dompdf/config/dompdf.php] To [/config/dompdf.php]
Publishing complete.

なんじゃこりゃーーーーーーーーーーーー??

proc_open(): fork failed – Cannot allocate memory

proc_open(): fork failed – Cannot allocate memory が出た時。

swapファイルを作ってやりましょう。
[vagrant@localhost tea]$ sudo /bin/dd if=/dev/zero of=/var/swap.1 bs=1M count=1024
1024+0 records in
1024+0 records out
1073741824 bytes (1.1 GB) copied, 7.91221 s, 136 MB/s
[vagrant@localhost tea]$ /sbin/mkswap /var/swap.1
/var/swap.1: 許可がありません
[vagrant@localhost tea]$ sudo /sbin/mkswap /var/swap.1
スワップ空間バージョン1を設定します、サイズ = 1048572 KiB
ラベルはありません, UUID=984427a6-99bf-434c-ad6b-ea90be7f2670
[vagrant@localhost tea]$ sudo /sbin/swapon /var/swap.1
[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): Loading from cache
– Installing phenx/php-svg-lib (v0.3.2): Downloading (100%)
– Installing phenx/php-font-lib (0.5.1): Downloading (100%)
– Installing dompdf/dompdf (v0.8.3): Downloading (100%)
– Installing barryvdh/laravel-dompdf (v0.8.4): Downloading (100%)
dompdf/dompdf suggests installing ext-imagick (Improves image processing performance)
dompdf/dompdf suggests installing ext-gmagick (Improves image processing performance)
Writing lock file
Generating optimized autoload files
> Illuminate\Foundation\ComposerScripts::postAutoloadDump
> @php artisan package:discover –ansi
Discovered Package: barryvdh/laravel-dompdf
Discovered Package: beyondcode/laravel-dump-server
Discovered Package: fideloper/proxy
Discovered Package: laravel/tinker
Discovered Package: nesbot/carbon
Discovered Package: nunomaduro/collision

うむー なんだかなー

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関数を使って任意の場所で起動

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