Blog
Omitting Default Drupal Styles
Submitted by Aaron Longwell on Sat, 2005-10-01 15:08.Drupal's default styles (from misc/drupal.css) can be omitted by using a PHPTemplate theme override function.
function phptemplate_stylesheet_import($stylesheet, $media = 'all') {
if ($stylesheet != 'misc/drupal.css') {
return theme_stylesheet_import($stylesheet, $media);
}
}
Jetty with mod_jk on Linux
Submitted by Aaron Longwell on Wed, 2005-08-24 20:57.Create group webadmin. Grant group access to all users who need administrative access to the web server.
Download the Jetty distribution from jetty.mortbay.org.
Extract to /usr/local/jetty-%VERSION%.
Create symbolic link to /usr/local/jetty-%VERSION% at /usr/local/jetty.
Edit /usr/local/jetty/extra/unix/bin/boot-jetty.sh. Change the JAVA_HOME variable to /etc/alternatives/java_sdk. Change JETTY_HOME to /usr/local/jetty. Change JETY_XML_FILE to /usr/local/jetty/etc/admin.xml /usr/local/jetty/etc/jetty.xml. Check permissions on LOG_DIR.
Create a symbolic link to /usr/local/jetty/extra/unix/bin/boot-jetty.sh at /etc/init.d/jetty. Set permissions for /etc/init.d/jetty.
Manual Version Increment with CVS
Submitted by Aaron Longwell on Thu, 2005-08-11 13:06.CVS' major version number (the 1 in 1.2) can be incremented manually. This is done with a command like the following.
cvs commit -r 2 filename
The example above will set the version of the specified file to 2.1. After this is done, a cvs update -A may be required.
cvs update -A filename
SSH Agent Setup with Cygwin
Submitted by Aaron Longwell on Mon, 2005-08-08 09:18.To get an SSH agent running in all Cygwin console windows, change the cygwin.bat file's last line to the following.
ssh-agent bash --login -i
This will open BASH from within an SSH agent parent process, allowing the ssh-add command to store private keys. To automatically load keys, you can add the following line to your ~/.bash_profile file.
ssh-add ~/.ssh/*id_dsa
Remember to Check Input Format Permissions
Submitted by Aaron Longwell on Wed, 2005-08-03 15:02.I worked for some time today on a permissions problem in Drupal. I wanted to allow all administrators (a role) edit access to all page content. I first tried the taxonomy_access module, to no avail; access was denied. I then installed the nodeperm module; again no edit rights.
Finally I discovered that the problem was not the permissions system in general, but a specific permission. The content I was trying to edit was using the "Full HTML" input format, which was not available for the user in question. Drupal was forbidding access to the entire node because it was using an unsupported input format.
Building a Drupal Node Module
Submitted by Aaron Longwell on Tue, 2005-08-02 13:52.Design Database Table
Connecting Apache to Java With mod_jk (on Windows)
Submitted by Aaron Longwell on Mon, 2005-08-01 22:15.Virtually all J2EE servlet containers come bundled with an HTTP server, and setting one of them up is usually very simple. Despite the conveniece, I've found many reasons not to use these bundled HTTP servers in even a development/testing environment. In production, the decision is simple: the Apache HTTPD server is faster, more stable, more secure, more configurable and more powerful than any bundled HTTP server. In development and testing, I've found the configurability of Apache to be an enormous asset, offsetting the additional challenge of using mod_jk to link Apache and the servlet container.
Downloading mod_jk
The mod_jk package is closely connected to the development of Jakarta Tomcat, and can be downloaded most easily by finding a tomcat mirror site. From the Tomcat site, make your way to a download mirror (via the download links), and then browse to jakarta/tomcat-connectors/jk/binaries/ once inside the mirror (paths may be slightly different due to mirror uniquenesses). From the binaries directory for your platform, download the newest version of mod_jk that matches your Apache version. Note that there are separate packages for the Apache 1.x and 2.x release cycles.
Placing the Module
After downloading the .so file, you'll need to place it in your Apache modules directory. Rename the file mod_jk.so and place it in %APACHE_ROOT%/modules.
Notifying Apache
Create a file d:/www-config/mod_jk-apache.conf, and place the following statements in it.
LoadModule jk_module "modules/mod_jk.so"
JkWorkersFile "d:/www-config/mod_jk-workers.properties"
JkLogFile "d:/www-logs/mod_jk.log"
JkLogLevel warn
#
# Standard mod_jk mappings
#
JkMount /*.jsp java1
JkMount /servlet/* java1
JkUnMount /servlet/*.gif java1
That file is imported using the Apache configuration recommended in another post, where Apache's httpd.conf includes all .conf files in d:/www-config. Note: the documentation for mod_jk directives is available.
The workers.properties file referenced above is a listing of "workers" (instances of a Java servlet container). Create the file d:/www-config/mod_jk-workers.properties.
worker.list=java1
worker.java1.port 8009
worker.java1.host localhost
worker.java1.type ajp13
The complete chain works like this: 1) The Apache JkMount and JkUnmount directives tell Apache which request patterns to forward on to the servlet container by its "worker" name. 2) The servlet container with the worker name in question receives the request as if it came directly from the client computer. 3) The servlet container's response is retrieved by Apache and returned to the end user. The trick is that only portions of the hosting tree are mapped to Java. Ideally, static HTML, Javascript, CSS and images are handled by Apache directly, without having to consult the servlet container.
Using Code Filter and Line Break Converter
Submitted by Aaron Longwell on Mon, 2005-08-01 19:08.The codefilter module creates its formatting by inserting <code> tags in the markup. These tags are not excluded from the Line Break Converter. This can be corrected. Just edit the following line in modules/filter.module.
@(?(?:pre|script|style)[^>]*>)@i
Change it to:
@(?(?:pre|code|script|style)[^>]*>)@i
This simply adds the <code> tag to the exclusion list.
Signage Guidelines (Character Size vs. Reading Distance)
Submitted by Aaron Longwell on Wed, 2005-07-20 14:38.I've often needed to know what type size to use for signage graphics. Logically, there would be some kind of ratio between type size and reading distance, at least for average people.
Today I discovered a document from Transport Canada, that provides some detailed analysis of this very problem.
Here's the bottom line for building signage:
- Building entrance signage: at least 150mm (6in).
- Direction signs in corridors: 50-100mm (2-4in).
- Wall mounted information signs, a size of 15-25mm (0.5-1in).
The document also contains a chart (attached) that explains the decline of legibility over distance. The following table highlights a few key distances. In each case, the lower type size number is the minimum legible size for 20/20 readers. The upper number is the optimal size for 20/60 readers. Note that at 70m and above, 20/60 readers cannot read anything smaller than 250mm type.
| Max Reading Distance | Min Type Size |
|---|---|
| 10m | 20-50mm |
| 20m | 25-100mm |
| 30m | 30-150mm |
| 40m | 50-200mm |
| 50m | 60-250+mm |
| 60m | 75-250+mm |
| 70m | 80-250+mm |
| 80m | 100-250+mm |
| 90m | 110-250+mm |
| 100m | 125-250+mm |
Installing RedHat-based Linux on an Acer TravelMate 800
Submitted by Aaron Longwell on Wed, 2005-07-20 11:40.I have a note that installing CentOS requires the allow cddma command to be specified at boot of the installer.
linux allowcddma
After installing the operating system a driver for the Intel Pro 2100 needs to be installed. This is done with noarch RPM file. It must be installed as root, and it's easiest to use the CDROM.
rpm -Uvh ipw2100*.rpm
Then enable the module with modprobe.
modprobe ipw2100
