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 "&amp". 294 entries found.

You can also try this same search on Google.

Wireless Printer Server - doesn't work

Washington Park, Denver I bought a Linksys Wireless-Ready USB Print Server last week. I have a Dell TrueMobile Wireless network setup that works fine with my PowerBook and my XP machine. However, I am unable to get the print server on the wireless network - it just won't show up, and the WI-FI light on the little bastard won't light up either. It works fine when I plugin an ethernet cable - but I want wireless damnit! I'm using a Dell TrueMobile NIC, but I think that should work since it works fine in my Dell with WinXP. Any ideas?

Posted in General at Jan 18 2003, 11:22:30 AM MST 1 Comment

Found: Hibernate based personal image server

I found the pixory personal image server on the hibernate-devel mailing list this morning. It looks like a regular web-based photo album, but seems to offer client side tools as well. You can checkout the screenshots if you want to get right to it.

Pixory is a personal image server based on Hibernate and HsqlDB.
-------------------------------
Pixory allows you to store your photos on your own pc but to access, compose into albums, and share them anywhere on the internet. It's your personal online photo sharing service, running on your computer using your broadband internet connection. Pixory is a client and a server, a lightweight web application for browsing photo collections on your hardrive; an album server to your friends and family or anyone on the internet. It simplifies accessing and organizing photo collections on your home network.

Today was a pretty awesome day in my development life. This morning started off great with the "remember me" feature, and I also implemented the Nested tag library from Struts. It was great - took me all of about 5 minutes to implement and get nested, indexed iterating of child objects in a form. I ended the day with disappointment as I tried to save this form. That's when I discovered that XDoclet wasn't generating getter/setters for my indexed getter/setters. I might actually have to put a form in my source tree to get this functionality. So far, all my ValidatorForms are still generated from POJOs, which Hibernate uses. Not all my POJOs are run though XDoclet -- some are generated using Hibernate's Reverse Engineering Tool. It actually seems to take less time to write the mapping file than to mark up the POJO with XDoclet tags. If you generate it with the RET, it's like taking candy from a baby.

Speaking of babies, I started to learn a new language tonight. I call it Abbie-blah - it consists of making grunts and groans and sticking your tongue out. I swear I had an intellectual conversation with Abbie - I had her smiling like you wouldn't believe. Fun times.

Posted in Java at Jan 14 2003, 09:40:12 PM MST 3 Comments

Simple Intentions turn into Remember Me Login

I woke up this morning, and had the simple intention of blogging about one of my favorite tools, The Color Schemer. If you're a wanna-be designer like me, it's awesome. It helps you match "like" colors and also allows you to select any color on your screen. It's one of my most invaluable web design tools. Putting a tip about this was my only hope at 4:30 when I sat down at this computer. Now it's 5:39.

Why am I still here? I got caught up in reading the Colorado Bloggers mailing list - which actually got some traffic yesterday. This is one of the first times I've received a message from the list. One of the members pointed me to a another Photo Album for the web. It's called Gallery and she has an example setup. Looks like it runs on PHP. Well that shouldn't have taken me an hour, right?

The activity that's filled my last hour has been wrestling with Erik Hatcher's request for "remember me" functionality in a J2EE app, using container-managed security. The good news is that I did get it working - here's how:

  1. First, I added a checkbox called "rememberMe" to my login.jsp. When the user clicks "submit", I do some JavaScript logic. This logic entails saving the username and password as cookies - but only if the rememberMe checkbox is checked. If rememberMe is checked, a cookie is set called "rememberMe" with a value of "true."
  2. Using Roller's BreadCrumbFiler (maps to /*), I added some logic to check for the existence of the "rememberMe" cookie, and if it exists, to route the user to "j_security_check?j_username="+usernameCookie+"&j_password="+passwordCookie.

