Mark Stoecker

This user hasn't shared any biographical information

Homepage: http://www.poundbangwhack.com


Posts by Mark Stoecker

MySQL Quick-Tip: Target specific versions of MySQL with conditional comments

July 14, 2010 - 12:02 am

Tags: , , , , , ,
Posted in MySQL, Quick Tips | 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:

 VERSION=$( mysql -u$user -p$password -S $socket -e"SELECT VERSION();" | cut -f1,2 -d. )
 if [ $VERSION = '5.0' ]; then
  # Execute 5.0 code
 elif [ $VERSION = '4.1' ]; then
  # Execute 4.1 code
 elif [ $VERSION = '4.0' ]; then
  # Execute 4.0 code
 else
  echo "Unable to determine version
  exit 1

This method involved a lot of code duplication.

How to reset the bash IFS variable

July 9, 2010 - 4:53 pm

Tags: , , ,
Posted in How To, Linux, SSH/Command Line | No comments

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 [...]

What I learned from my first OWASP meeting (or why I will never use PHP Nuke)

July 6, 2010 - 10:23 pm

Tags: , , , , , ,
Posted in Development, Linux, MySQL, PHP, Security | 1 comment

Like I said, I learned a lot (much more than I though I was going to) at the meeting and look forward to attending every month. I highly suggest checking for an OWASP chapter in your area and attending monthly meetings. In closing, I’d like to leave a list of some of the things I took away from this meeting:

Improve the performance of the WordPress plugin Statpress (and your blog)

July 3, 2010 - 11:15 pm

Tags: , , , , ,
Posted in Blogging, MySQL, Wordpress Plugins | No comments

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.

What do three “less than” (<<<) symbols mean in PHP?

July 2, 2010 - 1:47 pm

Tags: , , , ,
Posted in Linux, PHP, SSH/Command Line | No comments

To teach myself PHP, I started out reading Beginning PHP4 (Programmer to Programmer). After that, I begin studying others’ code. One of the first things I learned from other peoples’ code was heredoc syntax. It took me a while to fully understand what it was and how to use it, but now I use it all the time and it is a fantastic tool.

jQuery tabbed content switcher

June 27, 2010 - 10:08 pm

Tags: , , , , , ,
Posted in Development, How To, JavaScript Scripts, Web Design, jQuery | No comments

I was working on a new web design last night early this morning I found myself struggling (probably more than I should have been) with creating tabbed content switcher (hover over one element changes the content of another). I knew the right way to go was jQuery, and I wanted to avoid downloading a plugin as that would likely end up with more code and another HTTP request to the server. As I was working on the content switcher, I had one of those “Let’s try this and see if it works” moments (those tend to work all to often for me). It turned out that it did half of what I needed, so I removed another line and voila! I had my content switcher.

CSS Sprites without the CSS (mostly)

June 21, 2010 - 1:26 am

Tags: ,
Posted in CSS | No comments

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.

Our first WordPress Plugin: WordPress Woot Watcher

February 17, 2010 - 10:23 am

Tags: , ,
Posted in Development, Wordpress Plugins | No comments

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 [...]

How to append values to an array in bash

February 4, 2010 - 1:14 pm

Tags: , , ,
Posted in How To, Linux, SSH/Command Line, Shell Scripts | 9 comments

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 [...]

Improve Your WordPress Blog’s Performance With this Database Hack

January 9, 2010 - 10:52 pm

Tags: , , , , ,
Posted in Blogging, MySQL | No comments

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.