WordPress Global Translator and FireStats

 Update:  For those of you interested in getting Global Translator 0.6 to work with FireStats, go here.

 I've had several requests from people who use Omry Yadan's FireStats and want to use Davide Pozza's Global Translator Plugin, as the two plugins tend to behave poorly together.  For anyone that hasn't used these two together, what happens is the wrong source page is sent to the Google Translation service, and readers receive either a 404 or a white blank page.  This appears to be a mod_rewrite issue that only affects Global Translator.  Luckily, there is a very quick and dirty fix that will resolve the issue.

First off, I'd like to say that this fix has been tested on both WordPress 2.0.x and 2.1 with FireStats 1.1.0 through to the current 1.1.5 Stable and Global Translator 0.4.1.  I have not updated to the most current version of Global Translator because this one suits my needs just fine.

Now the fun stuff.

There are only two lines that need to be changed in the translator.php file found in your /wp-content/plugins/global-translator/ directory, and in the translate function.

$url_to_translate = BLOG_HOME . '/' . $url;
should be changed to:
$url_to_translate = preg_replace('(it|ko|zh-CN|pt|en|de|fr|ja|es|ar|//)', '', $_SERVER['REQUEST_URI']);

And below that:
$resource = $translator_base_url . $language . '&u=' . $url_to_translate;
should be changed to:
$resource = $translator_base_url . $language . '&u=' . BLOG_HOME . $url_to_translate;

These changes eliminate the $url variable's use from the translate($lang, $url) function, but the second variable should not be removed from the definition.  This is not a complete solution to the matter, but it's a quick solution that will work for the majority of sites.

Keep in mind that you need to use "Date and Name based" permalinks and your .htaccess file should be updated acccordingly (this is done by WordPress automatically if the appropriate permissions have been granted).  All of this is outlined in the Global Translator instructions, but it's a critical component that I've seen missed elsewhere.

For anyone that has not used these plugins, I highly recommend them.  The Global Translator is a great way to help foreign visitors enjoy your site (despite the occasional inaccuracies in machine translation), and FireStats will give you a great idea of where your readers are coming from and what browsers they're using.  This last point is important if you are designing sites to be optimized for certain browsers.

If there are any questions with this change, just drop me a line.  I'll be sure to offer what help I can.


As requested, here is the modified translator.php file that I use on this site.  Please note that this is from version 0.4.1 rather than the current release.

Before using this file, please make sure that your site has the "WordPress should compress articles (gzip) if browsers ask for them)" checkbox cleared.  This can be found in the Options menu, under Reading, down at the very bottom.  Several users have reported that after this is cleared out, Global Stats will work without fail on their site.


Amazon's Typo? Or Intentional 'Glitch'?

Today I was reading on SlashDot about a promotional problem that Amazon encountered just before Christmas of last year, and their subsequent method of recovering lost earnings from this problem.  At first I found their solution to be wrong, but as I continued thinking about it, I realized that Amazon is partially right to pursue their course of action.

The jist of the problem is this:  Amazon advertised a "Buy One, Get One Free" DVD promotion, and the online shopping cart would glitch when the order was placed, effectively allowing a buyer to get two DVDs for free or a small fraction of the actual cost.  Shortly thereafter, Amazon sent an email to customers asking that they either return the unopened merchandise to them or their credit cards would be charged for the proper amount.  People who did not respond to Amazon's request had about a month before the company started putting through (what some consider) to be unauthorized charges on their cards.

When I first read this, my initial reaction was: "No.  If Amazon screwed up their pricing, then Amazon should take the hit."  But then I started thinking about this from a legal point of view.  In many countries, this would be considered theft.

The customers knew that Amazon had a pricing glitch in their system.  Some may have even taken gross advantage of this glitch ordering dozens or hundreds of Box Set DVDs for a fraction of their actual cost.  Many legal systems make it the obligation of the consumer to advise the retailer of this error and ensure it's correctness.  If the consumer does not let the retailer know, then the store does have the legal right to go after the consumer for the remainder of the proper balance within a short timeframe.

