Progressive Web Apps – bridging the gap between apps and websites

Apps, websites, mobile sites

For a long time, developers had to choose whether they would build a (mobile) web site or an app to reach their audience. Both have their own set of advantages and disadvantages. Web sites are platform independent, but lack functionality and cannot be used offline. Apps deeply integrate with the device on which they are installed but have to be developed for each platform and are not as easily updated.

Progressive (more...)

The MongoDB ObjectId explained in under 2 minutes

As you may have noticed, especially when your background is from a MySQL or Oracle database, is that the unique identifier for database records (or ‘documents’ in MongoDB) is quite different. It’s not a incremental counter, but a long string of characters. 12 bytes in hexadecimal format, to be precise. And although they appear to contain no information, they actually do. This is how an ObjectId is composed.

Let’s take an ObjectId:


The first (more...)

Node.js tutorial part 2; building a proper website

Your first fully functional Node.js application

In the first part of this tutorial we set up a development environment. As you have noticed there, the core of a Node.js application is a server side Javascript file. You will be editing this file a lot and along the while it will grow accordingly.

I think the first step you will take, is change your code so that node.js serves a proper website. This (more...)

Enforce the HTML5 max attribute of input items with JavaScript

The HTML5 max and min attribute on input items

The max attribute is introduced in HTML5 and specifies the maximum value for an <input> element. Unfortunately, it doesn’t enforce the maximum value entered when typing in numbers as you might expect.

The syntax for the HTML element is as follows:

<input max=”number|date“>

With a small JavaScript function it’s possible to make sure no value larger than the max value (or smaller (more...)

How to compare Mongo _id’s in Javascript

How to compare Mongo _id’s in Javascript

When comparing MongoDB generated _id fields in Javascript, you’ll soon or later find out that the following code will not give expected results:

var id1 = mongoose.Types.ObjectId('58a0625246cb87062919eb62');
var id2 = mongoose.Types.ObjectId('58a0625246cb87062919eb62');
if (id1===id2) {
 console.log('elements are equal but we dont get here!' );

Although this appears a valid comparison, the console.log will never be printed. ObjectId’s are objects, and although (more...)