Sunday, November 29, 2015

What's new in Grails 3

SpringOne2GX presentation about what's new in Grails 3

This seems to have been a particularly good SpringOne2GX and a lot of the presentations are becoming available now.

There were several good presentations about Grails and my general impression is the demise of Grails was greatly exaggerated.

Grails has a new corporate sponsor, OCI.

Groovy Grails Tool Suite remains unsupported but Grails 3 Released: Installing Gradle and Groovy 2.4 Support in Eclipse/GGTS offers some tips for continuing to use GGTS with Grails 3.

Another interesting thing about this presentation is Graeme Rocher is using IntelliJ IDEA CE (community edition, i.e. the free version) to demo everything.  I've been using IDEA to debug Groovy scripts because just debugging a script in isolation doesn't seem to be very well supported in the Eclipse-based IDEs like GGTS.  But this is opening my eyes to the CE version having a lot of functionality and being a pretty useful tool.

I like the direction of taking advantage of existing infrastructure like Gradle as the build tool.

One downside of the many changes in 3.X is there is no direct upgrade path.  This seems like it is going to be a big hump to get over, especially for projects using a lot of Grails 2.X plugins (as we do at work).

Learning priorities

What I'm most interested in at the moment
  • Spring Boot/Cloud, generally getting back up to speed in Spring
  • Gradle
  • IntelliJ IDEA
  • TextMate
  • Cloud Foundry (free version running locally)
  • Docker
  • Jenkins, CI

Sunday, October 11, 2015

Java 8

Wow, have I really not posted anything since January?

I'm coming up to speed on Java 8.  I've been working in Groovy for like a year and a half so these concepts are not new, but the syntax is just different enough that I have to think about it.

Here is some code I wrote a while back.  It is a solution to a Cracking the Coding Interview problem to write a boolean method taking two strings as input and returning whether one string is a permutation of the other (same characters in a different order):


This is basically Java 6 the way we've been writing it for the last 10 years or so.

isPermutation stays the same so I'll just be showing changes to signature.

Use a Java 8 lambda and a stream to iterate through the String.  Note the use of String.chars() returning an IntStream which is where the stream comes from.  You'd think there's be a CharStream, but no, so I'm using a rather awkward conversion to get the int back to a char:


Not a big improvement so far... next I use the cool new Map.getOrDefault() to replace 7 lines of code with one:



That is starting to be some more expressive and maintainable code... finally there's nothing sacred about the signature being implemented as a Map<Character,Integer>, so let's change that to Map<Integer,Integer> which will make it possible to remove the awkward int to char conversion and make the lambda body an expression rather than a block:



Friday, January 16, 2015

Mint 17, hibernate, plymouth

According to time-honored tradition I took advantage of time off over the holidays to upgrade my home computer from Mint 13 to Mint 17.

It's been about 2 1/2 years since I first tried Mint and I'm really feeling upbeat about this distro.  When Mark Shuttleworth went out of his mind and started ruining Ubuntu around 2010, it created a real vacuum.  For the first time since the Red Hat years there wasn't a Linux distro choice that was obvious.  I tried some different things, Mandriva, Magiea, Lubuntu and Xubuntu, Fedora... the magic just didn't seem to be there.

I was hearing good things about Mint so I gave it a shot.  Mint started out in a relationship with Ubuntu that you could compare with the old Mandrake - Red Hat relationship.  MATE gave me a way to cling to the familiar Gnome 2-ish desktop framework and continue to use all the same Ubuntu packages as before.

Anyway, things went smoothly.  This was kind of a big project due to the many purposes I use this computer for.  It's where I read my mail.  It's my 'file pig' where I keep movies and music.  It's my games box (dual boot with Windows XP).

You can now install Netflix practically out of the box.

I had a little trouble with Google Earth.  (Cool program).  Don't use the Google PPA.  Instead, install googleearth-package from the default Ubuntu repositories, then google-earth-stable:i386 as described here.

I used to just keep this computer up and running 24X7, but a few years ago I started hibernating it at night or when I was at work to keep the power consumption down.  After the upgrade, I had some trouble with hibernate.  Previously I had been using uswsusp, but now that didn't work at all.  I would get through a successful-looking hibernate and resume, then the computer would just lock up and I'd have to power cycle to bring it back up.

