Surface Pro - USB Hub

The Surface Pro is a cool device but USB connectivity is one of its weak point. It has a single USB 3 port that is not fully powered. Devices that need the more power like an USB monitor will not work.

Up until now I used a hub with 3 USB ports and LAN (RJ45). An Y cable connected the USB port on the power supply to provide additional power to the hub.

I found something better. 
  • Really small form factor
  • 2 USB 3 ports, 
  • 1 RJ45 LAN port
  • Card reader (SD and Micro SD)
  • Micro USB power connector
So I loose 1 USB port, but get the SD card reader. The form factor is really nice. The killer feature is the Micro USB port. Finally a powered USB hub that does not need a special power supply.

Take a look:

I tested it connected to the Surface Pro power supply and the Asus MB168B+ USB monitor. Works fine.  


FluentDOM 5.1 - New Features

FluentDOM 5.1 is now available. Here are some of the highlights:


The classes can now be called as functions to navigate in a DOM with XPath expressions. The following example fetches all link hrefs attributes from an HTML page:
$dom = new \FluentDOM\Document();

$links = [];
foreach ($dom('//a[@href]/@href') as $href) {
  $links[] = (string)$href;

This works for most of the nodes in a DOM. 


The new Creator class provides short syntax to create DOM nodes. More detailed information can be found in the wiki.
$_ = FluentDOM::create();
echo $_(
  ['class' => 'navigation'],
  $_('li', 'FluentDOM')


Several serializers/loaders for JSON where added. JSONML, Rayfish, BadgerFish and RabbitFish are supported.
echo "XML -> JsonML\n\n";
$json = json_encode(
  new FluentDOM\Serializer\Json\JsonML($dom), 
echo $json;

echo "\n\nJsonML -> XML\n\n";
echo FluentDOM(
  $json, 'application/jsonml+json')->formatOutput();

The Release


FluentDOM + HTML5

HTML 5 is not directly supported by PHPs DOM extension. That means FluentDOM can not understand it, too. But here is a solution. HTML5-PHP is library that can parse HTML5 into a DOM document.

Both libraries use Composer:
"require": {
  "fluentdom/fluentdom": "5.*",
  "masterminds/html5": "2.*"

Read HTML5 into FluentDOM:
$html5 = new Masterminds\HTML5();
$fd = FluentDOM($html5->loadHTML($html));

Or write it:
echo $html5->saveHTML($fd->document);

HTML5-PHP puts the elements into the XHTML namespace. To use XPath expressions, you will need to register a prefix for it:
$html5 = new Masterminds\HTML5();
$fd = FluentDOM($html5->loadHTML($html));
  'xhtml', 'http://www.w3.org/1999/xhtml'
echo $fd->find('//xhtml:p')->text();