July 13, 2010

Vista fonts compared to older fonts

The "Vista fonts" are Cambria, Calibri, Candara, Consolas, Constantia and Corbel. A good piece on them is provided by hunlock.com here.

July 12, 2010

Package becomes unrecognized in Eclipse

Error:
Saving a Java source file in Eclipse causes the errors "[class] cannot be resolved to a type" and "The import org.oasis_open.docs.[whatever] cannot be resolved" for classes in a package that was previously recognized.

Solution:
Open the context menu for the affected package in Package Explorer, select Build Path > Configure Build Path... and go to the "Order and Export" tab. Make sure custom classes are at the top, third-party files are in the middle and the JRE is at the bottom of the list. Select OK and refresh the affected files/packages.

July 8, 2010

Putting a head tag below a body tag

It is possible to put <head> tags underneath <body> tags. Why do this? One reason is to make cache instructions work better, as described by Microsoft here.

Another is described in High Performance Web Sites: Rule 6 – Move Scripts to the Bottom by Steve Souders, Yahoo!'s Chief Performance Yahoo!

With stylesheets, progressive rendering is blocked until all stylesheets have been downloaded. That’s why it’s best to move stylesheets to the document HEAD, so they get downloaded first and rendering isn’t blocked. With scripts, progressive rendering is blocked for all content below the script. Moving scripts as low in the page as possible means there's more content above the script that is rendered sooner.

The second problem caused by scripts is blocking parallel downloads.

July 6, 2010

The Java heap

The young generation consists of eden plus two survivor spaces. Objects are initially allocated in eden. One survivor space is empty at any time, and serves as a destination of the next, copying collection of any live objects in eden and the other survivor space. Objects are copied between survivor spaces in this way until they are old enough to be tenured, or copied to the tenured generation.

-Tuning Garbage Collection with the 5.0 Java[tm] Virtual Machine by Sun

The Java HotSpot VM defines two generations: the young generation (sometimes called the "nursery") and the old generation. The young generation consists of an "Eden space" and two "survivor spaces." The VM initially assigns all objects to the Eden space, and most objects die there. When it performs a minor GC, the VM moves any remaining objects from the Eden space to one of the survivor spaces. The VM moves objects that live long enough in the survivor spaces to the "tenured" space in the old generation. When the tenured generation fills up, there is a full GC that is often much slower because it involves all live objects. The permanent generation holds all the reflective data of the virtual machine itself, such as class and method objects.

-Using JConsole by Sun

See figure at either link above (both use the same figure).

Mark-and-Sweep Garbage Collection, used in Tenured Generation GC
Stop-and-Copy Garbage Collection, used in Young Generation GC
The Copy Algorithm, used in the Stop-and-Copy method of GC