Here’s the source to my Tic Tac Toe PHP game. I originally wrote this in Perl before porting it to PHP. It’s quite primitive (load a new page every time you make a move). It has a computer opponent with a decent AI, implementing Minimax (see http://en.wikipedia.org/wiki/Minimax for more) algorithm. You can see it running here. […]

This guide walks you through in getting the Facebook Credits Sample running in test mode. 1. Download the official sample code from: https://github.com/facebook/credits-api-sample 2. Read the overview. 3. Copy the files into your server into a subfolder (your server must support PHP): – callback.php – index.php – xdreceiver.html 4. Create a test application. Fill out […]

One of the things that I played around several years ago was the GD library, which allows image manipulations and creations on the server-side. I have always want to automate repetitive things such as creating glossy-icons for web-pages.  Basically I want to automate the process of converting: From this To this: I wasn’t sure if […]

With the Facebook introduction of Graph API, there are several ways of authenticating (logging in user) and displaying the permission request. Before we continue, let’s see an example of two of them: Popup Authentication This method spawns a new bowser window (as popup) containing the form: Same Window Authentication This methods opens a Facebook page […]

The guide below is an extension of this tutorial: https://www.permadi.com/blog/2010/12/using-facebook-open-graph-api-in-flash-as3/. The function to get your profile picture is Where uid is the Facebook user id. Once you establish a Facebook connection, your user id is available at Facebook.getSession().uid. So we can call: This will give you the URL which ‘theoretically’ you can ask a Loader […]

In this part of the turorial, we will explore how to extend WordPress forms to show new fields in Custom Post Types that we created in the previous part of the tutorial. The previous part of this tutorial can be read here: https://www.permadi.com/blog/2010/11/introduction-to-custom-post-types-in-wordpress-3-part-1/. This part of the tutorial will show you how to create custom […]

Custom Post Types functionality is added in WordPress 3 (it was present in 2.9 but with limited featrues). Broadly speaking, with Custom Post Types, your Posts (also commonly referred as blog-enty” or “blog-post”) are no longer limited to the two predefined types of Post and Page and most likely you end up with the standard […]

In this tutorial, we will demonstrate methods of saving the content of a HTML5 Canvas object using server side scripting. PHP will be used in this example, but the technique can be applied in other languages as well. This post requires understanding of Javascript, HTML (especially forms and/or AJAX). PHP is used in the example […]

In this example, we will be adding a watermark (logo) into an image using PHP and GD library. For introduction to PHP GD, visit this post: /blog/2010/03/using-php-gd-to-create-images/ This is the logo image that I will be using: This logo is a PNG file with alpha channel. With transparent images, using PNG is better than using […]