Wednesday, January 14, 2015

Copyrights... and wrongs


I just read the ZDNet post entitled "​Google pushes to take Oracle Java copyright case to Supreme Court". Very interesting. While my initial thought was who cares, I now must confess to agree with the author, Steven J. Vaughan-Nichols... to a point.

Before I proceed, I do feel that I should say that, as a guy who started programming in Java in 1997, I really like that Google chose Java to power Android devices. It is significantly lowering my learning curve.

While I do agree that software APIs should not qualify for copyright protection, I have a very difficult time accepting that what was protected when authored should cease to be protected just because we now use it everywhere. The successful adoption of technology must not render it public domain. How long do you think that an attempt to remove the copyright from Microsoft Windows would last? Those protected rights are part of what Oracle bought when they purchased Sun.

I, for one, would love to write some code that becomes so ubiquitous that I regret the following statement. Law makers in all jurisdictions should now have the courage to pass laws that will prevent such shackling of innovation in the future.

Thursday, January 8, 2015

My Aversion to Multiple Versions

Well, after spending the past couple of days futzing around with my system, I am starting to get into the code. That's not too bad, but the one thing that I had forgotten is how version dependant everything is.

I've had Maven 3 installed on my system for a while. My first attempt at building some sample Spring code failed... no, I didn't save the error. But when I investigated it, I got the message that this particular error resulted from a bug in Maven itself, and I should report it. Well, not wanting to waste anyone's time, I figured I should at least make sure I had the latest version of Maven. Well, sure enough Maven is now up to 3.2.5 and I only had version 3.0.5. No big deal right? Just run apt-get update and then upgrade. Well, wouldn't you know it, I've got the latest version from the Ubuntu repository. After goofing around a bit with adding another repository, I decided to just download the latest and install it beside the one that apt-get installed and change the symbolic link to mvn. Sweet, now, lets try again. Not so fast... the sample code I was trying to build doesn't work with the latest Maven.

*sigh*

OK, get the right Maven installed, and try again. Now I get messages that the lsbstdc++ package is missing dependencies! AAAARGHH! Back to apt-get build-dep.

OK, looking at this post it doesn't look all that bad, but there was a bunch of other stuff in there as well that had me almost ready to blow away my Windows partition and do a complete re-install with just Linux.

Now, what shall we build?

Tuesday, January 6, 2015

Long time no "C"

... or C++... or Java. ;^P

Well, here I am again... at another crossroads in my life. After a four year hiatus from programming, I am now looking back and wondering if I made the right choice. I won't get into the motivations for my absence, it all seemed like the right thing to do at the time, but as I fire up my IDE for the first time in a while there is definitely some apprehension.

But now, it occurs to me that I am probably not alone. There are probably lots of people like me who, upon hitting their heads on a glass ceiling, decide to test out other opportunities. So I'm going to start blogging again, but now from the position of a prodigal son.

I'm going to be discussing the things that get forgotten when one is no longer immersed in a profession. What are the gotchas that I've long since forgotten about? Is it like riding a bike? I used to always say that the syntax is secondary, it's the analytical skills that matter. Now's the time to put my money where my mouth was. If that's true, I should be able to get back up and running in fairly short order.

So, without further delay... here we go.

Friday, March 25, 2011

Jasperoo update

I have just completed some fairly significant enhancements to Jasperoo. It's starting to look like a pretty solid addon for Spring Roo. As far as I can tell, your Roo projects can now benefit from the power of Jasper Reports.

What has changed?
  • I've introduced "Detail" reports. These reports provide the contents of all the fields of a specific entity instance, all on one page.
  • I've abandoned the idea of a menu entry for each report. The reports are now accessed through icons on the "List" and "Show" page for each entity that has been added to Roo.
  • I've simplified the process of adding additional report formats. Previously, you had to choose which formats you wanted when you called "setup". With the addition of the "extend" method, you can now add support for other formats after setup.
  • I have spent a fair bit of time documenting jasperoo. Please check out the jasperoo project site at jasperoo.digitalface.ca, and click on API and How-To from the left-side navigation.
Many thanks for the feedback already received, I look forward to hearing more.

Here are some screen shots to whet your appetite.
A "show" screen with the report icons highlighted.

A "Detail" report

A "list" screen with the report icons highlighted.

A "List" report.
The "extend" command in use.

Friday, March 18, 2011

#JasperReports + #SpringRoo = #Jasperoo

For Immediate Release

DigitalFace has released the jasperoo code to the community under GPL3.

What? You say you've never heard of it before? Well, that's not too surprising, I only dusted off the last of the critical functionality last night. ;o)

There are still features missing, and a few little bugs, but I didn't want to work on it any longer without checking it into source control, and since I planned to make this a open source project, I figured that now is the time for its release.

