Skip to content

Instantly share code, notes, and snippets.

@solomax
solomax / pom.xml
Created January 19, 2019 04:21
Dumb pom.xml illustrating issue in maven-project-info-reports-plugin
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.apache.maven.test</groupId>
<artifactId>team-page-test</artifactId>
<version>1.0.0-SNAPSHOT</version>
<packaging>pom</packaging>
@solomax
solomax / Test.java
Last active January 30, 2019 06:09
commons-collections BidiMap values() test
package org.tmp;
import org.apache.commons.collections4.BidiMap;
import org.apache.commons.collections4.ListValuedMap;
import org.apache.commons.collections4.OrderedBidiMap;
import org.apache.commons.collections4.OrderedMap;
import org.apache.commons.collections4.OrderedMapIterator;
import org.apache.commons.collections4.SetValuedMap;
import org.apache.commons.collections4.SortedBidiMap;
import org.apache.commons.collections4.bidimap.DualTreeBidiMap;
@solomax
solomax / PostTest.php
Created November 8, 2016 13:41
OM PHP API POST test
$options = array (
CURLOPT_RETURNTRANSFER => true // return web page
, CURLOPT_HEADER => false // return headers
, CURLOPT_FOLLOWLOCATION => true // follow redirects
, CURLOPT_ENCODING => "" // handle all encodings
, CURLOPT_USERAGENT => "openmeetings" // who am i
, CURLOPT_AUTOREFERER => true // set referer on redirect
, CURLOPT_CONNECTTIMEOUT => 120 // timeout on connect
, CURLOPT_TIMEOUT => 120 // timeout on response
, CURLOPT_MAXREDIRS => 10 // stop after 10 redirects
@solomax
solomax / Loader.java
Created July 27, 2016 02:48
In-memory Jar Class Loader
/*
* 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
@solomax
solomax / red5
Last active March 10, 2016 05:19
CentOS red5 init
#!/bin/bash
#
# Startup script for Red5
export RED5_HOME=/opt/red5
start_red5="$RED5_HOME/red5.sh"
stop_red5="$RED5_HOME/red5-shutdown.sh"
start() {
echo -n "Starting Red5: "
@solomax
solomax / ISTTest.java
Created October 28, 2015 11:04
Test to prove there is no IST time zone in threetenbp
package com.mycompany.app;
import static org.junit.Assert.assertNotNull;
import java.util.TimeZone;
import org.junit.Test;
import org.threeten.bp.ZoneId;
/**
@solomax
solomax / HomePage.java
Created October 27, 2015 12:38
NPE in wicket 7.1.0
package com.mycompany.myproject;
import org.apache.wicket.ajax.AbstractAjaxTimerBehavior;
import org.apache.wicket.ajax.AjaxRequestTarget;
import org.apache.wicket.devutils.debugbar.DebugBar;
import org.apache.wicket.markup.html.WebPage;
import org.apache.wicket.markup.html.basic.Label;
import org.apache.wicket.request.mapper.parameter.PageParameters;
import org.apache.wicket.util.time.Duration;
@solomax
solomax / testTZ.js
Created September 3, 2014 09:06
JS code to get DST start date/time
function testTZ() {
//we assume here jan1 is not on the "DST edge"
var jan1 = new Date(new Date().getFullYear(), 0, 1, 0, 0, 0, 0)
, offset = -jan1.getTimezoneOffset()
, dstPresent = false, dstMonth = 0, MINUTE_STEP = 5;
for (var i = 1; i < 12; ++i) {
var d = new Date(jan1.getFullYear(), i, 1, 0, 0, 0, 0), curOffset = -d.getTimezoneOffset();
if (curOffset != offset) {
dstPresent = true;
}
@solomax
solomax / HelloService.java
Created April 18, 2014 04:06
working @webservice by David Blevins
package org.apachecon;
@javax.jws.WebService
@javax.ws.rs.Path("/")
@javax.ejb.Singleton
public class HelloService {
@javax.ws.rs.GET
public String hello() {
return "Hello, Maxim";
import java.io.*;
import java.net.*;
import java.util.Date;
import java.lang.Thread;
public class EchoServer {
public static final int DEFAULT_PORT = 9004;
public static final long DEFAULT_SLEEP = -1L;
private int port = DEFAULT_PORT;