Skip to content

Instantly share code, notes, and snippets.

View dai0304's full-sized avatar

MIYAMOTO Daisuke dai0304

View GitHub Profile
@dai0304
dai0304 / Bar.java
Created November 29, 2010 06:30
check constructor argument 'n' before invoke super constructor
class Bar extends Foo {
Bar(Number n) {
if (n == null) {
throw new IllegalArgumentException();
}
super(n.toString());
}
}
@dai0304
dai0304 / jiemamy-api-tutorial
Created February 14, 2011 12:18
basically usage of Jiemamy API v0.3
void tutorial_01_read() throws Exception {
JiemamySerializer serializer = JiemamyContext.findSerializer();
JiemamyContext context = serializer.deserialize(new FileInputStream("tutorial.jiemamy"));
Set<JmTable> tables = context.getTables();
for (JmTable table : tables) {
System.out.println(table.getName());
}
}
void tutorial_02_write() throws Exception {
public static final class DomainType extends DefaultEntityRef<JmDomain> implements RawTypeDescriptor {
private final OnMemoryEntityResolver<? extends JmDomain> res;
/**
* インスタンスを生成する。
*/
DomainType(SimpleJmDomain x, OnMemoryEntityResolver<? extends SimpleJmDomain> res) {
super(x);
this.res = res;
#!/bin/bash
STR=ABC-0
if [[ "$STR" =~ "-0$" ]]; then
echo A
else
echo B
fi
....
<form method="post" wicket:id="form">
<wicket:container wicket:id="p1"><div class="clearfix error">
<label for="p1" class="xlarge">label1</label>
<div class="input"><input type="text" id="p1" class="xlarge"/></div>
</div></wicket:container>
</form>
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" lang="ja" dir="ltr"
xmlns:wicket="http://wicket.apache.org/dtds.data/wicket-xhtml1.4-strict.dtd">
<head profile="http://purl.org/net/ns/metaprof">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>sample form</title>
<meta name="robots" content="noindex,nofollow" />
<meta http-equiv="content-style-type" content="text/css" />
<meta http-equiv="content-script-type" content="text/javascript" />
@dai0304
dai0304 / MyChart.java
Created October 15, 2011 05:35
GChart subclassing
package com.example.charts4j;
import static com.googlecode.charts4j.Color.ALICEBLUE;
import static com.googlecode.charts4j.Color.BLACK;
import static com.googlecode.charts4j.Color.LAVENDER;
import static com.googlecode.charts4j.Color.WHITE;
import java.util.List;
public class MyChart extends BarChart {
public class WrappingReflectiveOperationException extends Exception {
public WrappingReflectiveOperationException(InvocationTargetException e) {
super(e);
}
public WrappingReflectiveOperationException(IllegalAccessException e) {
super(e);
}
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.Statement;
import java.sql.Time;
public class Main {
public static void main(String[] args) throws Exception {
Connection con = DriverManager.getConnection("jdbc:h2:mem:test");
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" lang="ja" dir="ltr"
xmlns:wicket="http://wicket.apache.org/dtds.data/wicket-xhtml1.4-strict.dtd">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>wicket-snippet</title>
</head>
<body>
<ul>