WordPress.org API key

November 6, 2009 6 comments

You just installed wordpress.org and now you’re about to install some plugins which require the API key to work.. and you look everywhere in your wordpress.org for that API key but couldn’t find it. It’s because it’s not there. In other words, wordpress.org doesn’t have any API key. Yes, you read that right. You would never find any API key in wordpress.org.

So how do you install those plugins that need the API key, right? The answer is you have to create an account with wordpress.com and you’ll get the API key there. Yes, maybe you think you don’t need any account with wordpress.com since you already have your own wordpress.org running, but the fact is, the plugins that require the API key actually need wordpress.com to run. And most probably the plug-in was wrote by the good guys at wordpress.com.

So, head on to http://www.wordpress.com, register yourself a new account which probably you’ll never bother again in the future and get yourself an API key by logging in into your newly created account.

Advertisements
Categories: Uncategorized Tags: , ,

Php copy .. failed to open stream: Permission denied in …

November 6, 2009 1 comment

Ever faced this problem when you’re trying to copy files using php? Well, as the error above said, you’re having a permission problem to access the source and/or destination file. I’ll describe two possible ways to overcome this problem:

1)If this problem happened on your local pc, you’ll just have to right click on the folder where the file resides, click Properties, and make sure the Read Only Attributes is not checked. Try running the code again.
2)If this problem happened on your internet(hosting) server, you’ll have to set the permission of the folder. If you’re using CPanel, go to File Manager, and browse to the parent directory of the folder, check (tick) the folder name, and click on the ‘Change Permissions’ button. Try enabling the folder’s Read, Write, and Execute for World and Group. Try running the code again.

For security reasons, after you’re sure that the code works, don’t forgot to tweak the permission settings so that only the minimal permission is granted. Sure you don’t want anyone out there to overwrite your files, don’t you?

Hope this post helps somebody out there!

Categories: PHP, Programming Tags:

Anyone can be a chef at TryMasak!

February 3, 2009 Leave a comment

assalamualaikum and hi all

test

Just wanna share a new and sensational site, www.trymasak.my! At trymasak there’re hundreds of no-frills video recipe of malay, chinese, indian and western cooking. You can rate those recipes, comment them, and even upload your own video recipes. It’s all free for life, so what are you waiting for, head on to www.trymasak.my now!

Categories: Uncategorized

php session/cookies failed on certain page

August 18, 2008 Leave a comment

Ever faced a situation where your supposed to be authenticated-by-session or cookie failed? it works initially, but on certain page, it fails.. and you don’t know what went wrong because you cold swear that the exact same piece of code works on the previous page but not on another page..!

Well, most probably here’s how your php authentication code look like, where you included it in every part of your php page, either using session or cookie. The example below uses session:
=======================================
session_start();

if ($_POST){
$_SESSION[‘user’]=$_POST[“user”];
$_SESSION[‘pass’]=$_POST[“pass”];
}

include (“dbconf.php”);    //the php file that contains the database settings
// query for a user/pass match
$result = mysql_query(“select status from login
where user='” . $_SESSION[‘user’] . “‘ and pass='” . $_SESSION[‘pass’] . “‘ “) or die (mysql_error());
=======================================

Then the code above works for first page, second page… but on the 3rd page it returns an error. Or sometimes the session/cookie suddenly disappeared, and it returns invalid username/password! Let me tell you two thing:

