Monthly Archives: October 2013

Metaprogramming experiments: Selector Properties

Hello everyone!

A few days ago I wrote a post about “Virtual Instances in JavaScript with Proxy API – JSDataViews“.
It’s an approach on how to calculate the data representation of a variable at runtime with the help of the new Proxy API.

Today I want to show another feature which is part of the core of JSDataViews

Selector Properties

A lot of people are familiar with jQuery. The development of jQuery is driven by the fact that the DOM is a hierarchical, complex data structure and people need an easy way to access and manipulate different parts of it.
Since JavaScript objects can reach a similar complexity I was looking for an easy and nice way to run similar queries on them.
Continue reading Metaprogramming experiments: Selector Properties

How to install Couchbase for Node.js on a Windows 8 machine


Update: You’re reading the Couchbase Post of the Week!
pow


Working Installation

This should be a working step-by-step installation. If you’re interested in a particular error or how I got to this steps please read the article below.

1. Make sure you have python >=2.5 and < 3.0 (eg 2.7) installed 2. Download and install libcouchbase (search for windows)
2b. Ensure that your folder structure matches the
binding.gyp – (try to access C:\couchbase\bin\libcouchbase.dll in your explorer)
3. Download and install a C/C++ compiler (e.g. via Visual Studio Express for Win8)
4. Set path to python in your shell like so: set PYTHON=C:\Dev\Python27\python.exe
6. Run

(7.) If the gyp config does not match your visual studio edition use flags:

Tips for Mac Users

For additional information please refer to the node-gyp requirements page

Test it

Tugdual Grall has a simple test example on his page which unfortunately seems to be outdated. Here is a newer one:

I hope this helps some people out there 😉

Continue reading How to install Couchbase for Node.js on a Windows 8 machine

Virtual Instances in JavaScript with Proxy API – JSDataViews

Today I discovered an interesting new way of declaring variables. I used a technique to mimic a principle which is called “Views” and which is well known in the database world.

DB Views !== UI Views

On the PostgreSQL website Views are described as follows:

The view is not physically materialized. Instead, the query is run every time the view is referenced in a query.

The principle can be simply visualized using a set of data entries where each “View” builds a subset of these entries (colored boxes) when executed:

db views

Enter JS

Instead of declaring the final variable/dataset for the View we will create a function that behaves like a View object. I’ll call this a Virtual Instance since the data for this View is not existent before it is accessed. Instead, the function is evaluated and brings data into the  variable at runtime.
Continue reading Virtual Instances in JavaScript with Proxy API – JSDataViews