Loading Twitter updates Loading...
Follow me on Twitter
20031130 Sunday November 30, 2003

AppFuse 1.0 Released! I feel this release deserves the big 1.0 designation because it is an up-to-date representation of my learnings and my perceived best practices in building web applications. Of course, as I learn more, I will continue to push out new releases.

In this release, I did a lot of refactoring and enhancements to existing features. The DAO and Manager interfaces are no longer tied to Struts or Hibernate. Hibernate's Session object is now passed as an argument into Manager and DAO constructors, rather than method signatures. The DAOFactory was refactored by Bear Giles to use reflection to instantiate Hibernate DAO's. Now, if you add a new DAO, you don't have to edit DAOFactory and DAOFactoryHibernate. To insantiate a new DAO, the code is now:

LookupDAO dao = (LookupDAO) DAOFactory.getInstance(conn, LookupDAO.class);

...where conn is a connection object retrieved from ServiceLocator or ActionFilter. When you add new POJOs, you still have to add them to ServiceLocator (for JUnit tests) and hibernate.cfg.xml, which is kindof a pain. I'd like to figure out a way to tell Hibernate to just look in appfuse-ejb.jar.

<tangent>
I still don't have a Factory for Managers, and I don't know that there's a need for one, but it's something I might add in the future. Managers are still creating using: LookupManager mgr = new LookupManagerImpl(ActionFilter.getConnection());. One thing I've been thinking about is the ability to switch webapp frameworks - kindof like you can do with Persistence Frameworks and the DAO Pattern. It'd be cool to add a way to switch (at build time) to use WebWork or Tapestry. Maybe by replacing values for the controller in web.xml. It'd probably be a pain since I'd probably have to create new JSPs for the new frameworks - but it would probably be a great learning experience.
</tangent>

The Remember Me feature has been refactored so the username and password cookies are only available under the /appfuse/security url-pattern. I also changed the posting to "j_security_check" in LoginServlet from response.sendRedirect to an HTTP POST, using Jakarta Common's HttpClient. The reason I have a LoginServlet vs. just using action="j_security_check" in my <form> is to encrypt passwords.

I've developed 3 different applications using AppFuse (struts-resume is one of them), and I have found that it's a pain to upgrade to new versions of AppFuse. Because of this, I don't recommend upgrading unless you really need to. I will be upgrading struts-resume to AppFuse 1.0, but I doubt I'll upgrade it to any future AppFuse releases - it's just too much work for not much reward.

Posted in Java at Nov 30 2003, 06:35:24 PM MST Add a Comment

JSTL Tips o' the Day Here's a couple of tips to help you in your JSP development with JSTL:

  • The <c:out> tag has a default attribute you can use to provide a default value when the value in your the variable you're trying to write is null. This is much easier than using if statements. Example: <c:out value="${user.firstName}" default="None Given" />.
  • You can populate dynamic values in a key from your ResourceBundle using the <fmt:param> tag. For instance, if you have a message with a link in ApplicationResources.properties - and you want to populate it with a struts-forward, it's easy with JSTL:

    ApplicationResources.properties:

    mainMenu.link=Click <a href="{0}">here</a> to return to the Main Menu.
    
    In your JSP:

    <fmt:message key="mainMenu.link">
      <fmt:param><html:rewrite forward="mainMenu"/></fmt:param>
    </fmt:message>
    

Usually I try not to put any HTML in ApplicationResources.properties, but I don't think a minimal amount hurts anything. Of course, you could put all the HTML in your JSP, so mainMenu.link changes to "Click {0} to return to the Main Menu." and your JSP changes to:

<fmt:message key="mainMenu.link">
  <fmt:param>
      <html:link forward="mainMenu">here</html:link>
  </fmt:param>
</fmt:message>

Enjoy! Posted in Java at Nov 30 2003, 06:14:20 PM MST 1 Comment

20031129 Saturday November 29, 2003

Archives now available I finally got enough motivation to spend 5 minutes and make my archive page presentable. Enjoy! View source for the CSS. Most of the work on this page is accomplished with a macro in Roller: #showBigWeblogCalendar(). Posted in Roller at Nov 29 2003, 08:10:47 PM MST 3 Comments

Memory and Disk Space is Cheap Memory and Disk Space sure is cheap these days. I got 1 GB of RAM for $150 last week, and I bought a 160 GB Hard Drive today for $80. Gotta love that! Posted in General at Nov 29 2003, 11:38:43 AM MST Add a Comment

20031127 Thursday November 27, 2003

Happy Thanksgiving Y'all

Happy Thankgiving!

Happy Thanksgiving to everyone! This year I'm thankful for continued employment, a thriving Java community and an awesome family. Abbie and Julie are the most incredible women I've ever met. My parents, sister, and in-laws deserve a "Thank You" as well - you all rock. Here's a smile from Abbie to brighten your Turkey Day. Happy Turkey Day!

Abbie on a bench

