AlanBarber.Org
Twitter Updates
Tuesday, September 21, 2004
How to make an ExpressionEngine test site
How to make an ExpressionEngine test site for module and plugin testing
If you currently are or planning to do module and/or plugin development work for ExpressionEngine you really should have a dedicated private test installation of EE that you can work with. While you could use your public installation it’s not a good idea. Do you really want to have your public blog throwing out errors or completely being wiped out because of a bug in the module or plugin you were working on?
This tutorial will walk you through step by step on how to setup a test installation. The ultimate goal being that once you follow these steps you’ll have a clean install of EE that you can test your modules or plugins with. The benefit of following this guide is that at any time you can do a complete rollback to the fresh installation in just seconds. Should you accidentally blow up your database or mangle the configuration all you’ll have to do is run a simple command line script and bingo it’s just like new again!
A few things to point out before we begin. First off, this should work fine for any *nix OS but I am using FreeBSD for my server. Second, you will need command line access to your server. IE you’ll need to use telnet, ssh, or be working locally. Third, this does need to be a clean, private install. The install you do should be completely separate from anything else including the use of MySQL databases and server directories. Fourth, I’m using my real world setup as the example in the tutorial just to help make it clearer. You should change the names and directories where appropriate to match your setup.
Step 1: Installing EE
There really is no need to explain this. Just do a normal fresh install of EE. Create a new database and use a new directory structure separate from anything else. I created a new MySQL database and user account called “ee_test_site”. I installed EE in a separate folder “/home/abarber/public_html/ee_test_site” too. Just copy the EE image, system and user_guide folders into this new folder. IE “home/abarber/public_html/ee_test_site/images”.
Step 2: Configure and Setup the EE test site
Just go through and setup the test site. Set all the admin configurations, build the templates, create a few sample members, create a few sample entries, etc. Basically, you want to have the site setup just how you want it to look and act every time you do a rollback.
This is the most crucial step! You need to have everything exactly as you want it. We’ll be making a backup of the entire installation and the rollback will totally wipe out everything and reset it to how it is from the backup.
If for example you forget to set template cacheing on but really do want it on. Every time you do a rollback you’ll have to go in and turn on template cacheing because the backup had it off!
So take a few extra minutes to thoroughly check every single thing. Yes even the directory contents. If there are files you do or do not want in the backup manage them now. It’ll make life much easier later.
Step 3: Create backup directory
Someplace you should make a directory to hold and run the rollback from. I prefer to make a folder called “rollback” in my home directory. “/home/abarber/rollback”
Step 4: Make the MySQL backup
We’re going to use mysqldump program to create the backup.
At the command prompt type:
mysqldump -u ee_test_site -p[enter password]—add-drop-table—databases ee_test_site > /home/abarber/rollback/ee_test_site.sql
Step 5: Make the EE installation backup
We’re just going to make a simple tar gziped file with the contents of the website folder. That means the actual EE files, images, etc. Remember what I said above? This is your last chance to make any changes to the files in the backup!
At the command prompt type:
tar cvzf /home/abarber/ rollback/ee_test_site.tar.gz /home/abarber/ public_html/ee_test_site
Step 6: Create the rollback script
I call it rollback.sh and place it in the “/home/abarber/backups/rollback” directory.
—copy below—
#/usr/bin/sh
echo Rolling back EE Test Site blog…
echo Reloading database defaults into MySQL…
mysqladmin -u ee_test_site -p[enter password] -f drop ee_test_site
mysql -u ee_test_site -p[enter password]
< /home/abarber/rollback_data/ee_test_site.sql
echo Reloading EE installation…
rm -rf /usr/home/abarber/public_html/ee_test_site
cd /
tar xfz /home/abarber/rollback/ee_test_site.tar.gz
echo Resetting file and folder permissions…
chmod 777 /home/abarber/public_html/ee_test_site/images/captchas
chmod 777 /home/abarber/public_html/ee_test_site/images/uploads
chmod 777 /home/abarber/public_html/ee_test_site/system/cache
chmod 666 /home/abarber/public_html/ee_test_site/system/config.php
chmod 666 /home/abarber/public_html/ee_test_site/system/config_bak.php
chmod 666 /home/abarber/public_html/ee_test_site/path.php
echo Rollback finished!
echo
-- copy above --
Note - Remember to chmod the "rollback.sh" script to give it execution permission.
Step 7: Test the rollback script
Make a few changes in the control panel such as delete a few entries or delete a template or change a category name.
Now go to the rollback directory and type “./rollback.sh” at the prompt. Check the control panel again. The missing entries and changed categories should be back. If not we have a problem and need to figure out what we did wrong.
Now lets try something a bit more crazy. Just go in and start randomly deleting files until the website no longer works. Oh no! The site is ruined. Wait lets use the mighty rollback again! Sit back and watch in amazement as the backups are reloaded and your site is saved.
So what’s the point of all this you might ask? Software development is a science. When you’re working on a module or plugin it’s nice to always have a fresh clean install to do your tests. That way whenever you make changes to your software you can rollback the system and have identical test parameters. This helps to keep bugs from cropping up that are not a result of your software but the test environment being changed from a previous test.
This you may realize comes in very handy for module development since modules make changes to several database tables and probably create their own. That way you don’t get errors or bugs showing up because you have already installed 3-4 different versions of the module before. When you’re working on that module you know you have a fresh clean install every time you start testing it. It’ll make it just that much easier to debug!
I hope people find this useful. I’ll admit it’s probably not the clearest written tutorial but you should get the idea of how to set this up. I’m using it and it works great. I can screw around with the test site to my hearts content then just run the rollback script and it’s back to normal in 30 seconds.
Monday, September 20, 2004
Automatic Gmail Invite Giver-Awayer
This is for all you folks looking for G-Mail invites!
I found this thread today over at WebHostingTalk.
I give you the Automatic Gmail Invite Giver-Awayer.
This nice guy snakez has setup an automated gmail invite share system. Basically, you send invites to a special email address and his system automatically puts the invite into a queue. When a person visits the site and enters their own email address it sends the person a random invite. Pretty cool isn’t it. No begging on forums or using silly gmail matchup sites. Just head on over and grab a free invite.
So, If you would like an invite and don’t have one yet visit the site: http://gmail.snakez.org/.
Just do them a favor by sending an invite or two back when you can.
Sunday, September 19, 2004
FreeBSD PHP Ports Changes
It’s actually pretty old news I guess but I just got around to doing some updating on my FreeBSD installation today and found out some major changes have been made to the way PHP is now installed.
It used to be that you could do an install of php “/usr/ports/www/mod_php4> make install clean” and a menu would come up to lets you select the extensions to install. IE… support for mysql, session, xml, etc.
However now there are no options and you will get only a default base install.
To install the extensions you either have to do each one manually by finding them spread out around the ports tree. MySQL support is in “/usr/ports/databases/php4-mysql” for example. The easier way is to use the new php extension meta-port in “/usr/ports/lang/php4-extensions”. doing an “install” of this port will show the menu where you can select all the extensions then it will go out and do installs of all the extensions.
The notices are in the /usr/ports/CHANGES and /usr/ports/UPDATING dated July 17th, 2004. Just thought I’d point this out since I’m sure there will be a few folks to miss this like I did. Yes I know I should read the CHANGES and UPDATING files but like 90% of people I just run the updates on the ports and don’t check out things until something doesn’t work right!
** UPDATE (9/20/2004) **
Ok even after running the php4-extensions meta-port the modules were still not loading. After spending this morning searching the web I managed to figure out that the problem is the php.ini file has a misconfigured “extension_dir”. It appears default is set to “./” where as for php4 the actual location is “/usr/local/lib/php/20020429”.
If you look in the php.ini file found in “/usr/local/etc” for these lines:
; Directory in which the loadable extensions (modules) reside.
extension_dir = “./”
You can either comment out the extension_dir line by putting a semicolon before it or change the “./” to “/usr/local/lib/php/20020429”. A quick restart of apache and you should be good to go.
Tuesday, September 14, 2004
Another Job Rejection
Well… I got another rejection letter from the place I went in for the second interview last week.
Guess I’ll be scratching that one of my list as well. In fact, I think it’s time to just throw away the whole list. All of these jobs I’ve applied to over a month or more ago. If they haven’t contacted me by now well I don’t think they’re going to ever.
So lets call that round one. I put up plenty of good swings but at the bell I’m hurting bad. I guess this is the point that the coach would tell me I need to hunger for the win. To go out there and want it bad enough I can see it. They’re slapping on a bandage and giving me a squirt of water.
So here’s the bell and the start of round two. I see the win. I see the knockout blow. I see it alright!
Now all I have to do is make it a reality. Problem is I’m not a boxer, I’m a guy with a Computer Science degree and there’s apparently no where to use it.
Seriously, could someone explain to me what the fuck happen? All I heard through junior high and high school was how computers were the future. How in the next century there were going to be millions of jobs in the computer fields. I saw the crazy dot com days back in college. Where students were hired right out of college with huge deals. Cars, stock options, bags full of cash!
Then something happened. The economy turned to shit. The computer industry went from phenomenal growth to agonizing loss. This had to just happen just when I finished my education and I’m trying to enter the job market… err… I take that back. It’s no market! It’s a slaughter house. I feel like a damn cow in the line slowly making my up the shoot just waiting for my turn to die.
This is not how it’s supposed to be. I shouldn’t hate the idea of work when I’m just starting my professional career. I should be excited about finding a job and getting to go to work. I shouldn’t get up every morning and immediately be depressed as I realize I still don’t have a job and won’t for a while.
What the hell am I suppose to do? I’m serious! If anyone has the answer then for crying out loud just tell me!
Monday, September 13, 2004
Everything you wanted to know about blogging but were afraid to ask
This is a great little post I found just surfing from blog to blog. Honestly, I’m not sure how I even ended up there!
I give you “Everything you wanted to know about blogging but were afraid to ask” at Simon World.
Here are my five favorite points from the list: (original quotes are in bold. My response is in plain)
* If you think this blogging caper is a path to fame and fortune, give up now.
That’s the truth! I’ve been doing this for over a year now and I’m still just as unknown and poor as when I started. I have been lucky enough to have free hosting thanks to a good friend and even gtt a free license to Expression Engine. Still I’ve paid plenty in for domain fees and hosting in the past. Lets be honest here, the Google Ads, while great, aren’t going to let me retire anytime soon.
* It’s not fair. It never was and never will be. Deal with it.
This reminded me of how many bloggers start complaining when they start getting a lot of attention. I’ve seen many a blog shut off comments or even kill the entire blog as soon as they get any negative attention. If you don’t have the cajonies to take a little negative criticism then don’t start a blog people. Not everyone is going to love you and what you believe in. They even might tease and harass you but don’t go run and hide. Stick it out. You might have a bad week but remember we live in Internet time now. You’re fame will pass just as fast as the star wars kid or that girl in the apple switch ads. Don’t threaten lawsuits and other crap. Just ride it out and you’ll end up fine in the end.
* Learn to spell or how to use a spell-checker.
It amazes me how many blogs I go to that have horrible spelling mistakes. Let me put out a word of advice from a fellow blogger folks. Write your posts in your favorite office application, be it Word, Open Office, StarOffice, etc. They all have spell checkers!
* Forget what your schoolteachers told you. Form matters more than substance. If your blog is a hideous pink colour the best content in the world won’t get people coming back. Invest effort in your design, or get a pro to do it for you. People respond a lot better to good designs. The key is simple: if you think you right good stuff, keep the design simple. If you write cr@p, then use as many distractions as you can.
I’ve ranted about this before. I can’t stand how many “blogs” I go to that have the more disgusting layouts and schemes in the world. Let me give you another hint folks. 8 point purple text on a black background is not easy to read! Take a second and open your favorite book or magazine. Notice something? See that black text on white pages? They don’t do that because they’re not “hip” or “in style” people! They do it because it’s easy on the eyes to read. Try it! You might just find people visit your site more when you don’t make their eyes bleed.
* There is no greater diversion than your own blog. You will spend hours getting the coding right, the format right, the content right, fixing links, trying to get readers, reading other blogs. You don’t get paid for it. In fact blogging is the one game where the more successful you are the more it costs you (e.g. in bandwidth charges). It really is a sucker’s game.
Heh… boy isn’t that the truth! I wish I would keep track of how much time I spend tweaking and playing with my site. I’ve probably wasted hundreds of hours. I should know better but hey, long as it’s fun I’ll keep slogging at it.
Now go read the rest of the list.
Saturday, September 11, 2004
9/11 - Three Years Later



Has it really been three years? That seems like such a long time ago and yet… It’s like it just happened. I think that is the most important thing. We must never forget!
There are those out there that scoff and say too much energy and time is spent talking about the terrorist attacks on September 11th, 2001. I can only tell you this. We must learn to accept and move on but not ignore our history. If we do we are bound to repeat the mistakes which allowed the events to unfold. What happened was not just a failure of government or intelligence groups. It was a failure by civilized society at large. We failed to take threats against our way of live seriously. We became complacent and spent too much time celebrating our own greatness.
I don’t focus on 9/11 because I can’t get over the horrors that I witnessed. I focus on 9/11 because it was a wakeup call! It showed everyone that the world isn’t the wonderful little happy happy joy joy land that we thought it was. There are some seriously deranged and evil individuals out there. While we may try to be accepting of their different views and ways of life they do not. They see us as a threat and they are willing to spill blood to destroy us. We can not sit by idly and hope things get better. We must be active to protect ourselves.
Last year I made a post about where I was and what my first reactions to the events were. For those interested you can read it here:
9/11 reactions - A look back