How it sucks I recently wrote some code to filter nodes from a DOM and had issues with NullPointerExceptions: NodeList nl = doc.getElementsByTagName(“mytag”); for(int i = 0, n = nl.getLength(); i < n; i++) { Element elt = (Element) nl.item(i); if(…) { elt.getParentNode().removeChild(elt); } } The problem was that NodeLists are live, and removing elements […]
Monthly Archives: December 2009
Kubuntu 9.10
Posted December 18, 2009 – 11:50 amI just upgraded to Kubuntu 9.10. The upgrade pretty much just worked (unlike my horrible experience with the last one which left my computer unusable). A few settings got lost such as the default font size. Nothing broke, though. A few annoyances did get fixed. Among them was the fact that in 9.04, Flash audio […]
“sudo nice” versus “nice sudo”
Posted December 15, 2009 – 12:15 pmWhile re-testing the script mentioned in my last post, I decided to play a little safer. I changed “sudo foo” to “nice sudo foo”. However, it turns out that on my machine (running Ubuntu 9.04), processes launched by sudo do not inherit niceness. From a web search, though, I gathered that they do on some […]
killall is your friend
Posted December 14, 2009 – 8:56 pmI created a backup script that needed to run as root. For convenience, I named the script backupWeb.sudo and created a script called backupWeb that would call backupWeb.sudo with sudo. Of course, I forgot the .sudo suffix, and the script launched itself recursively. The result was a less-lethal fork bomb. My computer was nearly unresponsive. […]