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.

Approved for Google Ads

After seeing that Tim Bray is making $500/month of Google Ads, I decided it was high time I try to get this site approved again. Low and behold it worked! So they've approved me, but I only want to show them when folks come from Google. As in, when the referer (yeah, I know that's spelled wrong, but it is in Java and JavaScript too) contains "google" - show the ads. Anyone know how to do this cleanly in Roller/Velocity? Or JavaScript? I tried the following, but it doesn't work:

if (document.referer != null 
    && document.referer.toString().indexOf("google") != -1) {
    // define variables
    document.write("<scr" + "ipt type='text/javascript' src='ads.js'><\/scr" + "ipt>");
}

Since Google is my top referrer - I think I'll get a fair amount of users seeing the ads, and it won't disturb the folks who come here just to read my ramblings.

Posted in Roller at Feb 03 2004, 08:10:33 PM MST 10 Comments
Comments:

Matt, this site was better before you sold out ;-)

Posted by Keith Sader on February 04, 2004 at 07:36 AM MST #

I appreciate everything that you contribute to the J2EE community. No one can question the level of your dedication, as it is very strong. Being your site, I don't think that any visitor can criticize you for doing whatever you need to do so that you can continue such contributions and keep the site running. I encourage you to stand by whatever decision you feel is best for you. If anyone doubts your motives, they are fools.

Posted by Daniel Allen on February 04, 2004 at 09:09 AM MST #

To answer your question, believe it or not, in javascript "referrer" is spelled correctly, differing from the HTTP standard and Java. I find this to be an extremely amusing inconsistency in that it actually made its way into the dictionary. So you will want: if (document.referrer != null && ...

Posted by Daniel Allen on February 04, 2004 at 09:16 AM MST #

Thanks Daniel - that worked! Now I just have to figure out how center that sucker and make the links show up (I e-mailed Google, we'll see what they say). To see the ads, click on this link, and then click on one of the results. I only added it to the main pages of this site, so if it doesn't show up, try another link. I wouldn't click on the ads though - I think that's against the agreement - to run up the numbers.

Posted by Matt Raible on February 04, 2004 at 12:14 PM MST #

I centered the ads by putting the adsense code into <div id="adsense"> with the alignment set to center. Have a look and take the stylesheet if you want.

Posted by Koz on February 04, 2004 at 02:49 PM MST #

! Right, Don't know what happened there. I previewed the comment and it had escaped the <div>. so to recap: To get adsense centered on my site I've wrapped all the javascript into <div style=&quot;text-align: center; margin: 10px&quot;></div>

Posted by Koz on February 04, 2004 at 02:51 PM MST #

Heh, and I fixed it. Oh well, I need to set the time right so it shows up in the proper order. Thanks for the tip, I'll try that - although I think I already did.

Posted by Matt Raible on February 04, 2004 at 02:52 PM MST #

The "centering not working" problem was because I was writing my <div>'s using document.write's around the document.write to include the ads.js.

Koz - thanks for the assurance that it was possible. You got me thinking and by moving the <div>'s before/after the <script> tag - it solved the problem.

Posted by Matt Raible on February 04, 2004 at 09:33 PM MST #

Good luck with adsense. I've just started with them too. I like your idea of just showing the ads to folks who come from google. I wanted to add a CSS-based "hide ads" link to my page. But I think it violates Google's terms and conditions...

My gripe right now is that half the ads showing up at my site are for blogging software, rather than Java-related things.

Posted by David Flanagan on February 05, 2004 at 11:45 PM MST #

&nbsp;•&nbsp;Fun and Humor &nbsp;•&nbsp;Directory of Information &nbsp;•&nbsp;Hot Posters &nbsp;•&nbsp;Fun and Humor Links &nbsp;•&nbsp;The Best search of the Web &nbsp;•&nbsp;Free Forex Guide &nbsp;•&nbsp;Fun, Humor and Jokes : kkcindia.com &nbsp;•&nbsp;I Love my India &nbsp;•&nbsp;Information Free for All &nbsp;•&nbsp;Cheap Posters &nbsp;•&nbsp;UP Suda &nbsp;•&nbsp;Best PosterShop &nbsp;•&nbsp;Free Webhosting Guide &nbsp;•&nbsp;kkc.freehomepage.com &nbsp;•&nbsp;ASP.Net Question Bank &nbsp;•&nbsp;Law Guide &nbsp;•&nbsp;Finance Guide USA

Posted by Fun and Humor and Jokes on August 24, 2005 at 02:02 AM MDT #

Post a Comment:
  • HTML Syntax: Allowed