Railo 4.1: Template compilation and javaagent path

The latest Railo 4.1 bring “Smarter Template Compilation” (read the blog post!). In order to get it running you need to set the -javagent variable for your JVM or else you will see this message in the Administrator:

There is no Java Agent defined in this environment. The Java Agent is needed to improve memory (PermGen Space) consumption for templates. To enable the Java Agent follow this instructions: Add the “-javaagent” JVM argument and set it to point to the railo-inst.jar in this environment that would be: -javaagent:/railo-inst.jar.

The issue with my installation was that in my instance the “/” defaults to the main path and not the Tomcat one. Furthermore, I have Railo installed in a multi-deployment setup so I actually only have one Railo for all web applications. So, the obvious answer was to use the absolute path which in my case is “/Library/apache-tomcat-7.0.32/railo/WEB-INF/lib/railo-inst.jar”.

But even with the absolute path, Railo was unable to find the jar. In the end it all boiled down to pass the absolute, absolute (if that makes sense) path to the argument. In my case (on MacOS X) this is “/Volumes/Macintosh\ HD/Library/apache-tomcat-7.0.32/railo/WEB-INF/lib/railo-inst.jar”.

Hope this helps someone out there :-)

Comments { 0 }

Tomcat truncating cookies with = values

Starting with Tomcat 6.0.18 and in Tomcat 7.x any cookie containing a “=” will be truncated. Where you would expect your cookie to hold all values, e.g. “value1=myname&value2=password” you will only be able to retrieve the “value1=”.

This is because Tomcat now adheres to the cookie spec more tightly than previous versions. If you are in control of the cookie you might be able to change it and work around this. If not, then you can can change the settings within the catalina.properties file by appending the following two settings:

org.apache.tomcat.util.http.ServerCookie.ALLOW_EQUALS_IN_VALUE=true
org.apache.tomcat.util.http.ServerCookie.ALLOW_HTTP_SEPARATORS_IN_V0=true

Comments { 0 }

Python wxPython install on MacOS X 10.8.x

wxPython is a GUI library kit for developing desktop application with Python. Since it is cross-platform you can actually run your code on MacOS X, Windows and Linux.

Now, while installing wxPython on my development environment (MacBook Air 13″, MacOS X 10.8.x) and the standard installer from the wxPython website I’ve hit an error already by simply importing the wx library. The error was:

import wx
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/wxPython-unicode-2.8.12.1/lib/python2.7/site-packages/wx-2.8-mac-unicode/wx/__init__.py", line 45, in <module>
    from wx._core import *

Now, whatever I tried, did not work, until I remembered that I install all my apps with “brew”. Ok, so off I went to find the correct installer arguments for wxPython. To my surprise it wasn’t really public and so here is the correct installer argument for getting wxPython up and running with Brew:

brew install --python wxmac --devel

This will install and link everything perfectly and now wxPython can be imported successfully. Please note; I also use the Python version from Brew, so your experience might be different if you want to use the one coming with MacOS X.

Comments { 1 }

Seriously, this is the best commercial ever

I know, best title for a blog post, but seriously you have to watch the below commercial. It is funny, engaging and touches quite enough inside of you to want to do something. Brilliant, simply brilliant.

Rainforest Alliance - Follow the Frog

Comments { 1 }

That’s what I call innovative…

Yeah we all have been spoiled by Microsoft and (during the Steve Jobs area) by Apple with innovation, but clearly the stage for the next “big thing” belongs to Ubuntu.

Seriously, not because it is open source, but because they have shown that they are willing to go out of their way (Unity anyone?) to take the desktop and user interface further than any other company (in that sense I have to applaud Microsoft for Windows 8 also).

Today, they announced Ubuntu for tablets. What is more unique about the Ubuntu approach is that there is for one a company that is really thinking about having one device that the user carries around and becomes their only device. To be honest, I haven’t been so excited about a new product as for the Ubuntu mobile phone and tablet line.

Below their vision. I love it…

Comments { 0 }

Python and Django: ImportError: No module named django.core

Python is without a doubt a great language. Django is a great framework. It is just obvious to use them and get your site up and running. So, today, while setting up a new site with “django-admin.py startproject mysite” I’ve run into the “ImportError: No module named django.core” error.

While hunting for a solution on the net, none of them seamed to work, though I knew the problem is most likely just a path issue. See, I’ve installed python with brew in order to receive the 2.7.3 update (MacOS X Mountain Lion ships with 2.7.2 and it doesn’t look like Apple is upgrading it). The issue here is that brew installs everything in the “/usr/local/bin” directly.

Now, you might say, to simply add the “/usr/local/bin/” directory to the Path environment, but the point here is that the “django-admin.py” has the path to set to “#!/usr/bin/python”. In other words, edit the file “django-admin.py” (most likely at /usr/local/bin/) and give it the correct path to python (“”#!/usr/bin/python”).

Voila. Now the utility works as expected. On with coding…

