Posts

Java 9 Process API

Java 9 will come with interesting features. Here is a quick review of the new Java 9 Process API.

Use Cases for the Java Process API
These are probably some ways how we are using the Java Process API:

To Install, configure or to communicate to other programs from Java: For example, I implemented a Java Installer to install the WebSphere Application Server into the system, and then I configure it by running a script coded in Jython executed the wsadmin tool.To install specific Operating System stuff. I didn’t find any other simpler way to install Windows start menu items from Java other than by doing it in a VBScript program.In my opinion, the Java Process API is in general used to integrate Java with other programs or processes. For example. I made a game in Blender and I implemented a launcher in Java. So, from Java I am calling the blender.exe passing the game.blender file as argument.
Known Problems and Workarounds
There are common issues in Windows when invoking commands which have …

Android 3D Model Viewer Open Source

So finally I decided to publish my 3D model Viewer android app on the Google Play Market :)

This app is about drawing 3D objects in android using OpenGL ES 2.0; and its Open Source as my other projects, so people can either contribute, start a similar project based on that or just learn how to do it by looking at the source code.

Although there is already similar apps on the market and lots of 3D frameworks out there, neither of the published apps are Open Source.

So I wanted to learn how 3D works and I think the best way to understand how it works is by looking at how matrices transforms the objects in space and how pixels are drawn to the screen. Thats why this app does not use any third party framework.

So far the app serves as a model viewer, but I have some ideas of what can be done with the code; or as I prefer to think of it, mini-3D-framework.  So for example, I am thinking in creating my very first and simple mini-game and I want to do it in 3D as it is a matter I really like…

Introduction to Software Design Patterns

Image
This is a presentation I did for the company I work Digital Origin. Its an introduction about architecting software solutions using Design Patterns.  Hope you like it.

What is a Design Pattern "Each pattern describes a problem which occurs over and over again in our environment, and then describes the core of the solution to that problem, in such a way that you can use this solution a million times over, without ever doing it the same way twice"
- Cristopher Alexander -
"Is a general resuable solution to common ocurring problems. It is a description of template for how to solve a problem in different situations"
- Wikipedia - Prerequisites & Basic Principles These are the basic principles one should be concerned before applying patterns. Use Object Oriented languageUse of AbstractionUse of EncapsulationUse High CohesionUse Loose CouplingUse Open - Closed prinipleUse Separation Of ConcernsUse Dependency InversionSeparate volatile from Stable componentsUse Interfa…

How to build a replicated ehcache through firewall and not to die trying

It's assumed that:

You already have a java application and you have an ehcache instance running in your program with 1 cache configured to replicate.You want to connect 1 instance to another instance you have in a remote machineThe remote machine you are connecting to is located behind a firewall.You have been given access to only 1 port to make an ssh connection to the remote (firewalled) machine. Ehcache uses RMI to connect the remote instances. When the cache in host 1 tries to connect to cache in host 2, RMI opens a new server socket in host 1 to listen for incoming connections from the host 2.
The problem here is that these random ports are not accesible to remote hosts because the hosts are behind a firewall.

So to fix it, we need to configure ehcache to only use 2 ports. The "remoteObjectPort" does the magic. So we have this ehcache.xml configuration:
1 server port for the ehcache server to listen to other ehcache servers.1 server port for the ehcache cache to liste…

How to package a jar-with-dependencies with maven and not to die trying!

How to package a jar-with-dependencies with maven and how to manage resource collisions (if we have multiple log4j.xml for example).

Sometimes it's easier to distribute our application in a single fat jar (myapp-1.0-jar-with-dependencies.jar) instead of distributing our jar + libs.jar. To achieve this, we can use maven-assembly-plugin and the jar-with-dependencies descriptor.

However, the jar-with-dependencies works but until we have resource collisions. Imagine that you have your own /src/main/resources/log4.xml but one of your dependencies (i.e. dependency.jar) has a /log4j.xml as well.

To handle this situation, we can redefine the jar-with-dependencies assembly descriptor so we start packing the fat jar first with our own project files and then include the rest of the dependencies. That will work because maven will not overwrite files that already exists.

Another thing to keep in mind, is that it works fine for any resource, except for the MANIFEST.MF file that is handled by …

Google Drive FTP Adapter

Image
Google Drive FTP Adapter
This open source application lets you connect your FTP applications to your Google Drive files through the FTP protocol rather than using the Official's Google Drive client.
This custom google drive client was created because official's one can't be reinstalled in a new PC without having to redownload all your drive files again, from the cloud to your local PC.  So if you have hundred of Gigas and a regular ADSL it would take weeks to complete. Also, because the official client does not support FAT32 partitions and I used to have all my files in one of this partitions.
So this application basically starts a FTP server in your local machine emulating that it is hosting your google drive files, acting as a gateway. Once this setup is done, you can connect any FTP client to connect to your google drive files. I use it in conjunction with Beyond compare to compare my local files (stored anywhere in my hard drive) and compare them to ones I have in the…