I took a shot at using swsusp instead.  uswsusp has several advantages over swsusp.  With uswsusp you get some output on the console showing the progress of the save or restore.  Swsusp just gives you a flashing cursor.  Uswsusp gives you a config file.  It gives you compression.  So uswsusp is my first choice.  But with a little configuration effort (notably building a swap file bigger than my RAM, since it doesn't use compression), swsusp seemed to be working.  But after a couple of weeks I had to admit it wasn't stable.  The longer my computer was up, the more likely hibernate was to fail.  It failed during the 'suspend', and shortly afterward X would lock up and I would need to reboot.

Around this time I started taking a really close look at a package called plymouth.  The purpose of plymouth is to display some eye candy while your system is booting.  By default, it gives you the Linux Mint logo but there are some other things you can configure.  The trouble with this is, if you're trying to troubleshoot something that happens during the boot process, like resuming from hibernate, all that dmesg output is hidden and you can only guess what's going on.

No problem, just remove plymouth, right?  Uh-uh.  For no reason that makes any sense, hundreds of packages are dependent on plymouth.  Packages like apache2, cron, cups, the kernel itself, mysql-server... This appears to come from Ubuntu since my buddy was able to easily remove plymouth from Mint-Debian.

So, a bit of frustration there, but the solution is easy enough... just remove "splash" from the boot line.

OK, did that.  Now I can see that my resume from uswsusp hibernate is proceeding to 100% completion, but right after that the computer locks up.

I did some more googling and found this.  Oh, that's interesting, plymouth itself is breaking the resume?  Here's another page documenting how to fix this.  I tried it and it worked.

So, plymouth was the real villain of this task, first blinding me to the output I needed to troubleshoot a problem, then it turns out plymouth itself caused the problem!  Plymouth is teh sux.

Update 2/17/2015:

I was continuing to have some instability with this system.  Every week or two I would have a lock-up and be forced to reboot.

I was just poking around in the motherboard manual kind of at random looking for clues when I noticed a feature called AHCI.  AHCI is a protocol for accessing SATA hard drives.  The BIOS menu has an option to either use AHCI or to cause the SATA drives to emulate IDE protocol.

Linux is fine with AHCI so I decided to try this.  I changed the BIOS setting to AHCI and Linux stayed up for 2 weeks.

There was a slight problem in that this computer was dual boot with Windows XP which is my games box for stuff I can't play in Linux.  Windows XP was on a SATA drive, and it does not support AHCI.  There are some hacks to enable this which I tried without success.  Finally I decided to just upgrade the Windows partition to Windows 7.  Windows XP was going on a year past its EOL date so this was probably something I was going to want to do eventually anyway.  This went smoothly and left me with a system I could just leave in AHCI mode all the time.

This issue predates my Mint 17 update as the computer has been having these freezes and lockups since the middle of last year. I actually was hoping Mint 17 would fix this.   My current theory is that I was running in AHCI mode for most of the lifetime of this motherboard (since October, 2009!), but after one of the changes I made last year, the BIOS was reset to its defaults, which includes IDE mode for SATA drives.

I'm not observing any disk I/O performance improvements or any other differences besides this system stability improvement as a result of switching to AHCI.  It is said to improve performance for SSDs.


Resources



Sunday, November 23, 2014

NFJS 2014 (2)

They should call this the JavaScript, Architecture and Dev/Ops show.

I'm doing a certain amount of career soul-searching.  Is Java over?

In 2007 I went to Scott Davis' Grails presentation and thought it was the coolest thing I ever saw.  So, a long and winding 7 years later, I'm actually working in Grails.  Scott wasn't at this NFJS but I saw him a while back at Boulder Java User's Group and he was presenting on a JavaScript topic.

Pratik Patel has gone over to JavaScript.  Matt Stine went over to Dev/Ops.  And of course Bruce Tate went over to Rails some years ago.  These are the kind of people I look up to and try to emulate.

I really like Groovy/Grails and the Spring world.  I feel like I'm finally right where I want to be in my career after a somewhat bitter struggle, working with these technologies.

Anyway... the coolest cool new thing was Web Components and Polymer.  The way most web development is done is going to completely change in the next year or so.

The most crowded presentation I went to with people standing up in the back of the room was Neal Ford's talk on Microservices.  This sits at the intersection of Architecture and Dev/Ops where there seems to be a high level of interest.  Matt Stine's keynote Failure is the Only Option was also Dev/Ops-related.

Daniel Hinojosa's test-driven development talk The Walking TDD was good and drew a lot of interest.

I wasn't expecting much from Brian Sletten's talk about cryptography but this turned out to be really good.  Trust no one.

I dutifully went to Craig Walls' What's New in Spring.  I would have gone to the Spring Boot talk but I saw him give it at Boulder JUG a while back.  My sense is Spring continues to rock, but I'm focused on other things right now.

If I had to sum up NFJS 2014 (or the 1/5 of the sessions I went to, anyway) in one word, the word would be 'components'.  Web components, of course, and Microservices Architecture is all about modularity and components, and the same is true of Docker.

Links

Web components



Thursday, November 20, 2014

NFJS 2014

My uber-cool employer is sending me to No Fluff Just Stuff.

This will be the 10th anniversary of my first time in 2004.

Hot topics in 2004 were dependency injection, object-relational mapping and web frameworks (which in those days meant primarily server-side).  Dave Thomas and Bruce Tate were among the speakers.  SOAP was alive and well and there were lots of XML-related talks.  Agile methodologies were new and exciting.

Some specific presentation topics included Spring, Hibernate, JDO, Struts, JSF, Tapestry, Ruby, Groovy, AOP.

It was totally mind-blowing for me.  My Java experience leading up to this was Tomcat, JBoss and Struts.  I thought EJBs and J2EE were the pinnacle of advanced enterprise Java.  I had tried Struts but reverted back to JSP for web development.  Back then I thought JavaScript was suitable only for cheesy effects that no serious developer would use.

I went on to use Tapestry in a project within the next year.  This was the coolest Java web framework of 2005 (you could use components that encapsulated JavaScript functionality without knowing anything about JavaScript!) but it didn't do well in the years that followed and is almost forgotten now.

Spring, Hibernate and Groovy had a big influence on me and (along with Grails) these are what I'm mostly working in today.

So, in 2004, NFJS exposed me to many ideas that were new and even revolutionary.  It also made me realize that I had been in a complacent backwater and was ignorant of a wide world of innovation going on outside the confines of my narrow career.

Comparing that with the program for this year, I can't help feel a little disappointed.  And I hasten to say this is no reflection on the NFJS presenters and organizers.  But the awesome creative ferment of a decade ago seems to have spent its force.

The one thing on the agenda that is somewhat new is Microservices.  There's plenty of good stuff. even the usual tough choices where more than one presentation I'd like to see are being offered at the same time.  But, there's not much here that is new since my last visit to Uberconf 2 1/2 years ago.

Did the excitement and innovation go elsewhere?  Is the whole industry in a slump?

The conventional wisdom lately has been that the actual Java language has become the COBOL of the 2010s, however lots of cool new languages like Groovy, Clojure and Scala run on the JVM. and the next big thing was probably going to involve a JVM-based language, possibly a functional language that would solve the concurrency problem.  I've been hearing this for about 4 years now and nothing much seems to be happening... these languages thrive in their little niches but there is no revolution.

Well, perhaps I'm being overly pessimistic and something from this NFJS is getting ready to knock my socks off.  Or, I'm just at a stage in my development where I don't need to be chasing the latest new thing so much as deepening my command of existing tools and frameworks.  I think I could spend the rest of my life mastering Spring framework and all the additional Spring projects.  Do we really just have enough of this stuff to the point where new languages and frameworks become superfluous?

Wednesday, September 3, 2014

Jasper Reports

I've been trying to work (again) with the Jasper Reports suite of tools (Jasper Reports Server, JasperSoft Studio).  There's a Community (free) edition, and a variety of non-free commercial editions.

It's getting incredibly frustrating, because for the most part the documentation covers the commercial editions, with only a short disclaimer at the beginning that some of the features described may not be implemented in the Community version.

I find I'm repeatedly being led down the garden path towards a solution to the particular problem I'm trying to solve, only to discover that the feature being described is not available in Community.