Play Framework – Activator – Fix for IllegalArgumentException: empty text
In case of calling an Play Server via HTTPS, an strange Exception is thrown as shown ... Read more
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# set lucene version version="4.4.0" # set base directories basedir=~/build/lucene/lucene-$version indexdir=$basedir/data/index # create direct for Lucene code and binaries mkdir -p $indexdir cd $basedir/.. # download lucene if [ ! -e lucene-$version.zip ]; then wget http://apache.imsam.info/lucene/java/$version/lucene-$version.zip fi; # extract unzip -oq lucene-$version.zip # create directory to save the search index mkdir -p $basedir/data/index # start demo indexing cd lucene-$version # set classpath classpath=$classpath:$basedir/demo/lucene-demo-$version.jar classpath=$classpath:$basedir/core/lucene-core-$version.jar classpath=$classpath:$basedir/analysis/common/lucene-analyzers-common-$version.jar # Do index the directory with lucene documentation java -classpath $classpath org.apache.lucene.demo.IndexFiles -index $indexdir -docs $basedir/docs # check content of index directory echo $indexdir ls -lh $indexdir |
1 |
sudo apt-get install -y eclipse |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
public static List<Integer> getIdsList(String ids) { ids = StringUtils.stripStart(ids, "{"); ids = StringUtils.stripEnd(ids, "}"); List<Integer> list = parseInts(ids, ','); return list; } public static List<Integer> parseInts(String source, char delimeter) { if (StringUtils.isEmpty(source)) { return Collections.emptyList(); } List<Integer> result = new ArrayList<Integer>(); for (String intStr : source.split(String.valueOf(delimeter))) { result.add(NumberUtils.toInt(intStr)); } return result; } public static List<String> parseStrings(String source, char delimiter) { Pattern p = (delimiter == ',') ? ',' : Pattern.compile(String.valueOf(delimiter)); return Arrays.asList(p.split(source, 0)); } |
1 2 3 4 5 6 7 8 9 10 11 |
public static String exceptionToString(Throwable throwable ) { try{ StringWriter stringWriter = new StringWriter(); throwable.printStackTrace(new PrintWriter(stringWriter)); return stringWriter.toString(); }catch(Exception e){ // shouldn't happen but whatever return null; } } |
1 2 3 4 5 6 7 8 9 10 11 12 13 |
public static String byteToHex(byte b) { // Returns hex String representation of byte b char hexDigit[] = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f' }; char[] array = { hexDigit[(b >> 4) & 0x0f], hexDigit[b & 0x0f] }; return new String(array); } public static String charToHex(char c) { // Returns hex String representation of char c byte hi = (byte) (c >>> 8); byte lo = (byte) (c & 0xff); return byteToHex(hi) + byteToHex(lo); } |