Angular 8 return 404 page

Returning a 404 page and setting the response status code is easy but comes with a catch: You need to run your application with Angular Universal.

Why is that?

A client side/single page application (the „normal“ app, without Angular Universal) is rendered once. The rest of the time the pages are rendered in the DOM. Which means all the magic is happening in the client browser – without any server requests (and therefore responses). The server side rendering part comes with Angular Universal.

Read the rest of this entry »

Dezember 25th, 2019

Set routing for sitemap.xml and robots.txt in Angular

The sitemap.xml and robots.txt are not part of Angulars routing per default. That means you cannot access them directly even so they are lying in your root/public folder. You have to explicitly set the routing for your sitemap.xml. Or rather, as everything that needs to be accessed publicly, define it as an asset. Same goes for the robots.txt. Just add both files to your angular.json file in the „assets“ part.

November 7th, 2019

Learning Chinese in Berlin

So I recently startet learning Chinese. My primary motivation was to learn an Asian language. The choice was between Japanese and Chinese. While both cultures are extremely interesting Japanese would have helped me to dive into the Japanese culture (especially comics and anime in its original language) and its people. However the Chinese language seemed like the more reasonable choice for what’s to come in the future. With China on the rise in every sector it feels like having a (basic) way of communicating and understanding in Chinese is the better strategic choice. Even though English will probably still be the world language #1 for the next centuries, having a second option for presenting oneself felt like a good idea.
If you happen to think about learning Chinese in Berlin, you could check out this teacher:

If you’re looking for an app to support your studies have a look at That app literally offers everything you need to improve your learnings additionally to the courses.

August 28th, 2019

jQuery/Slick slider: Uncaught TypeError: Cannot read property ‚add‘ of null

When using slick.js for creating awesome sliders, it might happen that you encounter the following error message:

Uncaught TypeError: Cannot read property 'add' of null

Chances are that you tried to initialize the slider twice (eg by switching within a responsive design or by working with an Angular App and reinitiating the slider).

The simplest solution in this case would be to add the „.not(‚.slick-initialized‘)“ method call to the chain when initiating the slider in the first place:

    slidesToScroll: 4,
    rows: 0,
    slidesToShow: 4,




Juni 18th, 2019

Run Symfony 4 with Docker

If you want to run your next Symfony 4 project within Docker the guys of medium have a great instruction for you.

However I had to additionally install the php zip extension (for docker). You can do this by adding the command

docker-php-ext-install zip



My first RUN command in .docker/php/DOCKERFILE looks as the following:

RUN apt-get update \ apt-get install -y --no-install-recommends vim curl debconf subversion git apt-transport-https apt-utils \ build-essential locales acl mailutils wget zip unzip libz-dev \ gnupg gnupg1 gnupg2 \ && docker-php-ext-install zip

Without the additional command the package for facebook/webdriver would have thrown a dependency error

If you have performance issues running your application locally on docker, you can follow the blog post of DracoBlue for more insights.

You get a better performance if you add the „:cached“ flag to your mounted php volume:

  build: .docker/php
  container_name: php_container
    - .:/home/wwwroot/app:cached
    - mysql


Mai 5th, 2019

ORDER BY clause is not in SELECT list

Just like problems with a old passwords you also might encounter the following SQL error when updating your MySQL version:

ERROR 3065 (HY000): Expression #1 of ORDER BY clause is not in SELECT list, references column 'piwigo.piwigo_images.file' which is not in SELECT list; this is incompatible with DISTINCT

The main reasons is: „As of MySQL 5.7.5, the default SQL mode includes ONLY_FULL_GROUP_BY. (Before 5.7.5, MySQL does not detect functional dependency and ONLY_FULL_GROUP_BY is not enabled by default. For a description of pre-5.7.5 behavior, see the MySQL 5.6 Reference Manual.)“ Source: MySQL docs

You have two options to solve this message: start your mysql server with –sql-mode=““ or set sql-mode=““ in /etc/my.cnf

November 24th, 2018

Fatal error: Uncaught PDOException: PDO::__construct(): The server requested authentication method unknown to the client [caching_sha2_password]

If you happen to update your MySQL it might happen that afterwards you get the following error message:

Fatal error: Uncaught PDOException: PDO::__construct(): The server requested authentication method unknown to the client [caching_sha2_password]

One (of a couple) possible solution could be to start your mysql server with the option „default-authentication-plugin“ and the „mysql_native_password“ value:

mysql.server start --default-authentication-plugin=mysql_native_password

It might also be necessary to alter your password as following:

ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'your_password';

(But don’t forget to flush your privileges with FLUSH PRIVILEGES tho)

November 24th, 2018

Monitor changes on cli live

If you want to watch or monitor a certain process on the cli (to check if changes happen) you can use the „watch“ command. For example if you want to check if a ffmpeg process is going to start or quit use the following command:

watch -n 3 „ps afx | grep ffmpeg“

In this example the command „ps afx | grep ffmpeg“ will be refreshed every 3 seconds on the cli.

Juli 6th, 2018

Javascript: onclick and onblur priority issues

Imagine you have search input field which also opens a suggest container as soon as you begin to type. Also imagine you want the suggest container to vanish as soon as you leave the search input field. You put an onblur() event on your search input field. Now you also want to click on a value of the suggest container to execute a search. The problem now is, if you use an onclick() event for triggering the search via suggest container, the onclick() event will never be triggered. The onblur() of the search input is executed before the onclick() of the suggest container. To solve this issue just swap your onclick() with a onmousedown() event.  That solution let’s the browser automatically re-order the priorities of these event handlers.

Juni 15th, 2018

Query elasticsearch with uri and get parameters

If you want to query elastic search directly via uri you can use the source parameter. This parameter helps you to fire requests like this:

curl -XGET "http://localhost:9200/employee/_search?search_type=count&pretty" -d '{
  "aggregations": {
    "profile": {
      "terms": {
        "field": "_type"
      "aggs": {
        "hits": {
          "top_hits": {
            "size": 1


directly via URL/GET:

curl -XGET 'http://localhost:9200/employee/_search?search_type=count&pretty&source={"aggregations":{"profile":{"terms":{"field":"_type"},"aggs":{"hits":{"top_hits":{"size":1}}}}}}'


Source: stackoverflow

Juni 14th, 2018