Drupal 6 entered beta stage
September 26th, 2007– just a note –
Will write about it next days.
Add this blog to Del.icio.us, Digg or Furl | Create Watchlist for this blog
– just a note –
Will write about it next days.
Sometimes when setting up a drupal site, the situation appears, that I need a “special translation” for a standard module. I.e. I need a blogging functionality - but I don’t want to call the system a “blog”.
That’s when I need a customized translation of the blogging module. This article is about how to customize drupal strings with the localization feature.
What you need first the the GNU gettext package (it’s contained in every linux distro). From this package you need the program “xgettext”. This program is able to extract the strings from the module code that can be translated (if the module is programed very well, this should be all strings in the code).
Now go the the module’s location (usualy /modules/blog) and type:
xgettext.exe --keyword=t -L PHP blog.module
The L tells xgettext, that this code is PHP code, the keyword tells xgettext, that function “t()” is used for gettext translations. The output of xgettext is by default a file called messages.po. This file contains all translateable strings of blog.module.
...
#: blog.module:137
msgid "Post new blog entry."
msgstr ""#: blog.module:140
msgid "You are not allowed to post a new blog entry."
msgstr ""#: blog.module:178
msgid "RSS - blogs"
msgstr ""#: blog.module:222 blog.module:257
msgid "Blogs"
msgstr ""#: blog.module:239
msgid "@username's blog"
msgstr ""#: blog.module:261
msgid "My blog"
msgstr ""#: blog.module:277 blog.module:286
msgid "Recent blog posts"
msgstr ""#: blog.module:285
msgid "more"
msgstr ""#: blog.module:285
msgid "Read the latest blog entries."
msgstr ""
...
Keep each string in messages.po that you want to translate, delete the one’s you don’t want to translate, rename the file to i.e. myBlogStrings.po. Now put your translation of each string into the “msgstr” field.
I.e.
#: blog.module:222 blog.module:257
msgid "Blogs"
msgstr "Articles"#: blog.module:239
msgid "@username's blog"
msgstr "@username's articles"#: blog.module:261
msgid "My blog"
msgstr "My articles"
Then save the file myBlogStrings.po.
Go to Administer / Site building / Modules and activate the “Locale” menu.
Go to Administer / Site configuration / Localization and choose “importing a translation”.
Use the file selector to choose your “myBlogStrings.po” file, choose to import to your current language (most times it’s english (en)). And check “Strings in the uploaded file replace existing ones, new ones are added”. Then import the strings with button “import”.
You’re done, your blog is now a article collection.
The character-set of your file must be correct (i.e. UTF-8). That means, you need an editor that’s capable of saving files in UTF-8 (I use PSPad) and don’t forget to change the CHARSET in line “Content-Type: text/plain; charset=CHARSET\n” of the xgettext program’s output.
As promised yesterday, I’ll try the OpenMP features of Intel C++ 10.0 for Linux today. Cause I’m lazy, I use a wide spread “Hello World” for OpenMP example, it is very simple and it’s only purpose is to demonstrate the basics of how to parallelize a code with OpenMP.
/***********************************************************
* FILE: omp_hello.c
* DESCRIPTION:
* OpenMP Example - Hello World - C/C++ Version
* In this simple example, the master thread
* forks a parallel region. All threads in the team obtain
* their unique thread number and print it. The master
* thread only prints the total number of threads. Two OpenMP
* library routines are used to obtain the number of threads
* and each thread's number.
* AUTHOR: Blaise Barney 5/99
* LAST REVISED: 04/06/05
************************************************************/
#include <omp.h>
#include <stdio.h>
#include <stdlib.h>
int main (int argc, char **argv) {
int nthreads, tid;
/* Fork a team of threads giving them their own copies of variables */
#pragma omp parallel private(nthreads, tid)
{
/* Obtain thread number */
tid = omp_get_thread_num();
printf("Hello World from thread = %dn", tid);
/* Only master thread does this */
if (tid == 0)
{
nthreads = omp_get_num_threads();
printf("Number of threads = %dn", nthreads);
}
} /* All threads join master thread and disband */
}
To compile this example with icc you need the OpenMP switch turned on:
rainer@novotop:/tmp> icc -openmp omp_hello.c
omp_hello.c(22): (col. 1) remark: OpenMP DEFINED REGION
WAS PARALLELIZED.
rainer@novotop:/tmp> ./a.out
Hello World from thread = 0
Number of threads = 2
Hello World from thread = 1
Ok, that’s pretty cool. We saw how to parallelize a region and giving private variables to it. By the way, you can specify the number of threads OpenMP starts with the OMP_NUM_THREADS environment variable (export OMP_NUM_THREADS=4, then start a.out -> you get four thread outputs).
Next post will handle mutexes, semaphores, thread shared memory etc. in more depth.
About installing Intel C++ 10.0 on OpenSuSE 10.2
A good tutorial
I like gcc very much but now I have a Intel Core 2 Duo notebook, and I think it’s time to get the most out of it. That’s why I go for the Intel C++ 10.0 compiler today.
Intel provides a “free for non-commercial usage” download, that’s pretty nice and one more reason to give’em a try!
The other thing I am really interested in is the openMP integration. If you had troubles with pthreads you know why!
Go to the download page, confirm non-commercial agreement, register with email address, then start downloading the 45 MB package (in the IA32 version).
Untar the package and as root type
./install.sh
The installation went smooth, had to agree to several license agreements, answer some question (always took the default). Until suddenly:
Your platform :
architecture = i686
kernel = 2.6.18
glibc = glibc-2.5-25
operating system = unknown
This product is supported for use with the following combinations :
Machine Type Kernel glibc
IA-32/Intel(R) 64 2.4.x 2.2.5
IA-32/Intel(R) 64 2.4.x 2.2.93
IA-32/Intel(R) 64 2.4.x 2.3.2
IA-32/Intel(R) 64 2.6.x 2.3.x
IA-32/Intel(R) 64 2.6.x 2.4.x
IA-32/Intel(R) 64 2.6.x 2.5.x
Would you like to perform an unsupported install of this product [yes/no] (no) ? :
At this point I face my fear but typed YES.
After some other questions (always answer with default) I finally got the “successful” message:
Successfully installed:
Substitute Headers for Intel(R) C++ Compiler for applications running on IA-32, Version 10.0 (10.0.023)
intel-isubh100023-10.0.023-1.i386.rpm
Intel(R) C++ Compiler for applications running on IA-32, Version 10.0 (10.0.023)
intel-icc100023-10.0.023-1.i386.rpm
Intel(R) Debugger for applications running on IA-32, Version 10.0 (10.0.023)
intel-iidb100023-10.0.023-1.i386.rpm
Intel(R) C++ Compiler features and plugins for integration into Eclipse* CDT development environment, Version 10.0 (10.0.023)
intel-icc_ide100023-10.0.023-1.i386.rpm
Intel(R) Debugger features and plugins for integration into Eclipse* CDT development environment, Version 10.0 (10.0.023)
intel-idb_ide100023-10.0.023-1.i386.rpm
My first compilation will be a “Hello World” as it is good tradition in the C business:
#include <stdio.h>
int main(int argc, char **argv)
{
fprintf(stdout, "Hello ICC Worldn");
return 0;
}
To get the icc environment up, Intel delivers a Shell-Script. Source it then compile like this:
source /opt/intel/cc/10.0.023/bin/iccvars.sh
icc hello.c
Then run the result:
./a.out
Watch the output and be happy ![]()
Hello ICC World
This is so great! Tomorrow I’ll report on first experiences with openMP!
See you soon!
I’ve started a new Drupal project in the DAX Investment business. It’s kind of “pre-alpha” but it’s already a very interesting project from a technology view. It will contain blocks with high dynamical image content as well as stock quotes. So I will need to look somewhat deeper to caching technology and AJAX.
It will also contain community features like blogs and a forum, so there’s also lot of work to do with taxonomy.
I’ll keep you informed.
Drupal ships with a lot of necessary modules like Blog, Forum, Taxonomy, Poll, Locale …
They do most necessary tasks when building a website. But some modules I frequently need are provided by third parties.
Here is my list of five important third-party modules when building a site with drupal:
Other webmasters, other opinions, so here are some links to several drupal module top lists:
Troy Schneider’s top ten
Daan’s list of used drupal modules
A SEO view on modules from fiLi
And 5 musts from Keith’s marketing perspective
I drive about 25 domains with different technologies like wordpress, drupal, b2evolution, lussumo vanilla, phpCMS etc. Most of that need a typical LAMP. That is a Linux, an Apache, a MySQL and a PHP. It’s common sense to have kind of test systems, systems where you can test your development work before bringing it up to production. For that I use one linux machine running OpenSuSE Linux 10.2 (basically some partitions on my laptop I use with a boot manager).
There are several goal to be met by my dev-env:
My first and most important hint: Don’t use yast2 for setting up the virtual apache hosts. That module is still buggy. Use it only to set up apache the first time.
I assume you have apache2, MySQL4 or MySQL 5 and PHP4 or PHP5 up and running. All you need now is a virtual host, a new database and a new database user to run the dev-env. What you get from your production hosting provider is a domain, a database server, a database name and a database user.
As an example I use my domain geekland.de. It is hosted by 1&1 and has the following attributes (not really exactly these
):
domain: geekland.de
db-host: db1234.1und1.de
db-user: dbo12345678
db-pwd: qwertz123
database: db12345678
CMS: wordpress 2.1
Tools: PHP5, MySQL 5, Apache 2
Because I don’t want to mingle the real domains, I use a TLD “.test” on my local machine. For the example that means, I set up the domain “geekland.test” on my host.
That’s an easy task within unix. As root use
ifconfig lo:1 127.0.0.2
and add in /etc/hosts
127.0.0.2 geekland.test www.geekland.test
Add the virtual server in your apache’s httpd.conf file:
NameVirtualHost 127.0.0.2
<VirtualHost 127.0.0.2>
ServerName www.geekland.test
DocumentRoot /srv/www/vhosts/geekland
</VirtualHost>
Now put your htdocs file into /srv/www/vhosts/geekland and don’t forget to restart your apache!
Login in to your MySQL server via mysql command, then issue the following command:
CREATE DATABASE `db12345678` ;
Now create a database user and grant login rights:
CREATE USER 'dbo12345678'@'localhost'
IDENTIFIED BY 'qwertz123';
GRANT USAGE
ON * . * TO 'dbo12345678'@'localhost'
IDENTIFIED BY 'qwertz123'
WITH MAX_QUERIES_PER_HOUR 0
MAX_CONNECTIONS_PER_HOUR 0
MAX_UPDATES_PER_HOUR 0
MAX_USER_CONNECTIONS 0 ;
Now grant special rights (all) to the new user for the new database:
GRANT ALL PRIVILEGES
ON `db12345678` . *
TO 'dbo12345678'@'localhost'
WITH GRANT OPTION ;
As I don’t need any access to the hoster’s DB machine db1234.1und1.de. I alias that host to my localhost. With that simple trick I can use the same config (like wp-config.php) file on my dev-env as on the production environment.
In /etc/hosts modify the localhost line to contain the DB Server:
127.0.0.1 localhost db1234.1und1.de
Now you’re done. You can use all the same files on your production plattform and your development plattform now. The only thing you need to take care is to change the top level domain if necessary (i.e. in DB dump files of wordpress).
Your next project can be set up in exactly the same way, just change the virtual interface to lo:2 127.0.0.3 and the apache config accordingly.
My current favorite is a mini espresso (Italian coffee) machine. It comes with a typical can and a build in electro oven. It’s about 15 cm x 15 cm with 25 cm height and has everything to breed the Italian kind of coffee.
It is able to cook the coffee and keep it warm (not to long - or else it’s getting a bitter taste), so everything I need for long programming nights
The manufacturer is called “Splendida”.
When I tried to install WASABI’s nice related entries plugin on my new Wordpress site geekland it failed with the following error:
#1214 - The used table type doesn’t support FULLTEXT indexes
I am not sure if this is WP2.2 related - in the schema creation source I found no difference to 2.1 in the posts table - but I never had that problem with 2.1.
The solution is to convert the wp_posts table to ISAM (MyISAM) by issuing
ALTER TABLE `wp_posts` ENGINE = MYISAM
and after that re-issue the installation script of WASABI what does not more than:
alter table wp_posts add fulltext post_related (post_name, post_content)
Well, on my development system, the WP2.2 database was created in InnoDB format. and InnoDB does not support fulltext-search columns.
That’s all.
Yesterday I launched my first Drupal project in alpha state.
It’s a project for a customer in the real-estate business and I selected Drupal as CMS because of it’s very well selection of extension modules and - sure - for it’s perfect team editing features.
Drupal is, like Plone, in the leading Tools area for high-end websites with dynamic content. A key-strength for my purpose was it’s possibility to assign different roles to editors with different tasks. So I can keep the power about i.e. the menu-structure but let a story writer do the business content.
Above these business reasons, I am glad to have my first PHP5 and MySQL 5 project now. All other projects I’m currently running are based on PHP4 and MySQL 4, so I hope to make new (good) experiences with this new versions. I have waited very long for triggers in MySQL - needed to do some projects in Oracle, just because of the availability of triggers. And I have heard a lot about the processing speed improvements of PHP5. Well, I am going forward…
Some links for CMS comparison:
Drupal vs. Plone
Wordpress vs. Drupal: here, hier (german) and here.