Skip to content

Instantly share code, notes, and snippets.

@wataru420
wataru420 / CustomFreeMarkerView.java
Created August 8, 2012 03:37
SpringMVCのFreeMarkerでEnum
public class CustomFreeMarkerView extends FreeMarkerView {
@Override
protected void exposeHelpers(Map<String, Object> model, HttpServletRequest request) throws Exception {
super.exposeHelpers(model, request);
model.put("enums", BeansWrapper.getDefaultInstance().getEnumModels());
}
}
@wataru420
wataru420 / example.ftl
Created July 16, 2012 14:09
SpringFreemarkerMacro
<#import "/spring.ftl" as spring />
<a href="<@spring.url '/userUrl'/>">ユーザ</a>
@wataru420
wataru420 / svn:ignore
Created July 12, 2012 04:09
SpringProject用
target
.classpath
.settings
.project
@wataru420
wataru420 / deploy.sh
Created June 24, 2012 13:27
tomcat7でtomcatManager
WAR="/home/cy_jenkins/.jenkins/jobs/hogeapp-build/workspace/target/hogeapp.war"
curl --upload-file $WAR "http://hogeuser:fuga@targethost:8080/manager/text/deploy?path=/hogeapp&update=true"
@wataru420
wataru420 / pom.xml
Created June 14, 2012 11:53
maven-war-plugin
<build>
<finalName>myapp</finalName>
<resources>
<resource>
<directory>${resources.directory}</directory>
</resource>
<resource>
<directory>${basedir}/src/main/resources</directory>
</resource>
</resources>
@wataru420
wataru420 / createtable.sql
Created May 28, 2012 06:03
Mysql Caseでorder
CREATE TABLE `hoge` (
`user_id` char(32) NOT NULL default '',
`category_1` smallint(5) unsigned default NULL,
`category_1_point` int(10) unsigned default NULL,
`category_2` smallint(5) unsigned default NULL,
`category_2_point` int(10) unsigned default NULL,
PRIMARY KEY (`user_id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
@wataru420
wataru420 / error
Created May 26, 2012 13:31
strict modeのerror
Error updating database. Cause: com.mysql.jdbc.MysqlDataTruncation: Data truncation: Data truncated for column 'hoge_colum' at row 133
@wataru420
wataru420 / catalina.sh
Created May 1, 2012 11:47
Tomcat7起動オプション
# CATALINA_OPTS (Optional) Java runtime options used when the "start",
# "run" or "debug" command is executed.
# Include here and not in JAVA_OPTS all options, that should
# only be used by Tomcat itself, not by the stop process,
# the version command etc.
# Examples are heap size, GC logging, JMX ports etc.
.
.
.
@wataru420
wataru420 / jmxremote.access
Created April 27, 2012 11:25
visualVMのためのJMX設定
monitorRole readonly
controlRole readwrite
@wataru420
wataru420 / old-tomcat-threads
Created April 27, 2012 10:43
Tomcat7とmunin
if($xml->{'connector'}->{'http-'.$PORT}->{'threadInfo'}->[0]->{'currentThreadsBusy'} &&
$xml->{'connector'}->{'http-'.$PORT}->{'threadInfo'}->[0]->{'currentThreadCount'}) {
print "busy.value " . $xml->{'connector'}->{'http-'.$PORT}->{'threadInfo'}->[0]->{'currentThreadsBusy'} . "\n";
print "idle.value " .
($xml->{'connector'}->{'http-'.$PORT}->{'threadInfo'}->[0]->{'currentThreadCount'} -
$xml->{'connector'}->{'http-'.$PORT}->{'threadInfo'}->[0]->{'currentThreadsBusy'}) . "\n";
} else {
print "busy.value U\n";
print "idle.value U\n";
}