Outlook Hates Line Breaks

If you’ve ever wondered why your plain text email message is randomly ignoring line breaks like \n or \r\n then you’re not alone. I regularly use PHPMailer to send off automated emails and usually in plain text to keep it simple.

What Outlook 2003 (and 2002 and 2007 versions apparently) likes to do is be super helpful and remove what it regards as extra line breaks. It won’t be consistent either within a single mail or across many but it will make the content difficult to read. What you thought would be new lines will now be joined up in places and it seems to happen more often the further through the content you go.

There don’t seem to be many fixes for this issue but there are a few work arounds to help out.

  1. Turn off this “feature” in Outlook in the Tools»Options menu. Honestly I’m not sure what use it is anyway. Unfortunately you’d have to do this on all the recipient’s computers.
  2. Use HTML in your email rather than plain text. Depending on your content and need for complete accuracy, perhaps more time than it’s worth.
  3. Add twice the number of line breaks where you currently have them. This seems to help but now your email is rather full of white space and may be more difficult to read.

Other than changing email clients, which is pretty unlikely, that’s about it. If you know of other options to try and get Outlook to not remove line breaks, please leave a comment below. This Microsoft KB article explains which versions of Outlook are affected http://support.microsoft.com/kb/287816.

MySQL Replication on Ubuntu with DRBD

I’ve been looking around for some easy and open-source ways to handle database replication for a handful of small but important MySQL databases. A few options were viable but usually included too many config changes for things like creating a new database. DRDB on a Linux server seems to be one of the fastest and easiest methods to handle database synchronisation for DR purposes, so this is the subject of this post. The content is a combination of two main sources from Mark Schoonover and the Ubuntu server guide and the gotchas I found along the way.

This post will show you how to create two MySQL servers that automatically replicate all their databases using DRBD. With Heartbeat installed on a third machine you’ll have basic fail over protection as well (we’ll do this in another post). Only one of the database servers will be active at any one time. Read more »

Using a WordPress Page for your Main Site Content

Official WordPress logoI thought I’d make more use of WordPress on wekadesign.co.nz since it’s very powerful and apparently was recently voted top PHP based CMS ahead of Joomla and many other top-notch products. It’s ease-of-use and interface are all excellent and the massive user base and huge number of plugins make it very attractive for almost any web publishing.

After moving the small amount of static WekaDesign content into Pages, I copied a couple of files (index.php and .htaccess) from my WordPress folder (./blog) into the site root, changed the settings in WordPress (Settings»General»Blog Address) and viola, anyone going to www.wekadesign.co.nz, now hits WordPress. Good. Step one done.

Now to change the default landing page to be a static Page rather than the blog. Just as easy, visit Settings»Reading in WordPress and change the Front Page Displays option to be your Page. Excellent, now everyone lands at the the WordPress version of my static content. But how do you now send people to your old default blog page? You can use http://www.yoursite.co.nz/2009/ to target certain groups of content by date or category if you have Permalinks setup, but I couldn’t find the way that WP builds the default blog page.

It’s not obvious, but that 2nd option in Settings»Reading holds the key. The Posts Page option is asking you to select an existing WP Page that will act as a placeholder and be that default blog page. So, if you haven’t already, create a new Page with a suitable name. The name is important as that’s the URL everyone will use and see for your blog. So if you call the Page “peanut butter”, your blog page will now be http://www.yoursite.co.nz/peanut-butter/. It doesn’t matter what the content of the Page holds as no one will ever see it.

There is a slight “gotcha” with the Page names, in that any name being reused will work, but WP will append it with an incrementing number e.g. “peanut-butter-2″.

To finish off, just create a nice link on your site somewhere like the Sidebar to your default blog page.

MS Exchange Local vs Hosted vs Google for 10,000 Users

After looking at some comments around Exchange Hosted Services, I thought I might do a quick (and very dirty) comparison between that and Google for 10,000 users. (This is no way reflects on the three options and may not resemble your reality).

MS Exchange Hosted Services would cost US$90k/month for company with 10k email users and selecting roughly half the options available (Communicator and Hosted Archive being two). That sounds really pricey vs local in-house servers and admins? I have no specific Exchange knowledge but say 20 servers across 5 virtual hosts, plus storage and backups is roughly NZ$350-400k as a one-off cost. Plus a team of seven admins to run it @ NZ$80k pa each is a five year cost of around $2.8 million, but lets say $3.2M to round it up to include a few software licenses and some power,cooling and floor space.

