Books & Tools Techniques

Comprehensive coverage of Ruby 1.8 and 1.9

"The New Most Important Ruby Book"
Peter Cooper,
rubyinside.com

Completely updated for Ajax and Web 2.0

"A must-have reference"
Brendan Eich,
creator of JavaScript

Jude

Jude is my Java documentation browser. It combines Sun's definitive javadocs with the easy-to-use format of Java in a Nutshell, and tops it off with easy keyboard-based navigation and full-text searching.

Jude is available for free evaluation.

See the user's guide for more info

Java in a Nutshell

The 5th edition is now out, with complete coverage of Java 5.0!

It includes a fast-paced tutorial on the language, and a compact quick-reference for the core Java API.

Java Examples in a Nutshell

The 3rd edition, updated for Java 1.4

This edition has all-new coverage of the NIO and JavaSound APIs, completely rewritten Servlets and XML chapters, and coverage of new Java 1.4 features (assertions, logging, preferences, SSL, etc.) added througout. A great book for those who like to learn by example. 193 working examples: 21,900 lines of carefully commented code to learn from.

Java 1.5 Tiger: A Developer's Notebook

Amazon incorrectly credits me as the main author on this book. I'm actually the second author: really more of a consultant. This is a good book about all the language changes in the latest version of Java.

Effective Java

I didn't write this excellent book, but I wish I had.

Author Josh Bloch is probably best known for the collections classes in the java.util package. His experience and wisdom are apparent in this book. I learned from it and recommend it highly.

September 30, 2004

Java 5.0 FCS is out

Download here

September 23, 2004

New regular expression feature of Java 5.0

The java.util.regex package has been enhanced in Java 5.0. One nice new feature is the ability to save the results of a find() operation into a MatchResult object. Prior to Java 5.0, you could query a Matcher for the results of the most recent find() , but the results would be overwritten by the next find().

The new MatchResult interface lends itself to code like the following:

import java.util.regex.*;
import java.util.*;

public class FindAll {
    public static void main(String[] args) {
	Pattern pattern = Pattern.compile(args[0]);
	String text = args[1];

	List<MatchResult> results = findAll(pattern, text);
	for(MatchResult r : results) {
	    System.out.printf("Found '%s' at (%d,%d)%n",
			      r.group(), r.start(), r.end());
	}
    }

    public static List<MatchResult> findAll(Pattern pattern, CharSequence text)
    {
	List<MatchResult> results = new ArrayList<MatchResult>();
	Matcher m = pattern.matcher(text);
	while(m.find()) results.add(m.toMatchResult());
	return results;
    }
}

This code also demonstrates generics, the for/in loop, and the printf() method, all of which are also new in Java 5.0

September 15, 2004

Hex Floating Point: 0Xf.aP1 == 31.25

Ugh! I've been following the new language features of Java 5.0 very, very closely, but this ugly one slipped right by me.

We can now write floating point literals using hexadecimal notation. This allows literals to map directly to the bits of a float or a double, I guess.

Here are the unpleasant details: A floating-point literal in hexadecimal notation begins with "0X" or "0x". This is followed by the hexadecimal significand. The catch is that this significand may include a decimal point (a hexadecimal point?). After the significand comes the exponent, which is required. Instead of using e or E to introduce the exponent, hexadecimal floating-point literals use p or P. (Think "power" as a mnemonic). The p or P is followed by the exponent, which must be a decimal number, not a hexadecimal number. And this is a binary exponent, not a decimal exponent. That is, is represents the power of two to which the significand should be raised. Finally, the whole thing can be followed by an f or F to indicate a float literal or a d or D to indicate a double literal, just as a decimal floating-point literal can.

Here are some examples:

public class Hex {
    public static void main(String[] args) {
	double x = 0XaP0;    // 10 * 2^0 = 10
	double y = 0XfP2D;   // 15 * 2^2 = 60
	float z  = 0Xf.aP1F; // (15 + 10/16ths) * 2^1 = 31.25
	System.out.printf("%f %f %f%n", x, y, z);
    }
}

This change is a Sun-internal one, and was not the result of any JSR through the Java Community Process.

September 08, 2004

1000 US Soldiers Dead in Iraq

This is a sad milestone.

Data from icasualties.org

To display this list on your own website, grab these two files:

This works best in Mozilla. If you know how to get the fading code to work in IE, let me know and I'll fix it.

Update: I've written JavaScript code to display a histogram of the ages of the dead:

September 01, 2004

Java 5.0 RC is out

The Java 5 Release Candidate is now available.

Advertising
About
Store
Search
Google
Web this site
Archives
Syndicate

Powered by
Movable Type