Posts

Showing posts with the label Java

Geecon 2015

Image
So last month I've attended  Geecon  and I really loved it. Geecon is a conference focused on Java and JVM technologies, hosted annually in Cracow (usually). Geecon had a Steampunk theme This year’s it was all about microservices, so it’s no surprise that I enjoyed Fred George ’s “Challenges in implementing microservices” the most. In his talk Fred George shared his experiences with replacing monolith applications with microservices. He explained how microservices facilitate a Service Oriented Architecture and “going faster” as shorter reaction time for the whole company. What was most interesting to me was the comparison of asynchronous and synchronous approaches to microservices. He mentioned his friend Chad Fowler suggests synchronous communication on default mainly because it’s easier for most of the modern programmers. In contrast Fred George believes that asynchronous messaging gives so too much of an opportunity for robustness and graceful degradation to ignor...

Mavenized Java server application and Angular.js frontend application using yeoman

Image
Setting up Angular.js using Yeoman In Gruntfile.js change application config, so the application is compiled into java resources Finally add build plugin to pom.xml so the js appliacation and all of its resources are built into your Java resources. Notice that for workingDirectory I'm using my directory 'ui'. The build should pass and you can deploy your appliacation to a server container of your choosing. I'm using Spring (along with Spring Boot). A simple controller like this: Should yield a result like this: I've based this article on Gunnar Hillert's Botanic-ng and my own experimentation.

Installing FANN on Java project and NativeLibrary.loadLibrary problems with 32bit/64bit

If you try to install FANN  and get it working with a Java project you might run into a few problems. The whole process is explained on the fannj (the Java binding) project's wiki but not in great detail. Installing Fannj Get fannj Store it somewhere and add the jar to your project. Get FANN Extract it somewhere. Set up the DLL by either: copying the fannfloat.dll to System32, or adding the following line before you try to use FANN:  System.setProperty("jna.library.path", [fannfloat.dll dir path]); Solutions to common issues No Java Native "Exception in thread "main" java.lang.NoClassDefFoundError: com/sun/jna/Platform" Solution : Download the JNA and add the jar to your project. Can' find the FANN library Exception in thread "main" java.lang.UnsatisfiedLinkError: Unable to load library 'fannfloat': The specified module could not be found. Solution : Add debugging code (or better yet: use a debugger) after y...

Android Activity.managedQuery selection and selectionArgs arguments

Most of the examples of managedQuery don't use the selection and selectionArgs arguments, others are pretty simple like : Cursor simple(String id) { return managedQuery(getIntent().getData(), PROJECTION, "id = " + id, null, DEFAULT_SORT_ORDER); } or Cursor simple(String id) { return managedQuery(getIntent().getData(), PROJECTION, "id = ?", new String [] ={id}, DEFAULT_SORT_ORDER); } Both of the above do exacly the same thing. The '?'s are the elements in the array in order they are placed. [ Resource ] I was working on a piece of code that stored IDs in SharedPreferences and then loaded the elements with those IDs into a ListView from a ContentProvider. Basically I was trying to get that : WHERE id IN ( id1, id2, id3, id4,...) So the selection argument looked like that : "id IN ( ? " +  [",? "] + " )" and the selection args stored the ID of elements I wanted to load. SharedPreferences data = getSharedPref...