blog.gvm-it.eu
Redis Lua scripting: Four scripts to help you deal with hashes and tables

Over the past month I’ve been learning a lot about Lua scripting on a Redis server. While scripting is great, there are a few things which are a bit painfull on the interaction layer between Redis and Lua. One of those things are tables and bulk replies. With the following post I will provide you with four functions that deal with Redis bulk replies and Lua tables/dictionaries.

Read More

This article has a nice overview of general logging rules and practices, definitely worth a read.

In this opinion piece, Troy Topnik elaborates on why node.js as a platform became successful whilst other server-side JavaScript implementations rarely took off.

Introduction to the node.js EventEmitter

When you start learning node.js you soon stumble upon something called EventEmitter. The following post covers how the built-in EventEmitter works, how you can use and why it is so useful.

Read More

Extract newline seperated messages from a stream

In node.js, you are often confronted with streams that you may want to send and recieve data over. The following post provides and explains a small helper function that allows you to extract newline-separated messages from a node.js stream.

Read More

Callback conventions in node.js, how and why

When first confronted with node.js, you are not only presented with a completely new programming environment. You also encounter what is often referred to as callback hell accompanied by weird unfamiliar programming patterns. One of these is the way node treats callback functions.

The following post explains the conventions that node.js uses for its callback patterns (referred to as Continuation-passing style) and how you should implement them in order to comply.

Read More

Register all routes in a folder for your express server

Given the following problem: You have an express based webserver and you have stored all your routes in seperate files in one folder, perhaps even organized into several subfolders. You now want an easy way to apply all routes with as little effort as possible..

Meet node-walker: This little module let’s you crawl a subfolder and perform a callback on each filename that it encounters, including files in subdirectories.

Read More

Use node-walker to recursively walk over a directory and all its files. You can then iterate over all filenames to i.e. require them all one after the other. Can be installed through npm as well: npm install node-walker

Getting started with MongoDB and node.js on Windows

Earlier I wrote a little tutorial on how to get started with node.js on windows, which I now want to continue by explaining how to setup and use MongoDB with node.js in a Windows environment. This tutorial will cover:

  • Brief introduction to MongoDB
  • Installation and setup of a MongoDB database server.
  • Connecting to MongoDB using node and node-mongodb-native
  • Basic database operations through node

Read More

Getting started with node.js on Windows

The following tutorial will give you a very brief guide on how to get started with node.js on Windows. This tutorial will not tell you which third-party tools to use, this is just a plain introduction to the node.js ecosystem. This includes:

  • Install and setup node.js on windows.
  • Run a “Hello world!”-program.
  • Create a webserver program.
  • Use npm to install a module.

Read More