Find Missing Files in a Backup

Long time no write… I had many ideas for blog posts, but no time to write them. Hopefully, this will change soon. Here just a small update… As you know (if you read my blog), I have a “special” way of storing and “backupping” my files. All my documents are stored in a folder named YYYY/ (e.g. 2021) and have the format YYYYMMDD-<some-name>.<some-ending>. I further categorize my files by using macOS tags.

Every year I prepare a folder tax-YYYY/, where I copy all the files with relevance to my tax declaration. But sometimes I am not completely sure whether all the files in there are in my main YYYY/ folders, too. This is, because I copy files from my e-mail (like invoices) and some files, which relate to year YYYY are from YYYY+1, e.g. the proof of social security. So, after finishing the tax declaration I double check, whether every file that belongs to a year made its way into the corresponding folder with a dedicated unix command (here exemplarily for 2019). For sure this can be used to check the completeness of backup folders, too. A recursive variant may even be used to search complete backups for missing duplicates/files. So here is the command.

ls 2019* | while read file; do; \
found=$(find ../2019 -name $file | wc -l); \
if [ $found -eq 0 ]; then; echo $file; fi; \
done 

Be aware, that this does only search for a file with the same name. It does not check whether it is not the same file (e.g. due to file changes). This can be done by using a hashing algorithm

Exciting 🤓.

Enhancing Mustache via an if-Statement with EL

Mustache is a well-adopted template language which itself says that it is logic-less. So, there are pseudo-logic statements, which allow to iterate over a list or do a null-check, and it is possible to add arbitrary (unparameterized) template function. But they make a hold when it comes to an if-statement with a boolean check.

There is a lot of discussion going on in the nettm on why a null-check and template functions are ok, but an if-statement and parameters are not… but hey we have template functions, so why not add our own implementation of such things?

Read More

Convert Markdown to PDF

Lately, I wrote a small text in markdown and felt the need to share it with someone (non-technical). I searched for solutions to convert markdown to PDF and was very surprised, that there were only so-so solutions. After some googling and coding I found an easy to use solution which comprises a markdown tool for converting markdown to html and phantomJS (a headless WebKit scriptable) for converting html to pdf. The cool things: hyperlinks and custom css work.

Read More

Coexistence of Graphical and Textual DSLs

A major part of my research/work at the university and in some of my personal projects is about integrating business experts into the development process. You can read more about it in my dissertation. We reincarnated a very ambitious project, which now focuses on modeling complete web applications. We defined different interconnected graphical DSLs (Domain-Specific Languages) with Cinco and allow to one-click generate and deploy it on an application server. I am very excited about this great project and some of my posts are (and will be) inspired by it.

As of recently, we use XText as an alternative serialization format to XMI for our graphical DSLs. XText languages have some nice properties over XMI, like syntax highlighting, scoping, validation, just not being XML, compatibility with VCS, etc.. But most important it is much easier to “repair” XText models after a format/meta model change, than with a graphical editor (which just ignores friendly inquiries to open an incompatible file), or with XMI (trust me it is a 😵).

This brings me near to a dream I already have for quite some time: Bringing together textual and graphical DSLs to describe the same model. This is so great because all these integration efforts of business experts (i.e. non-programmers) into the development process is up-to-now a one-way approach. But with a textual representation both the technical and the business experts are likely to use (different views on) the same modeling artifact. Since December 2015 XText (2.9.x) supports IntelliJ IDEA, some web editors as well as standalone usage besides Eclipse. This is great news again (although I have some problems to get it up and running the way I would like to. But more on that later)!

So stay tuned, to news regarding this great new project called DIME (Dynamic web application Integrated Modeling Environment).

Exciting 😉.

Apple Swift: Emulate Partial Fully Applied Functions

This article is only a short one, that tells an obvious fact, but I love it; hence, I will let you participate. Currently, I am doing a project with the new language Swift from Apple. Swift is a object-functional language like e.g. Scala.

Both languages have the nice functionality partial application of functions. This means you can set some of the parameters which returns a function that has the remaining parameters, only. So, it is not yet executed, but the already passed parameters are stored into the partial applied function and used if it is called with the rest of the parameters. Just for the seek of completeness, currying is then, when a function with multiple parameters is decomposed into a chain of functions that each has exactly one parameter (this is not the same).

But hey, this should be a short one. Here comes the punch line: You can partially apply functions, so that they have only one parameter, but what if I would like to preset all the parameters? It is very simple: Use a closure to create a new anonymous function, that simply executes the function of interest with all its parameters.
Read More