How to get the month name in the IntelliJ copyright velocity template

Every time I try to create a copyright profile in IntelliJ (or PyCharm), I find myself googling around the web trying to find out how to get the month name, e.g. August, into the template. Unfortunately, the IntelliJ documentation is not very helpful by just saying:

IntelliJ documentation about date formatting

In short, it can be done via $today.format("MMMM"), as the DateInfo implements the syntax from java.text.SimpleDateFormat, which has a long list of formatting options:

java.text.SimpleDateFormat formatting options

However, the important part is further below:

Month: If the number of pattern letters is 3 or more, the month is interpreted as text; otherwise, it is interpreted as a number.

  • Letter M produces context-sensitive month names, such as the embedded form of names. Letter M is context-sensitive in the sense that when it is used in the standalone pattern, for example, “MMMM”, it gives the standalone form of a month name and when it is used in the pattern containing other field(s), for example, “d MMMM”, it gives the format form of a month name. For example, January in the Catalan language is “de gener” in the format form while it is “gener” in the standalone form. In this case, “MMMM” will produce “gener” and the month part of the “d MMMM” will produce “de gener”. If a DateFormatSymbols has been set explicitly with constructor SimpleDateFormat(String,DateFormatSymbols) or method setDateFormatSymbols(DateFormatSymbols), the month names given by the DateFormatSymbols are used.
  • Letter L produces the standalone form of month names.

It’s important to use at least 3 letters M to have the month be printed in text form otherwise, you will get the month’s number.

With that in mind, one can now provide a decent copyright profile in IntelliJ, well, to my liking at least, anyway:

Since: $today.format("MMMM") $today.year
Author: $username
Name: $file.fileName
Description: 

Copyright $today.year Gerald Venzl

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

Which generates:

/*
 * Since: January 2022
 * Author: gvenzl
 * Name: Test.java
 * Description:
 *
 * Copyright 2022 Gerald Venzl
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

Introducing gvenzl/oracle-xe: Oracle Database XE Docker images

One of the things that kept me busy lately was experimenting with how much an Oracle XE database setup could be streamlined inside a Docker image for things like CI/CD consumption. Pretty much ever since I put together the first official build scripts for Oracle Database, people have asked for faster image pull and startup times to speed up their continuous integration tests. A lot of things have changed since then, and I’m happy that my engineering colleagues at Oracle have taken on the maintenance and further enhancements of Oracle’s official Docker build files and images, and integrated them into the internal processes.

Continue reading “Introducing gvenzl/oracle-xe: Oracle Database XE Docker images”

How to list dependencies of a rpm package via dnf

The other day while writing up the blog post How to install Oracle Database 18c XE on Oracle Linux 8 I stumbled across the question of how to list all the dependencies of a rpm package on Oracle Linux 8. The solution was easier than I thought but required some googling, so here is it for easy reference:

The dnf command provides a nice little sub command called repoquery which is equivalent to rpm -q and to the repoquery command provided by yum-utils on Linux 7. It’s quite a powerful little command which is reflected by the long list of parameters it takes. You can check for yourself by just typing dnf repoquery --help. One of these parameters is --requires which allows you to, as the documentation puts it “Display capabilities that the package depends on.

Continue reading “How to list dependencies of a rpm package via dnf”

How to install Oracle Database 18c XE on Oracle Linux 8

It has been more than two and a half years since Oracle 18c XE has been released for Linux. Since then things have changed and one of these changes was the release of Oracle Linux 8 about nine months later. Unfortunately, installing Oracle 18c XE on Oracle Linux 8 is no longer quite as straightforward as it was with Linux 7 – a simple yum command. That is because the oracle-database-preinstall-18c is not provided for Oracle Linux 8. However, installing Oracle 18c XE on Oracle Linux 8 is still possible, it just requires a few more keystrokes.

tl;dr

Execute all commands as root user:

  1. curl -OL https://download.oracle.com/otn-pub/otn_software/db-express/oracle-database-xe-18c-1.0-1.x86_64.rpm
  2. dnf install -y /bin/bash /bin/sh /etc/redhat-release bc bind-utils binutils ethtool glibc glibc-devel initscripts ksh libaio libaio-devel libgcc libstdc++ libstdc++-devel make module-init-tools net-tools nfs-utils openssh-clients pam procps psmisc smartmontools sysstat unzip util-linux-ng xorg-x11-utils xorg-x11-xauth libnsl
  3. rpm -i --nodeps oracle-database-xe-18c-1.0-1.x86_64.rpm
Continue reading “How to install Oracle Database 18c XE on Oracle Linux 8”

How to build your own Thanksgiving shopping list app with JavaScript

Thanksgiving is about to arrive in the US and, as every year, millions of people and I are preparing our shopping lists for Thanksgiving dinner. I thought this is a good opportunity to flex my coding muscles again and see how quickly I can build an online shopping list using JavaScript. To my surprise, it was easier and quicker than I originally thought and perhaps you like a little challenge yourself. Here is how it went…

Continue reading “How to build your own Thanksgiving shopping list app with JavaScript”
%d bloggers like this: