A web development/programming blog providing info, tips, and tricks on programming languages, scripting, Linux, MySQL and more
How To
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 »
mysqldump: Got error: 2008: MySQL client run out of memory when retrieving data from server
Dec 7th
I came across this error today while at work. While trying to process a MySQL dump of a database of approximately 8 GB in size, I got the following error:
mysqldump: Got error: 2008: MySQL client run out of memory when retrieving data from server
This occurred on a MySQL 4.1 server. To get around this, you will need to use the -q switch as part of your mysqldump command.
This option is useful for dumping large tables. It forces mysqldump to retrieve rows for a table from the server a row at a time rather than retrieving the entire row set and buffering it in memory before writing it out.
(source: MySQL :: MySQL 3.23, 4.0, 4.1 Reference Manual :: 4.5.4 mysqldump — A Database Backup Program)
Your full command should look something like this:
$ mysqldump -u user -p password -q database > outfile.sql
How to Read Email Headers
Jun 19th
Sooner or later, people who run their own server, or email server, are going to run into email issues. In earlier posts, I discussed how to configure an alternate port for Qmail as well as how to test if your email server is working. This post touches on how to read email headers which can be useful when your email delivery is delayed to find out where the delay is occurring.
Read the rest of this entry »
How to Post to Twitter from a Linux Shell
Jun 18th
I had a little downtime today and work and decided to write a shell script that I could use to tweet from the shell of my Linux server. The reason is that Twitter is one of many social networking sites that is blocked at my workplace. However, I do have access to my server and found a great one-liner on commandlinefu.com to update twitter via curl. I decided to expand on this a bit and wrote a shell script that offers a bit more than merely posting a tweet. Check out my shell script to post to Twitter here.
How to Create a File of a Specific Size on Linux
Jun 16th
I was doing some testing the other night of a web-based file uploader I had built into one of the websites I had developed. The website is hosted on a GoDaddy.com shared hosting account
and allows my client to upload images, videos, and documents to her website directly through the browser. We had been running into a problem though with some files not uploading properly and I had a feeling it had to do with PHP limits imposed by the server. Even though I had raised the limits in a php.ini file, I thought those might be getting overwritten by the server.
Read the rest of this entry »
How to Insert Google Ads into the Content of your WordPress Post
Jun 15th
Have you ever wondered how to get your Google Ads inside your post content like I have below? A couple of days ago, I was trying to figure out how to insert Google Adsense Ads directly into my post content without pasting the whole Adsense code. I came across an article that detailed exactly what I was looking for: Insert Google Adsense Code Anywhere In Your Wordpress Article.
Read the rest of this entry »
How to Configure an Alternate Port for Qmail
Jun 11th
I had initially posted instructions on how to change the default Qmail port. However, an associate of mine pointed out the fallacy in my instructions. Changing the default Qmail port will prevent email from being delivered to your server as foreign mail servers will try to connect to your server on port 25 and if you change it, you won’t be able to receive email. I completely forgot about that little side effect when I posted this and have thus changed this post to only show how to configure an alternate port for Qmail.
A couple days ago I wrote about how to troubleshoot an email server when it isn’t working. This post isn’t necessarily follow-up to that, but more of a corollary. One of the things I didn’t mention in that post is what to do if you are running an email server and your ISP does not allow outgoing connections over port 25, the standard SMTP port. Many ISP’s have this policy to cust down on Spam sent through their servers, mine included. So when I tried to connect to my email the other day through Mozilla Thunderbird, I ran into a problem. I knew what I had to do. I had to configure Qmail to use an alternate port.
Read the rest of this entry »
How to fix a broken WordPress RSS feed
Jun 9th
Looking over my analytics for my blog the last couple days, I’ve noticed I have got a couple of referral visits from my web design company website. I added a FeedBurner widget to the front of that site highlighting my 5 most recent blog posts. Out of curiosity, I was browsing on that website and notice the Widget stated “Watch this space for future items!” Well that was just weird to me since I post every day. Upon further research, FeedBurner was showing an error “There is an issue that must be addressed with your source feed for the feed”. When I went to my actual feed URL, I got the following error:
XML Parsing Error: XML or text declaration not at start of entity
Location: http://www.poundbangwhack.com/feed/
Line Number 2, Column 1:<?xml version="1.0" encoding="UTF-8"?>
^
2 SUREFIRE ways to test if your email is working
Jun 8th
We’ve all ran into those problems where all of our sudden, we can’t send email and we don’t know why, and don’t know what to do, besides call our email provider. One thing I’ve been focusing on at work lately is empowering our customers to “take ownership” of their servers, to help them figure things out on their own. The way I put it, being a server administrator is like getting married; “through good times and bad.” The problem is most administrators (or wannabe administrators) only want to be the admin when the server is running. Once there’s a problem, they expect us to be the admin. Sorry folks, but that’s not how it works.
Read the rest of this entry »

