Automatic editing

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 …

Share Button

Git for Linux System Engineering

Now that git has become the standard version control software, which is used by software developers. Now for system engineering and system administration purposes it used to be an approach to just login and do something and remember it or even note it somewhere. Some people tried to just use RCS or SCCS on the …

Share Button

Perl & Java

How do we use Perl and Java together? Unlike many other languages, that for example run in the JVM, it is not particularly easy to combine them. But that is not the idea. A good starting point is thinking about houses and furniture. While it is perfectly possible to build houses of wood or furniture …

Share Button

How to rename files according to a pattern

We often encounter situations, where a large number of files should be copied or renamed or moved or something like that. This can be done on the Linux command line, but it should be possible in almost the same way on the Unix/Linux/Cygwin-command line of newer MS-Windows or MacOS-X. Now people routinely do that and …

Share Button

Comparing Images

A practical problem that I have is to sort my digital photos. Some of them have been taken with analog cameras and they have been scanned. Some of them have been scanned several times, using different resolution, different providers or different technologies. So one issue that occurs is having two directories which contain more or …

Share Button

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 …

Share Button

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 …

Share Button

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 …

Share Button

How to get rid of these HTML-entities in Files

It has been written here that HTML-entities (these ä etc) should be avoided with the exception of those that we need due to the HTML-syntax like <, >, & and maybe " and  . They were already mostly obsolete more than 20 years ago, but in those days we still did not automatically use UTF-8 …

Share Button

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) { …

Share Button