Google’s offering that I compared MS against is their Premier Edition of Apps. It’s US$50 per user per year and offers the usual email, calendar, resource booking, etc much like Exchange. I was expecting a few missing features but was surprised to see BlackBerry Enterprise Server (BES) synching and user and group provisioning APIs. It integrates with LDAP and offers Single Sign-On (SSO) so most of your users won’t see too much of a change – especially if they keep on using the Outlook client. The main issue for some businesses may be the 99.9% uptime guarantee – that’s 8h 45m down time per year. I’m sure there are a few features that Exchange holds over Apps but in many situations the cost may outweigh the benefit or it’s just not needed. Using Google Apps also unties you from MS Outlook and possibly MS Office, so this option may open the door to other savings.

So over 5 years for the 10k user company we have the following options:

In-house MS Exchange with 20 VMs, storage and 7 admins = NZ$3.2M

MS Exchange Hosted Services with a mid-tier option seclection @ US$90k/month = NZ$7.4M (at today’s exch rate of 0.72)

Google Apps Premier Edition @ US$50 per user per year = NZ$3.5M

Now one stands out there and not for a particularly good reason. The MS EHS option does include Communicator and Hosted Archiving as an option but I don’t see the extra value over staying with what you have or sending it all to Google. Add to both the off-site options, the project costs of actually implementing this and your own Exchange would have to be in a bad way or have some serious pain to go either way.

What are your thoughts on this one? Are my locally run Exchange costs way off for 10k users and are there any NZ based companies of a similar size (NZ Post’s 2100 users are on the way to Google Apps) that have taken either remote option? Is Google half the service or twice the value of the MS offering?

My last thought would be – just how reliable is that internet connection of yours?

Google Wave Invites

I have 10 Google Wave invites to give away. If anybody would like one, please leave a comment below or DM @mikemcmurray on Twitter. First in first served.

New Version of Kisimi Wiki is Available

I’m happy to announce that a new version of Weka Design’s free wiki software called Kisimi is available. There are a huge number of improvements in the 20091025 release. Here are some of the more important ones.

  • Page security allows you to dictate exactly who can view and edit your pages. Some people can edit your pages, some can view and everyone else can’t see a thing. Security is as finely grained as you want it to be.
  • Kisimi now comes with an upgrade option at installation time and things are a little smarter. Installation can take less than 2 minutes!
  • Longer pages with headings can automatically generate a table of contents section.
  • Users can specify a timezone so that the dates and times are relevant to their location.
  • Administrators can prevent new user sign ups. Handy for those sites publishing their documentation and support pages to the world.
  • Any user with an email address listed at www.gravatar.com has their avatar image appear in their preferences.
  • Tidier user interface with plenty of little shiny bits.
  • Plenty of bug fixes including those messages for PHP configs that show all warnings. It’s still recommnended that PHP is configured without warnings for production servers.

Just head to http://kisimi.wekadesign.co.nz to download the latest version and start managing your online wiki content better.

Upgrading to VMware Server 2 on Ubuntu 8.04

After downloading the latest Windows 7 RC I loaded it into VMware Server 1.06 that I installed on Ubuntu Server a while back. All going well until the Windows 7 installer wouldn’t see the disk I had created. It seems that Windows 7 doesn’t like the SCSI virtual disk, so I removed that and created an IDE virtual disk and restarted the install.

Things were much better until it came time to install the VMware Tools and nothing happened. Things weren’t exactly snappy and without the tools installed, they weren’t going to get any better. It was time to make the upgrade from VMware 1.06 to 2.0 and as it turns out, is much easier than previous VMware installs.

Overall I followed the instructions from the LinuxGazette website and things worked flawlessly, but there were a couple of extras due to the upgrade.

Firstly (and fairly obviously), make sure you stop your current VMware daemon/service before starting the install. The VMware installer is pretty good, but I’m sure that your virtual machines would appreciate being offline before things get messed up.

sudo /etc/init.d/vmware stop

If you’re upgrading from VMware Server 1.06 the installer will also complain about the vmnet and vmmon modules being left from a previous version. So we need to get rid of those – using the correct kernel version. You can get that with “uname -r”.

sudo rm /lib/modules/2.6.24-22-server/misc/vmnet.o
sudo rm /lib/modules/2.6.24-22-server/misc/vmnet.ko
sudo rm /lib/modules/2.6.24-22-server/misc/vmmon.o
sudo rm /lib/modules/2.6.24-22-server/misc/vmmon.ko