I'm forced to agree with Amazon regarding their recovery policy.  Customers would have seen immediately that two or more DVD Box Sets were incredibly under-priced at the Check-Out.  Why didn't these people say "Wait a minute?  This is only going to come back to haunt me if I take advantage of this." ?  Where is the moral compass of the people who may have abused this error?

There are way too many people who think that the world owes them something for nothing.  The loudest shouters are usually the ones who knowingly break laws and agreements for their own personal gain thinking that "big giants like Amazon should take it up the rear" when a mistake is made.  But Heaven forbid someone does the same to these people in a sale.

Some conspiracy theorists believe this was just a tactic by Amazon to boost their bottom line during the busy Christmas season.  However, I see no pattern to this.  Web-based companies have made mistakes before.  We're all human, and are not impervious to the occasional typo.  While it might have been prudent to have someone test this on the live web server, consumers should know the difference between right and wrong.

Just because we can do a thing, does not mean we must do a thing.  Greed will only consume us.

If There Was Ever a Crew In Need of Shore Leave ...

I feel so bad for the crews manning five Japanese whaling vessels.

It seems that since leaving port the crews have had to deal with super cold weather, constant hassling from a small group of environmental terrorists, and now a fire on their primary ship.

First, I'd like to say "WTF!?!" to the environmental terrorists that have been harassing the people on these vessels.  They call themselves the "Sea Shepherd Conservation Society", but I think it's a typo on their part.  I think they meant to call themselves "Unemployable Jackasses From Mars".  I use the term "terrorist" as a descriptor because of the tactics they employ.  I can't believe this is a Canadian organization … it just doesn't make sense.

I can understand that people may not be happy with whaling, considering how we (humans) have been hunting these creatures for centuries to harvest not only for food, but lamp fuel, mechanical lubricant and a host of other uses.  We've brought some species right to the brink of extinction in our carelessness, but we've learned from our mistakes and many species are begining to make a slight comeback.

Do these life forms deserve to have some kind of protection from us?  Absolutely.

Does this give other humans the right to be retards?  No.

There are ways to accomplish goals in this world, and there are ways to make yourself look like an idiot to the world.  I admit that I look like an idiot quite often, but even I have my limits as to how far I'll sink in the eyes of my peers.  The fishing vessels that were being harassed were operating on legal permit from their government.  If the Sea Shepherd's want to raise a stink, they should discuss it with our politicians and request some form of dialog be opened with the offending government.  If these "conservationists" want to send a vessel out to monitor the actions of these whaling vessels to ensure the legal limits are not breached, and no other endangered species are accidentally captured or killed, then so be it.  But observe.   Don't assault crew members with bottles of acid.

I often wonder where these groups get the money to make all these global trips.  Filling an ocean-going vessel with enough fuel to chase five Japanese cruisers around the Antarctic isn't cheap.  You'd think the SSCS would send some more intelligent people instead.

I'll admit that it's not easy to get governments to listen to the people they've sworn to serve.  They have lots of people shouting at them, and only so many hours in a day.  While working with governments it's often wise to show some form of restraint to ensure your messages are better heard.  Being stupid will just destroy any credibility you may have once carried.

It's also important to look at why certain countries are whaling, and try to offer solutions to their needs.

Greenland, Iceland, Norway and Japan are some countries that still whale.  But these countries do not go out and slaughter these creatures en masse.  Each country has their own imposed limitations.  Greenland and Japan still eat whale meat.  Iceland collects less than 40 in the name of science.  Norway also gets a few under the guise of science.  While these numbers are still higher than the zero that many conservationists would like to see, it's a much better sight than the horrid slaughter that took place by many of the European nations up until the early 20th century.

I'm not saying that we should go out and take the life of whatever animal we choose so long as we benefit from it.  Heck, I still have a hard enough time eating meat twice a week knowing that something died to give me nourishment.  But while the earth seems to shrink all the time, the planet is still large enough for most of us.  Rather than make yourself look inept on a global scale by sending your dullest, it may be better to work with the systems in place with your brightest.  It's not perfect, but only through open and frank discussion can differences in opinion be ironed out and a compromise met.

