Skip to content

Instantly share code, notes, and snippets.

@jhorstmann
jhorstmann / RecurseiveParsingWithJsonBuilder.java
Created November 12, 2012 22:41
Getting familiar with the JsonBuilder API of JSR 353
package net.jhorstmann.jsonp;
import java.io.IOException;
import java.io.PushbackReader;
import java.io.StringReader;
import javax.json.JsonArray;
import javax.json.JsonArrayBuilder;
import javax.json.JsonBuilder;
import javax.json.JsonBuilder.JsonBuildable;
import javax.json.JsonObject;
@jhorstmann
jhorstmann / gist:1579903
Created January 8, 2012 22:15
How to modify android-x86 asus_laptop image to add rtl8192se wireless lan driver

The "intellibook" netbook contains a rtl8192se pci network chip that is not currently included in the android-x86 builds. I could not get a complete self-build image to work so I decided to add the neccessary drivers to the existing release from 20120101. This has the added benefit that the installation contains the google apps, which are not included in the source download. The image can be downloaded from http://www.android-x86.org/releases/build-20120101 (android-x86-4.0-asus_laptop-20120101.iso).

Extract the iso image and the contained squashfs image and mount the contained filesystem image as a loopback device.

$ bsdtar -C android-image -xf android-x86-4.0-asus_laptop-20120101.iso
$ cd android-image
$ unsquashfs system.sfs
$ sudo mkdir /mnt/iso
$ sudo mount ./squashfs-root/system.img /mnt/iso  -o loop
@jhorstmann
jhorstmann / jiffybox-android-x86.txt
Created January 8, 2012 10:59
Setup an android-x86 build environment on a JiffyBox cloud server by domainFACTORY
Setup a JiffyBox by following the instructions, using Ubuntu 10.04 as the operating system. I created a CloudLevel 4 server with 16GB swap but it seems a smaller one would also be sufficient.
Login as root and create a normal user with sudo rights, as in a normal Ubuntu installation. Working as root should be really discouraged.
$ adduser jh
$ adduser jh adm sudo
Logout and login as the user you created above. Install a nicer editor, vim in my case.
$ sudo apt-get install vim
@jhorstmann
jhorstmann / exporter.patch
Created December 1, 2011 12:53
Patch for Primefaces 3.0.M4 to use native excel formats instead of converting everything to strings
diff --git a/src/main/java/org/primefaces/component/export/CSVExporter.java b/src/main/java/org/primefaces/component/export/CSVExporter.java
index e5e8992..db0e981 100644
--- a/src/main/java/org/primefaces/component/export/CSVExporter.java
+++ b/src/main/java/org/primefaces/component/export/CSVExporter.java
@@ -20,6 +20,7 @@ import java.io.OutputStream;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.lang.reflect.Array;
+import java.util.ArrayList;
import java.util.Iterator;
@jhorstmann
jhorstmann / ConstantTracker.java
Created September 7, 2011 22:01
Extract constant arguments to `PrintStream#println(String)` from a Java class file using the ASM bytecode framework
import org.objectweb.asm.tree.MethodNode;
import java.util.Iterator;
import org.objectweb.asm.tree.analysis.Analyzer;
import java.io.IOException;
import org.objectweb.asm.ClassReader;
import org.objectweb.asm.tree.ClassNode;
import java.io.InputStream;
import java.util.List;
import org.objectweb.asm.Type;