Skip to content

Instantly share code, notes, and snippets.

View berlinbrown's full-sized avatar

Berlin Brown berlinbrown

View GitHub Profile
public static final class Mutable<T> {
private T mutable;
/**
* Constructor.
* @param m
*/
public Mutable(final T m) {
this.mutable = m;
}
/**
@berlinbrown
berlinbrown / WicketAjaxRequestErrorRedirect.txt
Created April 14, 2011 02:27
What is ajax response direct, where is the code?
POST /life/launch/?wicket: interface=:23:navigationPanel:nextLink::IActivePageBehaviorListener:1:-1&wicket:ignoreIfNotActive=true&random=0.006311339758800216 HTTP/1.1
Accept: text/xml
Accept-Language: en-us
wicket-ajax: true
Referer: https://mysite/life/launch/
wicket-focusedelementid: idc96
Content-Type: application/x-www-form-urlencoded
UA-CPU: x86
Accept-Encoding: gzip, deflate
User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; .NET CLR 1.1.4322; .NET CLR 2.0.50727; .NET CLR 3.0.04506.30)
@berlinbrown
berlinbrown / gist:939788
Created April 24, 2011 18:44
ErrorWithCabalInstallGTKGLIB
I did the following:
Navigate to the directory gio\0.12.0:
cabal update
cabal build
cabal install --global -v
And I get the error at the bottom:
@berlinbrown
berlinbrown / gist:947800
Created April 29, 2011 03:48
Scalar Summation in Java
/**
* Simple scalar sum class.
*/
package org.berlin.algo.basic;
/**
* Simple scalar sum class.
* Normally use j=1, stops at n.
* <pre>
* Sum:
@berlinbrown
berlinbrown / gist:950204
Created May 1, 2011 03:00
Convert this from haskell to Java (see the top blurb)
/**
* See the comment.
* I was trying to convert haskell to Java but I am still not
* getting the insertion sort to work.
* This is purely, throw-away code.
*
* Java Insertion Sort based on Haskell impl.
*
*/
package org.berlin.algo.basic;
@berlinbrown
berlinbrown / gist:950205
Created May 1, 2011 03:03
OK, one more time, haskell to java
package org.berlin.algo.basic;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Random;
/**
* Insertion Sort with simple cost and time statistics.
@berlinbrown
berlinbrown / gist:950279
Created May 1, 2011 05:40
Java Insertion Sort based on Haskell impl (Convert from Haskell to Java)
/**
* Berlin Brown , berlin dot brown at gmail.com
*
* Java Insertion Sort based on Haskell impl (Convert from Haskell to Java).
*
*/
package org.berlin.algo.basic;
import java.io.Serializable;
import java.util.ArrayList;
@berlinbrown
berlinbrown / gist:951052
Created May 2, 2011 01:03
Insertion sort Java, from Haskell to Java
/**
* Berlin Brown , berlin dot brown at gmail.com
*
* Java Insertion Sort based on Haskell impl (Convert from Haskell to Java).
*
*/
package org.berlin.algo.basic;
import java.io.Serializable;
import java.util.ArrayList;
@berlinbrown
berlinbrown / gist:1070925
Created July 8, 2011 01:36
Example Gzip Code in Java2
/*
Unzip a gz file in Java:
You could probably modify to do a zip.
*/
package io;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
@berlinbrown
berlinbrown / gist:1070929
Created July 8, 2011 01:40
Basic Time Plot for GnuPlot
# Basic time plot. You have time intervals and some Y metric.
# Run with gnuplot and an image file is output.
#!/bin/sh
OUTPUT_IMG_FILE=request_log_time.png
echo "set terminal pngcairo size 1024,768
set output '${OUTPUT_IMG_FILE}'
set title 'Critical Errors By RequestTime (Past Day)'
set size 1,1