Archive for GNU/Linux

An Update Weekend

Normally I’m quite conscientious about keeping up-to-date with upgrades, especially security-related ones. But in recent months my mind seemed to have been elsewhere and I let everything lapse. Oh I still read the security bulletins that went out - I just didn’t act on them. But this weekend I decided enough was enough and sat down and started updating all of my machines. All of them. I have a Mac running OS/X, a (cough) Windows XP machine and an Ubuntu machine. They all needed my attention and I made sure I gave it to them. There were innumerable software packages that had new updates/upgrades that I felt compelled to install, not counting the myriad patches from the likes of Microsoft’s “Patch Tuesday”. Backups to be done, scripts to be re-visited, drives to be analyzed and de-fragged, and yada-yada.

I sat back and thought about why some of my cron jobs weren’t executing, why Postfix was starting and a host of other imponderables and finally got everything working to my satisfaction. I don’t recommend waiting months to do this stuff; better to do it as it occurs - a lesson learned if I’ll keep to it.

Comments

Wordpress upgrade script

After having to do several Wordpress upgrades in the space of a single week I finally decided to sit down and write a little script to help automate this mess. Why Wordpress doesn’t provide such a script is rather beyond me. This is admittedly a rather brain-damaged script but it does work. Tailor to your own needs:

#!/bin/bash
#
# Script to upgrade Wordpress.
#
# J. Wren Hunt
# July 11, 2008

# Ensure that we have full MySQL root privs before we start
clear
echo "Change the username/password in wp-config.php to root, re-edit and re-run."
exit

# 1st, go to wordpress site and get the latest version:
echo "Retrieiving latest Wordpress upgrade."
wget http://wordpress.org/latest.tar.gz

# If wordpress dir exists, blow it away
echo "Nuking any prior Wordpress directory."
sudo rm -rf wordpress

# Unpack it:
echo "Unpacking the update."
sudo tar xvfz latest.tar.gz

# Backup blog sites
echo "Backing-up blog directories."
sudo tar cfz wrenhunt.tar.gz wrenhunt

# Backup the MySQL databases too - do a tar of the dir and a dump of the db.
cd /var/lib/mysql
#
echo "Backing up the MySQL dirs."
sudo tar cfz wrenz-wordpress.tar.gz wrenz-wordpress

echo "Performing MySQL dumps."
mysqldump -uroot -pXXXXXXXXX --add-drop-database --add-drop-table --databases --compatible=mysql40 wrenz-wordpress >  wrenz-wordpress_dump.sql
gzip wrenz-wordpress_dump.sql

# Now start the upgrade

echo "Nuking Wordpress wp-includes, wp-admin dirs."
sudo rm -rf /var/www/html/wrenhunt/wp-includes
sudo rm -rf /var/www/html/wrenhunt/wp-admin

cd /var/www/html/wordpress
sudo cp -rv . ../wrenhunt

echo "Now point your browser to http://wrenhunt.com/wp-admin/upgrade.php"

Comments

Christmas Certs

I don’t know how it ended up this way, but all my server certs expire on Christmas day. I guess I was bored and monkeying around on Christmas years ago and with a 1-yr expiration time, the practice continues to the present. Every year I expect the renewal to be easy and painless and it seems each year there’s just one “gotcha” that I forgot about. This year it was Dovecot, my IMAP server. I kept looking at my Postfix configuration completely forgetting all about UW-Washington and Dovecot IMAP configs, just underscoring the need for proper internal documentation - which I’ve now corrected! We’ll see how well I’m on target for next year!

Comments

BostonPHP June meeting: Object-Relational Mapping (ORM)

Like a lot of developers, I’ve been surprised by the sudden popularity of ORM tools and techniques sweeping much of software development recently. I have had good intentions to beef-up on NHibernate but like so many other things haven’t quite gotten around to it yet (so many things to do, so little time!) So it was with great interest that I anticipated tonite’s BostonPHP talk on Object-Relational Mapping (ORM) by Chuck Hagenbuch. Chuck is well-known in PHP circles for his work on the Horde project, which if you’ve ever used it, gives his words a lot of weight. I now know a heckuva lot more on ORM than when I started - but I’m still trying to find time to program all these great ideas into my own projects!

Comments

Wordpress upgrade

Today I upgraded our blogs from the Wordpress 2.0 –> 2.1 series. Actually its the second time I’ve done so as I aborted the first as the installation didn’t ‘take’.  The installation process, while relatively easy, doesn’t always work quite right if you don’t prepare properly, particularly by deleting existing files, directories, etc., This time I actually read the directions - Gasp!

All is well except there seems to be some javascript issue preventing me from using hyperlinks, image dialogs, etc., editing under the new MacBook running OS X and the latest version of Java and Firefox 2.  I’m not the only one with these issues though so at least I’m not crazy, but it looks like they could stand to do a bit more testing before release.

