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?

(more…)

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.

(more…)

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 😉.

Read More

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.
(more…)

Read More