Empire Node 2016

This article was originally posted by Jack on his blog.

 

Last month I had the good fortune to attend Empire Node at The National Museum of the American Indian, courtesy of InRhythm. A good time was had by all and we got to see some great talks! There was programmable music, smart ways to get into code style linting and, of course, robots. Following are my notes on the talks. They’re definitely incomplete and probably inaccurate so send me a note if you spot something out of order.

Hosts

Matthew Conlin – @mathisonian – Computational Journalist with 538

Extending HyperTerm (now known as Hyper)

  • HyperTerm is built on js, react, redux and exposes a full plugin API and lifecycle hooks.
  • npm install hpm and then use hpm like npm to install HyperTerm extensions.
  • Plugins like powerhyperambient.
  • Intercept redux actions to change behavior by triggering new actions. add reducers to listen on those actions and change state.
  • To deal with files and streams all you really want is cat but pushing everything to stdout is unreliable. instead output to a file and pass around references to that file.
  • HyperTerm has access to the entire react ecosystem!
  • htyt will take a reference to an arbitrary youtube video and play it in your terminal!

Jamund Ferguson – @xjamundx – Paypal

Advanced linting with ESLint

  • “Linting multiplies your power as an engineer”.
  • “It’s like being able to whisper best practices into somebody’s ear as they’re coding.”
  • When you’re throwing an error, do not throw a string. Throw new Errorbecause if there’s no error you lose the stack trace.
  • The problem with callbacks is you frequently forget to pipe up the errors. always remember to handle errors first.
  • Don’t nest promises!
  • Don’t ever mismatch code patterns that solve the same problem!
    • es6 classes and prototypes
    • es6, commonjs, amd modules
    • connect middleware, koa middleware
    • early return and single in single out
    • factory, singleton, etc
    • lodash, underscore, jquery
  • Writing custom rules
    • astexplorer.net
    • How do we prevent promises inside of callbacks?
    • Detect a promise by looking for a MemberExpression with a name of then.
    • Detect a callback by looking for a parent FunctionExpression that has a first argument with a name of err.
  • Figure out patterns that you’re using incorrectly and write rules to fix them.
  • Learn ASTs to better help you understand what’s going on in your code.

Justin J Moses – @justinjmoses – MongoDB

The Sound of Music

  • Learned to play classical guitar after a career in ColdFusion.
  • Functional Programming – coming back into vogue as a response to the unpredictability of object-oriented applications.
  • EventEmitters (pubsub) give us a way to do async but if something happens before something else is listening that event is lost.
  • Promises fix that issue by hanging onto the return value until something listens.
  • Streams take that even further and hang onto old value(s) and continue to allow you to pipe values through them.
  • Node keyboard – library that allows you to play midi values and pipe them around. use various “instruments” by engaging “soundfonts”.
  • Western music theory is largely functional and popular musical sequences can be constructed just by applying simple functional transforms to other popular sequences. (making music with functional composition).
  • RX is like a super-powered pubsub pattern. (obesrvables).
  • Converting sentiment analysis scores to notes allows us to do something like “listen to our facebook news feed and hear the tone of what people are saying”.

Alejandro Oviedo – @a0viedo – NodeSchool, Thinkful

Understanding JavaScript Engines

  • The history of JS engines.
  • source code > parsing phase > byte code > execution phase.
  • Garbage collector > heap.
  • “Hot functions” are functions that are running too often.
  • Adaptive/Optimistic optimization.
  • Inline caches.
  • Most engines use 2 different compilers. One that optimizes compilation time and another that optimizes execution time.
  • Each of the 3 major browsers use a slightly different architecture of optimizers and interpreters.
  • In low level programming languages like Assembly, calling a function results in a “context switch” which is a costly operation so optimizers will try to reduce function calls as much as possible.
    • This is why a for-loop is so much faster than #forEach, the #forEach callback function creates a new context and switches to it for each iteration.
  • Replace repeated calculations with constants.
  • Trim code that’s never used known as “dead code” to reduce wasted cycles.
  • Working on a way at runtime to detect which optimizations are enabled.
  • How to measure optimization performance? It’s difficult.

Seth Samuel – @sethfsamuel – Working at Airtime

