Category Archives: javascript

Ubuntu Javascript Fail

The “out of the box” apache on Ubuntu comes with a “feature” called “javascript-common” enabled. I haven’t got much idea what this wretched thing does, other than screw me up. I remember now that I had to struggle this some time back on Cinnamon. Now I am in Ohio trying to get something running on a box there, and tearing my hair out once again over the same issue.

This feature adds an Alias directive that takes the directory “/javascript” and sends it off to /usr/share/javascript. So if you are foolish enough to have a directory in your website called “/javascript” (and who would ever dream of putting their javascript files in a directory called javascript, after all) it will fail.

The directory /usr/share/javascript has some nice stuff in it, including jquery, and I guess it is a nice convenience feature for some people. But am I the only one who things it is crazy for a distribution to do something that breaks websites that have a commonly named directory like javascript!?

Apache Configuration Issues

Trying to set up a new Zend Framework (ZF) website, I struggled once again with getting the setup correct. I learned some lessons, and this post is supposed to help me remember them.

First, the requirements.

1) ZF websites need rewrite rules to force all the urls through index.php so the can be picked apart. Also, ZF websites using the ZF config mechanisms need an APPLICATION_ENV php variable set somewhere in the site configuration, so the website can figure out where it is running and make hosting specific decisions (like, e.g. where the database will be, whether to turn on debugging, etc.).

2) I want to keep the website in a repository, and check it out onto different web-hostsĀ  for testing, development, production. So any configuration stuff which is web-host specific should not be in the repository but in the host configuration files.

3) Although the urls for the ZF website need to be rewritten to index.php, there may be other urls (like phpmyadmin) that should not be rewritten. So the configuration has to allow for this. In particular on some websites (like wmbuck.net) the website itself redirects non-logged in users to the blog (this blog) with a redirect to /blog/. The rules need to allow normal handling of this url (to select /blog/index.php) in the normal way.

The rewrite rules and application environment stuff can be put in an .htaccess file within the DocumentRoot. Most ZF documentation describes doing it this way. But for me, at least the application environment variable can’t be here because everything under DocumentRoot is in the repository. So I want APPLICATION_ENV oregano on one box, APPLICATION_ENV tarragon on another box, and if I put this in .htaccess, and .htaccess is in the repository the file can only have one or the other setting.
Continue reading Apache Configuration Issues

Adding maps to my java flying apps

Just for fun I explored the Google Maps API and put maps into the flying apps. The google maps aren’t FAA charts or course, but on a multiple leg trip it is quite handy to be able to see the various stops laid out on a map. I also added maps to the page that shows the list of checkpoints. I think this is pretty handy in flight planning, as the alternative is to mark up a hardcopy chart.

Another nice new feature is airport lookup. This is a jquery enabled box on the pages that are asking for an airport ID. If you are planning to fly to some city but don’t know the ID of the airport there, you can just type in the name of the city. It is an autocomplete thing which does an ajax lookup in the airport database as you are typing, giving you a progressively narrower list of airports in cities that match what you have typed. Once you select an airport the ID is automatically put into the field.

Try the flight planner to see these new features.

JQuery with Zend Framework

A couple of years ago I incorporated some jquery stuff, and some jquery-ui stuff into a website I had built on Zend Framework. At that time Zend Framework didn’t have its own support for jquery (or if it did, I didn’t know about it).

Now I’m working on a new site, and I find that there is now a jquery view helper to help do jquery stuff. It is located in the “extras” library. I also didn’t know about this library. When did this get added? Anyway, stumbling around on the net I discovered that there is now some jquery support in Zend Framework. Cool. So I set about learning how to use it.

I often find the documentation in the Programmers Reference in Zend Framework to be very cryptic and difficult. Probably this is because I am a very old programmer who learned the craft while dodging dinosaurs back in the stone age. I think people freshly learning to program today have a considerably different perspective (and probably vastly better). Sometimes I just have to go read the code. I had a devil of a time getting the jquery stuff to actually work. These notes maybe will help me the next time I have to do it. Continue reading JQuery with Zend Framework