Java

FacebookTwitter
http://docs.oracle.com/javase/1.4.2/docs/guide/lang/assert.html

Programming With Assertions - docs.oracle.com (HTTP)

An assertion is a statement in the Java TM programming language that enables you to test your assumptions about your program. For example, if you write a method that calculates the speed of a particle, you might assert that the calculated speed is less than the speed of light. Each assertion contains a boolean expression that you believe will be true when the assertion executes. If it is not true, the system will throw an error. By verifying that the boolean expression is indeed true, the assertion confirms your assumptions about the behavior of your program, increasing your confidence that the program is free of errors. Experience has shown that writing assertions while programming is one of the quickest and most effective ways to detect and correct bugs.

Java theory and practice: Dealing with InterruptedException - www.ibm.com (HTTP)

http://www.ibm.com/developerworks/java/library/j-jtp05236/index.html This story is probably familiar: You're writing a test program and you need to pause for some amount of time, so you call Thread.sleep() . But then the compiler or IDE balks that you haven't dealt with the checked InterruptedException . What is InterruptedException , and why do you have to deal with it? The most common response to InterruptedException is to swallow it -- catch it and do nothing (or perhaps log it, which isn't any better) -- as we'll see later in Listing 4 .
http://blog.igorminar.com/2007/03/how-java-application-can-discover-its.html Occasionally it is important for an application to know its PID, specially if this application cooperates with other non-java applications. Currently there is no direct support for retrieving an application's process id by using standard Java api (this might change in the future if RFEs like 4250622 , 4244896 or 4890847 are resolved). I found five ways how to get the PID from my Java code: Using the java management and monitoring API (java.lang.management): ManagementFactory.getRuntimeMXBean().getName(); returns something like: 28906@localhost where 28906 is the PID of JVM's process, which is in fact the PID of my app.

Igor Minar's Blog: How a Java Application Can Discover its Process ID (PID) - blog.igorminar.com (HTTP)

In an equaly distributed table, a single cell is an intersection of a single row and a single column. However, for design purposes, it is often convenient to use group table column headers (above a sequence of cells), and sometimes several vertical cells are containing the same data, so they can be merged into one single large cell. Word processing and spreadsheet software usually uses terms like “merged cells” for joined cells, and in HTML terminology, merged cells are often denoted by column-spanning and row-spanning. We will use HTML terminology here, since it is more precise and takes into account a difference betweek horizontal (column) and vertical (row) merging. Column spanning is a HTML cell property that defines how much “logical” columns a table cell contains. http://web.archive.org/web/20080726035429/http://www.swingwiki.org/howto:column_spanning

howto:column_spanning [SwingWiki]

Source Code Analysis Using Java 6 APIs

http://today.java.net/pub/a/today/2008/04/10/source-code-analysis-using-java-6-compiler-apis.html Have you ever thought of how tools like "http://checkstyle.sourceforge.net/">Checkstyle or "http://findbugs.sourceforge.net/">FindBugs perform a static code analysis, or how Integrated Development Environments (IDEs) like NetBeans or "http://www.eclipse.org/">Eclipse execute quick code fixes or find the exact references of a field declared in your code? In many cases, IDEs have their own APIs to parse the source code and generate a standard tree structure, called an Abstract Syntax Tree (AST) or "parse tree," which can be used for deeper analysis of the source elements. The good news is that it is now possible to accomplish the said tasks plus a lot more with the help of three new APIs introduced in Java as part of the Java Standard Edition 6 release. The APIs that might be of interest to developers of Java applications that need to perform source code analysis are the "http://www.jcp.org/en/jsr/detail?id=199">Java Compiler API (JSR 199), the "http://www.jcp.org/en/jsr/detail?

Reflecting generics

