Subversion does not work with Apache 2.2

Part of rebuilding my laptop was to get Subversion going.

Installed Subversion server 1.4. As I like to access it over http using Apache, I installed latest build of Apache 2.2.

But after making changes to http.conf to get Apache to work with Subversion, Apache server refused to start up. The Apache logs didn’t contain anything descriptive on why the server was not starting up.

Then I came across the following warning on the Subversion downloads page:

Note that the Apache modules included in this package was compiled against Apache HTTP Server 2.0, and thus will not work with Apache HTTP Server 2.2.

So that was the problem. Have now uninstalled Apache 2.2 and am installing Apache 2.

Hopefully that will work.

TinyMCE issue with Skype plugin in Firefox

I use TinyMCE as the HTML editor for one of the projects I work on.

While using the TinyMCE editor today I found that the stylesheet drop-down did not list any styles in Firefox. The styles were showing up correctly in IE.

Whenever I face such a situation (where tested Javascript code works in IE and not in Firefox), my first reaction is to disable all Firefox plugins and test again.
I disabled all the plugins. And TinyMCE styles worked as expected!

After a bit of googling, I found that it is the Skype plugin for Firefox that causes issues with the stylesheet drop-down in TinyMCE.

I now officially have a love-hate relationship with Firefox.

Running MySQL 5 as MySQL 4

I use MySQL 5 as the default database for the work that I usually do.

Today I came across a situation where I needed to test some MySQL 4 functionality.

An option was to install MySQL 4 on another port (not the standard 3306).

However, an easier option is to simply switch the MySQL mode.

/* show the current sql mode */

SELECT @@GLOBAL.sql_mode;

/* change the settings to mysql 4 mode */

/* the 'GLOBAL' keyword changes the mode for all clients  that connect from that time on */

SET GLOBAL sql_mode = 'NO_FIELD_OPTIONS,HIGH_NOT_PRECEDENCE';

More information can be found at: http://dev.mysql.com/doc/refman/5.0/en/server-sql-mode.html

Hello Ubuntu! I’m going easy on Vista

Today I had an interesting conversation with colleagues and friends about Vista and who all amongst us wanted to upgrade our home computers to Vista.

All of them said they were going to hold off upgrading their home machines.

There seemed to be a few valid reasons:

  • There are still a lot of “unknowns” about Vista.
  • It might have all the oomph but the home computers need to match the oomph.
  • Price. No one wanted to pay 400 bucks (NZ) for only an upgrade. And that too upgrade to the home edition.

All my temptation to upgrade to Vista was tempered after this conversation. And rightly so. That was all it was — a temptation.

However, I’ve been meaning to make my machine dual-boot — Windows and Linux. So that is the project that I am going to undertake this weekend.

I’m going to be installing Ubuntu alongside Windows XP.

In case you haven’t heard about it, “Ubuntu is a free, open source Linux-based operating system that starts with the breadth of Debian and adds regular releases (every six months), a clear focus on the user and usability (it should “Just Work”, TM) and a commitment to security updates with 18 months of support for every release (and with 6.06 LTS you get 3 years on the desktop and 5 on the server!).” You can read more on the Ubuntu site.”

From what I’ve read and seen of it, I am very impressed. I downloaded the Ubuntu CD image file and have burnt it on a CD. (If you want you can ask them to snail-mail the CDs to you — and they do it free of any cost to you!)

Rebooted my computer with the CD and it loads up Ubuntu from the CD! Yes, the complete OS runs from the CD! Very impressive. Once logged in, the user interface was really nice and clean. All applications — video, audio, word processor, spreadsheet — were preloaded and all ran without needing to do anything. (Ubuntu ships with Firefox, Thunderbird, Open Office, Gaim, and a whole lot of other free stuff).

It was a wonderful experience! Very different (almost opposite) from what I had when I installed Red Hat on my laptop a few years back.

Now the weekend is going to be spent in partitioning my home computer, installing Ubuntu properly and dual-booting.

I don’t think I’ll be in any hurry to switch to Vista at home in the near future.

Installing Apache Derby Database on ColdFusionMX 7.0.2

I recently re-discovered Apache Derby, a Java-based database that seems like a promising alternative to MySQL. I downloaded it a few months back but for some reason or the other never persisted with it. Anyway, this time around there were other factors so I went through the motions of understanding how it works and setting it up.

