Skip to content

Instantly share code, notes, and snippets.

View Tiim's full-sized avatar

Tiim

View GitHub Profile
@Tiim
Tiim / Exception
Last active September 2, 2015 18:45
Exception in thread "main" org.springframework.jdbc.BadSqlGrammarException: StatementCallback; bad SQL grammar [CREATE TABLE test (id INTEGER PRIMARY KEY)]; nested exception is org.h2.jdbc.JdbcSQLException: Tabelle "TEST" besteht bereits
Table "TEST" already exists; SQL statement:
CREATE TABLE test (id INTEGER PRIMARY KEY) [42101-188]
at org.springframework.jdbc.support.SQLErrorCodeSQLExceptionTranslator.doTranslate(SQLErrorCodeSQLExceptionTranslator.java:231)
at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:73)
at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:415)
at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:439)
at TestMain.main(TestMain.java:19)
Caused by: org.h2.jdbc.JdbcSQLException: Tabelle "TEST" besteht bereits
Table "TEST" already exists; SQL statement:
local monitor = peripheral.wrap("right");
rednet.open("top");
maxX, maxY = monitor.getSize();
curX, curY = 1,1;
print("Max X: " .. maxX .. " Max Y: " .. maxY);
names = {};
@Tiim
Tiim / PlaySound.java
Created November 16, 2012 17:53
Java Play Sound
package org.wikijava.sound.playWave;
import java.io.IOException;
import java.io.InputStream;
import javax.sound.sampled.AudioFormat;
import javax.sound.sampled.AudioInputStream;
import javax.sound.sampled.AudioSystem;
import javax.sound.sampled.LineUnavailableException;
import javax.sound.sampled.SourceDataLine;
@Tiim
Tiim / gist:3958945
Created October 26, 2012 13:52
Zooming
g.translate(getTranslateX(), getTranslateY());
g.translate(-viewport.width / 2, -viewport.height / 2);
g.scale(getZoom(), getZoom());
g.translate((viewport.width / 2) * getZoom(), (viewport.height / 2) * getZoom());
// As soon as getZoom() is not 1.00, it breaks!
final JCommandPopupMenu menu = new JCommandPopupMenu();
menu.addMenuButton(new JCommandMenuButton("Hallo",null));
button.setCommandButtonKind(JCommandButton.CommandButtonKind.POPUP_ONLY);
button.setPopupCallback(new PopupPanelCallback() {
@Override
public JPopupPanel getPopupPanel(final JCommandButton commandButton) {
return menu;
}