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 "css". 327 entries found.

You can also try this same search on Google.

Know of any good Calendar Tag Libraries?

Anyone know of a good Calendar Tag Library - that renders calendars like the ones you see on blogs? I found this one from Coldbeans, but it's $50 - whereas free is always better. We just need it to render a calendar on a page and gray out certain days (with CSS) to say that day is not available.

Posted in Java at Sep 24 2003, 04:24:31 PM MDT 5 Comments

Tiles Tips o' the Day

Here's a couple of things I learned today that might be useful to you Struts developers out there. When using Tiles, you'll normally import all the attributes into your baseLayout.jsp, and then your attributes are exposes as beans/scripting variables (you can actually grab them with JSTL tags). Rather than using:

<tiles:importAttribute/>

Use:

<tiles:importAttribute scope="request"/>

And then all your inserted pages can access these attributes. Pretty slick when you got a little JSTL love in the mix. The second tip is how to implement definition path switching. Let's look at the following baseLayout definition as an example:

  <definition name=".baseLayout" path="/layouts/baseLayout.jsp">
    <put name="titleKey"/>
    <put name="header" value="/common/header.jsp"/>
    <put name="sidebar" value=".sidebar"/>
    <put name="footer" value="/common/footer.jsp"/>
  </definition>

You currently cannot change the "path" attribute with a Controller, so you have to do it as the Tiles author recommends - by changing your path to refer to an action. So I changed the path on this particular definition to be:

<definition name=".baseLayout" path="/do/switchLayout">

Where my action-mapping is defined as follows:

 <action path="/switchLayout" 
   type="org.appfuse.webapp.action.SwitchLayoutAction">
   <forward name="printLayout" path="/layouts/printLayout.jsp" />
   <forward name="baseLayout" path="/layouts/baseLayout.jsp" />
 </action>

Then in SwitchLayoutAction.java, I have the following code:

boolean print =
    Boolean.valueOf(request.getParameter("print")).booleanValue();

// see if a print parameter is passed in the request
if (print) {
    log.debug("switching base layout to printing...");

    return mapping.findForward("printLayout");
} else {
    return mapping.findForward("baseLayout");
}

Pretty slick IMO! It's easy to make the printLayout.jsp only contain some simple wrapper stuff and only do <tile:insert attribute="content"/>. Of course, in this particular example, you could just use a print stylesheet (media="print"), but that doesn't work so well on 4.x browsers (man I hate those beotches).

Posted in Java at Sep 24 2003, 03:01:03 PM MDT 4 Comments

Good CSS Design at Lee Jeans

Russ reminds us why Web Standards are cool:

From Zeldman which I just recently added to my aggregator, I just saw this great awesome article on how the XHTML/CSS design was created for the new Lee Jeans - One True Fit website.

The overview is short and to the point and gives links to all the tricks used on the page to get the design desired. Adding ?style=false to any of the page's urls will show the non-css markup. The difference is astounding. I'm more and more amazed at the power of a good designer and CSS every day.

This article is very elegant in explaining how CSS and XHTML can simplify your life. I'm a huge fan of web standards and (luckily) have been able to convince most teams/clients to use them in the past couple of years. Just to remind you how easy it is to write XHTML, check out the New York Public Library's XHTML Guidelines.

On a related topic, I've had a few folks ask for my wiki's theme recently. So here it is. Enjoy!

Posted in The Web at Sep 04 2003, 08:24:08 AM MDT Add a Comment

PHP vs. Java - which is better?

I have a former client that has a customer. This customer asked them - "so when are you migrating from Java to PHP?" So evidently this person has the impression that the next wave of web applications will be written in PHP. My former client has asked me to provide an answer for their customer. If I translate it, I think they mean to ask "what is different between Java and PHP and why should we use Java over PHP." Here are my opinions - please add yours as you see fit. I must admit I don't know a whole lot about PHP, except that it's widely popular among the Linux/Apache/MySQL crowd and that it's similar to ASP in it's lack of a MVC architecture (yes, I know about the PHP MVC project).

  • I think Java is more of an industry standard, whereas PHP seems to be popular among hackers and hobbyists.
  • Java provides better separation of layers - key for testability. PHP has all the code embedded in the page, so you have to run it through a browser to test if database connections work (for instance).
  • Java is more scalable.
  • More folks know Java and it's easier to qualify someone's Java skills. How do you test someone knows PHP? Is there a certification?
  • More for-profit organizations use it.

