Git me the log

There are times that as a developer who primarily responsible for the deployment can use a little helping hand on getting the right source and builds for a release. After all, the artefacts coming out of it can be the same one that’s going to be deployed in production. It’s really important that we check each and every code commits as well as their impacts.

One thing I do in this situation is I use the git log to give me the information of the sources and commits that will be part of the release:

git log --pretty=format:"%h - %an, %ar, %ae : %s" --stat --name-only --graph --since=2015-01-01 >> logme.log

Let’s run this down bit by bit

git log is a git command that gets the details of the commits
--pretty=format can be used to specify a specific format using "%an, %ar, %ae, : %s". Thats author revision, name, email and file.
--stat to show the statistics
--name-only to show the filenames only
-- graph to show a graphical representation
--since to show only the commits made from the given date up to the current date (today)

16-07-2015 8-34-13 AM

How about a graph only? I ran the same git log but only passed a format and a –graph argument. Output below.

$ git log --pretty=format:"%h %s" --graph
* 2d3acf9 ignore errors from SIGCHLD on trap
* 5e3ee11 Merge branch 'master' of git://
| * 420eac9 Added a method for getting the current details to the branch.
* | 30e367c timeouts
* | 5a09431 add timeout protection to hubbys
* | e1193f8 support for heads with slashes in them
* d6016bc require time for xmlschema
* 11d191e Merge branch 'hubbys' into local

.. and how about log specifically for areyes since January 01, 2014 but before November 01, 2010

$ git log --pretty="%h - %s" --author=areyes1--since="2014-10-01" --before="2010-11-01"
5610e3b - Fix testcase failure when extended attributes are in use
acd3b9e - Enhance hold_lock_file_for_{update,append}() API
f563754 - demonstrate breakage of detached checkout with symbolic link HEAD
d1a43f2 - reset --hard/read-tree --reset -u: remove unmerged new paths
51a94af - Fix "checkout --track -b newbranch" on detached HEAD
b0ad11e - pull: allow "git pull origin $something:$current_branch" into an unborn branch

There’s a lot of format options available for git log that can be found here and given these, a lot of automations can be created!

Idea: You can echo this to a file and send it out to developers for verification, or a better idea, loop through the list of users, get each of their emails and revisions, generate the logfile for each and send it out to them. Pretty neat as it will give the developer a bird eye view of their sources that will be included on the release (and notify the team if theirs was not included)

Basics – JasperReport on your Java Desktop App


Have you ever had a client that only wants a basic reporting screen that has the values in it? Good thing JasperReports was invented!

In this post, I’m going to share a small example of how you can create your own report in iReport, compile it to *.jasper and call them via your own Java Desktop App!

Step by Step

Create your report in iReport

You can actually code this in XML but that would be inefficient. iReport is an open source report editor that developers can use to design reports. Jasper Reports are basically like Java Source code that you can compile in different language, as of this writing, it supports Java (of course), Groovy and JavaScript. Obviously, if you want to create a report that can be viewed in the Java based report viewer, you should compile it in Java. If you want to view it in a Web Browser, it should be in Javascript (although, technically, you can wrap a JFrame in an Applet and place the JasperReport viewer on the Applet, but not getting ahead in here).

In this example, let’s just create a simple Report (a blank perhaps) and put a few parameters and fields.

Screenshot at Jun 15 22-20-20

Once done, compile it and locate your jasper file (*.jasper is the compiled source file).

Code it!

I wouldn’t dive much on how you where you should put your jasper files. It can be externally access or via resource classpath. My recommendation is of course, put it in your classpath, but we all have our own case of usage. If there will be a lot of adjustments to your report because of alignments, then I would go with putting it externally. This is so that you wouldn’t have to compile your project again just to do minor alignments.

Before we go to the snippet code, make sure you have the dependency below.


If you’re not familiar with Maven, you should be, read here. :)

and here is a sample of code.

// Get the file, put it in a stream
FileInputStream fis = new FileInputStream(this.getClass().getResource("").getFile());
BufferedInputStream bufferedInputStream = new BufferedInputStream(fis);
// We do have parameters, so we create the map object to store values for them.
Map map = new HashMap();
map.put("SAMPLE1", "This is a sample 1 text");
map.put("SAMPLE2", "This is a sample 2 text");

// We create the jasper report object, load the report with JasperFillManager object and use the
// JasperViewer to display the report            
JasperReport jasperReport = (JasperReport) JRLoader.loadObject(bufferedInputStream);
JasperPrint jasperPrint = JasperFillManager.fillReport(jasperReport, map,new JREmptyDataSource());
JasperViewer.viewReport(jasperPrint, false);

Screenshot at Jun 15 22-19-45

If you’re having issues, just let me know (via comments), I can help you out.

Java 7 try-with-resources statement

In Java 7 you can write the code from the example above using the try-with-resource construct like this:

Screenshot at May 11 23-48-08

