Kept hitting CTRL+R, F5 or CTRL+F5 and don’t see what you’re expecting to see in your CakePHP App? This might have to do with the CakePHP internal caching and here’s how to get pass it.
[Read more…]
MySQL: Always Trim Your Data Before Loading Into MySQL
Here’s a situation. There are 2 columns in a table which are identical. Identical as in having the same data type and collation (varchar(100) + utf8_unicode_ci) and having the same content.
For example, let’s say the table has 2 columns:
a | b
=========
abcd|abcd
xyza|xyza
1234|1234
The Question
How could “select a,b from tableName where a=b” return 0 results?
[Read more…]
MySQL: How To Remove Duplicate Rows From A Table
Fast and simple way to remove duplicates rows from your MySQL tables. No messing around with programming language (php,.net,ruby,python, etc). Just pure SQL. Here’s how.
[Read more…]
htaccess Redirect Rule Not Redirecting Troubleshooting
So I was pretty sure that my htaccess redirect rule was perfect but it simply won’t work no matter what when tested from davidtan.org (main domain of a shared host).
[Read more…]
Firebug Console Debugging jQuery Notes
Just a quick note to myself and those who might find this useful. While using firebug console to debug jQuery, make sure that $ is in fact representing jQuery, since the $ alias might be tied to other things.
[Read more…]
WordPress Hard Crop VS Soft Crop Difference & Comparison Example
Have you ever question what does the “Crop thumbnail to exact dimensions” checkbox in WordPress Dashboard > Media > Thumbnail size actually do?
[Read more…]
How To Check How Many Opened Connections To MySQL
I was writing a wordpress plugin and came across a bug whereby I was creating a new database connection instance (wpdb in this case since I’m working with wordpress) everytime in a foreach loop.
foreach ($results as $result) { $newdb = new wpdb(DB_USER, DB_PASSWORD, DB_NAME, DB_HOST); ... ... }
Most Efficient Way To Write A Select Random Rows SQL Query
Here’s a quiz, which of the following would be more efficient and take less time to perform?
[Read more…]
Securing WordPress .htaccess
Make sure you read this if you run a wordpress blog. Never leave your .htaccess file permission at 777.
[Read more…]
How To Connect To MySQL Server Remotely
Connecting to a remote database server is a common thing to do for dba, database architect, web developer, application developer etc.
[Read more…]