Downloading or mirroring a website with wget

The easiest way to download/mirror a complete website is using WGET and use the mirror option. If you want to see your website with the correct layout and all images, make sure you also supply the --page-requisites flag.

The full command:

wget -p -m -k -K -E

See wget --help for an explanation of all command-line options, but these should give you a good start.

AJT 2.8 released

Even though it's been a while, AJT 2.8 was released with some more improvements.

LineIterator has become even more versatile. Added some more GUI widgets. Extended the tricks of FrequencyMap to make it more intelligent.

Download AJT

Linux breaking lines to fixed length

Break line in fixed width with the linux fold command.

I keep forgetting this command, so here goes.

The Linux 'fold' command, can be used to wrap each input line to fit in specified width.

If width is not specified using -w option, by default, 'fold' breaks lines wider than 80 columns. The output is split into as many lines as necessary.

AJT 2.6 released

AJT 2.6 adds a peek method to the LineIterator class that allows you to look at the next line, but not yet consume it.

API documentation

AJT 2.5 released

AJT 2.5 adds new functionality to the TimeInterval class, implements a NullStream to simulate /dev/null, adds a LRUCache implementation, fixed a comment identifier bug in LineIterator, adds a new toolkit to work with Sets and fixes a bug in ExtensionManager with respect to upper case extensions.

API documentation

Howto change a default Eclipse project to an Eclipse Java project

To change a default Eclipse project to an Eclipse Java project you can follow the steps below.

  1. First close the project in Eclipse (right-click project folder > close project)
  2. Open the .project file in a text-editor outside Eclipse
  3. Add the Java builder and nature to the .project file
  4. Save and close file
  5. Open project in Eclipse and it now is a Java project

Original .project file

<?xml version="1.0" encoding="UTF-8"?>
	<name>A project</name>

Replacing text in a directory tree

Sometimes you want to replace one piece of text with another in all files in a whole directory tree.

*nix and sed to the rescue.

find ./ -type f -exec sed -i ’s/queryString/replaceString/g’ {} \;

AJT 2.2 released

AJT 2.2 fixes a bug in the handling of TitledComponent, the component inside the border now properly expands in both directions.

API documentation

AJT 2.1 released

AJT 2.1 adds transparent handling of GZIP files to the LineIterator class.

API documentation

Java memory usage

We all know that Java is a memory hog. This page aims to give you an idea how much it actually hogs without using a profiler.
Primitive types
A reference to an object is in this listing also considered to be a primitive type.

  • boolean: 1 byte
  • byte: 1 byte
  • char: 2 bytes
  • short: 2 bytes
  • int: 4 bytes
  • long: 8 bytes
  • float: 4 bytes
  • double: 8 bytes
  • reference: 4 bytes

Each Java object uses the following:

  • 8 byte Object overhead
Syndicate content