- Open postgresql.conf
- Set shared_buffers (misal 512MB)
- Set maintenance_work_mem (misal 256MB)
- Set full_page_writes jadi off
- Set wal_buffers (misal 16MB)
- Set autovacuum jadi off
- Restart postgresql
Nb: Hanya untuk pg_restore
use \Jyggen\Curl\Curl;
use \Jyggen\Curl\Request as Request;
class FirebaseManager
{
private $key = 'yourfcmkey';
private $appURL = 'https://fcm.googleapis.com/fcm/send';
private $device_target;
private $data;
private $response;
private $notification;
public function sendPush()
{
$headers = array('Authorization:key=' . $this->key, "Content-Type: application/json");
$fields = array();
$target = $this->device_target;
$fields['data'] = $this->data;
if(is_array($target))
{
if (count($target) == 1)
{
$fields['condition'] = "'".$target[0]."' in topics";
}
if (count($target) >= 2)
{
$topics = '';
foreach ($target as $k => $v)
{
if ($topics == '')
{
$topics = "'".$v."' in topics";
}
else
{
$topics .= " || '".$v."' in topics";
}
}
$fields['condition'] = $topics;
}
}
else
{
$fields['condition'] = "'".$target."' in topics";
}
$request = new Request($this->appUrl);
$request->setOption(CURLOPT_POST, true);
$request->setOption(CURLOPT_HTTPHEADER,$headers);
$request->setOption(CURLOPT_SSL_VERIFYHOST, 0);
$request->setOption(CURLOPT_SSL_VERIFYPEER, FALSE);
$request->setOption(CURLOPT_POSTFIELDS, json_encode($fields));
$request->execute();
$this->response = $request->getResponse();
}
public function setData($push_data)
{
$this->data = $push_data;
}
public function setTarget($target)
{
$this->device_target = $target;
}
public function setNotification($notif)
{
$this->notification = $notif;
}
public function getResponse()
{
return $this->response;
}
}
$contoh = new FirebaseManager;
$contoh->setData($data);
$contoh->setNotification($notif);
$contoh->setTarget($target);
$contoh->sendPush();
// Memakai fungsi for dimulai dengan $i=1 dan akan bertambah terus sampai $i<=100
for($i=1; $i<=100; $i++){
if($i%3 == 0){
echo "Fizz ";
}
elseif($i%5 == 0){
echo "Buzz ";}
elseif($i%3 == 0 && $i%5 == 0){
echo "FizzBuzz ";}
else{2. Buatkanlah function php untuk mencetak bilangan fibonacci dengan contoh output 10 deret bilangan fibonacci
echo $i." ";}}
function cetak_deret_fibonacci($jumlah){
$bilangan_awal = 0;
$bilangan_kedua = 1;
echo "$bilangan_awal $bilangan_kedua ";
for($i=0; $i<=$jumlah-2; $i++){
$hasil = $bilangan_awal+$bilangan_kedua;
echo "$hasil ";
$bilangan_awal = $bilangan_kedua;
$bilangan_kedua = $hasil;}}
//Cetak dengan function
cetak_deret_fibonacci(10);