http://www.artima.com/weblogs/viewpost.jsp?thread=208860 Code by Any Other Name Reflecting generics by Ian Robertson June 23, 2007 Summary Type arguments to generic classes are not available for reflection at runtime - or are they? The type arguments for statically declared types can be discovered at runtime. A look at how to do this, and why you might want to. Probably the most common complaint about generics in Java is that they are not reified - there is not a way to know at runtime that a List<String> is any different from a List<Long> . I've gotten so used to this that I was quite surprised to run across Neil Gafter's work on Super Type Tokens .
All text and content found at URLs starting with http://www.AngelikaLanger.com/GenericsFAQ/ (collectively, "the Java Generics FAQ") are the sole property of Angelika Langer. Copyright @ 2004-2013 by Angelika Langer . All rights reserved. Except as specifically granted below, you may not modify, copy, publish, sell, display, transmit (in any form, or by any means, electronic, mechanical, photocopying, recording, or otherwise), adapt, distribute, store in a retrieval system, create derivative works, or in any other way use or exploit the contents of the Java Generics FAQ, without the prior consent of the author. All rights, titles and interest, including copyrights and other applicable intellectual property rights, in any of the material belongs to the provider of the material. You do not acquire proprietary interest in such materials by accessing them on my web site. http://www.angelikalanger.com/GenericsFAQ/JavaGenericsFAQ.html

Java Generics FAQs - Frequently Asked Questions

http://technicalmumbojumbo.wordpress.com/2008/01/13/java-custom-annotations/

Java Custom Annotations | My experiments with technology

My earlier post covered in-built annotations supported by Java 5. Today we will look at developing custom java annotations on our own. Let’s begin by defining our own custom java annotation called Documentation. The definition of the annotation class is as below: The only difference between an interface definition and that of an annotation is the presence of @ before the interface keyword. Now the annotation can have its own members.
This year one of my goals is to try and become proficient in using ANTLR. I think that learning to translate text or build an external DSL is skill that, although not used everyday, will be very useful to know. For my first attempt I settled on something fairly easy, a SQL like grammar that could be used to search for files and the content within those files. http://www.nearinfinity.com/blogs/bill_bejeck/learning_antlr_part_i.html

Learning ANTLR part I - Blogs at Near Infinity

Design Patterns

http://www.exciton.cs.rice.edu/JavaResources/DesignPatterns/default.htm Design patterns form a cohesive language that can be used to describe classic solutions to common object oriented design problems. These patterns enable us to discuss systems of objects as quasi-encapsulated entities. By using design patterns to solve programming problems, the proper perspective on the design process can be maintained. These pattern discussions, except for the Null and Model-View-Controller patterns are adapted from the classic text, Design Patterns by Gamma, Helm, Johnson and Vlissides (Addison Wesley Longman, 1995.

Debugging Swing, the final summary

Posted by alexfromsun on February 16, 2006 at 11:49 AM PST It's taken some time to study all possible ways of detecting Event Dispatch Thread rule violations, and now I feel I this topic is about to be closed. But let me tell from the beginning:

Awesome tip for debugging Swing by keester81 Sep 29

Generics Tutorial

Oracle Oracle Technology Network > Java Article Why, Where, and How JavaFX Makes Sense CaptainCasa moved from Swing to JavaFX for front-end infrastructure, explaining that implementing an employee desktop front end with native technology is a valid approach and that JavaFX is a good fit.

10 things you need to know about Java 6

Need a digest, summary, compressed form, precis of what's up with Java SE 6 'Mustang', currently in beta ? Here it is, the top 10 things you need to know. 1. Web Services All developers get first class support for writing XML web service client applications.
You are here: Home / Java 7 This page lists the proposed features in Java 7 and information about them. At this point, no Java 7 JSR has been created (although Danny Coward apparently is working on it). So, consider this a list of possible features and libraries, not the actual future contents of Java 7. I formerly published a weekly roundup of discussion on what’s been added to this page.

Java 7 features

Javadoc Home Page This document describes the style guide, tag and image conventions we use in documentation comments for Java programs written at Java Software, Oracle. It does not rehash related material covered elsewhere: For reference material on Javadoc tags, see the Javadoc reference pages . For the required semantic content of documentation comments, see Requirements for Writing Java API Specifications .

Writing Javadoc comments

API docs

Libraries