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/
    step02
    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)
  VALUES (EMPTY_BLOB())
  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);
$this->execute($stmt);

$handle = fopen("myFile", 'r');
while (($buffer = fread($handle, 2048)) != '') {
  $lob->write($buffer);
  $lob->flush();
  flush();
  ob_flush();
}
fclose($handle);
oci_commit();
oci_free_statement($stmt);
$lob->free();

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

Hi

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:
https://www.speich.net/articles/en/2015/08/22/new-nikon-600mm-f4-fl-ed-vr-is-too-front-heavy-with-d810-attached/

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
Simon

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

New Nikon 600mm F/4 FL ED VR is too front-heavy with D810 attached

Update 04.03.2017: Perfectly balancing a Nikon 600mm FL with a D810 / D500 works now. I not only replaced the stock foot, but also use the gimbal Heavy Duty MK IV by jobu design.

Update 23.04.2016: Balancing the 600mm FL horizontally works fine now. I finally went with a foot replacement by jobu design.

Update 06.11.2015: A few words about my setup in the video. I replaced the stock foot of the lens with the RRS LCF-13, which has a lower profile, is lighter than the original Nikon foot and even slighly longer. The tripod head is by Dietmar Nill and weights 1.2kg. Unfortunately height can not be addjusted, but it’s less extrem than it seems in the video. Note that the exact same setup worked perfectly fine on the older 600mm F/4 ED VR.
——–

I just got my Nikon 600mm f/4 FL ED VR a few days ago. It’s so light and you can really handhold it. But the initial smile after picking it up went away pretty quickly as soon as I mounted it on my tripod with the D810 attached. It’s not possible to balance it! It’s way too front-heavy.

Only after not only attaching the additional battery grip MD-12, but also loading it with AA batteries, did I manage to balance it. The normal EN-EL15 was not enough.

How can this be? What an oversight by Nikon! I bought this lens because it’s light, and now I have to add weight back to make it work properly. What an irony!

This actually means that it only works properly with the heaviest camera, the D4. It also means that Nikon can’t make lighter flagship bodies in the future as long as they still want to support this lens.

The only solution I see without having to completely redesign the lens, is to drastically reduce the weight of the hood. Good opportunity for any 3D printing business. I’d buy one.

 

PhpStorm: Complete code versus complete current statement

Here are two useful keyboard shortcuts for PhpStorm which sound similar, but are quite different:

complete code CTRL + SPACE
will either finish your code if what you typed so far is unambiguous or otherwise offer a list to choose from.

complete current statement CTRL + SHIFT + ENTER will add a semicolon at the end of your statement, no matter where the cursor is.

If you want to train your shortcut skills for PhpStorm or other software, the website shortcutFoo is really helpful and fun to use.

JavaScript tip: Shorten document.getElementById with Function.prototype.bind

I found this really nice one liner on Nick Desaulniers blog about Function.prototype.bind Edge Cases:

// var byId = function(id) { return document.getElementById(id); }
var byId = document.getElementById.bind(document);

Love it!