Thursday, December 29, 2011

Khmer Unicode for iPhone, iPod and iPad

Now you can get Khmer Unicode Font and Keyboard on your jailbroken iPhone, iPod and iPad. Please follow the 7 steps below to install Khmer Unicode Font and Keyboard on your devices.
1. Go to Cydia > Manage > Sources.
2. Click Edit > Add.
3. Enter Cydia/APT URL as the following: http://iphonekhmer.com/ and then click Add Source.
4. After the source has been added, click Done and go to the source: “iphonekhmer.com.”
5. Select the right version of Khmer Unicode Font and Keyboard that correspond to your devices.
6. Click install > Confirm and then allow the installation proceeds. Click Return to Cydia or Reboot Device when finished.
7. Leave Cydia and go to Settings > General > Keyboard > International Keyboards > Add New Keyboard… and then scroll to find and select Khmer.
Now your Khmer Unicode Font and Keyboard installation is set. To test if it works, please open a New Note. To change your keyboard from English to Khmer, tab on the world button next to the space bar. Now you are ready to type in Khmer on your devices.
Good luck!

Tuesday, December 20, 2011

5 useful url rewriting examples using .htaccess

If you are looking for the examples of URL rewriting then this post might be useful for you. In this post, I’ve given five useful examples of URL rewriting using .htacess. If you don’t know something about url rewriting then please check my older post about url rewriting using .htaccess.
Now let’s look at the examples
1)Rewriting product.php?id=12 to product-12.html
It is a simple redirection in which .php extension is hidden from the browser’s address bar and dynamic url (containing “?” character) is converted into a static URL.
RewriteEngine on
RewriteRule ^product-([0-9]+)\.html$ product.php?id=$1
2) Rewriting product.php?id=12 to product/ipod-nano/12.html
SEO expert always suggest to display the main keyword in the URL. In the following URL rewriting technique you can display the name of the product in URL.
RewriteEngine on
RewriteRule ^product/([a-zA-Z0-9_-]+)/([0-9]+)\.html$ product.php?id=$2
3) Redirecting non www URL to www URL
If you type yahoo.com in browser it will be redirected to www.yahoo.com. If you want to do same with your website then put the following code to .htaccess file. What is benefit of this kind of redirection?? Please check the post about SEO friendly redirect (301) redirect in php and .htaccess.
RewriteEngine On
RewriteCond %{HTTP_HOST} ^optimaxwebsolutions\.com$
RewriteRule (.*) http://www.optimaxwebsolutions.com/$1 [R=301,L]
4) Rewriting yoursite.com/user.php?username=xyz to yoursite.com/xyz
Have you checked zorpia.com.If you type http://zorpia.com/roshanbh233 in browser you can see my profile over there. If you want to do the same kind of redirection i.e http://yoursite.com/xyz to http://yoursite.com/user.php?username=xyz then you can add the following code to the .htaccess file.
RewriteEngine On
RewriteRule ^([a-zA-Z0-9_-]+)$ user.php?username=$1
RewriteRule ^([a-zA-Z0-9_-]+)/$ user.php?username=$1
5) Redirecting the domain to a new subfolder of inside public_html.
Suppose the you’ve redeveloped your site and all the new development reside inside the “new” folder of inside root folder.Then the new development of the website can be accessed like “test.com/new”. Now moving these files to the root folder can be a hectic process so you can create the following code inside the .htaccess file and place it under the root folder of the website. In result, www.test.com point out to the files inside “new” folder.
RewriteEngine On
RewriteCond %{HTTP_HOST} ^test\.com$ [OR]
RewriteCond %{HTTP_HOST} ^www\.test\.com$
RewriteCond %{REQUEST_URI} !^/new/
RewriteRule (.*) /new/$1

Thursday, December 15, 2011

How to make PHP Crosstab?

SELECT DATE_FORMAT(tracked_date,'%Y-%m-%d') as my_tracked_date,
sum(ss.term_id IN (3) OR tt.parent IN (3)) AS category3,
sum(ss.term_id IN (4) OR tt.parent IN (4)) AS category4,
sum(ss.term_id IN (5) OR tt.parent IN (5)) AS category5,
sum(ss.term_id IN (6) OR tt.parent IN (6)) AS category6
FROM wp_terms AS t LEFT JOIN a AS ss ON t.term_id = ss.term_id LEFT JOIN b AS tt
ON ss.term_id = tt.term_id
WHERE DATE_FORMAT(tracked_date,'%Y-%m-%d') IS NOT NULL
GROUP BY my_tracked_date ORDER BY my_tracked_date