For changing file contents, we often use editors. But sometimes it is a good idea to do this from a script and do a change to many files at once or do the same kind of changes often. The classic approach to this is using sed, which is made exactly for this purpose. But most …
Schlagwort-Archive: Perl programming language
Perl Scripts for editing
Even though we do have IDEs with quite powerful refactoring mechanisms for many languages, it is still sometimes useful, to have another automated editing mechanism. Why would that be the case? Some examples: In some cases there was an SQL script to create the database tables, which had been written first. From that classes and …
JSON instead of Java Serialization: The solution?
We start recognizing that Serialization is not such a good idea. It is cool and can really work on a wide range of objects, even including complex and cyclic reference graphs. And it was essential for some older Java frameworks like EJB and RMI, which allowed remote access to Java objects and classes. But it …
„JSON instead of Java Serialization: The solution?“ weiterlesen
Perl and Scala: what can they learn from each other?
Ironically Scala at first drew my interest, because I discovered that about ten years ago there was no really good understanding of how to do a good multithreading concept for Perl 6. I thought exploring how they do it in Scala, where it was already known to be good at that time, would give a …
„Perl and Scala: what can they learn from each other?“ weiterlesen
Exceptions to implement Program Logic
Sometimes it is conveniant to use exceptions for implementing the regular program logic. Assuming we want to find some data and then process them. When no data is found, this step can be skipped, because there is nothing to do. So we could program something like this: public Data readData(Param param) { Data data = db.read(param); if (data.isEmpty()) { throw new NotFoundException(„nothing found“); } return data; } public ProcessedData doWork(Param param) { …
Why am I learning Python
To be honest, what can be done with Python can also be done with Perl or Ruby. I am not working in areas, where there is much better library support for Python than for Perl or Ruby. And I like Perl and Ruby very much and I am somewhat skeptical about Python. But there are …
Meaningless Whitespace in Textfiles
We use different file formats that are more or less tolerant to certain changes. Most well known is white space in text files. In some programming languages white space (space, newline, carriage return, form feed, tabulator, vertical tab) has no meaning, as long as any whitespace is present. Examples for this are Java, Perl, Lisp …
Loops with unknown nesting depth
We often encounter nested loops, like for (i = 0; i < n; i++) { for (j = 0; j < m; j++) { doSomething(i, j); } } This can be nested to a few more levels without too much pain, as long as we observe that the number of iterations for each level need …
Devoxx 2017
I was lucky to get a chance to visit Devoxx in Antwerp the sixth time in a row. As always there were interesting talks to listen to. Some issues that were visible across different talks: Java 9 is now out and Java 8 will soon go into the first steps of deprecation. The step of …
Perl 5 and Perl 6
We have now two Perls. Perl 5, which has been around for more than 20 years just as the „Perl programming language“ and Perl 6, which has been developed for more than a decade and of which now stable versions exist. The fact, that they are both called „Perl“ is a bit misleading. They are …