Kamis, 04 April 2013


Konversi .htaccess dari Apache ke Nginx 

Contoh:
Jika pada apache

RewriteEngine On
RewriteRule ^index.html$ ./index.php?mdrw=on
RewriteRule ^manual.html$ ./index.php?action=manual&mdrw=on
RewriteRule ^([0-9]+)_([-0-9]+).html$ ./index.php?action=vtopic&forum=$1&page=$2&mdrw=on

Maka pada Nginx
rewrite ^index.html$ index.php?mdrw=on last;
rewrite ^manual.html$ index.php?action=manual&mdrw=on last;
rewrite ^([0-9]+)_([0-9]+).html$ index.php?action=vthread&forum=$1&page=$2&mdrw=on last;

Semoga bermanfaat
Kadang kala blog atau web kita tidak bisa diakses, dan muncul beberapa pesan error. Seperti 403, 404, 500 error bad gateway dan lain-lain. Sebenarnya apa sih arti dari pesan-pesan error tersebut?akan saya jelaskan sedikit dibawah ini.

HTTP Error 404 – Not Found

Ada dua kemungkinan penyebab yang sering terjadi apabila muncul pesan seperti ini.

File yang diakses tidak ada, apabila Anda sebagai pemilik web tersebut, silahkan coba file yang Anda akses, apakah ada atau tidak pada folder public_htm. Namun jika file ada tetap muncul pesan error seperti diatas maka kita ke point 2.
URL rewritenya tidak benar, URL rewrite digunakan untuk membuat link-link pada website Anda menjadi lebihsimpel dan bagus. Dan perintah-perintah URL rewrite diletkan pada file .htaccess jadi silahkan periksa kembail perintahnya, apakah sesuai dengan link yang Anda akses.
HTTP Error 403 Forbidden

Muncul error seperti diatas paling sering terjadi disebabkan oleh permission pada folder/file yang dituju tidak membolehkan untuk dilihat oleh publik. Apabila Anda ingin mengijinkan publik untuk mengakses folder/file tersebut silahkan set permissionnya menjadi 755 atau 644.

HTTP Error 500 – Internal Server Error

Hal ini seperti diatas paling sering disebabkan kesalahan pada perintah-perintah di file .htaccess. Jadi coba cek kembali perintah-perintah yang Anda masukkan.Kalau masih tetap maka coba cek ulang apakah mod_rewrite sudah aktif atau belum. 

HTTP Error 503 – Service Unavailable

Pesan kesalahan ini mengisyaratkan bahwa server web tempat situs anda berada saat ini tidak dapat menangani permintaan HTTP dari browser karena proses di server telah melebihi batas kapasitas yang ditentukan (atau sedang kelebihan beban).

HTTP Error – Bad Gateway

Pesan kesalahan ini terjadi ketika salah satu server yang terlibat dalam proses akses kesitus web yang sedang anda tuju mengalami masalah. Hal ini umumnya tidak disebabkan oleh program di sisi pengunjung, melainkan disisi aplikasi / script di server web, atau jaringan yang menuju ke server atau di sisi ISP. Meskipun penyebab masalahnya tidak terjadi di sisi Anda, kami menyarankan agar anda melakukan hal-hal berikut:

Mencoba untuk mengulangi akses ke situs web anda dengan merefresh, atau mengetik alamat langsung.

Jika error di atas terjadi pada saat anda mencoba script cgi/perl/php, silahkan periksa kembali sintaks-sintaks script tersebut. Menurut pengalaman kami, script-script cgi/perl/php yang memiliki kesalahan sintaks juga dapat menghasilkan pesan error seperti diatas pada saat di eksekusi.

Namun pesan semua kesalahan yang disebutkan diatas belum tentu penyebabnya merupakan yang dijabarkan tadi, untuk lebih jelasnya Anda dapat membuka error_log.

Nah itu lah arti dari pesan error yang kadang mengahmpiri blog kita. Semoga membantu.

Berikut ini adalah contoh penggunaan rownum sebagai pengganti limit di Oracle. Saya menggunakan Schema HR

select * from
(select employee_id,first_name,last_name,email,RANK() OVER (ORDER BY employee_id asc , ROWNUM ASC ) RN from employees)
where RN > 0 and RN <= 10

Hasil:


Tambahan :
Cara lain penggunaan rownum dapat seperti berikut.

select *
  from ( select a.*, rownum rnum
           from ( YOUR_QUERY_GOES_HERE -- including the order by ) a
          where rownum <= MAX_ROWS )
 where rnum >= MIN_ROWS

dengan query tersebut kita dapat menambahkan ekspresi group by dan order by.

Jumat, 15 Februari 2013


Mudahnya Setting Koneksi PHP Oracle dengan WAMP server.
Setelah installasi oracle berhasil, Untuk setting koneksi PHP ke Oracle, kita install dulu wampserver yang softwarenya dapat kita download secara gratis di website resminya [DISINI]. Setelah selesai proses  installasinya kita jalankan wampservernya  ->  klik icon wampserver -> arahkan ke php -> PHP extensions -> aktifkan php_oci8.
Hasilnya dapat dilihat di phpinfo()

Kita coba dengan script php. Buat file php baru yang isinya seperti dibawah ini.
<?php
$sid = "orcl";  
$user = "scott";
$pass = "tiger";
$con = ocilogon($user,$pass,$sid);
if($con)
echo "Koneksi PHP ORACLE Berhasil";
else
echo "Koneksi PHP ORACLE Gagal";
?>

Simpan dengan nama cobaKoneksi.php dan letakkan di folder c:\wamp\www.
Jalankan dengan browser, ketikan http://localhost/cobaKoneksi.php jika berhasil maka akan muncul “Koneksi PHP ORACLE Berhasil” dan jika gagal akan muncul “Koneksi PHP ORACLE Gagal”. Jika ada masalah silahkan membuat komen di bawah ini.





EXPORTING MODULE

From version 2.3.5  an exporting module is available for Highcharts, which allows users to download images or PDF's of your charts. This module consists of an extra JavaScript file, exporting.js, and a web service or server module written in PHP. Highslide Software offers the exporting web service free of charge. If you include the exporting module in your charts, two buttons will appear in the upper right. One button prints the chart, which is done on the client side only. The other button handles exporting. By default, an SVG representation of the chart is sent by POST to http://export.highcharts.com, where it is converted using Apache's Batik converter to PDF, PNG or JPEG.
See the navigation and exporting reference items for a full documentation for the options available. Also see under "Methods and Properties" in the reference for members releated to exporting.

6.1 Client side setup

Add the exporting module JavaScript file after your highcharts.js file.
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js" type="text/javascript"></script>
<script src="/js/highcharts.js" type="text/javascript"></script>
<script src="/js/modules/exporting.js" type="text/javascript"></script>

6.2 Server module setup

If you want to set up this web service on your own server, the index.php file that handles the POST is supplied in the download package inside the/exporting-server directory.
  1. Make sure that PHP and Java is installed on your server.
  2. Upload the index.php file from the /exporting-server directory in the download package to your server.
  3. In your FTP program, create directory called temp in the same directory as index.php and chmod this new directory to 777 (Linux/Unix servers only).
  4. Download Batik from http://xmlgraphics.apache.org/batik/#download. Find the binary distribution for your version of jre
  5. Upload batik-rasterizer.jar and the entire lib directory to a location on your web server.
  6. In the options in the top of the index.php file, set the path to batik-rasterier.jar.
  7. In your chart options, set the exporting.url option to match your PHP file location.
As an ASP.NET alternative to our Java/PHP based server module, ClĂ©ment Agarini has kindly shared his export module for ASP.NET.
Source : http://docs.highcharts.com/

Kamis, 17 Januari 2013

Pertama kita buat script seperti dibawah ini dan taruh di paling atas.


<?php
$time = microtime();
$time = explode(' ', $time);
$time = $time[1] + $time[0];
$start = $time;
?>
Kemudian buat juga script seperti di bawah ini dan taruh di paling bawah.


<?php
$time = microtime();
$time = explode(' ',$time);
$time = $time[1]+$time[0];
$finish = $time;
$total = $finish - $start;
echo "Page generated in $total second";
?>

Page generated in 0.32267308235168 second
hasil di atas menunjukan berapa waktu yang server butuhkan dalam memuat suatu halaman.

Subscribe to RSS Feed Follow me on Twitter!