Matt RaibleMatt Raible is a writer with a passion for software. 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.
You searched this site for "howto". 64 entries found.

You can also try this same search on Google.

Eclipse Plugins Updated for 3.0

I finally got around to updating my Eclipse Plugins package for Eclipse 3.0 → Download or read the Release Notes. Below is a list of plugins included in this download. I dropped Lomboz and JSEditor b/c they didn't work at all with 3.0 on Windows - which I expect is the largest user base. Additions include CSS Editor and Doclipse.

Colorer and Jalopy don't work on OS X, so I wouldn't even bother installing them. Colorer has issues on Linux too. For OS X, I'd recommend buying a subscription to My Eclipse. It's only $30 and if you can afford a Mac, what's another $30? ;-) For a source code formatter on OS X, I recommend buying IDEA - it's only $200 - same cost principle applies. I tend to use IDEA a lot more on the Mac simply b/c it's faster and you don't need to install all these plugins. However, I've been stuck a lot in Eclipse-land lately because of it's multiple-project-in-one-pane support - as well as it copies and pastes code nicely into Word.

In addition to these plugins, I recommend installing the Spring IDE Plugin if you're using Spring [HowTo] - and Spindle if you're using Tapestry. Hopefully, distributions like this will become unnecessary with the introduction of the Web Tools project.

Posted in Java at Jul 23 2004, 03:31:57 PM MDT 13 Comments

Importing OS X Address Book into GMail

One of the problems with using GMail over .Mac is that I don't have easy synchronization of my contacts from OS X's Address Book. However, there is an easy way to get your initial set of contacts imported. Google is your friend - "export contacts gmail mac" brings up this howto. Here's the condensed version:

Very nice - GMail definitely has one of the best web interfaces I've ever used. Who says JavaScript sucks? wink

Posted in Mac OS X at Jul 08 2004, 08:58:07 AM MDT 3 Comments

[DisplayTag] Changing a row's CSS class based on values in the row.

One request I've seen on the displaytag-user list a few times is the ability to change a <tr>'s CSS class based on a certain value. While the displaytag doesn't have this feature out-of-the-box, it is possible (and fairly easy) to do. All you need to do is sprinkle a little JavaScript into the mix. Basically, the displaytag will render a well-formed HTML table - like the following:

Username First Name Last Name
mraible Matt Raible
tomcat Tomcat User

By adding an "id" attribute to your table (i.e. id="user"), your table will get an "id" attribute and now you can easily access it via the DOM. The following JavaScript will grab the table and search the first column for a value of 'mraible' - and if found, it will change the row's background color to red.

<script type="text/javascript">
<!--
    var table = document.getElementById("user");    
    var tbody = table.getElementsByTagName("tbody")[0];
    var rows = tbody.getElementsByTagName("tr");
    // add event handlers so rows light up and are clickable
    for (i=0; i < rows.length; i++) {
        var value = rows[i].getElementsByTagName("td")[0].firstChild.nodeValue;
        if (value == 'mraible') {
            rows[i].style.backgroundColor = "red";
        }
    }
//-->
</script>

You could easily change rows[i].style... to rows[i].className = if you want to assign a new CSS class. Now let's see it in action (and see if your browser supports it). This has only been tested in Safari and Mozilla on OS X.

Username First Name Last Name
mraible Matt Raible
tomcat Tomcat User

Other displaytag tips: Static Headers HowTo and Highlight and allow clicking of rows. The 2nd tip (highlighting) is available in AppFuse, in the userList.jsp page.

BTW, I also added support for the DisplayTag to render the results from JSTL's SQL Tag. I haven't committed it yet - I'm still waiting for more feedback.

Posted in Java at Mar 08 2004, 01:22:34 PM MST 10 Comments

AppFuse 1.4 Released!

This release involves many changes: re-arranging packages/directories, Spring integration, Remember Me refactorings and I also added iBATIS as a persistence option. I also spent a lot of time going through the tutorials to make sure they are up to date. I've been using AppFuse 1.4 for a few weeks on my current project, and I really do like the way Spring makes it easy to configure Hibernate, Transactions and Interface->Implementation relationships. If you're interested in upgrading your AppFuse 1.x app to use Spring, you can checkout this howto.

I also made the leap and moved the AppFuse project from SourceForge to java.net. This is mainly so I have more control over mailing lists and adding other developers. As of today, CVS files in SourceForge and Java.net are the same - but I'll only be updating Java.net from here on out. I also have released files in both projects, but will only use java.net in the future.

I spent all weekend updating the tutorials and fixing release-related issues. Phew - I'm glad that's over. "So," you ask, "what's next?"

A week of vacation (my sister flies in tomorrow), followed by starting to write Spring Live and creating a Spring MVC option for AppFuse. Oh yeah, I'll also be at SD West in Santa Clara, CA - let me know if you plan on attending.

Posted in Java at Mar 01 2004, 12:35:54 AM MST 11 Comments

Generating indexed-property ready ActionForms with XDoclet

One of the issues with using XDoclet to generate your Struts ActionForms (from POJOs) is that out-of-the-box, your Forms will not support indexed properties. This means that if you have a List on an object (this list will likely contain other objects/forms), you have to extend the generated form to add the necessary setters for indexed properties. For example, if you have an addresses List on a PersonForm, you would need the following in order to edit those addresses in Struts.

    setAddresses(int index, Object address) {
        this.addresses.set(index, address);
    }

