Author name: greg

PhantomSQL released

Finally I have released my PhantomSQL project. PhantomSQL is a domain specific language designed for mining content from static and dynamic sources, It closely resembles SQL with features borrowed from other popular dynamic languages. It can be run as a interpreter or ‘server’ mode, it comes with type 4 JDBC driver for ease of integration …

PhantomSQL released Read More »

Leptonica Tutorial – Cropping

Common use is to crop to certain area of an image, this can be quite easily accomplished with following code. BOX* box = boxCreate(x, y, w, h); PIX* dpix= pixClipRectangle(spix, box, NULL);BOX* box = boxCreate(x, y, w, h); PIX* dpix= pixClipRectangle(spix, box, NULL);

Proper way to read InputStream to byte array

There are many ways to accomplish this but this one does not use any external dependencies like Apache commons. Two common pitfalls that I see are that people forget to flush the ByteArrayOutputStream and they call ‘baos.write(buffer)’ instead of ‘baos.write(buffer, 0, read)’ without actually clearing the buffer, which causes the last write to append previous …

Proper way to read InputStream to byte array Read More »

Flash Scope and Flash variables in Spring MVC

Sometimes its nice to be able to transfer object between request or for flash messages without need for a whole session. Here we will use session as our store mechanism for our flash scope. This concept here can be extended into implementing a ‘Conversation Scope’ but that is a whole different animal. Example Usage @FlashAttribute(TABNAME_ATTRIB) …

Flash Scope and Flash variables in Spring MVC Read More »