Artisan tinker Error: In Configuration.php line 363: mkdir(): Permission denied

I got following error while running artisan tinker thru Google Compute VM console:

project@projectserver1:/var/www/html/Project_October$ php ./artisan tinker

In Configuration.php line 363:
 
mkdir(): Permission denied

And here is why and how to fix it:

This error occurs because you switch user (guessing using su) without “dash” option.

Replace su www-data with su - www-data and everything should works!

psysh tries to write runtime data in “original user” folder, instead of in “current user” folder…

PS my “current user” has XDG_RUNTIME_DIR env defined. Switching user without -, forced www-data to use the same env variable, while www-data hasn’t write permission in that folder.

Source: https://www.bountysource.com/issues/52403365-error-mkdir-permission-denied

 

 

Advertisements

Error while Installing Watchman: fatal error: Python.h: No such file or directory

Got following errors while installing Watchman, here is the error:

building 'pywatchman.bser' extension
creating build
creating build/temp.linux-x86_64-2.7
creating build/temp.linux-x86_64-2.7/pywatchman
x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fno-strict-aliasing -Wdate-time -D_FORTIFY_SOURCE=2 -g -fdebug-prefix-map=/build/python2.7-nbjU53/python2.7-2.7.15~rc1=. -fstack-protector-strong -Wformat -Werror=format-security -fPIC -I/usr/include/python2.7 -c pywatchman/bser.c -o build/temp.linux-x86_64-2.7/pywatchman/bser.o
pywatchman/bser.c:31:10: fatal error: Python.h: No such file or directory
 #include <Python.h>
 ^~~~~~~~~~
compilation terminated.
error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
Makefile:5060: recipe for target 'py-build' failed
make[1]: *** [py-build] Error 1
make[1]: Leaving directory '/home/yusuf/htdocs/watchman'
Makefile:1101: recipe for target 'all' failed
make: *** [all] Error 2

 

and here is how to fix it:

For apt (Ubuntu, Debian…):

sudo apt-get install python-dev   # for python2.x installs
sudo apt-get install python3-dev  # for python3.x installs

For yum (CentOS, RHEL…):

sudo yum install python-devel   # for python2.x installs
sudo yum install python34-devel   # for python3.4 installs

For dnf (Fedora…):

sudo dnf install python2-devel  # for python2.x installs
sudo dnf install python3-devel  # for python3.x installs

For zypper (openSUSE…):

sudo zypper in python-devel   # for python2.x installs
sudo zypper in python3-devel  # for python3.x installs

 

Source: https://stackoverflow.com/questions/21530577/fatal-error-python-h-no-such-file-or-directory

 

Repeat this following action

$ ./configure
$ make
$ sudo make install

 

Resolve Docker Container Cannot Connect To the Internet

╭─yusuf@yusuf-berkarya ~/htdocs/lms ‹feature/XXX-1234› 
╰─➤ docker exec -it lms_harukaedu_lms_1 bash 

root@fc9f04a74bbd:/var/www# ping www.google.com
ping: unknown host
root@fc9f04a74bbd:/var/www# exit

Just realized that my container doesn’t connect so some errors occurred in my dev env, and here is how to fix it:

Check Provider DNS

╭─yusuf@yusuf-berkarya ~/htdocs/lms ‹feature/LMS-3735› 
╰─➤ nmcli dev show | grep 'IP4.DNS'
IP4.DNS[1]: 203.142.82.222
IP4.DNS[2]: 8.8.8.8
IP4.DNS[3]: 203.142.84.222
IP4.DNS[4]: 182.253.236.236

 

Add the DNS to /etc/docker/daemon.json

{
 "dns": ["203.142.82.222", "8.8.8.8", "203.142.84.222", "182.253.236.236", "8.8.8.8", "8.8.4.4", "203.142.82.224", "182.253.236.236", "1.0.0.1", "1.1.1.1", "202.155.0.10", "202.155.0.15", "202.155.0.20", "202.155.0.25", "202.155.30.227", "10.0.18.38", "10.0.18.42"]
}

 

Restart Docker

╭─yusuf@yusuf-berkarya ~/htdocs/lms ‹feature/LMS-3735› 
╰─➤ sudo service docker start

 

It’s working Now

