ThomThom's Website

PHP Resumable Download Server

22 Sep 07 - 13:23

I wanted to add a download section to my site, but at the same time keep statistics of the files downloaded. So made a little PHP script to act as a download server.

This little script became a little larger when I added support for partial file downloads. I noticed that many comments in the PHP manual and other sources described the method wrong. For instance, many of them announced to accept multiple byte ranges while that was not the fact. And they also tended to not handle the requested byte range according to the HTTP 1.1 specifications.

Now, I'm never pretending this is a complete implementation or free for issues. But it should work very well and I've tried to make it behave to the specifications.


  • Serves files from a file repository.
  • Makes sure no files outside the repository is served.
  • Lists files if a directory is requested.
  • Supports partial file request allowing users to pause or accelerate downloads.
  • Logging function to keep statistic over the file downloads. (Needs configuring to work.)

Live Example

Known Issues

  • Files larger than 2GB might give unexpected results on platforms that use 32-bit integers. This is because it might affect the calculation of filesizes.


21 June 2011: I have uploaded the project at BitBucket. It is the recommended way to obtain the project. Now you can send back your patches and improvements.


Installation instructions is in the readme.txt file.

Download latest version from the BitBucket repository.

Colour Swatch Manager Documentation

07 Sep 07 - 09:53

Version: 1.0.3
Last Updated: 23 September 2007

Related Files

Table of Contents


Warning: Any changes made to a scheme are automatically saved. If you delete or edit a colour there’s no way to undo it. An Undo function might be added in a later version.

Scheme Menu

Click on “Scheme: ” to open the Scheme Menu. Here you are presented with the tools related to the scheme itself.

Creating new scheme

Choose “New Scheme” from the Scheme Menu. You will then be presented with a window asking for title and filename.

Type the name of your new Scheme and then enter the filename with full path to where you want to store the Scheme. Click the “Browse” button to browse your system and pick the location you want.

Warning: This file dialog does not automatically append the *.xcsm file extension to the files. You must remember to add this yourself. This will hopefully be corrected in later version.

Opening scheme

Choose “Open Scheme” from the Scheme Menu and locate the file you want to open.

Alternatively you can drag and drop colour scheme files onto the gadget. When you drag a colour scheme onto an already open colour scheme you can choose to append the file you dragged to the one already open.

Information: Currently there’s no way to associate colour scheme with Colour Scheme Manager due to limitation of DesktopX. Hopefully a future version will support this feature.


Creating new swatch

Click on “New Swatch...” at the bottom of the swatch list. It will only appear when there’s a colour scheme open.

Name the swatch and pick the colour.

Information: At the moment you have to use Windows’ colour picker. It has its limitations that it only lets you enter RGB and HSL values. A future version will feature a custom colour picker with CMYK, Hex and long support.

Warning: The HSL value ranges used in Windows’ colour picker is not the same as the ones used in Colour Manager. Colour Manager matches what Photoshop uses.

Swatch Menu

Right click on a colour entry to bring up the Swatch Menu. This brings up your options for the specific swatch.

Expand swatch

You can expand the swatch to display all the colour codes by left clicking the swatch list-item.

Organizing swatches

You can drag and drop the swatches in the list to organize them to your liking.

Warning: Dragging the swatch outside the gadget area will delete them with no undo function available.

Deleting swatches

Apart from using the Swatch Menu to delete a swatch you can also drag a swatch outside the gadget area. When you then release the mouse the swatch will be deleted. The drag symbol will say “Delete” to indicate that the swatch will be deleted if you release the mouse.

Copying colour values

You can copy the colour values from the various colour spaces by using the Swatch Menu. If you click the colour sample of a swatch you copy the colour values of the default colour space.

Colour Spaces


The native colour space of computer monitors.


The Hue is given a value of 0–360 degrees with the Saturation and Lightness ranges from 0–100%. This is similar to how Photoshop let you pick HSL values.


Warning: CMYK colours needs colour profiles of the source and the target medium to be calculated accurately. Colour Scheme Manager only performs a very generic conversion and should only be regarded as guidance.


Hexadecimal values in the same format used in HTML and CSS.


Some computer languages take colour codes in one integer number.


Default Colour Space

Here you set the default colour space to be used. This colour space is the one displayed next to the colour when a swatch is collapsed. It’s also the colour space copied when you click the colour sample.

Verbose Copy

By default Colour Scheme Manager will only copy the colour values. I.e.: “FF8000” or “255, 128, 0”. If you tick this option it will prefix the text copied with colour space indication; “#FF8000” or “RGB: 255, 128, 0”.

Lowercase Hex

Tick this option if you want lower case letters in your hexadecimal values.

Show Hotkey

You can assign a hotkey that will bring the gadget to the front of your windows.