This is the try-with-resources construct. The FileInputStream variable is declared inside the parentheses after the trykeyword. Additionally, a FileInputStream is instantiated and assigned to the variable. When the try block finishes the FileInputStream will be closed automatically. This is possible because FileInputStreamimplements the Java interface java.lang.AutoCloseable. All classes implementing this interface can be used inside the try-with-resources construct. If an exception is thrown both from inside the try-with-resources block, and when the FileInputStream is closed (when close() is called), the exception thrown inside the try block is thrown to the outside world. The exception thrown when the FileInputStream was closed is suppressed. This is opposite of what happens in the example first in this text, using the old style exception handling (closing the resources in the finally block).


Ionic Framework – Mobile Hybrid Application Development

When I was developing our wedding application back in February, I was also trying to learn the ropes in AngularJS. It didn’t make sense for me to go with JQuery Mobile since, well I am learning angularjs. So I think through my options and ask, “Jquery mobile is essentially built in a javascript framework, is there an angularjs alternative?”. Luckily for me, I had an interesting discussion with a friend of mine who is happen to be researching new mobile development frameworks. He mentioned ionicframework and that it’s based in angularjs, cordova and he is excited to use it.

I was curious and quickly google it. Lo and behold, it is what it is. It’s a mobile hybrid development framework based on angularjs with tons of built in directives. To make it matters more interesting, it also has it’s own ui style framework so that every component you used can inherit the mobile systems native ui. Its something new to me and I’m already thinking all the possibilities that I can do with it.

For this post, I’ll be giving a few basics of using ionicframework.

  1. Setting up your local ionic framework environment
  2. Brackets or Sublime Text editor
  3. Some digging in the code
  4. Build and Test
  5. Our Wedding App!

Step 1: Setting up your local ionic framework environment.

I’m a command line guy, let me emphasis that and I don’t see any reason why you wouldn’t consider that. Using the actual cli commands will give you more control over anything you do to your application.

Download the node package manager and install ionic framework cli

  • To download and install npm cli, click here
  • Now after the installation, go to your project folder (create one if you don’t have it yet) and run the following command.
    npm install -g cordova ionic
  • This will install the ionic framework cli.
  • After the installation, you can now use the ionicframework cli to create, build and test projects. For more examples, go the ionic site

Step 2: IDE. Brackets? Sublime? NotePad++?

I personally use Brackets most of the time as it’s simple and easy to use. It’s an Open source adobe projects and has a lot of plugins and extension available. It also compliments the adobe products such as adobe photoshop if you need to get the details of your slices and graphics within your code.

I use a mint green themed IDE, autocompletion for css, javascript. And if you look at my screen, I use coffee app as well.

Step 3: Try out an example project

Go to your project directory. I’m assuming you already have your ionic cli install so let’s go step by step

  1. cd dir
  2. ionic start myApp tabs

The steps above will create a scaffolding ionic project.
Screenshot at May 10 20-30-39

Open your source in your IDE

In my case, I am using brackets. I can launch it using Live Preview button

Screenshot at May 10 20-38-43

The scaffolding app looks good. It has tabs, list, and basic page that you can use as your guideline.

Step 4: Let’s dig in deeper

If you look at the scaffolding app, it already has the app.js along with the services and controller js source. Let’s look in closer.


Screenshot at May 10 21-07-19

  • app.js – this is the global source code for angularjs framework. AngularJS will basically manipulate the DOM as soon as it receives the HTML object. It’s usually being used to house the modules, routes and service definitions, although this can be in a separated source code but basically runs on the same DOM interpreter.
  • Line 8: create the module name ‘starter’ importing the following modules:
    • ionic – this basically the ionic library module
    • starter.controllers – the controllers we defined. The main module needs access to this
      so that it can dictate the controller scope that it will be used for each route.
    • – the services we defined. We need this so that we can access services
      within the module.
  • Line 11 – 22: This executed upon running the module, this basically means that the native mobile service needs to know that we are using the cordova keyboard plugin and status bar.
  • Line 24: the .config is a module function that sets any configuration needed upon running the module. In this case, we use the stateProvider and urlRouterProvider module to route to different pages and views.


Screenshot at May 10 21-19-58

  • Line 1: Definition of the starter.service module.
  • Line 6: Definition of factory Object ‘Friends’ which we will used eventually in the controller.


Screenshot at May 10 21-20-34

  • Line 1: Definition of module starter.controllers – which we imported from app.js. We really don’t need any new modules inside this so no imports necessary.
  • Line 3 – 16: Defined the controller. The controller is basically the main source that is directly bound to the ui. If you observe carefully, you can see that on the FriendsCtrl, we imported the ‘Friends’ factory from the module.

The scaffolding is almost complete with the most basic UI controls. There are tons of examples in CodePen for this, from panel directives, sliders, to tinder cards. The key however is trying to consolidate them all to your needs. Most of the UI components available are made through directives which is the perfect way of creating components, not just in an angularjs web app, but also in ionic framework for mobile.

Step 5: Build and Test in your mobile

Ionic is based on cordova, so you can compile the source in any platform supported by this. Here are some of the code you need to build for android or ios platform.

ionic platform add android
ionic ionic build android
ionic ionic emulate android --device
This means that you will emulate on your device.

Extra: Our Wedding App.

I somehow use our wedding as an opportunity to practice, so here are some screenshots of the app.

I did this in just a week after learning the ropes!

Download the APK here.