MySQL aliases (just like table names) are case sensitive on *nix

As you might know when using MySQL on a case-sensitive OS (like Linux) you must reference your table names in a case sensitive manner. So if you have a table called products the following sample query will NOT work:

It won’t work because MySQL stores the table information in directories on the file system, therefore these directories are case sensitive. So your query must be as follows (note the lower case products):

That’s all good and well, but did you know that using table aliases are also case sensitive? I found this out the other day when debugging an issue with some existing code and confirmed on the MySQL site that “By default, table aliases are case sensitive on Unix, but not so on Windows or Mac OSX“.

So the following query will fail because the alias used in the WHERE clause is different from the one used in the FROM definition:

Although database and table names are not case sensitive on some platforms, you should not refer to a given database or table using different cases within the same statement. The following statement would not work because it refers to a table both as my_table and as MY_TABLE:

mysql> SELECT * FROM my_table WHERE MY_TABLE.col=1;

If your interested you can read more on MySQL identifier case sensitivity here.

No Comments

2 cool things about Railo

Session management:

If an application/session scope is defined with the tag <CFAPPLICATION …> or the application.cfc, in Railo it will not automatically exist. Only when the scope is used for the first time it will be created. If the scope is not used, it won’t be created either.

This is really good news. Many people have blogged in the past about issues with “bots” hitting ColdFusion sites and spawning a multitude of sessions which (depending on the application of course) can cause memory and/or performance problems.

Trusted cache:

In contrast to CFML Standard, with which the Trusted Cache can only be activated on the server, with Railo it is possible to define single Mappings as Trusted. This is especially useful if a function uses a framework in which the Source-Code doesn’t change any more but the function can generate a dynamic code.

Nice :)

No Comments

FarCry 5 running on Railo 3 (Windows)

The CFML market is hotting up with Railo going open source (in version 3.1) and joining forces with JBoss for an end of 2008 release! With that in mind I figured it was time to check out Railo with the latest version of FarCry.

My environment:

  • Windows XP
  • Railo 3.0.0.003
  • FarCry 5.0.0 (although 5.0.2 is out, the latest distro from the site offers only 5.0.0)
  • FarCry 5.0.2
  • MySQL 5

I’m using the “express” version of Railo which bundles with Jetty Application Server, so no need for any apache configurations as everything runs off port 8888. This is not how you would have things running in a production environment of course, but is great for evaluation purposes as you can just put the Railo files anywhere you want with no actual installation required.

I already had MySQL installed, so I got a fresh zip of FarCry 5.0.2 and the latest release candidate for Railo.

I unpacked Railo into D:/ (this could be anywhere on your system) then unpacked FarCry into the “webroot” folder of Railo following the standard FarCry 5 installation instructions.

Next was starting Railo, on Windows open a command prompt (cmd) and run the start.bat file which is in the Railo root directory:

Now that Railo is running I needed to create a datasource to point to a fresh database created for my new FarCry app. To do this visit the admin area of Railo at http://localhost:8888/railo-context/.

The first time you do this you’ll be asked to enter a password which will be used in the future to access the admin area.

Create and verify a datasource just as you would in ColdFusion Administrator and you’re ready for the FarCry install.

To install FarCry visit http://localhost:8888/farcry/ and follow the instructions. As mentioned above you first have to create an empty database for your FarCry site.

After FarCry installed (without a hitch!) it was time to look around my new site to see if everything is working as normal (well, as it would normally under ColdFusion). Upon initial inspection everything is working fine with just a few exceptions (pun intended!).

Firstly it seems there is a reserved word conflict with the FarCry core codebase and Railo which prevented me from viewing one of the pages (support) in the mollio skeleton site FarCry installs by default (and also some pages from the webtop).

Railo threw the following error:

invalid argument for function query, only array as value are allowed

The code in question was calling a FarCry method called query(). I renamed the method to execQuery() and updated the calls to it and everything started working as expected.

I also added this as a FarCry bug so hopefully it will be resolved by the Daemon guys in the next FarCry release.

There were a couple of other small issues (with containers/publishing rules and a permission problem in the webtop) which I’ve contacted Daemon about. Hopefully they will be resolved quickly.

All in all it looks as though FarCry is a success on Railo which great news!

Although I was only looking at the express version of Railo, I was extremely impressed with just how simple everything was. Comparing CF8 and Railo (browsing the FarCry admin console), Railo looks a lot faster to me. Of course I did no actual load/performance testing. But it was interesting that I noticed the speed difference by simply browsing.

I’m looking forward to playing with it further, particularly when 3.1 comes out :)

1 Comment

getmooh - automated callback service

Looking to escape from a date or to get out of any sticky social situation?

Try this free online automated callback service called getmooh.

It is designed to help you escape a variety of situations by calling you automatically on your phone at a pre-specified time and playing you a recording which will either instruct you on what to say to elude your tormentor(s), or which will simply give a convincing sense of you being on an important call.

Could quite possibly add your number to a spam list…but too funny :)

1 Comment

Adding subscriptions to comments for your Wordpress theme

If you are using a Wordpress theme which doesn’t support users subscribing to comments (crazy I know) you can add the plugin Subscribe to comments which is currently at version 2.1

A summary of the features this plugin provides:

  • Rudimentary security
  • Recognition of subscription status
  • Themeable subscription manager
  • Ability to let users change notification e-mail address
  • Easy integration into comments form
  • Subscription without leaving a comment
  • Customization
  • Internationalization

Installation is as easy as you’d expect from a Wordpress plugin. Simply upload 1 php file into the plugins directory, then “activate” the plugin in the admin area.

Then all you need to do is add a line of code to your theme comments.php where you want the checkbox to go and you’re ready!

Read more and download the plugin here.

No Comments