In https://github.com/angular/angular-cli/issues/9869 and stackoverflow and elsewhere people are wringing their hands about ng serve and service workers. I was also cursing, losing the incremental compile, the debugging, etc. So much efficiency loss.

I researched. There are good reasons to use only https for service workers. But, there is an escape clause, localhost. Why can’t ng serve use this?

Some more research, it appears the service worker is the same file each time (its not compiled, it comes from npmjs).

So methinks, the answer is probably yet-another-proxy. And, it works.

So, what I did:

ng build --prod
cd dist/<project>
python3 -mhttp.server

And just let that sit. In another window, I created a proxy.conf.json in the project root. I then ran the ng serve as below, and, huzzah, it worked.

ng serve --prod --disable-host-check --proxy-config proxy.conf.json --verbose

The proxy.conf.json file:

{
  "/ngsw*": {
    "target": "http://localhost:8000/",
    "secure": false,
    "logLevel": "debug"
  },
  "/manifest.webmanifest": {
    "target": "http://localhost:8000",
    "secure": false
  },
  "/worker-basic.min.js": {
    "target": "http://localhost:8000",
    "secure": false
  },
  "/safety-worker.js": {
    "target": "http://localhost:8000",
    "secure": false
  }
}

Note you can also use ‘ngrok‘ (ngrok http 4200 -host-header=”localhost:4200″) to lie to the browser and have it think this is https.

ng serve --prod    --optimization=false --progress=true --disable-host-check --proxy-config proxy.conf.json --sourceMap=true --live-reload --watch

might also be a good approach to emulate debug mode.

You’re welcome. I’m sure there are all kinds of limitations here, but, well, progress!

This was kind of a fun research article from Harvard Kennedy School of Government. They asked a bunch of people a bunch of questions in a bunch of orders. They then correlated by where they got their news: US ‘mainstream’ (MSNBC, NY Times), ‘social’, and ‘conservative media’ (Fox et al).

The upshot is pretty astonishing. They found that there was a strong correlation to dangerous underestimation of risk, and it correlated to the conservative media. Interestingly, people who identified as Conservative were not the issue. E.g. its not that Conservatives underestimed the risks or held conspiracy theories to be true, it was people who got their primary news from Fox News.

Give the essay a read, its pretty approachable. In particular, they show the survey at the end, the questions they asked.

So last night I’m on my way home from the office. Biking along the path. Now, the Iron Horse trail is a very mixed demographic, aged from infant to aged and all in between. Previously the most noteworthy was a guy in a mobility scooter, with a small dog on a leash, and a tall-boy of malt liquor in the cupholder, maybe second was a delightful elderly lady pushing a pram with a kitten (in a bonnet!) in it.

But, back to last night. Last night as i’m weaving along, I often end up pulling in behind someone because there is traffic in the opposite direction. Its a wide trail, multi-use, but its just not polite to cut off pedestrians. Plus 2m distances. So last night I end up slowing to a near halt behind someone walking while the opposite direction cleared, and I though I would share this with you.

You see, she was an elderly lady, perhaps mid 70’s. And she had a largish speaker of some sort playing an audio book. And what an audio book. A traditional bodice ripper with a lot of loaded adjectives. Oh my. And the volume was cranked to the spinal tap 11.

So, I think she surpasses malt-liquor scooter dog walker, we’ll see who’s next.

Can I silence the foreign WiFi with an unused faraday bag I have from a previous need? Let’s find out!

A Faraday cage is a enclosure used to block electromagnetic fields. You use it for shielding, for safety, etc. In a nutshell you make sure that there is conductivity all the way around the thing you are protecting at the frequencies in question. The higher the frequency, the smaller the holes you can have.

Recently I wrote about the plight of the foreign WiFi in my home. I have 2 devices that enable their WiFi transmitters as access points, but are not connected to my network. 1 relates to my home security system, and 1 relates to my wife’s work from home setup.

The latter is a bit of a pain, it has a strong transmitter on both 2.4GHz and 5GHz. They are unused other than to cause noise. On the 2.4GHz band, there is only 3 channels, and each of these devices is chirping away on one of them lowering the noise floor.

On the 5GHz band, although there is a lot more spectrum and channels, only a few of them are actually great because of DFS (radar avoidance), see the list here. And of course, this device is eating one of the good channels at -40dBm.

So, can I use a Farraday bag I have left over from a previous need to muffle it? Let’s try.

Bag removed from storage, I assess the problem. The Aruba device will fit, but it has 3 Ethernet cables and 1 power cord to it. Frustratingly the industrial design is the device has no flat side, one Ethernet cable exits the middle of the back, 2 from one end, and the power cord from a side. The remaining sides are slipper and rounded. It fits ok into the bag, but, as you probably guessed from the foreshadowing of “the higher the frequency the smaller the hole size” above, its hard to create a great seal with the four cables exiting differently.

After some scrunching it around and playing w/ the WiFi power meter, yes, it was somewhat successful. On the 2.4GHz band we managed to get it to -53dBm from -35dBm measured at 6m. On the 5GHz band we managed to get it to -61dBm from -45dBm at the same distance. Is this enough to matter? Well, not really. It still renders those channels less than usable. The combination of the lack of seal plus the cables acting as unintentional antenna are blocking the approach.

Somewhere in my collection of stuff I have some ferrite coils, I might have a few that are cat-5 sized and be able to reduce the antenna affect. Hmm… its a big collection.

I guess I can hold off and try another approach, maybe get some copper foil and tape and make a box of some sort.

Anyone have any expierence with this? I mean, the easy solution involves a screwdriver, open the lid, solder the antenna to ground đŸ™‚ But its not my device. The antenna are internal to it so I can’t just do the same on the SMA connectors.

PS I highly recommend these Faraday bags for your laptop sleeve. They are no bigger or heavier, they are tough, and they give you added protection. Give it a go.