Matt RaibleMatt Raible is a Web Developer and Java Champion. Connect with him on LinkedIn.

The Angular Mini-Book The Angular Mini-Book is a guide to getting started with Angular. You'll learn how to develop a bare-bones application, test it, and deploy it. Then you'll move on to adding Bootstrap, Angular Material, continuous integration, and authentication.

Spring Boot is a popular framework for building REST APIs. You'll learn how to integrate Angular with Spring Boot and use security best practices like HTTPS and a content security policy.

For book updates, follow @angular_book on Twitter.

The JHipster Mini-Book The JHipster Mini-Book is a guide to getting started with hip technologies today: Angular, Bootstrap, and Spring Boot. All of these frameworks are wrapped up in an easy-to-use project called JHipster.

This book shows you how to build an app with JHipster, and guides you through the plethora of tools, techniques and options you can use. Furthermore, it explains the UI and API building blocks so you understand the underpinnings of your great application.

For book updates, follow @jhipster-book on Twitter.

10+ YEARS


Over 10 years ago, I wrote my first blog post. Since then, I've authored books, had kids, traveled the world, found Trish and blogged about it all.

AppFuse Light converted to Maven modules, upgraded to Tapestry 5 and Stripes 1.5

This past week, I stayed up a couple of late nights to do some of the AppFuse Light work I wrote about in October. I converted all web frameworks to Maven modules, as well as made them inherit from the appfuse-web project. Below is what the new module structure looks like:

New AppFuse Light Modules

At this point, the project is ready to import into AppFuse's SVN project. Here's a list of other changes I made:

  • Modules now depend on AppFuse's backend and allow you to use Hibernate, JPA or iBATIS as the persistence framework. Implementations for Spring JDBC, OJB and JDO have been removed.
  • Upgraded to JWebUnit 2.1, which now uses HtmlUnit under the hood and has much better JavaScript support. It also has Selenium support, but I've yet to try it.
  • Ajaxified Body integrated into all frameworks. You can easily turn it off by modifying the global.js file.
  • Prototype and Scriptaculous loaded from Google's Ajax Libraries CDN.
  • Upgraded to Tapestry 5. Mad props to Serge Eby and his tapestry5-appfuse project for showing me how to do this. Serge became a committer on AppFuse recently, so hopefully we'll continue to see great things from the Tapestry 5 support. I really like the clean URLs and minimum configuration required in Tapestry 5. It's testing framework is nice too, but I believe it could be improved.
  • Upgraded to Stripes 1.5. This was easy and painless. I'm definitely a fan of Stripes and look forward to reading the Stripes book on my bookshelf.
  • Dropped support for: Struts 1.x, WebWork, Spring MVC + Velocity.

If you want to try any of these applications, you can create archetypes using the following commands:

svn co https://appfuse-light.dev.java.net/svn/appfuse-light/trunk appfuse-light
cd appfuse-light/preferred-web-framework
mvn archetype:create-from-project
cd target/generated-sources/archetype
mvn install
cd ~/dev
mvn archetype:generate # The new archetype should show up as an option

Next steps include figuring out a way to flatten the inherited dependencies and plugins so archetype:create-from-project can create truly standalone projects. Please let me know if you have any questions.

Posted in Java at Dec 20 2008, 06:42:03 PM MST 9 Comments

Dojo/Comet support in Java Web Frameworks

Dojo Logo This week I'm doing a research project for a client. The main purpose of the project is to find out which Java-based web framework works best with Dojo and Comet. Here's the key requirement from the client:

It's all about Comet, we want Comet everywhere we can put it, but we want to isolate the icky bits of fiddling with pages with JavaScript. We're kind of wed to the Dojo implementation of the client-side bit, so we may as well use more of the Dojo widgets for a richer UI. For us, "works best with" needs to pay a certain amount of consideration to "fits naturally with", if you understand what I mean. I know that any framework that lets you spit out raw HTML will let you hand code in your Dojo / Comet, but that's certain to become very tiresome very quickly.

The candidate frameworks they asked me to look at are Wicket and Tapestry 5. They're willing to upgrade to Struts 2 since they're already using Struts 1. However, they don't feel that action-based frameworks naturally lead to rich UIs, so they'd prefer a component-based framework. They're currently using Seam for an administration-type application and feel it's too heavy for their customer-facing application.

