Monthly Archives: August 2012

Steve Yegge blog posts

I’ve recently been browsing some of Steve Yegge’s (lengthy) blog posts, something I’ve been meaning to do since I found out about him after his platforms rant. Here are a few that I found interesting.

Singleton Considered Stupid – when you use singletons, what you’re often actually doing is forgetting all about OO programming, and simply use classes as namespaces.

Google’s Secret Weapon – how Google was winning the smart people recruiting game back in 2004 (and probably still is).

Being the Averageist – why programmers don’t know how competent they are (we can’t measure it), why most don’t bother trying to improve (lack of incentive, or a company culture), and many other things.

Practicing Programming – how your day job isn’t real practice that’ll improve your skills, why you need to learn/practice, and what sort of practice you should do.

jps and other lesser known tools from the Java JDK bin

I recently needed to programmatically find out which java.exe was running which application. Simple on Linux using the output of the ps command, simple on Windows 7 with the tasklist command. But not so on Windows XP, where tasklist doesn’t provide the invoking command line string for each process. I could have used the WMIC tool, but I didn’t have this available.

So after a bit of Googling I came across the JVM Process Status Tool (jps) tool, which has just the output I need.

This led me to wonder what the other tools in the bin folder that I don’t use are, turns out they’re documented on this page – JDK Tools and Utilities. Quite a few of them are experimental, here are a few ones of general interest:

  • jdb – command line debugger
  • javap – class file disassembler
  • native2ascii – convert text to Unicode Latin-1 (useful for Resource Bundles in particular)
  • serialver – returns serialVersionUID of a class
  • keytool – key and certificate management
  • jstat – statistics monitoring for a JVM
  • jconsole – JMX compliant graphical monitoring tool
  • jvisualvm – JVM monitoring tool
  • jinfo – configuration info for a process/core file
  • jhat – heap dump browser (launches a web server so you can view it in your browser)
  • jmap – memory map for a process/core file
  • jsadebugd – “attaches to a Java process or core file and acts as a debug server”, seems would be useful if you needed to debug an application that wasn’t started in debug mode
  • jrunscript – command line script shell, using JavaScript by default (turns out this is Mozilla Rhino)

IE10 will drop support for conditional comments

IE10 will be dropping support for conditional comments. As stated in the post, feature and behaviour detection is preferable to browser detection – but with so many quirks in previous versions of IE, those aren’t often enough. So conditional comments to add classes to the html element for IE<10 will stay around for quite a while longer.

Useful Eclipse plugins

Following on from my note on FileSync, I thought I’d gather a list of useful plugins I use and have a look around for any new ones that are useful.

First, my usual ones:

  • Subclipse
  • eclipse-cs (Checkstyle)
  • PMD
  • FindBugs
  • Maven Integration for Eclipse WTP
  • Apache IvyDE

And ones I’ve recently tried out and found useful:

  • LogViewer – allows tailing of multiple log files, with coloured highlighting based on configured words and regular expressions
  • MoreUnit – allows quick creation of test classes, quick switching between a class and its test, amongst many other things
  • EclEmma – highlights code coverage of unit tests directly in the editor when you run the tests
  • Mousefeed – aids learning of keyboard shortcuts by displaying the corresponding shortcut when you perform an action using a mouse click

Mercurial

Subversion has been the version control system used on all projects I’ve worked on so far apart from one, which used Git. So when I wanted a VCS for a small personal project, I was keen to try Mercurial. Although I realise that with only me working on it, I won’t get the full experience of using Mercurial.

First good thing for my use case is that it doesn’t require me to set up a local server – good.

I can recommend the Hg Init tutorial by Joel Spolsky, which includes a section on “Subversion re-education”. The key things I’ve picked up are:

  • “Mercurial separates the act of committing new code from the act of inflicting it on everybody else”
  • “because Mercurial thinks in terms of “changesets” instead of “revisions” it can merge code much better than Subversion”
    • “that means that you can feel free to branch because the merge isn’t going to be a nightmare”
  • unlike in SVN, all commands apply to the entire tree (rather than just the directory in which you invoke the command)
    • in a company, you’d therefore want many smaller repositories for each project rather than one big one
  • “pulls” pulls the latest changes to a local repository, doesn’t switch our working copy to actually use them

This Stack Exchange Programmers question is also worth a read, as well as Martin Fowler’s article on Version Control Tools. The latter has an interesting idea at the end which is to use multiple VCSs to get around issues caused by corporate standards demanding the use of a “deficient” VCS such as Visual SourceSafe.

Falsehoods about names and times

Interesting articles:

Although I don’t quite get why all of them are false, for example from the last one:

  • 8. The day of the month always advances contiguously from N to either N+1 or 1, with no discontinuities.
  • 16. The day before Saturday is always Friday.