Archive for March 19th, 2007

Hiding sub categories in Wordpress - a quick hack

Here is a quick hack to hide sub categories in Wordpress. This has the added advantage that even though sub categories are not visible, they will still get crawled by search engines. For example, the categories you see on the right are only the root categories.

All you have to do is to add the following line to the Wordpress stylesheet.

.children { display: none; }

This works because the secondary level categories have “children” as the style class.

Quick Java Tips - List conversions

Here are some quick Java tips. This is based on my recent code reviews.

1. How to convert HashMap keys to an ArrayList?
new ArrayList(map.keySet());

2. How to convert an Array to an ArrayList?
new java.util.ArrayList(java.util.Arrays.asList(array));

3. How to create and initialize a List in one step?
java.util.List = java.util.Arrays.asList(new String[] {”1″, “2″});