╭─yusuf@yusuf-berkarya ~/htdocs/lms ‹feature/LMS-3735› 
╰─➤ docker exec -it lms_harukaedu_lms_1 bash
root@fc9f04a74bbd:/var/www# ping www.google.com
PING www.google.com (172.217.27.228): 56 data bytes
64 bytes from 172.217.27.228: icmp_seq=0 ttl=51 time=26.188 ms
64 bytes from 172.217.27.228: icmp_seq=1 ttl=51 time=25.769 ms
64 bytes from 172.217.27.228: icmp_seq=2 ttl=51 time=127.347 ms
64 bytes from 172.217.27.228: icmp_seq=3 ttl=51 time=69.424 ms
^C--- www.google.com ping statistics ---
5 packets transmitted, 4 packets received, 20% packet loss
round-trip min/avg/max/stddev = 25.769/62.182/127.347/41.594 ms
root@fc9f04a74bbd:/var/www#

Menukar Uang ke Pecahan Kecil Recehan di Jalan Dago Ir. H. Juanda Bandung

Hari ini saya mencoba melakukan penukaran uang dari pecahan 100rban ke pecahan yang lebih kecil, berikut pengalaman yang saya dapatan saat saya mencoba menukar uang tsb di bank-bank yang terdapat di  Jalan Dago Ir. H. Juanda Bandung.

CIMB NIAGA

Jalan Ir. Haji Juanda No. 165, Lebak Siliwangi, Lb. Siliwangi, Coblong, Kota Bandung, Jawa Barat 40132

Tidak ada batasan jam maksimal (dalam jam dan hari kerja) untuk melakukan penukaran uang, hanya saja nilai penukaran dibatasi misal pecahan 2000 max 200rb dan 10.000 max 1jt.

Bank BCA

Jl. Ir. H.Djuanda No.118, Lebakgede, Coblong, Kota Bandung, Jawa Barat 40132

Batasan jam maksimal (dalam jam dan hari kerja) untuk melakukan penukaran uang adalah jam 12 siang.

Bank HSBC

Jl. Ir. H. Djuanda No. 74, Bandung, 40132, 1500 700 (Premier) 1500 808 (Advance)

Batasan jam maksimal (dalam jam dan hari kerja) untuk melakukan penukaran uang adalah jam 12 siang.

Bank Danamon

Jl. Ir. H.Djuanda No.64, Tamansari, Bandung Wetan, Kota Bandung, Jawa Barat 40115

Tidak ada batasan jam maksimal (dalam jam dan hari kerja) untuk melakukan penukaran uang, hanya saja sering tidak punya stok uang lembaran baru.

 

 

Penukaran Uang Receh Lebaran di Bandung Jawa Barat 2018

Hi kawan-kawan semua puasa sebentar lagi berarti lebaran juga sebulan lagi donk… pastinya ponakan, anak, adik udah pada bersiap-siap buat nerima amplop lebaran jangan sampai kecewa karena kehabisan pecahan uang receh baru dari tempat penukaran uang.

Dalam menukarkan uang dengan pecahan uang kecil atau pecahan uang receh kita bisa saja menukarkan dipinggir jalan dengan membeli misal pecahan 5000 (LIma ribu rupiah) 10 lembar yang bernilai 50000 mungkin dengan seharga 55000, ya lebih mahal 5 ribuan dari nilai aslinya (atau berkisar segituan kurang lebih nilainya).

Nah bila anda berniat menukar uang (bukan membeli) makaanda bisa menukarkan uang anda di Bank dimana bank-bank sekarang mayoritas menerima penukaran uang dari pecahan besar ke pecahan kecil / recehan terutama menjelang lebaran Ied Fitri.

Pemerintah pun sudah menyiapkan diri untuk kebiasaan tahunan ini, misalBI Yogyakarta:

“Bank Indonesia siap melayani penukaran uang kartal untuk transaksi bagi masyarakat, kami akan suplai terus uangnya, total kebutuhan sekitar Rp 5,5 triliun untuk satu bulan puasa dan lebaran ini,” – Kepala BI Yogyakarta

Nah mau tau Lebaran Idul Fitri sekarang kalo mau nukarin uang ke pecahan kecil dimana aja ? nah ikuti dan baca aja artikel pendek tentang menukarkan uang pecahan pesar ke pecahan kecil / recehan di area Bandung Jawa-Barat dan sekitarnya (Info ini juga bisa berlaku untuk daerah lain, karena banyak instansi keuangan menerapkan kebijakan yang berlaku secara nasiona, Misalnya penukaran uang pecahan kecil atau receh di Daerah Surabaya, Solo, Jogjakarta, Malang dan Jakarta biasanya bisa di lakukan di instansi keangan yang sama selama ada cabangnya di daerah tersebut).