Here's what I've found so far in my research. Please let me know if anything is incorrect.

  • Tapestry 5 doesn't have Dojo or Comet support (Prototype and Scriptaculous are the baked-in Ajax frameworks).
  • Struts 2 has old (version 0.4.3) and somewhat deprecated Dojo support. The developers seem to be in favor of removing it and promoting people hand-code Dojo instead. Struts 2 doesn't have support for Comet.
  • Wicket has support for Dojo 1.1 that includes Comet support. This was written by Stefan Fußenegger and posted to the mailing list last month. I e-mailed Stefan and asked him about documentation. His response: "I lost my ambition to document it properly since I didn't receive any feedback on the mailing list. :)"

At this point, it seems that if the client really wants to use Dojo, they should use Wicket, and possibly pay Stefan to document it properly. However, they're willing to consider other options, as long as they have Comet support.

One option I thought of is to use DWR and its Reverse Ajax/Comet support. Another option would be to add better Dojo support to Tapestry 5. However, I don't think this is possible since the Prototype/Scriptaculous code is generated by the framework and would likely require a changes to switch it to Dojo.

Are there any other Java-based web frameworks that support easily creating Dojo widgets and working with Comet? Keith Donald tweeted that Spring MVC has Dojo support. However, I believe it's only for widgets and it still requires you to write JavaScript. If your framework doesn't have Dojo/Comet support, how hard would it be to add it?

Update: I also posted this question on LinkedIn. Make sure and check my question for additional thoughts from folks.

Posted in Java at Dec 18 2008, 03:58:37 PM MST 19 Comments

Abbie is a Blue Skier!

On Friday afternoon, the kids and I headed up to Winter Park for a night at Zephyr Lodge. The drive up was great (no traffic) and it started snowing as soon as we got off I-70. 45 minutes later and the kids were on the slopes for the last few runs of the day. There was a few inches of snow that turned out to be great - it slowed them down enough that they didn't have to turn or worry about "pizza".

On Saturday, we put Jack in Ski School and Abbie and I had a "Daddy + Daughter" day on the mountain. She didn't want to hit the magic carpet and instead opted for the lift right away. We skied a couple greens and w/in an hour she was ready to try a blue. She did quite well on the blue and even skied a few bumps on the side. Yes, she did fall a few times, but she got up by herself and always had a smile on her face. I was extremely proud. Below are a few pictures and a video from our weekend.

Riding the Magic Carpet Snowball Fight! Pizza

I'm glad I took the kids skiing yesterday. It's been dumping with cold temperatures ever since we left. It's currently -15°F in Denver (a new record) and it's snowed 2 feet at some resorts. Now I just need to figure out a way to make it up a couple of times this week. ;-)

Posted in General at Dec 14 2008, 09:55:44 PM MST 1 Comment

How I recovered data from my failed Linux box

Yesterday, I decided to quit procrastinating and finish up my 2007 taxes once and for all. When I booted up QuickBooks on my XP box, it said it couldn't connect to drive Q. Drive Q is on my Linux box, which I discovered wasn't on. When I booted it, the screen showed an "Error 18" after the GRUB loading message. The resulted in several hours of grub-install and many other commands to no avail.

Since I hadn't messed with the box in almost a year, I didn't even know if it had Fedora or Suse installed on it. I had both disks lying around, so I tried the good ol' linux rescue with my Fedora disks. I was able to access the data, but had no luck in getting network connectivity or copying files to a USB drive.

Today I hoped for a different route: Live CDs. Yesterday, I discovered I was running Suse 10, so I downloaded a Suse 11 Live CD, burned it and booted. It worked, but I didn't have access to my hard drives and wasn't able to mount anything. Next up, I tried Knoppix, which allowed me to boot and access my hard drives. Unfortunately, I still didn't have any network access and my 2GB thumb drive didn't hold enough data.

Next, I pulled out a 250GB USB drive I had lying around. Knoppix recognized it, but was unable to format it for some reason. I plugged it into my XP box, used fat32format to format the drive as FAT32, and plugged it back into my Linux box. Success! I was able to copy all the data I needed and now I have the USB drive plugged into my Airport Extreme.

Hopefully if someone else runs into similar issues, they can use this post to find their path to success.

Posted in Open Source at Dec 11 2008, 02:02:29 PM MST 6 Comments

Costa Rica was Awesome!

After entering The Golden Period almost two weeks ago, I boarded a flight bound for Costa Rica early on the morning of Thanksgiving. I knew Costa Rica was going to be a great time since good friends (the bride and groom, Autumn and Clint) and my parents were going.

