Repair and optimize all tables in all MySQL databases
MySQL tables can crash or become corrupt quite easily if you don't shut down the server correctly, for example hard reboot or power outage.
Thankfully there is a quick way of repairing all the tables.
- mysqlcheck --auto-repair --check --optimize --all-databases
You may need to specify the username and/or password -u or -p
See the mysqlcheck docs for more information.
[Snippet] How (Not) To Vertically Center Content
Vertically Centering content in divs isn't as straight forward as it used to be in classic table based layouts.
http://phrogz.net/CSS/vertical-align/index.html explains all.
Controling Compatibility View in IE
After hours of frustration trying to make some CSS look right for a selection of people using IE8 I gave up.
There has to be a better solution.
Internet Explorer 8 and Internet Explorer 9 include a Compatibility View feature that displays websites that were created for older browsers as they were designed to appear with Internet Explorer 7. You can enable Compatibility View in Internet Explorer, most users don't even know they are in Compatibility View - which is where the problems arise!
Custom Post Type Index/Archives
Custom Post Types have come a long way recently.
Custom Post Type index/archives have been around in WordPress since 3.1., but very few people seem to use them. They came out of a bug (#13818) on the WP Trac.
Force jQuery Version in WordPress
Here's the right way to load a specific version of jQuery in WordPress. With each new version of WordPress we generally get a new version of jQuery, this can sometimes cause issues with other jQuery scripts you've loaded.
- function force_jquery_version() {
- wp_deregister_script( 'jquery' );
- wp_register_script( 'jquery', 'http://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js');
- wp_enqueue_script( 'jquery' );
- }
-
- add_action('init', 'force_jquery_version');
Sorting a multidimensional array
PHP's sort() or asort() functions are only single dimensional. What happens when you need to sort a multidimensional array based on a specific key?
Use this.
Looping over dates in PHP
I recently had to loop over the difference between two dates.
For example to create checkboxes for individual dates within a date range? Should be simple, right?
Rebranding WordPress 3.2
Woah. The new WordPress 3.2 admin interface is much better! Theres a lot of much welcome improvements.
I've upgraded a few blogs as test cases. Rebranding is mainly portable from 3.1 and below with one notable change.
Programmatically adding items to the cart in Shopp
One of the Shopp Support Reps - Adam has posted a good article on his site about how to add items to the Shopp cart from outside Shopp.
Top of teh Google!
A Google search for CubeCart Programmer brings me up as the top organic result! If you don't already know, I'm an independent CubeCart programmer available for any type of CubeCart job.



