Articles

  • August 21, 2008

    Java's Swing components have a constant background color used to fill the entire component area. To add interest, contrast, and polish to a user interface, override the component's background painting and add a gradient to smoothly vary the color across the background. This tip shows how and demonstrates the effect.

  • July 26, 2008

    A "findable" web site is one that search engines can easily scan to find content to add to their search indexes. Since most visitors today find web pages by using a search engine, the more easily search engines can index your content, the more easily visitors will find it. A default Drupal installation is moderately findable, but you can improve the site by installing a few more modules.

  • June 19, 2008

    CSS optimization (a.k.a. minimization, cleaning, or tidying) removes white-space and comments, merges similar selectors, removes redundant properties, and cleans up a CSS file to make it more compact. The optimized file is smaller and faster to send to a site visitor. This article uses the CSS Tidy optimizer and measures the improvement first for CSS from 30 popular web sites, and second for CSS from 30 site themes for the Drupal content management system. Unfortunately, in all cases the improvement is small and will not have a noticeable impact on page load times.

  • May 27, 2008

    An absolute URL is complete and ready to use to download a web file. But web pages often include incomplete relative URLs with missing parts, such as an "http" or host name, or the first part of a file path. These parts need to be filled in by copying them from a base absolute URL. This article shows how and includes code to do it.

  • May 27, 2008

    Splitting apart and rebuilding URLs is essential for link checkers, phishing detectors, spiders, and so on. PHP's standard parse_url( ) function works pretty well to parse simple URLs, but it has problems with complex and relative URLs. Once split apart, there is no standard PHP function to reassemble the URL properly. This article reviews the official syntax of URLs, discusses URL parsing complexities, and provides new PHP functions to split apart a URL and join its parts together again.

  • April 20, 2008

    Java's threads are essential for building complex applications, but thread control is split across several classes in different packages added at different times in the JDK's history. This tip shows how to connect these classes together to find threads and thread groups, and get thread information.

  • April 13, 2008

    Web page keywords characterize the page's topic for a search engine. Extracting keywords requires that you recognize the page's character encoding, strip away HTML tags, scripts, and styles, decode HTML entities, and remove unwanted punctuation, symbols, numbers, and stop words. This article shows how.

  • March 20, 2008

    Performance optimization requires that you measure the time to perform a task, then try algorithm and coding changes to make the task faster. Prior to Java 5, the only way to time a task was to measure wall clock time. Unfortunately, this gives inaccurate results when there is other activity on the system (and there always is). Java 5 introduced the java.lang.management package and methods to report CPU and user time per thread. These times are not affected by other system activity, making them just what we need for benchmarking. This article shows how to use the java.lang.management package to benchmark your application.

  • February 24, 2008

    Java has several classes for reading files, with and without buffering, random access, thread safety, and memory mapping. Some of these are much faster than the others. This article benchmarks 13 ways to read bytes from a file and shows which ways are the fastest.

  • January 6, 2008

    The starting point for building a link checker, web spider, or web page analyzer is, of course, to get the web page from the web server. Java's java.net package includes classes to manage URLs and to open web server connections. This tip shows how to use them to a get text, image, audio, or data file from a web server.

Syndicate content
Nadeau software consulting
Nadeau software consulting