svn: warning: cannot set LC_CTYPE locale

Somehow with the recent Ubuntu 10.04 LTS updates or maybe with a subversion update, I received some errors message of the type “locale…”. To be more precise the errors are;

svn: warning: cannot set LC_CTYPE locale
svn: warning: environment variable LC_CTYPE is UTF-8
svn: warning: please check that your locale name is correct

While all SVN commands still worked, it was something I didn’t tackle with immediately. But today, I set out to fix it. Well, it only took a minute or so :)

So, if you want to fix this all you have to do is to set the “LC_ALL” variable manually. To make it permanent just edit the file “/etc/environment” and add the line:

LC_ALL=C

Save the file and exit the editor. In order for it to apply you have to logout of the current shell session. The next time you log in, the issue with SVN will be gone.

 

Plesk 9.5 and domain is expired

Currently doing some Plesk administration and migration of a couple of servers and run into “domain is expired” errors.

To be frank here, I’m very surprised at how many hosting companies have Plesk deployed, even thought the system has one of the worst user interfaces and to use it is like “searching” instead of “Oh, here it is”. Finding what you need within the Plesk administration is a frustrating task, to say the least.

So, today I was hit with a message of “… domain has expired”. While surprisingly it is easy to “unsuspend” a domain, it is quite the opposite if you are being hit by another message of “The domain is still suspended for the following reason: Domain is expired“.

Now, what? The domain is still expired even thought I just “unsuspended” it? There is no message indicating what you have to do next or what is still causing the domain to be expired. (I already ranted on the usability part, right?)

To make a long story short, the reason why Plesk is reporting the “domain expired” message is that the domain has a expiration date set!

Now, to fix this you have to go into the Domain itself, then click on “Resource Usage” (that icon belongs to the “Statistic” group!!!). At the very button of the Resource Usage page you will find the expiration date setting.

By now, you will probably wonder what the Usability designers of Plesk have been thinking and really wish that someone over at Parallels will get their act together. I wonder, who I can bill my time now, after searching countless of hours for such settings?

 

Seamless server access from MacOS X to Ubuntu with SSH public keys

When you access a server over SSH you usually get asked for a password that you trustfully type into the terminal window. But doing so is insecure for many different reasons (I’m sure there are many people who wrote about this before and describe it better then I ever could). So, what is a better way to log into your server then? The best way so far is a method called “public key authentication”.

So, since we want to add security to our belt, we can simply use this technique for our SSH access as well. On MacOS X it is actually very easy to setup.

First up, you need to create your own keys. Doing so, is straight forward, all you have to do is to open up a Terminal window and type “ssh-keygen”. This will then prompt you some questions, where to put the keys (use default) and for the passphrase (I would suggest you use a good password). In the end, it will save your keys (your private one and a public one) to your .ssh directory.

Now what you got your public key, all there is left to do is to copy your public key to your server. In case you have root access to your server, it is simply a manner of doing it with “scp”, like:

“scp ~/.ssh/id_rsa.pub root@{yourserverdomain}:.ssh/authorized_keys”

This will copy your public key to the “authorized_keys” of the server.

Once done, you can now simply log into your server with ssh root@{yourserverdomain} without the need to enter a password since your server and you exchange keys for authentication.

Troubleshooting

When you copy your key to server you might get a error that the file “authorized_keys” is not found. If so, then simply create the file on the server and issue the copy command again.

 

MySQL: Failed to open the relay log

If you happen to see the message “Failed to open the relay log…” in your MySQL error log file (sometimes it is good to look into it once in a while) then you either have your replication setup incorrectly or you forgot to remove the salve information in the master.

If the later is the case all you have to do is to login to the MySQL server and issue:

Stop Slave;
Reset Slave;

There is no need to restart MySQL. But if you want to see that it actually works now, then restart MySQL and look into the mysql.log file. You will now see that the error message is gone.

Live every day to the fullest – it could be your last one

Let’s be honest, we are all wrapped up with our everyday live, worrying about money, our career, our love (or not getting enough love), money, friends… you name it. Everyone of us has their own mind full of things that “matter”. “Matter” because, in the end, these are, after all, material matters (mostly are) that don’t really matter in the end, if it would be your last day of your life.

Studies have shown that most people would change their life on the dot, if they would know they only have to live for another month. As always, my first question is, why don’t you live the life that you want to live now? Why wait? Why waste time on things that don’t matter now? What are you waiting for?

One of those people that had a “wake up call” is Ric Elias. Ric was on the plane that crash-landed in the Hudson River in New York in January 2009. In this 5 minutes talk, he shares some important experiences with us. My favorite quote; “… I regret the time I wasted in things that did not matter with people that matter…“!

Enjoy the talk and make sure to let me know your thoughts.

Installing memcached on Ubuntu for wordpress and phpbb

As an application maintainer you always look for the best performance in your application and website. At one point in your quest for the best performance you will undoubtedly trip over memcached.

In short memcached is (quote); Free & open source, high-performance, distributed memory object caching system, generic in nature, but intended for use in speeding up dynamic web applications by alleviating database load. Memcached is an in-memory key-value store for small chunks of arbitrary data (strings, objects) from results of database calls, API calls, or page rendering.