Comments { 0 }

AES 256-bit keys and Coldfusion

This week seams to be the Java week. Just yesterday I’ve posted about my experience on installing Java 7 on MacOS X 10.8.2 and today comes another Java one. This time, it is about the 256-bit AES keys and Coldfusion (well my choice is the open source CFML engine called OpenBD).

Since I’m working currently on a project that needs to exchange sensitive data with a third party we obviously would like to protect the data with the strongest key, so a AES 256-bit key has been chosen. While the key was valid, my code always threw a “Illegal key size” error message.

As it turns out, this was due that Java did not have the “Java Cryptography Extension (JCE) Unlimited Strength Jurisdiction Policy Files 7″ bundles installed. Apparently they are needed for any stronger keys then 128-bit keys. You can get the Unlimited Strength bundles from the Oracle site. Installing them is as “simple” as dumping them to the “$JAVA_HOME/lib/security” directory.

Troubleshooting

While the above seams to be obvious on Linux and Windows I’ve had a hard time to get the correct installation on MacOS X. Somehow this is hidden far down in the paths and not at all obvious. But the correct location to store the security JAR’s is at “/System/Library/Frameworks/JavaVM.framework/Versions/CurrentJDK/Home/jre/lib/security/”.

Hope this helps anyone out there :-)

Comments { 0 }

MacOS X Mountain Lion and Java 7 installation

Today I set out to get Java 7 JDK running on MacOS X Mountain Lion (10.8.2). As Apple actually only installs Java 6 (1.6.x) one needs to get Java 7 from the Oracle website at the Java SE download site.

Once downloaded simply run the installer and it (should) install Java 7 properly on your system. After that, you can use the following command to make Java 7 the active version to use:

/usr/libexec/java_home -v 1.7.0_11 --exec javac -version

Now, if you use “java -version” it should actually give the output that it used Java 7.

Troubleshooting

Now the above should all be according to the book, but as things are when it comes to Java they are never “click and go”. One of the problems, I’ve had was that no application on the terminal actually picked up the Java 7 JDK. Digging around a bit showed me that the installation created sym links in the “/System/Library/Frameworks/JavaVM.framework/Versions/” directory.

As it turns out the “CurrentJDK” linked to the “old” Java 6 (1.6) installation. So, in order to point it to Java 7 I’ve had to do the following:

rm CurrentJDK
ln -s /Library/Java/JavaVirtualMachines/jdk1.7.0_11.jdk/Contents/ CurrentJDK

This immediately fixed the issue and all terminal applications worked again.

Note: I’ve had manually set the “JAVA_HOME” and “JRE_HOME” variables in the “.profile” file. With the above setting I’ve had to remove those variables in order to make it work!

Troubleshooting 2

I initially removed the Apple installed Java 6 (1.6) installation manually, I removed the directory /System/Library/Frameworks/JavaVM.framework and other Java references (yes, I know it is/was a bad idea). Just installing Java 7 did not help nor does a system reboot. Also, Apple updates did not recognise that Java was gone. Also, installing Java 6 from Apple directly (download img) did not help. In short, nothing worked anymore.

The only solution was to get Pacifist (look for it on the web). Within Pacifist load the PKG (from the Java 6 image) and install the complete package and overwrite all existing installation. This will replace all the files I accidentally removed (the important system files) and got it all up and running again.

Comments { 6 }

Movie about open source software has to become a reality

Open source software turns this world and is found in every little gadget, in your phone (Android), when you swipe your credit card at the counter, in the plane (on my flight the other week the had to reboot and one could see the terminal screen for some time) in your TV set and for some driving their website with open source software on a open source operating system.

In short, open source is everywhere and is not something for freaks only anymore. Sure, Linux (as the open source operating system) has a long way to go to be used on a broad scale for the end user on the desktop, but at the rate that Ubuntu Desktop is driving forward I’m certain this goal will be reached in the coming years.

So, I find it a wonderful idea that there should be a movie about open source software. If you think the same, you can now pledge your support for the movie with a small donation (well, you also get something in return). I’ve just done so and think that we all should support this in order to spread the word about open source software! Head over now to the website of Software Wars now!

Comments { 0 }

Each database its own unique generator

Don’t you love that every major database on the planet thinks that we (as in developers) don’t need to have a common syntax and that we should spend hours looking for the needed functionality?

Well, it just so happens that I was in need for generating a unique ID today with the database function – also know as UUID. A UUID is a string that is unique and looks something like “0302B2FE-8046-45D1-AB584481D0F2A99E”.

So, without further due here are the different functions for:

MySQL

SELECT uuid() FROM ...

MS SQL

SELECT newid() FROM ...

DB2

SELECT generate_unique() FROM ...

Oracle

SELECT sys_guid() FROM ...

H2

SELECT random_uuid() FROM ...

Yep, that’s right. Each function is named completely different, so it was not so easy to find them as quickly as I thought. In any case, hope this helps.

Comments { 0 }