1) The page before the session/cookie fails have a Submit button with the method set as POST.
2) Now let me tell you where it went wrong. See the line if ($_POST){ above? THAT’s WHERE it went wrong. Instead of writing only $_POST, you should write something like ($_POST[‘username’] || $_POST[‘password’]) or whatever your username and password box named in the previous page. Because if you wrote only $_POST, and a page has a Submit button with method POST, the line if ($_POST) will trigger and passes the now empty $_POST[“USER”] to $_SESSION[‘user’] since there are no input box named as USER or PASSWORD in the page (and even if they do, most probably it’s not meant for password authentication), and of course, the sql query below it will return an error since it now queries using an empty or wrong $_SESSION[‘user’] and $_SESSION[‘pass’]!

I faced the above problem because I tend to copy paste codes from supposed-to-be session tutorial. IMHO, it’s a bad practise to write a tutorial which can complicate matters in the future, although probably they only meant to simplify things.

In summary, here’s how your session authentication should look like:

==============================

if ($_POST[‘username’] || $_POST[‘password’])
{
$_SESSION[‘username’]=$_POST[‘username’];
$_SESSION[‘password’]=$_POST[‘password’];
}
==================================

Hope this post helps someone out there!

PHP “Cannot send session cache limiter – headers already sent” error

July 22, 2008 6 comments

I faced with this problem today, and Mr Google helped me to this site which helped me figure out how to solve the problem. Basically what the site says is “Make sure to check for and remove any spaces or carriage returns directly before or after your opening and closing php tags.” So for me, my problem is caused by this line:

==================================

<html><head><title>My Page</title></head>

<?PHP

include(“global.php”);
include(“adminAuth.php”);

?>

==================================

and to fix it, I simply put both the include lines at the uppermost, which becomes like this:

==================================

<?PHP

include(“global.php”);
include(“adminAuth.php”);

?>

<html><head><title>My Page</title></head>    <–see now the html code is brought down

==================================

Alhamdulillah, thank God the problem is solved just by doing this. Anyway this problem only surfaced when I uploaded my php code to my internet server. The same code doesn’t give any problem on my localhost server. Which I think I can conclude that the error will only appear on certain PHP/apache version.

Categories: Technology Tags: , ,

Windows Vista Sux – Stay Away From It

July 18, 2008 1 comment

I’ve heard many people said it, but hey, it can’t be that bad, right? I mean, Microsoft has been in the OS area since a few decades ago. Anyway I don’t have the chance to try Vista until I got my Dell Inspiron 1420 which came with Windows Vista installed – which ultimately after 3 weeks of using it, I decided to get rid of it, forever. And here’s why (just partly, ok):

  • Slow like heck.
  • I got at least 5 BSOD (yes, the infamous blue screen of death) during my 3 weeks experience with Vista. (No, it’s not hardware problem. I’ve managed to run XP on the very same system without any BSOD)
  • Firefox 3.0 will crash several times. Average once every 2 days.
  • Sometimes Netbeans 6.0 will close itself without warning. Happens at least twice.
  • Many small old programs won’t work as efficient as they did in Windows XP.
  • Posting in forums indicates that many Inspiron 1420 users ditched Vista too.. most complained of Vista as too slow and unreliable.
  • Among the last to detect cabled network connection in my office (others using XP detected it faster than my Vista).

Anyway I don’t know what’s so special of this Vista until it needs to eat too many system resources. The only thing I like about Vista is the game package it came with. Lame, isn’t it? Haha.

Hey, don’t regard this as a Microsoft bashing post.  Instead, consider it as a pat-on-the-back to Microsoft, since their Windows XP has proven that it can stand the test of time.

Windows Vista is very unrealiable – worse than Windows ME. No wonder Intel has decided not to use Vista. And no wonder Microsoft has announced that a new Windows will be revealed at the end of 2009.

Categories: Uncategorized

Why joining Barisan Rakyat is the most ethical thing any BN MPs could do

April 16, 2008 2 comments

Perlawanan bola sepak antara team BN & team BR baru bermula. Sebelum perlawanan dimulakan, team BN dengan angkuhnya meramalkan yang mereka akan menang 10 – 1. Baru 10 minit permainan bermula, pengadil dengan suka hatinya memberikan 3 gol percuma kepada team BN. Takde alasan. Saje2 je, kata pengadil. Pemain2 team BR yang membantah keputusan pengadil diberikan kad merah. Akibatnya 2 pemain team BR kene keluar padang. Permainan diteruskan dengan bilangan pemain team BR yang kurang dari team BN.

Bila hampir tamat permainan, keputusannya mengejutkan semua pihak. Team BN hanya mendahului dengan bilangan gol yang amat tipis, 8 berbalas 7. Hanya 2 gol saja lagi yang team BR perlukan untuk mendahului team BN. Pemain2 team BN bagai hilang punca. Tak pernah dlm sejarah team BN hampir-hampir tewas. Permainan diteruskan dalam masa kecederaan. Pemain2 team BN tahu yang sekiranya permainan ini dijalankan secara adil, memang team BR dah lama menang. Dalam masa kecederaan itu, sebilangan pemain-pemain team BN yang masih mempunyai harga diri mengambil keputusan untuk skor gol sendiri sebanyak 3 biji, kerana mereka sendiri juga tahu yang 3 gol awal kepunyaan team BN adalah tidak sah. Mereka tahu penonton mahukan permainan yang adil. Jadi dengan 3 gol sendiri yang dijaringkan pemain BN itu, setidak-tidaknya mereka telah memberikan kepada penonton satu permainan dengan jumlah gol yang adil. Dan keputusan akhir, team BR mengalahkan team BN dengan skor 10 – 8.

Persoalannya (nada ala2 shebby singh), adakah pemain-pemain BN yang telah skor gol sendiri pada saat-saat akhir perlawanan itu melakukan sesuatu yang tidak beretika? Sesuatu yang tidak bermoral?

Jika anda mengatakan yang pemain-pemain BN itu telah mengkhianati penonton-penonton kerana mengskor gol sendiri dan mengatakan yang mereka tidak sepatutnya berbuat demikian dan seharusnya mereka memberikan kemenangan tidak adil kepada team BN, maka silakan, teruskanlah perjuangan anda untuk sentiasa menjadi pembangkang.

Kerana pastinya perlawanan akan datang team BN akan terus merangka tipu daya yang lebih konkrit untuk mengonyong team BR 10 – 0. Mereka mampu berbuat demikian, walaupun jika penyokong team BR adalah lebih ramai. Pengadil adalah penyokong mereka. Stadium mereka yang punya. Padang dan bola pun milik mereka. Apatah lagi scoreboard. Waktu itu barulah anda akan berteriak dan menjerit-jerit yang keadilan makin lenyap dan pudar, yang keadilan tidak dilaksanakan di dalam permainan itu dulu, kini dan selamanya.

Padan muka. Waktu ada peluang nak restore keadilan, tak nak guna.

Walaupun mungkin tidak begitu tepat, senario perlawanan bola sepak di atas adalah analogi kepada pilihanraya umum ke-12 malaysia yang baru sebulan berlalu. Sekarang sibuk tentang perbicaraan yang terdapat lebih dari 30 ahli parlimen BN yang hendak lompat parti masuk Barisan Rakyat (walaupun saya sendiri meraguinya, tp sentiasa berdoa & mengharapkan ianya terjadi..) Sebilangan besar rakyat menyokong kejadian lompat parti itu sekiranya ianya betul-betul akan terjadi. Namun ada juga yang membangkang. Alasannya perbuatan seperti itu tidak beretika. Menipu rakyat, katanya. Kene lawan cara gentleman.

I beg to differ dengan mereka-mereka yang berpendapat seperti ini. Bagi saya, melompat parti dari BN ke BR adalah perkara yang PALING BERETIKA yang boleh ahli-ahli MP BN lakukan pada ketika ini. First thing first. Walaupun alhamdulillah BR dpt deny majoriti 2/3 BN dalam parlimen, dan 6 (termasuk KL) negeri ditangan BR, tetapi hakikatnya pilihanraya yang baru berlalu ini telah dijalankan dengan tidak adil. Tengok sendiri dah tau. Mainstream media semua angkat BN, kutuk BR. Jentera kerajaan abih BN guna. SPR pula berperangai seperti salah satu parti komponen BN (dari pembatalan setem utk pencalonan dan penggunaan dakwat kekal, etc etc) Dan tidak lupa juga persempadanan pilihanraya yang tidak adil yang telah banyak membantu BN.

Namun Alhamdulillah dengan kuasa Allah, penipuan-penipuan terancang yang depa dok lakukan ini tetap tidak dapat membendung kemahuan rakyat yang mahukan perubahan. Dengan kata lain, sekiranya pilihanraya lepas dijalankan dengan seadil-adilnya, dah lama BN kalah. Diulangi, DAH LAMA BN KALAH. Jadi perbuatan MP-MP BN yang hendak melompat masuk BR, adalah perbuatan yang paling beretika, paling bermoral dan paling terpuji dalam proses kita hendak mengembalikan keadilan kepada negara kita. Kerana dengan melompatnya MP2 BN itu, tidak bermaksud kita merampas kerusi milik BN dan juga merampas kepercayaan rakyat, tetapi kita MENGEMBALIKAN KERUSI ITU KE TEMPAT YANG SEPATUTNYA, kita MENGEMBALIKAN UNDI RAKYAT KE TEMPAT YANG SEPATUTNYA!! (Part akhir tu bace ala-ala DSAI tengah berkobar-kobar berceramah)

“Ya Allah, ampunkanlah dosa-dosa kami. Janganlah Engkau hukum kami disebabkan dosa-dosa kami. Kami merayu kepada Engkau, kembalikanlah keadilan kepada negara kami, angkatlah pemimpin-pemimpin dari kalangan kami mereka-mereka yang takutkan Engkau, yang sentiasa bersifat adil dan amanah, dan Engkau hinakanlah mereka-mereka yang telah lama menipu dan merosakkan negara kami, yang telah memerintah kami berpandukan hawa nafsu mereka, serta mereka-mereka yang melindungi mereka. Engkaulah penolong kami Ya Allah, kepada Engkaulah kami berharap, dan kepada Engkaulah kami akan dikembalikan. Amin Ya Rabbal Alamin.”