How WebAssembly will change your life

  • A brief history of the web: Charles Babbage, Ada Lovelace, Alan Turing, Grace Hopper, Tim Berners-Lee, Brendan Eich, Ryan Dahl, and YOU. Oh good, now we’re all caught up.
  • What are programming languages? A bridge between human thought and computers.
  • Why do we need them? Computers are just pipes of electrons.
  • Electrons > Machine code (binary numbers) > Assembly (using conceptual words to describe simple machine operations) > Lower level languages (you don’t need to know exactly how many bytes to assign to a variable in memory but you do need to do a lot of calculations manually. At a time this was considered a “higher order” language) > High-level languages (don’t worry about machine operations at all or very much. Write understandable code more quickly.)
  • ASM.js – supposed to be easier for compilers to compile down to assembly code.
  • Mariko Kosaka – How to be* a Compiler.
  • global.Wasm (don’t use this in production yet).
  • Fibonacci is the “darling of cpu profiling tests”.
  • “Loose typing is great when you’re writing code and terrible when you’re running code”.
  • With ASM.js you can run compiled system languages (like C) in the browser!
  • Webassembly lets us write code however we want and compile it down to the same target language/AST such that it can be run without all sorts of intermediary steps.
  • The first big win will be getting some of these processor-intensive dependencies (like libsass) to run in your JS environment without having to go through the C compile step.

Will Blankenship – @retrohack3r – Consultant(Sellsword)

Building p2p applications in Node

  • Why build in JS? Because it’s ubiquitous and very close to the best tool for the job. And because we have Electron to wrap our applications in lovely interfaces.
  • We don’t use p2p applications on a daily basis because they’re generally hard to use.
  • Why build this way? Reduce server costs and make highly-available applications. Non-data code and non-IP code doesn’t need to be on a centralized server.
  • Deep Blue – 11.3 gigaflops (floating point operations per second).
  • “Your wifi router has more computing power than all of nasa had in 1968.”
  • “I like counting windows because I know that behind each window is at least one computing device.”
  • What could we do with all of the untapped computing power just in NYC, the US, the world?
  • WebTorrent is a beautiful piece of code. If you want to learn how to write Node modules and ship them the right way this is the best place to start.
  • Kad Tools is a super simple interface that lets you wrap complicated code. Good example – Storj.io (a decentralized version of S3).
  • https://github.com/retrohacker/awesome-p2p.
  • PeerWeb – a decentralized internet browser.
  • This is going to change the future of how we access information and pay for that access.

Nick Hehr – @hipsterbrown – Tessel, Namely

Portable, Distributed Systems

  • Data is transferred over the internet in the form of packets.
  • Packets are made up of a bunch of different sections like headers.
  • Packet delays come in several forms: propagation (basically distance over the wire), transmission (the rate at which you can transfer data), process (the time it takes to interpret and process the received data), queueing (variable latencies and delays because router buffers hate dropping packets).
  • “For every 20ms decrease in latency we have a linear improvement in load times.”
  • Tessel is a node-based microcontroller.
  • OpenWRT (an embedded linux distro, mostly for routers).
  • How to distribute the load between multiple nodes? Create a MANET.
  • The dgram module provides an implementation of UDP for node.
  • UDP is used by DNS and routing.
  • mDNS is a way to resolve hostnames on a local network without a local nameserver.
  • tessel-av
  • TesselMobile
  • TesselComms – small devices that create an adhoc network and subscribe to a pubsub service. Can be used to turn on and off switches or evolve into a walkie-talkie.

Carlos Justiniano – @cjus – Flywheel Sports

Node Microservices Using Hydra

  • A longstanding interest in distributed computing.
  • 2005 world record for largest distributed chess computer.
  • Large applications power businesses but they’re big, slow, and bogged down by a bunch of dependencies.
  • Microservices should be fast and agile.
    • That’s an inaccurate description.
    • “A process dedicated to doing a single particular task.”
  • We wanted to create a smart and easy to use and deploy microservices so we created Hydra.
  • Hydra comes with a bunch of features out of the box like automatic service discovery…
  • Use a yeoman generator to bootstrap your microservice! fwsp-hydra.
    • Bootstrapped microservices come with an “app” and a “routes” file that describes how the microservices should listen and respond.
  • Hydra is based on Express.
  • Hydra router automatically discovers services available on your application. It makes those available and even automatically load balances between instances of microservices.
  • Hydra wallboard provides a list of running microservices and status for each of them because each microservice is expected to self-report status.
  • Built a hydra compute cluster out of 8 Raspberry Pis.
  • hydra MCP – master control program. A GUI for communicating with the cluster.
  • Hydra doesn’t just have http restful services, it also communicates over sockets.
  • Test your code on Raspberry Pis and Arduinos. If you can get your code to run on low-level machines then you can run it anywhere.

Gabrielle Crevecoeur – @nowayshecodes – Technical Evangelist at Microsoft

