Thursday, January 31, 2019

An Empty WebStorm Project and Unresolved Require

When I started an empty Webstorm project to do some light dabbling in Node.js the IDE would not recognize some pretty basic node globals for autocomplete. (version 2018.3.3)


The resources and posts I found all used solutions which didn't work for me or could not carry them out.


The solution is to simply go into the Node and NPM settings menu (Settings | Languages & Frameworks | Node.js and NPM) and check "the box". The box which says "Coding Assistance for Node.js".


Apparently people have also noticed this on other projects which may not have started on empty. Un-checking and re-checking looks like it can help.

Good Luck!

- Victor F

Wednesday, January 30, 2019

The $27 Mechanical Keyboard from Aukey

I bought a $27 AUKEY mechanical keyboard with equivalent blue switches.

I'm actually really proud of those sheets.

The Aukey KM-G9 feels heavy. Weighing in at 1.83 pounds (according to Amazon) it's the heaviest keyboard I own now, in spite of it being the one with the least number of keys.

The sound of the clicks are very high pitched. So when typing softly that's primarily all I hear. When typing harder you'll get a deeper thwak (as keyboards do). I'm using this in the office now; It's pretty loud. There's a reverberation after the key strokes, like tapping on a metal bowl, when I listen to it in a quieter place.

The action is more than I'm used to, having mostly typed on laptop and stock, included for free keyboards.
As such it feels very different and I'm not having the best performance of my life.

If, like me, you've wanted a mechanical keyboard but the prices and number of choices are paralyzing you - keeping you from your from your destiny - this one, among other low price Chinese offers, could be the one to get you through the door.

Good Luck!
- Victor F

Tuesday, January 29, 2019

How to Look Under the Hood at Javascript Code

I'm finally taking the long overdue step of learning Javascript. Part of the process of learning language is to figure out what it is doing at a far lower level then the luxurious heights at which we get to program. Plus it's just damn interesting.

In the Node (using v10.14.2) usage description there is an option --v8-options. Run Node with this to see a long list of options to give directly to V8, the Javascript engine running under the hood of Node.

There are a few options in here that will get us a look at the inner workings of the Javascript code we write.
--print-code
--print-bytecode
--print-code prints the code out in x64 assembly, I think.

--print-bytecode prints the intermediate bytecode.

For even a simple program like hello world there are a few pages of bootstrapping code that also gets printed out. Your functions are put under a label that looks like this: 
[generated bytecode for function: myadd]

Use that to your advantage to find your code.

Good Luck!

-Victor F.