How Politics Work

I told my son, “You will marry the girl I choose.”
He said, “NO!”

I told him, “She is Bill Gates’ daughter.”
He said, “OK.”

I called Bill Gates and said, “I want your daughter to marry my son.”
Bill Gates said, “NO.”

I told Bill Gates, My son is the CEO of World Bank.”
Bill Gates said, “OK.”

I called the President of World Bank and asked him to make my son the CEO.
He said, “NO.”

I told him, “My son is Bill Gates’ son-in-law.”
He said, “OK.”

This is exactly how politics works . . . Thanks Bill Keller for the story!

Posted in Allgemein | Leave a comment

Referenz oder Pointer im Funktionsaufruf, was kann man nutzen?

Referenzen können nicht all das erledigen, was Pointer (Zeiger) erledigen können. Dennoch tragen sie enorm zur Lesbarkeit des Quellcodes durch Entfernung expliziter Dereferenzierung bei. Insbesondere bei Veränderung von Argumenten im Innern von Methoden.

Continue reading

Posted in C++, Java | Leave a comment

Regex für Akzente in der Internationalisierung

Die Internationalisierung schreitet vorran. Um dem gerecht zu werden, kann sich ein Entwickler mit der Validierung von Eingaben auch mit Zeichen beschäftigen. Im deutschen Alphabet kommen viele Zeichen nicht vor.

Herausforderung

Sicherlich wird es immer schwieriger, je andersartiger die Zeichen zur nativen Sprachen werden. Hier denke ich beispielsweise ans Kyrillische oder Chinesische. Aber auch einfache Prüfungen können bereits fehlschlagen, sollte man sich darüber keine Gedanken machen. Allein beim Namen “André” schlägt ein Regulärer Ausdruck fehl, der auf das deutsche Alphabet prüft.

Hier finden sich einige reguläre Ausdrücke zur Erkennung von Buchstaben mit Akzenten.

x = new RegExp("^[a-zÀ-ÿ]+$",'i');
x.test("Hallo"); // true
x.test("Hàllò"); // true
x.test("Hallo123"); // false

update für UTF-8 Probleme:

x = new RegExp("^[a-z\u00E0-\u00FC]+$",'i');

Hut - Internationalisierung

Posted in JavaScript | Leave a comment

Rest HATEOAS, was ist das?

HATEOAS (Hypermedia as the Engine of Application State) is a constraint of the REST application achitecture.

A hypermedia-driven site provides information to navigate the site’s REST interfaces dynamically by including hypermedia links with the responses. This capability differs from that of SOA-based systems and WSDL-driven interfaces. With SOA, servers and clients usually must access a fixed specification that might be staged somewhere else on the website, on another website, or perhaps distributed by email.

Continue reading

Posted in Allgemein | Leave a comment

How To Set Up MySQL Master-Master Replication

Intro

This second installment of “Scaling Web Applications” will list out the steps necessary for scaling a mysql deployment over two VPS.

The first article in this series laid out the steps needed to load-balance nginx over two VPS, and it is recommended that you read that article first.

MySQL replication is the process by which a single data set, stored in a MySQL database, will be live-copied to a second server. This configuration, called “master-slave” replication, is a typical setup. Our setup will be better than that, because master-master replication allows data to be copied from either server to the other one. This subtle but important difference allows us to perform mysql read or writes from either server. This configuration adds redundancy and increases efficiency when dealing with accessing the data.

Continue reading

Posted in Allgemein, PHP | Leave a comment