Welcome to issue #3 of Allen Holub's Sporadic Newsletter. Subscribe at /newsletter. -- For Subscribers Only To access the subscribers-only part of the web site this month: URL: /subscribers User name: subscriber This month's password: xxxxx The password will change again with the next newsletter. (There's nothing new in there, yet---I'm still editing the Design-pattern reference.) -- Java Order of Precedence Chart and Class Diagrams I've posted a Java order-of-precedence chart (which is surprisingly hard to find) and also class diagrams for the Swing and Collection/Map hierarchies to the "Goodies" page of the web site. The links to all three are at . -- Java Programming Tip: Composing Email (and Browsing) from Java Last newsletter I asked if anyone knew an easy way to launch the default email client from within Java. An OS-specific answer is surprisingly easy, so I thought I'd share it. (Sometimes I think I'm the last person on earth to know this stuff.) Under Windows, cmd.exe understands URLs, and will launch either the browser or email client automatically. For example, The first command, below, launches Eudora (or whatever your client is) in new-message mode, and the second command launches Explorer, positioned at the required page: cmd /c start mailto:person@some-domain.com cmd /c start The second example works even if you leave off the protocol ("http://"). Compose mail from inside a java program with: String to = "person@abcdefg.com"; String subject = "This is the subject line"; subject.replaceAll( "\\s", "%20" ); Runtime.getRuntime().exec( "cmd.exe /c start mailto:" + to + "?subject=" + subject ); Note that the subject line has to be "URL Encoded." That's why I've replaced spaces with the string "%20". You can launch the default browser using the same technique: URL url = new URL(""); Runtime.getRuntime().exec( "cmd.exe /c start " + url.toExternalForm() ); You could, of course, just use a string rather than a URL in this example. This solution is Windows specific, of course. On the Mac, you can launch osascript to run an AppleScript program that looks something like: open location "mailto:" & default_address & "?subject=" & mail_subject (The subject line should be URL encoded.) In Unix, you could just launch "mail" (or Netscape Navigator with a mailto: URL on the command line). Thanks to Anatoly Pidruchny and Danny Rabbani for (independently) supplying the answer. -- The OO Workshop, A Reminder There are still openings in the public OO Workshop scheduled for the week of April 7-11 in Berkeley, CA. This workshop is the "lite" version of what you'd get if you hire me to mentor a project. It's the best way quickly come up to speed on the skills you need to produce high-quality object-oriented software. The Workshop combines a very intensive introduction to the OO process (RUP, XP, etc), notation (UML), and design patterns with a 3-or-more-day hands-on exercise where we take an idea from conception through to a workable design. The class size is kept deliberately small so that we can work in small groups with lots of interaction with myself. I'm really convinced that the OO-Design workshop is by far the most effective way to learn OO design. The practical experience that you get really makes the methodology sink in, and you'll come away from the workshop understanding enough to actually do OO design in the real world. You can also arrange for a Workshop to be given directly to your organization in house. This way the in-class exercise can be real work, solving a real problem that you're working on now. An in-house workshop also helps develop a design team as a team. Find more information on the workshop (or enroll) at . ------------------------------------ Until next time, Allen 2003/03/12
