tag:blogger.com,1999:blog-5748160065721099472024-03-14T00:12:27.244-07:00Good News from the IT Crowd - Day In Life: IT ConsultantTim Harder (Owner of Harder IT Consulting)http://www.blogger.com/profile/11732226431914526209noreply@blogger.comBlogger39125tag:blogger.com,1999:blog-574816006572109947.post-40323227196128302012020-02-27T08:12:00.001-08:002020-02-27T08:12:14.573-08:00NEW BLOG! http://cleancode.consulting/Dear Reader,<br />
<br />
This Blog is closed and remains as an archive.<br />
<br />
Please find our new Blog at <a href="http://cleancode.consulting/" target="_blank">http://cleancode.consulting/</a>Tim Harder (Owner of Harder IT Consulting)http://www.blogger.com/profile/11732226431914526209noreply@blogger.com0tag:blogger.com,1999:blog-574816006572109947.post-82093622199706481872019-10-07T07:16:00.001-07:002019-10-07T07:56:49.750-07:00How to create Nav with Angular + Angular Material<span style="font-family: "verdana" , sans-serif;">To setup a basic navigation in Angular Material, type the following command in your terminal (e.g. I am using WebStorm IDE):</span><br />
<span style="font-family: "courier new" , "courier" , monospace;"><br /></span>
<span style="font-family: "courier new" , "courier" , monospace;">$ ng generate @angular/material:material.nav -name=main-nav</span><br />
<span style="font-family: "courier new" , "courier" , monospace;"><br /></span>
<span style="font-family: "verdana" , sans-serif;">This will create a component named main-nav with all basic elements, fully responsive and free to modify.</span>Tim Harder (Owner of Harder IT Consulting)http://www.blogger.com/profile/11732226431914526209noreply@blogger.com0tag:blogger.com,1999:blog-574816006572109947.post-54505203830039916832019-09-10T07:45:00.001-07:002019-09-10T07:45:13.917-07:00Find Color for CSS layout in Dreamweaver - Hex Value with Color Picker<span style="font-family: Verdana, sans-serif;">If you need the color from an image, just </span><br />
<span style="font-family: Verdana, sans-serif;"><br /></span>
<br />
<ul>
<li><span style="font-family: Verdana, sans-serif;">enter the color attribute in your CSS, e.g.</span></li>
</ul>
<br />
<span style="font-family: Courier New, Courier, monospace;"><br /></span>
<span style="font-family: Courier New, Courier, monospace;">background-color: <type Ctrl + Enter> ;</span><br />
<span style="font-family: Verdana, sans-serif;"><br /></span>
<br />
<ul>
<li><span style="font-family: Verdana, sans-serif;">Choose the color-selection option, </span></li>
<li><span style="font-family: Verdana, sans-serif;">choose Color picker and </span></li>
<li><span style="font-family: Verdana, sans-serif;">place it above the image.</span></li>
<li><span style="font-family: Verdana, sans-serif;">Press Enter.</span></li>
</ul>
<br />
<span style="font-family: Verdana, sans-serif;"><br /></span>
<span style="font-family: Verdana, sans-serif;">The value will appear in your CSS, e.g.: </span><br />
<span style="font-family: Courier New, Courier, monospace;"><br /></span>
<span style="font-family: "Courier New", Courier, monospace;">background-color: </span><span style="font-family: "Courier New", Courier, monospace;"><span style="color: red;"><b>#25787F</b></span></span><span style="font-family: "Courier New", Courier, monospace;"> ;</span><br />
<span style="font-family: "Courier New", Courier, monospace;"><br /></span>
<span style="font-family: "Courier New", Courier, monospace;"><br /></span>
<span style="font-family: Verdana, sans-serif;">VoilĂ !</span>Tim Harder (Owner of Harder IT Consulting)http://www.blogger.com/profile/11732226431914526209noreply@blogger.com0tag:blogger.com,1999:blog-574816006572109947.post-25083743226689647972019-09-06T08:13:00.000-07:002019-09-06T08:13:59.545-07:00RESTful Java Jersey JAX-RS Unit Test embedded Jetty Maven Webapp Download<h2>
<span style="background-color: white; color: #586069; font-family: , "blinkmacsystemfont" , "segoe ui" , "helvetica" , "arial" , sans-serif , "apple color emoji" , "segoe ui emoji" , "segoe ui symbol"; font-size: 14px;">HOWTO create a Java Webapp with JSON, REST and UNIT Test</span></h2>
<span style="background-color: white; color: #586069; font-family: , "blinkmacsystemfont" , "segoe ui" , "helvetica" , "arial" , sans-serif , "apple color emoji" , "segoe ui emoji" , "segoe ui symbol"; font-size: 14px;">RESTful Java Jersey JAX-RS Unit Test embedded Jetty Maven Webapp Download.</span><br />
<span style="background-color: white; color: #586069; font-family: , "blinkmacsystemfont" , "segoe ui" , "helvetica" , "arial" , sans-serif , "apple color emoji" , "segoe ui emoji" , "segoe ui symbol"; font-size: 14px;"><br /></span>
<span style="background-color: white; color: #586069; font-family: , "blinkmacsystemfont" , "segoe ui" , "helvetica" , "arial" , sans-serif , "apple color emoji" , "segoe ui emoji" , "segoe ui symbol"; font-size: 14px;"><a href="https://github.com/harderitconsulting/restful-webapp-watchstore" target="_blank">DOWNLOAD Source Code</a></span>Tim Harder (Owner of Harder IT Consulting)http://www.blogger.com/profile/11732226431914526209noreply@blogger.com0tag:blogger.com,1999:blog-574816006572109947.post-85279522295628963562019-08-21T02:42:00.001-07:002019-10-01T05:14:52.933-07:00Docker Compose Webapps Port Forwarding<h1 style="background-color: white; border-bottom: 1px solid rgb(234, 236, 239); box-sizing: border-box; color: #24292e; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol"; line-height: 1.25; margin-bottom: 16px; margin-left: 0px; margin-right: 0px; margin-top: 0px !important; padding-bottom: 0.3em;">
Multiple Webapps Inside Docker Compose Setup</h1>
<ul style="background-color: white; box-sizing: border-box; color: #24292e; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol"; font-size: 16px; margin-bottom: 0px !important; margin-top: 0px; padding-left: 2em;">
<li style="box-sizing: border-box;"><div style="box-sizing: border-box; margin-bottom: 16px; margin-top: 16px;">
Learn how to setup a custom network for your containers: container A talks to container B</div>
</li>
<li style="box-sizing: border-box; margin-top: 0.25em;"><div style="box-sizing: border-box; margin-bottom: 16px; margin-top: 16px;">
Learn how to run multiple webapps inside Docker containers on different ports with Docker Compose</div>
</li>
</ul>
<div>
<span style="color: #24292e; font-family: , "blinkmacsystemfont" , "segoe ui" , "helvetica" , "arial" , sans-serif , "apple color emoji" , "segoe ui emoji" , "segoe ui symbol";"><br /></span>
<span style="color: #24292e; font-family: , "blinkmacsystemfont" , "segoe ui" , "helvetica" , "arial" , sans-serif , "apple color emoji" , "segoe ui emoji" , "segoe ui symbol"; font-size: large;"><a href="https://github.com/harderitconsulting/dockerComposeMultiWebappDemo" style="font-family: verdana, sans-serif;" target="_blank">Download complete source code here</a></span><br />
<span style="color: #24292e; font-family: , "blinkmacsystemfont" , "segoe ui" , "helvetica" , "arial" , sans-serif , "apple color emoji" , "segoe ui emoji" , "segoe ui symbol";"><br /></span></div>
<ul style="background-color: white; box-sizing: border-box; color: #24292e; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol"; font-size: 16px; margin-bottom: 0px !important; margin-top: 0px; padding-left: 2em;">
<li style="box-sizing: border-box; margin-top: 0.25em;"><div style="box-sizing: border-box; margin-bottom: 16px; margin-top: 16px;">
Create the network with <span style="font-family: "courier new" , "courier" , monospace;">$docker network create skynet</span></div>
</li>
<li style="box-sizing: border-box; margin-top: 0.25em;"><div style="box-sizing: border-box; margin-bottom: 16px; margin-top: 16px;">
Run with <span style="font-family: "courier new" , "courier" , monospace;">$docker-compose up</span></div>
</li>
<li style="box-sizing: border-box; margin-top: 0.25em;"><div style="box-sizing: border-box; margin-bottom: 16px; margin-top: 16px;">
Stop with <span style="font-family: "courier new" , "courier" , monospace;">$<Ctrl + C></span></div>
</li>
<li style="box-sizing: border-box; margin-top: 0.25em;"><div style="box-sizing: border-box; margin-bottom: 16px; margin-top: 16px;">
Clean up from time to time (beware, network will be deleted as well) with <span style="font-family: "courier new" , "courier" , monospace;">$docker system prune -a -f</span></div>
</li>
<li style="box-sizing: border-box; margin-top: 0.25em;"><div style="box-sizing: border-box; margin-bottom: 16px; margin-top: 16px;">
access via <a href="http://localhost:8080/sample" rel="nofollow" style="background-color: transparent; box-sizing: border-box; color: #0366d6; text-decoration-line: none;">http://localhost:8080/sample</a></div>
</li>
<li style="box-sizing: border-box; margin-top: 0.25em;"><div style="box-sizing: border-box; margin-bottom: 16px; margin-top: 16px;">
access via <a href="http://localhost:8081/sample" rel="nofollow" style="background-color: transparent; box-sizing: border-box; color: #0366d6; text-decoration-line: none;">http://localhost:8081/sample</a></div>
</li>
</ul>
<br />
<br />
<br />
<br />
<br />Tim Harder (Owner of Harder IT Consulting)http://www.blogger.com/profile/11732226431914526209noreply@blogger.com0tag:blogger.com,1999:blog-574816006572109947.post-72170645946439742162019-08-20T02:24:00.001-07:002019-08-20T06:54:09.233-07:00Docker How To Map Ports To Tomcat Application Server<span style="font-family: "verdana" , sans-serif;">How to map ports to your Tomcat application server in Docker.<br />Example uses Tomcat 7.</span><br />
<span style="font-family: "verdana" , sans-serif;">Adapt to your tomcat directory if using another version.</span><br />
<span style="font-family: "verdana" , sans-serif;"><br /></span>
<span style="font-family: "verdana" , sans-serif;">In Dockerfile:</span><br />
<span style="font-family: Courier New, Courier, monospace;"><br /></span>
<span style="font-family: Courier New, Courier, monospace;">#start Tomcat and map Port 8080 to Container Port 8080</span><br />
<span style="font-family: "courier new" , "courier" , monospace;">RUN sed -i 's/port="8080"/port="8080"/' /opt/apache/tomcat/conf/server.xml</span><br />
<span style="font-family: "courier new" , "courier" , monospace;"><br /></span>
<span style="font-family: Verdana, sans-serif;">URL:</span><span style="font-family: "courier new" , "courier" , monospace;"> http://localhost:8080</span><br />
<span style="font-family: "courier new" , "courier" , monospace;"><br /></span>
<span style="font-family: "verdana" , sans-serif;"><br /></span><br />
<span style="font-family: "verdana" , sans-serif;">Example 8081:</span><br />
<br />
<span style="font-family: Courier New, Courier, monospace;">#start Tomcat and map Port 8080 to Container Port 8081</span><br />
<div>
<span style="font-family: "courier new", courier, monospace;">RUN sed -i 's/port="8080"/port="8081"/' /opt/apache/tomcat/conf/server.xml</span></div>
<span style="font-family: "courier new" , "courier" , monospace;"><br /></span>
<span style="font-family: "courier new" , "courier" , monospace;"><span style="font-family: Verdana, sans-serif;">URL:</span><span style="font-family: "courier new" , "courier" , monospace;"> http://localhost:8081</span></span>Tim Harder (Owner of Harder IT Consulting)http://www.blogger.com/profile/11732226431914526209noreply@blogger.com0tag:blogger.com,1999:blog-574816006572109947.post-52529550198562960372019-08-14T02:48:00.000-07:002019-10-08T02:28:37.403-07:00Docker - How to shrink large Docker Images.<span style="font-family: "verdana" , sans-serif;">Some images become very big - one reason being that multiple RUN commands will create a layer and keep the data there. No removal.</span><br />
<span style="font-family: "verdana" , sans-serif;"><br /></span>
<span style="font-family: "verdana" , sans-serif;"><b>Example:</b></span><br />
<span style="font-family: "verdana" , sans-serif;"><br /></span>
<span style="font-family: "courier new" , "courier" , monospace;">RUN unzip myfile.war -d mynewdirectory/</span><br />
<span style="font-family: "courier new" , "courier" , monospace;">RUN zip -r myfile.war mynewdirectory/</span><br />
<span style="font-family: "courier new" , "courier" , monospace;">RUN mv myfile.war somedirectory</span><br />
<span style="font-family: "verdana" , sans-serif;"><br /></span>
<span style="font-family: "verdana" , sans-serif;">The myfile.war will be kept. It will not be deleted by the mv command.</span><br />
<span style="font-family: "verdana" , sans-serif;"><br /></span>
<span style="font-family: "verdana" , sans-serif;"><b>Reason:</b> Docker will create a layer for each RUN command.</span><br />
<span style="font-family: "verdana" , sans-serif;"><br /></span>
<span style="font-family: "verdana" , sans-serif;"><b>Solution:</b></span><br />
<span style="font-family: "verdana" , sans-serif;"><br /></span>
<span style="font-family: "courier new" , "courier" , monospace;">RUN unzip myfile.war -d mynewdirectory/ &&\</span><br />
<span style="font-family: "courier new" , "courier" , monospace;"> zip -r myfile.war mynewdirectory/ &&\</span><br />
<span style="font-family: "courier new" , "courier" , monospace;"> mv myfile.war somedirectory</span><br />
<span style="font-family: "verdana" , sans-serif;"><br /></span>
<span style="font-family: "verdana" , sans-serif;">Keep everything in one layer by utilizing concatenation with '&&\'.</span><br />
<span style="font-family: "verdana" , sans-serif;"><br /></span>
<span style="color: red; font-family: "verdana" , sans-serif;"><b>WARNING:</b></span><br />
<span style="font-family: "verdana" , sans-serif;">Docker is highly optimized and based on Checksums.</span><br />
<span style="font-family: "verdana" , sans-serif;">If everything is concatenated, building an image can take very long. </span><br />
<span style="font-family: "verdana" , sans-serif;"><br /></span>
<span style="font-family: "verdana" , sans-serif;">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.</span><br />
<span style="font-family: "verdana" , sans-serif;">Through concatenation, you reap Docker of the benefits regarding optimization (e.g. Checksums). No check. Everything is executed.</span><br />
<span style="font-family: "verdana" , sans-serif;"><br /></span>
<span style="font-family: "verdana" , sans-serif;">It is a good practice to keep this in mind when concatenating instrunctions.</span><br />
<span style="font-family: "verdana" , sans-serif; font-size: x-small;"><br /></span>
Tim Harder (Owner of Harder IT Consulting)http://www.blogger.com/profile/11732226431914526209noreply@blogger.com0tag:blogger.com,1999:blog-574816006572109947.post-17662585334660042872019-08-01T08:13:00.001-07:002019-08-01T08:13:01.561-07:00How to make Virtualbox available on Windows via localhost<span style="font-family: Verdana, sans-serif;">Sometimes fate forces us to work with Windows.</span><br />
<span style="font-family: Verdana, sans-serif;">Because Linux is so good, we get a VirtualBox to emulate it.</span><br />
<span style="font-family: Verdana, sans-serif;"><br /></span>
<span style="font-family: Verdana, sans-serif;">How can we access a webapplication via localhost:8080 from the Windows machine inside of a Webbrowser?</span><br />
<span style="font-family: Verdana, sans-serif;"><br /></span>
<span style="font-family: Verdana, sans-serif;">VirtualBox Manager -> VM-Tools -> Settings -> Network -> Port Forwarding</span><br />
<span style="font-family: Verdana, sans-serif;"><br /></span>
<span style="font-family: Verdana, sans-serif;"><b>Name:</b> http8080 </span><br />
<span style="font-family: Verdana, sans-serif;"><b>Protocol:</b> TCP</span><br />
<span style="font-family: Verdana, sans-serif;"><b>HostIP:</b> empty</span><br />
<span style="font-family: Verdana, sans-serif;"><b>Host-Port:</b> 8080</span><br />
<span style="font-family: Verdana, sans-serif;"><b>Guest-IP:</b> empty</span><br />
<span style="font-family: Verdana, sans-serif;"><b>Guest-Port:</b> 8080</span><br />
<span style="font-family: Verdana, sans-serif;"><br /></span>
<span style="font-family: Verdana, sans-serif;"><br /></span>
<span style="font-family: Verdana, sans-serif;"><b>Name:</b> ssh </span><br />
<span style="font-family: Verdana, sans-serif;"><b>Protocol:</b> TCP</span><br />
<span style="font-family: Verdana, sans-serif;"><b>HostIP:</b> 127.0.0.1</span><br />
<span style="font-family: Verdana, sans-serif;"><b>Host-Port:</b> 2222</span><br />
<span style="font-family: Verdana, sans-serif;"><b>Guest-IP:</b> empty</span><br />
<span style="font-family: Verdana, sans-serif;"><b>Guest-Port:</b> 22</span>Tim Harder (Owner of Harder IT Consulting)http://www.blogger.com/profile/11732226431914526209noreply@blogger.com0tag:blogger.com,1999:blog-574816006572109947.post-54628766412412100842019-07-24T05:22:00.001-07:002019-07-24T05:22:48.659-07:00Howto create Docker Network with Docker Compose - Communication between Services inside of a Container<span style="font-family: Verdana, sans-serif;">Create your network named</span><span style="font-family: Courier New, Courier, monospace;"> 'yournetwork':</span><br />
<span style="font-family: Courier New, Courier, monospace;"><br /></span>
<span style="font-family: Courier New, Courier, monospace;">$ docker network create -d bridge yournetwork</span><br />
<span style="font-family: Courier New, Courier, monospace;"><br /></span>
<span style="font-family: Verdana, sans-serif;">You have created your own network now.</span><br />
<span style="font-family: Verdana, sans-serif;">Verify it by typing</span><br />
<span style="font-family: Courier New, Courier, monospace;"><br /></span>
<span style="font-family: Courier New, Courier, monospace;">$network inspect yournetwork:</span><br />
<span style="font-family: Courier New, Courier, monospace;"><br /></span>
<span style="font-family: Verdana, sans-serif;">In the docker-compose.yml:</span><br />
<span style="font-family: Courier New, Courier, monospace;"><br /></span>
<span style="font-family: Courier New, Courier, monospace;">networks:</span><br />
<span style="font-family: Courier New, Courier, monospace;"> yournetwork: #TODO remove this hard-coded network reference</span><br />
<span style="font-family: Courier New, Courier, monospace;"> external:</span><br />
<span style="font-family: Courier New, Courier, monospace;"> name: ${NETWORK}</span><br />
<span style="font-family: Courier New, Courier, monospace;"><br /></span>
<span style="font-family: Courier New, Courier, monospace;"> yourservice:</span><br />
<span style="font-family: Courier New, Courier, monospace;"> container_name: "your-container-name"</span><br />
<span style="font-family: Courier New, Courier, monospace;"> image: your-image-name:${TAG:-latest} #will pull the latest #tagged image of yours</span><br />
<span style="font-family: Courier New, Courier, monospace;"> ports:</span><br />
<span style="font-family: Courier New, Courier, monospace;"> - 8080:8080 #example localhost:8080</span><br />
<span style="font-family: Courier New, Courier, monospace;"> net: ${NETWORK}</span><br />
<span style="font-family: Courier New, Courier, monospace;"><br /></span>
<span style="font-family: Verdana, sans-serif;">Start it with:</span><br />
<span style="font-family: Courier New, Courier, monospace;"><br /></span>
<span style="font-family: Courier New, Courier, monospace;">$ NETWORK=yournetwork docker-compose-up</span>Tim Harder (Owner of Harder IT Consulting)http://www.blogger.com/profile/11732226431914526209noreply@blogger.com0tag:blogger.com,1999:blog-574816006572109947.post-45975268880869809862019-07-23T06:31:00.004-07:002019-07-23T06:36:09.739-07:00[Solution] Maven Proxy Issue - Maven not downloading artifacts - Maven behind Proxy<span style="font-family: "verdana" , sans-serif; font-size: xx-small;">Your settings.xml - mine is in <b>etc/maven/settings.xml </b>on Linux - must look like:</span><br />
<span style="background-color: white;"><br /></span>
<span style="color: blue; font-family: courier new, courier, monospace; font-size: x-small;"><?xml version="1.0" encoding="UTF-8"?></span><br />
<span style="color: #38761d; font-family: courier new, courier, monospace; font-size: x-small;"><!--</span><br />
<span style="color: #38761d; font-family: courier new, courier, monospace; font-size: x-small;">Licensed to the Apache Software Foundation (ASF) under one</span><br />
<span style="color: #38761d; font-family: courier new, courier, monospace; font-size: x-small;">or more contributor license agreements. See the NOTICE file</span><br />
<span style="color: #38761d; font-family: courier new, courier, monospace; font-size: x-small;">distributed with this work for additional information</span><br />
<span style="color: #38761d; font-family: courier new, courier, monospace; font-size: x-small;">regarding copyright ownership. The ASF licenses this file</span><br />
<span style="color: #38761d; font-family: courier new, courier, monospace; font-size: x-small;">to you under the Apache License, Version 2.0 (the</span><br />
<span style="color: #38761d; font-family: courier new, courier, monospace; font-size: x-small;">"License"); you may not use this file except in compliance</span><br />
<span style="color: #38761d; font-family: courier new, courier, monospace; font-size: x-small;">with the License. You may obtain a copy of the License at</span><br />
<br />
<span style="color: #38761d; font-family: courier new, courier, monospace; font-size: x-small;"> http://www.apache.org/licenses/LICENSE-2.0</span><br />
<br />
<span style="color: #38761d; font-family: courier new, courier, monospace; font-size: x-small;">Unless required by applicable law or agreed to in writing,</span><br />
<span style="color: #38761d; font-family: courier new, courier, monospace; font-size: x-small;">software distributed under the License is distributed on an</span><br />
<span style="color: #38761d; font-family: courier new, courier, monospace; font-size: x-small;">"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY</span><br />
<span style="color: #38761d; font-family: courier new, courier, monospace; font-size: x-small;">KIND, either express or implied. See the License for the</span><br />
<span style="color: #38761d; font-family: courier new, courier, monospace; font-size: x-small;">specific language governing permissions and limitations</span><br />
<span style="color: #38761d; font-family: courier new, courier, monospace; font-size: x-small;">under the License.</span><br />
<span style="color: #38761d; font-family: courier new, courier, monospace; font-size: x-small;">--></span><br />
<span style="color: blue; font-family: courier new, courier, monospace; font-size: x-small;"><br /></span>
<span style="color: blue; font-family: courier new, courier, monospace; font-size: x-small;"><settings</span><br />
<span style="color: blue; font-family: courier new, courier, monospace; font-size: x-small;"><span style="white-space: pre;"> </span>xmlns="http://maven.apache.org/SETTINGS/1.0.0"</span><br />
<span style="color: blue; font-family: courier new, courier, monospace; font-size: x-small;"><span style="white-space: pre;"> </span>xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"</span><br />
<span style="color: blue; font-family: courier new, courier, monospace; font-size: x-small;"> xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd"></span><br />
<span style="white-space: pre;"><span style="color: blue; font-family: courier new, courier, monospace; font-size: x-small;"> </span></span><br />
<span style="color: blue; font-family: courier new, courier, monospace; font-size: x-small;"><span style="white-space: pre;"> </span><pluginGroups></span><br />
<span style="color: blue; font-family: courier new, courier, monospace; font-size: x-small;"><span style="white-space: pre;"> </span></pluginGroups></span><br />
<span style="white-space: pre;"><span style="color: blue; font-family: courier new, courier, monospace; font-size: x-small;"> </span></span><br />
<span style="color: blue; font-family: courier new, courier, monospace; font-size: x-small;"><span style="white-space: pre;"> </span><proxies></span><br />
<span style="color: blue; font-family: courier new, courier, monospace; font-size: x-small;"><span style="white-space: pre;"> </span></proxies></span><br />
<span style="color: blue; font-family: courier new, courier, monospace; font-size: x-small;"><br /></span>
<span style="color: blue; font-family: courier new, courier, monospace; font-size: x-small;"><span style="white-space: pre;"> </span><servers></span><br />
<span style="white-space: pre;"><span style="color: blue; font-family: courier new, courier, monospace; font-size: x-small;"> </span></span><br />
<span style="font-family: courier new, courier, monospace; font-size: x-small;"><span style="color: blue; white-space: pre;"> </span><server></span><br />
<span style="font-family: courier new, courier, monospace; font-size: x-small;"><span style="white-space: pre;"> </span><id>myRepository</id></span><br />
<span style="font-family: courier new, courier, monospace; font-size: x-small;"><span style="white-space: pre;"> </span><username>your user</username></span><br />
<span style="font-family: courier new, courier, monospace; font-size: x-small;"><span style="white-space: pre;"> </span><password>your pw</password></span><br />
<span style="font-family: courier new, courier, monospace; font-size: x-small;"><span style="white-space: pre;"> </span><configuration></span><br />
<span style="font-family: courier new, courier, monospace; font-size: x-small;"><span style="white-space: pre;"> </span><httpConfiguration></span><br />
<span style="font-family: courier new, courier, monospace; font-size: x-small;"><span style="white-space: pre;"> </span><all></span><br />
<span style="font-family: courier new, courier, monospace; font-size: x-small;"><span style="white-space: pre;"> </span><usePreemptive>true</usePreemptive></span><br />
<span style="font-family: courier new, courier, monospace; font-size: x-small;"><span style="white-space: pre;"> </span></all></span><br />
<span style="font-family: courier new, courier, monospace; font-size: x-small;"><span style="white-space: pre;"> </span><settings></span><br />
<span style="font-family: courier new, courier, monospace; font-size: x-small;"><span style="white-space: pre;"> </span></settings></span><br />
<span style="font-family: courier new, courier, monospace; font-size: x-small;"><span style="white-space: pre;"> </span></httpConfiguration></span><br />
<span style="font-family: courier new, courier, monospace; font-size: x-small;"><span style="white-space: pre;"> </span></configuration></span><br />
<span style="font-family: courier new, courier, monospace; font-size: x-small;"><span style="white-space: pre;"> </span></server></span><br />
<span style="white-space: pre;"><span style="color: blue; font-family: courier new, courier, monospace; font-size: x-small;"> </span></span><br />
<span style="color: blue; font-family: courier new, courier, monospace; font-size: x-small;"><span style="white-space: pre;"> </span></servers></span><br />
<span style="white-space: pre;"><span style="color: blue; font-family: courier new, courier, monospace; font-size: x-small;"> </span></span><br />
<span style="font-family: courier new, courier, monospace; font-size: x-small;"><span style="color: blue; white-space: pre;"> </span><mirrors></span><br />
<span style="white-space: pre;"><span style="font-family: courier new, courier, monospace; font-size: x-small;"> </span></span><br />
<span style="font-family: courier new, courier, monospace; font-size: x-small;"><span style="white-space: pre;"> </span><mirror></span><br />
<span style="font-family: courier new, courier, monospace; font-size: x-small;"><span style="white-space: pre;"> </span><id>myRepository</id></span><br />
<span style="font-family: courier new, courier, monospace; font-size: x-small;"><span style="white-space: pre;"> </span><name>Proxy for XY</name></span><br />
<span style="font-family: courier new, courier, monospace; font-size: x-small;"><span style="white-space: pre;"> </span><url>http://<maven proxy url></url></span><br />
<span style="font-family: courier new, courier, monospace; font-size: x-small;"><span style="white-space: pre;"> </span><mirrorOf>*,!sonar</mirrorOf></span><br />
<span style="font-family: courier new, courier, monospace; font-size: x-small;"><span style="white-space: pre;"> </span></mirror></span><br />
<span style="font-family: courier new, courier, monospace; font-size: x-small;"><span style="white-space: pre;"> </span></mirrors></span><br />
<span style="white-space: pre;"><span style="color: blue; font-family: courier new, courier, monospace; font-size: x-small;"> </span></span><br />
<span style="color: blue; font-family: courier new, courier, monospace; font-size: x-small;"><span style="white-space: pre;"> </span><profiles></span><br />
<span style="white-space: pre;"><span style="color: blue; font-family: courier new, courier, monospace; font-size: x-small;"> </span></span><br />
<span style="color: blue; font-family: courier new, courier, monospace; font-size: x-small;"><span style="white-space: pre;"> </span></profiles></span><br />
<span style="color: blue; font-family: courier new, courier, monospace; font-size: x-small;"><br /></span>
<span style="color: blue; font-family: courier new, courier, monospace; font-size: x-small;"></settings></span><br />
<br />
<br />
<br />
<br />Tim Harder (Owner of Harder IT Consulting)http://www.blogger.com/profile/11732226431914526209noreply@blogger.com0tag:blogger.com,1999:blog-574816006572109947.post-4560967751976740482019-07-18T05:21:00.000-07:002020-01-27T03:39:10.627-08:00DOCKER - No Space Left on Device // How to clean Docker on LinuxSometimes Docker will simply claim to much space. Time for a clean up ;)<br />
<div>
<br /></div>
<div>
<span style="background-color: #f8f8f8; color: #333333; font-family: "consolas" , "menlo" , "monaco" , "lucida console" , "liberation mono" , "dejavu sans mono" , "bitstream vera sans mono" , "courier new" , monospace; font-size: 14px;">docker system prune -a -f</span></div>
<div>
<br />
<span style="color: red;"><b>Attention:</b></span> if your network is not in the default, this command will eventually erase your subnet immediately.</div>
Tim Harder (Owner of Harder IT Consulting)http://www.blogger.com/profile/11732226431914526209noreply@blogger.com0tag:blogger.com,1999:blog-574816006572109947.post-65634635565674408122019-06-17T05:06:00.000-07:002019-06-17T05:06:10.576-07:00Intellij Order Of Imports<span style="font-family: Arial, Helvetica, sans-serif;">IntelliJ sometimes changes the appearance of imports in the code on checkout when organizing imports.</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;">To control that, one can adjust the settings:</span><br />
<span style="font-family: Courier New, Courier, monospace;"><br /></span>
<span style="font-family: Courier New, Courier, monospace;">Settings -> Editor -> Code Style -> Java -> Layout static imports separately</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;">Change the order as you need, IntelliJ will sort the imports accordingly.</span>Tim Harder (Owner of Harder IT Consulting)http://www.blogger.com/profile/11732226431914526209noreply@blogger.com0tag:blogger.com,1999:blog-574816006572109947.post-83680019399204753312019-06-17T01:23:00.003-07:002019-06-17T01:23:56.163-07:00Getting Gradle Dependencies in IntelliJ IDEA<h3>
<span style="font-family: Arial, Helvetica, sans-serif;">Gradle Project Import</span></h3>
<div>
</div>
<br />
<ol>
<li><span style="background-color: white; color: #242729;"><span style="font-family: Arial, Helvetica, sans-serif;">Import the project as a Gradle project from within Idea.</span></span></li>
<li><span style="font-family: Arial, Helvetica, sans-serif;">When you add a dependency you need to open the Gradle window and perform a refresh</span></li>
</ol>
<div>
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span></div>
<h3>
<span style="font-family: Arial, Helvetica, sans-serif;"><b>Gradle Wrapper</b></span></h3>
<ol>
<li><span style="font-family: Arial, Helvetica, sans-serif;">IntelliJ will ask you to auto-import Gradle in some cases. This can be done.</span></li>
<li><span style="font-family: Arial, Helvetica, sans-serif;">Gradle Wrapper - many environments will use this wrapper to maintain the same standard between the different environments and stages. How to:</span></li>
</ol>
<br />
<span style="background-color: white; color: #242729; font-family: Arial, "Helvetica Neue", Helvetica, sans-serif; font-size: 15px;"><br /></span>
<div style="background-color: white; color: #172b4d; font-size: 14px; margin-top: 10px; padding: 0px;">
<i><span style="font-family: Courier New, Courier, monospace;">Ctrl + Shift + Alt + S → Import Module → Import Module from external model → Choose Gradle → </span></i></div>
<div style="background-color: white; color: #172b4d; font-size: 14px; margin-top: 10px; padding: 0px;">
<i><span style="font-family: Courier New, Courier, monospace;">For Gradle Home: Use gradle 'wrapper' task configuration.</span></i></div>
<div style="background-color: white; color: #172b4d; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, "Fira Sans", "Droid Sans", "Helvetica Neue", sans-serif; font-size: 14px; margin-top: 10px; padding: 0px;">
<br /></div>
<div style="background-color: white; color: #172b4d; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, "Fira Sans", "Droid Sans", "Helvetica Neue", sans-serif; font-size: 14px; margin-top: 10px; padding: 0px;">
<br /></div>
<div style="background-color: white; color: #172b4d; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, "Fira Sans", "Droid Sans", "Helvetica Neue", sans-serif; font-size: 14px; margin-top: 10px; padding: 0px;">
<br /></div>
Tim Harder (Owner of Harder IT Consulting)http://www.blogger.com/profile/11732226431914526209noreply@blogger.com0tag:blogger.com,1999:blog-574816006572109947.post-81381916896700216642019-06-13T08:06:00.000-07:002019-06-13T08:09:55.946-07:00Kafka vs. MQ + JMS - Difference Apache Kafka and MQ, RabbitMQ, ActiveMQ, JMS<div style="background-color: white; box-sizing: inherit; color: #666666; font-family: "open sans", helvetica, arial, sans-serif; line-height: 20.0063px; margin-bottom: 0.7em;">
<span style="box-sizing: inherit; line-height: 20.0063px;">Kafka is a messaging system. From the ground up it has been designed to provide high throughput, fast performance, scalability and high availability. </span><br />
<span style="box-sizing: inherit; line-height: 20.0063px;">Here are the basics:</span></div>
<ul style="background-color: white; box-sizing: inherit; color: #666666; font-family: "open sans", helvetica, arial, sans-serif; line-height: 20.0063px; list-style-image: none; margin: 0px 0px 0px 40px; padding: 0px;">
<li style="box-sizing: inherit; margin: 0px 0px 0.45em;"><em style="box-sizing: inherit;">Producers</em> of the messages publishes to the Topics</li>
<li style="box-sizing: inherit; margin: 0px 0px 0.45em;"><em style="box-sizing: inherit;">Consumers</em> subscribes to the Topics</li>
<li style="box-sizing: inherit; margin: 0px 0px 0.45em;"><em style="box-sizing: inherit;">Messages</em> are array of bytes. They can be JSON objects, Strings etc</li>
<li style="box-sizing: inherit; margin: 0px 0px 0.45em;"><em style="box-sizing: inherit;">Topics</em> are logs of messages</li>
<li style="box-sizing: inherit; margin: 0px 0px 0.45em;">Kafka is run as a <em style="box-sizing: inherit;">Cluster</em> of servers each of which is called a <em style="box-sizing: inherit;">Broker</em></li>
</ul>
<div>
<span style="color: #666666; font-family: "open sans" , "helvetica" , "arial" , sans-serif;"><span style="font-size: 13.008px;"><i><br /></i></span></span></div>
<div>
<span style="color: #666666; font-family: "open sans" , "helvetica" , "arial" , sans-serif;"><span style="font-size: 13.008px;"><i><br /></i></span></span></div>
<div>
<div style="background-color: white; box-sizing: inherit; color: #666666; font-size: 17.6px; margin-bottom: 0.7em; margin-left: 40px;">
<div style="font-family: "open sans", helvetica, arial, sans-serif;">
<br /></div>
<div class="MsoNormal" style="background: white; font-family: "open sans", helvetica, arial, sans-serif; margin: 0cm 0cm 8.4pt 30pt;">
<a href="https://www.blogger.com/u/1/null" name="_GoBack"></a><b><span style="color: #666666; font-family: "helvetica" , sans-serif; font-size: 13.0pt;">1. Kafka has no P2P model. Message order will remain.</span></b></div>
<div class="MsoNormal" style="background: white; font-family: "open sans", helvetica, arial, sans-serif; margin: 0cm 0cm 8.4pt 30pt;">
<span style="color: #666666; font-family: "helvetica" , sans-serif; font-size: 13.0pt;">In Kafka there is no concept of Queue and hence no
send or receive for putting/getting messages from the queue. Publish-subscribe
is the only paradigm available as a messaging model. Producers of the
messages <i>Publish</i>a message to the <i>Topic</i> and <i>Consumer</i> receives
messages by <i>Subscribing </i>to the topic. This publish-subscribe
paradigm is very similar between MQ/JMS and Kafka - the difference is under the
covers that we will discuss next.<o:p></o:p></span></div>
<div class="MsoNormal" style="background: white; font-family: "open sans", helvetica, arial, sans-serif; margin: 0cm 0cm 8.4pt 30pt;">
<span style="color: #666666; font-family: "helvetica" , sans-serif; font-size: 13.0pt;"><br /></span></div>
<div class="MsoNormal" style="background: white; font-family: "open sans", helvetica, arial, sans-serif; margin: 0cm 0cm 8.4pt 30pt;">
<b><span style="color: #666666; font-family: "helvetica" , sans-serif; font-size: 13.0pt;">2. Message<i> Persistence</i></span></b><span style="color: #666666; font-family: "helvetica" , sans-serif; font-size: 13.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="background: white; font-family: "open sans", helvetica, arial, sans-serif; margin: 0cm 0cm 8.4pt 30pt;">
<span style="color: #666666; font-family: "helvetica" , sans-serif; font-size: 13.0pt;">Typical JMS providers (IBM MQ, Rabbit MQ, Active MQ ..)
implement the topics in a such way that the messages published to the topic are
sent to a common storage (memory or/and persistent store) from where they are
picked up by the subscribers. In MQ/JMS systems once the message is read it is
removed from the storage and is no more available. Kafka retains the messages
even after all the subscribers have read the message. The rentention period is
a configurable parameter.<o:p></o:p></span></div>
<div class="MsoNormal" style="background: white; font-family: "open sans", helvetica, arial, sans-serif; margin: 0cm 0cm 8.4pt 30pt;">
<span style="color: #666666; font-family: "helvetica" , sans-serif; font-size: 13.0pt;">In a typical MQ/JMS consumer implementation, the
message is deleted by the messaging system on receiving an ACK/Commit. If for
some reason the message gets processed but fails before the ACK/Commit, it
would lead to message being read more than once. This problem has been
addressed by Kafka by way of message retention and state management based on
the consumer offset.<o:p></o:p></span></div>
<div class="MsoNormal" style="background: white; font-family: "open sans", helvetica, arial, sans-serif; margin: 0cm 0cm 8.4pt 30pt;">
<span style="color: #666666; font-family: "helvetica" , sans-serif; font-size: 13.0pt;"><br /></span></div>
<div class="MsoNormal" style="background: white; font-family: "open sans", helvetica, arial, sans-serif; margin: 0cm 0cm 8.4pt 30pt;">
<b><span style="color: #666666; font-family: "helvetica" , sans-serif; font-size: 13.0pt;">3. Topic partitioning</span></b><span style="color: #666666; font-family: "helvetica" , sans-serif; font-size: 13.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="background: white; font-family: "open sans", helvetica, arial, sans-serif; margin: 0cm 0cm 8.4pt 30pt;">
<span style="color: #666666; font-family: "helvetica" , sans-serif; font-size: 13.0pt;">Kafka has implemented the topics as partitioned logs.
A partition is an ordered, immutable sequence of messages that is continually
appended to. This is similar to <i>database log, </i>for that reason
the partition is also referred to as the <i>commit-log. </i>This is
one of the biggest difference between MQ/JMS and Kafka. The partitioning of the
topic leads to its high throughput (and parallelism). <o:p></o:p></span></div>
<div class="MsoNormal" style="background: white; font-family: "open sans", helvetica, arial, sans-serif; margin: 0cm 0cm 8.4pt 30pt;">
<br /></div>
<div class="MsoNormal" style="background: white; font-family: "open sans", helvetica, arial, sans-serif; margin: 0cm 0cm 5.4pt 60pt; text-indent: -18pt;">
<!--[if !supportLists]--><span style="color: #666666; font-family: "symbol"; mso-bidi-font-family: Symbol; mso-bidi-font-size: 13.0pt; mso-fareast-font-family: Symbol; mso-fareast-language: DE;"><span style="mso-list: Ignore;">·<span style="font: 7.0pt "Times New Roman";">
</span></span></span><!--[endif]--><span style="color: #666666; font-family: "helvetica" , sans-serif; font-size: 13.0pt;">Partitions for the same topic are distributed across multiple brokers in
the cluster<o:p></o:p></span></div>
<div class="MsoNormal" style="background: white; font-family: "open sans", helvetica, arial, sans-serif; margin: 0cm 0cm 5.4pt 60pt; text-indent: -18pt;">
<!--[if !supportLists]--><span style="color: #666666; font-family: "symbol"; mso-bidi-font-family: Symbol; mso-bidi-font-size: 13.0pt; mso-fareast-font-family: Symbol; mso-fareast-language: DE;"><span style="mso-list: Ignore;">·<span style="font: 7.0pt "Times New Roman";">
</span></span></span><!--[endif]--><span style="color: #666666; font-family: "helvetica" , sans-serif; font-size: 13.0pt;">Partitions are replicated across multiple servers; number of replicas is a
configurable parameter<o:p></o:p></span></div>
<div class="MsoNormal" style="background: white; font-family: "open sans", helvetica, arial, sans-serif; margin: 0cm 0cm 5.4pt 60pt; text-indent: -18pt;">
<!--[if !supportLists]--><span style="color: #666666; font-family: "symbol"; mso-bidi-font-family: Symbol; mso-bidi-font-size: 13.0pt; mso-fareast-font-family: Symbol; mso-fareast-language: DE;"><span style="mso-list: Ignore;">·<span style="font: 7.0pt "Times New Roman";">
</span></span></span><!--[endif]--><span style="color: #666666; font-family: "helvetica" , sans-serif; font-size: 13.0pt;">Each Partition has one server as a <i>leader</i> and a number of
servers as <i>followers</i><o:p></o:p></span></div>
<div class="MsoNormal" style="background: white; font-family: "open sans", helvetica, arial, sans-serif; margin: 0cm 0cm 5.4pt 60pt; text-indent: -18pt;">
<!--[if !supportLists]--><span style="color: #666666; font-family: "symbol"; mso-bidi-font-family: Symbol; mso-bidi-font-size: 13.0pt; mso-fareast-font-family: Symbol; mso-fareast-language: DE;"><span style="mso-list: Ignore;">·<span style="font: 7.0pt "Times New Roman";">
</span></span></span><!--[endif]--><span style="color: #666666; font-family: "helvetica" , sans-serif; font-size: 13.0pt;">Each Server acts a leader for some of its partitions and as a follower for
some other<o:p></o:p></span></div>
<div class="MsoNormal" style="background: white; font-family: "open sans", helvetica, arial, sans-serif; margin: 0cm 0cm 5.4pt 60pt; text-indent: -18pt;">
<!--[if !supportLists]--><span style="color: #666666; font-family: "symbol"; mso-bidi-font-family: Symbol; mso-bidi-font-size: 13.0pt; mso-fareast-font-family: Symbol; mso-fareast-language: DE;"><span style="mso-list: Ignore;">·<span style="font: 7.0pt "Times New Roman";">
</span></span></span><!--[endif]--><span style="color: #666666; font-family: "helvetica" , sans-serif; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: DE;">The Producers are responsible for choosing which message to assign to which
partition within the topic based on key assigned to message.</span><span style="color: #666666; font-family: "helvetica" , sans-serif; font-size: 13.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="background: white; font-family: "open sans", helvetica, arial, sans-serif; margin: 0cm 0cm 8.4pt 30pt;">
<b><span style="color: #666666; font-family: "helvetica" , sans-serif; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: DE;"><br /></span></b></div>
<div class="MsoNormal" style="background: white; font-family: "open sans", helvetica, arial, sans-serif; margin: 0cm 0cm 8.4pt 30pt;">
<b><span style="color: #666666; font-family: "helvetica" , sans-serif; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: DE;">5. Message sequencing</span></b><span style="color: #666666; font-family: "helvetica" , sans-serif; font-size: 13.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="background: white; font-family: "open sans", helvetica, arial, sans-serif; margin: 0cm 0cm 8.4pt 30pt;">
<span style="color: #666666; font-family: "helvetica" , sans-serif; font-size: 13.0pt;">In MQ/JMS there is no gurantee that the messages will
be received in a sequence in which they were sent. In Kafka though the sequence
is maintained at a partition level. In other words if the topic is configured
with a single partition then the messages are received in the same order that
they were sent in. <o:p></o:p></span><br />
<span style="color: #666666; font-family: "helvetica" , sans-serif; font-size: 13.0pt;"><br /></span></div>
<div class="MsoNormal" style="background: white; font-family: "open sans", helvetica, arial, sans-serif; margin: 0cm 0cm 8.4pt 30pt;">
<b><span style="color: #666666; font-family: "helvetica" , sans-serif; font-size: 13.0pt;">6. </span></b><b><span style="color: #666666; font-family: "helvetica" , sans-serif; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: DE;">Message reads</span></b><span style="color: #666666; font-family: "helvetica" , sans-serif; font-size: 13.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="background: white; font-family: "open sans", helvetica, arial, sans-serif; margin: 0cm 0cm 8.4pt 30pt;">
<span style="color: #666666; font-family: "helvetica" , sans-serif; font-size: 13.0pt;">The consumer of the messages in Kafka issues a fetch
request to the broker leading the partition it wants to consume. As part of the
fetch, consumer specifies the offset from which the message in the log is read
from. This is very different from the MQ/JMS messaging system where First In
First Out (FIFO) is the way messages are read off the queue/topic. The other
thing that happens is that with offset based control, the consumer can re-read
the same message which is not possible in MQ/JMS (yes you can do it with browse
but that is not what it is intended for).<o:p></o:p></span></div>
<div class="MsoNormal" style="background: white; font-family: "open sans", helvetica, arial, sans-serif; margin: 0cm 0cm 8.4pt 30pt;">
<span style="color: #666666; font-family: "helvetica" , sans-serif; font-size: 13.0pt;">This rewinding mechanism can be very handy in some
situation. E.g., if you received a batch of messages and processed it with
buggy code, you may fix the code and re-run the processing on the messages by
resetting the offset.<o:p></o:p></span><br />
<span style="color: #666666; font-family: "helvetica" , sans-serif; font-size: 13.0pt;"><br /></span></div>
<div class="MsoNormal" style="background: white; font-family: "open sans", helvetica, arial, sans-serif; margin: 0cm 0cm 8.4pt 30pt;">
<b><span style="color: #666666; font-family: "helvetica" , sans-serif; font-size: 13.0pt;">7. Load balancing</span></b><span style="color: #666666; font-family: "helvetica" , sans-serif; font-size: 13.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="background: white; font-family: "open sans", helvetica, arial, sans-serif; margin: 0cm 0cm 8.4pt 30pt;">
<span style="color: #666666; font-family: "helvetica" , sans-serif; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: DE;">In the case of MQ/JMS the load balancing required messaging systems to be designed
using some clustering mechanism and the onus of distributing the load across
the cluster members was on the producer sending the messages. </span><span style="color: #666666; font-family: "helvetica" , sans-serif; font-size: 13.0pt;">The Kafka nodes
publish the metadata which tells the producer which servers are alive in the
cluster, where the leader for the partitions are. This allows the client to
send message to the appropriate server (and partition) thus distributing the
message load across the cluster members.<o:p></o:p></span><br />
<span style="color: #666666; font-family: "helvetica" , sans-serif; font-size: 13.0pt;"><br /></span></div>
<div class="MsoNormal" style="background: white; font-family: "open sans", helvetica, arial, sans-serif; margin: 0cm 0cm 8.4pt 30pt;">
<b><span style="color: #666666; font-family: "helvetica" , sans-serif; font-size: 13.0pt;">8. Automatic failover & High
availability</span></b><span style="color: #666666; font-family: "helvetica" , sans-serif; font-size: 13.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="background: white; font-family: "open sans", helvetica, arial, sans-serif; margin: 0cm 0cm 8.4pt 30pt;">
<span style="color: #666666; font-family: "helvetica" , sans-serif; font-size: 13.0pt;">Traditional MQ/JMS implementations did not have the
concept of message replication but some systems built it over a period of time;
those replication features at most times were not leveraged in favor of
simplicity. In Kafka, as decribed earlier the messages are replicated
(leader-followers) for each topic's partitions across a configurable number of
servers. This inherently leads to an architecture that provides automatic
failover to replica thus leading to high availability.<o:p></o:p></span></div>
<div class="MsoNormal" style="background: white; line-height: 15pt; margin: 0cm 0cm 8.4pt 30pt;">
<div style="font-family: "open sans", helvetica, arial, sans-serif;">
<span style="color: #666666; font-family: "helvetica" , sans-serif; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: DE;"><b><br /></b></span></div>
<div style="font-family: "open sans", helvetica, arial, sans-serif;">
<span style="color: #666666; font-family: "helvetica" , sans-serif; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: DE;"><b>Zookeeper</b></span></div>
<span style="color: #666666; font-family: Arial, Helvetica, sans-serif;">Zookeeper plays a central role in this replication
mechanism. The follower servers maintain a session to zookeeper and respond to
the heartbeat messages. The slaves/replicas continuously read messages from the
leader as fast as they can as to not fall behind. The leader if discovers that
the slave is lagging removes it as the replica; this is determined by way of
configurable parameters. The message is considered <i>committed </i>when
all replicas are in sync with the leader. This sync aspect is also
configurable.<o:p></o:p></span></div>
<div class="MsoNormal" style="background: white; line-height: 15pt; margin: 0cm 0cm 8.4pt 30pt;">
<span style="color: #666666;"><span style="font-family: Arial, Helvetica, sans-serif;">The state of the replication is managed by the leader
server and leader may drop the replica/slave if the replica is lagging too far
behind or is unresponsive.</span><span style="font-family: open sans, helvetica, arial, sans-serif;"><o:p></o:p></span></span></div>
<div class="MsoNormal" style="font-family: "open sans", helvetica, arial, sans-serif;">
<br /></div>
<div style="font-family: "open sans", helvetica, arial, sans-serif;">
<br /></div>
</div>
</div>
Tim Harder (Owner of Harder IT Consulting)http://www.blogger.com/profile/11732226431914526209noreply@blogger.com0tag:blogger.com,1999:blog-574816006572109947.post-65268565455304362852019-05-27T08:33:00.003-07:002019-05-27T08:33:19.403-07:00My Advice to Founders + Anyone Starting Their Own Business<div class="mentions-texteditor__content" style="background: 0px 0px rgb(255, 255, 255); border: 0px; box-sizing: inherit; color: rgba(0, 0, 0, 0.75); font-family: -apple-system, system-ui, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", "Fira Sans", Ubuntu, Oxygen, "Oxygen Sans", Cantarell, "Droid Sans", "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Lucida Grande", Helvetica, Arial, sans-serif; font-size: 1.4rem; line-height: 1.42857; padding: 8px 8px 1px; vertical-align: baseline;">
<br /></div>
<div class="mentions-texteditor__content" style="background: 0px 0px rgb(255, 255, 255); border: 0px; box-sizing: inherit; color: rgba(0, 0, 0, 0.75); font-family: -apple-system, system-ui, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", "Fira Sans", Ubuntu, Oxygen, "Oxygen Sans", Cantarell, "Droid Sans", "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Lucida Grande", Helvetica, Arial, sans-serif; font-size: 1.4rem; line-height: 1.42857; padding: 1px 8px; vertical-align: baseline;">
Here is my advice when you are about to start your own business.</div>
<div class="mentions-texteditor__content" style="background: 0px 0px rgb(255, 255, 255); border: 0px; box-sizing: inherit; color: rgba(0, 0, 0, 0.75); font-family: -apple-system, system-ui, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", "Fira Sans", Ubuntu, Oxygen, "Oxygen Sans", Cantarell, "Droid Sans", "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Lucida Grande", Helvetica, Arial, sans-serif; font-size: 1.4rem; line-height: 1.42857; padding: 1px 8px; vertical-align: baseline;">
<br /></div>
<div class="mentions-texteditor__content" style="background: 0px 0px rgb(255, 255, 255); border: 0px; box-sizing: inherit; color: rgba(0, 0, 0, 0.75); font-family: -apple-system, system-ui, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", "Fira Sans", Ubuntu, Oxygen, "Oxygen Sans", Cantarell, "Droid Sans", "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Lucida Grande", Helvetica, Arial, sans-serif; font-size: 1.4rem; line-height: 1.42857; padding: 1px 8px; vertical-align: baseline;">
No matter what business you start, at a certain level it is all the same. </div>
<div class="mentions-texteditor__content" style="background: 0px 0px rgb(255, 255, 255); border: 0px; box-sizing: inherit; color: rgba(0, 0, 0, 0.75); font-family: -apple-system, system-ui, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", "Fira Sans", Ubuntu, Oxygen, "Oxygen Sans", Cantarell, "Droid Sans", "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Lucida Grande", Helvetica, Arial, sans-serif; font-size: 1.4rem; line-height: 1.42857; padding: 1px 8px; vertical-align: baseline;">
<br style="box-sizing: inherit;" /></div>
<h4 style="background: 0px 0px rgb(255, 255, 255); border: 0px; box-sizing: inherit; color: rgba(0, 0, 0, 0.75); font-family: -apple-system, system-ui, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", "Fira Sans", Ubuntu, Oxygen, "Oxygen Sans", Cantarell, "Droid Sans", "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Lucida Grande", Helvetica, Arial, sans-serif; font-size: 1.4rem; line-height: 1.42857; padding: 1px 8px; vertical-align: baseline;">
<b><span class="mentions-texteditor__hashtag" data-id="urn:li:hashtag:1" dir="ltr" style="background: 0px 0px; border: 0px; box-sizing: inherit; font-size: 14px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">#1</span> Get a Coach</b></h4>
<div style="background: 0px 0px rgb(255, 255, 255); border: 0px; box-sizing: inherit; color: rgba(0, 0, 0, 0.75); font-family: -apple-system, system-ui, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", "Fira Sans", Ubuntu, Oxygen, "Oxygen Sans", Cantarell, "Droid Sans", "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Lucida Grande", Helvetica, Arial, sans-serif; font-size: 1.4rem; line-height: 1.42857; padding: 1px 8px; vertical-align: baseline;">
Look for someone who is able to help you out by giving advice to you. The best thing was if this person has already achieved what you want to achieve. For instance, my own Coach is successfully running multiple companies. It may cost you money but investing in yourself is the best thing you can do!</div>
<div class="mentions-texteditor__content" style="background: 0px 0px rgb(255, 255, 255); border: 0px; box-sizing: inherit; color: rgba(0, 0, 0, 0.75); font-family: -apple-system, system-ui, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", "Fira Sans", Ubuntu, Oxygen, "Oxygen Sans", Cantarell, "Droid Sans", "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Lucida Grande", Helvetica, Arial, sans-serif; font-size: 1.4rem; line-height: 1.42857; padding: 1px 8px; vertical-align: baseline;">
<br style="box-sizing: inherit;" /></div>
<h4 style="background: 0px 0px rgb(255, 255, 255); border: 0px; box-sizing: inherit; color: rgba(0, 0, 0, 0.75); font-family: -apple-system, system-ui, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", "Fira Sans", Ubuntu, Oxygen, "Oxygen Sans", Cantarell, "Droid Sans", "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Lucida Grande", Helvetica, Arial, sans-serif; font-size: 1.4rem; line-height: 1.42857; padding: 1px 8px; vertical-align: baseline;">
<span class="mentions-texteditor__hashtag" data-id="urn:li:hashtag:2" dir="ltr" style="background: 0px 0px; border: 0px; box-sizing: inherit; font-size: 14px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">#2</span> Manage yourself as a boss and employee in one. </h4>
<div class="mentions-texteditor__content" style="background: 0px 0px rgb(255, 255, 255); border: 0px; box-sizing: inherit; color: rgba(0, 0, 0, 0.75); font-family: -apple-system, system-ui, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", "Fira Sans", Ubuntu, Oxygen, "Oxygen Sans", Cantarell, "Droid Sans", "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Lucida Grande", Helvetica, Arial, sans-serif; font-size: 1.4rem; line-height: 1.42857; padding: 1px 8px; vertical-align: baseline;">
Enjoy the freedom and flexibility regarding time, appointments and mindset - you are your own boss now. Because of this: negotiate clever and be tough as nails regarding your ressource planning, even more with yourself ;)</div>
<div class="mentions-texteditor__content" style="background: 0px 0px rgb(255, 255, 255); border: 0px; box-sizing: inherit; color: rgba(0, 0, 0, 0.75); font-family: -apple-system, system-ui, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", "Fira Sans", Ubuntu, Oxygen, "Oxygen Sans", Cantarell, "Droid Sans", "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Lucida Grande", Helvetica, Arial, sans-serif; font-size: 1.4rem; line-height: 1.42857; padding: 1px 8px; vertical-align: baseline;">
<br style="box-sizing: inherit;" /></div>
<h4 style="background: 0px 0px rgb(255, 255, 255); border: 0px; box-sizing: inherit; color: rgba(0, 0, 0, 0.75); font-family: -apple-system, system-ui, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", "Fira Sans", Ubuntu, Oxygen, "Oxygen Sans", Cantarell, "Droid Sans", "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Lucida Grande", Helvetica, Arial, sans-serif; font-size: 1.4rem; line-height: 1.42857; padding: 1px 8px; vertical-align: baseline;">
<span class="mentions-texteditor__hashtag" data-id="urn:li:hashtag:3" dir="ltr" style="background: 0px 0px; border: 0px; box-sizing: inherit; font-size: 14px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">#3</span> Go with the flow </h4>
<div class="mentions-texteditor__content" style="background: 0px 0px rgb(255, 255, 255); border: 0px; box-sizing: inherit; color: rgba(0, 0, 0, 0.75); font-family: -apple-system, system-ui, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", "Fira Sans", Ubuntu, Oxygen, "Oxygen Sans", Cantarell, "Droid Sans", "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Lucida Grande", Helvetica, Arial, sans-serif; font-size: 1.4rem; line-height: 1.42857; padding: 1px 8px; vertical-align: baseline;">
It is easier for me to accept the limits or moods of my employees than accepting my own. But if I hit the floor because of sleep deprivation or anxiety, my business will go down, too. Thus: </div>
<div class="mentions-texteditor__content" style="background: 0px 0px rgb(255, 255, 255); border: 0px; box-sizing: inherit; color: rgba(0, 0, 0, 0.75); font-family: -apple-system, system-ui, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", "Fira Sans", Ubuntu, Oxygen, "Oxygen Sans", Cantarell, "Droid Sans", "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Lucida Grande", Helvetica, Arial, sans-serif; font-size: 1.4rem; line-height: 1.42857; padding: 1px 8px; vertical-align: baseline;">
<br style="box-sizing: inherit;" /></div>
<h4 style="background: 0px 0px rgb(255, 255, 255); border: 0px; box-sizing: inherit; color: rgba(0, 0, 0, 0.75); font-family: -apple-system, system-ui, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", "Fira Sans", Ubuntu, Oxygen, "Oxygen Sans", Cantarell, "Droid Sans", "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Lucida Grande", Helvetica, Arial, sans-serif; font-size: 1.4rem; line-height: 1.42857; padding: 1px 8px; vertical-align: baseline;">
<span class="mentions-texteditor__hashtag" data-id="urn:li:hashtag:4" dir="ltr" style="background: 0px 0px; border: 0px; box-sizing: inherit; font-size: 14px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">#4</span> Be kind to yourself</h4>
<div class="mentions-texteditor__content" style="background: 0px 0px rgb(255, 255, 255); border: 0px; box-sizing: inherit; color: rgba(0, 0, 0, 0.75); font-family: -apple-system, system-ui, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", "Fira Sans", Ubuntu, Oxygen, "Oxygen Sans", Cantarell, "Droid Sans", "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Lucida Grande", Helvetica, Arial, sans-serif; font-size: 1.4rem; line-height: 1.42857; padding: 1px 8px; vertical-align: baseline;">
... as you do already have proven that you have the courage to walk your own path. Being kind to yourself will help you to not crack under the pressure. </div>
<div class="mentions-texteditor__content" style="background: 0px 0px rgb(255, 255, 255); border: 0px; box-sizing: inherit; color: rgba(0, 0, 0, 0.75); font-family: -apple-system, system-ui, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", "Fira Sans", Ubuntu, Oxygen, "Oxygen Sans", Cantarell, "Droid Sans", "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Lucida Grande", Helvetica, Arial, sans-serif; font-size: 1.4rem; line-height: 1.42857; padding: 1px 8px; vertical-align: baseline;">
<br style="box-sizing: inherit;" /></div>
<h4 style="background: 0px 0px rgb(255, 255, 255); border: 0px; box-sizing: inherit; color: rgba(0, 0, 0, 0.75); font-family: -apple-system, system-ui, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", "Fira Sans", Ubuntu, Oxygen, "Oxygen Sans", Cantarell, "Droid Sans", "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Lucida Grande", Helvetica, Arial, sans-serif; font-size: 1.4rem; line-height: 1.42857; padding: 1px 8px; vertical-align: baseline;">
<b><span class="mentions-texteditor__hashtag" data-id="urn:li:hashtag:5" dir="ltr" style="background: 0px 0px; border: 0px; box-sizing: inherit; font-size: 14px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">#5</span> Fun is the most important thing</b></h4>
<div class="mentions-texteditor__content" style="background: 0px 0px rgb(255, 255, 255); border: 0px; box-sizing: inherit; color: rgba(0, 0, 0, 0.75); font-family: -apple-system, system-ui, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", "Fira Sans", Ubuntu, Oxygen, "Oxygen Sans", Cantarell, "Droid Sans", "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Lucida Grande", Helvetica, Arial, sans-serif; line-height: 1.42857; padding: 1px 8px 8px; vertical-align: baseline;">
<span style="font-size: 1.4rem;">Life is too short. Never forget that stress is a powerful force. Do always remember that fun is what this is about. The rest will follow - </span><span class="mentions-texteditor__hashtag" data-id="urn:li:hashtag:lawOfAttraction" dir="ltr" style="background: 0px 0px; border: 0px; box-sizing: inherit; font-weight: 600; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;"><span style="font-size: large;">#lawOfAttraction</span></span> <span style="font-size: 1.4rem;">. </span></div>
<div class="mentions-texteditor__content" style="background: 0px 0px rgb(255, 255, 255); border: 0px; box-sizing: inherit; color: rgba(0, 0, 0, 0.75); font-family: -apple-system, system-ui, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", "Fira Sans", Ubuntu, Oxygen, "Oxygen Sans", Cantarell, "Droid Sans", "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Lucida Grande", Helvetica, Arial, sans-serif; font-size: 1.4rem; line-height: 1.42857; padding: 1px 8px 8px; vertical-align: baseline;">
<br /></div>
<div class="mentions-texteditor__content" style="background: 0px 0px rgb(255, 255, 255); border: 0px; box-sizing: inherit; color: rgba(0, 0, 0, 0.75); font-family: -apple-system, system-ui, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", "Fira Sans", Ubuntu, Oxygen, "Oxygen Sans", Cantarell, "Droid Sans", "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Lucida Grande", Helvetica, Arial, sans-serif; font-size: 1.4rem; line-height: 1.42857; padding: 1px 8px 8px; vertical-align: baseline;">
Wish you much success with your business and all the best! </div>
<div class="mentions-texteditor__content" style="background: 0px 0px rgb(255, 255, 255); border: 0px; box-sizing: inherit; color: rgba(0, 0, 0, 0.75); font-family: -apple-system, system-ui, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", "Fira Sans", Ubuntu, Oxygen, "Oxygen Sans", Cantarell, "Droid Sans", "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Lucida Grande", Helvetica, Arial, sans-serif; font-size: 1.4rem; line-height: 1.42857; padding: 1px 8px 8px; vertical-align: baseline;">
Tim</div>
Tim Harder (Owner of Harder IT Consulting)http://www.blogger.com/profile/11732226431914526209noreply@blogger.com0tag:blogger.com,1999:blog-574816006572109947.post-75786855575542627822019-05-15T02:21:00.003-07:002019-05-15T02:25:17.319-07:00How to remove line breaks etc. in Java String<pre style="background-color: white; font-family: "Courier New";"><pre style="font-family: "Courier New";">
</pre>
</pre>
<pre style="background-color: white; font-family: "Courier New";"></pre>
<pre style="background-color: white; font-family: "Courier New";">myString.trim()
.replace(<span style="color: green; font-weight: bold;">"</span><span style="color: navy; font-weight: bold;">\n</span><span style="color: green; font-weight: bold;">"</span>, <span style="color: green; font-weight: bold;">""</span>)
.replace(<span style="color: green; font-weight: bold;">"</span><span style="color: navy; font-weight: bold;">\r</span><span style="color: green; font-weight: bold;">"</span>, <span style="color: green; font-weight: bold;">""</span>)
.replace(System.<span style="font-style: italic;">getProperty</span>(<span style="color: green; font-weight: bold;">"line.separator"</span>), <span style="color: green; font-weight: bold;">""</span>);</pre>
Tim Harder (Owner of Harder IT Consulting)http://www.blogger.com/profile/11732226431914526209noreply@blogger.com0tag:blogger.com,1999:blog-574816006572109947.post-12123391029116016122019-04-29T09:12:00.004-07:002019-04-29T09:19:19.200-07:00Spring Security - get User Name<span style="font-family: "arial" , "helvetica" , sans-serif;">If you want to retrieve the name of a logged in user, do this:</span><br />
<br />
<br />
<pre style="background-color: white; font-family: "Courier New";"><pre style="font-family: "Courier New";"><span style="color: navy; font-weight: bold;">import </span>org.springframework.security.core.context.SecurityContextHolder;
<span style="color: navy; font-weight: bold;">import </span>org.springframework.security.core.userdetails.UserDetails;</pre>
</pre>
<span style="background-color: white; color: navy; font-family: "courier new"; font-weight: bold;">private </span><span style="background-color: white; font-family: "courier new";">String getUserName() {</span><br />
<pre style="background-color: white; font-family: "Courier New";"> Object principal = SecurityContextHolder
.getContext()
.getAuthentication()
.getPrincipal();
String userName;
<pre style="font-family: "Courier New";"><span style="color: navy; font-weight: bold;"> if </span>(principal <span style="color: navy; font-weight: bold;">instanceof </span>UserDetails) {
userName = ((UserDetails)principal).getUsername();
} <span style="color: navy; font-weight: bold;">else </span>{
userName = principal.toString();
}
<span style="color: navy; font-weight: bold;">return </span>userName;
}</pre>
</pre>
Tim Harder (Owner of Harder IT Consulting)http://www.blogger.com/profile/11732226431914526209noreply@blogger.com0tag:blogger.com,1999:blog-574816006572109947.post-76600176299136605082019-04-24T02:51:00.002-07:002019-04-24T02:54:22.898-07:00Recover and Restore System Properties with Java - JUnit and more - Free program<div style="background-color: white; box-sizing: border-box; color: #24292e; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol"; font-size: 16px; margin-bottom: 16px;">
Sometimes it is necessary to change System Properties. Maybe for a Test or something else. This program and test will recover and restore the System Properties to their initial state.</div>
<div style="background-color: white; box-sizing: border-box; color: #24292e; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol"; font-size: 16px;">
The program and test may be used freely under GNU General Public License Version and is brought to you by Harder IT Consulting <a href="http://www.harder-it-consulting.de/" rel="nofollow" style="background-color: transparent; box-sizing: border-box; color: #0366d6; text-decoration-line: none;">www.harder-it-consulting.de</a><br />
</div>
<div style="background-color: white; box-sizing: border-box; font-size: 16px;">
<a href="https://github.com/harderitconsulting/SystemPropertiesRecovery" target="_blank"><span style="color: blue;">Download here</span></a></div>
Tim Harder (Owner of Harder IT Consulting)http://www.blogger.com/profile/11732226431914526209noreply@blogger.com0tag:blogger.com,1999:blog-574816006572109947.post-72753738237708221632019-04-18T06:19:00.003-07:002019-04-18T06:22:49.505-07:00Remove duplicates in list with Java > 8<br />
<pre style="background-color: white; font-family: "Courier New";"><span style="color: grey; font-style: italic;"> //remove duplicates from a list with Java 8 or greater </span> </pre>
<pre style="background-color: white; font-family: "Courier New";"> mylist.stream().distinct.collect(Collectors.toList())
</pre>
Tim Harder (Owner of Harder IT Consulting)http://www.blogger.com/profile/11732226431914526209noreply@blogger.com0tag:blogger.com,1999:blog-574816006572109947.post-59102496757318989022019-04-17T05:38:00.002-07:002019-04-18T06:23:33.410-07:00Mock static methods with Mockito in Java (mock, static, method, java)<br />
<pre style="background-color: white; font-family: "Courier New";"><span style="color: navy; font-weight: bold;">import </span>org.junit.<span style="color: olive;">Test</span>;
<span style="color: navy; font-weight: bold;">import </span>org.junit.runner.<span style="color: olive;">RunWith</span>;
<span style="color: navy; font-weight: bold;">import </span>org.mockito.BDDMockito;
<span style="color: navy; font-weight: bold;">import </span>org.powermock.api.mockito.PowerMockito;
<span style="color: navy; font-weight: bold;">import </span>org.powermock.core.classloader.annotations.<span style="color: olive;">PrepareForTest</span>;
<span style="color: navy; font-weight: bold;">import </span>org.powermock.modules.junit4.PowerMockRunner;</pre>
<br />
<br />
<pre style="background-color: white; font-family: "Courier New";"><span style="color: olive;">@RunWith</span>(PowerMockRunner.<span style="color: navy; font-weight: bold;">class</span>)
<span style="color: olive;">@PrepareForTest</span>(MyStatic.<span style="color: navy; font-weight: bold;">class</span>)
...
<span style="color: olive;">@Test</span></pre>
<pre style="background-color: white; font-family: "Courier New";"><span style="color: navy; font-weight: bold;">public void </span>someTest() {
</pre>
<pre style="background-color: white; font-family: "Courier New";"><span style="color: grey; font-style: italic;"> //given</span><span style="color: grey; font-style: italic;"> </span></pre>
<pre style="background-color: white; font-family: "Courier New";"> PowerMockito.<span style="font-style: italic;">mockStatic</span>(MyStatic.<span style="color: navy; font-weight: bold;">class</span>);
BDDMockito.<span style="font-style: italic;">given</span>(MyStatic.<span style="font-style: italic;">someStaticMethod</span>()).willReturn(<span style="color: navy; font-weight: bold;">...</span>);
<span style="color: grey; font-style: italic;"> //when</span>
...
<span style="color: grey; font-style: italic;"> //then </span> </pre>
<pre style="background-color: white; font-family: "Courier New";"> PowerMockito.<span style="font-style: italic;">verifyStatic</span>();
MyStatic.someStaticMethod();
<span style="font-style: italic;"> assertThat</span>(//your further asserts....</pre>
Tim Harder (Owner of Harder IT Consulting)http://www.blogger.com/profile/11732226431914526209noreply@blogger.com0tag:blogger.com,1999:blog-574816006572109947.post-64187586120171762632019-03-28T09:46:00.000-07:002019-03-28T09:46:13.725-07:00Scan Files For Search Terms - Java Program Code + Download<br />I have written a small progam to help us out. <a href="https://github.com/harderitconsulting/FileScanner" target="_blank">Download</a>Tim Harder (Owner of Harder IT Consulting)http://www.blogger.com/profile/11732226431914526209noreply@blogger.com0tag:blogger.com,1999:blog-574816006572109947.post-79215110911754310062019-03-28T07:14:00.001-07:002019-03-29T02:31:24.874-07:00Maven - How to create Maven Java Project From ScratchInstall Maven, go to the <a href="https://maven.apache.org/install.html">Apache Site</a><br />
<br />
In your command line enter:
<br />
<br />
<code class="java plain" style="background: none; border-radius: 0px; border: 0px; bottom: auto; box-sizing: content-box; float: none; height: auto; left: auto; line-height: 20px; margin: 0px; min-height: inherit; outline: 0px; overflow: visible; padding: 0px; position: static; right: auto; top: auto; vertical-align: baseline; width: auto;"><span style="font-family: "courier new" , "courier" , monospace;">D:\>mvn archetype:generate -DgroupId=de.consulting.it.harder -DartifactId=java-project -DarchetypeArtifactId=maven-archetype-quickstart -DinteractiveMode=false</span></code><br />
<br />
This will create a basic Maven project from scratch.<br />
<br />
Update your POM with the following properties to define the Compiler:<br />
<br />
<span style="font-family: "courier new" , "courier" , monospace;"> <properties><br /> <maven.compiler.target>1.8</maven.compiler.target><br /> <maven.compiler.source>1.8</maven.compiler.source><br /> </properties></span><br />
<br />
Define JUnit as your first dependency for Testing with scope "test":<br />
<br />
<span style="font-family: "courier new" , "courier" , monospace;"> <dependency></span><br />
<span style="font-family: "courier new" , "courier" , monospace;"><span style="white-space: pre;"> </span><groupId>junit</groupId></span><br />
<span style="font-family: "courier new" , "courier" , monospace;"><span style="white-space: pre;"> </span><artifactId>junit</artifactId></span><br />
<span style="font-family: "courier new" , "courier" , monospace;"><span style="white-space: pre;"> </span><version>4.13</version></span><br />
<span style="font-family: "courier new" , "courier" , monospace;"><span style="white-space: pre;"> </span><scope>test</scope></span><br />
<span style="font-family: "courier new" , "courier" , monospace;"> </dependency></span><br />
<br />
<br />
I suggest Hamcrest, if you do not know it yet:<br />
<br />
<br />
<span style="font-size: x-small;"> <!-- https://mvnrepository.com/artifact/org.hamcrest/hamcrest-all --> </span><br />
<div>
<span style="font-family: "courier new" , "courier" , monospace;"> </dependency></span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"> <groupId>org.hamcrest</groupId></span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"> <artifactId>hamcrest-all</artifactId></span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"> <version>1.3</version> </span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"> <scope>test</scope></span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"> </dependency></span><br />
<span style="font-family: "courier new" , "courier" , monospace;"><br /></span>
If you want to package as executable JAR:<br />
<span style="font-family: "courier new" , "courier" , monospace;">$ mvn clean package</span><br />
<br />
If you want to start the JAR:<br />
<span style="font-family: "courier new" , "courier" , monospace;">$ java -jar <your jar file name here> </span><br />
<div>
<span style="font-family: "courier new" , "courier" , monospace;"><br /></span></div>
Here is the POM with all attributes for executable JARs: <a href="https://github.com/harderitconsulting/FileScanner/blob/master/file-content-search/pom.xml" target="_blank">Download Example POM</a></div>
Tim Harder (Owner of Harder IT Consulting)http://www.blogger.com/profile/11732226431914526209noreply@blogger.com0tag:blogger.com,1999:blog-574816006572109947.post-66449147538408256342019-03-19T07:50:00.002-07:002019-03-19T07:56:34.352-07:00How To Resolve GIT Merge Conflicts with IntelliJ<div style="background-color: white; color: #172b4d; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, "Fira Sans", "Droid Sans", "Helvetica Neue", sans-serif; font-size: 14px; margin-top: 10px; padding: 0px;">
<h2 id=x" style="background-color: white; border-bottom-color: rgb(2, 4, 8); color: #003399; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, "Fira Sans", "Droid Sans", "Helvetica Neue", sans-serif; font-size: 20px; font-weight: normal; line-height: 1.5; margin: 30px 0px 0px; padding: 0px;">
Resolve a Merge Conflict in GIT with IntelliJ</h2>
<div style="background-color: white; color: #172b4d; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, "Fira Sans", "Droid Sans", "Helvetica Neue", sans-serif; font-size: 14px; margin-top: 10px; padding: 0px;">
<br /></div>
<div style="background-color: white; color: #172b4d; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, "Fira Sans", "Droid Sans", "Helvetica Neue", sans-serif; font-size: 14px; margin-top: 10px; padding: 0px;">
Let us assume you are using Bitbucket or a similar tool to administrate and host your GIT repositories.<br />You are using the Open Source principle with Pull Request, Review, Merge: </div>
<div style="background-color: white; color: #172b4d; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, "Fira Sans", "Droid Sans", "Helvetica Neue", sans-serif; font-size: 14px; margin-top: 10px; padding: 0px;">
</div>
<ul>
<li>Push changes</li>
<li>Assign a reviewer or two</li>
<li>Depending on your team agreement, either you or the reviewer will merge the feature onto your main develop branch (I will call it "develop"). The pull request is merged.</li>
</ul>
<br />
<div style="background-color: white; color: #172b4d; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, "Fira Sans", "Droid Sans", "Helvetica Neue", sans-serif; font-size: 14px; margin-top: 10px; padding: 0px;">
In some cases there will be incompatible changes which happened on the develop branch when you are about to merge.<br />The pull request cannot be merged due to merge conflicts with your develop branch.</div>
<div style="background-color: white; color: #172b4d; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, "Fira Sans", "Droid Sans", "Helvetica Neue", sans-serif; font-size: 14px; margin-top: 10px; padding: 0px;">
<br /></div>
<div style="background-color: white; color: #172b4d; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, "Fira Sans", "Droid Sans", "Helvetica Neue", sans-serif; font-size: 14px; margin-top: 10px; padding: 0px;">
1) Checkout the current develop branch from remote locally.</div>
<div style="background-color: white; color: #172b4d; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, "Fira Sans", "Droid Sans", "Helvetica Neue", sans-serif; font-size: 14px; margin-top: 10px; padding: 0px;">
2) Checkout the feature branch locally</div>
<div style="background-color: white; color: #172b4d; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, "Fira Sans", "Droid Sans", "Helvetica Neue", sans-serif; font-size: 14px; margin-top: 10px; padding: 0px;">
3) When you have switched to your feature branch, use this command:</div>
<div class="code panel pdl conf-macro output-block" data-hasbody="true" data-macro-name="code" style="background-color: white; border-radius: 3px; border: 1px solid rgb(223, 225, 229); color: #333333; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, "Fira Sans", "Droid Sans", "Helvetica Neue", sans-serif; font-size: 14px; margin: 10px 0px; overflow: auto; padding: 0px;">
<div class="codeContent panelContent pdl" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; line-height: 20px; margin: 0px; overflow: hidden; padding: 0px;">
<div style="margin: 0px; padding: 0px;">
<div class="syntaxhighlighter sh-eclipse nogutter java" id="highlighter_399628" style="font-size: 1em; margin: 0px; overflow: auto; padding: 0px; position: relative; width: 1101px;">
<table border="0" cellpadding="0" cellspacing="0" style="background: none; border-radius: 0px; border: 0px; bottom: auto; box-sizing: content-box; float: none; font-family: Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace; font-size: 14px; height: auto; left: auto; line-height: 20px; margin: 0px; min-height: inherit; outline: 0px; overflow: visible; padding: 0px; position: static; right: auto; top: auto; vertical-align: baseline; width: 1101px;"><tbody style="background: none; border-radius: 0px; border: 0px; bottom: auto; box-sizing: content-box; float: none; height: auto; left: auto; line-height: 20px; margin: 0px; min-height: inherit; outline: 0px; overflow: visible; padding: 0px; position: static; right: auto; top: auto; vertical-align: baseline; width: auto;">
<tr style="background: none; border-radius: 0px; border: 0px; bottom: auto; box-sizing: content-box; float: none; height: auto; left: auto; line-height: 20px; margin: 0px; min-height: inherit; outline: 0px; overflow: visible; padding: 0px; position: static; right: auto; top: auto; vertical-align: baseline; width: auto;"><td class="code" style="background: none; border-radius: 0px; border: 0px; bottom: auto; box-sizing: content-box; float: none; height: auto; left: auto; line-height: 20px; margin: 0px; min-height: inherit; outline: 0px; overflow: visible; padding: 0px 0px 0px 15px; position: static; right: auto; top: auto; vertical-align: baseline; width: 1086px;"><div class="container" style="background: none; border-radius: 0px; border: 0px; bottom: auto; box-sizing: content-box; float: none; height: auto; left: auto; line-height: 20px; margin: 15px 0px 0px; min-height: inherit; outline: 0px; overflow: visible; padding: 0px 0px 15px 0em; position: relative; right: auto; top: auto; vertical-align: baseline; white-space: pre-wrap; width: auto;" title="Hint: double-click to select code">
<div class="line number1 index0 alt2" style="background: none; border-radius: 0px; border: 0px; bottom: auto; box-sizing: content-box; float: none; height: auto; left: auto; line-height: 20px; margin: 0px; min-height: inherit; outline: 0px; overflow: visible; padding: 0px 1em 0px 0em; position: static; right: auto; top: auto; vertical-align: baseline; white-space: nowrap; width: auto;">
<code class="java plain" style="background: none; border-radius: 0px; border: 0px; bottom: auto; box-sizing: content-box; float: none; font-family: Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace; height: auto; left: auto; line-height: 20px; margin: 0px; min-height: inherit; outline: 0px; overflow: visible; padding: 0px; position: static; right: auto; top: auto; vertical-align: baseline; width: auto;">$git merge develop</code></div>
</div>
</td></tr>
</tbody></table>
</div>
</div>
</div>
</div>
<div style="background-color: white; color: #172b4d; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, "Fira Sans", "Droid Sans", "Helvetica Neue", sans-serif; font-size: 14px; margin-top: 10px; padding: 0px;">
4) The merge conflicts are now shown.</div>
<div style="background-color: white; color: #172b4d; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, "Fira Sans", "Droid Sans", "Helvetica Neue", sans-serif; font-size: 14px; margin-top: 10px; padding: 0px;">
5) Use IntelliiJ Merge Tool to resolve the merge conflicts: <a class="external-link" href="https://www.jetbrains.com/help/idea/resolving-conflicts.html" rel="nofollow" style="color: #003399; text-decoration-line: none;" target="_blank">https://www.jetbrains.com/help/idea/resolving-conflicts.html</a></div>
<div style="background-color: white; color: #172b4d; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, "Fira Sans", "Droid Sans", "Helvetica Neue", sans-serif; font-size: 14px; margin-top: 10px; padding: 0px;">
<b>Note:</b> there is also the standard GIT merge-tool which will work as a stand-alone without an IDE.</div>
<div style="background-color: white; color: #172b4d; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, "Fira Sans", "Droid Sans", "Helvetica Neue", sans-serif; font-size: 14px; margin-top: 10px; padding: 0px;">
6) Push everything to your remote feature branch</div>
<div style="background-color: white; color: #172b4d; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, "Fira Sans", "Droid Sans", "Helvetica Neue", sans-serif; font-size: 14px; margin-top: 10px; padding: 0px;">
7) Merge the pull request via Bitbucket or other tool.</div>
</div>
Tim Harder (Owner of Harder IT Consulting)http://www.blogger.com/profile/11732226431914526209noreply@blogger.com0tag:blogger.com,1999:blog-574816006572109947.post-82678547942052428422018-11-23T04:12:00.001-08:002018-11-23T04:16:57.207-08:00GIT - Replace local branch with remote branch.<br />
<ul>
<li>Delete the local branch:</li>
</ul>
<code style="background-color: #eff0f1; border: 0px; box-sizing: inherit; font-family: consolas, menlo, monaco, "lucida console", "liberation mono", "dejavu sans mono", "bitstream vera sans mono", "courier new", monospace, sans-serif; font-size: 13px; font-stretch: inherit; font-variant: inherit; font-weight: inherit; line-height: inherit; margin: 0px; padding: 1px 5px; vertical-align: baseline; white-space: pre-wrap;"><i>git branch -d local_branch</i></code><br />
<ul>
<li>Fetch remote branch: </li>
</ul>
<span style="background-color: white; font-family: inherit; font-size: 15px; font-style: inherit; font-weight: inherit;"> </span><code style="background-color: #eff0f1; border: 0px; box-sizing: inherit; font-family: consolas, menlo, monaco, "lucida console", "liberation mono", "dejavu sans mono", "bitstream vera sans mono", "courier new", monospace, sans-serif; font-size: 13px; font-stretch: inherit; font-variant: inherit; font-weight: inherit; line-height: inherit; margin: 0px; padding: 1px 5px; vertical-align: baseline; white-space: pre-wrap;"><i>git fetch origin remote_branch</i></code><br />
<ul>
<li>Rebuild the local branch with remote content: </li>
</ul>
<span style="background-color: white; font-family: inherit; font-size: 15px; font-style: inherit; font-weight: inherit;"> </span><i><code style="background-color: #eff0f1; border: 0px; box-sizing: inherit; font-family: consolas, menlo, monaco, "lucida console", "liberation mono", "dejavu sans mono", "bitstream vera sans mono", "courier new", monospace, sans-serif; font-size: 13px; font-stretch: inherit; font-variant: inherit; font-weight: inherit; line-height: inherit; margin: 0px; padding: 1px 5px; vertical-align: baseline; white-space: pre-wrap;">git checkout -b local_branch </code><code style="background-color: #eff0f1; border: 0px; box-sizing: inherit; font-family: consolas, menlo, monaco, "lucida console", "liberation mono", "dejavu sans mono", "bitstream vera sans mono", "courier new", monospace, sans-serif; font-size: 13px; font-stretch: inherit; font-variant: inherit; font-weight: inherit; line-height: inherit; margin: 0px; padding: 1px 5px; vertical-align: baseline; white-space: pre-wrap;">origin/remote_branch</code></i><br />
<br />
<span style="color: #242729; font-family: "consolas" , "menlo" , "monaco" , "lucida console" , "liberation mono" , "dejavu sans mono" , "bitstream vera sans mono" , "courier new" , monospace , sans-serif;"><span style="font-size: 13px; white-space: pre-wrap;"><br /></span></span>
Tim Harder (Owner of Harder IT Consulting)http://www.blogger.com/profile/11732226431914526209noreply@blogger.com0tag:blogger.com,1999:blog-574816006572109947.post-91005429674344429212018-08-30T07:56:00.004-07:002018-08-30T07:59:32.725-07:00GIT Troubleshooting - revert and pull not possible?<div style="background-color: black; margin-top: 10px; padding: 0px;">
<span style="font-family: "arial" , sans-serif;"><span style="font-size: 14px;">Sometimes a file does not differ from the repository version. But GIT shows it as modified and does not accept a revert.</span></span><br />
<span style="font-family: "arial" , sans-serif;"><span style="font-size: 14px;"><br /></span></span>
<span style="font-family: "arial" , sans-serif;"><span style="font-size: 14px;">This file, however should not be commited, because it has not changed, but is simply not properly managed by GIT.</span></span><br />
<span style="font-family: "arial" , sans-serif;"><span style="font-size: 14px;"><br /></span></span>
<span style="font-family: "arial" , sans-serif;"><span style="font-size: 14px;">This is related to GIT working in file mode.</span></span><br />
<span style="font-family: "arial" , sans-serif;"><span style="font-size: 14px;"><br /></span></span>
<span style="font-family: "arial" , sans-serif; font-size: 14px;">Try this and then pull again:</span><br />
<span style="font-family: "arial" , sans-serif;"><span style="font-size: 14px;"><br /></span></span>
<span style="font-size: 14px;"><i><span style="font-family: "courier new" , "courier" , monospace;">$git config core.fileMode false</span></i></span></div>
Tim Harder (Owner of Harder IT Consulting)http://www.blogger.com/profile/11732226431914526209noreply@blogger.com0