Skip to content

Instantly share code, notes, and snippets.

View mp911de's full-sized avatar
🚑
I may be slow to respond…

Mark Paluch mp911de

🚑
I may be slow to respond…
View GitHub Profile
@mp911de
mp911de / ChoiceValuesService.java
Last active December 20, 2015 06:29
Suite for WebService Delegators
public interface ChoiceValuesService {
ChoiceValues getChoiceValues(String choiceValuesId, boolean useCache) throws ChoiceValuesNotFoundException;
}
@mp911de
mp911de / FieldComparisonQLToken.java
Created November 12, 2013 07:26
Leveraging dynamic queries
/**
* @author <a href="mailto:mpaluch@paluch.biz">Mark Paluch</a>
* @since 07.11.13 12:36
*/
public class FieldComparisonQLToken implements FieldQLToken {
private String field;
private String value;
private QueryComparator queryComparator = QueryComparator.EQUAL_TO;
@mp911de
mp911de / AbstractConfigurationTest.java
Created November 22, 2013 14:29
Cached Apache Commons XML Configuration
import org.apache.commons.configuration.HierarchicalConfiguration;
import org.apache.commons.configuration.SubnodeConfiguration;
import org.junit.Test;
import static org.junit.Assert.assertEquals;
/**
* @author <a href="mailto:mpaluch@paluch.biz">Mark Paluch</a>
* @since 22.11.13 14:48
*/
@mp911de
mp911de / devices.xml
Created December 13, 2013 18:47
Example output of player/devices
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<midiDeviceInfos>
<device id="0">
<name>Gervill, Software MIDI Synthesizer (OpenJDK)</name>
<types>
<type>SYNTHESIZER</type>
</types>
</device>
<device id="1">
<name>Real Time Sequencer, Software sequencer (Oracle Corporation)</name>
--- dist/hadoop-0.23.10/sbin/hadoop-daemon.sh 2013-12-03 06:59:44.000000000 +0100
+++ customization/sbin/hadoop-daemon.sh 2014-02-20 09:23:15.000000000 +0100
@@ -108,8 +108,8 @@
# some variables
export HADOOP_LOGFILE=hadoop-$HADOOP_IDENT_STRING-$command-$HOSTNAME.log
-export HADOOP_ROOT_LOGGER="INFO,DRFA"
-export HADOOP_SECURITY_LOGGER="INFO,DRFAS"
+export HADOOP_ROOT_LOGGER=${HADOOP_ROOT_LOGGER:-INFO,DRFA}
+export HADOOP_SECURITY_LOGGER=${HADOOP_ROOT_SECURITY_LOGGER:-INFO,DRFAS}
@mp911de
mp911de / add-gelf-logger.cli
Last active August 29, 2015 14:01
add-gelf-logger.cli
/subsystem=logging/custom-handler=GelfLogger/:add(module=biz.paluch.logging,class=biz.paluch.logging.gelf.jboss7.JBoss7GelfLogHandler,properties={ \
host="<Your Logstash Host>", \
extractStackTrace=true, \
filterStackTrace=true, \
mdcProfiling=true, \
facility="JBoss AS7/AS8", \
additionalFields="Environment=Test", \
mdcFields="remoteAddr,remoteUser,sessionId,requestUri,requestMethod" \
},level=INFO)
<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/">
<!-- ================================= -->
<!-- Preserve messages in a local file -->
<!-- ================================= -->
<!-- A time/date based rolling appender -->
<appender name="FILE" class="org.jboss.logging.appender.DailyRollingFileAppender">
<errorHandler class="org.jboss.logging.util.OnlyOnceErrorHandler"/>
200a201,206
> if [ -r "$CATALINA_BASE/bin/logstash-gelf-1.4.2.jar" ] ; then
> CLASSPATH=$CLASSPATH:$CATALINA_BASE/bin/logstash-gelf-1.4.2.jar:$CATALINA_BASE/bin/json-simple-1.1.jar:$CATALINA_BASE/bin/jedis-2.5.1.jar:$CATALINA_BASE/bin/commons-pool2-2.0.jar
> else
> CLASSPATH=$CLASSPATH:$CATALINA_HOME/bin/logstash-gelf-1.4.2.jar:$CATALINA_HOME/bin/json-simple-1.1.jar:$CATALINA_HOME/bin/jedis-2.5.1.jar:$CATALINA_HOME/bin/commons-pool2-2.0.jar
> fi
>
#!/bin/sh
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
* Marker for a method argument to use it as part of the cache key (multiple arguments can be are annotated with @CacheKey)
*
*/
@Target({ ElementType.PARAMETER })