After that it’s plain sailing. Just follow the instructions to untar your VMware download and run the installer. Assuming you used the default locations in the previous install, your virtual machines will be untouched and start happily under VMware Server 2.0

One of the final things to note in the install is that the new client interface is all browser based. To log into your VMware server requires a password and the Ubuntu root user does not have one by default. So on your server be sure to run,

sudo passwd root

and set a nice secure password for when you head to http://servername:8222. Firefox users will need to give the site security certificate the OK and all browsers will need to install the plugin to use the console to view your machines.

Hooray – Windows 7 now installs the VMware Tools properly and runs pretty well. At the moment I have no sound and the limited graphics under VMware don’t allow Aero fanciness, but I can now test and develop in the Windows world while meeting all license requirements. The Windows 7 RC license is valid until June 2010 although don’t wait that long as it’ll start making life hard for you in March 2010. That’s almost a year of free OS from Microsoft!

Enable WakeUp from PS2 Keyboard in Ubuntu 8.10

One of the annoying “missing features” I’ve struggled with under Ubuntu is that I was unable to wakeup the PC from suspend or hibernate with my keyboard. Of course, Windows just does it – tap the keyboard and the PC starts up again. I could press the power button on the front of the PC, but its down the side of the desk and not easily accessible.

I found an older post in the Ubuntu forums that had the fix for USB devices and it also works for PS2 with the simplest of changes. So follow these steps and you should be saving power and getting back to work faster.

Open a Terminal and type,

cat /proc/acpi/wakeup

Note the entries that come back and you should see a device called “PS2K” toward the top if you have a PS2 keyboard. For those with USB, it’ll be one of the USB items toward the bottom. The entry will probably also have “Disabled” on the same line, hence your problem.

To enable this entry, switch to a root session by typing,

sudo -s

and enter your password. Now type the following to update the acpi file and toggle “disabled” to “enabled”, (those with USB devices can try USB0, USB1, etc)

echo PS2K > /proc/acpi/wakeup

That should have now enabled your PS2 keyboard to wakeup your PC for this session. Give it a test by putting your machine to sleep and then tapping a key on your keyboard. Probably a good idea to save stuff first, just in case.

If you tried changing a USB device, it may take a few guesses until you find the KB. My mouse was USB0 and clicking any mouse button can also do the wakeup task.

To make this change permanant, you need to add that line to a script and run it when Ubuntu starts. So we create a file called wakeup.sh with the following contents,

#!/bin/bash
echo PS2K > /proc/acpi/wakeup

Save it and from a Terminal make it executable so it runs properly as a script and not just a text file,

chmod +x wakeup.sh

Now to add it to the startup area go back to your Terminal that’s running as root. We need to copy the file to the correct location and add it to the startup processes. You’ll need to run the cp command in the same folder as where you saved your wakeup.sh file.

cp wakeup.sh /etc/init.d/wakeup.sh
update-rc.d wakeup.sh defaults

Now when you reboot, the script will run and enable your PS2 keyboard in ACPI so you can wakeup your PC.

Adding up Rows with JQuery

Simple and sometimes unnecessary function to add table cells together and populate another with the total. Using jQuery because its easy and it works and we all love it.

$(document).ready(function() {
    var x = 0;
    $("td.num").each(function() {
        x += parseInt($(this).html());
    })
    $("td#total").html(x);
});

Where your table cells to add up are <td class=’num’> and the table cell that has the total is <td id=’total>.

Print Processor Updates for Windows Queues

A while back I wrote about a few little tools from Microsoft that allowed an easy way to create remote print queues. One of the things I didn’t realise then was that another handy tool exists (in the Server 2003 Resource Kit) called setprinter.exe that opens up a few more options.

We use a non-standard print processor at work to insert barcodes on certain output from SAP. So to set all the printers on the print server or just one to use the new print processor, we just run,

setprinter \\myserver 2 pPrintProcessor="SAP Barcode"
setprinter \\myserver\printer01 2 pPrintProcessor="SAP Barcode"

Lots of other properties can also be changed using setprinter.exe, pretty much everything other than security permissions and for that you can use another tool in the RK, subinacl.exe. To view the properties of a queue and what you can change, just cycle through the property groups 0-9 (that’s the 2 in the above commands).

for %i in (0 1 2 3 4 5 6 7 8 9) do setprinter -show \\myserver\printer01 %i

Next Page »