Comments

Gnats –> Eventum converter

I’ve got a Gnats –> Eventum bug database migration script in Perl if anyone is interested. Just drop me a line.

Comments

Thoughts of an interrupted juggler

In the hands of an idiot, all tools are alike.” - J. Wren Hunt

If you envision a juggler with ‘n’ objects in the air and then having to examine each object and say to yourself “How the hell can I examine this while its swirling all around me?”, you can empathize with my current dilemma. I have the idea for an exciting new product, huge by any stretch of the imagination, which is going to tax all the developer resources I have and then some. The objects in the juggling metaphor are new technologies which I need to master (or at least come to grips with) before I start laying down the first lines of code. It’s a classic “chicken or the egg” scenario.

Proponents in the Agile camp would have me start knocking out tests and then code (Test Driven, or TDD Development), while the classicists dictate having a solid design document to guide one with. I’m straddling the fence with a middle-of-the-road approach: get basic design stuff done, then attempt to work agilely.

By far the most encompassing decisions to make are to determine which platform(s) will the backends run on? Ideally I’d like for the code to be platform agnostic and run on everything but of course that will take markedly longer to develop. So right off the bat we have 2 choices:

+ Windows Server 2003 running IIS and SQL Server 2005

Cons:

- Cost. Microsoft ain’t giving these products away for free.

- WebService development is frighteningly easy.

Pros: - Easy-of-Use. Many tasks will be much easier than writing equivalent routines.

+ GNU/Linux running Apache, PHP5 and MySQL5.

Cons: - Rock banging. Some things require equivalent complex Windowsesque functionality to be redeveloped.

Pros: - Cheap. Scales well.

At issue are these absolutely brand-new technologies with which I have zero experience:

  1. Windows PocketPC (PPC) programming.
  2. SQL Server (both 2005 edition as well as Compact (CE) Editions)
  3. IIS
  4. Active Directory
  5. MicroSoft Message Queue (MSMQ)

(One of) the primary factors affecting which backend we ultimately choose concerns how data will be transferred and reconciled between client < --> server:

I could use SQL offline transaction sets with SQL compact running on the PPC and SQL Server 2005 on the backend and everything would “just work”. Its a sweet siren song tempting to any developer. But then I’m “locked-in” to Windows platforms only. We could eschew a tight coupling between client and server database technologies by using web services. This gives us more platform choices at the cost of writing data-conflict-resolution code.

Happily I think I’ve managed to find a way out of the labryinth I’ve laid for myself: Microsoft’s patterns & practices group to the rescue. I’ll admit to being a newbie when it comes to patterns. “Back in the day”, we didn’t use the term patterns - we just called it experience! But its an excellent idea, a way of formalizing and reusing experience just like we do with classes for code.

So now before I start writing code, I’m trying to get a handle on the various formal pattern types, names, software factories, etc., From what I can tell, Microsoft’s Enterprise Library Application Blocks will help reduce if not eliminate vast tracts of code which we would otherwise have to write. The beautiful part is that this approach will work even if our backend database changes (i.e., MySQL). I just have to learn how to navigate it first (without dropping the ball I started this metaphor with!)

Comments

thehuntison

“…there have been times in my life when I have been forced to eat my words, but on the whole I’ve found them a rather wholesome diet.” - Winston Churchill

Round 1: Jacob (AKA “Cheeky Monkey”) - 1 Wren - 0

The other day during our morning meeting Jacob and I had a little friendly “bet” on the hackability of this website, to wit: ‘wrenhunt.com’. Last night Jacob was able to get further than I thought he would yet I’m not quite convinced he got quite as far as he claimed; I think there’s a bit of leg-pulling going on!

I’m not going to divulge yet what he found until I have a chance to mull it over more in depth and do some research but I am indebted to be in receipt of the information - and getting ready for round 2!

Comments

Simple MySQL Replication

Behold! The magic formula for painless MySQL replication:

mysql> stop slave;
Query OK, 0 rows affected (0.00 sec)

mysql> reset slave;
Query OK, 0 rows affected (0.01 sec)

mysql> change master to master_host=’wrenhunt.homelinux.org’, master_user=’xxxx’, master_password=’xxx’, master_log_file=’mysql-bin.00xxxx’, master_log_pos=xxxx;
Query OK, 0 rows affected (0.02 sec)

mysql> start slave;
Query OK, 0 rows affected (0.00 sec)

Comments

Browns

Chatting with Adam the other day on MySQL vs. PHP generated hashes (PASSWORD vs. CRYPT) gave me an idea for a handy little command-line utility to manipulate and display various hash types. Since as all developers know, the most important part of any software project is the name, I’ve decided to call it ‘browns’ - as in “hash-browns”. Get it!? Bad pun I know.

Comments

« Previous entries