Unscientific Benchmarking of Type Casting, is_numeric, and regex in PHP
I performed some unscientific PHP benchmarks today pitting casting to an integer against is_numeric against preg_replace. The point was to see which is the fastest way of quickly cleaning user input...
View ArticleInheritance in CodeIgniter: Adding More Functionality To Your Models
I recently blogged on Reducing Code using CodeIgniters Active Record Class. In this blog I focus on easily collecting data from your object members using get_object_vars(). After using this for a while...
View ArticleMySQL Optimization Tip: Checking for Differences in Queries.
I’ve been going through the MySQL slow query log at my new job to optimize our applications performance. It’s a bit more scary making changes when you’re the “new guy” because there are a lot of...
View ArticleWorking Around CodeIgniters Default Session Library
Recently I was attempting to test a web application using BrowserCam. BrowserCam has a bank of virtual machines on different versions of many platforms including Apple OSX, Linux Fedora, and Windows....
View ArticleCakePHP Benchmarks on Storing Persistent Cache in APC. Hint: It’s Faster!
It’s been a while since I last posted on here so I thought I’d get something up here before my next big blog post. Since starting a new job back in September I’ve been working in CakePHP 1.3 (soon to...
View ArticleUsing Google Analytics Custom Variables for AB Testing
Setting up AB Tests using Google Analytics is a simple and free alternative to incredibly expensive solutions like Omniture AB Testing. I had actually used Omniture Test and Target with a company I had...
View ArticleProfiling Execution Time in JavaScript and the Perils of jQuery .append()
HI I’m Chris and I’ve been living under a rock because I just barely learned about using the console.profile() function in conjunction with FireBug. Better late than never. I was trying to figure out...
View ArticleEnhanced PHP performance profiling with Xhprof
XHProf is a function-level hierarchical profiler for PHP and has a simple HTML based navigational interface. The raw data collection component is implemented in C (as a PHP extension). The reporting/UI...
View ArticleFinding Out Where a Method is Being Called From in PHP
If you don’t have a debugger setup or would rather just see this sort of information in a log format use this snippet to find where a method is being called from. Note, if you have NetBeans configured...
View ArticleScrape Faster with PHP DomDocument and Safely with Tor
I recently was tasked with a rather complex project involving scraping hundreds of thousands HTML documents. Normally scraping is quite easy. I have a lot of experience with it and just use the...
View ArticleHow Lazy Loading JavaScript Reduces Page Load and Optimizes Application...
If you’ve ever built a large JavaScript application in any of the popular libraries out there like jQuery or MooTools you quickly find yourself including a lot of different libraries. In a recent...
View ArticleMake Apache Slow by Adjusting Prefork Settings
This is probably the strangest thing I’ve ever needed to figure out how to do in Apache: make apache slow. My initial thought was I could just drop max connections to 1, but this would completely halt...
View ArticleGenerating Google Webmaster Tools Disavow Text File in Linux
I had a domain that generates me about a grand each month get spanked badly by Google due to the work of an outsourced SEO. Luckily Google released a tool to disavow bad links. I suggest reading...
View ArticleCakePHP-DataTables – a Component for interoperability between CakePHP and...
Just a quick note. I released a new component for CakePHP that provides server-side interoperability between CakePHP 2.x and jQuery DataTables plugin. Features Takes paginated data and converts into...
View ArticleSimplifying adding new routes in Davis.Js
Davis.js is a library that allows you to use your back button in single-page ajax driven applications. It essentially binds events to all anchor tags on the page and intercepts them before the browser...
View ArticleHow to Log PHP Errors and SQL to Chrome Console in CakePHP
PHP errors can be a obnoxious when you’re developing an XHR heavy application with lots of JSON responses. The errors just aren’t very readable. So today I finally decided to implement ChromeLogger in...
View ArticleHow to Cache CakePHP DbAcl, ACO, and ARO checks
After enabling SQL query logging to Chrome Console I began noticing that queries against the ARO table appear running at 300 milliseconds or higher. This is data that doesn’t change often and is needed...
View ArticleUsing jQuery ajaxError to Automatically Handle Session Expiration and Server...
A question I get asked a lot is “What is the best way to check for expired sessions in an Ajax application”. A lot of developers end up polling the server every few minutes to validate the users...
View ArticleSo Netflix Search Sucks
So Netflix has the worst search capability ever. I can’t even adequately search for a genre such as “history channel” without returning results like Cars Toons: Mater’s Tall Tales and Charge....
View ArticleI sold my first business and here’s what I learned
I remember when I first learned how to ride a bike. I was eager to ditch the training wheels and hit the road (okay sidewalk). So one day we removed the training wheels and my Mom held onto my bicycle...
View Article