PHP Short Open Tag

Posted on March 4th, 2010 in PHP Short Open Tag by admin

Mungkin kita sudah tahu semua kalau kita mau memulai ngoding PHP kita harus membukanya dengan tag <?php dan menutupnya dengan ?> . Namun kadang kala mungkin ada yang membuka tag php dengan <? dan menutup dengan ?> . Apakah yang membedakan ?

Sebenarnya ini tergantung dari settingan php dalam server kita. Lebih tepatnya settingan ini terdapat dalam file php.ini. Jika kita menggunakan xampp file ini terdapat dalam directory “xampp\apache\bin\php.ini”.

Agar kita bisa melakukan open tag dengan <?php ataupun dengan <? lakukan settingan seperti dibawah ini

  1. Buka file php.ini
  2. Cari string “short_open_tag”
  3. Jika anda menemukan string “;short_open_tag” di awali dengan titik koma. Lakukan terus pencarian sampai ditemukan string “short_open_tag”.
  4. Setelah menemukan string tersebut ganti short_open_tag = off menjadi short_open_tag = on
  5. Selesai. Restart server PHP.

Manfaat settingan ini adalah sebagai berikut.

Misal jika kita ingin mencetak variable $x kitabiasanya menggunakan echo seperti dibawah ini.
<?php
echo $x;
?>

Tapi jika kita sudah melakukan setting seperti cara diatas kita bisa melakukan print variabel $x dengan cara sebagai berikut :
<?=$x?>

Menghitung Jumlah Karakter Dalam String Oracle

Posted on February 18th, 2010 in Menghitung Jumlah Karakter Dalam String Oracle by admin

Jika kita mau menghitung panjang string dalam database oracle mungkin sangat mudah, yaitu dengan menggunakan length seperti contoh dibawah ini:

SELECT LENGTH('Hello World') FROM DUAL;

Mungkin teman-teman sudah tau semua ya … Tapi bagaimana kalau kita ingin menghitung jumlah karakter l saja ???

Mungkin kita bisa menggunakan bantuan fungsi lain yaitu fungsi replace. Pertama yang harus kita lakukan adalah menghitung jumlah karakter tanpa huruf l. Syntax nya adalah sebagai berikut :

SELECT LENGTH(REPLACE('Hello World', 'l', null)) FROM DUAL

Karakter l di replace dengan null kemudian di hitung panjang karakternya.

Kita dapat mencari jumlah karakter l saja dengan cara menghitung jumlah semua karakter dikurangi dengan jumlah karakter tanpa l. Syntax lengkapnya adalah sebagai berikut :

SELECT LENGTH('Hello World') - LENGTH(REPLACE('Hello world', 'l', null)) FROM DUAL

Mudah kan ?? heheee…..

Error After Wordpress Plugin Installed

Posted on January 21st, 2010 in Error After Wordpress Plugin Installed by admin

In installing wordpress plugin will not always succeed. This could be due to differences between the versions of wordpress and plugins. For that I will provide a solution if there is failure to install the wordpress plugin.

  1. Login into your wordpress database.
  2. You can use phpmyadmin or other tool. Find “Option” tables.
  3. Find the line that the contents of “active plugins”. It is a list of active plugins.
  4. Delete all the contents of the list. All plugins will be in a state of inactivity.
  5. Perform reactivation of plugins that can work well.

Done ! your  wordpress can walk again as before

Cpanel Port Blocked

Posted on January 18th, 2010 in Cpanel Port Blocked by admin

When we are hosting a website, we can access a cpanel feature to manage a website. In other way, we can’t access cpanel because of the cpanel port blocked by network administrator for security reason.
Now i will explain how to resolve it.
The first time you must go to the place that you can access cpanel. Open it !. Create a new subdomain for your new cpanel (for example mpanel.yourdomain.com).
Usually, by default, cpanel address located at cpanel.yourdomain.com or yourdomain.com/cpanel. Download cpanel proxy from cpanelproxy.net or you can download here. Upload cPanelProxy.zip to your new subdomain root directory. Extract it.
Open and edit file cpanelproxy.php. Assume your new subdomain is mpanel.yourdomain.com
Change this code
$cpanelhost = 'cpanel.'.$hostpostfix;
To
$cpanelhost = 'mpanel.'.$hostpostfix;
Now you can access your new cpanel at mpanel.yourdomain.com

Wordpress With More One Language (without plugin)

Posted on January 18th, 2010 in Wordpress With More One Language (without plugin) by admin

In this session i will explain how to configure wordpress article with more one language. It is very simple, didn’t need a plugin, using google translate
Now i will explain it :
Copy the article that you want to translate in google translate textbox. Chose a language in Translate from and Translate into. Click translate button. Copy all of translate result to your wordpress Post Editor. And Finish !!!! Publish your post.
The other language will appear as a tooltip with other language.
The advantages of using my way is you can use more than one language translate in your wordpress blog, but in one article only can use two language.
If you use a plugin it only can translate one language in all of your wordpress blog.

Next Page »