I only hope it happens before potentially irreversible damage is caused.

Isn't It Time We Stopped Being Scared?

It seems that since September of 2001, the media has made it a habit to scare the public into paying attention.  While this may have worked great for the first few years, isn't it about time they change tactics?

In the last few years we've heard how everything and anything can be used against us by terrorists, pedophiles, bored children and the government.  A perfect example of this unnecessary fear mongering would be the recent Vancouver Sun article talking about a possible terrorist threat that a city-wide WiFi network would introduce.  This is the fourth "possible threat" that has plastered the newspapers and news channels in the last 3 days.

I hate the be the bearer of bad news, but a 4-inch aluminum pipe purchased at Home Depot and stuffed full of incendiary material for a total cost of $30 is much more likely than some Al-Queda member sitting in some remote part of Vancouver with a notebook and hacking some dam, causing it to release too much water and flooding a city.

Of course this raises another question.  In the article, they say:

"The plan calls for much of the city's infrastructure, from traffic signals and TransLink systems to BC Hydro generators and Terasen gas meters, to use the wireless platform for communications and remote operations."

What genius thought of this?  Someone in the higher levels of management, clearly.  This is about as intelligent as hiring a convicted theif as an armoured truck driver.  Critical infrastructure shoud never be placed on a public network.  Anyone who thinks this is a great way to save money is just asking for trouble.  Because of this, I highly doubt it will actually come to pass.  Informed technology consultants will likely recommend against this kind of design as it's just foolish.

Humans are a pretty clever bunch.  No sooner had we learned that we could more effectively kill healthy animals with spears that we were doing the same to our cave-dwelling rivals.  You take almost any tool that we've created, from the wooden club to the wrench to the pen, and if we've found a way to use it to our advantage for a purpose it was not intended to serve.

A city-wide wireless internet infrastructure would be pretty cool.  The likelyhood of the city connecting critical devices such as hydro-electric dams, traffic lights and bridges to this network is likely nil.  Like every other subject that's been in the news recently regarding some sort of technology and a faceless criminal who'll take advantage of it, this story was likely conjured up and misconscrued long before it even made it to print.

We know that fear sells.
… The media breeds fear.
… … Is big media our faceless terrorist enemy?

Somebody tell Dubya!  The terrorists were here all along!

It's time we stop being scared.  The world is no worse today than it was 100 years ago.  Sure, we have more tools to bastardise for terrible acts, but we also have more tools to use for incredible feats.  Let's focus on our potential rather than some abstract "what if?" fantasies.

Learning More Than I Wanted to Know

Typically I will not discuss work on this site, but this is going to be an exception.

For the last few days I've been working on a problem that one person has faced when sending email through a powerful software package called SugarCRM.  This is a great application and I would recommend it for anyone that's looking for a slick web-based CRM suite.  That said, there are occasionally some pains from time to time when users uncover specific areas that have not been fully tackled by the programmers.

Last week, one of those issues was passed to me.  A user who had a special accent in their name was reporting their displayed name would show up very weird whenever an email was sent.  This looked to be a character set issue, but after several hours, this proved to not be the case.  Over the course of the next 60 hours I learned how emails worked, their history, their requirements and read seemingly all the RFC's that have been published on the subject in the last 20 years (including the 1993 RFC on the Japanese Japanese Character Encoding for Internet Messages).  After all this time, I had determined where the problem originated and resolved the matter for the user.


I had never thought I would need to learn so much about email.  Now that I have, though, I can see why certain decisions have been made over the years regarding the many different standards that are out.  I'm also confident enough in what I've learned to actually build an alternate version of PHP's sendmail() function should it become necessary.

Now the hard part will be billing the appropriate customer for the right amount of time … for the sake of a single user's display name, we will be billing them 60 hours of work.  Somehow I doubt that it will fly.