My Room at Villa Pacande On Thursday night, I had a room booked at Villa Pacande. As they suggested on their website, I took an Orange cab (for $4, not $22 like the driver tried to tell me) to my hotel. 30 minutes later I ended up at the Hotel Pacande and quickly negotiated for another cab to the Villa Pacande. 30 minutes later, I was swinging in a hammock on my room's balcony. As you can see from the picture on the right, it was a pretty nice room. I enjoyed the sunset, tipped back a few cold ones and waited for my friends to arrive at 11. After they arrived, we stayed up until the wee hours of the morning and had a fun time sharing old memories.

On Friday, we boarded a private bus that transported us from the Villa to Hotel Esperanza. It was pretty nerve-racking watching our driver navigate the narrow roads at high speed for 5 hours. We safely arrived in Playa Carrillo on Friday afternoon and soon after walked 10 minutes to the local beach. As we were walking there, my parents showed up in their rental car (they'd been in Panama for the week). Soon after, we saw some monkeys in trees then ran for the beach and splashed around in the waves of the Pacific. We entered darkness to a beautiful sunset that evening.

Monkeys Playa Carrillo Mom and Dad in Costa Rica

Sunset in Playa Carrillo Sunset in Playa Carrillo Sunset in Playa Carrillo

On Saturday, I woke up early (6:30), went on a run with my mom (very hot when the wind disappeared), had a dip in the pool and enjoyed a delicious breakfast from Dennis, the host of Hotel Esperanza. I should probably talk about the hotel a bit since that was one of the best parts. Hotel Esperanza is owned by an American (Dennis) from Florida and he and his right-hand man (Erwin) provided some of the best service I've ever seen at a hotel. The hotel had 7 rooms, and our wedding party took up 6 of them. The bride and groom occupied one, I had one, the maid of honor (Angie) had one and the other 3 were occupied by parents (mine + parents of the bride and groom). We had the place all to ourselves and it was simply magnificent.

After breakfast, we headed down to Jesse's Gym for some surfing lessons. We were told to come back at 2:30 when the tide was good. We walked down the beach to Samara and had some lunch while we waited. After lunch, 5 of us got surfing lessons and had a blast. I'm definitely hooked on surfing now and hope to get some more practice in when I make trips out to LA this winter.

Happy Fellas Beach like Glass Beautiful Beach near Samara

Wipeout! Nice Ride! No Comment

Sunday was the wedding day and we started things off by taking a horseback ride in the pouring rain. It was a warm rain, so the ride itself wasn't bad. The lack of views at the top of the mountain wasn't too great though.

Giddyup! Riding in the Rain Autumn and Clint in Costa Rica

For the wedding ceremony, all the guys traveled down to the local beach and built an altar. The ceremony was a couple hours later and we had a ball toasting, eating and dancing the night away. At the end of the night, after everyone else had crashed, Angie and I walked down to the beach with a bottle of wine and enjoyed a spectacular site: 15-20 boats that were glowing in the distance off the shore. Sure, it could've been the booze, but I'm pretty sure it wasn't. ;-)

Happy Wife You May Kiss the Bride! Goofy

On Monday morning, people started to head their different directions. Clint's parents were staying another week, so they rented a car and headed north. Clint and Autumn jumped on a bus to enjoy their honeymoon in many different parts of Costa Rica. Autumn's parents hopped on a shuttle to San Jose to catch a flight back home. The rest of us (my parents, Angie and I) stayed at Hotel Esparanza for one more night. Angie and I got massages, napped by the pool and enjoyed one last walk on the beach. Tuesday was spent driving back to San Jose. We dropped Angie off at Hotel Pacande and boarded a plane for Panama City.

After arriving in Panama City, we rented a car and drove to Ivan's Bed and Breakfast (highly recommended) for the night. On Wednesday morning, we toured the Miraflores Locks (part of the Panama Canal) and drove to our friends' house in El Valle. In El Valle, we talked, read, relaxed and watched it rain. A lot. It was a nice way to wind down the trip before flying back last Friday.

Ivan's in Panama Ivan's Bed and Breakfast Panama

Mom and Dad at Miraflores Locks At The Panama Canal Big Cargo Ship

My favorite part of this vacation was enjoying the beautiful beaches with really cool people. Good friends are always fun to party with, especially when they bring along other good friends. I love destination weddings and I'm pumped to enjoy two more in 2009: one in West Palm Beach and one in Cancun.

It's a strange feeling being back in the snow after surfing last week. Hopefully I'll get over it soon. Skiing last weekend was good therapy. 5 more days before the end of the year and I should be fully recovered.

For more pictures from this trip, see my Costa Rica 2008 set on Flickr.

Posted in General at Dec 10 2008, 12:39:24 AM MST 3 Comments

What's Next

It's been three weeks since I joined the realm of the unemployed. Fortunately, I didn't stay unemployed for long. In fact, after writing the aforementioned post, I received 5 offers the next day. Of the opportunities I received, the most interesting ones were those from companies interested in hiring the whole team. Not only that, but LinkedIn hired me back as a contractor through the end of the year. The goal of the LinkedIn contract: finish up projects that my team had started in the previous months.

At the end of the first week after the LinkedIn layoffs, we all had individual opportunities, but we also had two team opportunities. The following week (last week), I flew to NYC to meet with one potential client while the other potential client flew to Denver to meet with the rest of the team. After flying to NYC, I traveled to Mountain View to do some on-site work at LinkedIn. At the end of the week, it seemed like most of the remaining tasks at LinkedIn could be done by someone else. I told them I thought it was best that I move onto other things, while staying available for support questions. On the way to the airport, I spoke with both our team opportunities. Following those conversations, I was very pumped about both projects and confident about pending offers. You can imagine my disappointment when my flight was delayed for 5 hours.

After a fun weekend with Abbie, Jack and friends, I woke up Monday morning without a job and it felt great. However, things changed quickly. Monday morning many opportunities landed in my inbox: a 3-day gig this week (helping write open-source training), a 1-week gig in December (evaluating how well Tapestry 5, Wicket and Struts 2 integrate with Dojo/Comet for a client in Europe), a 1-week training gig in Europe next year and a 3-month gig for the whole team. I accepted all these opportunities and am very happy I'll get to work with Jimbo, Country and Scotty again next year. The 3-month gig should be a lot of fun. We're helping build a SOFEA-based architecture that leverages appropriate client technologies (to be determined) to build a kick-ass web application. I look forward to talking about the technologies we use and things we learn along the way.

Costa Rica, courtesy of Rob Misek So the good news is I've entered The Golden Period. The Golden Period is when you don't have a job, but you do have a start date. Unemployment is absolutely blissful during this time. The Golden Period exists a couple times for me over the next 6 weeks.

I'll be traveling to Costa Rica tomorrow for a best friend's wedding. I'm leaving both my laptop and my iPhone at home. Next week, I'll be loving life with my parents in Costa Rica and Panama. The following week, I'll be working on AppFuse all week and hope to make great progress on developing 2.1. Then I have the 1-week Web Framework Analysis gig, followed by 2 weeks of vacation in Oregon. My Golden Period begins this afternoon (for 3 weeks) and happens again over Christmas (for 2 weeks).

Yeah, life is good. Damn good. :-D

Posted in Java at Nov 26 2008, 03:19:18 PM MST 12 Comments

Jack's Mohawk

Last weekend, we celebrated Abbie's birthday with friends and family at Julie's house. My parents and I had a great time, but left a bit early so I could take them to their first DU Hockey game. Towards the end of the game, I received the following text message from Jack's soon-to-be Uncle Jason.

Jack wants a mohawk? Is that OK?

My response:

Absolutely! Please take pictures.

Below are pictures from what ensued shortly after.

Before Before

After After

Jack looks pretty darn cute with his new haircut and he's received nothing but compliments from everyone. Personally, I dig it.

Posted in General at Nov 12 2008, 11:21:08 PM MST 3 Comments

LinkedIn Cuts 10% (a.k.a. The Journey is Over)

This morning, my co-workers and I discovered that LinkedIn decided to trim 10% of its employees. The Denver Office was among those that were laid off. I can't say we didn't see the writing on the wall. In fact, on the evening of October 15, I sent the following e-mail to my co-workers:

LinkedIn's top investor[1] is Sequoia Capital and they recently posted this presentation on the web.

http://www.slideshare.net/eldon/sequoia-capital-on-startups-and-the-economic-downturn-presentation?type=powerpoint

Notice the reduce head count recommendations. ... Oh well, life goes on. ;-)

