Chris Nizzardini

Salt Lake City, Utah Developer / Human / Blogger

Programming

How 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 our application here at work. This is one thing I’ve always missed since moving away from FireFox and its excellent plugin FirePHP.

, , , ,

CakePHP-DataTables – a Component for interoperability between CakePHP and jQuery DataTables.

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 json response compatible with datatables Accepts dataTables ORDER BY requests Accepts dataTables WHERE conditions Accepts dataTables pagination Works LinkableBehavior and to a lesser extent Containable Dependancies [...]

, , ,

Generating 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 Googles blog post on the matter at http://googlewebmastercentral.blogspot.com/2012/10/a-new-tool-to-disavow-links.html to ensure you are using the tool properly and know when to [...]

, , , , ,

Scrape 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 wonderful Simple HTML DOM library . Simple HTML DOM has some issues though. It chokes on large HTML documents. And when running [...]

, , , , , , ,

Finding 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 with XDebug you can add a break point and watch the callstack for this sort of information. [...]

, ,

Enhanced 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 layer is all in PHP. It is capable of reporting function-level inclusive and exclusive wall times, memory usage, CPU times and number of calls [...]

, , , ,

CakePHP 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 be 2.0). The other day I had the opportunity to explore optimizing CakePHP. My employers [...]

, , ,

Working 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. While attempting to regression test in older versions of IE I noticed I absolutely could not log in to my application. This only occured [...]

, , , , , ,

Inheritance 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 I found that unsetting certain members prior to an insert/update became rather annoying. I’ve been knee deep in Code Igniter for the past [...]

, , , ,

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 before passing to a SQL query to prevent against SQL injection. Obviously this would only work on database fields that are integers. To be [...]

, , , , , , , ,

Previous Posts