That said, installing is a no brainer as well. On Ubuntu you simply need to do the following:

apt-get install memcache
apt-get install php5-memcached

That’s it. Your system takes care of the rest and you will have your first memcached server up and running. Of course, the final step will be to restart apache in order for php to pick up the changes.

Now, memcached alone is of no good use, if your code/application can’t work with it. Thus here I’ll outline 2 examples.

WordPress: Memcached with the W3C total cache plugin

First off, if you aren’t using the awesome W3C Total Cache plugin you should now run install the plugin immediately (just search for w3 cache in the plugin section of the wordpress administration). Even if you are not using memcached it will boost the performance of your WordPress site manifold.

Now, to enable memcached for your WordPress site is as simple as selecting the memcached option for the cache. with the plugin you can even select what you want to place into the memcached cache. Quit slick.

 

Configuring phpBB to use memcached

Actually it took some time to figure this out, since the setting were not so apparent, so I’m hopping this helps others also. phpBB by default used the local disk for caching. This can be chanced in the config.php file in phpBB folder. Open it and ADD or change the following lines:

$acm_type = 'memcache';
@define('PHPBB_ACM_MEMCACHE_HOST', 'localhost'); // Memcache server hostname
@define('PHPBB_ACM_MEMCACHE_PORT', 11211); // Memcache server port
@define('PHPBB_ACM_MEMCACHE_COMPRESS', false); // Compress stored data
$load_extensions = 'memcache';

Especially the last line with “load_extensions” is important. Save the file and restart apache. Now phpBB will use the memcached server(s). Alone on a board with 800 users I have seen a massive speed improvement.

That’s it. Next up is to get all my CFML apps to work with memcached :-)

Celebrating 20 years of Linux

I remember when I installed Linux the first time (many many moons ago) and it was all cryptic for me. All that starred at me, was a black screen with some strange symbols and a pointer blinking.

So, this is Linux, I thought and tried to get my way around it. To be honest, it took a couple of re-installs and some learnings to come to the level I’m at now. Nowadays, all of my applications run on Linux servers (my favorite one is Ubuntu server) and I have to say that I’m more then happy how Linux performs.

Actually, my next step is to adopt Linux (Ubuntu) on my laptop, but to move to Linux on my desktop, I really need to have a application like Aperture of Adobe Lightroom. Apart from that, I think Linux on the desktop has a big chance to succeed. Especially, Ubuntu 11 with Unity will probably make this move apparent for a lot of users.

In any case, if you run Linux on your servers or thinking of migrating to Linux, you own it to yourself to watch the below anniversary video and head over to the dedicated “20 years of Linux” site.

Coldfusion: How to pass struct and array in a URL

A user just asked:

I need to pass my array to a webserver. But somehow, the array passed with cfhttp throws an error. Please help

You can not pass a structure or an array in a URL as they are complex values and Coldfusion does not have a way to convert them to simple string values (this is what you need to pass in a URL).

The only way to pass complex values is to serialize the Coldfusion struct or array for the URL. Fortunately, Coldfusion has a built in function called “SerializeJSON” to create a simple string. On the other hand, you can convert the simple string back to a struct or array with “DeserializeJSON”.

Here is a simple example how to pass a 2 dimensional array with cfhttp:

<cfset myar = arraynew(2)>
<cfset myar[1][1] = "keywords">
<cfset myar[1][2] = "Razuna, Wordpress, Tomcat">
<cfset myar[2][1] = "description">
<cfset myar[2][2] = "Razuna is a dam with a lot of features">

<cfset thejson = SerializeJSON(myar)>

<cfhttp url="function.cfc">
      <cfhttpparam name="jsondata" type="URL" value="#thejson#">
</cfhttp>

Changing the default search engine in Firefox

On a Windows machine I came upon the other day (forcefully and not intentional:-) ) I saw that the default engine was “search-results.com”. This URL was called whenever the user entered a keyword in the URL bar (you do know that Google Chrome and Firefox 4 will automatically search for the words you enter in the URL field, don’t you?). Key was, that I wanted to change this URL.

Easy right? Well, as it turned out, it took some small effort to find the right value.

First off, I entered the “about:config” and searched for “browser.search.defaultenginename”. Double clicked on it and changed it to “Google”. Immediately, I restarted Firefox, but unfortunately the search still was being directed to the other site.

Ok, hitting again the “about:config” and this time searching for “search” only revealed that there was another setting called “browser.search.defaultengine” which also pointed to another search engine. Changing it to “Google” also did not help.

Finally, after looking for some more, I find out that the config value “keyword.url” is the one setting that needs to be changed. Low and behold, Firefox even has a nice page on this topic (you just need to know what you need to be looking for, right…).

In short changing the value back to the default value (or any other you want) “http://www.google.com/search?ie=UTF-8&oe=utf-8&q=” fixed it.

Hope this helps.

Great talk about bootstrapping

Here is a great talk from Jason Fried, co-founder of 37signals, on bootstrapping and getting your company up and running. Really worth seeing.