java convert codepoint to string

either of these two would do it, probably prefer the former, ref

  private static String codePointToString(int codePoint) {
    return new String(Character.toChars(codePoint));
private static String codePointToString(int codePoint) {
  StringBuilder stringOut = new StringBuilder();
  return stringOut.toString();

eternal input stream

here’s a faux one that “reads forever”


eternalInputStream = new InputStream() {
  boolean closed = false; // simulate what a file read does...kind of.

  public void close() throws IOException {
    closed = true;

  public int read() throws IOException {
    throw new UnsupportedOperationException("shouldnt need this for unit test but the class signature requires its definition");

  public int read(byte b[], int off, int len) throws IOException {
    if (closed) {
      throw new IOException("stream already closed");
    return 1; // who cares what the bytes actually even are LOL

jruby ArgumentError: Constructor invocation failed: null

this meant (for me) “you have default-jre-headless installed and are subclassing a JFrame” which doesn’t work right…

so for me it was

sudo apt-get install openjdk-default

to get the non headless one

you can see the real error exception message by not subclassing one but just creating it:

jruby-1.7.16 :001 > require ‘java’
=> false
jruby-1.7.16 :002 >

this should always work…if not then install the non headless package of your jdk.

installing package uuid-devel gives wrong .pc filename /usr/lib64/pkgconfig/ossp-uuid.pc should be uuid.pc

this meant “use the  libuuid-devel package instead of uuid-devel”


packrd@dpsprod-app07.a|dpsprod:~/ltfs-1.2.6$ repoquery -l libuuid-devel

postgres unique substring slow

postgres string index with first characters


anyway the answer is, if you want to query based on a known substring

ok, if you want “like ‘abc%’ then postgres has a special type of index; (I think varchar_ops or what not…ymmv).

For us, who had a slow select unique substr then adding an index that was the exact same size works: