A web development/programming blog providing info, tips, and tricks on programming languages, scripting, Linux, MySQL and more
How To
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 »
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 »
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 at 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 »