This all worked fine and dandy right off the bat - took me about 10 minutes to implement. The problem was that a user couldn't "logout." So I've spent the last hour (now it's been an hour and 1/2) with my own ignorance trying to delete cookies (and doing null checks and such) so users could logout. And I just got it working - fricken sweet! What a way to start the day! The only problem I could see now is if a user tries a username/password and selects "remember me", but then closes their browser. The BreadCrumbFilter will keep trying to authenticate them - yep, I just verified that that's a problem. It's also a problem when they enter an invalid password and select rememberMe.

One way to solve this is to not set the "rememberMe" and "password" cookies until someone has successfully authenticated. Maybe I could use the breadcrumbs in the BreadCrumbFilter to check the last URL accessed, and if it's already j_security_check, don't do the routing. Anyway, here's the code that does the heavy lifting in BreadCrumbFilter:

Cookie rememberMe = RequestUtil.getCookie(request, "rememberMe");
// check to see if the user is logging out, if so, remove the
// rememberMe cookie and password Cookie
if (request.getRequestURL().indexOf("logout") != -1 && 
	(rememberMe != null)) {
    if (log.isDebugEnabled()) {
        log.debug("deleting rememberMe-related cookies");
    }

    response =
        RequestUtil.deleteCookie(response,
                                 RequestUtil.getCookie(request,
                                                       "rememberMe"));
    response =
        RequestUtil.deleteCookie(response,
                                 RequestUtil.getCookie(request,
                                                       "password"));
}

if (request.getRequestURL().indexOf("login") != -1) {
    // container is routing user to login page, check for remember me cookie
    Cookie username = RequestUtil.getCookie(request, "username");
    Cookie password = RequestUtil.getCookie(request, "password");

    if ((rememberMe != null) && (password != null)) {
        // authenticate user without displaying login page
        String route =
            "j_security_check?j_username=" +
            RequestUtils.encodeURL(username.getValue()) +
            "&j_password=" +
            RequestUtils.encodeURL(password.getValue());

        if (log.isDebugEnabled()) {
            log.debug("I remember you '" + username.getValue() +
                      "', authenticating...");
        }

        response.sendRedirect(response.encodeRedirectURL(route));

        return;
    }
}

I can post the code for RequestUtil if you need it. The class RequestUtils (for encoding URLs) is a Struts class.

Posted in Java at Jan 14 2003, 06:07:21 AM MST 4 Comments

ConvertUtils problem solved!

I got the solution to my ConvertUtils problem from the hibernate-devel mailing list. Thanks to Juozas Baliuka! Here's my new convert method:

public Object convert(Class type, Object value) {
    if (log.isDebugEnabled()) {
        log.debug("entering 'convert' method");
    }

    // for a null value, return null
    if (value == null) {
        return null;
    } else if (value.getClass().isAssignableFrom(type)) {
        return value;
    } else if (ArrayList.class.isAssignableFrom(type)
                   && (value instanceof Collection)) {
        return new ArrayList((Collection) value); // List, Set, Collection  -> ArrayList
    } else if (type.isAssignableFrom(Collection.class)
                   && (value instanceof Collection)) {
        try {
            //most of collections implement this constructor
            Constructor constructor =
                type.getConstructor(new Class[] { Collection.class });

            return constructor.newInstance(new Object[] { value });
        } catch (Exception e) {
            log.error(e);
        }
    }

    throw new ConversionException("Could not convert "
                                  + value.getClass().getName() + " to "
                                  + type.getName() + "!");
}

Posted in Java at Jan 13 2003, 09:15:09 AM MST Add a Comment

My First Attempt at ConvertUtils

My first attempt at using ConvertUtils is turning out to be a painful one - most likely due to my own ignorance. Let's see if you can help me out. I have a Hibernate Bag, which is really a java.util.List on my User object. When I run the User object through XDoclet, I create a UserForm (extends ValidatorForm). The form has an ArrayList on for any instances of List or Set on the object (set through a custom struts_form.xdt template). So I created a ListConverter to convert a List object to an ArrayList. Sounds pretty simple right?! Here's my ListConverter.java:

public class ListConverter implements Converter {
    //~ Instance fields ========================================================

    protected Log log = LogFactory.getLog(ListConverter.class);

    //~ Methods ================================================================

    /**
     * Convert a List to an ArrayList
     *
     * @param type the class type to output
     * @param value the object to convert
     */
    public Object convert(Class type, Object value) {
        if (log.isDebugEnabled()) {
            log.debug("entering 'convert' method");
        }

        // for a null value, return null
        if (value == null) {
            return null;
        } else if (value instanceof Set && (type == Set.class)) {
            return new ArrayList((Set) value);
        } else if (value instanceof List && (type == List.class)) {
            return new ArrayList((List) value);
        } else {
            throw new ConversionException("Could not convert " + value
                                          + " to ArrayList!");
        }
    }
}

When I run BeanUtils.copyProperties(userForm, user), I get:

Could not convert cirrus.hibernate.collections.Bag@e2892b to ArrayList!

On another class, where I am trying to convert a List of Longs, I get:

Could not convert [-1, 1, 30129] to ArrayList!

I'm registering my custom converter in a static block of my BaseManager class. My *Manager classes do all the conversions, so this seems logical:

static {
    ConvertUtils.register(new StringConverter(), String.class);
    ConvertUtils.register(new LongConverter(), Long.class);
    ConvertUtils.register(new ListConverter(), ArrayList.class);
	
    if (log.isDebugEnabled()) {
        log.debug("Converters registered...");
    }
}

Since I'm in a major time crunch, I'll try simply making my getter/setters on my UserForm to be List. I'd like to use ConvertUtils though, so hopefully someone has a solution.

This brings me to a RANT and I think it's my first official one. My last three projects have always started small, and the goal has always been a prototype of functionality. A prototype that turns into a production system. All fricken three of them. All were supposed to take about 3 months to develop initially. The last two projects took at least 6 months. This one has a one month deadline, but the scope is a lot smaller than the previous two. But still, it's always the same scenario - the clients want a prototype, but turn it into a production system. Since it's a prototype, I tend to write "workarounds" for design patterns (see above) that I can't figure out. Is this good? It probably doesn't hurt since no one will ever look at my code - right?! When's the last time you looked at a co-workers code? (The more == the better). And the truth is, as long as it works - it's probably good enough. However, I as a developer, get heartburn when I think about maintaining the system that I created under the impression that it was a prototype. Maybe one of these days I'll figure out all the best practices to creating a robust web application, and then I'll know everything - so I won't have to write workarounds for my lack of knowledge. If you see some pigs flying, you can think to yourself - "Wow, Raible must've figured it all out" ;-)