Nah beriku tempat-tempat dimana kamu bisa menukarkan uang kamu dengan pecahan kecil  mulai dari Rp20 ribu sampai Rp2.000.:

Penukaran uang rupiah resmi dari BI

Layanan itu melalui kas keliling lembaga perbankan cabang daerah setempat.

Bank Swasta dan Pemerintah

Berikut ini 9 Bank lokasi penukaran uang pecahan kecil di Bandung:

  1. Bank Jabar Banten, Jalan Braga Nomor 12
  2. Bank Mandiri, Jalan Braga Nomor 133, Jalan Surapati Nomor 2, Jalan Asia Afrika Nomor 51
  3. Bank BCA, Jalan Asia Afrika Nomor 122, Jalan Ir. H. Djuanda Nomor 166, dan Soekarno-Hatta Nomor 240
  4. Bank OCBC-NISP, Jalan Cibeunying Selatan Nomor 31
  5. Bank Panin, Jalan Banceuy Nomor 8, Jalan Asia Afrika Nomor 166, Jalan Ottoiskandardinata Nomor 233
  6. CIMB-Niaga, Jalan Gatot Subroto Nomor 2, Jalan Lembong Nomor 7, Jalan Peta Nomor 65
  7. BTPN, Jalan Otto Iskandardinata Nomor 392
  8. UOB Buana, Jalan Jenderal Sudirman Nomor 55 A
  9. BNI ’46, Jalan Asia Afrika Nomor 119, Jalan Perintis Kemerdekaan Nomor 3, Jalan Raya Laswi-Majalaya.

 

Fakta Penukaran uang receh yang harus kalian ketahui:

  1. Bank yang saya tulis di atas adalah bank-bank yang beroperasi secara nasional maka sebenarnya mereka bukan hanya menerima penukaran uang receh untuk wilayah bandung saja tapi di Seluruh Indonesia (setidaknya di Kota-kota besar).
  2. Faktanya hampir Semua Bank bahkan Bank-Bank kecil menerima penukaran uang di saat lebaran, saya pernah coba berjalan di sepanjang Jl. Dago / JL. Ir.H. Juanda 17Bandung semua bank (HSBC, CIMB, Danamon,) menyediakan penukaran uang kecil (Ya semua,  bahkan Bank Chinatrust yang beralamat di JL. Ir.H. Juanda 17).
  3. Jangan menukar uang terlalu mepet ke Lebaran anda akan kehabisan stock uang baru, kalaupun ada anda akan kebagian uang yang udah lecek.
  4. Bila ragu anda bisa menanyakan ke satpam terlebih dahulu sebelum masuk dan mengantri kedalam bank supaya anda menghemat waktu.

 

Jadi kesimpulannya:

“Mau nukar duit buat amplop lebaran? jangan pusing-pusing ya sudah ke Bank aja… bank mana aja maksudnya (asal resmi)…. hahahahaha “

Istilah-istilah dalam olahraga Grapling dan MMA modern

 

Leverage

Simple definition of leverage – Leverage simply put is doing more with less. In terms of grappling it is gaining more control without applying a ton of force. sumber

 

Positions

Selection_002.png

Dominant Position

In a jiu-jitsu match each fighter is constantly trying to achieve positional dominance. Being in a dominant position is desirable because is almost always means that gravity and/or leverage is on your side.You are also safer when you are in a dominant position because it will be difficult for your opponent to strike you or apply leverage against you. sumber

Top Position

Bottom Position

Guard Position

  • Close Guard
  • Half Guard
  • Open Guard
  • Pulling Guard

Side Control Position

side-control

Mount Position

Selection_007.png
Mount Position 1
Selection_008.png
Mount Position 2
Selection_009.png
Mount Position 3

Back Position

Selection_010.png
Back Position 1
Selection_011.png
Back Position 2

Opponent Control

Chest on Chest

Selection_003.png

Kesa Gatame

Selection_004.png

Reversed Kesa Gatame

Selection_005.png

North and South

Selection_006.png

Finishing The Fight

Selection_012.png

Selection_013.png

Submission Hold / Kuncian

Choke / CekikanSelection_014.png

Air Choke

Selection_015.png

Blood Choke

Selection_016.png

Joint Lock

Selection_017.png

Selection_018.png
Dislokasi Engsel
Selection_019.png
Wrist lock 1
Selection_020.png
Wrist lock 2
Selection_021.png
Wrist lock 3
Selection_022.png
Elbow joint lock 1
Selection_023.png
Shoulder joint lock 1
Selection_024.png
Neck Join lock
Selection_025.png
Hip Joint Lock using Banana split
Selection_026.png
Knee Joint Lock with knee bar
Selection_027.png
Angke Joint Lock

Bagan Keseluruhan teknikSelection_028.png

Strike

 

Find out current requested Controller and Method Name on the Laravel

In years of development of project, it could be contains tons of features that consisted from hundred of controllers and thousand methods, it’s usually take time to specify where is current Controller name and Method name that is being requested by the browser  at the time,  here is the tip about how find it out:

dd(\Route::currentRouteAction());

put that line code somewhere in your base controller or middleware.

For 5.6

dd(class_basename(Route::current()->controller));

 

Laravel Migration Basic

In this post I gonna show a little bit about Laravel database migration

Install Laravel

╭─yoesoff@yoesoff-ThinkPad-X220 ~/Development 
╰─➤ laravel new DBMigration 
Crafting application...
Loading composer repositories with package information
Installing dependencies (including require-dev) from lock file

Installed Laravel

╭─yoesoff@yoesoff-ThinkPad-X220 ~/Development/DBMigration 
╰─➤ php ./artisan 
Laravel Framework 5.6.15

Usage:
 command [options] [arguments]

Create an Setup SQLite Database

╭─yoesoff@yoesoff-ThinkPad-X220 ~/Development/DBMigration 
╰─➤ touch ./storage/database.sqlite && ls storage 
app database.sqlite framework logs

╭─yoesoff@yoesoff-ThinkPad-X220 ~/Development/DBMigration 
╰─➤ cat .env

APP_DEBUG=true
APP_URL=http://dbmigration.test:8181/
APP_KEY=LCG9E1xG5FQDMNauR8wWW3GTyB6Tj6Nv

DB_CONNECTION=sqlite
DB_DATABASE=storage/database.sqlite

Migrate  Migration Files that come with Laravel Instalation

╭─yoesoff@yoesoff-ThinkPad-X220 ~/Development/DBMigration 
╰─➤ ls database/migrations 
2014_10_12_000000_create_users_table.php 2014_10_12_100000_create_password_resets_table.php

╭─yoesoff@yoesoff-ThinkPad-X220 ~/Development/DBMigration 
╰─➤ php ./artisan migrate
Migration table created successfully.
Migrating: 2014_10_12_000000_create_users_table
Migrated: 2014_10_12_000000_create_users_table
Migrating: 2014_10_12_100000_create_password_resets_table
Migrated: 2014_10_12_100000_create_password_resets_table

Migration Result

Selection_140.png

Migration Reset

╭─yoesoff@yoesoff-ThinkPad-X220 ~/Development/DBMigration 
╰─➤ php ./artisan migrate:reset 1 ↵
Rolling back: 2014_10_12_100000_create_password_resets_table
Rolled back: 2014_10_12_100000_create_password_resets_table
Rolling back: 2014_10_12_000000_create_users_table
Rolled back: 2014_10_12_000000_create_users_table

 

Compare Migrate and Reset Proses

╰─➤ php ./artisan migrate

2014_10_12_000000_create_users_table Migrated: 2014_10_12_000000_create_users_table Migrating: 2014_10_12_100000_create_password_resets_table Migrated: 2014_10_12_100000_create_password_resets_table

 

╰─➤ php ./artisan migrate:reset

Rolling back: 2014_10_12_100000_create_password_resets_table
Rolled back: 2014_10_12_100000_create_password_resets_table
Rolling back: 2014_10_12_000000_create_users_table
Rolled back: 2014_10_12_000000_create_users_table

Migrate execution order

  1. Create users table
  2. Create password_resets table

Migration reset execution order

  1. Drop password_resets table
  2. Create users table

Conlusion: Reset and Rollback process are being executed in reversed order to avoid error.

Adding new column

╭─yoesoff@yoesoff-ThinkPad-X220 ~/Development/DBMigration 
╰─➤ vim ./database/migrations/2018_04_08_111208_add_address_to_users.php 1 ↵

--- Auto-Commands ---
╭─yoesoff@yoesoff-ThinkPad-X220 ~/Development/DBMigration 
╰─➤ php ./artisan migrate 
Migrating: 2018_04_08_111208_add_address_to_users
Migrated: 2018_04_08_111208_add_address_to_users

 

Reset after Migrate

Selection_141.png

Rollback after Migrate (Reverse last migrate)

Selection_142.png

 

If you got following error while migration reset:

╭─yoesoff@yoesoff-ThinkPad-X220 ~/Development/DBMigration 
╰─➤ php ./artisan migrate:reset

Symfony\Component\Debug\Exception\FatalThrowableError : Class 'Doctrine\DBAL\Driver\PDOSqlite\Driver' not found

at /home/yoesoff/Development/DBMigration/vendor/laravel/framework/src/Illuminate/Database/SQLiteConnection.php:64
 60| * @return \Doctrine\DBAL\Driver\PDOSqlite\Driver
 61| */
 62| protected function getDoctrineDriver()
 63| {
 > 64| return new DoctrineDriver;
 65| }
 66| }
 67|

Exception trace:

1 Illuminate\Database\SQLiteConnection::getDoctrineDriver()
 /home/yoesoff/Development/DBMigration/vendor/laravel/framework/src/Illuminate/Database/Connection.php:884

2 Illuminate\Database\Connection::getDoctrineSchemaManager()
 /home/yoesoff/Development/DBMigration/vendor/laravel/framework/src/Illuminate/Database/Schema/Grammars/SQLiteGrammar.php:244

Please use the argument -v to see more details.

 

Here is the way  to fix it

╭─yoesoff@yoesoff-ThinkPad-X220 ~/Development/DBMigration 
╰─➤ composer require doctrine/dbal

Fix Error of Docker Compose up : port is already allocated

I got following errors after tried to run docker-compose up (later I realized that it was not an error but the service(s)/container(s) is already running )

╭─yoesoff@yoesoff-ThinkPad-X220 ~/Development/Obunda_October ‹feature/First-Setup*› 
╰─➤ docker-compose up
Starting obundaoctober_obunda_october_1 ... 
Starting obundaoctober_obunda_october_1 ... error

ERROR: for obundaoctober_obunda_october_1 Cannot start service obunda_october: driver failed programming external connectivity on endpoint obundaoctober_obunda_october_1 (53c195720a02841c1a5c3f5c123af4b634d1ccbd9b42195dac3e4704f92574e0): Bind for 0.0.0.0:8181 failed: port is already allocated

ERROR: for obunda_october Cannot start service obunda_october: driver failed programming external connectivity on endpoint obundaoctober_obunda_october_1 (53c195720a02841c1a5c3f5c123af4b634d1ccbd9b42195dac3e4704f92574e0): Bind for 0.0.0.0:8181 failed: port is already allocated
ERROR: Encountered errors while bringing up the project.

This error occurred   because the container(s) is already up/running (usually because of auto start after the host booted) and used/locked the port(s).

If it’s happened to you just check the service and make sure that the service is already running or not, if the service already up that it means you no need to run docker-compose up again, but if you still want to use docker-compose up  then you have to stop all running container(s) that locked your port  by using following command:

╭─yoesoff@yoesoff-ThinkPad-X220 ~/Development/Obunda_October ‹feature/First-Setup*› 
╰─➤ docker stop $(docker ps -a -q) 1 ↵
8ab72171abe9
4cfd47e550c8
0f18dad139dd
729c034697e4

 

And then try to execute docker-compose up again

╭─yoesoff@yoesoff-ThinkPad-X220 ~/Development/Obunda_October ‹feature/First-Setup*› 
╰─➤ docker-compose up 
Starting obundaoctober_obunda_october_1 ... 
Starting obundaoctober_obunda_october_1 ... done
Attaching to obundaoctober_obunda_october_1
obunda_october_1 | Do not run Composer as root/super user! See https://getcomposer.org/root for details
obunda_october_1 | Loading composer repositories with package information
obunda_october_1 | Installing dependencies (including require-dev) from lock file
obunda_october_1 | Nothing to install or update
obunda_october_1 | Generating autoload files
obunda_october_1 | Laravel development server started: <http://0.0.0.0:8181>

 

Then the service is running at http://0.0.0.0:8181 as usual.

 

Export and Import PostgreSQL database using PSQL

PostrgeSQL CheatSheets

Drop existing PostgresSQL Database

dropdb -h 0.0.0.0 -U postgres lmsums

Create PostgresSQL Database

createdb -h 0.0.0.0 -U postgres lmsums

Import PortgreSQL Database

psql -h 0.0.0.0 -U postgres lmsums < /home/yusuf/Downloads/20180322_1000.sql

Export PostgresSQL Database

pg_dump -h 0.0.0.0 -U postgres lmsums > /home/yusuf/Downloads/20180322_1000.sql

 

Selection_025.png
PSQL in action