Skip to content

Content Tagged "java"

Page 1 of 2

Content Tagged "java"

Some Resources for Sony Alpha Development

October 9, 2017Categories: Idea, Software
Every time I get a gadget I think of building something for it. Since I've gotten a Sony A6000 things are not different, particularly because I have some issues with the default Sony Android app requiring GPS location (and insisting not to work without it). Therefore, I would like to build an app…

HTML to PDF with iText 2.1.7

July 7, 2017Categories: Software, Tutorial
Sometimes you need to use an older version of a product die to e.g. licensing changes. It's my case with iText. While the new version looks fantastic, their changes (and removal of e.g. RTF output) are deal breakers for the feature set we need to maintain. Therefore, 2.1.7 is the most recent version…

Call an Oracle Function from Spring with CallableStatement

June 29, 2017Categories: Software, Tutorial
Following the previous post , I wondered if there's a more elegant way to call a function. It turns out there is and it's based on CallableStatement : The CallableStatementCreator sets up the statement and the CallableStatementCallback executes the statement and returns the value up to the…

Call an Oracle Function from Spring

June 29, 2017Categories: Software, Tutorial
The easiest way to call a function from Spring is using SELECT . For example, having a function HAS_PANEL_FLAG_OK with two parameters and returning an integer , the function call looks like: This will return all flags for the panels matching the condition. Java Call The query string can be…

List Columns in a ResultSet

December 8, 2016Categories: Software, Tutorial
In order to list all columns in a JDBC ResultSet (e.g. for debug purposes), you need to iterate through its metadata: Note: Column numbers start from 1, not 0 (hence the md.getColumnName(i + 1) above). I usually wrap this in a if(logger.isTraceEnabled()) so it doesn't get triggered all the…

Make Tomcat Log Stuff to Console (in Eclipse)

December 7, 2016Categories: Software, Tutorial
TL;DR: in your project's src/main/resources add the CONSOLE setting to the log4j.properties file. While trying to add features to a web application, I stumbled on an odd situation: my Eclipse Console would show only log messages for tomcat processes, none of my logs. I've tried to add a…

Pass Through a Corporate Proxy in Java

October 26, 2016Categories: Software, Tutorial
TL;DR: There's no easy way to create a proxy :) I've tried for a while to build a way to request something through a proxy, for testing an emulated android app. The solution came from Octavian who kindly provided me a snippet to run once per app lifetime. It tackles the problem from two fronts…

Mock an Observable Interface

August 1, 2016Categories: Software, Tutorial
TL;DR: Use a doAnswer() with a new Answer<Observable<Type>>() if you have to mock observables. Today I wrote my first test where I had to mock an observable interface: where the User model is: Solution In my test class (named UserDatabaseTest ), I first mocked the interface: Then, my setup…

Load Glyphs with LibGDX

January 3, 2016Category: Software
TL;DR : Remember to give the font loader the list of characters to render from the font! I'm trying to get a more resolution-independent mechanism to load simple shapes in place. After investigating SVG loading for several days I got nowhere. Then, I found out that libGDX actually supports vector…

About Java Exceptions in SE 7

November 7, 2015Category: Software
TL;DR : JDK 7 improves on exception handling (less code, base exception class...). Base exception class Reflective operations exceptions now have a base class ReflectiveOperationException. This allows you to to a global catch rather than one for each exception. Now you can write: Note : Reflective…
Next

All tags