A nagging problem that has cropped up on the last 2 projects I've worked on is users cutting and pasting from MS Word into a text area, including curly quotes (“smart quotes”). These always end up as junk after the request is submitted back to the server. For example, the left curly quote ends up as â (The characters with the codes 226, 128, and 156 respectively).
Christopher Pierce's blog
Java as Windows Service with Apache Commons Daemon
Wed, 2009-02-11 21:38 in- 27 comments
- Read more
- 14340 reads
Recently, I wanted to take a Java command line program and turn it into a Windows Service. There are a number of ways to do this, but I decided to try out the Apache Commons Daemon project (http://commons.apache.org/daemon/).
It is actually very simple to turn your Java Program into a service with Commons Daemon but, if you’re like me, you will very quickly become confused by browsing the project page, so here are some tips.
Procrun
On the fly page modification with mod_ext_filter
Fri, 2006-07-14 18:46 in- 2 comments
- Read more
- 3272 reads
Recently, I had wanted to be able to add a header and footer to every web page on a site, but I didn’t want to actually change any code.
The web application in question was hosted on a Tomcat instance that was reverse proxied though Apache 2.2 (which is real easy to set up thanks to "mod_proxy_ajp" that comes with Apache 2.2).
So how did I do this? Well, Apache 2 comes with a super convenient module called "mod_ext_filter" that lets you re-write a page using any executable that takes the original page on "standard in", and writes out the new page on "standard out".
Subversion and Bugzilla integration with BugTraq and ScmBug
Mon, 2006-04-24 12:50 in- 12 comments
- Read more
- 37577 reads
O.K. I have Subversion and Bugzilla sharing accounts (see here) and I have WebSVN allowing only authorized users to browse the repository (see here). Now I would like to be able to link a Subversion commit to a Bugzilla bug.
Ideally, when I do a commit, I would like my GUI tool to include a "Bug ID" text field to enter in bug numbers. I’d like the bug numbers to be added to the commit log message in a standard way, and I’d like the specified bug to be updated in Bugzilla to indicate the modified files.
I was able to accomplish all these things with the BugTraq properties (and tools that support BugTraq like TortoiseSVN and Subclipse) and the ScmBug integration service.
WebSVN: Subversion repository browsing with authorization
Thu, 2006-03-09 10:52 in- 5 comments
- Read more
- 24052 reads
In my last blog entry, I talked about how I got Subversion to use Bugzilla accounts and passwords to authenticate users. At the bottom of that entry, I briefly mentioned that I use an “access file” to limit which Bugzilla users are actually authorized to access the Subversion repository.
Now I want to set up a nice web interface to the repository to quickly and easily track changes to the code. This is especially nice for people with “read-only” access so that they don’t have to install a full subversion client.
The tool I settled on for doing this is WebSVN (http://websvn.tigris.org/) which is a web repository viewer specifically designed for Subversion.
Reuse Bugzilla accounts in Subversion with mod_auth_mysql
Thu, 2006-02-09 11:10 in- 12 comments
- Read more
- 12079 reads
I was recently setting up a development environment with the intent of using Bugzilla and Subversion (via WebDAV).
I needed to create/maintain user accounts for these systems, which was easy enough in Bugzilla, since it has a user maintenance front end. Subversion uses Apache's authentication mechanism, which meant running "htpasswd" to create each user along with their password.
But I had some issues with this configuration:
- Ideally, I didn't want users to have to remember two passwords for Bugzilla and Subversion. But the problem is that users maintain their own password in Bugzilla via the web interface. Once they change it, Bugzilla and Subversion passwords are out of sync.
- If a user wanted to change their Subversion password they would have to tell it to me so I could change it via htpasswd. For liability reasons, I don't want to know the user's password. I want them to be able to change it on their own, but I also don't want to give them access to the htpasswd file.
A quick and easy solution was to configure Apache to use the Bugzilla user table (stored in MySQL) to authenticate users. This can be done using the Apache module "mod_auth_mysql".
A common requirement in many applications is to compare two dates, and to perform an action if the amount of time between them exceeds some threshold. For example "System will perform action X after 2 days".
As good programmers, we would never hard code the value "2", instead we would have some bean property ("actionXDays") that we would configure in our configuration file
(<property name=”actionXDays” value="2"/>).
But what if our requirement changes from 2 days to 2 hours? 2 months? 2 years? Suddenly it is not sufficient to change our configuration file alone, but also how we interpret the value (from days to whatever the new units are).