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.

Added Google search to this theme

The idea hit me like a cold beer pouring down my throat on a hot summer day. Crisp, clean and exciting. I've been wanting to add a search form to this theme, but I didn't want to add another tab, and putting it anywhere in the header would conflict with the background image. And then I spotted the perfect spot. Right under the categories, in the banner of the first entry on this page. With a little love from the DOM, you can now search this site using this theme and Google. Here's the relevant code that I added to the bottom of this theme.

<div id="search" style="display:none; margin-top: -17px; text-align: right">
    <form id="searchForm" method="get" action="http://www.google.com/search"
        onsubmit="return search()" style="margin: 0; padding: 0">  
        <input type="text" id="q" name="q" size="20" maxlength="255"
            value="search this site" onclick="this.value=''" /> 
</div>
<script type="text/javascript">
    // get the first entry shown in the page and append the
    // hidden 'search' div from above
    document.getElementById("entries")
            .getElementsByTagName("div")[0]
            .appendChild(document.getElementById("search"));
    toggle("search");
    function search() {
        form = document.getElementById("searchForm");
        if (form.q.value == "search this site" || form.q.value == "") {
            alert("Please enter a search term to continue.");
            form.q.focus();
            return false;
        } else {
            form.q.value = form.q.value + " site:www.raibledesigns.com";
            form.submit();
        }
    }
</script>

Boy oh boy does the DOM make it easy to do web sites! Seems to work in all the browsers I use regularly (IE/Moz on Win, Camino/Safari on Mac). It doesn't work in Opera 6, but does in Opera 7. Now back to that cold beer - I'm gettin' thirsty...

Posted in Roller at Jun 27 2003, 04:57:58 PM MDT 8 Comments
Comments:

Love it! Matt, you are doing a sweet job with this theme. It might be too nice for me to even want to modify on my site, but I am sure I will tinker.

Posted by Dan Allen on June 27, 2003 at 08:25 PM MDT #

Have you guys thought of sliding Lucene in to Roller? By the way, I like the new theme. :-)

Posted by Simon Brown on June 28, 2003 at 08:24 AM MDT #

Definitely - and it's on my next round of improvements for Roller (if someone doesn't beat me to it). Here's the bug for it. I think it'll be fairly easy as there's good Lucene documentation out there. The only concern I have is invalid HTML in a user's entries and those might have to be fixed. We should be able to use our regular Velocity templates for rendering search results.

Posted by Matt Raible on June 28, 2003 at 09:12 AM MDT #

I just throw the body content of my blog entries and comments through Lucene and with the default analyzer and it works great because it treats them as flat text. I might get around to extending the analyzer to omit HTML tags or find another (HTML specific) analyzer one day but I'm in no rush. It just means that I can search for occurences of HTML tags. A very unuseful side-effect! ;-)

Posted by Simon Brown on June 28, 2003 at 09:19 AM MDT #

Darn it, there you go again. Posting something really useful (I had no idea you could use google to search your specific site without paying for it). How am I supposed to stop reading your blog and do something productive when you keep posting such great information? ;-)

Posted by Paul Rivers on June 28, 2003 at 11:16 PM MDT #

Just wanted to add my thanks to the list. Very useful! Keep the Roller tips/tricks coming! BTW, Abbie Loo is adorable. :) My wife is scheduled to be induced this Monday (June 30th - our first child)...wish me luck!

Posted by Daniel Potter on June 29, 2003 at 12:13 AM MDT #

Problem - in my browser (the latest version of IE) when the page loads, or gets refreshed, there's an extra purple bar cutting across the page right behing the cute picture of the baby. When I scroll down, then scroll back up again, its gone. It doesn't really hurt anything, it just looks weird.

Posted by PaulRivers on June 29, 2003 at 02:39 PM MDT #

Paul - I saw this at work on Friday right after I added it (IE 6 SP1, Win2K). I don't see it here at home though - same browser, WinXP. If I see it again, I'll try to fix it then - it's probably related to the search addition somehow.

Posted by Matt Raible on June 29, 2003 at 02:51 PM MDT #

Post a Comment:
  • HTML Syntax: Allowed