Call   0208 3131682   Mon-Fri 9am-6pm
Monthly Archives

June 2020

Setting up a Laravel app on Docker

By | Apache, Docker, Laravel, linux | No Comments

Rough notes, will pull this togther in a blog post at later date.

issue:

The requested URL /login/ was not found on this server.

resolution:

add to manually enable mod rewrite on command line in the container:

# launch a terminal in the container

docker exec -it e39431779799 bash

# enable modrewrite

a2enmod rewrite

/etc/init.d/apache2 reload

 

issue:

could not find driver (SQL:

resolution:

Add this to Dockerfile:

RUN docker-php-ext-install mysqli pdo pdo_mysql
run

docker-compose build

then bring it up:

docker-compose up -d

Use anonymous functions sparingly

By | Javascript, Programming Tips and Best Practices | No Comments

This is the first of a bunch of posts I’m going to write on programming tips and best practices.

This one is about Anonymous functions ( a sometimes useful technique if your going to use in one place and throw away ). 

And thats all well and good, however these make code more difficult to understand ( especially large code bases you need to maintain ).

For example imagine some code you need to maintain, lets say it starts off with a long file you need to read through and get a high level understanding of. If its littered with anonymous functions it’s makes it hard to understand (quickly, quickly being the operative word, we’re busy people after all with lots of a new features the boss wants to add).

Is this easier to understand (approach 1)

 

Than this

 

It’s quicker and easier to read and understand the 2nd code ( we don’t even need to read the function ‘toggleDisplayOfControls’ because from its name it’s obvious what it does).

To take this one step further we can nicely comment the function (toggleDisplayOfControls) at the top ( as is standard ) if needed (in my experience anonymous functions are rarely commented).