Posted in Java at Jan 11 2003, 04:04:43 PM MST 1 Comment

Links to this site and the information found

I saw Russ's "Links To Me" link on his site, and tried it for this site. There I found a great idea from Patrick Chanezon regarding WebTest:

...once you go declarative, you can begin to build tools to generate the declaration.

One could build a Mozilla XUL based tool that would generate this XML based on an interactive testing session in the browser.

Now THAT is a great idea! Any takers?

Posted in Java at Jan 11 2003, 07:48:45 AM MST Add a Comment

Adding color to VIM and Cygwin

These are notes-to-self more than anything, but maybe you can use them. You can add colorized text to Vim by adding the following to .vimrc in your $HOME directory:

" Switch syntax highlighting on, when the terminal has colors
" Also switch on highlighting the last used search pattern.
if &t_Co > 2 || has("gui_running")
  syntax on
  set hlsearch
endi

If you don't have this file, you can create it using :mkv. You can change your font-settings by editing them with Edit >> Select Font and then typing :set guifont, followed by :mkv!. I prefer Courier New, 9pt.

If you want colors for file listings (using ls) in Cygwin, add the following to your .bashrc file in your $HOME directory:

alias ls="ls -CF --color"

Posted in Java at Jan 05 2003, 03:12:08 PM MST 7 Comments

Middlegen now supports Hibernate

I saw this on the Middlegen mailing list this afternoon:

I have created a Hibernate plugin for Middlegen, modeled loosely upon the JDO plugin. Many features of Hibernate are not supported, but this at least generates classes with basic properties and associations (one-to-one, one-to-many, many-to-one, many-to-many). Composite keys are NOT supported, partly because they are not currently supported by the Hibernate XDoclet module.

As described by Max Anderson, here:

http://hibernate.bluemars.net/52.html#16

this approach is somewhat inconvenient and indirect from the point of view of the full Hibernate toolset. It would make much more sense from our point of view to generate a .hbm.xml mapping document with middlegen and then delegate to our CodeGenerator tool to generate the Java code. (CodeGenerator supports a larger subset of Hibernate functionality than XDoclet.) However this is not the kind of approach taken by middlegen elsewhere.

Anyway, this plugin is a good start and should already be useful for some people.

(The plugin was developed against the latest middlegen CVS and has NOT yet been rigorously tested.)

Gavin

What are you up to on the first day of this new year? I'm reading blogs and we just ordered a pizza. I hope to relax the rest of the day, maybe watch a movie, and order/post some pictures of Abbie.

Posted in Java at Jan 01 2003, 02:06:09 PM MST Add a Comment

CSS and border-collapse property

I can't seem to get the border-collapse property to work on my tables. Basically, I should be able to specify a border and border-collapse: collapse on a table and this border will be applied to all cells. But I can't get it to work - any ideas? Here's an example:

<table width="300" 
  style="border: 1px solid black; border-collapse: collapse">
  <tr>
    <th>&nbsp;</th>
  </tr>
  <tr> 
    <td>this cell should have a top border<td>
  </tr>
</table>

And here's that same table without the HTML escaped:

 
this cell should have a top border

Posted in The Web at Dec 29 2002, 06:58:14 AM MST 3 Comments

What Maven Does

I, like Charles, was unsure of what Maven did. James has made it clear and I have seen the light - I think. In my AppFuse project, I have a lib directory that contains all the various third-party jars I'm using in my build process. Among these are XDoclet, Struts, Cactus, JSTL, Hibernate, JUnitDoclet, etc. The problem is that this directory is ~16MB and if I add it to CVS, I've got a monster project. The zipped up version of AppFuse's source is 14MB! That's enough to scare off folks right there.

It sounds to me that Maven can help me out in 2 ways. It can be used to download and install these jars as part of the build process. Slick if it can! Can it get me nightly builds from CVS? The 2nd feature seems to be building a project website for me. That's cool and definitely better than my simple readme file. However, can I make my site look like this (my site) rather than this (Maven site)? The good news I see is that the generated website does use XHTML and a DOCENGINE:

<!DOCENGINE html PUBLIC "-//CollabNet//DTD XHTML 1.0 Transitional//EN"
    "http://www.collabnet.com/dtds/collabnet_transitional_10.dtd">

The bad news is that it's not a standard DOCENGINE and even after I override the doctype and charset, it still does not validate. Of coure, this may not be a big deal, but if this were to be more "standard" it would be easier to convince folks like me to jump on the bandwagon. If there's templates I can modify, show me, and I'll dig like a miner that's struck gold.

Posted in Java at Dec 13 2002, 12:25:05 AM MST 2 Comments