Displaying keyword search results 1 - 12
Created by Dr. Xi on September 23, 2013 09:00:22 Last update: September 23, 2013 09:17:55
Tsung is an open-source multi-protocol distributed load testing tool. It's written in Erlang , but don't let that dissuade you. Here are some simple steps to get started. Install Tsung. On Ubuntu, this is simply: sudo apt-get install tsung . Create a config file ( tsung.xml ):
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYP...Beware of the dumptraffic attribute. You might want to set it to false for a real load test. Run the test:
$ tsung -f tsung.xml start Starting Tsung "L...Generate the reports:
$ cd /home/drxi/.tsung/log/20130923-1031 $ /usr...Open the report file in your browser: file:///home/drxi/.tsung/log/20130923-1031/report.html . For HTTPS testing change the server line to:
<servers> <server host="192.168.80.160" port="...
Created by Fang on September 07, 2009 20:44:15 Last update: November 03, 2011 14:43:19
Step 1: Repackage a web app as EAR A Java EE application is a multimodule Maven project. At the very least you'll need to package a WAR and an EAR. To get started, I'll simply re-package the simple webapp as an EAR. Create a directory named javaee-app Copy the webapp from here to javaee-app . Rename struts1app to webapp . Create pom.xml under javaee-app :
<project> <modelVersion>4.0.0</modelVersion>...Create a directory named ear under javaee-app . Create pom.xml under ear :
<project> <modelVersion>4.0.0</modelVersion>...Modify pom.xml in the webapp directory so that it looks like this:
<project> <modelVersion>4.0.0</modelVersion> ...Build with " mvn package " in the javaee-app directory. You can see that ear-1.0.ear is successfully generated in javaee-app/ear/target . Maven successfully resolves dependencies between the sub-projects....
Created by Fang on October 28, 2011 14:49:53 Last update: October 28, 2011 14:52:19
Facelet templates can be nested, for example, a page can use a template which inherits from another template. To demonstrate this, let's start from the simple example and make these additions: Add a place holder for CSS style sheets in WEB-INF/templates/default.xhtml :
<h:head> <title>Facelets Template Demo</tit...Add a derivative template ( WEB-INF/templates/default-style.xhtml ) which provides CSS:
<?xml version="1.0" encoding="UTF-8"?> <ui:comp...Add a page that uses the styled template ( home-style.xhtml ):
<?xml version="1.0" encoding="UTF-8"?> <ui:comp...The only difference between this file and home.xhtml is the template being used. Compare the display of the pages home.xhtml and home-style.xhtml .
Created by freyo on September 07, 2011 16:46:14 Last update: September 07, 2011 19:23:00
The Android unit test framework is based on JUnit 3 , not JUnit 4. Test cases have to extend junit.framework.TestCase or a subclass (such as android.test.InstrumentationTestCase ). Tests are identified by public methods whose name starts with test , not methods annotated with @Test (as in JUnit 4). An Android test suite is packaged as an APK, just like the application being tested. To create a test package, first you need to identify the application package it is testing. Google suggests to put the test package source in a directory named tests/ alongside the src/ directory of the main application. At runtime, Android instrumentation loads both the test package and the application under test into the same process. Therefore, the tests can invoke methods on...
Created by alfa on July 01, 2011 13:16:12 Last update: July 01, 2011 13:16:12
This is a simple doclet that prints all public methods and their parameter names and types. Code
import com.sun.javadoc.*; public class List...Compile
javac -cp $JAVA_HOME/lib/tools.jar:. ListMethodsDo...Use
javadoc -doclet ListMethodsDoclet -sourcepath /pat...
Created by alfa on June 03, 2011 09:41:03 Last update: June 03, 2011 09:41:03
Dynamic proxy can be used to eliminate the need to stub out unused interface methods. This is an example for a simple SAX content handler for XML parsing. The org.xml.sax.ContentHandler interface requires 11 methods be implemented but we only need three:
import java.io.IOException; import java.util.Ar...With a dynamic proxy, we don't need the empty blocks for the unused methods:
import java.io.IOException; import java.util.Ar...Equivalently (with anonymous inner class):
import java.io.IOException; import java.util.Ar...demo.xml :
<breakfast-menu> <food> <name>Belgian W...
Created by Dr. Xi on February 28, 2011 15:39:08 Last update: February 28, 2011 15:39:08
For simple projects, archetype:generate seemed too heavy for me, but creating the standard Maven file structure by hand is such a chore. So I created this simple script to ease the pain:
#!/bin/sh if [ $# -lt 4 ]; then echo "Us...Example usage:
./initmvn.sh myProject theGroupId theArtifactId co...
Created by Dr. Xi on October 26, 2010 04:47:37 Last update: January 11, 2011 20:00:36
<!doctype html> <html> <head> <style typ...
Created by James on June 30, 2010 19:04:45 Last update: July 03, 2010 21:24:33
/** * * AJAX IFRAME METHOD (AIM) * http...The above code only supports HTML responses. In order to support JSON responses, the above...
Created by Dr. Xi on November 19, 2008 00:22:27 Last update: January 07, 2010 23:00:36
There is a open source project named [ini4j] for processing Windows .ini configuration files. However, I found it an overkill for my purposes. So here is my simple implementation of a .ini parser. It mimics the standard java.util.Properties class with enhancements to get and set properties by section name. There are only a few simple rules: Leading and trailing spaces are trimmed from section names, property names and property values. Section names are enclosed between [ and ] . Properties following a section header belong to that section Properties defined before the appearance of any section headers are considered global properties and should be set and get with no section names. You can use either equal sign ( = ) or colon ( : )...
Created by Fang on September 07, 2009 16:39:37 Last update: September 07, 2009 18:43:04
It's easiest to use the archetype plugin to start a new Maven project. I'll use struts 1 as example since it's not in the built-in archetypes for archetype:generate . Generate a simple webapp with archetype:generate :
C:\work\maven>mvn archetype:generate -DarchetypeAr...It generates a directory structure like this:
struts1app struts1app/pom.xml struts1app/src...with a simple POM:
<project xmlns="http://maven.apache.org/POM/4.0.0"...Create settings.xml in $HOME/.m2 , add Java.net repository for Java EE dependencies:
<?xml version="1.0" encoding="UTF-8"?> <setting...Add Java EE and Struts dependencies in pom.xml . Note that the Java EE dependency has scope provided , meaning that the web app container provides the jars, therefore we don't need to bundle them with our war fie.
<project xmlns="http://maven.apache.org/POM/4.0.0"...Create a directory named java under main , create the Struts form and...
Created by Fang on August 13, 2009 04:18:26 Last update: August 13, 2009 04:18:26
To start a simple "Hello World" project in maven, enter:
mvn archetype:create -DgroupId=com.example -Dartif...in the command line. It will take a while for Maven to run. But eventually it will create the standard Maven directory structure with a "Hello World" app and a fake JUnit test. Enter
mvn packagewill build the simple App into a jar under the target directory. Run the resulting App:
C:\maven\hello-world>java -cp target\hello-world-1...This is the generated pom: