Apache serves cached files with garbled text at end

When using Apache running on a VirtualBox machine with a shared folder, small files such as JavaScript or CSS files might not get updated from the host and served with additional characters at the end. This happens because of a bug in VirtualBox when Apache is using sendfile to improve data transfer. Just turn the EnabeSendfile Directive off in your httpd.conf, e.g.:

EnableSendfile off

Why I love PhpStorm: SQL GROUP BY handling

Here’s another post from my series why I love JetBrains PhpStorm. This is a SQL query, where I have I list of column names. The IDE not only marks the columns missing in the GROUP BY clause as errors, it also offers an option to fix it for you by adding them to the GROUP BY clause.

PhpStorm understands SQL mixed with PHP code.

More PhpStorm love:
SQL table aliases
JavaScript code completion with dojo

What I don’t like about the Nikon D500

So far nothing except one (little) thing:
Unlike on the D810, the GPS icon is not displayed on the top LCD only on the rear LCD. The GPS icon (on the rear LCD) blinks as long as no fix is available. Having this information on the top would be useful before taking a picture, especially if you have the Standby Timer setting enabled to save battery.

Why is your PHP output still buffered even when you turned buffering off?

If you want to stream your content with PHP, you need to have output_buffering set to off in you php.ini and/or use it together with flush(). If this still does not work check your Antivirus software.

On Windows, the on-access scanners of Sophos and Avira Antivirus buffer your http output! The only solution is to either switch to https or turn on-access scan off.

PHP: How to sort a NodeList by element attribute

$elements = iterator_to_array($nodeList);
usort($elements, function($a, $b) {
  return (int) $b->getAttribute('someAttribute') - (int) $a->getAttribute('someAttribute');

Gimbal and replacement foot for the Nikon 600mm FL

Unfortunately, the Nikon 600mm f/4E FL ED VR does not balance with the D810 and the foot replacement LCF-13 by Really Right Stuff nor with the Nikon stock foot. The LCF-13 worked perfectly with the previous model 600mm f1/4G ED VR.

After some research I ordered the foot LF-N604FL by jobu design. It is 4 cm longer than the Nikon stock foot and 2cm longer than the new LCF-18 by RRS, which is too short according to this comment. Now, my setup balances fine horizontally, but vertically the lens sits (still) too high with the gimbal by Dietmar Nil.

To balance my setup also vertically, I needed a different gimbal head. The WH-200 Wimberley Head Version II would let me compensate a height up to 12 cm. I went with the Jobu Heavy Duty MK IV, which is a bit lighter, but only gives you about 10.5 cm (my combination requires at least 10 cm).

Video showing the balancing of the Nikon 600mm f1/4E FL ED VR with the Jobu LF-N604FL replacement foot. The lens is attached to a Nikon D810 and mounted on the Jobu Heavy Duty MK IV gimbal.
Continue reading “Gimbal and replacement foot for the Nikon 600mm FL”

Use JSDoc 3 and PhpStorm to generate JavaScript documentation

This is an update to my former installation guide How to Generate JavaScript Documentation with JSDoc 3 and PhpStorm, which was written in 2013. Since then, JSDoc 3 moved from Mozilla’s Rhino to Node.js to generate the documentation, which is why that guide no longer works (unless you use an older version of JSDoc 3). This installation guide is written for Windows, but should also work on Linux and Mac.

Install and integrate Node.js

  1. Download and install Node.js.
  2. Integrate Node.js into PhpStorm:
    Open Settings (Ctrl+Alt+S) -> Plugins -> Install JetBrains Plugins -> Search for Node.js -> Install the Plugin
    Install NodeJS in PhpStorm
    Open Settings (Ctrl+Alt+S)  again and go to Languages & Frameworks -> Node.js and NPM. In the Node interpreter field, specify the local Node.js interpreter to use. Also press the Enable Node.js core button to enable code assist. For more details about Node.js in PhpStorm read IntelliJ IDEA 2016.1 Help | Node.js
  3. Install the node package manager npm from within PhpStorm:
    Install the npm package manager by clicking on the green add button
    icon add button
    . Beware to make the installation global by setting Options to -g, otherwise you end up with npm in your project folder. The -g option will install npm into your folder %AppData%/npm/
    For more details about using the package manager in PhpStorm read Installing and Removing External Software Using Node Package Manager.
Continue reading “Use JSDoc 3 and PhpStorm to generate JavaScript documentation”

Streaming large data (LOBs) directly into an Oracle database with PHP

The OCI library allows you to stream large data in chunks directly into a LOB instead of loading it completely into memory first. This technique is only mentioned in the article Working with LOBs in Oracle and PHP on the Oracle Technology Network, but no code example is given there, so here’s my take:

$sql = "INSERT INTO myTable (myUploadBinary)
  RETURNING myUploadBinary INTO :myBinary";
$stmt = oci_parse($conn, $sql);
$lob = oci_new_descriptor($conn, OCI_D_LOB);
oci_bind_by_name($stmt, ":myBinary", $lob, -1, OCI_B_BLOB);

$handle = fopen("myFile", 'r');
while (($buffer = fread($handle, 2048)) != '') {

New Foot for the Nikon 600mm f/4 FL VR is on the way

The Nikon 600mm f/4 FL is a superb lens, but you need a very long lens plate to balance it correctly with a D810 attached. For example the the Really Righ Stuff LFC-13 replacement foot is not long enough, but there is help on the way. I just received the following email from RSS:

Really Right Stuff Support Case #51499 – “replacement foot for Nikon 600mm FL”

Hi Simon,

We are in the process of designing a new foot for the 600mm FL and 500mm FL, but at this time I don’t have a timeline for the release of that product(s).

The LCF-17 is another foot we know fits, but reports are similar in that proper balance cannot be achieved, which is leading us to design new feet.

I’d recommend checking back within the next month, when we expect to have more information on those feet. Please let me know if you have any other questions.

Message History
—–Original Message—–
From: Simon Speich
Sent: Friday , January 22, 2016 01:06 am PST (GMT-08:00)
Subject: replacement foot for Nikon 600mm FL


Currently I’m using the LFC-13 with the new Nikon 600mm f/4 FL ED VR and
a Nikon D810 without extra battery grip. Unfortunately, the camera is
too light, resp. the lens to front heavy:

Do you have another (replacement) foot that would be longer, but still
let me mount the hood in reverse when stowing away?

Or are you going to produce a new foot designed specifically for the
600mm FL? With the new D500 coming out, which is also a lot lighter than
the D4/D5, more people will have the same problem of the lens being to
front heavy. Do you also produce custom made foots?

Thank you for your help

Share VPN connection of Windows host with VirtualBox guest

Sharing the VPN connection of your host in VirtualBox works fine with NAT, but not with host only mode. The solution I found on morales-rodriguez.net is simple. Open an admin console on your windows7 host and execute the following:

$ VBoxManage list vms

Note that uuid or name in parenthesis of your VM and then:

$ VBoxManage modifyvm  --natdnshostresolver1 on