What is jasperoo, and why should I care?
If you don't use Spring Roo, then you probably won't care... just carry on with your life.

If you have started using Spring Roo (or if you've been reading my posts lately), then you already know that it is very powerful for quickly stitching together the components needed for Enterprise Java applications. Jasperoo facilitates the integration of Jasper Reports into your Spring Roo applications.

Let's say that you have created the PetClinic application and would like to have a report that generates a list of Owners. Without jasperoo, you would need to:
  • Add the JasperReports dependencies to your pom.xml;
  • Add the jasperreports-maven-plugin to your pom.xml;
  • Create the ReportController to handle the report requests;
  • Create your jrxml template; and 
  • Wire it all together.
With jasperoo, after it is installed, you just have to call:
  • jasperoo setup
  • jasperoo add --type ~.domain.Owner
Do you want to try it out?
Ok... here we go. I will assume that you have already setup Spring Roo, and familiarized yourself with it. If not, go to the Spring Roo website for instructions.

Step 1 - Create a sample application.
mkdir clinic
cd clinic
roo
    ____  ____  ____
   / __ \/ __ \/ __ \
  / /_/ / / / / / / /
 / _, _/ /_/ / /_/ /
/_/ |_|\____/\____/ 1.1.2.RELEASE [rev fbc33bb]


Welcome to Spring Roo. For assistance press TAB or type "hint" then hit ENTER.
roo> script --file clinic.roo
Step 2 - If you already have an older version of jasperoo installed do the following, otherwise, skip to step 3.
roo> addon remove --bundleSymbolicName ca.digitalface.jasperoo
Step 3 - Install the latest version of jasperoo
roo> osgi start --url http://s.digitalface.ca/jasperoo-latest
Step 4 - Setup jasperoo
roo> jasperoo setup
Step 5 - Generate a report of the Pet Owners
roo> jasperoo add --type ~.domain.Owner
There... that wasn't so hard, was it?

Test your work
Now either exit out of roo, or open another command shell and start-up the Pet Clinic application.
mvn tomcat:run
Open your browser and go to localhost:8080/petclinic/
[click to enlarge]

Create a new Owner
[click to enlarge]

Select the PDF report
[click to enlarge]

Open the report in Adobe Acrobat or some other PDF viewer.
[click to enlarge]

Select the Excel Report
[click to enlarge]

Open the report in MS Excel or Open Office Calc
[click to enlarge]

The reports generated are very utilitarian. However they can be readily edited in iReport.

The same code produces pdf and xls files, and with a small change to the menu file you also get csvhtmlodtxml, and rtf formats.

So, I encourage you to download it and try it out. The project is hosted on Google Code: jasperoo.digitalface.ca.

I look forward to your feedback.

Wednesday, February 23, 2011

Typical Security in Roo (#springroo, #roo-typical-security)

Rohit Ghatol, the author of the typical security addon for Spring Roo has invited me to be a contributor.

So my first contribution was to fix the minor bugs I mentioned in my previous post.

The following are reflected in the 0.1.4.BUILD-SNAPSHOT of the typical security addon:

  1. Password encryption
  2. Fixed SimpleMailMessage Autowire bug in SignUpController.java and ForgotPasswordController.java
  3. Fixed activationDate
  4. Fixed the finders 
  5. Renamed UserModel to User and RoleModel to Role.
  6. Renamed the Typicalsecurity command to typicalsecurity
  7. Set the default entity package to ~.domain (to align with how the rest of roo works).
As always, both Rohit and I welcome your feedback on this tool.

Saturday, February 19, 2011

Typical Security in roo

Roo provides a basic Spring Security setup out of the box.
roo> security setup
But what if you want the typical security features like user registration and password changing etc.?

There is a project underway to provide this. The Typical security add-on for roo facilitates the generation of some typical security features.

The author introduced it to the community here: http://forum.springsource.org/showthread.php?t=100534 but basically, the following will be all that you need to do to gain all the typical security features.
roo> Typicalsecurity setup --controllerPackage ~.web --entityPackage ~.domain
There are some minor bugs in the current build (0.1.2.BUILD). After you run the setup, you will need to
roo> focus --class ~.domain.UserModel
~.domain.UserModel roo> finder add findUserModelsByEmailAddress
~.domain.UserModel roo> finder add findUserModelsByActivationKeyAndEmailAddress
~.domain.UserModel roo> field date --type java.util.Date --fieldName activationDate
~.domain.UserModel roo> focus --class ~.domain.UserRoleModel
~.domain.UserRoleModel roo> finder add findUserRoleModelsByUserEntry
and you will need to comment out the Autowired annotation for SimpleMailMessage in SignUpController.java and ForgotPasswordController.java
//@Autowired
private transient SimpleMailMessage simpleMailMessage;

I will be keeping a close eye on this project. I sure hope it finds its way into the standard roo distribution.