This is a follow up post to my blog on enabling and disabling the MySQL slow query log without restarting MySQL. In this post I’ll explain some methods for analyzing and parsing information out of the MySQL slow query log and then optimizing the slow queries. The slow query log is an absolute mess. Go ahead just open it and you will see what I mean…
MySQL Slow Query Log – Analyzing, Parsing, and Optimizing Slow Queries
My First Code Igniter Project (Part 2)
This is a continuation of blog on My First Code Igniter Project. In my first post on Code Igniter I learned how to: remove the ugly URLs, include CSS, JavaScript, and header/footer files, make and use helpers, and also use Active Record. Since my last post I’ve been mostly spending time on non Code Igniter centric pieces of my project such as the database schema and the user interface. I had originally decided NOT to use Ajax in this application, but after looking over the interface I decided it was needed to provide a rich user experience. So lets cover Ajax.
Read Full Blog »
My First Code Igniter Project
Two things got me interested in using a PHP framework recently. One was this article by Matthew Inman covering how he built a complete site in 66 hours using CakePHP. The other was stepping head first into a new company with a less than friendly code base with no standards. If those two things can’t get you interested in a development framework (be it custom or community driven) then you can’t be saved. Having previously tried CakePHP I was not interested in adhering to its strict set of standards. After reviewing Code Igniter I was pleased that it didn’t have a strict rule set to follow beyond its implementation of MVC. Here is a review of my first project.
Fun With Regular Expressions
Here are some regular expressions I’ve become very fond of. Most of these examples are built for the PHP programming language, to make them compatible with other languages you will likely just need to remove the beginning forward slash and ending backslash. For testing regular expressions I use the regex powertoy.
Posted in Programming, Tagged: php, preg_match, preg_replace, regex, regular expressions
Happy Cacti Graphs at the Office
I’m pretty excited about getting cacti running in our production environment to monitor our Web and Database servers. Cacti is a complete network graphing solution designed to harness the power of RRDTool‘s data storage and graphing functionality. Cacti provides a fast poller, advanced graph templating, multiple data acquisition methods, and user management features out of the box. All of this is wrapped in an intuitive, easy to use interface that makes sense for LAN-sized installations up to complex networks with hundreds of devices.
A Sneak Peak at Moo2Complete, MooTools Plugin For Auto Completion
It’s been a while since I’ve written a community plugin for MooTools suitable for MooForge. My last one was FbModal about a year ago and before that was the MooTools TableSorter. Well I started a new project earlier this month and was looking around for a suitable MooTools based auto completer. I was thoroughly unimpressed with the options out in the wild. Enter Moo2Complete!
Spam Wall – Edition 1
I’ve been running cnizz.com for about 4 years now and its served me well. I’ve gotten in touch with clients, gained new friends, and have easy access to reference materials no matter where I am. I also enjoy blogging about the many subjects you find on here. It’s been awesome, but there is a dark side though, that dark side is the amount of spam I receive.
How to Configure LogWatch on Centos
I recently discovered some dunce code was modifying our php.ini settings at run time preventing error logging in production. Not displaying errors in production is fine, but not logging them makes it difficult to fix bugs and generally makes me want to slap the developer that disabled error logging through an ini_set(). After fixing the dunce code I finally took a peak at the log and discovered a mountain of mostly PHP Warnings and a few fatal errors here and there. I decided to setup logwatch and document the experience here on my blog.
Logwatch analyzes and reports on system logs. It is a customizable and pluggable log-monitoring system and will go through the logs for a given period of time and make a customizable report. It should work right out of the package on most systems. On our Centos install the package was already installed so I just needed to make a few slight configuration changes.
Read Full Blog »
Setting up WebDav on Ubuntu 10
Finally got around to installing WebDAV on my home computer. Had to fight getting basic Apache authentication working, here’s what I did. Hopefully things go smoother for you. You’ll need to have apache and svn installed along with webdav which can be done using synaptic or aptitude. I gave a pretty good overview of setting this up in a previous blog. Once installed enable webdav using the following command:
Calculating Sample Size in PHP
How to return a sample size by population using PHP.
The formula is s = Z^2 * (p) * (1-p) / c^2 where , Z is the confidence level, and c is the confidence interval. Then:
ss = s / [1+(s-1 / pop)] where ss = sample size and pop = population size. Here is a simple PHP function I wrote the implements the formula.
function getSampleSize($pop){ //$pop = 10000; // population $Z = 1.99; // confidence level $c = .03; // confidence interval $p = .5; $top = pow($Z,2)*($p)*(1-$p); $bot = pow($c,2); $ss = ($top/$bot); return round($ss/(1+($ss-1)/$pop)); }
I wrote this as a way to randomly sample a table for errors. We’ll see if it works.
Resources: