Monday, April 2, 2012

Joomla "rights" Meta Tag Fails W3 Validation

So, you've built a new HTML5 Joomla website and you're ready to deliver it to your client.  But first, because you're a quality conscious developer, you mosey on over to the W3 Validator to check it one last time.  And... what's this!??  You have an ERROR!  A meta tag with the name of "rights" is not a valid meta tag.  You'd never add this tag - where is it coming from??

Since Joomla 1.5, Joomla developers have reported that Joomla renders the meta tag, <meta name="rights" content="your text here">, that the W3 Validator fails to validate.  As near as I can tell, this issue has been closed by the Joomla team: http://joomlacode.org/gf/project/joomla/tracker/?action=TrackerItemEdit&tracker_item_id=26069

However, now as of Joomla 2.5 it's still not fixed.  Not really.  The "fix" requires that you leave the "Content Rights" field blank in the Joomla Global Configuration page.  That's not a fix - it's a hack.  There is no indication on the Global Configuration page that putting text here will produce an invalid meta tag.  And why have the field at all if it's main function is to produce the meta tag?  This field should still be used - it's useful info for your site and your theme - but it should NOT render an invalid meta tag.  Period.

Here's how to fix it yourself

Until the Joomla team decides to address this easy-to-fix issue head on, there is something you can do.

You could just tell your clients not to put any text in that field.  But that's not very professional (it's what the Joomla team did).  Or, you can add this code to your template to prevent the meta from rendering:

$doc =& JFactory::getDocument();
unset($doc->_metaTags["standard"]["rights"]);

That removes the offending met tag from the list of meta tags to be rendered.

While you're at it...

As long as you're messing with meta tags, you can also add your own tags
$doc->_metaTags["standard"]["geo.region"] = "US-GA";
$doc->_metaTags["standard"]["geo.placename"] = "Atlanta";

Final Note...

This meta fix can easily be made into a plugin. You might try this yourself - it would be a great "starter" if you've never written a plugin before but want to learn how. If you need help with the plugin, feel free to contact me.
Saturday, March 3, 2012

What Happens to Your Company if You Lose Your Data?

Backups are more important than you ever imagined

Backups aren't something you do to improve your business a little. You do backups because without them, you risk going out of business!! Yes, they are that important.

What would happen to your company if you lost your data? What if you lost all your email and your contact information? What if you lost your contracts and your accounting information? How long could you stay in business?

According to the research, you are very likely to go bankrupt and lose your business.

Strategic Research Institute:
Companies that aren't able to resume operations within ten days (of a disaster hit) are not likely to survive.
National Archives & Records Administration in Washington:
93% of companies that lost their data center for 10 days or more due to a disaster filed for bankruptcy within one year of the disaster. 50% of businesses that found themselves without data management for this same time period filed for bankruptcy immediately.
Research by Computer Economics:
American business lost more than $7.6 billion as a result of viruses during first six months of 1999.
"The Cost Of Lost Data", David M. Smith:
6% of all PCs will suffer an episode of data loss in any given year.
Home Office Computing Magazine:
30% of all businesses that have a major fire go out of business within a year. 70% fail within five years.
Mozy Online Backup:
Every week 140,000 hard drives crash in the United States.

OK, So what am I selling?...

Well... nothing. I'm going to suggest ways that YOU can do your own backups. But backups are a lot like your tax return: if you have a little training or experience, you can get by with doing it yourself. If you don't and you just "wing it", you can mess it up and risk very serious consequences.

So these recommendations are for those that can follow them competently!! If you're not sure than you can, then my recommendation to you is to hire a professional. It won't cost much and you can't afford the risk.

Here are some general guidelines that make sense in many common business scenarios.  Keep in mind that your business is unique, so this might not be the best solution for you.

What to backup

Here are common things to back up:
  • PCs and Laptops - either backup the entire hard-drive image, or backup the C:\Users directory (for Windows), or the /home directory (for Linux and Mac).  Backing up the entire image is best.  Then you'll be sure to have everything, and you can recover from a hard drive crash in about an hour, rather than after a day of having to re-install the operating system and all the programs.  If you're unable to do this, backing up the user or home directory will most likely include your critical data.
  • Servers - backup all of your companies shared files. If you run email services, backup your email. If you run a CRM, ERP, or other data-based applications, backup the databases.  Note that depending on your database system, you should do a database dump or backup, rather than simply making a file-level backup.
Make sure that your backup strategy captures:
  • Clients info
  • Vendors info
  • Contracts and other legal records
  • Financial and accounting records
  • Email
  • HR records
  • And other info specific to your business like Inventory, etc.

How often to backup

  • Backup your PC and laptop files at least once a day (if not continuously) to your server, to a jump drive, a CD, or DVD (or to offsite backup).
  • Do a "bare metal" backup of your PCs and laptops once a month
  • Do a differential backup of your file server once a day.  The reason to do a differential backup is because it's quick and it doesn't take up much archive space.
  • Do a full backup of your file server monthly.
  • Do a differential (or incremental if you prefer) database backup at least once a day.  For mission critical data, consider hourly backups or even data replication
  • Do a full database backup at least once a month
Note: store a copy of your monthly backups off site so that you can recover in case of a disaster to your office building.

