Montag, 7. Oktober 2019

How to create Nav with Angular + Angular Material

To setup a basic navigation in Angular Material, type the following command in your terminal (e.g. I am using WebStorm IDE):

$ ng generate @angular/material:material.nav -name=main-nav

This will create a component named main-nav with all basic elements, fully responsive and free to modify.

Dienstag, 10. September 2019

Find Color for CSS layout in Dreamweaver - Hex Value with Color Picker

If you need the color from an image, just 


  • enter the color attribute in your CSS, e.g.


background-color: <type Ctrl + Enter> ;


  • Choose the color-selection option, 
  • choose Color picker and 
  • place it above the image.
  • Press Enter.


The value will appear in your CSS, e.g.: 

background-color: #25787F ;


Voilà!

Mittwoch, 21. August 2019

Docker Compose Webapps Port Forwarding

Multiple Webapps Inside Docker Compose Setup

  • Learn how to setup a custom network for your containers: container A talks to container B
  • Learn how to run multiple webapps inside Docker containers on different ports with Docker Compose
  • Create the network with $docker network create skynet
  • Run with $docker-compose up
  • Stop with $<Ctrl + C>
  • Clean up from time to time (beware, network will be deleted as well) with $docker system prune -a -f





Dienstag, 20. August 2019

Docker How To Map Ports To Tomcat Application Server

How to map ports to your Tomcat application server in Docker.
Example uses Tomcat 7.

Adapt to your tomcat directory if using another version.

In Dockerfile:

#start Tomcat and map Port 8080 to Container Port 8080
RUN sed -i 's/port="8080"/port="8080"/' /opt/apache/tomcat/conf/server.xml

URL: http://localhost:8080



Example 8081:

#start Tomcat and map Port 8080 to Container Port 8081
RUN sed -i 's/port="8080"/port="8081"/' /opt/apache/tomcat/conf/server.xml

URL: http://localhost:8081

Mittwoch, 14. August 2019

Docker - How to shrink large Docker Images.

Some images become very big - one reason being that multiple RUN commands will create a layer and keep the data there. No removal.

Example:

RUN unzip myfile.war  -d mynewdirectory/
RUN zip -r myfile.war mynewdirectory/
RUN mv myfile.war somedirectory

The myfile.war will be kept. It will not be deleted by the mv command.

Reason: Docker will create a layer for each RUN command.

Solution:

RUN unzip myfile.war  -d mynewdirectory/ &&\
    zip -r myfile.war mynewdirectory/ &&\
    mv myfile.war somedirectory

Keep everything in one layer by utilizing concatenation with '&&\'.

WARNING:
Docker is highly optimized and based on Checksums.
If everything is concatenated, building an image can take very long. 

Example: COPY or ADD will check wether a change in the underlying files or source code has been made and only execute if a change is detected.
Through concatenation, you reap Docker of the benefits regarding optimization (e.g. Checksums). No check. Everything is executed.

It is a good practice to keep this in mind when concatenating instrunctions.

Donnerstag, 1. August 2019

How to make Virtualbox available on Windows via localhost

Sometimes fate forces us to work with Windows.
Because Linux is so good, we get a VirtualBox to emulate it.

How can we access a webapplication via localhost:8080 from the Windows machine inside of a Webbrowser?

VirtualBox Manager -> VM-Tools -> Settings -> Network -> Port Forwarding

Name: http8080 
Protocol: TCP
HostIP: empty
Host-Port: 8080
Guest-IP: empty
Guest-Port: 8080


Name: ssh 
Protocol: TCP
HostIP: 127.0.0.1
Host-Port: 2222
Guest-IP: empty
Guest-Port: 22

Mittwoch, 24. Juli 2019

Howto create Docker Network with Docker Compose - Communication between Services inside of a Container

Create your network named 'yournetwork':

$ docker network create -d bridge yournetwork

You have created your own network now.
Verify it by typing

$network inspect yournetwork:

In the docker-compose.yml:

networks:
  yournetwork: #TODO remove this hard-coded network reference
    external:
      name: ${NETWORK}

  yourservice:
  container_name: "your-container-name"
    image: your-image-name:${TAG:-latest} #will pull the latest                                                #tagged image of yours
    ports:
    - 8080:8080 #example localhost:8080
    net: ${NETWORK}

Start it with:

$ NETWORK=yournetwork docker-compose-up

Dienstag, 23. Juli 2019

[Solution] Maven Proxy Issue - Maven not downloading artifacts - Maven behind Proxy

Your settings.xml - mine is in etc/maven/settings.xml on Linux - must look like:

<?xml version="1.0" encoding="UTF-8"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements.  See the NOTICE file
distributed with this work for additional information
regarding copyright ownership.  The ASF licenses this file
to you 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.
-->

<settings
xmlns="http://maven.apache.org/SETTINGS/1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0                                              http://maven.apache.org/xsd/settings-1.0.0.xsd">

<pluginGroups>
</pluginGroups>

<proxies>
</proxies>

<servers>

<server>
<id>myRepository</id>
<username>your user</username>
<password>your pw</password>
<configuration>
<httpConfiguration>
<all>
<usePreemptive>true</usePreemptive>
</all>
<settings>
</settings>
</httpConfiguration>
</configuration>
</server>

</servers>

<mirrors>

<mirror>
<id>myRepository</id>
<name>Proxy for XY</name>
<url>http://<maven proxy url></url>
<mirrorOf>*,!sonar</mirrorOf>
</mirror>
</mirrors>

<profiles>

</profiles>

</settings>




Montag, 17. Juni 2019

Intellij Order Of Imports

IntelliJ sometimes changes the appearance of imports in the code on checkout when organizing imports.

To control that, one can adjust the settings:

Settings -> Editor -> Code Style -> Java -> Layout static imports separately

Change the order as you need, IntelliJ will sort the imports accordingly.

How to create Nav with Angular + Angular Material

To setup a basic navigation in Angular Material, type the following command in your terminal (e.g. I am using WebStorm IDE): $ ng generate...