Raible

[1] http://www.linkedin.com/static?key=investors

So, as of today, there is no LinkedIn Denver office. While I had a lot of fun being a UI Architect and managing Engineers, I'm somewhat happy this has happened. After all, now I get to enjoy the best perk about being an employee: the good ol' severance package!

If you're looking for good Engineers, I highly recommend all of the guys who worked for me during this journey. You can read more about the skills they possess and what they're looking for by viewing their LinkedIn Profiles:


Scott Nicholls

Bryan Noll

James Goodwill

As for me, I'm definitely in the market as well. You can view My LinkedIn Profile to see if I might be a good fit for your organization. I'm willing to travel up to 25%, but would prefer not to. After all, ski season is right around the corner. ;-)

Lastly, I just wanted to say that I really enjoyed working at LinkedIn. I've never worked with a smarter group of Engineers, nor been so excited about a company's product and vision. I know that LinkedIn will be highly successful and I hope to use their site to find gigs for many years to come.

Posted in Java at Nov 05 2008, 03:10:06 PM MST 16 Comments

Happy Birthday Abbie!

Today marks the 6th anniversary of Abbie's birthday. Happy Birthday kiddo!

Abbie has all her baby teeth

To see how Abbie has grown up over the years, see past Happy Birthday posts: #1, #3 and #4, #5. To celebrate, I'll be getting off early and having lunch with Abbie's class at school. After that, we'll be embarking on a Daddy/Daughter day where she gets to pick everything we do. I did this with Jack on his birthday and had a lot of fun.

Posted in General at Nov 05 2008, 06:42:55 AM MST 4 Comments

Moving from Spring's XML to Annotations in AppFuse

Last night, I did a spike on AppFuse to change XML to Spring annotations (@Repository, @Service and @Autowired) in its service and data modules. While I was able to accomplish everything in a few hours (including converting tests), I did run into a couple issues.

AbstractTransactionalJUnit4..Tests vs. AbstractTransactionalDataSource..Tests
I've switched from my favorite Spring class to the annotation-happy AbstractTransactionalJUnit4SpringContextTests. However, this has presented an issue: when using ATDSSCT, I was able to call endTransaction() and startNewTransaction(). With ATJ4SCT, this doesn't seem possible. Below is a screenshot of the diff on a test method in the JPA implementation of UserDaoTest:

AbstractTransactionalJUnit4SpringContextTests vs. AbstractTransactionalDataSourceSpringContextTests

On the right, you'll notice that I had to comment out @ExpectedException to get the test to pass. This concerns me since this exception should be thrown. Is there a way to call endTransaction() and startNewTransaction() when subclassing AbstractTransactionalJUnit4SpringContextTests?

Instantiating GenericDao Implementations Programmatically
The second feature I tried to add is the ability to instantiate a GenericDao programatically rather than requiring a XML bean definition. In current versions of AppFuse, you can use the following bean definition to create a GenericDao for a model object.

<bean id="personDao" class="org.appfuse.dao.hibernate.GenericDaoHibernate">
    <constructor-arg value="org.appfuse.tutorial.model.Person"/> 
    <property name="sessionFactory" ref="sessionFactory"/>
</bean> 

When moving to a no-XML required architecture, it'd be nice to allow users to create GenericDao's programmatically. Below is the easiest way I've found to do this in a test:

GenericDao<User, Long> genericDao;
@Autowired
SessionFactory sessionFactory;

@Before
public void setUp() {
    genericDao = new GenericDaoHibernate<User, Long>(User.class);
    genericDao.setSessionFactory(sessionFactory);
}

However, there's a couple problems with this. First of all, mixing constructor injection and setter injection probably isn't a good idea. Changing the constructor to take a SessionFactory solves this problem, but now all subclasses need to have a more verbose constructor:

@Autowired
public UserDaoHibernate(SessionFactory sessionFactory) {
    super(User.class, sessionFactory);
}

Whereas before they had:

public UserDaoHibernate() {
    super(User.class);
}

In an ideal world, I could call new GenericDaoHibernate<User, Long>(User.class) and the SessionFactory would be wired in auto-magically. Is this possible with Spring 2.5?

The 2nd problem this presents is your client code will now be dependent on an implementation rather than the interface. I don't know how to solve that one, but I'd love to figure out a way to create GenericDaos with no XML and no implementation details in the client. Any ideas are most welcome.

If you'd like to see all the changes I made in converting from XML to Annotations, please see this patch.

Posted in Java at Nov 04 2008, 11:39:54 AM MST 14 Comments