Also note: if the cost of being without data for, say, a day is very high, then consider a redundancy solution (fail-over) where if a server fails, a redundant server becomes immediately available.  That means no down time.

Backup tools

  • CloneZilla - an open source, Linux-based solution that will create an "image" of your computers hard drive.  You can later restore this image to the same drive, or to a new drive in case your old drive is no longer serviceable
  • Rsync - an open source, Linux-based solutions that you can configure to store only files that have changed.  This gives you an easy way to mirror your data without having to copy all of your files all the time.  That saves you both space and network traffic.  Note that the rsync server runs on Linux and Mac, but there are rsync clients available for all 3 platforms (Windows, Linux and Mac).

Offsite Backup Services

One easy way to keep off-site backups is to store that backup medium (like a 2.5" hard drive, or DVDs) in a safety deposit box at your bank.  Another convenient option is to use inexpensive off-site backup services like Box, DropBox, ADrive, and others. If you do use offsite services, you should encrypt your backup files!  Don't depend on the security of the off-site backup service to keep your data private.
Saturday, February 4, 2012

Joomla .html Extensions + Sitemap.xml

The Problem

You have a Joomla site with search-engine friendly (SEF) page names enabled, and you've enabled .html extensions. So your pages look something like:
http://www.my-domain.com/home.html
To top it off, you'd like to use an extension like XMap by Guillermo Vargas to automatically generate your Sitemap. So far, so good. Here's the rub: you can't figure out how to make the link to your sitemap look like:
http://www.my-domain.com/Sitemap.xml
Out of the box, XMap's path to the sitemap looks something like:
http://www.my-domain.com/index.php?option=com_xmap&view=xml&tmpl=component&id=1

The Solution - Part 1

There are a couple of things you have to do to make this happen. First, you have to edit your .htaccess file. Find the line in your .htaccess file that looks like this:
## Begin - Joomla! core SEF Section.
and add these few lines of new code just above it so that it now looks like this:

## Begin - XMap rewrite

RewriteCond %{REQUEST_URI} ^/sitemap.xml [NC]

RewriteRule .* /index.php?option=com_xmap&view=xml&tmpl=component&id=1 [L]

## End - XMap rewrite



## Begin - Joomla! core SEF Section.

Note - depending on your version of XMap, the query string (the part that follows "index.php?") might be different. To find the right path, log into Joomla! as the Administrator and find the XMap component and find your sitemap. The "XML Sitemap" link has the right query string.

At this point, you should now be able to get to your sitemap by browsing to:
http://www.my-domain.com/Sitemap.xml.html
That's already much better, and if you don't mind the .html after the .xml, you can stop here.

The Solution = Part 2

This next step is a hack to the Joomla router. It's too bad that there isn't another way around this because if Joomla updates the router, your change will be lost. Unfortunately I haven't been able to find any other way around this.

Edit the ./includes/router.php file. Find the line that looks like this - in Joomla 1.7.5, it's on line 66 of the file:
if ($app->getCfg('sef_suffix') && !(substr($path, -9) == 'index.php' || substr($path, -1) == '/')) {

And change it to look like this:
if (!stripos($path,'sitemap.xml') && $app->getCfg('sef_suffix') && !(substr($path, -9) == 'index.php' || substr($path, -1) == '/')) {

Now you should be able to browse to this!
http://www.my-domain.com/Sitemap.xml.html
You can see an example of this on the em2 website. Notice that normal pages have the familiar .html extension, but the sitemap has the .xml extension.
Saturday, January 28, 2012

The Microsoft People's Operating System ("POS")

Since the Microsoft Vista Operating System has gained such a bad reputation among the technically savvy, I'm suggesting Microsoft rename it to the "People's Operating System" (or, "POS") so that the rest of us regular folk don't judge it unfairly just because the elitists who understand technology say it's bad.

Unlike other Operating Systms like the Linux OS, you don't have to do install the Microsoft POS - all you have to do is buy a new PC or laptop and the POS comes pre-installed. It's not free like Linux OS though - you pay for it as part of the cost of the computer.  That's a big advantage though for the majority of users who are happy to have Microsoft's POS.

There are a few special features of the Microsoft POS that you should be aware of:
  • It tends to crash more often than other OS's, and you can't always close your software applications (even if you're a competent Windows administrator - Microsoft's POS doesn't always allow you to kill locked processes). That's a handy feature that helps us recognize and deal with our control issues.
  • It frequently loses wireless connectivity, then the wireless tools lock up.  The only option is to close all of the work you might be in the middle of, and reboot.  Sometimes you have to reboot more than once.  That's OK though.  That forces us to take time out of our busy schedule to chill while we wait for the POS to boot - sometimes more than once.
  • You have to buy commercial anti-virus software and a good firewall if you want to secure the Microsoft POS.  If you're running Microsoft's POS on your computer without these third-party add-ons, odds are you are infected with several viruses.  That's Microsoft's way of giving back to the community - spending money on 3rd party software that wasn't included in the POS helps stimulate our economy.
The Microsoft POS really is quite an impressive Piece Of Software.  It's bound to remain a favorite of computer users for years to come.

About EM Squared

We develop custom softare in C#, Java, PHP, and Python, and we build websites using Joomla, Wordpress, and Drupal.

Find out more about EM Squared