Monday, 6 November 2006

Akismet service

I've just finished to install the Akismet Moderation Plugin for using the homonym anti-span service, consequently:

  1. trackbacks are again enabled. I had to close them a month or two ago because they weren't protected by the Math Comment Moderation Plugin and spammers were playing on it. Anyway I'm almost sure that nobody miss them :-D ;
  2. the Math Comment Moderation Plugin has retired, in the hope to not have to come back.

The plugin is configured for deleting automatically every comment/trackback/pingback that is judged spam. So if you add a comment and don't see it, first try to force a refresh of the page and then, please, try to rewrite it using less times the word sex ;-)

Technorati Tags:

Posted by Nicola Piccinini at 12:50 AM CET in blojsom/

Wednesday, 28 December 2005

An effort to localize blojsom

A while ago I sketched a solution to localize the blojsom public interface but I haven't time to write about it until now. So, for anyone that could find it useful:
the solution is based on ResourceManager and doesn't require any modification to source code.
It uses the Velocity dispatcher and:

  • a couple of specific velocimacros that should be added in user-macros.vm in WEB-INF/classes;
  • a set of properties files with messages' translations named lMessages_<language_code>.properties and placed in WEB-INF/classes too.
    If a user wants to be newfangled, he can add personal translations in files named <user_id>_lMessages_<language_code>.properties;
  • localized Velocity templates;
  • the DateFormatPlugin to format the dates of comments and trackbacks. In fact, differently from org.blojsom.blog.BlogEntry, the classes org.blojsom.blog.BlogComment and org.blojsom.blog.Trackback don't have a method getDateAsFormat with a parameter of type java.util.Locale.

The translation's file is choosen depending on the language code specified in blog configuration.

At http://superfluo.org/blojsom-resources/ you can find:

To localize your Asual theme, simply:

  1. configure conveniently DateFormatPlugin,
  2. tar xzf blojsom-l-messages.tgz in WEB-INF/classes,
  3. if your desired language code is different from en or it, add in WEB-INF/classes a new resources file named lMessages_<language_code>.properties :-) ,
  4. substitute standard Asual templates and resources with the localized ones in blojsom-asual.tgz,
  5. set blog-language=<language_code> in WEB-INF/<user-id>/blog.properties,
  6. restart servlet container.

Why not to simply create different templates for different languages? Because, in my opinion:

  • it's easier to mantain a set of message sources than a set of templates. This is a crucial point for blojsom developers but is unhelpful for us users :-) ,
  • in this way, the blog's owner can change the language with a very simple operation that can be done also by inexperienced users. This could be important in many situations, expecially when new blogs are added frequently.

Superfluos and Sakscia are using this solution.

Known problems:
  • many (harmless) ERROR log messages are generated by the attempt by velocimacro lMsgF to read a user messages file, when this last one is missing.
Posted by Nicola Piccinini at 5:21 PM CET in blojsom/

Monday, 5 December 2005

Improving my blojsom installation

Now I'm running the CVS head version of blojsom because:

  1. I'm using the new exclusion mapping feature (see blojsom changelog) for filtering out the entries in category zzz,
  2. I slightly modified the source code of org.blojsom.filter.PermalinkFilter to move around the lack of URIEncoding configuration parameter in the version of Apache Tomcat on mayatecnologie (see Internazionalization section in blojsom FAQ) and so, in order to merge future releases, it's better to work under version control.

With the usage, I've noticed that my policy configuration was still too much restrictive. It's necessary to add
permission java.io.FilePermission "/tmp/-", "read, write, delete";
to allow resources' upload.

Posted by Nicola Piccinini at 10:19 PM CET in blojsom/

Saturday, 12 November 2005

Upgrade of blojsom and PostMailerPlugin

I upgraded blojsom to version 2.27. Everything went well except of a misunderstanding with TinyMCE templates.

Writing a new post, I noticed that my policies' configuration was excessively restrictive, unless one doesn't need trackbacks :-P . If it isn't the case, it's better to allow every outwards connection:
permission java.net.SocketPermission "*", "connect";

I've slighty adjusted the PostMailerPlugin too:

Howto
  1. copy blojsom-postmailer.jar to WEB-INF/lib,
  2. in your global /WEB-INF/plugin.properties file, add the following line:
    postmailer=org.blojsom.plugin.postmailer.PostMailerPlugin
  3. create in /WEB-INF/(blog-id) a configuration file named postmailer.properties (you can specify a different name in /WEB-INF/web.xml). In the sample configuration file you find some documentation about configurable parameters.

2005-Dec-05 CET: update.

Posted by Nicola Piccinini at 3:38 PM CET in blojsom/

Saturday, 24 September 2005

The PostMailerPlugin

A missing feature in blojsom is the capability to send, every time an entry is added, an email with its content (title and description). For example blogger allows it and I find it useful because I'm using email as an archiving system (thanks to the recent avalability of free, with large disk storage and well working email services).

Fortunately, blojsom is open source software and so I could add this functionality. Its plugin architecture facilitated notably my job.
I took the CrossPostPlugin (with its event handling behaviour) and added a send email funtionality copying from the CommentPlugin. The result is the PostMailerPlugin (maybe not a good name). The source code with a velocity template for the email body and a sample configuration file are avalaible here.

2005-Nov-13 CET: update.

Posted by Nicola Piccinini at 6:53 PM CEST in blojsom/

Friday, 23 September 2005

Installing blojsom

I've choosen blojsom after a quick comparison with some other blog software and, in truth, it hasn't been a very meditated decision. Anyway, now I'm enthusiastic of blojsom, in my opinion it is really lightweight and powerful and looks different from the tipical java application, in fact it is inspired by bloxsom and it is really perlish!

Installing blojsom (version 2.26) was easy. I did it on mayatecnologie (system configuration) where tomcat is running with a SecurityManager enabled. Perhaps somebody could find useful my policy configuration:

// blojsom
grant codeBase "file:/usr/share/tomcat4/pic/blojsom/-"
 {
 // deducted by inspection of exceptions' traces in catalina.out
 permission java.lang.RuntimePermission "getClassLoader";

 // deducted by an error message concerning CompressionFilter and
 // exceptions' traces in catalina.out  
 permission java.lang.RuntimePermission 
   "accessClassInPackage.org.apache.catalina.*";
 permission java.lang.RuntimePermission 
   "defineClassInPackage.org.apache.catalina.*";

 // more liberal runtime permissions
 //permission java.lang.RuntimePermission "*";

 permission java.io.FilePermission 
   "/usr/share/tomcat4/pic/blojsom/-", "read, write, delete";
 permission java.io.FilePermission 
   "/var/lib/tomcat4/blojsom/-", "read, write, delete";
 // used by WeatherPlugin
 permission java.net.SocketPermission "www.nws.noaa.gov", "connect";
 // used by PingPlugin
 permission java.net.SocketPermission "rpc.weblogs.com", "connect";
 permission java.net.SocketPermission "rpc.pingomatic.com", "connect";
 // to send mail
 permission java.net.SocketPermission "localhost:25", "connect";

 // more liberal socket permissions
 //permission java.net.SocketPermission "*", "connect";

 permission java.util.PropertyPermission
   "blojsom.installation.directory", "read, write";
 permission java.util.PropertyPermission
   "org.apache.xmlrpc.TypeFactory", "read";

 //permission java.security.AllPermission;

 }
 ;
// end blojsom

Another suggestion for who is using the tomcat4 debian package:
I noted that the RefererLogPlugin wasn't able to write its log on tomcat's shutdown, this was due to the init script that kills every JVM processes without waiting their natural termination. From /etc/init.d/tomcat4:

 su -p $TOMCAT4_USER -c "\"$DAEMON\" stop" \
         >/dev/null 2>&1 || true 
 # Fallback to kill the JVM process in case stopping didn't work
 sleep 2
 start-stop-daemon --stop --oknodo --quiet \
         --pidfile "$PIDFILE" --user "$TOMCAT4_USER" 

I commented out "start-stop-daemon --stop ...", I suppose that it could cause troubles in many other situations other than installing blojsom (especially in application that creates a lot of threads, I guess).

2005-Nov-13 CET: update.

Posted by Nicola Piccinini at 4:03 PM CEST in blojsom/