Monthly archives: August, 2018

Connect to MQTT server with WILL via PHP

In MQTT, you use the Last Will and Testament (LWT) feature to notify other clients about an ungracefully disconnected client. Each client can specify its last will message when it connects to a broker. The last will message is a normal MQTT message with a topic, retained message flag, QoS, and payload. The broker stores …

Angular Invalid Pipe Argument error for pipe DatePipe in Safari browser

Angular Invalid Pipe Argument error for pipe DatePipe in Safari browser Error: InvalidPipeArgument: ‘2018-05-28 15:17:47’ for pipe ‘DatePipe’ Chrome Run perfectly, why: DatePipe In angular 2 DatePipe is used as follows. date_expression | date :’format’ A. date_expression: The values of date expression are the followings. 1. Date object 2. Date in milliseconds as Number 3. …

How to setup a Nginx proxy for API backend to avoid Angular cross region issue

How to setup a Nginx proxy for API backend to avoid Angular cross region issue server { listen 80; server_name frontend.domain; root /www/frontend.domain; location /backend/ { proxy_pass http://frontend.domain:8080/; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; add_header Cache-Control public; } }   note: http://frontend.domain:8080/ is the backend

How to pkill file name with space or with command parameter string

How to pkill file name with space or with command parameter string # more mqtt_subscribe.sh pkill -9 -f “php artisan extraction:analyze”; cd /www/backend.extraction/extraction/laravel; sudo -u www-data php artisan extraction:analyze 3 > ./storage/logs/mqtt_sub.log & tail -f ./storage/logs/mqtt_sub.log; accordingly to the pkill man page: -f The pattern is normally only matched against the process name. When -f …

resolve laravel/app/storage/logs/laravel.log failed to open stream: Permission denied

laravel/app/storage/logs/laravel.log failed to open stream: Permission denied chown -R www-data:www-data logs file_put_contents(/laravel/storage/framework/views/95ac0ca235d9950c39eaf4bafb09e7a067e99f10.php): failed to open stream: Permission denied chown -R www-data:www-data framework “message”: “Temporary files directory \”/laravel/./temp/\” is not writable”,    

Use Laravel \Carbon\Carbon::parse to convert date time

Goal: insert time format 2018-08-16T13:58:48.409 into timestamp column first try: \Carbon\Carbon::createFromTimestamp ErrorException : A non well formed numeric value encountered at /laravel/vendor/nesbot/carbon/src/Carbon/Carbon.php:808 804| * @return static 805| */ 806| public static function createFromTimestamp($timestamp, $tz = null) 807| { > 808| return static::today($tz)->setTimestamp($timestamp); 809| } change to   \Carbon\Carbon::createFromFormat(‘Y-m-d H:i:s’,$item[‘Saved’]), InvalidArgumentException : Unexpected data found. Trailing data Carbon\Carbon::createFromFormat(“Y-m-d H:i:s”, …

How to use ip address or hostname to visit Angular 4200 ng serve webserver

How to use ip address or hostname to visit Angular 4200 ng serve webserver $ ng serve –host 0.0.0.0 ** Angular Live Development Server is listening on 0.0.0.0:4200, open your browser on http://localhost:4200/ ** 95% emitting CopyPluginℹ 「wdm」: wait until bundle finished: / Date: 2018-08-22T03:50:12.762Z Hash: 53759709547cf1e65 Time: 31587ms chunk {main} main.js, main.js.map (main) 390 …