Coding trivia 1

Random interesting stuff that I learned last week

ER diagrams

Entity Relationship diagrams are important concept in database design. They help to conceptualize the relationship between tables in a database. I was looking for a quick refresher on the ER diagrams. These two videos did the job: Part 1 and Part 2

Unix sockets

You know when you’re trying to connect to MySQL and an error shows up that the socket file is missing? That’s because in MySQL the socket connection is enabled by default on localhost. What are UNIX socket files? These are files that enable two application to communicate with each other on the same machine, without the need for networking.
Here is an in-depth explanation of how they work:
http://www.techdeviancy.com/uds.html
And here’s a quick video explanation:
https://www.youtube.com/watch?v=uXve8WYiGts
More on the details of sockets:
https://stackoverflow.com/questions/14919441/principle-of-unix-domain-socket-how-does-it-work

The sticky bit

In some cases you might want to set a folder to be writable to the whole world, bu limit the scope of changes that every user could do to the files. Sticky bit limits the activity in the folder so that only the owners of the files the overall directory or root user can rename or delete . This means that users won’t be able to mess with other user’s filesĀ  and makes sense to set it in collaborative directories.

Adding it is easy with:
chmod +t test;

Wikipedia has a good explanation of the concept