Recent Notes

Displaying keyword search results 1 - 11
Created by Dr. Xi on May 25, 2012 15:47:34    Last update: May 25, 2012 15:49:33
Steps to configure SSL for Apache HTTPD server on Windows: In Apache2.2/conf/httpd.conf , load mod_ssl and include httpd-ssl.conf : LoadModule ssl_module modules/mod_ssl.so ... In Apache2.2/conf/extra/httpd-ssl.conf , make sure the paths for the cert files point to the cert and key you want to use: # Server Certificate: # Point SSLCertificat... Start up Apache. If it fails, use the command line to see what the error is. There won't be any log in error.log if there are errors in the conf files: C:\Program Files (x86)\Apache Software Foundation\... I corrected the previous error by using the alternative line for SSLSessionCache : # Inter-Process Session Cache: # Configure ...
Created by Dr. Xi on June 22, 2011 12:14:15    Last update: June 22, 2011 12:15:12
Parsing a CVS file seemed to be a sore spot for software development. It's not simple enough that you can roll your own code in a couple of hours, and yet not deemed big enough for a full-fledged project. As a result, there are multiple libraries, each one with its own quirks. This is a summary of some simple tests I've done with five CSV parsers. Apache commons CSV parser : Does not escape backslash. The backslash is treated as literal if not proceeding a double quote, but then there's no way to have a backslash as the last character before the ending quote (even though it's a rare scenario). IOException thrown for unmatched quotes SuperCSV parser Can't handle escapes inside quotes Throws Exception for...
Created by Dr. Xi on June 21, 2011 15:41:51    Last update: June 22, 2011 11:33:36
Demo code for CSV parsing with Apache Commons CSV parser . Java code: import java.io.*; import org.apache.commons.csv... Test with a simple CSV file: psmith01,CLASS2B,Peter Smith 1,YEAR2,1,N,ADVANCED,... Result: Line 1 has 11 values: |psmith01| |CLASS2B|... The parser worked correctly. Test with a more complicated CSV file: "psmith01 abc", "CLASS2B " , " Peter... Result: Line 1 has 4 values: |psmith01 abc| |CLASS... The third line is invalid input, but throwing a Java IOException is a bit grave. Also, the parser is not able to escape a backslash. Add a new line in item two: "One", "Two ", "Three" Result: Line 2 has 3 values: |One| |Two | |...
Created by voodoo on April 13, 2011 13:47:34    Last update: April 13, 2011 13:49:20
You get "permission denied" error from Apache HTTPD for a page. And you checked file/directory permissions (the whole directory path, not just the file) and everything in httpd.conf . If everything seemed right, then SELinux may be blocking the access. Open /var/log/httpd/error_log , you may see a line like this: [Wed Apr 13 15:50:35 2011] [notice] SELinux poli... These are the steps to fix: If the directory resides in a user home directory: # setsebool -P httpd_read_user_content 1 Create a policy package from the audit log: # grep httpd /var/log/audit/audit.log | audit2allo... Apply the policy package just created # semodule -i mypol.pp Restart apache httpd: # apachectl restart
Created by nogeek on September 01, 2010 19:25:09    Last update: December 31, 2010 11:54:45
Edit the file server\default\conf\jboss-log4j.xml and change the log level from INFO to DEBUG : <!-- ============================== --> <!-... Presumably this should change the log level for the console appender (STDOUT) to DEBUG. However, this change alone does not work. It should be used in combination with the system property jboss.server.log.threshold . Either add -Djboss.server.log.threshold=DEBUG to JAVA_OPTS in bin\run.conf.bat : rem # JVM memory allocation pool parameters - modi... or set it from the command line: bin\run -Djboss.server.log.threshold=DEBUG
Created by voodoo on July 30, 2010 14:53:33    Last update: July 30, 2010 14:54:52
The -d switch for cURL sends HTTP POST with data from the command line. To verify the data being posted, this is a CGI script that echos the data back: #!C:/perl/bin/perl.exe ## ## echo -- echos ... Examples: POST data from command line: C:\>curl -d input1=value1^&input1=value2 http://lo... POST data from stdin (with @ before the - symbol): C:\>curl -d @- http://localhost/cgi-bin/echo.pl ... POST data from a file (with @ before the - symbol and input redirect): C:\tmp>cat data.txt abcd 1234 xyz ... For some reason, @ with file name didn't work as expected: C:\tmp>curl -d @data.txt http://localhost/cgi-bin/... One thing to notice is that cURL removes the new line characters when posting (thus the echo back is only one line instead of three). This can...
Created by Fang on April 01, 2010 22:24:58    Last update: April 02, 2010 02:49:38
In this note I'll show you how to create and package a JSP custom tag. The purpose of this tag is to display a random splash image for a home page, among a set of images. We should be able to add or delete candidate splash images from the WAR archive without the need to change the JSP. This is the intended use of the tag: <%@ taglib uri="http://custom.tag.com/demo" prefix... In the above example you provide a set of images named splash*.png (e.g., splash1.png, spalsh2.png, ...), and the tag will pick a random one to display when the JSP is rendered. Let's get started. I'll use Maven for this purpose. Create the standard Maven directory structure ./pom.xml ./src ./src/main ./src/main/jav... pom.xml <project xmlns="http://maven.apache.org/POM/4.0.0"... SplashTag.java package tagdemo; import java.util.ArrayList......
Created by Dr. Xi on January 08, 2010 03:53:37    Last update: January 08, 2010 03:54:56
This is an Ant custom task to merge Properties files I lifted from http://marc.info/?l=ant-user&m=106442688632164&w=2 , with some minor bug fixes. Example usage: <taskdef name="mergeProperty" classname="ant.task.... Implementation: package ant.task.addon; import java.io.Buff...
Created by Dr. Xi on December 14, 2008 19:09:19    Last update: December 14, 2008 19:09:19
My mod_python app failed to extract Python eggs with this error: [Sun Dec 14 09:40:03 2008] [error] [client 127.0... The error message suggested to set the PYTHON_EGG_CACHE environment variable. While this may help solve the problem, there's no reason why the Python egg can't be installed expanded: easy_install -Z MySQL-python-1.2.2.tar.gz
Created by Dr. Xi on September 15, 2008 19:50:39    Last update: September 15, 2008 20:01:50
Create a properties file to hold the properties for the MailLogger: MailLogger.mailhost=smtp.example.com MailLogger... Invoke from command line: ant -DMailLogger.properties.file=C:\Build\MailLogg... Alternatively, invoke from another ant script: <target name="build" depends="checkout"> <e... However, the built-in MailLogger doesn't override buildStarted . Therefore, you can't send email to notify of build starting with MailLogger . To achieve that, you can either use the Mail task or override MailLogger with your own derivative.
Created by Dr. Xi on December 12, 2007 20:30:01    Last update: December 12, 2007 20:32:23
This is a script to tail a log file through the web browser. It uses AJAX, apache web server, mod_python, UNIX utilities tail (requires the --lines switch) and wc . The log file may reside on the web server or any other host accessible from the web server through SSH. Although it's written in python, it should be easy to port to other languages such as Perl. Apache httpd.conf : LoadModule python_module modules/mod_python.so ... Python script: import time, os from os.path import basename ...