To debug: Add -Dlog4j.debug to the jvm parameters.
The files log4j.properties or log4j.xml must be on the classpath.
A piggy bank of commands, fixes, succinct reviews, some mini articles and technical opinions from a (mostly) Perl developer.
Jump to
Easily import properties file in JUnit
Pass this parameter to the jvm:
-DPropertyManager.file=/path/to/props.properties
Then in the program:
import junitx.util.PropertyManager; // from http://sourceforge.net/projects/junit-addons/ ?
PropertyManager.getProperty("my.key");
-DPropertyManager.file=/path/to/props.properties
Then in the program:
import junitx.util.PropertyManager; // from http://sourceforge.net/projects/junit-addons/ ?
PropertyManager.getProperty("my.key");
Labels:
config,
java,
junit,
properties
Subversion on a Mac 10.4 (Tiger), behind a firewall
The Subversion project recommends:
- THIS ONE WORKS: MacPorts - has a .dmg installer for 10.4
- need to set environment variable http_proxy if behind a firewall
- then the sudo port -v selfupdate command
- then do sudo port install subversion
- Warning: The installed version of Xcode (2.3) is known to cause problems. Version 2.5 or later is recommended on Mac OS X 10.4. Download Xcode tools.
- Fink - wouldn't install for me, saying "Cannot perform symlink test on this volume because of a permissions problem". Running "Repair Disk Permissions" utility as recommended doesn't help at all.
- Apple's Developer Tools - I don't think it's on the CD. Couldn't find a list of apps anywhere. When I tried, it installed a lot of stuff but I couldn't see svn anywhere.
- OpenCollabNet - ?
Remove all login restrictions for MySQL
Start mysqld (or mysqld_safe) with the --skip-grant-tables option
Labels:
mysql,
networking,
password
Cocoon documentation
Current:
Dead or out-of-date:
Criticism:
- Wiki: http://wiki.apache.org/cocoon/FrontPage (question about docs. Answer: Understand How ASF works)
- Official v2 site: http://cocoon.apache.org/
- Jira bug tracking: https://issues.apache.org/jira/browse/COCOON (issue about docs - there are several more issues regarding out-of-date contribution procedures)
- Cocoon 3 alpha: http://people.apache.org/~reinhard/c3-ref/html/
- List of mailing lists: http://svn.apache.org/repos/asf/cocoon/site/site/mail-lists.html (also a browsable SVN repository of the documentation website - will updating this fix the live site?)
- Main site mailing lists: http://cocoon.apache.org/2.1/1175.html
- Searchable mailing list archives: http://markmail.org/search/?q=list%3Aorg.apache.cocoon.users
- and http://markmail.org/search/?q=list%3Aorg.apache.cocoon.dev
Dead or out-of-date:
- org.apache.cocoon.docs - is this dead?
- This link to Cocoon Bugzilla is dead (it should be Jira now anyway): http://cocoon.apache.org/2.0/howto/howto-bugzilla.html
- Many of the links on this menu are dead: http://cocoon.apache.org/2.0/
- The "View, Edit or comment" link at the bottom of this page is dead: http://cocoon.apache.org/
Criticism:
Use DBUnit
Add to the classpath:
Example program:
- dbunit-2.4.7
- slf4j-api-1.6.1
- slf4j-simple-1.6.1
- mysql-connector-java-5.0.8
Example program:
import java.io.FileOutputStream; import java.sql.*; import org.dbunit.database.*; import org.dbunit.dataset.*; import org.dbunit.dataset.xml.*; // database connection Class driverClass = Class.forName("com.mysql.jdbc.Driver"); Connection jdbcConnection = DriverManager.getConnection("jdbc:mysql://host:port/dbname","user","pass"); IDatabaseConnection connection = new DatabaseConnection(jdbcConnection); // prevent error: Potential problem found: The configured data type factory // 'class org.dbunit.dataset.datatype.DefaultDataTypeFactory' might cause problems with the current database 'MySQL' // (e.g. some datatypes may not be supported properly). connection.getConfig().setProperty(DatabaseConfig.PROPERTY_DATATYPE_FACTORY, new MySqlDataTypeFactory()); // full database export IDataSet fullDataSet = connection.createDataSet(); FlatXmlDataSet.write(fullDataSet, new FileOutputStream("dbname"));
Sprintf in Java
import java.text.MessageFormat; int a = 3; String b = "coders"; System.out.println( MessageFormat.format("{0} Java {1}.", String.format("%04d", a), b) );
Subscribe to:
Posts (Atom)