Posted in General at Nov 27 2003, 05:10:38 AM MST

20031126 Wednesday November 26, 2003

AppFuse won't work with J2EE 1.4 Final I don't know why, but AppFuse's MailUtilTest won't run with J2EE 1.4 Final. It works fine with 1.4 Beta 2. Posted in Java at Nov 26 2003, 10:09:12 PM MST Add a Comment

Upgraded to Roller 0.9.9 I upgraded this site to Roller 0.9.9-dev about an hour ago. Seems to be humming along quite nicely - and the GZip Filter is back in action (wasn't working before I upgraded). There looks to be a few issues to iron out still, but since I was able to figure them all out - I'm pretty darn happy with this release.

  • oscache.properties is missing from CVS
  • a bunch of the editors had leftover (?) taglib declarations - I replaced them with an include to /theme/taglibs.jsp
  • the value in Website > Config > Site Name shows up where "Home" used to - I had to rename my site to "Home" to maintain my same menu selections
  • there's a lot of SQL (or HQL) logging going on that I can't turn off
  • bookmark display macros are broken - you'll need to change the name of your bookmark names (in the macros) to have a /root/ prefix. For example, #showBookmarks("Articles" true true) -> #showBookmarks("/root/Articles" true true)

Hope this helps any early adopters... Posted in Roller at Nov 26 2003, 10:06:00 PM MST 6 Comments

My Favorite Eclipse Plugins (Download v1.0) When I go to new clients, I either have to install Eclipse, or help others configure Eclipse with cool plugins. So I made my own download of my favorite Eclipse plugins. If you want it, download version 1.0 from SourceForge. It includes the following:

Installation: Unzip to where ever you have Eclipse installed. I use c:\Tools\eclipse on Windows.

I don't really use XMLBuddy because it doesn't allow spaces (only tabs), but I suppose it's better than nothing. The built-in Ant Editor has the same behavior (tabs only). I'd love to find a plugin that gives code-completion for XDoclet when typing JavaDocs, but I couldn't find one. Sure, there's JBoss-IDE (which is just a bunch of Eclipse plugins), but that only has jboss-specific tags - no @hibernate, no @struts.

NOTE: Many of these plugins didn't work on Eclipse 3.0 M5, so I reverted back to M4.

OS X Users: Jalopy and Colorer don't seem to work at all for me (M4). You'll need to change Easy Explorer from "explorer.exe {0}" to "open {0}" in Window > Preferences > Easy Explorer.

These are all the latest versions as of November 26, 2003.

Posted in Java at Nov 26 2003, 01:02:59 PM MST 13 Comments

Unix Utils for Windows If you develop on Windows, and you use Microsoft's "cmd" to run Ant or compile your classes - you really should install Cygwin - it's much easier and provides the same functionality as cmd. Even better, Dan sent me an e-mail (can't find it now) about UnxUtils - Native Win32 ports of some GNU Utilities. You can even download an executable to install it. I dig it - symlinks that actually work on Windows. Posted in General at Nov 26 2003, 07:02:20 AM MST 3 Comments

20031125 Tuesday November 25, 2003

Fedora like OS X? Is Fedora like OS X? It almost seems like it - everything "just works." Well, at least after my 2nd format-and-install it does. Last Wednesday, I tried to upgrade from Red Hat 9 to Fedora Core 1. It didn't go very smoothly and the upgrade wasn't possible (installer said not enough disk space - I know there's enough). I ended up doing a format and clean, and got most things working but my USB Printer. I spent hours trying to get the damn thing working on Friday night (until 3 a.m.). I spent more time compiling things and trying to get it to work on Saturday (insert picture of me banging my head against the wall). Finally, I gave up on Saturday night and reverted back to Red Hat 9 (it worked before). Formatted and installed. Then I spent all day Sunday trying to get DNS/DHCP and HPOJ (Printing) working. It worked before - what the hell?!

And then on Monday morning, I found the simple-ass solution that was staring me in the face the whole fucking time: Turn off the printer and turn it back on. I found it on a mailing list or something. So, since I knew the solution, and I still hadn't gotten DNS/DHCP/Samba working on RH 9, I decided to upgrade to Fedora (again) last night. Again, same error - on a new 30 GB hard drive - not enough space to upgrade. So I formatted and installed. Lo and behold, I power cycled the printer and everything worked! I installed Dynamic DNS (I did have to run rndc-confgen) and configured Samba to recognize my printer. Viola - in under 20 minutes after I installed Fedora - everything worked. I spent 15 hours trying to fix something that eventually took 1 hour to fix. While setting this stuff up, and everything "just working" - I thought "Fedora is just like OS X - everything just works." Now if I could only get a Ximian Desktop for Fedora.

Notes to self: You're a Linux rookie. Don't mess with the default config. Don't bang your head against the wall for more than an hour. Don't try to upgrade Red Hat 9 to Fedora. Posted in General at Nov 25 2003, 02:19:39 PM MST 2 Comments