What does l10n, i18n or m4 mean ?

Posted on August 27th, 2008 in Code, Linux, Monkey Business

I have never understood what l10n stands for, nor i18n, nor m4 for that matter. But reading a good online book about autotools, there are a couple of words explaining that in fact m4 stands for Macro, which is m+4 chars. l10n is localization written asĀ  “l+strlen(ocalizatio)+n”. Fun. Since I was on vacations while I read this, I had time to write a bash script to do this automatically while enhancing my bash skills. Here is the script:

#!/bin/bash

STRING=$1
STRLEN=${#STRING}

A=${STRING:1:$STRLEN-2}
echo ${STRING:0:1}${#A}${STRING:$STRLEN-1:$STRLEN-1}

Try running internationalization on it.

Web Development - Improved Ubuntu Workflow

Posted on May 4th, 2008 in Code, Linux, Ubuntu

Following my previous post on Web Development Workflow, I decided to be done with my procrastination and setup a local workflow, which keeps me location independent and autonomous.

The work flow is simple: Develop and test locally, deploy remotely. I’m currently applying this towards the development of an improved theme for my blog, which is basically this one, plus minor adjustments.

My setup is an Apache 2 webserver, with PHP and mySQL. On top of this I enable user dirs for the webserver, and deploy a local wordpress, which in fact runs a backup database from my production site.

First , install apache2,php and mysql support:

sudo apt-get install apache2 php5 libapache2-mod-php5 mysql-server

Now enable user directories support (things like localhost/~jonhdoe which actually live in /home/johndoe/public_html) and create the public_html folder:

sudo a2enmod userdir
mkdir $HOME/public_html

Another twist, since this is my main workstation and I don’t want an apache+mysql setup running all the time, is to remove all of the startup scripts from the default boot runlevels:

sudo update-rc.d -f mysql remove
sudo update-rc.d -f apache2 remove

I then run a script to start my environment when I want to code some web bits:

#!/bin/bash

/etc/init.d/apache2 start
/etc/init.d/mysql start

Don’t forget to make the script executable:

chmod +x bin/start-web-dev.sh

After all this I just installing web apps locally. In my case I just install Wordpress by uncompressing it into public_html, creating a DataBase using phpmyadmin, and running the install. After that I went to my production wordpress exported the DB, and imported it on the local wordpress. And I’m done.

As a finally twist I created a git repository of my theme, so i just modify+commit+push, and pull on the main website. Since I can push only when I need or can, this setup is really working for me.

Any further enhancements are welcome, so feel free to drop some suggestions to improve on this.

Web Development Workflow

Posted on April 21st, 2008 in Code, Linux, My World

Lately I’ve been working on some web projects, nothing major, one of which is the template for this blog. One thing that always bugs me is the workflow for web development. What is the best workflow for such projects, that require server side testing ?

How to develop a Wordpress theme without major hassle ? Or a php website for that matter ?

Option 1

Deploy a local http server, and test it as you code it on your local machine.

Downsides

  • Requires deployment of local http server and mysql server and wordpress/custom stuff.

Upsides

  • Fast code/test/fix cycle.
  • If you screw up, just reinstall or star over.
  • Does not bother visitor on production sites.

Option 2

Code directly on the server. Through ssh.

Downsides

  • Remote work is usually slugish.
  • Requires exporting the X windows for minimal usefulness.
  • Too much work to get into a usable state.
  • Direct work on the database/project/software.

Upsides

  • Direct work on the database/project/software.
  • Already deployed server/php/mysql/wordpress whatever software.

But I recently found a third option that seems viable.

Option 3

Mount the remote working directory through sshfs.

Downsides

  • Remote work can be slugish.
  • Direct work on the database/project/software.

Upsides

  • Direct work on the database/project/software.
  • Simple deployment. Just mount the damn thing and be on your way.
  • Take advantage of your desktop/development environment.

This is the latest and greatest solution so far. But this still doesn’t sound like perfect, because if I want to code a wordpress theme/template I have to enable it and work on my production website, which hinders both development and visitors.

Has anyone got a great solution for this ? A great workflow ? Or am I just being lazy and should install everything locally ?