A web development/programming blog providing info, tips, and tricks on programming languages, scripting, Linux, MySQL and more
How to reset the bash IFS variable
Jul 9th
Here’s a quick tip for everyone. I was working on a one-liner today at work that involved parsing through a file with some data in it. The data had spaces in it which can cause problems with the default $IFS variable (Internal File Separator). nixCraft has an excellent tutorial on working with the $IFS variable.
Read the rest of this entry »
What I learned from my first OWASP meeting (or why I will never use PHP Nuke)
Jul 6th
I just got home from attending my first meeting of the Phoenix chapter of OWASP. WOW!!! That’s all I have to say. The guest speaker was Mike Brooks, currently the top answerer and asker of security questions on Stack Overflow, who will be giving the same talk at the upcoming DEF CON 18. Mike gave an amazing presentation on chaining vulnerabilities in order to bypass layered security systems and ways of obtaining wormable remote code execution on a modern LAMP platform.
Read the rest of this entry »
Improve the performance of the WordPress plugin Statpress (and your blog)
Jul 3rd
I haven’t hid my feelings about the poor performing StatPress plugin for WordPress. However, performance issues aside, I will say that the information this plugin provides is useful, and detailed. I’ve been running this plugin for 8 months now and have a good sized data set (125,000+ rows of data). While I myself have not experienced as many issues with this plugin as I have seen on other blogs, it is mainly because I am running my blog on a virtual dedicated server as opposed to shared hosting. I have seen smaller data sets than mine cause problems on shared hosting servers.
Read the rest of this entry »
What do three “less than” (<<<) symbols mean in PHP?
Jul 2nd
I am a true believer in that the best ways to learn how to do anything is by studying work of those who have done the same thing previously. When programming, that means looking at others’ code and learning from what they do. However, don’t assume that everything someone else does is correct! What this means is that not only should you learn what to do from other peoples’ code, but you should also learn what not to do.
Read the rest of this entry »
jQuery tabbed content switcher
Jun 27th
Eat your heart out Sir Alexander Fleming! While my accidental invention of a jQuery tabbed content switcher may not be up there with penicillin, the pacemaker, and post-it notes, it sure did wonders for my latest web design project.
Read the rest of this entry »
CSS Sprites without the CSS (mostly)
Jun 21st
It’s been a while since I blogged. Hopefully I can get back into it on a regular basis now.
I came across an interesting post today titled CSS Sprites w/out Using Background Images. Now obviously I was intrigued as I’ve discussed how to use CSS Sprites before and have really been getting into them lately with some new killer projects I’ve been contracted to do. But this post, I just had to read.
If you read that post, and I suggest you do, you’ll see that the author talks about using Sprites without the use of a CSS Background Image. When I rolled over the examples though, I got a basic sprite functionality. But that’s what he was talking about. Although he mentioned they were just <img /> tags. I just wasn’t seeing it.
Soh Tanaka mentions that the goal was to make it simple for a client who may have multiple affiliate banners to upload and didn’t want his client trying to have to mess with CSS and creating custom classes and code. Good point. The way Soh went about achieving this was simple: Instead of moving the background image of an element, use an <img /> tag with the same sprite image and move the <img /> tag up with negative margins. The theory is identical, the execution is just different.
Instead of setting a background image on the element and doing a
background-position: 0 -182px;on the:hoverSoh does uses an actual <img /> tag and sets amargin-top: -182pxon it (182px was the size of the image, or half of it).
Now as author Chris Heilmann mentioned in the comments, this isn’t the best use of sprites in the world, and kind of defeats the purpose. But the functionality is there and it was something Soh did to make it easier on his client (which we’ve all done) and was just showing the technique for technique’s sake. By the way, Chris authored a fantastic JavaScript/DOM Scripting/AJAX book I have in my Tech Library. It’s definitely worth the read.
Anyways, I just wanted to drop this tip as I stared at it for a while utterly confused and wondering how this tip was any different as all I could see was the same sprite functionality. But, like I said, that’s the point. It still functions the same.
Our first WordPress Plugin: WordPress Woot Watcher
Feb 17th
In conjunction with Lee Thompson of MySQLHow2.com, we have released our first WordPress Plugin:
WordPress Woot Watcher
WordPress Woot Watcher, will monitor and check woot, shirt.woot, kids.woot, wine.woot and sellout.woot for new products every 10 hours. When a woot-off is launched, the widget will update the woot product every 30 seconds. WordPress Woot Watcher is a sidebar widget that enables select the woot sites you want to monitor in the administration section. The default installation selects woot.com only.
For all the details, installation, and more, visit the WordPress Woot Watcher page.
How to append values to an array in bash
Feb 4th
Last week I was working on a bash script for a project at work. The script parsed through a log file with server load and disk usage statistics at regular intervals. The script was calculating the average CPU idle time, disk utilization, and disk usage for servers. After calculating the averages for each of these three metrics, I then proceeded to loop through all the lines in the file and create an array of all the times when the CPU idle time was below average, or the disk utilization or usage was above average.
Read the rest of this entry »
Improve Your WordPress Blog’s Performance With this Database Hack
Jan 9th
**UPDATE**: After further research of the query below, I have found some additional information. The query was first introduced in WP 2.3 and is used for comment flood protection. I am currently running WP 2.9.1 and do not have the issue as the query has been modified and using a proper index to assist with the query speed. If you are using the latest version of WP, you won’t have this problem. I am still trying to find exactly when the query was changed so you all can know where you stand. However, I know that some people don’t upgrade their WP version due to changes they have made which upgrading will break. If you are on an older version of WP and have a large number of comments (tens to hundreds of thousands), this query will help improve your comment post times. If you are familiar enough with MySQL, look at the wp_comments table in your database. If there is an index on the `comment_date_gmt` column, you are ok. If not, read on, and run the query below as adding an index to the `comment_date_gmt` column won’t work as your query does not have that column in it’s WHERE clause.
One of daily responsibilities as a database administrator is maintaining the health of our shared hosting environment. In doing so, I deal with plenty of WordPress blogs daily. The one thing I have noticed is that many WordPress plugins are very poorly designed and can cause problems in a shared hosting environment. WordPress at it’s core though, is very well designed, although I have noticed some areas of possible improvement. As I come across common issues, I will post the fixes for them here for all to use.
Read the rest of this entry »


MySQL Quick-Tip: Target specific versions of MySQL with conditional comments
Jul 14th
Posted by Mark Stoecker in MySQL
No comments
I was working on a project over the weekend that required me to run some code relating to MySQL privileges across a large number of MySQL servers all running various versions of MySQL between 4.0 and 5.0. My initial efforts at this entailed writing out the version specific code and targeting the version with bash thusly:
This method involved a lot of code duplication. Yesterday, a co-worker mentioned using MySQL version specific comments, which I had seen before, but never fully understood.
Read the rest of this entry »