The worst part is that you need to populate the addresses list with a bunch of empty AddressForm objects before Struts' auto-population will succeed. If you were coding the PersonForm by hand, you could code a reset() method such as the following:

    public void reset(ActionMapping mapping, HttpServletRequest request) {
        this.addresses = ListUtils.lazyList(new ArrayList()new ObjectFactory());
    }

    /**
     <code>StringFactory</code>
     *
     @see org.apache.commons.ListUtils
     */
    class ObjectFactory implements Factory {

        /**
         * Create a new instance of the specified object
         */
        public Object create() {
            return new AddressForm();
        }
    }

Now for the best part - I figured out how to generate this code with XDoclet, so any lists on your Forms will be indexed-property ready. By using <nested:iterate> in your JSP, you can easily CRUD you indexed properties. Pretty slick IMHO. The template is a bit much to put on this site, and it's long lines won't fit in a <pre> - so you can temporarily view the template here. I'll add a link to it in AppFuse's CVS once it shows up there. One thing you'll notice in this template is a little Velocity-lovin':

<XDtVelocity:generator>
  #set( $method = $currentMethod.name)
  ## trim off the 'get'
  #set( $objectName = $method.substring(3, $method.lastIndexOf('s')))
</XDtVelocity:generator>

Thanks to Erik on Merrick's blog for the quick Velocity/XDoclet howto. It was especially helpful since the XDoclet site has no documentation on this feature.

For all you my framework is better junkies - a clear explanation of how your framework handles indexed properties would be appreciated.

Posted in Java at Feb 27 2004, 05:18:10 PM MST 2 Comments

How blogging has helped me this morning

My early-morning blog reading comes through once again. First off, Charles explains how I should implement Remember Me. If understand him correctly, I basically need to create a new table (i.e. user_cookie) that has two columns: username and cookie_id - where cookie_id is a random 128 bit number. The key to his strategy is replacing the number with a new one everytime the user logs in. Why didn't I think of that? Thanks Charles!

Secondly, this Tweaking MySQL Primer (via Erik) has some good tips on MySQL. I'd prefer a more generic "tweak your database" howto that covered many databases, but this will have to do for now. I'm going to try a little OPTIMIZE tablename on this site in a few - it's it's down all morning, now you know why...

Lastly, what the hell are Erik and Rick Ross cooking up?

I spent five hours on the phone with Rick Ross (of Javalobby) on Saturday afternoon. I think we effectively fixed everything that is wrong in the world. Stay tunned. ;-)

WTF? 5 hours on the phone? I don't think I've spent 5 hours on the phone with anyone in my entire life. It must be good - or they're not very good communicators... ;-)

Posted in Java at Jan 19 2004, 07:55:51 AM MST 2 Comments

HowTo: Get an input field's value with Canoo's WebTest

I should start this by saying that I love Canoo's WebTest. It allows you to test clicking through your webapp as if you're using a browser. You simply write your tests in an XML file (which is really an Ant build file), and then run it with Ant. Usually, in my webapps, I write simple tests for CRUD on entities - i.e. EditUser (tests pulling up the edit screen), SavePosition (edit and save, verifies next screen's title), SearchUsers (verifies list screen's title).

One of the issues I had this morning was testing a wizard with WebTest. This was because I didn't know how to get the id of the new record after it was added. Now I found a way. Let's say you have a Create a Job wizard. On the first screen, you enter the job, and on the second, you add the required skills, on the third, you view a summary. To get the new id of the job, you can use XPath to get the hidden field named "jobId" - to do with what you may (i.e. click on a link to the third screen). Here's how: {{{ }}} This is especially helpful because I tend to use a lot of onclick handler's (with location.href's) on buttons (so I don't have to submit to the same action). I also turn off JavaScript for my tests - by not including js.jar in WebTest's classpath. I can't say enough about this tool - the ability to test your app, with JavaScript turned off, and verify that everything works... that's just cool. Especially when you're a JavaScript junkie like me.

Posted in Java at Jan 06 2004, 05:25:15 PM MST 5 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

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

Setting up my Fedora box with Out-of-the-Box

Rather than spending hours trying to recover my Red Hat 9 disk, I built a new disk/box with Fedora. For all I know, the RH 9 one is still recoverable, but I'm an upgrade junkie so I couldn't help myself. Setting up DHCP with Dynamic DNS was a bit of a pain, even when I followed this howto. I believe I ended up re-installing bind and everything worked (this was a 2 a.m. last night, so my memory is a big foggy).

The only thing I haven't been able to get running (so far) is my USB Printer, details on hpoj mailing list. It was easy to setup my OfficeJet G85 on RH 9.

As for setting up my dev environment, it was a breeze using Out-of-the-Box. However, out of the box the installer didn't work. I had to install "gd-devel" (a dependency of viewcvs) and then everything installed just fine. Hat tip to Eric Weidner (of EJB Solutions) for the tip. I was able to select the applications I wanted and get all of the following installed and running: MySQL, PostgreSQL, Apache, Tomcat, mod_jk2 (to connect apache and tomcat), Roller, Scarab, CVS, Java, Ant and ViewCVS. I'm sure I installed more, but these are the mains ones I was looking for.

While the installer for OBox takes a while to run (on 1.5 GB RAM with 1.5 GHz = 30 minutes), the beauty of OBox is that it configures everything for you and starts all the services. The one thing that is disappointing (or maybe it's good) is that it didn't setup any environment variables - no $CATALINA_HOME, $ANT_HOME, etc. No biggie, I can set those up myself.

I might just have to burn a CD of OBox for future clients. It'd be nice to show up with my development environment on CD and ready to go. One bug I did find was that the mod_jk2 install configures mappings for all the struts example apps (which I didn't install).

Posted in Java at Nov 21 2003, 12:55:55 AM MST Add a Comment