Thursday, January 31, 2019

Updating from IntelliJ IDEA Community to Ultimate


  1. export settings from Community and import them to Ultimate
    (see https://intellij-support.jetbrains.com/hc/en-us/community/posts/206858965-Import-Settings-from-Community-Edition-into-Professional-Edition)
  2. install any plugin you had in Community that you miss, like:
    1. Lombok plugin
    2. VueJS plugin
      (see https://www.jetbrains.com/help/idea/vue-js.html)
    3. Markdown file previewer
    4. Java dependency analyzer
  3. add sytax highlighting for any non-default files you usually use, like:
    1. Groovy sytax highlighting to Jenkinsfile (Settings > Editor > File types > Groovy > add "Jenkinsfile*" )
      (see https://stackoverflow.com/questions/47796757/jenkinsfile-syntax-highlighting-in-java-project-using-intellij-idea)​


Tuesday, January 22, 2019

Updating to Maven 3.6.0

On Ubuntu 16.04

Default state:
  • installation directory is: /usr/share/maven
  • version is 3.3.9
Update to new version (following the official, and this and this linux specific tutorials):
  1. download newest version of maven (bin tar.gz) from https://maven.apache.org/download.cgi
  2. unpack to /opt folder (the folder for installing unbundled independent applications)
    sudo tar xvf apache-maven-*.tar.gz --directory /opt
  3. add environmental variables (see also: official reference):
    1. create script file to set the variables system wide:
      sudo gedit /etc/profile.d/maven.sh
    2. add these lines and save it (change jdk path if needed):
      ## Environmental variables needed by Maven
      export JAVA_HOME=/usr/lib/jvm/jdk-11.0.2/
    3. set the file executable
      sudo chmod +x /etc/profile.d/maven.sh
    4. log out and log in again to see its effect
  4. update alternatives for the specific new version (change path if needed)
    sudo update-alternatives --install "/usr/bin/mvn" "mvn" "/opt/apache-maven-3.6.0/bin/mvn" 100
    sudo update-alternatives --set mvn /opt/apache-maven-3.6.0/bin/mvn
Note: With the above approach, the M2_HOME and MAVEN_HOME environmental variables are not needed, and the bin folder doesn't have to be added to the PATH manually.

On Windows 10

  1. download newest version of maven (bin zip) from https://maven.apache.org/download.cgi
  2. unpack zip to "C:\Program Files\Apache\"
  3. add "C:\Program Files\Apache\apache-maven-3.6.0\bin\" to Path environmental variable, or replace older maven version in Path variable with new one
  4. log out and log in for the environmental variable to take effect
Note: the M2_HOME and MAVEN_HOME environmental variables are not needed.

Friday, January 18, 2019

Updating to OpenJDK 11

Download OpenJDK's JDK 11 from https://jdk.java.net/11/

On Windows (10):
  1. extract zip to Program Files/Java/
  2. change JAVA_HOME environmental variable to point to the new JDK
On Ubuntu (16.04) for version 11.0.2:
  1. unpack tar.gz to /usr/lib/jvm/ (command taken from OpenJDK installation guide)
    sudo tar xvf openjdk-11*_bin.tar.gz --directory /usr/lib/jvm/
  2. update alternatives to be able to switch between other java installations (command taken from DZone guide)
    sudo sh -c 'for bin in /usr/lib/jvm/jdk-11.0.2/bin/*; do update-alternatives --install /usr/bin/$(basename $bin) $(basename $bin) $bin 100; done'
    sudo sh -c 'for bin in /usr/lib/jvm/jdk-11.0.2/bin/*; do update-alternatives --set $(basename $bin) $bin; done'
  3. don't forget to update the JAVA_HOME environmental variable if you use maven

Thursday, January 10, 2019

CSS: frequently used selectors

Basic selectors 

Wildcard selector: selects all elements
* {}
Type selector: selects all elements of the given type
div {}
Attribute selector ([]): selects all elements that has the given attribute
[src] {}
ID selector (#): selects the element with the given ID attribute
#menu {} /* or [id="menu"] {} */
Class selector (.): selects all elements with the given class attribute
.centered {} /* or [class~="centered"] {} */

Selector grouping

selector grouping (,): enables to specify common values in one place
div, #menu, .centered {}

Selector chaining

Selector chaining
div.#menu.centered[name="Menu"]:first-child::first-letter {}

Attribute value selectors

[attribute="value"] selector: selects all elements with the specified attribute and value
[target="_blank"] {}
[attribute~="value"] selector: selects all elements whose attribute value contains the specified whole word.
[title~="flower"] {}
[attribute|="value"] selector: selects all elements whose attribute value starts with the specified value, the value being a whole word or the first part of a hyphenated word.
[class|="top"] {}
[attribute^="value"] selector: selects all elements whose attribute value begins with the specified value. (like in regex)
[class^="top"] {}
[attribute$="value"] selector: selects all elements whose attribute value ends with the specified value. (like in regex)
[class$="test"] {}
[attribute*="value"] selector: selects all elements whose attribute value contains the specified value.
[class*="te"] {}

Selector combination

Descendant selector (space): matches all elements that are descendants of a specified element
div p {}
Child selector (>): selects all elements that are the immediate children of a specified element
div > p {}
Adjacent sibling selector (+): selects all elements that are the adjacent siblings of a specified element
div + p {}
General sibling selector (~): selects all elements that are siblings of a specified element
div ~ p {}