-
Disable sleep pada Debian
Untuk disable dapat menggunakan command berikut:
sudo systemctl mask sleep.target suspend.target hibernate.target hybrid-sleep.target
Untuk enable dapat menggunakan command berikut:
sudo systemctl unmask sleep.target suspend.target hibernate.target hybrid-sleep.target
-
Install PHP 7.4 pada Debian 10
Langkah pertama, update sistem.
sudo apt update sudo apt upgrade -y && sudo reboot
Langkah kedua, tambahkan SURY PHP PPA ke repository.
Download PPA repository
sudo apt -y install lsb-release apt-transport-https ca-certificates sudo wget -O /etc/apt/trusted.gpg.d/php.gpg https://packages.sury.org/php/apt.gpg
Tambahkan ke repository
echo "deb https://packages.sury.org/php/ $(lsb_release -sc) main" | sudo tee /etc/apt/sources.list.d/php.list
Langkah ketiga, install PHP 7.4 untuk Debian 10
Sebelum proses instalasi, ada baiknya update repository terlebih dahulu.
sudo apt update
Kemudian install PHP 7.4
sudo apt install php7.4
sudo apt install php7.4-{bcmath,bz2,intl,gd,mbstring,mysql,zip}
Langkah keempat, install apache2
sudo apt install apache2
Langkah terakhir, Buat file info.php untuk melihat hasil instalasi php.
nano /var/www/html/info.php
Kemudian tambahkan kode berikut.
<?php phpinfo(); ?>
Buka browser, kemudian arahkan ke http://localhost/info.php.
-
Konfigurasi Apache dan PHP pada macOS
MacOS sangan pupuler dikalangan pengembang, baik itu untuk membuat program mobile phone (android, iOS), desktop, maupun program untuk server. Baik itu pemograman dengan bahasa C, C++, C#, java, Java Script, php, maupun bahasa pemrograman lainnya. Pada postingan kali ini, akan dibahas mengenai konfigurasi apache2 dengan beberapa versi php yang dapat konfigurabel pada operating sistem macOS. Versi macOS yang digunakan adalah versi Big Sur.
XCode Command Line Tools
Jika belum menginstall
XCode
, ada baiknya install terlebih dahulucommand line tools
yang nantinya diperlukan oleh homebrew.xcode-select --install
Homebrew Installation
Homebrew
adalah sistem manajemen paket perangkat lunak sumber terbuka dan gratis yang menyederhanakan penginstalan perangkat lunak pada sistem operasi macOS Apple dan Linux. Untuk menginstallapache
danphp
dapat melaluihomebrew
./bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
Jika sudah berhasil diinstal, untuk mengetahu versi
homebrew
dapat menggunakan command:brew --version
Untuk memeriksa status aplikasi yang sudah diinstal, dapat menggunakan command:
brew doctor
-
ARP Commands
Displays and modifies the IP-to-Physical address translation tables used by
address resolution protocol (ARP).ARP -s inet_addr eth_addr [if_addr]
ARP -d inet_addr [if_addr]
ARP -a [inet_addr] [-N if_addr] [-v]-a Displays current ARP entries by interrogating the current protocol data. If inet_addr is specified, the IP and Physical addresses for only the specified computer are displayed. If more than one network interface uses ARP, entries for each ARP table are displayed. -g Same as -a. -v Displays current ARP entries in verbose mode. All invalid entries and entries on the loop-back interface will be shown. inet_addr Specifies an internet address. -N if_addr Displays the ARP entries for the network interface specified by if_addr. -d Deletes the host specified by inet_addr. inet_addr may be wildcarded with * to delete all hosts. -s Adds the host and associates the Internet address inet_addr with the Physical address eth_addr. The Physical address is given as 6 hexadecimal bytes separated by hyphens. The entry is permanent. eth_addr Specifies a physical address. if_addr If present, this specifies the Internet address of the interface whose address translation table should be modified. If not present, the first applicable interface will be used. Example:
arp -s 157.55.85.212 00-aa-00-62-c6-09 …. Adds a static entry.
arp -a …. Displays the arp table. -
Cara Menghapus Local Time Machine snapshot
Untuk mengosongkan space harddisk pada macOS dapat dengan cara menghapus file local time machine snapshot. Untuk melihat file snapshot, dapat menggunakan command berikut:
tmutil listlocalsnapshots /
Didapatkan hasil seperti contoh berikut ini:
mac@OS ~ % tmutil listlocalsnapshots / Snapshots for volume group containing disk /: com.apple.TimeMachine.2020-08-18-070820.local com.apple.TimeMachine.2020-08-18-090830.local com.apple.TimeMachine.2020-08-18-101626.local com.apple.TimeMachine.2020-08-18-130847.local com.apple.TimeMachine.2020-08-18-150842.local
Untuk menghapusnya, gunakan command berikut ini:
sudo tmutil deletelocalsnapshots 2020-08-18-070820
-
Bluetooth Audio Codec pada macOS
Seberapa bagusnya audio sering tergantung dari format yang digunakan. Biasanya, macOS menggunakan SBC audio compression codec sebagai standar. Tetapi, untuk mac jenis yang baru sudah mendukung AAC (Apple’s preferred iTunes codec) dan aptX. Kedua jenis codec tersbut mempunyai kualiatas audio dari pada SBC.
Untuk mengetahui code apa yang sedang digunakan pada bluetooth audio, dapat dengan cara sebagai berikut:
- Konekkana bluetooth audio dengan mac.
- Tahan tombol Option, kemudian klik ikon bluetooth yang ada di menu bar.
- Pilih bluetooth audio yang diinginkan.
-
CodeIgniter Error Message
Cookie “ci_session” will be soon rejected because it has the “sameSite” attribute set to “none” or an invalid value, without the “secure” attribute. To know more about the “sameSite“ attribute, read https://developer.mozilla.org/docs/Web/HTTP/Headers/Set-Cookie/SameSite
Pada file config perlu menggunakan konfigurasi sebagai berikut:
public $cookieSecure = true;
-
Android realtime chat dengan menggunakan Firebase Realtime Database
Pada artikel kali ini, saya akan membuat realtime chat yang sederhana dengan menggunakan Firebase Realtime Database. Firebase Realtime Database adalah database yang di-host di cloud. Data disimpan sebagai JSON dan disinkronkan secara realtime ke setiap klien yang terhubung. Ketika membuat aplikasi cross-platform dengan SDK Android, iOS, dan JavaScript, semua klien akan berbagi sebuah instance Realtime Database dan menerima update data terbaru secara otomatis.
Langkah pertama yang perlu dilakukan adalah membuat firebase project pada:
https://console.firebase.google.com
-
Java Native Interface
Java Native Interface (JNI) merupakan framework yang mengizinkan kode Java untuk memanggil native language seperti C, C+, maupun asemby. JNI dibutuhkan untuk mengoptimalkan performa pada Java.
Install terlebih dahulu tools yang diperlukan:
- JDK dan JRE
- Java IDE, pada kali ini digunakan Netbeans IDE 11.2.
- C++ IDE, pada kali ini digunakan Qt.
-
PHP stdClass to Array
PHP stdClass to Array
function objectToArray($d) { if (is_object($d)) { // Gets the properties of the given object // with get_object_vars function $d = get_object_vars($d); } if (is_array($d)) { /* * Return array converted to object * Using __FUNCTION__ (Magic constant) * for recursive call */ return array_map(__FUNCTION__, $d); } else { // Return array return $d; } }
PHP Array to stdClass
function arrayToObject($d) { if (is_array($d)) { /* * Return array converted to object * Using __FUNCTION__ (Magic constant) * for recursive call */ return (object) array_map(__FUNCTION__, $d); } else { // Return object return $d; } }