<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Thomas on Medium]]></title>
        <description><![CDATA[Stories by Thomas on Medium]]></description>
        <link>https://medium.com/@thoker?source=rss-7fcf8c2ddeb4------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*K0uUefQc9F1cNxg9.jpg</url>
            <title>Stories by Thomas on Medium</title>
            <link>https://medium.com/@thoker?source=rss-7fcf8c2ddeb4------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 05 Dec 2026 08:31:43 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@thoker/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Wiremock How to easily mock REST / SOAP or any other API]]></title>
            <link>https://towardsdev.com/wiremock-how-to-easily-mock-rest-soap-or-any-other-api-5ad276f66145?source=rss-7fcf8c2ddeb4------2</link>
            <guid isPermaLink="false">https://medium.com/p/5ad276f66145</guid>
            <category><![CDATA[software-testing]]></category>
            <category><![CDATA[wiremock]]></category>
            <category><![CDATA[software]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[software-engineering]]></category>
            <dc:creator><![CDATA[Thomas]]></dc:creator>
            <pubDate>Wed, 02 Mar 2022 14:32:52 GMT</pubDate>
            <atom:updated>2022-03-02T14:32:52.167Z</atom:updated>
            <content:encoded><![CDATA[<h3>How to easily mock any API in under 5 minutes with WireMock</h3><p>When working with external API’s you might have come to a point, where you want to test you application against them without really calling the API. This could be due to rate limits or you want to test a specific action response without actually executing this action. For Example imagine our sample API <em>http://coffeecompany.com/brew</em> where our local coffee machine starts brewing a coffee.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*oFb6Q8O92K71T8Yo" /><figcaption>Photo by <a href="https://unsplash.com/@lighttouchedphotography?utm_source=medium&amp;utm_medium=referral">Kevin Schmid</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>It would be rather bothersome when we have to brew hundreds of different coffees during development to integrate this API in another software.</p><blockquote>To solve this problem developers use mocking services which can simulate a response, without actually calling the API.</blockquote><p>There are many tools available, which support different features and have different pricing models. I will discuss multiple other tools at the end of the article, but now I want to show you WireMock. WireMock is a free and open-source mock and testing framework, which can be used as standalone application or integrated in JAVA JUnit tests. We will focus on the standalone application, which supports all features and allows file configuration or dynamic runtime configuration.</p><h3>Getting started with WireMock Standalone</h3><h4>Prerequisites</h4><ul><li>Make sure that you have installed Java. If you are not sure run “java -version” in the command line.</li><li>This guide is written on a windows machine, but it should work on any other device without problems</li></ul><p>At first we have to download the standalone WireMock jar from <a href="https://repo1.maven.org/maven2/com/github/tomakehurst/wiremock-jre8-standalone/">here</a>. The current version is <a href="https://repo1.maven.org/maven2/com/github/tomakehurst/wiremock-jre8-standalone/2.32.0/wiremock-jre8-standalone-2.32.0.jar">2.32</a>. Then I recommend putting the jar in a seperate folder.</p><p>Open the command line in the folder. A handy trick here is to type “cmd” in the directory line of the folder and press enter.</p><pre>java -jar wiremock-jre8-standalone-2.32.0.jar</pre><p>Use the command above to start the mocking service. There are multiple additional parameters, which you can add to configure logging, certificates (https communication), port binding, proxy behavior and record behavior.</p><p>Now you can either setup the configuration dynamically by making http requests to the WireMock Server or creating a file structure in the folder of your jar.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*SCbpRL7Y2BGLl7GDroo-RA.png" /><figcaption>The startup console</figcaption></figure><p>After that there should be two folder named mapping and __files. In the file folder you can simply put folder and files, which your server will serve when called with a GET request. Look at the file structure</p><pre>.<br>└── WireMock/<br>    ├── wiremock-jre8-standalone-2.32.0.jar<br>    ├── __files/<br>    │   ├── something.json<br>    │   └── sites/<br>    │       ├── brewdata.json<br>    │       └── homepage.html<br>    └── mappings</pre><p>Now you can call <a href="http://localhost:8080/sites/brewdata.json">http://localhost:8080/something.json</a>, <a href="http://localhost:8080/sites/brewdata.json">http://localhost:8080/sites/brewdata.json</a> or <a href="http://localhost:8080/sites/homepage.html">http://localhost:8080/sites/homepage.html</a> in your browser or a testing tool like Postman. <strong>Make sure that you restart your server to see these changes!</strong></p><blockquote>In the mappings folder you can setup more advanced mocking behaviors.</blockquote><p>Just create a .json file with the following content for example.</p><pre>{<br>    &quot;request&quot;: {<br>        &quot;method&quot;: &quot;GET&quot;,<br>        &quot;url&quot;: &quot;/api/brew&quot;<br>    },<br>    &quot;response&quot;: {<br>        &quot;status&quot;: 200,<br>        &quot;body&quot;: &quot;Brewed some fresh coffee&quot;,<br>        &quot;headers&quot;: {<br>            &quot;Content-Type&quot;: &quot;text/plain&quot;<br>        }<br>    }<br>}</pre><p>For json you can use jsonBody like shown below to avoid escaping the content.</p><pre>&quot;jsonBody&quot;: {<br>          &quot;arbitrary_json&quot;: [1, 2, 3]<br>        }</pre><p>You can also specify files for the response</p><pre>&quot;bodyFileName&quot;: &quot;path/to/myfile.xml&quot;</pre><p>Checkout the <a href="https://wiremock.org/docs/stubbing/">stubbing documentation</a> for further information.</p><p>Sometimes it can also be helpful to return different values for each request. Helpers can make this possible with ease.</p><p>For example the randomInt helper can return a random integer. To use it we need to specify the response-templating in the startup and in the response.</p><p>Your mapping should look like this.</p><pre>{<br>    &quot;request&quot;: {<br>        &quot;method&quot;: &quot;GET&quot;,<br>        &quot;url&quot;: &quot;/customer&quot;<br>    },<br>    &quot;response&quot;: {<br>        &quot;status&quot;: 200,<br>        &quot;body&quot;: &quot;Number customers: {{randomInt lower=5 upper=9}}.&quot;,<br>        &quot;transformers&quot;: [&quot;response-template&quot;]<br>    }<br>}</pre><p>Start the server with the following command:</p><pre>java -jar wiremock-jre8-standalone-2.32.0.jar<br>       --local-response-templating</pre><p>Alternatively you can start it with the flag “ — global-response-templating” and drop the transformer field.</p><p>There are many build in helpers to generate values and you can even build your own transformers in java. Leave a comment if you are interested in an advanced tutorial about that.</p><ul><li>Xpath Helper: simply select an element from the xml request</li><li>JsonPath Helper: select an element from the json request</li><li>Date and Time Helper: respond with a specific or relative date or time in your response</li><li>Random value Helper: generate different random values (strings, uuid, numbers, etc)</li><li>Random pick Helper: returns a random element from a given list</li><li>Math Helper: performs basic math operations</li><li>Contains Helper: checks if a string contains another string</li><li>Matches Helper: check if a string matches with a RegEx</li><li>base64 and Url Helper: encode/decode base64 and URL</li><li>Regex Extractor Helper: extracts only values, which match the regex</li><li>Conditional Helper: only return if the condition applies</li></ul><p>Of course you can combine multiple Helpers. A simple example:</p><pre>{<br>    &quot;request&quot;: {<br>        &quot;method&quot;: &quot;POST&quot;,<br>        &quot;url&quot;: &quot;/customer&quot;<br>    },<br>    &quot;response&quot;: {<br>        &quot;status&quot;: 200,<br>        &quot;body&quot;: &quot;{{parseJson request.body &#39;bodyJson&#39;}} {{#contains bodyJson.outer.inner &#39;abc&#39;}}YES{{/contains}}&quot;,<br>        &quot;transformers&quot;: [&quot;response-template&quot;]<br>    }<br>}</pre><p>Will return YES for the following request.</p><pre>{<br>  &quot;outer&quot;: {<br>    &quot;inner&quot;: &quot;abcd&quot;<br>  }<br>}</pre><p>Sources</p><ul><li>WireMock: <a href="https://wiremock.org/">https://wiremock.org/</a></li><li>Stubbing: <a href="https://wiremock.org/docs/stubbing/">https://wiremock.org/docs/stubbing/</a></li><li>Response Template: <a href="https://wiremock.org/docs/response-templating/">https://wiremock.org/docs/response-templating/</a></li></ul><p>If you are interested in dynamic configuration, certificate setup or the record and playback feature, which can automatically generate stubs please let me know.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5ad276f66145" width="1" height="1" alt=""><hr><p><a href="https://towardsdev.com/wiremock-how-to-easily-mock-rest-soap-or-any-other-api-5ad276f66145">Wiremock How to easily mock REST / SOAP or any other API</a> was originally published in <a href="https://towardsdev.com/">Towards Dev</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Diagrams directly in markdown with 5 lines of code]]></title>
            <link>https://towardsdev.com/diagrams-directly-in-markdown-with-5-lines-of-code-7a3182baa484?source=rss-7fcf8c2ddeb4------2</link>
            <guid isPermaLink="false">https://medium.com/p/7a3182baa484</guid>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[software-engineering]]></category>
            <category><![CDATA[github]]></category>
            <dc:creator><![CDATA[Thomas]]></dc:creator>
            <pubDate>Fri, 18 Feb 2022 09:43:13 GMT</pubDate>
            <atom:updated>2022-02-21T07:42:16.766Z</atom:updated>
            <content:encoded><![CDATA[<h3>Easy diagrams directly in markdown</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*UAlCMJbBGFNC_M61.png" /><figcaption><a href="https://github.com/mermaid-js/mermaid">mermaid.js</a></figcaption></figure><p>Whenever you start describing a complex problem or just want to explain the general architecture of your project, a diagram can come in handy.</p><blockquote>Forget the days when you needed a 3rd party library to create images for your Readme or Wiki. Github just announced support for <a href="https://github.blog/2022-02-14-include-diagrams-markdown-files-mermaid/">Mermaid</a> in their markdown rendering engine and it has never been easier.</blockquote><p>Write all types of uml diagrams in a few lines of code in markdown. Look for example at the sequence and flow diagram below. It’s just that easy.</p><pre><strong>sequenceDiagram</strong><br>    participant Alice<br>    participant Bob<br>    Alice<strong>-&gt;&gt;</strong>John<strong>:</strong> Hello John, how are you?<br>    <strong>loop</strong> Healthcheck<br>        John<strong>-&gt;&gt;</strong>John<strong>:</strong> Fight against hypochondria<br>    <strong>end</strong><br>    Note right of John<strong>:</strong> Rational thoughts &lt;br/&gt;prevail!<br>    John<strong>--&gt;&gt;</strong>Alice<strong>:</strong> Great!<br>    John<strong>-&gt;&gt;</strong>Bob<strong>:</strong> How about you?<br>    Bob<strong>--&gt;&gt;</strong>John<strong>:</strong> Jolly good!</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/690/0*5URApbk6GjRvIJjF.png" /><figcaption><a href="https://mermaid-js.github.io/mermaid/#/./sequenceDiagram">Sequence Diagram</a></figcaption></figure><pre> graph TD;<br>     A--&gt;B;<br>     A--&gt;C;<br>     B--&gt;D;<br>     C--&gt;D;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/300/0*gx7b5WyUP-qtXt_X" /><figcaption>Flow Diagram</figcaption></figure><p>And there are so many more possibilities.</p><ul><li>Flowchart</li><li>Sequence Diagram</li><li>Class Diagram</li><li>State Diagram</li><li>Entity Relationship Diagram</li><li>User Journey</li><li>Gantt</li><li>Pie Chart</li><li>Requirement Diagrams</li></ul><p>Check out the documentation, which is linked at the end of the article for more information.</p><h3>Embedding these diagrams in your markdown</h3><p>And embedding these diagrams in your markdown file is even more simple. Just put them inside a mermaid code block as shown below.</p><pre># My cool diagrams</pre><pre>```mermaid<br>PUT YOUR DIAGRAMS HERE</pre><pre>```</pre><h4>Support for VS Code</h4><p>Just install the plugin in the VS Code Marketplace <a href="https://marketplace.visualstudio.com/items?itemName=bierner.markdown-mermaid">Markdown Preview Mermaid</a> and you are ready to go. Alternatively you can also try the live editor @<a href="https://mermaid.live/">https://mermaid.live/</a> to test mermaid in your browser.</p><h3>PlantUML</h3><p>For completeness you also have to mention PlantUML, which on the first glance also allows to write UML diagrams directly in markdown. But contrary to markdown it is not using Javascript to render it directly in your browser, but Java for creating the diagrams. You can combine these with <em>Github Actions</em> (<a href="https://github.com/marketplace/actions/generate-plantuml">https://github.com/marketplace/actions/generate-plantuml</a>) to also add the images to your markdown. The advantages would be that your diagrams have to be rendered only once, but it requires a bit more setup to render you first diagram compared with <em>Mermaid</em>.</p><p>If you are interested for a complete guide with PlantUML let me know with a comment.</p><h3>Sources</h3><ul><li>Mermaid: <a href="https://mermaid-js.github.io/">https://mermaid-js.github.io/</a></li><li>Mermaid Live Editor: <a href="https://mermaid.live/edi">https://mermaid.live/edi</a>t/</li><li>Github Announcement: <a href="https://github.blog/2022-02-14-include-diagrams-markdown-files-mermaid/">https://github.blog/2022-02-14-include-diagrams-markdown-files-mermaid/</a></li><li>PlantUML: <a href="https://plantuml.com/de/">https://plantuml.com/</a></li><li>PlantUML Action: <a href="https://github.com/marketplace/actions/generate-plantuml">https://github.com/marketplace/actions/generate-plantuml</a>/</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7a3182baa484" width="1" height="1" alt=""><hr><p><a href="https://towardsdev.com/diagrams-directly-in-markdown-with-5-lines-of-code-7a3182baa484">Diagrams directly in markdown with 5 lines of code</a> was originally published in <a href="https://towardsdev.com/">Towards Dev</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[UML relations for class diagrams, everything you need to know]]></title>
            <link>https://thoker.medium.com/uml-relations-for-class-diagrams-everything-you-need-to-know-c784fa2645bb?source=rss-7fcf8c2ddeb4------2</link>
            <guid isPermaLink="false">https://medium.com/p/c784fa2645bb</guid>
            <category><![CDATA[diagrams]]></category>
            <category><![CDATA[computer-science]]></category>
            <category><![CDATA[uml]]></category>
            <category><![CDATA[software-architecture]]></category>
            <category><![CDATA[software-engineering]]></category>
            <dc:creator><![CDATA[Thomas]]></dc:creator>
            <pubDate>Sun, 29 Nov 2020 12:30:35 GMT</pubDate>
            <atom:updated>2020-11-29T12:30:35.772Z</atom:updated>
            <content:encoded><![CDATA[<p>There are multiple types of UML relations in a class diagram. Here is a list, which shows how and when to use different relations with short examples.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/528/1*93BD42TfSxK-ZPv9j5m1zQ.png" /></figure><h3>Association</h3><p>An association is a relationship, where 2 components interact with each other in some way, but are not dependent or related with each other. For example an author writes a book. A User opens a door. A student writes a test.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/796/1*O-UuJhZS2-VtjchkLA2anw.png" /></figure><p>You can also write an association with a cardinality. For a example a student has multiple tests and a test has multiple students.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/801/1*yAC17pm6p9d-plLn7Vqv5w.png" /></figure><h3>Dependency</h3><p>A dependency relationship says that component A relates somehow with component B. It is a bit tricky, because it can mean multiple different relations [<a href="https://www.uml-diagrams.org/dependency.html">https://www.uml-diagrams.org/dependency.html</a>].</p><p>There are 2 important types of dependencies in UML Class diagrams:</p><ul><li>use</li></ul><p>▹create</p><p>▹call</p><p>▹send</p><ul><li>abstraction</li></ul><p>▹ realization</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/807/1*Nck7ZUS2l2LJBc4PlfzLVw.png" /></figure><p>Although realization has a different arrowhead than general dependency, it is also a type of dependency relationship. A realization is for example a class, which realizes an interface.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/799/1*W4iUcx8gqdoa_dOlXQdNAg.png" /></figure><h3>Composition</h3><p>Component A depends on component B. For example a bullet point on a list can’t exist without that list. When you delete component B, A also gets deleted.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/825/1*BA5QP2mraLtODiUtMBWMVw.png" /></figure><h3>Aggregation</h3><p>Component B has multiple components A. But when you delete component B, A still exists.</p><p>Example: A football team has multiple players. When the team gets dissolved, then the players still exist and may want to apply to other teams.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/819/1*qcO3aXKSmxs4SQnohWYJ9Q.png" /></figure><h3>Generalization</h3><p>Generalization is when a component inherits from another component. For example horse inherits from animal. The difference between generalization and realization is like inheritation and implementation, simplified.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/812/1*97kbZiHUuMT7aCiH2eTc2g.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c784fa2645bb" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Jacobi and Gauss-Seidel method to solve a matrix]]></title>
            <link>https://thoker.medium.com/jacobi-and-gauss-seidel-method-to-solve-a-matrix-9e4f0606be55?source=rss-7fcf8c2ddeb4------2</link>
            <guid isPermaLink="false">https://medium.com/p/9e4f0606be55</guid>
            <category><![CDATA[gauss-seidel]]></category>
            <category><![CDATA[jacobi]]></category>
            <category><![CDATA[computer-science]]></category>
            <category><![CDATA[mathematics]]></category>
            <dc:creator><![CDATA[Thomas]]></dc:creator>
            <pubDate>Sun, 19 Jul 2020 13:05:14 GMT</pubDate>
            <atom:updated>2020-07-19T13:05:14.211Z</atom:updated>
            <content:encoded><![CDATA[<h3>What are the Jacobi and Gauss-Seidel method ?</h3><p>Jacobi and Gauss — Seidel are iterative methods, which are used to solve linear systems of equations.</p><h3><strong>Why do we need it ?</strong></h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*3yCCZpVanLa4VTsRaxqjTw.png" /><figcaption>Blackbox Jacobi &amp; Gauss</figcaption></figure><p>For such a small 3x3 matrix like this one you may think that it would be much simpler to solve it with a more classical approach like Gaussian elimination. And you are absolutely right! But a big advantage is that these methods can create a nearly correct result in much less time, when working with gigantic matrices.</p><p><strong>An example:</strong></p><p>Assume we have a 7.000.000* 7.000.000 matrix. For example from some particle or gravity simulation in physics.</p><p>When using a classical approach, like the Gaussian elimination method, you have a <strong>runtime complexity Big O of 2n³/3</strong>. Whereas with Jacobi / Gauss Seidel you have <strong>n² * Iterations</strong>. ( (number of rows * number of columns) * Iterations)</p><p>Assuming we have a maximum number of 100.000 iterations we are saving over 2,2 * 10²⁰ Operations.</p><h3>How does it work ?</h3><p>A simple cook recipe:</p><ol><li>We are making an initial guess what our results could be. (Normally for x1,x2,…xn = 0)</li><li>We are calculating new values for xₙ with the formula below</li><li>We are calculating an Error comparing the result of our previous iteration with our new results.</li><li>We are repeating steps 2–4 until our error is small enough.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/605/1*l1O1AyUT5LdeW8SlPcCdaQ.png" /></figure><p><strong>Jacobi method:</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/994/1*t7i2ne0c4nq2iIKtMauhxA.png" /><figcaption>First 2 Iterations with the Jacobi method</figcaption></figure><p>To determine the error, you simply calculate the total deviation between xₙ from the first iteration and the second iteration (and so on for every further iteration).</p><p><strong>Gauss-Seidel method:</strong></p><p>The Gauss-Seidel method uses the same formula as Jacobi, but immediately updates the values xₙ in the same Iteration. Therefore it needs less iterations to calculate a good result, but you can’t parallelize the calculations in the same iterations, because each xₙ needs the results of the previous xₙ n=0,1,…n.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*GVARmjZ7-MtTp5ceGnVo3Q.png" /><figcaption>First 2 Iterations with the Gauss-Seidel method</figcaption></figure><p><strong>One important last point</strong></p><p>Gauss-Seidel and Jacobi are not working for every matrix. In fact the given example in this article is not getting a final result. This is because it only works for matrices, which have a <a href="https://en.wikipedia.org/wiki/Spectral_radius">spectral radius</a> that is less than 1. Another condition, which works most of the time, but not always is that the matrix is <a href="https://en.wikipedia.org/wiki/Diagonally_dominant_matrix">diagonally dominant</a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9e4f0606be55" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>