Polymer Logo

Polymer Nested Scoping

I’ve taken my first dive into Polymer and the uber intriguing Web Components concept. One of the first things I had issues with was availability of custom attributes passed into the component template.

This issue arises when you have nested, or child, templates. In the example below, you’ll notice I’ve several nested templates inside my polymer-element.

Note that in each child template I’m trying to print out {{myvar}}, which is a custom attribute. In the first, it simply doesn’t exist, but we’re golden in the second. Polymer docs have this to say:

If a <template> using a named scope contains child <template>s, all ancestor scopes are visible, up-to and including the first ancestor not using a named scope….

In other words:

  • If a template uses a named scope, its parent scope is visible.
  • If a template uses an unnamed scope, its parent scope is not visible.

See http://www.polymer-project.org/docs/…

For some reason, this just didn’t click for me on the first read through.

A named scope looks like this:

<template bind="{{foo as bar}}">

Where as an un-named looks like:

<template bind="{{foo}}">

In the latter, the scope is limited to foo; no access to any parent scope is allowed. But the above says even more. That scoping is inherited up through the child templates until it hits the first un-named scope, that’s important to remember.

JS Bin

Mac RAM File Cache & VMWare Fusion

I have 16GB RAM in my Mac Mini; maxed out! I’ve been using all of it lately. I’ve even crashed the Mini because it used 100% of the RAM. Never done that before.

After some experimentation I’ve found that rebooting the Windows 7 virtual machine, running in VMWare Fusion 5.0.4, does not release RAM retained for File Cache. No idea why; I didn’t take the time to wait between reboots to see if the RAM would eventually be released.

The “fix” I’ve found is to purge the memory. Basically, it’s a manual release of the RAM allocated to File Cache.

sudo purge

Simple Traffic Splitting on Macs

At the office we have two separate data connections. One is used for business traffic via Ethernet and secure Wifi. The other is open Wifi only and meant for guests who visit; it does not allow access to our domain controlled business network.

Lately, we’ve had several high bandwidth Mac users who’ve been saturating our business network with artwork uploads / downloads. The solution I’ve just implemented is pretty straightforward.

  1. Open System Preferences > Network and turn on Wifi
  2. Connect Wifi to the guest network
  3. Click the cog icon under the network connections list and select Set Service Order
  4. Drag Wifi above Ethernet in the list and apply

Now, when one browses about the interwebs the Mac will attempt to connect via the Wifi connection, which happens to be connected to the guest internet connection. Any traffic to local, business network, locations will fail to resolve and the Mac will attempt to connect over the Ethernet connection. Whalla! Network splitting without having to look at routing tables.

Delving into Coldfusion, JavaScript, HTML5 and Linux