Build your child their very own NodeJS Frozen Bot

  • Why build a frozen node bot?
    • Little sisters! I wanted to build something that lets me do my job and also connect with somebody I care about.
  • “I googled… I mean, I ‘bingd’, sorry.”
  • How do I get started with microcontrollers? How do I get JavaScript on these boards?
  • “I felt like Arduinos make getting started with pins and headers and such easier.”
  • Johnny Five is a great way to get JavaScript onto these boards.
  • A lot of boards come with shields. The nice ones just plug straight into your board and other require you to wire them up on a breadboard next to the board.
  • Required hardware: arduino, mp3 shield, speaker.
  • Get my computer to listen on the microphone > pipe audio into a wave file > pipe to Microsoft Convoluted services > they process the audio and return text > scan the text for the trigger words.
  • If the trigger word is detected the host computer pushes an audio file the the shield which then tries to play the file.
  • Remember to turn your devices on and get the right port number when doing demos. It helps to pay attention.
  • When you’re making embedded components, make them pretty!
  • Go to aka.ms/frozenbot to get step by step instructions on building your own.

Philipp Burckhardt – @burckhap – Carnegie Mellon

Real Time Machine Learning with NodeJS

  • I needed to parse large amounts of data and Node seems to handle these tasks extremely well.
  • The one reason why Node has not become popular in mathematics and statistics is just because the community hasn’t built up yet.
  • What can machine learning help us with? It helps learn patterns from data! “Find the signal in all that noise.”
  • Real time machine learning is new and interesting because historically statisticians have worked on a fixed set of data collected after an experiment.
  • Batch algorithms vs incremental algorithms.
  • @stdlib/math/generics/randu – Math.random can work different in different environments and it’s not seedable so you can’t get reproducible data.
  • “Prediction is very difficult, especially if it’s about the future.” – Nils Bohr
  • Types of problems – regression (like housing prices), classification (like character recognition), clustering (like generating movie recommendations for similar users).
  • “Supervised” vs “Unsupervised” machine learning.
  • Regression example: find the average number of versions for packages on NPM over time in order to be able to predict the number for an unknown package.
  • Classification example: Find out which NPM dependency is an accurate predictor of that project also depending on React.
  • “Elements of Statistical Learning” – Freely available reading online.

Sarah Sexton – @Saelia – Microsoft Tech Evangelist, Voxels

Getting Started with Microsoft Bot Framework

  • Interested in getting more women into coding.
  • Why is Bot service interesting? It lets you write your chat bot once and deploy it to all sorts of services like Slack, Skype, or Facebook.
  • Bot builder available for NodeJS and .NET.
  • Tracery.io – tool by @GalaxyKate to generate text.
  • Use chat bots to do anything you need. Book a haircut, order a pizza, take notes…
  • Always save your passwords and secrets in environment variables or untracked files to avoid publishing them.
  • Dialogs follow routes and you can configure your bot to follow these conversational routes.
  • Use #createGrammar to create a basic grammar.
  • Use #addModifiers to add common grammar traits to your custom grammar.
  • https://github.com/SarahSexton/TraceryBot

Tierney Coren – @bitandbang – Developer Advocate at NodeSource

Rocketing the Node Community Beyond the Edge

  • We all think that Node is awesome. Applications are endless, it’s easy to pick up and learn, and it’s just JavaScript.
  • I think the community is awesome because of how large and diverse it is.
  • Ecosystem – 350,000 published packages. 500 new per day. Almost 6 billion downloads over the last month.
  • Node core – 15000 commits. 400 releases. Over 1000 collaborators. Over 4000 issues filed. Over 5000 pull requests submitted.
  • The io.js story – Node forward was the path that led us to the io.js fork. Thanksgiving 2014, Node was forked. Jan 13, 2015 io.js v1.0 was released.
  • Before the fork, everybody was fighting to get stuff in. After the fork they were content just to get their stuff done.
  • Now: “Individuals making significant and valuable contributions are given commit access to the project to contribute as they see fit.”
  • You can get started RIGHT NOW. There is a very low barrier to contributing and getting feedback.
  • What is the Evangelism Working Group? – create graphics and promotional materials for Node. Create public communication about Node. Grow the community’s positive messaging.
  • “You don’t need to code to be able to contribute to NodeJS.”
  • Now there’s a weekly newsletter that’s being developed by the foundation. Working on getting contributors to update the Node.js wiki page.
  • Beginning to develop a process to summarize the extremely long threads in core.
  • The Node.js project isn’t just about writing code or creating software. It’s a community of people coming together to work better and faster together.

Leave a Reply

Your email address will not be published. Required fields are marked *

Search Anything
Close
Visit Us On TwitterVisit Us On FacebookVisit Us On YoutubeVisit Us On LinkedinVisit Us On Instagram