MongoDB: How to lower case all items of an array

Collection name: movie. Field name: actors
function(e) {
for(var i = 0; i < e.actors.length; i++) {
e.actors[i] = e.actors[i].toLowerCase();

Linux Tip: Delete files older than X days

The following command will delete all files from the current folder that are more than 30 days old

find . -type f -mtime +30 -delete

The following command will delete all files from the folder /backups/ with extension .gz that are more than 5 days old

find /backups/ -type f -name *.gz -mtime +5 -delete

Collections.sublist() not serializable

Ran into a strange serialization issue when trying to add a Java class to memcached…

Caused by: java.util.RandomAccessSubList

The problem was with a class member that was initialized with Collections.sublist() method. This method returns an instance of java.util.RandomAccessSubList which is not serializable.

The solution was to wrap initialize the list as an ArrayList.

new ArrayList<String>(biglist.subList(2, 4))