| Books & Tools | Techniques | |
|
Comprehensive coverage of Ruby 1.8 and 1.9
"The New Most Important Ruby Book" JudeJude 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 NutshellThe 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 NutshellThe 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 NotebookAmazon 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 JavaI 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, 2004September 23, 2004New regular expression feature of Java 5.0The 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, 2004Hex Floating Point: 0Xf.aP1 == 31.25Ugh! 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, 20041000 US Soldiers Dead in IraqThis 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
|
Advertising
About
Store
Search
Archives
April 2008
March 2008 February 2008 January 2008 November 2007 October 2007 September 2007 August 2007 July 2007 June 2007 May 2007 April 2007 March 2007 February 2007 January 2007 December 2006 November 2006 October 2006 September 2006 August 2006 July 2006 June 2006 May 2006 April 2006 March 2006 January 2006 December 2005 November 2005 October 2005 September 2005 August 2005 July 2005 June 2005 April 2005 March 2005 February 2005 December 2004 October 2004 September 2004 July 2004 June 2004 May 2004 April 2004 March 2004 February 2004 January 2004 Syndicate
|