Skip to content

Instantly share code, notes, and snippets.

@solomax
solomax / pom.xml
Created Jan 19, 2019
Dumb pom.xml illustrating issue in maven-project-info-reports-plugin
View pom.xml
<?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 Jan 30, 2019
commons-collections BidiMap values() test
View Test.java
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 Nov 8, 2016
OM PHP API POST test
View PostTest.php
$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 Jul 27, 2016
In-memory Jar Class Loader
View Loader.java
/*
* 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 Mar 10, 2016
CentOS red5 init
View red5
#!/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 Oct 28, 2015
Test to prove there is no IST time zone in threetenbp
View ISTTest.java
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 Oct 27, 2015
NPE in wicket 7.1.0
View HomePage.java
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 Sep 3, 2014
JS code to get DST start date/time
View testTZ.js
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;
}
View HelloService.java
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";
View EchoServer.java
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;