Chariot Training Classes

Training Courses

I run Chariot's training and mentoring services. We provide training in AngularJS, HTML5, Spring, Hibernate, Maven, Scala, and more.

Chariot Education Services

Technology

Chariot Emerging Tech

Learn about upcoming technologies and trends from my colleagues at Chariot Solutions.

Resources

Chariot Conferences

Podcasts

Friday
Sep202013

Hacking the 'Roo... Removing the default web plugins

Let's say you love the productivity of Roo up to a point, but that point happens to be the web. Unfortunately, the default Spring MVC patterns installed in a Roo web app are pretty heavyweight - adding localization, tiles, tags, jspx, etc...

If you ever set up and then backed-out a Roo configuration for the web, and then did the wrong thing and found it regenerated the default web site scaffold, you may have sighed under your breath that you just wish Roo didn't do that.

Well, you have an option. I'd say it's rather voodoo, but if you want to get prototyping in some web-based applications and just make a simple Spring MVC front-end, but don't want to get Roo involved in anything above, say, the service tier, here's what you can do:

  • Make a custom Roo installation directory
  • Expand Roo
  • remove the bundles for web, webmvc, web-json, gwt, jsf, selenium (and maybe one or two more I can't remember)
  • remove the cache directory from Roo (it copies the deployed add-ons into this cache as part of the Equinox OSGi container).
  • start up Roo, and see if it sends any OSGi errors your way. If it does, you've forgotten to remove a bundle. Try again - shut down the shell, follow the removal step, clear the cache directory, and restart.

There you are. Now, you can enjoy using Roo for the Aspect-J ITDs, and to make modeling data easier, but if you are simply using Spring MVC for a RESTful front-end, now Roo doesn't get in your way anymore.

You can always link your roo.sh shell script for this version of roo to something like /usr/bin/roo-lite.

Happy Roo'ing.

Ken

Thursday
Jul112013

Accessing and writing client-created cookies in AngularJS

AngularJS provides a $cookieStore object that reads and writes cookies. Here is a sample JSFiddle (my new favorite toy) that demonstrates setting a cookie value and bumping it by one each time the button is clicked.

Note - you won't see the number bump in the iFrame-embedded JSFiddle... Only if you jump to the JSFiddle site to test with it! This is Cross-Site Scripting protection in action...

Original discussion source was this Stack Overflow article.

Monday
Jun172013

Spring Roo 1.2.4.RELEASE available now

Thanks to @alankstewart and some new contributors from the open source community, Spring Roo 1.2.4 has been released. It is available for download now.

Fifty issues have been resolved and it looks like the twitter tweet has been removed from the shell.

I'll be digging around with this a bit and posting any tidbits - I am also going to upgrade the code samples for Roo in Action to 1.2.4 this week, and will post any notes on what I find during upgrades.

Ken

Friday
May242013

AngularJS Pattern #1 - async service results

Spring Quizzo ETE sample code

Hi everyone. If you're looking for examples of potential ways to interact with a Spring app from AngularJS, take a look at the project I worked on with Pivotal's David Turanski for ETE, the Quizzo-ETE application.

It's at github.com/krimple/quizzo-ete. Highlights:

Now here's something I ended up using (but not as well as in here) for the quiz. It's a way to send a request to a Angular service asynchronously and receive a result via a message back to the component.

Asynchronous calls to services in Angular

In Angular, everything is asynchronous as much as possible to provide speed. A call to a $http service, which performs ajax methods, doesn't immediately return a value. If you decide to split up your Angular controllers and services, so you separate your UI from the calls to your backends, you'll quickly find that it becomes hard to get a response without some extra work.

One way to orchestrate calls is to use the Angular messaging framework, built into the $scope object. For example, in our controller we can execute a call to fetch games we're able to play right now, but we won't get the response right away. So, we can subscribe to a message, sent by our service, which will then come back to us with data. See this simple JSFiddle for an example:

The service uses a passed $scope variable. I've also injected a $rootScope into the service. Using that one would allow us to broadcast the message to any interested party.

Saturday
May042013

Spring Roo project updates...

It's been a while and all has been quiet on my front - I've been buried with day-job work, and enjoying not having to update a book in a while :)

A quick note on Spring Roo - looks like there are plans for a 1.2.4 release sometime in the summer. Alan Stewart tweeted this earlier in the week. Also, the Roobot, which accepts new OSGi bundles and also provides for downloading of existing ones, went down for a while, but due to some work recently by Alan it's up and running for internal bundles as of today.

If you're using Roo and need some basic Roo-provided bundles, they are now online.

Alan is working on getting the Roobot stabilized (some project descriptor might be causing trouble, we'll have to see which one - at one point it was mine). Once that's done they can re-populate the repository with the user-contributed ones.

Finally, the download link seems to be broken (the initial Download button works, but once you bypass registration and go to the download form, the real link is not a link), but follow my reply on this forum thread for a quick workaround.

Once Roo 1.2.4 gets ready for takeoff, I'll post my notes on it. I've recently submitted a contributor agreement to help Alan with some things here and there, and if they accept it, I'll be able to do a bit more for the community.