Trading durability for performance without NoSQL

Developers turn to NoSQL solutions whenever they are confronted with a DBMS (write) performance challenge. I think that in most of the cases that is an exceptionally bad idea. By choosing NoSQL you trade the A, C and I from ACID for performance: Atomicity (risk of writes half succeeding, due to lack of multi-entity transactions) Consistency (risk of ambiguous data due to denormalization into multiple key/value sets) Consistency (risk of “messy” data, due to lack of schema and constraints) Isolation (risk of parallel writes on inconsistent state, due to lack of multi-entity transactions) Durability (risk of losing data by not flushing to disk, but keeping in memory) A, C and I are actually the things of ACID that I often don’t want to trade. The thing I am most willing to trade is the “D”. I don’t care that in the very unlikely event of an application or server crash a few seconds of writes are lost in exchange for a ten to hundreds times better performance. Or as they say at MongoDB: ...

May 7, 2016 · Maurits van der Schee

Debugging Go with VSCode and Delve

Go, a programming language (by Google), is now supported by Visual Studio Code (by Microsoft). It has step-by-step debugging support thanks to the Delve debugger. I am very impressed with Visual Studio Code and it’s support for the Go language. I am running Ubuntu 16.04 and everything worked flawless and even when I was missing some packages Visual Studio Code nicely informed me how to solve this. Installation of Go First we install Go and set the GOPATH variable in the “.bashrc” file: ...

April 30, 2016 · Maurits van der Schee

Parameter 2 expected to be a reference

After my recent upgrade to Ubuntu 16.04 I have been making sure all my open source PHP projects work on PHP7. I am thrilled about PHP7 as it is about 2x faster than PHP5. In my experience it brings PHP more or less on par with NodeJS in terms of execution speed. PHP Warning for “bind_param” and “bind_result” When I was porting my PHP MVC framework (MintyPHP) to PHP7 I ran into the following warning: ...

April 29, 2016 · Maurits van der Schee

Install VNC on your Ubuntu 16.04

I upgraded my HTPC from Ubuntu 14.04 to 16.04 and since the box does not have a keyboard or mouse I had to setup remote access. I chose to install x11vnc, which is easy to use, but requires tunneling over SSH to be secure. Install SSH and enable it in the firewall I chose “x11vnc”, which is easy to use and can be configured to be active during the login (greeter). It’s built-in security is not good, so it requires tunneling over SSH to be secure. That’s why we start installing an SSH server using: ...

April 24, 2016 · Maurits van der Schee

Installing PHP7 on Ubuntu 16.04

Today is the release of Ubuntu 16.04! On this release you can install the entire LAMP stack using: sudo apt-get install lamp-server^ sudo apt-get install mariadb-server mariadb-client The command “php -v” will show that PHP7 is included: $ php -v PHP 7.0.4-7ubuntu2 (cli) ( NTS ) Copyright (c) 1997-2016 The PHP Group Zend Engine v3.0.0, Copyright (c) 1998-2016 Zend Technologies with Zend OPcache v7.0.6-dev, Copyright (c) 1999-2016, by Zend Technologies If you get the following error from PHPUnit: ...

April 21, 2016 · Maurits van der Schee

Precompile Handlebars Online

I have been playing around with Handlebars and it is awesome! It is a fast JavaScript implementation of the Mustache templating language. Handlebars allows you to precompile your template into a JavaScript object that you can store in a variable and use as a function to transform JSON into HTML. I was missing an online tool to test this out, so I decided to post it here. I’ve put in some sample data to play with. ...

April 18, 2016 · Maurits van der Schee

Porting PHP-CRUD-API to C#

I have started porting PHP-CRUD-API to C#. I am doing this for the expected improved performance and also to open up this tool for people that do not program PHP. I am considering a Java and a Go port after this C# port. Porting to C# has turned out to be more work than I expected, partly because I’m not that fluid in C#. I noted that it is very good for the code quality as I am forced to re-read and re-consider every line of code I’ve written. ...

April 16, 2016 · Maurits van der Schee

A tiny polymer clone: w3component.js

I like the idea of web components in a web application. I think it well-suited for things like menus, lists and forms. I especially like the concept of having three separate files for each element on your page. Much like this 3-layered MVC separation in back-end applications. You can have a similar separation in the front-end: HTML file holding a component’s template CSS file holding the component’s styling JavaScript file holding the component’s logic I wrote a tiny library, inspired by Polymer, to support this component separation. It is named “w3component.js” and you can find the code on Github. ...

April 11, 2016 · Maurits van der Schee

PHP-CRUD-API now supports SQLite

After 1 year of slowly growing PHP-CRUD-API another milestone is reached. Today SQLite support, the fourth supported database engine, is added to the project. This feature is added in order to facilitate fast prototyping as SQLite is easy to install and configure. I want to thank Antoine Weber for his feature request and contribution to deliver this feature. A few months ago I did some research on the feasibility of a SQLite implementation. I found that there were sufficient reflection methods available for the full functionality of the reflective REST API. Other DBMS systems provide reflection using the INFORMATION_SCHEMA, which is a SQL standard. I found out that SQLite has similar functionality, but with non-standard “pragma” statements. These statements are equally powerful, but less flexible as they cannot be combined with “SELECT” or “WHERE” clauses. ...

April 7, 2016 · Maurits van der Schee

High performance C# web service using EvHttpSharp

In a previous post I announced a attempts at high performance web server implementations in some popular languages (Java, Go, C# and JavaScript). Today I will show you a C# implementation and give you instructions on how to get it running on your own machine. Source code for HttpListener example Below you find a nice and short web server written in C# that I found online. using System; using System.IO; using System.Net; using System.Text; using System.Threading; class WebServer { HttpListener _listener; public WebServer(string address) { _listener = new HttpListener(); _listener.Prefixes.Add(address); } public void Start() { _listener.Start(); while (true) { HttpListenerContext request = _listener.GetContext(); ThreadPool.QueueUserWorkItem(ProcessRequest, request); } } void ProcessRequest(object listenerContext) { var context = (HttpListenerContext)listenerContext; context.Response.StatusCode = (int)HttpStatusCode.OK; context.Response.AddHeader("Content-Type","text/html; charset=utf-8"); var msg = Encoding.UTF8.GetBytes("<h1>Hello World</h1>"); context.Response.ContentLength64 = msg.Length; context.Response.OutputStream.Write(msg, 0, msg.Length); context.Response.OutputStream.Close(); } static void Main(string[] args) { (new WebServer("http://localhost:8000/")).Start(); } } Save this file as “hello.cs” in your project folder. ...

April 4, 2016 · Maurits van der Schee