Tuesday, February 5, 2013

Verifying void methods with Mockito

I had the following problem with Mockito


class MyClass{
 void logSupportingServiceWarn(File dummyFile, String aString){
 }
}

MyClass task = Mockito.spy(new MyClass())
Mockito.never(task.logSupportingServiceWarn(dummyFile, null));

> Java gives the following error :
'void' type not allowed here

Well, this is an issue with Java because it does not allow you to pass in void as a parameter.
Actually it's documented on the website, but I could still not find the exact syntax.

Instead do this :


Mockito.verify(task, Mockito.never()).logSupportingServiceWarn(dummyFile, null);



Monday, February 4, 2013

Java and your security

Over the past few months Java has had some really bad press about security. The good news is you need to have Java running on your machine for most of the security vulnerabilities to be exploited. Applications on servers should not be effected.

Windows, Linux and Mac with Java installed are effected.

It is very important for you and your customers that have Java installed on their machine to have the latest version of Java installed as it contains a lot of patches.

If your customer / you is still running Java 6 please updated to at least Java 6 update 39.
And Java 7 at least update 13.


You can check the version of Java installed here :
http://www.java.com/en/download/installed.jsp

Monday, January 14, 2013

Invient Charts, Problem with TimeZone - always in UTC

The Problem


It seemed that all my InvientChart 0.8.6 charts in Vaadin were two hours behind where they should have been. And because I live in GMT + 2 it seemed like a timezone issue.

The solution


Before adding your chart to the UI add this component


            try {
                CustomLayout cl = new CustomLayout(new ByteArrayInputStream("
".getBytes())); addComponent(cl); } catch (IOException ex) { //should never happen log.warn("Should never happen",ex); }

Tuesday, January 8, 2013

Manage my time more effectively - Email and chats are the devil

Being used to being unfocused

I am lucky enough to work in a private office where I can closed the door and not be disturbed. But work email, Google chats and private Google mail really becomes a distraction. 
To make it worse, when I am not being distracted by mail and chat I check to see if I have new mail or chats periodically.
This really disrupts my train of thought.

The desired end result

While developing software focus is key!
No disruptions during pomodoros!

What I am going to do
Close my work email and gmail during 25 min pomodoros

Monday, January 7, 2013

2013 New Years Resolutions as a Java developer

I am going to focus on the following this year and blog about it.

Test driven development for everything I do

 

Doing things in a panic and rush comes back and bites.
Completely offline and modular test are a must.

Deploy one application to the Android Market

 

Deploy one application to the IOS Market

 

Become a GWT master

GWT is really one of the best frameworks I have seen in a long time. I've been dabbling for a long time, but I really want to be a master. That includes MVP 

Never lie on my timesheets

At one of the Java User groups at a new venue, one of my friends joked. "Look at that guy coming, you can see he is a Java developer, his eyes are red."
Long hours and stress is part of being a Java developer and I log 8 hours on my timesheet per day even though I spend much more.
People need to see how long I work.

Manage my time more effectively

Refine how I work. The Pomodoro Technique is a great starting point to working smart and working towards a end goal. But there needs to be more.

Do my Oracle Certified Java 8 Programmer course

Java 8 should be released close to the end of the year. If this is so, I would like to do a beta of the exam. If this is possible in South Africa.

Get involved a little with Java EE 7

 

Adopt a JSR

http://java.net/projects/adoptajsr/pages/Home

Monday, November 26, 2012

PhoneGAP without Javascript! My demo of GWT 2.5 at the JoziJUG


Live code demos are scary

I did a live code demo to a bunch of Java geeks at the JoziJUG event

1) The showcase application I demoed on a iPad3, Android 2.1 phone, Android 3 tab, Android 4 phone, Windows 2008 tab last night is downloadable from PhoneGap Build. 
https://build.phonegap.com/apps/249950/share
The plain ugly Hello World HTML version is also downloadable :https://build.phonegap.com/apps/249918/share
2) You can also give GWT 2.5 a spin , even if it's in Eclipse (Marius and Myron ) ;-) 
http://mojo.codehaus.org/gwt-maven-plugin/user-guide/archetype.html
3) You can also check out the fancy demo I hacked together using m-gwt and gwt-phonegap 
https://github.com/rjdkolb/jozijug_phonegapdemo
You will need to read Google's MVP to understand the concepts :https://developers.google.com/web-toolkit/doc/latest/DevGuideMvpActivitiesAndPlaces

To the real person who made this possible in GWT :
Daniel Kurka thank you!

To Google, GWT is evolving so nicely :)
Here is Google's closure-compiler that is now built into GWT 2.5
Java is so cool! 
Richard.

Below is me pretending to know something about Java :)


Wednesday, October 31, 2012

Java Community Process EC Elections 2012

The election results are out!


Here is how the Jozi JUG voted :



Most notably on the open seat side, here are the people who got elected.

London Java Community 164 votes (33%)

CloudBees 101 votes (20%)


Thanks to everyone who made the effort to vote.


More info here.