My main goal was to get Derby to work with ColdFusionMX. And after a few minutes of looking at the documentation it was fairly easy to figure out what I needed to do. Derby can be installed in two environments:

  • Client/Server: where it runs like any other RDBMS like MySQL Server, MS SQL Server or Oracle. External applications/clients like ColdFusion applications can connect using JDBC/ODBC drivers (or any other mechanism). When Derby runs in client/server environment, multiple applications can access the Derby server over network
  • Embedded: Only a single application can access the database at a time. The reason why it is called “Embedded” is because Derby starts within the instance of an application in which it is embedded. Network access is not available when Derby runs in embedded enviornment.

I chose the embedded option. It seemed the easier of the two, seemed to satisfy the reasons why I wanted to use it (as an alternative to a MySQL database for a sample application I was working on).

And easy it was.

After downloading zip file for the latest release (10.1.3.1), unzipping it in a folder, I copied lib/derby.jar into the /WEB-INF/lib directory of the ColdFusionMX server instance. I then restarted the ColdFusionMX server, and theoretically the Derby database server should now be “embedded” in the ColdFusionMX instance.

To test that I logged into ColdFusionMX administrator, and setup a datasource with the following details:

Datasource Name : derbyDemo
JDBC URL: jdbc:derby:derbyDemo;create=true
Driver Class: org.apache.derby.jdbc.EmbeddedDriver
Driver Name: Derby Database Driver
Username: [left this blank]
Password: [left this blank]

Notice the “create=true” attribute passed as part of the JDBC url. That tells the embedded Derby database server to create the database in case it doesn’t exist. Upon clicking submit (and waiting for a few seconds), ColdFusionMX administrator informed that the datasource was successfully setup. Voila!

The next step was to create some tables, add some data and query the database. As Derby does not ship with a visual client tool, I wrote a 1-minute Derby Query Manager 🙂


<html><head><meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /><title>1-Minute Derby Query Manager</title></head>

<body>

<cfparam name="form.sql" default="">

<cfoutput><h2>Query:</h2><form action="index.cfm" method="post">   <textarea name="sql" cols="60" rows="10">#form.sql#</textarea>   <br/>   <input type="submit" name="btnQuery" value="Query!"/></form></cfoutput>

<cfif len(trim(form.sql))>   <h2>Results:</h2>   <cfset myquery = queryNew("")>   <cftry>      <cfquery name="myquery" datasource="derbydemo">         #preserveSingleQuotes(form.sql)#      </cfquery>      <cfcatch type="database">         <cfdump var="#cfcatch#">      </cfcatch>   </cftry>   <cfdump var="#myquery#"></cfif>

</body></html>


Using this, I issued the following three queries to create a database, populate it and query it.

<!--- Create a table called products ---><cfquery name="qCreate" datasource="derbyDemo">   CREATE TABLE products (   itemNumber INT NOT NULL,   price DECIMAL(5, 2),   stockDate DATE,   description VARCHAR(128)   )</cfquery>

<!--- Insert some dummy values ---><cfquery name="qInsert" datasource="derbyDemo">   INSERT INTO products(itemNumber, price, stockDate, description)   VALUES (4, 29.95, '2006-02-10', 'Male bathing suit, blue'),   (5, 49.95, '2006-02-20', 'Female bathing suit, one piece, aqua'),   (6, 9.95, '2006-01-15', 'Child sand toy set'),   (7, 24.95, '2005-12-20', 'White beach towel'),   (8, 32.95, '2005-12-22', 'Blue-striped beach towel'),   (9, 12.95, '2006-03-12', 'Flip-flop'),   (10, 34.95, '2006-01-24', 'Open-toed sandal')</cfquery>

<!--- Query the table and dump results ---><cfquery name="qGet" datasource="derbyDemo">   Select *   From products</cfquery>

<cfdump var="#qGet#" label="Derby Database Test Results">

All worked as expected. The first query created a table, the second populated it, and the third queried it and retrieved records. Wonderful! I love it when technology works as one expects.

If you want to a slightly more robust tool, Derby ships with a command-line, interactive tool called, ij (in the frameworks/embedded/bin/ directory). There is also a third-party application called Squirrel SQL Client, a Java-based UI to work with various database platforms, including Apache Derby.

I’m in the process of writing a little more useful Flex 2.0 based tool at work. I’ll post a link to it when I’m done.

All in all, it was very easy to get Apache Derby to work with ColdFusionMX. Once I have a decent Flex-based tool, I’m quite sure I’ll be using much more of Derby in the projects I work on.