Sanders DeNardi

Web Authentication With AWS Lambda and API Gateway

Wed, Nov 30, 2016 | tags: aws lambda api-gateway javascript nodejs

AWS makes building APIs with serverless architecture easy. Using API Gateway and Lambda, you can define functions that interact with databases, make web requests, and process data. While the API Gateway is primarily designed to serve JSON data, you can be configure it to serve plain HTML files and use it as a rudimentary web server. While API Gateway and Lambda have some limitations, such as relatively high latency compared to standalone web servers, and clunky binary data support, for side projects or simple sites it can be a very low-cost and low-maintenance solution. Read more >

Readable, Writable, and Transform Streams in Node.js

Thu, Jan 8, 2015 | tags: javascript nodejs streams

Streams in Node.js are very powerful and useful constructs. They are also one of the more difficult concepts in Node to wrap your head around. Over the past few weeks I’ve become more and more familiar with them, and the best way I’ve come to understand them is by creating simple examples of them myself. This post will go through trivial implementations of a readable, writable, and transform stream, and demonstrate how to interact with each and how they interact with each other. Read more >

Setting up Nginx Reverse Proxy for Node.JS on Fedora

Fri, Nov 21, 2014 | tags: fedora nginx nodejs

One of Nginx’s popular uses is as a reverse proxy for several different Node.js servers. A reverse proxy makes it easy to point to each separate app without having to remember which instance is on what port. Nginx makes this very easy, but Fedora’s SELinux policies make this setup not so straightforward. In this tutorial, I’m going to map 3 Node.js web servers, running on different ports, to different virtual directories on the same domain. Read more >

Understanding Javascript Callbacks

Tue, Sep 16, 2014 | tags: javascript

The first step in understanding the concept of Javascript callbacks is to realize that functions are really objects. The thing that makes them special is that you can invoke them (i.e. ‘run’ them). This is done by using ‘.call()’, or simply ‘()’. Because functions are objects, you can pass them as parameters to any other function. Say you have this code: var f = function() { console.log(5); }; f(); This is a pretty simple example. Read more >

Infinite Scrolling in Android

Sun, Jun 22, 2014 | tags: android

Infinite scrolling has become very popular in recent years. It’s become especially popular on mobile devices for the simple fact that it allows you to fetch new data while accessing data that’s already been fetched. The concept is pretty simple - once the end of the list is detected to be near, a call is made to fetch more data which is then appended to the end of the list. Read more >

Data Join Techniques in JavaScript

Fri, Apr 25, 2014 | tags: data-visualization festival-guide javascript

When I decided to cut over my festival guide to a standalone site, I needed to figure out a way to do the data operations on the client’s browser that I was doing on the MySQL server. Specifically, I needed to emulate joining tables. The nested loop join is the simplest join you can do in SQL, but it happens to be the most costly. The merge join is a much faster method that can also be easily emulated in JavaScript, but is only advantageous if the sets are sorted (which can offset any performance gain over the nested loop join). Read more >

Text Deduplication in SQL

Tue, Feb 25, 2014 | tags: festival-guide mysql sql

Data deduplication is essential when importing similar data from different sources. Different providers store data differently, and several variations (both correct and incorrect) exist in the English language for names of people, companies, and entities in general. Deduplication is often made easier if there is a lot of other information associated with the data because it gives you several things to compare to identify a dupe (such as birthday for people, location for company, etc. Read more >

Mapping the Snapchat Data Leak

Wed, Jan 8, 2014 | tags: data-visualization javascript mapping

I’ve been following the Snapchat data leak pretty closely the past few weeks, from the announced weakness to the actual leak of the phone numbers. What I found most interesting about this in particular was that instead of email addresses, password hashes, or credit cards, the leaked data was geographical, mappable data. Digging into what actually leaked, I saw some analysis that suggests that only a fraction of area codes were represented in the leak. Read more >

Introducing Tweet Zone

Wed, Dec 18, 2013 | tags: javascript nodejs twitter

About a month ago a Washington Capitals blog called JapersRink tweeted this out: How is it that we're in November 2013 and there isn't a Twitter account that just tweets out every single NHL goal when it's scored? — JapersRink (@JapersRink) November 16, 2013 Good question. Having worked with Twitter’s API, I knew that this would be fairly easy to accomplish if only I had a source for the score information. Read more >

Parsing JSON Array With Missing Elements

Sat, Nov 23, 2013 | tags: javascript json

A project I’m working on requires me to parse JSON arrays from strings that I do not have control over. One of arrays I see frequently has empty elements at certain positions in the array. This normally isn’t a problem if done correctly, but in this case it is not done correctly. ["Thu","8:25","Info",,"Entity 1","17","Entity 2","13",,,"55999",,"November","2013"] If you try to interpret this in Javascript, you’ll get a syntax error at the fourth element when it encounters the second comma. Read more >