2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2020

10/25/2006: Use CSS to Ensure Common Navigation HTML on Every Page

This tip was developed (or at least described by) Trenton Moss on the ITWALES.com site. I reproduce the essential elements of only one of the ten tips that he writes about. Please visit itwales.com to see all ten.

Add a class to each navigation item:

<ul> <li><a href="#" class="home">Home</a></li> <li><a href="#" class="about">About us</a></li> <li><a href="#" class="contact">Contact us</a></li> </ul>

Then insert an id into the <body> tag that indicates which are it represents. For example, When in ‘Home’ it should read <body id=”home”>. Now create a CSS rule:

#home .home, #about .about, #contact .contact { commands for highlighted navigation go here }

10/08/2006: Using Composite Object For Hash Key Better Than Concatenated String

Kirk Pepperdine has written a guest article for the Java Specialists’ newsletter about the DRY or Don’t Repeat Yourself principle.

While I agree with DRY, the important part of the article was his performance timing study. He compared using

personsByName.put(firstName + lastName, person);

versus

personsByName.put(new CompositeKey(firstName, lastName), person);

Cutting to the result of the test, the composite key cut the example’s execution by 66% and reduced memory consumption by about 65Mb. Visit the link above for more details or simply use Composite keys from now on!