If you're a Java or a PHP-lover, I'd love to hear your opionions (facts are always better). I'm going to point my client to this post, so keep it clean.

Posted in Java at Aug 22 2003, 03:52:33 PM MDT 98 Comments

Display Tag: Static Headers

One of the requests we get over on the display tag project is a way to have static headers. Basically, this means that a user could scroll down through all the records on a page and the header would stay in place. The next generation of the tag library has a <thead> and <tbody> that makes this fairly easy to do. For instance, just by adding style="height: 400px; overflow: auto" to the <tbody> tag - you get the desired effect. Cool stuff - only seems to work in Mozilla though. Any IE/CSS experts out there that can explain why it doesn't work in IE?

See Also: Display Tag: Static Headers - Revisited

Posted in Java at Aug 16 2003, 03:16:06 PM MDT 19 Comments

Cool RSS Readers for Windows

FR VS FD

I've recently come to accept the fact that I need an RSS Reader for Windows. I use NetNewsWire for the Mac and it's one of the best things since sliced bread. For Windows, I'm currently evaluating FeedReader and FeedDemon. FeedDemon is written by Nick Bradbury, the creator of TopStyle and HomeSite - my two favorite Windows apps. I tell you what - if Nick would create OS X versions of these TopStyle and HomeSite - I'd buy a G5 and get rid of Windows. I doubt that'll ever happen though. FeedReader is great with the tray icon and update notifications. FeedDemon has a "synchronize with OPML" that looks awesome, unfortunately, it doesn't work with my blogroll.

My favorite features of an RSS Reader? I've listed them below and if my readers support them. NNW = NetNewsWire, FD = FeedDemon, FR = FeedReader.

  • Drag-n-drop URLs from a browser window to the reader (NNW)
  • Ability to import my Blogroll from Blogroll.com (none)
  • Weblog posting/editing (NNW)
  • Retrieval of full post rather than description (NNW, FD)

If you can think of more cool reader features - let me know! There might be some I don't even know about.

Posted in Roller at Aug 16 2003, 11:57:24 AM MDT 4 Comments

Roller Searching - Powered by Lucene

Lucene Logo

Thanks to Min, we now have searching in Roller. He wrote a wicked-ass Lucene implementation using the util.concurrent package from Doug Lea. Here's how it works:

  • When Roller starts, it checks to see if the index is OK, and if not, rebuilds it. The index then goes into RAM and stays there until you destroy the servlet context - then it's written to disk. The location is configurable, but defaults to $(user.home} + File.separator + "roller-index".
  • A user's index is updated when they add/delete weblog entries.
  • A user can rebuild their own index via a button on the Website Settings page.
  • An Admin can rebuild a user's index from the "Admin" page and rebuild all users' indexes from the Config page.
  • The IndexManager is the central entry point, and it lives in RollerContext.getIndexManager(). For indexing, searching, etc. you use one of the following operations:

    - AddWeblogOperation
    - RebuildUserIndexOperation
    - RemoveWeblogOperation
    - SearchOperation

    After creating these ops, set any op-specific configuration options and then pass it to the IndexManager.executeIndexOperation() method.
  • Behind the scenes, there is an background thread running. This thread only performs one operation at a time. If an op is added when the thread it busy, the op will be queued. The way Lucene works is that most operations can be threaded. Lucene supports the concept of add, delete, read, query, and optimize. The only methods that cannot be active at the same time are IndexReader::delete() and IndexWriter::add(). Therefore, the operations that perform these operations are put into the background thread queue that garantees that these ops wont be performed at the same time. Searching doesn't interfere with these ops, so it can be run in any thread.

I created a #showSearchForm macro that renders a <form> with a textbox (size=20) and a "Search" submit button. I also added this to all the current themes - so if you developed a theme for Roller - you might want to check it out (username: test, passwd: roller). You can edit it right on the site if you want, then copy/send me the adjusted files. CSS seems to need the most tweaking for these to look right.

Please enter any bugs/enhancements in Roller's JIRA instance. The only one I've seen so far is that a user has to build their index manually before they get any search results. I don't know that this is a bug, just wanted to mention it. Doesn't get comments yet either - a NPE from weblogMgr.getComments() (when adding a new post) kept me banging my head against the wall for an hour - so I commented it out.

Try it, you might like it. ;-)

2 minutes later: Here's a bug - if you update an entry numerous times, it will get presented as numerous times (should be deleted and re-indexed).

Posted in Java at Jul 22 2003, 11:41:59 PM MDT 2 Comments

Prevent Caching of JavaScript and CSS files

We've been having an issue at work for awhile now where our .css and .js files are cached by a proxy server. When we update the app, we get a few users (behind the proxy server) that get served up an old style/script file, and the app looks like it's broken. So I added a super-simple cache-killer to our .js and .css files today. In my taglibs.jsp (included in every JSP), I added:

<%-- Create a variable that is the current time (in milliseconds) to kill
     caching on the proxy server --%>
<jsp:useBean id="now" class="java.util.Date" />
<c:set var="cacheKiller">
    <fmt:formatDate value="${now}" pattern="yyyyMMdd"/>
</c:set>

My date pattern only goes to the day because we don't update the site more than once in the same day. This way, the users will still get the stylesheet/script caching benefit of the browser, but now we control when the file is reloaded, rather than the proxy server. To make sure these files are re-fetched every request, you could use pattern="yyyyMMddHHmmssS" to get all the way down to the millisecond. After adding this, I adjusted my baseLayout.jsp (Tiles template) to add my cacheKiller as a parameter to the src attributes of scripts and stylesheets.

<%-- Get Javascript List --%>
<tiles:useAttribute name="scripts" ignore="true"/>

<c:forEach var="js" items="${scripts}">
    <script type="text/javascript"
        src="<html-el:rewrite page="${js}"/>?<c:out
             value="${cacheKiller}"/>"></script>
</c:forEach>

Works like a charm!

Posted in Java at Jul 14 2003, 10:16:48 AM MDT 6 Comments

Wicked DHTML Roller themes spotted in the wild

I spotted some cool DHTML-enhanced themes on FreeRoller today: My own confusion and A Corporate Eejit. Nice work gents - maybe we should add these suckers to the stock list of themes. These themes are a great example of how customizable Roller is and how it's just HTML, so pretty much anything is possible (that is possible on a web page). I'd be willing to bet you could even use Flash and use the RSS Feed for your XML input.

I'm thinking about adding a small DHTML enhancement to Roller. Basically, I'd like to show users a small picture of the theme (using these pictures) when signing up. Let me know if you think this is worth the effort and if so, I'll create a JIRA issue (uh oh, looks like we lost our bug database!).

Posted in Roller at Jun 25 2003, 10:58:02 AM MDT 7 Comments

Roller and GZIP Compression

Roller has a couple of gzip compression filters built into its codebase thanks to Lance. I haven't been using them because, according to Dave, they didn't work on Tomcat. I'm not one to doubt Dave, so I'm guessing he was running on an old version of Tomcat when this happened - because I was able to get them running lickedly split today! All I had to do was uncomment the filter mappings for the PageGzipFilter and the RssGzipFilter and voila - you're getting gzipped content (if your browser supports it). I've verified it's working using Firebird's Live HTTP Headers extension (thanks for the tip Lance). Cool beans - now help me name this new theme before I commit it. Here's some ideas I've come up with:

  • Minimal
  • Sunsets
  • LowB (for Low Bandwidth)
  • Simplicity

All suggestions are welcome.

Posted in Roller at Jun 23 2003, 09:10:27 PM MDT 9 Comments