Skip to content

Instantly share code, notes, and snippets.

protected long getGeneratedLongKey(PreparedStatement stmt) throws SQLException {
ResultSet rs = null;
long result = 0;
try {
rs = stmt.executeQuery("SELECT @@IDENTITY");
rs.next();
result = rs.getLong(1);
} finally {
if (rs != null)
rs.close();
org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestWrapper#getUserPrincipal
old:
public Principal getUserPrincipal() {
Authentication auth = getAuthentication();
if ((auth == null) || (auth.getPrincipal() == null)) {
return null;
}
[INFO]
[INFO] --- maven-dependency-plugin:2.1:tree (default-cli) @ test ---
[INFO] com.example:test:jar:1.0-SNAPSHOT
[INFO] +- com.fasterxml.jackson.dataformat:jackson-dataformat-yaml:jar:2.3.0-SNAPSHOT:compile
[INFO] +- com.fasterxml.jackson.core:jackson-databind:jar:2.3.0-SNAPSHOT:compile
[INFO] | \- com.fasterxml.jackson.core:jackson-annotations:jar:2.3.0-SNAPSHOT:compile
[INFO] +- com.fasterxml.jackson.core:jackson-core:jar:2.3.0-SNAPSHOT:compile
[INFO] \- com.codahale.dropwizard:dropwizard-core:jar:0.7.0-SNAPSHOT:compile
[INFO] +- com.codahale.dropwizard:dropwizard-util:jar:0.7.0-SNAPSHOT:compile
[INFO] | +- com.google.guava:guava:jar:14.0.1:compile
#!/bin/sh
# set the configuration variables below, before running the script
# get the solr nightly build download link from https://builds.apache.org/job/Solr-Artifacts-4.x/lastSuccessfulBuild/artifact/solr/package/
JETTY_URL="http://eclipse.org/downloads/download.php?file=/jetty/stable-9/dist/jetty-distribution-9.0.5.v20130815.tar.gz&r=1"
JETTY_HOME="/opt/jetty"
JAVA='/usr/local/jdk1.7.0_09/bin/java'
JETTY_PORT=8085
JETTY_HOST=127.0.0.1
private boolean resourceTransformed( List<ResourceTransformer> resourceTransformers, String name, InputStream is,
List<Relocator> relocators )
throws IOException
{
boolean resourceTransformed = false;
for ( ResourceTransformer transformer : resourceTransformers )
{
if ( transformer.canTransformResource( name ) )
{
# Just an example.
# @video is a direct reference to a '<video>' element.
# $() is assuming jQuery is being used in this example.
@video.addEventListener("loadedmetadata", (event) =>
actualRatio = @video.videoWidth/@video.videoHeight
targetRatio = $(@video).width()/$(@video).height()
adjustmentRatio = targetRatio/actualRatio
$(@video).css("-webkit-transform","scaleX(#{adjustmentRatio})")
)
public class CurrentUserLoggingFilter implements Filter {
public static final String MDC_CURRENT_ACCOUNT_ID_KEY = "CurrentAccountId";
@Context
HttpContext context;
@Override
public void init(FilterConfig filterConfig) throws ServletException { /* unused */ }
public class CurrentUserLoggingFilter implements Filter {
public static final String MDC_CURRENT_ACCOUNT_ID_KEY = "CurrentAccountId";
@Context
HttpContext context;
@Override
public void init(FilterConfig filterConfig) throws ServletException { /* unused */ }
<html>
<head>
<style type="text/css">
table table {
width: 600px !important;
}
table div + div { /* main content */
width: 65%;
float: left;
}
/* ====================================================================
* eldarion-ajax-core.js v0.10.0
* ====================================================================
* Copyright (c) 2013, Eldarion, Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* * Redistributions of source code must retain the above copyright notice,