Google API References
Sunday, December 11th, 2011- Google API Wiki Site
- Google OAuth 2 doc (with javascript support)
<dependency>
<groupId>c3p0</groupId>
<artifactId>c3p0</artifactId>
<version>0.9.1.2</version>
</dependency>
ComboPooledDataSource cpds = new ComboPooledDataSource();
cpds.setDriverClass( "org.postgresql.Driver" ); //loads the jdbc driver
cpds.setJdbcUrl( "jdbc:postgresql://localhost/testdb" );
cpds.setUser("swaldman");
cpds.setPassword("test-password");
// the settings below are optional -- c3p0 can work with defaults
cpds.setMinPoolSize(5);
cpds.setAcquireIncrement(5);
cpds.setMaxPoolSize(20);
// The DataSource cpds is now a fully configured and usable pooled DataSource
...
Cleaning up on app shutdown
DataSources.destroy( cpds );
For Hibernate, the maven dist is
<dependency> <groupId>org.hibernate</groupId> <artifactId>hibernate-c3p0</artifactId> <version>3.5.1-Final</version> </dependency>
import org.slf4j.Logger; import org.slf4j.LoggerFactory;
private static final Logger logger = LoggerFactory.getLogger(AnyClass.class);
In the Web.xml
<web-app>
<session-config>
<session-timeout>60</session-timeout>
</session-config>
...
</web-app>
<delete> <fileset dir="WEB-INF/lib" includes="**/some*.jar" excludes="**/some-other*.jar" /> </delete>
<copy todir="../new/dir">
<fileset dir="src_dir"/>
</copy>
<copy todir="../dest/dir">
<fileset dir="src_dir">
<exclude name="**/*.java"/>
</fileset>
</copy>
<copy todir="../dest/dir">
<fileset dir="src_dir" excludes="**/*.java"/>
</copy>
<!-- =========================================================== -->
<!-- Set handler Collection Structure -->
<!-- =========================================================== -->
<Set name="handler">
<New id="Handlers" class="org.eclipse.jetty.server.handler.HandlerCollection">
<Set name="handlers">
<Array type="org.eclipse.jetty.server.Handler">
<Item>
<New id="akuiContext" class="org.eclipse.jetty.webapp.WebAppContext">
<Set name="contextPath">/mywebapp</Set>
<Set name="resourceBase">/path/to/single/mywebapp</Set>
</New>
</Item>
</Array>
</Set>
</New>
</Set>
#format: -agentlib:jdwp=name1[=value1],name2[=value2]... java -agentlib:jdwp=transport=dt_socket,server=y,address=8000,suspend=n start.jar
help: prints a brief message on how to use it and exits the VM.
server: (”n” or “y”) If “y,” listen for a debugger application to attach; otherwise, attach to the debugger application at the specified address.
address: transport address for the connection. If server=n, attempt to attach to a debugger application at this address. If server=y, listen for a connection at this address.
timeout: If server=y, this specifies the timeout, in milliseconds, to wait for the debugger to attach. If server=n, this specifies the timeout, in milliseconds, to use when attaching to the debugger.
suspend: If “y,” JVM suspends the execution until a debugger connects to the debuggee JVM.
More info: Techrepublic and Source: StackOverflow
mvn -Dmaven.test.skip=true package
<repository> <id>jboss-repository-group</id> <name>jboss-repository-group</name> <url>https://repository.jboss.org/nexus/content/groups/public/</url> <layout>default</layout> </repository>
Note: the “http://repository.jboss.org/maven2/” is deprecated. Use the above one (Announcement, Getting Started Doc ).
Parsing CSV is not as simple at it seems. Not hard, but cumbersome.
Here is a simple Lib that does the job: Open CSV (download)
CSVReader reader = new CSVReader(new FileReader(ADDRESS_FILE));
String [] nextLine;
while ((nextLine = reader.readNext()) != null) {
System.out.println("Name: [" + nextLine[0] + "]\nAddress: [" + nextLine[1] + "]\nEmail: [" + nextLine[2] + "]");
}
Yes, File.renameTo is used to move file.
// File (or directory) to be moved
File file = new File("filename");
// Destination directory
File dir = new File("directoryname");
// Move file to new directory
boolean success = file.renameTo(new File(dir, file.getName()));
if (!success) {
// File was not successfully moved
}