May 2012
2 posts
4 tags
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.
EventEmitter basics
There is no magic. The EventEmitter is pure JavaScript and the code of it can be found here on GitHub. The following holds true for the base EventEmitter class:
Typically the...
3 tags
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.
Why use this?
The problem with a stream is that you never know how much of a message has arrived. A common problem is that either only a part of the...
April 2012
5 posts
5 tags
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...
6 tags
Register all routes in a folder for your express...
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,...
2 tags
Iterate over all files in a folder in node.js:... →
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
5 tags
Getting started with MongoDB and node.js on...
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...
4 tags
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.
Installation
...
December 2011
1 post
Plain Text Copy And Paste - Google Chrome...
I came to the realisation that I get mad whenever I accidently paste formatted text and that I am too lazy to use CTRL + SHIFT + V, so I wrote a tiny Google Chrome extension that removes formatting and markup information from text that you copy to your clipboard: Plain Text Copy And Paste
I recently have to do a lot of copy and paste work from websites to OpenOffice Calc and I lose my mind...
November 2011
1 post
Bookmark Buttons Startpage update 1.2.2 →
I just updated the Bookmark Buttons Startpage to version 1.2.2 which fixes a problem that is recognized by the current version of Google Chrome, but not by the previous ones. Also the webstore presentation was updated in order to comply with the new formats.
The extension should update automatically over the next days, but you can manually update it if you go to the extension management window...
October 2011
1 post
Simple template wrapper for NodeJS →
I rewrote a solution by John Resig to create simple templates in JavaScript to work with node.js and added support for file loading and inline templates. Check out the examples for more information.
July 2011
5 posts
Node.js 0.5.2 - Load JSON files with require
Just a brief post: With the latest release of node.js, it is now possible to load files that only contain JSON data directly into objects using the require( [path_to_file] ) function.
Before, you had to use a function like this to achieve the same:// a function to load json data from a file
var fs = require('fs');
function loadJSONfile (filename, encoding) {
try {
// default encoding is...
My very own Flow Control module →
While toying around with Node.js, I ended up writing my own little flow control library. Check it out on GitHub and leave a comment!
2 tags
How to: Heredocs in JavaScript
The following code allows you to define multi line strings in your JavaScript code. However, it is not cross-browser compatible - some implementations will return empty strings. So why bother? Because the V8 engine - thus node.js - does support this dirty hack!
Include the following function somewhere in your code:
function heredoc(func) {
// get function code as string
var hd =...
HTML5 vs Native apps from the viewpoint of... →
I’ve been doing some testing for Diary.com over the past few months. In this article, they describe their take on choosing between using HTML5 technologies over native code when creating their mobile app.
June 2011
2 posts
How to: Enable syntax highlighting on your Tumblr... →
Dr. Nic Williams has created a simple and easy to use plugin to Tumblr which allows coders to use syntax highlighting in their blog posts. Read his (4 year old) article on syntax highlighting in Tumblr.
3 tags
Keyboard input module for node: node-prompt.js
I have been watching node.js very close over the past weeks and eventually got myself a working installation, so it was about time to code something. But what? Don’t ask why, but I ended up writing a simple module that allows you to prompt input in your node process window.
Basically, what I wanted to have was the possibility to start up a node.js program and manually enter data without...
April 2011
1 post
Creating my first iPhone webapp: Pulse Meter
I have finally found something to turn into a more or less usefull webapp for the iPhone: A pulse meter which allows to quickly fetch a persons pulse. You can try the app by opening this link. Below there is a brief introduction and a user manual.
The reason why I came up with this is the following: In the hospital, from time to time, you need to manually take a patients pulse. Usually you would...
March 2011
4 posts
Bookmark Buttons Startpage v1.2.1 released
I just released the new version of the Bookmark Buttons Startpage. This is a minor update which fixes an annoying glitch and provides a few new features. You may need to manually update the extension from the extensions menu, otherwise Google may take its time to do so automatically.
The following things have been changed:
The behaviour of opening links has changed and thereby fixes the issue...
Coming soon: Version 1.2.1 of the Bookmark Button...
I am about to release the next minor version of the Bookmark Button startpage which fixes an annoying bug which rose with version 10 of the Google Chrome webbrowser.
The problem was the following: Whenever you would open a bookmark, app or just any link on the page, the adres bar at the top of the tab would not display the adres where you were at. This is mostly a cosmetic problem, but still a...
Bookmark Buttons Startpage has 400 users!
The new statistics from the Google Webstore just came in and they show that the Bookmark Buttons Startpage now has exactly 400 users worldwide! That is about 100 more users than two weeks ago. Needless to say, I’m very happy about this growth and I will soon go back to developing the next version!
Fooling around with TiltShiftGen for iOS
After eventually buying myself an iPhone, I recently stumbled upon an app called TiltShiftGen that would let you manipulate photo’s so they look as if they were taken using the Tilt-Shift technique photos. In a nutshell, this allows the photographer to selectively focus an object and create scenes that oftenly look like miniatures. Here you can see what my pictures look like.
Another thing...
February 2011
3 posts
Three extensions for speeding up Google Chrome
I have been using Google Chrome for quite some time now because it used to be an extremely fast browser in comparison to others. However, with the rise of social plugins on websites, the overall performance of many web browsers suffers. So here is my review of three Chrome extensions that will give you back that speed - and more.
1. AdBlock
It is one thing to encounter ads on i.e. the search...
Finalizing version 1.2 of the Bookmark Buttons...
It has been a long time since the last update of the Bookmark Buttons Startpage and finally I am about to update it to the next version. Here is a brief example of what new features one can expect and some other thoughts.
Improved themes and appearance
Users can now fully customize the colors and background of their new tab page. It was a lot more work than I expected to implement those...
Bookmark Buttons Startpage has 300 users
About a month ago, I posted news that my Google Chrome extension has reached 100 users. Now, I am very glad to say that the extension is currently used by 299 users worldwide. I will use this opportunity to tease about the upcoming changes which I am about to implement in the all-new version 1.2 of the extension.
Whilst being busy with other things, I did not spend as much time continuing with...
January 2011
10 posts
Open multiple bookmarks with one click, a new...
I just came up with a new idea for the bookmark buttons startpage which I am going to implement with one of the upcoming updates. The idea is, that you can define a list of bookmarks that open with one single click, depending on your preferences.
Imagine that you have a list of websites that you regularily check for updates. Especially that kind of websites, that you open up in the morning when...
Proper usage of MD5 passwords
I get angry when I see someone saying things like “MD5 is not secure to store password, SHA-1 is better” because this is one of the greatest misconceptions that exist out there. With the following small guide, I will explain why the above statement is wrong and how to handle MD5 passwords properly.
Important note, 2011-01-25: I stumbled upon a much smarter solution to this....
Some thoughts on creating a browser game
Developing a browser game is a lot different than an offline or client sided application. With the following post, I will try to point out some big differences with a focus on certain pitfalls and possible solutions to them. Do not expect completeness, this is an unordered collection of thoughts.
Common bottlenecks
One of the first bottlenecks that you may encounter is that your single webserver...
Bookmark Buttons Startpage has 100 users
Tonight finally updated and showed a total of 100 users of the Bookmark Buttons Startpage extension for Google Chrome. Here I’ll also summarize some of the statistical data that I have fetched from the webstore page using Google Analytics.
First of all, the following data has been gathered from the Chrome Webstore page, not the extension itself. This is important to note as I do respect...
Bookmark Buttons Startpage 1.1 released
The latest version of the Bookmark Buttons Startpage has been uploaded to the Chrome Webstore! The bigges new feature that you will notice is that there are six new themes that you can check out.
The reason why I picked the theming issue over other changes was that I really do understand that the happy blue layout most likely did not work out for other users. This especially comes to mind when...
Coming up next: Themes for the Bookmark Button...
For the next version of the Bookmark Button Startpage browser extension I intend to add some customization support for the look and feel of the new page. I understand that the baby-blue layout may freak some people out so it’s about time to give the people more options.
I plan to give users a lot of more options, but in the first iteration of the theming module, users will be able to choose...
Replacing variables in CSS using JavaScript
Did you ever want to use variables within stylesheets? The following tutorial explains how you can load stylesheets and neatly replace variables within them with a little help from jQuery.
While I am toying around with my Bookmark Button Startpage extension for Google Chrome, I came to a point where I would want to give users the possibility to modify the default theme.
Say my theme mainly uses...
Introducing: Bookmark Button startpage
After doing some final tweaking, the Bookmark Button startpage has just now entered the Chrome web store! Are you looking for a simplistic, yet useful new tab page for your Google Chrome browser? Then this extension may just be what you need.
If you have this extension installed, your newly opened up tabs that usually show the crowded default new tab page, will display your bookmarks and apps...
Finalizing the Bookmark Button startpage
This night I spent a lot of time working on the finalization of my new extension for the Google Chrome browser. Here are just some random thoughts that occurred to me whilst doing that.
First of all, I was a little annoyed that I had to pay 5 USD in order to get access to the Google webstore developer panel. Obviously, this is to avoid spammy and abusive extensions. Still I feel a little insulted...
Motivation for a Chrome startpage replacement
So I have decided to create my own extension for Google Chrome! In the following post I will describe why I made that plugin and what I expect it to do better than what’s out there.
When you use the web a lot - especially when you work on the web - you may have a lot of sites that you don’t visit every day, but at the very least regularily. So you probably have lot of web adresses...