Recently i decided to switch from MacOS to Linux. I was already an Ubuntu user from 2006 till 2015. So i am used to Linux. Nevertheless i struggled a little bit with the installation of PostgreSQL. For MacOS there is a nice all-in-one package which i recommend: Postgres.app. Everything works out-of-the-box there. In Ubuntu, on the other hand, we need to adjust the default installation a little bit in order to start application development....
Sometimes when i write small scripts i tend to insert print statements for debugging. After i verified the correctness of my program i want to get rid of all unnecessary debug statements. With Emacs you can delete all lines which match a specific regular expression with M-x flush-lines or with its alias M-x delete-matching-lines. Interactively you can enter your regular expression and all matching lines will be deleted from you cursor position downwards....
Yesterday Emacs 26.2 was released, see: https://www.gnu.org/software/emacs/news/NEWS.26.2
In this short guide i want to show how i install Emacs on my MacBook. I use the vanilla Emacs build from https://emacsformacosx.com/. It is just a simple .dmg file.
After installing the dmg file, Emacs is now available on your Mac as an application but not in the terminal-app. The terminal still opens the pre-install Emacs version. To make the new version available you have to create a bash-script and put it in your $PATH....
As a software programmer you often have to search and replace a specific string in multiple files because of a refactoring or just improving a variable or function name.
Normally you can use your IDE or your editor for this. But in bigger codebases with thousand or million lines of code it can be very slow. Neither do IDEs work with remote SSH-sessions. In such situations the command-line is pretty handy....
As a programmer you often search for a specific strings or regexps in multiple files. Previously i used to do this with the well-known GNU-tools find and grep.
The following command searches for main in all *.go files in the current directory and:
1 2 find . -iname '*.go' | xargs grep -inH "main" # -i ignore case, -n print line number, -H print filename Recently i discovered ag the silver searcher....
Replacing or searching text with regular expressions is very common. But sometimes it is hard to get them right and you need some playground to try them out. In order to verify regular expressions i used to visit webpages like:
https://regexr.com/ https://regex101.com/ But these webpages are optimised for perl, javascript or bash expressions and do not support Emacs regular expressions directly. In Emacs you have to consider some peculiarities....
Introduction Some years ago i was involved in migrating a big IBM Websphere monolith into a microservice landscape. We had a lot of problems with the monolith. Our development speed slowed down. We had many merge conflicts because of too many dependencies in the codebase. We outgrew the monolithic design and decided to introduce microservices. We extracted different domains like payment, booking, user and search. The teams were restructured into two-pizza teams....
A few years ago one of my colleagues “discovered” an algorithm which led to my nickname:
take the 3 first characters of my first name and surname concatenate them: DANiel + GERlach => Danger The algorithm can be implemented as a pure function in Javascript:
1 2 3 4 5 6 7 8 9 function getNickname(fullname) { return fullname .split(/\s+/) .map(n => n.substring(0,3)) ....