Skip to content

Instantly share code, notes, and snippets.

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd">
<bean id="name1" class="java.lang.String">
<constructor-arg value="tcp://test?foo=bar&amp;foo2=bar2"/>
</bean>
<bean id="name2" class="java.lang.String">
<constructor-arg><value>tcp://test?foo=bar&amp;foo2=bar2</value></constructor-arg>
@saltnlight5
saltnlight5 / .hgignore
Created January 20, 2012 22:39
Mercurial Tips
# Add this in your $HOME/.hgignore to have it affect all hg projects globally.
syntax: glob
target/*
.settings/*
.project
.classpath
<!-- Build helper plugin adds additional classpath into test phase (test) -->
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<version>1.7</version>
<executions>
<execution>
<phase>process-resources</phase>
<configuration>
<resources>
@saltnlight5
saltnlight5 / script-console.jsp
Last active August 16, 2017 09:53
script-console.jsp
<%@ page import="java.io.*,java.util.*,javax.script.*" %>
<%
// A script console jsp for Java
// Last modified: Zemian Deng <[email protected]> 05/15/2014
ScriptEngineManager factory = new ScriptEngineManager();
// Get all the script engine names available by inspecting the classpath
List<String> scriptEngineNames = new ArrayList<String>();
for (ScriptEngineFactory fac : factory.getEngineFactories()) {
@saltnlight5
saltnlight5 / snoop.jsp
Created July 22, 2012 22:30
JSP - Snoop Server Info from OpenShift
<HTML>
<HEAD>
<TITLE>JBossAS7 JSP snoop page</TITLE>
<%@ page import="javax.servlet.http.HttpUtils,java.util.Enumeration" %>
<%@ page import="java.lang.management.*" %>
<%@ page import="java.util.*" %>
</HEAD>
<BODY>
<H1>WebApp JSP Snoop page</H1>
#
# Bash Profile script
# Zemian Deng 07/03/2012
#
export EASYANT_HOME=$HOME/apps/easyant
export JAVA_HOME=$HOME/apps/jdk
export PATH=$JAVA_HOME/bin:\
$HOME/apps/maven/bin:\
@saltnlight5
saltnlight5 / email.py
Last active October 10, 2015 09:07
Python Scripts
import smtplib
message = """From: [email protected]
To: [email protected]
Subject: SMTP e-mail test
This is a test e-mail message.
"""
s = smtplib.SMTP('smtp.mycompany.com')
@saltnlight5
saltnlight5 / groovySql.groovy
Created September 20, 2012 14:22
Groovy Script Examples
// groovy -cp $HOME/.m2/repository/com/h2database/h2/1.3.166/h2-1.3.166.jar groovySql
// http://groovy.codehaus.org/Tutorial+6+-+Groovy+SQL
// Grab will not load the driver! but at least we can trigger it to download it and then use groovy -cp option to run this script.
// @Grab('com.h2database:h2:1.3.166')
import groovy.sql.Sql
sql = Sql.newInstance(
'jdbc:h2:~/test',
@saltnlight5
saltnlight5 / Bash.sublime-build
Created September 27, 2012 00:47
Sublime Text 2
// A build script to run shell script in Windows using cygwin.
// NOTE that a selector is "source.shell", not ".sh"!
{
"cmd": ["C:/cygwin/bin/bash.exe", "--login", "$file"],
"file_regex": "^[ ]*File \"(...*?)\", line ([0-9]*)",
"selector": "source.shell"
}
@saltnlight5
saltnlight5 / build.gradle
Created September 27, 2012 15:56
Gradle Build Exmaples
apply plugin: 'java'
repositories { mavenCentral() }
dependencies {
compile group: 'org.slf4j', name: 'slf4j-api', version: '1.7.1'
compile group: 'com.google.guava', name: 'guava', version: '13.0.1'
testCompile group: 'org.hamcrest', name: 'hamcrest-library', version: '1.3'
testCompile group: 'junit', name: 'junit-dep', version: '4.10'
}