Using NextGEN Gallery and Auto Thickbox

After many attempts, I finally have the NextGEN Gallery plugin working together with the Auto Thickbox plugin. I use NextGEN Gallery for the Photo Gallery pages on this site because I like the way it manages photo albums and galleries. However, I also like to include images in posts outside of NextGEN Gallery’s control. I wanted all of the clickable images on the site to be displayed using a Thickbox, e.g. the fancy popup frame that shows a larger image and the photo title. NextGEN Gallery can handle the images in its albums, but any images in regular posts would just display the raw image file, i.e. no Thickbox frame or site wrapper. When I added the Auto Thickbox plugin to the site, NextGEN Gallery and Auto Thickbox were in conflict since they were both attempting to add a Thickbox to the album images. To get both plugins to work together, I did the following:

The “nobox” option instructs NextGEN Gallery not to add the Thickbox code. This then allows Auto Thickbox to add Thickbox code for all clickable images (including images in NextGEN Gallery managed albums). No more conflict!

Round Double To Nearest Hundredth

Here are a few ways to round a double in Java to the nearest integer, tenths, hundredths, or thousandths decimal place.

UPDATE #1: A reader commented that the code was not working for tenths, hundredths, and thousandths. It has been corrected, as suggested, by adding a decimal point to the multipliers and divisors.

UPDATE #2: A reader commented that the code was only working for positive numbers. It has been corrected to handle both positive and negative numbers (and zero, too).

Such simple code, yet two errors were identified by readers. Shame on me for not fully testing the code before posting. Feel free to let me know if you find any other scenarios that don’t work as expected.