Times May Change, but People Don't

This is a story from last week, but speed is irrellevant to something as timeless as love.  Last week construction crews unearthed a pair of skeletons that have been dubbed a pre-historic Romeo and Juliet.

In this caffiene-induced world full of fast cars, fast computers and fast foods, it's good to see that some things never change.  This pair met their end together, the depth of their feelings apparent by the position they were found in.  Naturally, it's only our imagination that creates their story, but it's one that's as true today as it would have been so many thousands of years ago. 

Despite the constant distractions we face on a daily basis, we all eventually fall in love.  When we picture our end, which even the most positive of us will do from time to time, we want to know that we were loved and that the person who is most important to us is there.  Nobody wants to die alone, even if that's what they say.

Human experience is as unchanged today as it was ten thousand years ago.  Our environment has altered drastically, but what makes us all human has  not.  Skeletons like this have been found all over the planet.  What I like about this the most is that it shows that no matter where we may have come from, we all share many common traits.

Race, color and gender mean nothing in the grand scheme of things.  These self-imposed constructs only limit our acceptance of each other.  I only wish that the people today would realize this.

Open Invitation to DSL Providers in Vancouver

To mark the 100th published post on my site, I was hoping to discuss something cheery and positive.  Instead, I've just spent the last 10 minutes fighting with Telus regarding their unreliable service.  I will not take their consistent failures any longer.  I'm looking for a new ISP.

I don't ask for much, really.  I would like to be able to have a sustained 40 Kb/s stream so that Reiko and I can video chat in peace.  I would like to have notice when upgrades or service interruptions will be happening.  I would like to have roughly 130 Gig per month of transfer.  And I would like to have a tech help desk that can answer my call in less than half an hour for those rare occasions I need to call in (which is usually only during a prolonged outtage).

I'm currently spending $80 with Telus, for my phone and DSL service.  I'll gladly pay $100 to any other DSL provider that can offer superior reliability.  I don't need VoIP, or port 80 usage.  I don't need any special packages, per se.  Just a nice, reliable connection to the internet, with speeds that are suitable for video chatting two hours a day and IRC the rest of the time.

I admit that I will be using Torrents quite a bit (note the 130 Gig of transfer requirement), and I will be sharing the connection across 2 PCs.  I will not need seperate IPs.

I don't think my requirements are out of line.  I think that providing something like this would be simple for any 1.5 Mbit service, though I would enjoy 3.0 or higher.

I know there aren't too many residential DSL providers in the Vancouver area, but someone else must provide an alternate option for those that have gotten tired of the Shaw and Telus limitations … right?

I'll begin my investigation.  Hopefully I can make the switch in the next few weeks.  The $120 Telus cancellation charge isn't even a problem if it means I don't have to deal with such an inconsistent and unworkable network.

A Slight PHP Hiccup

What a terrible time for things to break down.

Yesterday I had decided to format my PC for the first time in quite some time, and after it was all said and done, I tried to access my website only to find a white screen waiting for me.

Not cool.

Since I had been able to connect the day before, I had thought that perhaps I didn't have an update for Opera or IE, but this wasn't the case.  The main website could be viewed by anyone … but I just couldn't log in successfully.  Apparently, one of my personal PHP functions was malfunctioning after a recent upgrade and I had to find out what the heck, and then fix it.

What's really nice about the failure is that I could find out why my WordPress installation would sometimes react in an unpredictable fashion.  Often times after making a change to a theme or activating/deactivating a plugin I would be stuck at a white screen, but I could get around this by refreshing the page.  It's clear that I should have done a bit more testing of my code before deploying it, even though it's just a personal plugin.

Either way, I have about five posts waiting in the queue to be published, so I guess it's time for me to start writing more regularily here.

Taking a Break

After 97 entries on a mostly-daily basis, I think I'm going to take a short break.  The last few weeks I've been focusing my energies elsewhere, and that has gotten in the way of me finding things to rant about.  Sure, I could go on and on about work, or how some people who take transit should take the mini-busses instead, but who wants to read that?

I'm sure I'll pick up some topics to discuss in the coming days.  Hopefully I'll have a bit more to say about them than normal.

They Could Do It, So Why Can't I?

Today's title is a statement often made by children who see someone else perform an act that they're scolded for themselves.  This statement is not limited to children, however, as nations often employ this as justification for actions that are deemed careless.

I speak, for the moment, about the ever increasing levels of carbon in our atmosphere by some of the larger countries on the planet:  China and India.

China currently has several thousand coal-powered electricity power plants, as well as India.  Some cities even have illegal coal-generated plants to pick up the slack where the state-owned operations are unable to keep up with demands.  Western nations cry foul over these dirty polluters saying that with the rising emissions of greenhouse gasses into the atmosphere, we will drastically alter the climate of the entire planet.

Both China and India have responed along the lines of:  "You did this for 200 years.  Who are you to tell us any different?"

In a sense, I can't blame them.  Coal fired power plants are much cheaper than the alternatives.  They provide a consistent source of electricity, and both China and India have, what is currently, a seemingly-endless supply of this fossil fuel.  Nuclear powered generators take an excessive amount of time to construct, and many Western nations become uncomfortable when new nuclear generators are started in certain parts of the world.  Wind is a viable option for some villiages, but the number of generators that would be reqiured makes this very clean option excessively cost-prohibitive.

So what's the option?

Personally, I don't know which side of the fence to cast my vote with.  This is one of those situations where I agree with some of the West who believe that this massive source of carbon emissions will hurt us all, while at the same time I agree with Asia's stance that they need cheap and plentiful electricity in order to compete on a global scale.  I don't like the fact that the combined carbon emissions from all nations are on the rise, but at the same time I'm forced to ask myself "what other cost-effective option is there?"

Unfortunately, like everything else in life, this all comes down to money.  Big utilities companies and state-run initiatives will not spend half a billion dollars on a nuclear generator if the surrounding area will not require that level of power, or be capable of affording it.  Wind mills are often considered in areas of high wind, but tend to be an eye-sore for the local populations, so are typically rejected if a large number of them are required.  Hydro-electric dams are a great source of seemingly-unlimited power, but there are only so many waterways that can be converted for this purpose.

So what else can be done?

For the moment, I'm forced to agree with these Asian nations and many other nations around the world that still employ coal-fired power plants (Canada and the United States included).  These massive centres for pollution cause more damage to the planet than most of us can comprehend, but at the same time they provide us with the electrical power that we've come to depend on.

While many people balk at Asia's response to their power generation, we tend to ignore the big picture.  As it stands, the average Canadian uses well over ten times the amount of electricity of the average Chinese person.  25% of our power comes from conventional thermal sources (coal, oil, natural gas), with over 50% coming from hydro-electric dams.  We seem to forget that not every country is as naturally wealthy as Canada.

While the West was polluting the atmosphere from the onset of the Industrial Revolution, Asia was kept relatively pristine and clear.  The West learned the hard way what excessive pollution and exposure to airborne chemicals did to both the human body and the surrounding environment.  While we've taken some strides to clean up our act, we're hardly innocent.

Of course, this means that now it's time for some parts of Asia to learn this lesson.

Just as we've seen time and time again in our collective histories, we tend to make the same mistakes over and over.  At one time, London was the most polluted city on the planet.  Spewing forth chemicals so dangerous and corrosive that people would die just by breathing the air.  Thick black clouds would completely enshroud cities and kill off surrounding farmland.  Disease would run rampant and mortality rates would drastically change.  Now this lesson must be learned in cities like Linfen, China.

We need to find more sources of cheap energy.  Sources that have little to no impact on the environment.  The Earth does a remarkable job of repairing itself despite all the surface damage we've caused, but eventually we may do so much harm that the planet cannot recover in a reasonable amount of time.  I can't pretend to have the answers, but I can say that I understand both sides of the argument.

I only hope that we all learn from our collective mistakes before it's not too late.