<?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 Jan Christian Alvestad on Medium]]></title>
        <description><![CDATA[Stories by Jan Christian Alvestad on Medium]]></description>
        <link>https://medium.com/@jancalve?source=rss-730e54a706e3------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*KcTqzROt9b7Ru-umOgTv5A.jpeg</url>
            <title>Stories by Jan Christian Alvestad on Medium</title>
            <link>https://medium.com/@jancalve?source=rss-730e54a706e3------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 21 Nov 2026 07:45:36 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@jancalve/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[RAGArchitect — Hand-craft prompts for your data while maintaining privacy and accurate results.]]></title>
            <link>https://medium.com/@jancalve/ragarchitect-hand-craft-prompts-for-your-data-while-maintaining-privacy-and-accurate-results-3d718ed1a593?source=rss-730e54a706e3------2</link>
            <guid isPermaLink="false">https://medium.com/p/3d718ed1a593</guid>
            <category><![CDATA[software-architecture]]></category>
            <category><![CDATA[llm]]></category>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[retrieval-augmented-gen]]></category>
            <category><![CDATA[artificial-intelligence]]></category>
            <dc:creator><![CDATA[Jan Christian Alvestad]]></dc:creator>
            <pubDate>Sun, 13 Apr 2025 00:07:44 GMT</pubDate>
            <atom:updated>2025-04-13T08:26:31.601Z</atom:updated>
            <content:encoded><![CDATA[<h3><em>RAGArchitect — Hand-craft prompts for your data while maintaining privacy and accuracy.</em></h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*j2PZAqXQCGpwzzZn" /></figure><p><em>DISCLAIMER: This article is about a personal project of mine that I’ve decided to open-source. I’m finding it useful for removing some of the boring tasks in my day-to-day and I hope this tool can help others as well.</em></p><p><strong><em>Large Language Models (LLMs)</em></strong> are powerful, but they often rely on cloud-based APIs that may expose your private data — and, by themselves, they can be prone to “<strong><em>forgetting</em></strong>” important context.</p><p><a href="https://github.com/jancalve/ragarchitect"><strong>RAGArchitect</strong></a> tackles these challenges head-on. Designed to be a privacy-first, all-in-one Retrieval-Augmented Generation (RAG) system, it gives you <strong><em>fine-grained control</em></strong> over what goes into your LLM’s context window, keeps <strong><em>data on your local machine</em></strong>, and allows you to integrate <strong><em>multiple data sources</em></strong> seamlessly.</p><h3>Why did I create RAGArchitect?</h3><p>I created this system to solve a “Tech lead” problem I faced in my day-to-day job.</p><p>We have tons of code in GIT as well as enough documentation in Confluence that I firmly believe we also have an article on the true meaning of Life if you bother long enough.</p><p>What I missed was a simple interface to cherry-pick from both documentation and code for my prompts, so I could use it as a way to quickly generate documentation, JIRA-tasks for new features, creating system diagrams and so on.</p><p>Traditional RAG systems would often pick outdated information <strong><em>(Shit in)</em></strong> and go off on a wrong tangent <strong><em>(Shit out)</em></strong> while being totally unacceptable from a company privacy point-of-view (<strong><em>Pants down)</em></strong>.</p><p>Additionally, being able to use the actual code as a source of truth for documentation in Confluence is a god-send. It is tedious enough to ensure Confluence is up-to-date and accurate — RAGArchitect simply makes that process a thousand times easier.</p><p>Do not get me wrong — “vanilla” RAG definitely has its place and some of the techniques are mind-blowing and quite accurate, but when you deal with real-life data you want a “Human-in-the-middle” when accuracy is of paramount importance. You don’t want a feather turning into ten chickens in your code nor in your docs :)</p><h3>Why RAGArchitect?</h3><h3>1. Control Over the Context Window</h3><p>Many RAG systems rely heavily on vector searches to decide which snippets to include when you prompt an LLM. RAGArchitect, however, places you firmly in the driver’s seat. You can hand-craft your query and decide exactly what context the LLM sees. This manual approach ensures you <strong>never omit critical details</strong> — perfect for high-stakes scenarios where model hallucinations or missed context can lead to incorrect results.</p><p>Additionally, you have the chance to omit <em>incorrect</em> information that might be residing in your data source. Traditional RAG systems would require you to re-index that data or add information about that in your prompt in order to get accurate replies.</p><h3>2. Privacy-First Approach</h3><p>All data stays on your machine if you choose to. RAGArchitect fetches information from your gated sources — like Git, Confluence, or other repositories — and can even run <strong>local inference</strong> with no cloud dependencies. If you’re worried about sending proprietary code or confidential text to external APIs, this feature alone can be a game-changer.</p><h3>3. Connect Disparate Data Sources</h3><p>Context doesn’t just live in one place — especially if you’re working across different platforms and documentation tools. RAGArchitect lets you write andplug in <strong>indexers</strong> for various data sources (such as Git repositories or Confluence pages). Once indexed, these sources can be used side by side, ensuring your LLM always has the most relevant data at its digital fingertips.</p><h3>4. Modular Inference Providers</h3><p>Choosing the right LLM shouldn’t box you into a single platform. RAGArchitect supports multiple inference providers out of the box:</p><ul><li><strong>Local Inference</strong> via <a href="https://github.com/jmorganca/ollama">Ollama</a></li><li><strong>Generic Inference </strong>(via your own wrapper service)</li><li><strong>AWS Bedrock</strong></li><li><strong>vLLM </strong>(Beta)</li><li>If a particular provider isn’t supported yet, it’s easy to write a proxy that bridges the gap, letting you switch or experiment with new LLMs as they emerge.</li></ul><h3>5. Zero-Shot Prompting (Not a Conversational AI)</h3><p>Unlike typical chatbots that maintain extended dialogues, RAGArchitect focuses on <strong>single-prompt sessions</strong> (zero-shot).</p><p>Why?</p><p>Because every LLM has a finite context window, and once you exceed it, previous information is forgotten. By forcing you to explicitly re-include context for each prompt, RAGArchitect prevents “stealth forgetfulness” and ensures the LLM’s responses are always anchored in the relevant data.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*yrtzyzCKt0fNO4w3cmBtFQ.png" /><figcaption>Cherry-picking context from code</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*tz5MhjqREi6zcr3cGmQTyw.png" /><figcaption>Generating a README.md</figcaption></figure><h3>Key Components</h3><p><strong>Backend (Spring Boot)</strong></p><ul><li>Exposes REST endpoints under /api/llm for chat, raw prompts, and vector searches.</li><li>Ties together vector search (Qdrant) with your chosen LLM inference provider.</li></ul><p><strong>Frontend (Vaadin)</strong></p><ul><li>Provides a user-friendly interface at http://localhost:8080/chat (for quick Q&amp;A) and http://localhost:8080/architect (for more advanced prompting and data inspection).</li></ul><p><strong>Indexers (Git &amp; Confluence)</strong></p><ul><li>Python-based scripts that populate the Qdrant vector database with embeddings of your codebase and documentation.</li></ul><p><strong>Qdrant</strong></p><ul><li>A vector database for storing embeddings and performing efficient similarity searches.</li></ul><p><strong>Inference Providers</strong></p><ul><li><strong>Ollama</strong> for local inference (a great choice to keep all data offline).</li><li><strong>AWS Bedrock</strong></li><li><strong>Generic</strong> (Bridge for any other service).</li><li>vLLM (BETA — not stable yet)</li></ul><h3>Getting Started</h3><p><strong>Step 1: Clone the Repository</strong></p><pre>git clone https://github.com/jancalve/ragarchitect.git<br>cd ragarchitect</pre><p><strong>Step 2: Create a </strong><strong>.env File</strong></p><p>Copy the example file and then open it to set tokens or model paths:</p><pre>cp .env.example .env</pre><p>Inside .env, specify values such as:</p><pre>CONFLUENCE_TOKEN=your_confluence_token_here<br>GIT_TOKEN=your_git_token_here<br>EMBEDDING_MODEL_PATH=/app/models/all-MiniLM-L6-v2<br>LLM_MODEL_PATH=/app/models/Llama-3.2-3B-Instruct</pre><p>If you’re not using Confluence or Git repos, you can skip those tokens.</p><p><strong>Step 3: Download Models</strong></p><p>Download the models you want to use. As these are downloaded and packaged in the images, you don’t need internet connectivity.</p><pre>./app/download_models.sh</pre><p><strong>Step 4: Spin Up the Services</strong></p><p>RAGArchitect runs via Docker Compose. For local inference (Ollama profile):</p><pre>docker compose -f docker-compose.yml -f docker-compose.ollama.yml --profile ollama up</pre><p>Visit <a href="https://github.com/jancalve/ragarchitect#readme">the project README</a> for details on other profiles (like <strong>Generic</strong> or <strong>vLLM</strong>).</p><h3>Usage</h3><p>Once your containers are up, open a browser and head to:</p><p><strong>Chat Interface</strong>:<br> <a href="http://localhost:8080/chat">http://localhost:8080/chat</a></p><ul><li>Ideal for quick Q&amp;A with the LLM, augmented by your indexed data.</li></ul><p><strong>Architect View</strong>:<br> <a href="http://localhost:8080/architect">http://localhost:8080/architect</a></p><ul><li>Offers more advanced features such as manually tweaking context or analyzing how large your prompts are vs. the LLM’s context window size.</li><li>Find relevant context by using vector search (The irony..)</li></ul><p><strong>API Endpoints</strong><br> If you’re a developer integrating RAGArchitect into another app, all LLM operations are exposed under /api/llm.</p><ul><li>POST /api/llm/chat – For chat-like interactions.</li><li>POST /api/llm/prompt – For raw prompt execution.</li><li>GET /api/llm/vector-search – For advanced retrieval queries.</li></ul><h3>Customizing Models</h3><p>RAGArchitect supports multiple Hugging Face models. To switch models:</p><ol><li>Download your chosen model (e.g., from Hugging Face).</li><li>Update EMBEDDING_MODEL_PATH or LLM_MODEL_PATH in .env.</li><li>Rebuild the Docker environment if needed:</li></ol><h3>Best Practices &amp; Tips</h3><p><strong>Index Carefully</strong><br>Garbage in, garbage out. If possible, try to ensure your Git or Confluence data is clean before indexing. But if your data is partially incorrect or cluttered, you still have the option to fix it before prompt-time.</p><p><strong>Prompt Engineering</strong><br> With RAGArchitect, you have granular control over the final prompt. Use it! You can insert disclaimers, step-by-step instructions, or references to ensure the LLM has the right context.</p><p>RAGArchitect also comes with a set of prompt templates so you can DRY ;)</p><p><strong>Monitor Context Window Sizes</strong><br> RAGArchitect will warn you if your constructed prompt exceeds the model’s context window. Make it a habit to keep an eye on those prompt sizes, especially when dealing with extensive code or documents.</p><p><strong>Stay Local for Privacy</strong><br> If your data is highly sensitive, stick to local inference. Ollama or other local inference modes are a great way to keep everything behind your own firewall.</p><h3>Contributing</h3><p>RAGArchitect is licensed under MIT, so contributions are always welcome.</p><p>I<a href="https://github.com/jancalve/ragarchitect?tab=readme-ov-file#contributing">n fact, this is the perfect time to join</a> if you have ever wanted to learn more about AI and how everything ticks under the hood.</p><p>Check out the <a href="https://github.com/jancalve/ragarchitect/issues">GitHub issues</a> for ideas or submit a pull request directly. Feel free to:</p><ul><li>Add new inference providers.</li><li>Extend the indexing logic for additional data sources (e.g., Slack messages, JIRA issues).</li><li>Improve the UI or create custom UI for specialized tasks.</li></ul><h3>Final Thoughts</h3><p><strong>RAGArchitect</strong> stands out in a sea of RAG tools by combining <strong>strict privacy</strong>, <strong>context-window transparency</strong>, and a <strong>modular design</strong>. If you’re looking for a powerful, adaptable solution to harness the best of LLMs — without leaking proprietary data — this might just be the tool for you.</p><p>Want to learn more or jump straight into the code? Check out the <a href="https://github.com/jancalve/ragarchitect">GitHub repository</a>!</p><p><em>Thanks for reading! If you enjoyed this article, consider sharing it with fellow developers, data scientists, or privacy enthusiasts who might find RAGArchitect a valuable addition to their tech stack.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3d718ed1a593" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Supercharge Your Shell: Using Local AI Models with Simple Commands]]></title>
            <link>https://medium.com/@jancalve/supercharge-your-shell-using-local-ai-models-with-simple-commands-602c22bbe480?source=rss-730e54a706e3------2</link>
            <guid isPermaLink="false">https://medium.com/p/602c22bbe480</guid>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[devops]]></category>
            <category><![CDATA[development]]></category>
            <category><![CDATA[local-llm]]></category>
            <category><![CDATA[llm]]></category>
            <dc:creator><![CDATA[Jan Christian Alvestad]]></dc:creator>
            <pubDate>Wed, 13 Nov 2024 15:31:29 GMT</pubDate>
            <atom:updated>2024-11-13T15:31:29.816Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*cm_9PNFN5qybVTnl" /></figure><p>I love the shell for its simplicity, thus I found it very useful to make it a bit “smarter” for those occasions I’d normally have to open some web interface or IDE just to access a GPT.</p><p>In addition, running an llm locally ensures your data (context) remains on your computer instead of potentially being recorded somewhere in the cloud.</p><p>As such, I created 2 simple shell functions, ask-ai and analyze-ai which use <a href="https://ollama.com/">ollama</a> to do the heavy lifting while retaining an easy way to try out <a href="https://ollama.com/library">other models</a>.</p><h4>Syntax: ask-ai &lt;model&gt; &lt;prompt&gt;</h4><p><em>Ask a question with a model of your choosing</em></p><p>Example: Ask it a really hard question</p><pre>ask-ai llama3.2 &quot;I have a java variable that should represent something with name, and it is bendy. It is also configurable. Suggest a name that is logical and approrpiate as a variable name for this.&quot;</pre><blockquote>Based on your description, I would suggest the following options:</blockquote><blockquote>1. `configurableShape`: This name conveys that the variable can hold<br>different shapes, but still has some configuration applied to it.<br>2. `configurableEntityName`: This name emphasizes that the entity (in this<br>case, a shape) has a configurable aspect to its name.<br>3. `bendyName`: This name is straightforward and highlights the<br>flexibility of the variable’s content.<br>4. `adjustableDimension`: If the “bendiness” refers to the variable’s<br>ability to adjust its dimension, this name would be fitting.<br>5. `dynamicAlias`: This name suggests that the variable can have multiple<br>aliases or representations, which fits with the idea of it being bendy and<br>configurable.</blockquote><h4>Syntax: &lt;piped source&gt; | analyze-ai &lt;model&gt; &lt;prompt&gt;</h4><p><em>Ask a question with a model of your choosing</em></p><p>Example: Ask it to analyze pod logs:</p><pre>kubectl logs elasticsearch-master-0 | analyze-ai llama3.2 &quot;Are there any issues in this elasticsearch instance?&quot;</pre><blockquote>The logs indicate that the Elasticsearch cluster is experiencing issues with one of its nodes, `elasticsearch-master-1`. The node has<br>disconnected from the cluster and has not been rejoined.</blockquote><blockquote>Here are the key events:</blockquote><blockquote>* A node (`elasticsearch-master-1`) disconnected from the cluster (logs timestamped around 12:13:12 UTC)<br>* After reconnection, the node is joined again but does not recover fully (log timestamped around 12:13:16 UTC). The node’s health remains<br>“YELLOW” instead of “GREEN”.<br>* A series of warnings appear in the logs about marking unavailable shards as stale for various indices. This suggests that the cluster is<br>unable to accurately determine which shards are available and can be used for queries.</blockquote><p>Note that this can be used for a variety of other sources as well</p><pre># Read from local file<br>cat export.csv | analyze-ai llama3.2 &quot;Who are the top performers?&quot;<br><br># Read from the web<br>curl -v https://www.my-news-site | &quot;What are the top stories?&quot;<br><br>cat uformatted.json | analyze-ai llama3.2 &quot;Format and pretty-print the json.&quot;<br></pre><h3>Setup</h3><p>Setting this up is (fortunately) rather easy</p><pre>brew update<br>brew install ollama<br>ollama pull llama3.2<br>ollama serve</pre><p>After which you add the functions to whichever bash init script you use (.zshrc, etc.):</p><pre>function analyze-ai() {<br>    # The first argument is the model name; if not provided, default to &#39;llama3.2&#39;<br>    local model=&quot;${1:-llama3.2}&quot;<br>    shift # Remove the first argument, so the rest can be used as the prefix<br><br>    # Use all remaining arguments as an optional prefix for the prompt<br>    local prefix=&quot;$*&quot;<br><br>    # Create a temporary file<br>    local tmpfile=$(mktemp)<br><br>    # Write the prefix and piped input to the temporary file<br>    echo -n &quot;${prefix} &quot; &gt; &quot;$tmpfile&quot;<br>    cat &gt;&gt; &quot;$tmpfile&quot;<br><br>    # Use input redirection to feed the content of the temporary file to ollama with the specified model<br>    ollama run &quot;$model&quot; &lt; &quot;$tmpfile&quot;<br><br>    # Clean up the temporary file<br>    rm &quot;$tmpfile&quot;<br>}<br><br>ask-ai() {<br>#!/bin/bash<br><br># Check if at least one argument (the model name) is provided<br>if [ $# -lt 1 ]; then<br>    echo &quot;Usage: $0 &lt;model_name&gt; [question]&quot;<br>    exit 1<br>fi<br><br># First argument is the model name<br>model=&quot;$1&quot;<br>shift # Remove the first argument so the remaining can be used as the question<br><br># Combine remaining arguments as the question<br>question=&quot;$*&quot;<br><br># Create a temporary file<br>tmpfile=$(mktemp)<br><br># Write the question to the temporary file<br>echo -n &quot;$question&quot; &gt; &quot;$tmpfile&quot;<br><br># Use input redirection to feed the content of the temporary file to ollama with the specified model<br>ollama run &quot;$model&quot; &lt; &quot;$tmpfile&quot;<br><br># Clean up the temporary file<br>rm &quot;$tmpfile&quot;<br><br>}</pre><h3>Important notes</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*KmhUq_bnCLaOiMo1" /></figure><p>If you are analyzing large files, you can run into issues with your context window being too small. You can spot this if you get this warning:</p><pre>level=WARN source=runner.go:126 msg=&quot;truncating input prompt&quot; limit=12000 prompt=58600 numKeep=5</pre><p>A workaround is to increase the context window (num_ctx) as such:</p><blockquote>Create a Modelfile with the following content</blockquote><pre># Modelfile<br>FROM llama3.2<br>PARAMETER num_ctx 12000</pre><blockquote>Run ollama create -f Modelfile llama3.2</blockquote><p>The next time you use the function, it should use the new context window size.</p><p>Be warned that this affects how much RAM and how long the query takes, so experiment a bit to find a sweet spot between the context window and your system specs.</p><p>There are a plethora of other models available. llama3.2 is a good all-rounder while others are more suited for coding questions or context.</p><p>A full list can be found at <a href="https://ollama.com/library">https://ollama.com/library</a></p><p>If you decide to try some out and find a really good combo, give me a holler in the comments!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=602c22bbe480" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Using serverless for AI function calling]]></title>
            <link>https://medium.com/@jancalve/using-serverless-for-ai-function-calling-3b32bdefacd4?source=rss-730e54a706e3------2</link>
            <guid isPermaLink="false">https://medium.com/p/3b32bdefacd4</guid>
            <category><![CDATA[artificial-intelligence]]></category>
            <category><![CDATA[llm-function-calling]]></category>
            <category><![CDATA[serverless]]></category>
            <category><![CDATA[large-language-models]]></category>
            <category><![CDATA[calendar]]></category>
            <dc:creator><![CDATA[Jan Christian Alvestad]]></dc:creator>
            <pubDate>Sun, 08 Sep 2024 00:47:20 GMT</pubDate>
            <atom:updated>2024-09-13T10:00:07.112Z</atom:updated>
            <content:encoded><![CDATA[<h3>Using serverless for Custom Actions in ChatGPT</h3><p>I had a dream.</p><p>A dream of an AI calendar assistant which could look up my calendar and tell me all sorts of nice things.</p><p>Giving it access to my family’s shared calendar and providing details on our daily routines, it could easily alert me of potential conflicts (so my lazy bum wouldn’t have to).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*1U4q2UIauiAqekLZ" /></figure><p>Using the function calling (<a href="https://help.openai.com/en/articles/8554397-creating-a-gpt">Custom Actions</a>) feature provided by OpenAI should fit the bill. After all — this is one of the many fairytale premises evangelized lately and has been dubbed <em>function calling</em>.</p><p>For those yet unitiated — this means the AI can retrieve information — such as the weather — and use the response of a weather service as additional context. A poor man’s RAG if you wish.</p><p>So I decided to give it a try.</p><p>I created a new custom GPT at OpenAI, gave it the URI of my calendar and a corresponding OpenAPI schema (generated by ActionsGPT):</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/860/1*W47EMbaSLvIONPqpsNJ2UQ.png" /></figure><p>A example of the response it would recieve is:<br><em>BEGIN:VEVENT<br>SUMMARY:-: Some event<br>DTSTART;TZID=Europe/Berlin:20241027T010000<br>DTEND;TZID=Europe/Berlin:20241027T020000<br>DTSTAMP:20240912T150454Z<br>UID:19c25e3c-29a7–469a-a068-df0603a604f4<br>SEQUENCE:2172<br>END:VEVENT<br></em>Which’s the .ics format for exporting and importing calendars.</p><p>In addition, I provided the GPT some additional context about my daily routines:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/853/1*p4O7VWPPmvXQXPctnuxvhg.png" /></figure><p>However, my experience was that the GPT was as dumb as a loaf of bread when the response is anything but JSON, so making it parse a ICS file (Digital calendar format) hit a dead end.</p><p>It would perform the call, but report the call failed even though the response was 200 OK with a perfectly valid response.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*WGnfF7hRqXv8zr7f" /></figure><p>To solve this challenge (and have some fun!), I decided to try the premise of serverless.</p><p>In essence, all that is needed is a simple REST endpoint somewhere which fetches the ICS file and parses it to JSON. Bonus points for pagination.</p><p>I considered <a href="https://aws.amazon.com/pm/lambda/?gclid=Cj0KCQjw8--2BhCHARIsAF_w1gx9KVSJ_HR-i8Z3YRO773AWfGjeGbMUvleIi8zg_DmDSzGScCROj24aAiwCEALw_wcB&amp;trk=492e1a39-117b-410f-afd2-e13b1632de9d&amp;sc_channel=ps&amp;ef_id=Cj0KCQjw8--2BhCHARIsAF_w1gx9KVSJ_HR-i8Z3YRO773AWfGjeGbMUvleIi8zg_DmDSzGScCROj24aAiwCEALw_wcB:G:s&amp;s_kwcid=AL!4422!3!651612776834!e!!g!!aws%20lambda!19835810525!147081599717">AWS Lambda</a> and <a href="https://vercel.com/">Vercel</a> for my serverless ventures.</p><p>My price point — as this is a hobby project — was 0$. Luckily, both the AWS free tier and Vercel hobby tier have generous limits so either is a viable option.</p><p>I decided to go with Vercel as they have some quite nice starter templates and because <strong><em>it’s fun!</em></strong> to try something new.</p><p>Additionally, it’s refreshing to try Node.js instead of Java since it’s — well — lighter. Less boilerplate.</p><p>Vercel has a nice collection of starter templates: <a href="https://vercel.com/templates?search=nodejs">https://vercel.com/templates?search=nodejs</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/568/1*G8iigtvI-8N7fEvBqhxxig.png" /></figure><p>Vercel also has a nice Github integration where it creates the git repo for you so the setup effort is minimal.</p><p>After that, it automatically deploys your function to a public uri. You can use custom domains if you wish, but for my use-case that wasn’t a priority.</p><p>In my experience, Vercel delivered on that. Within 5 minutes, the template endpoint was up and running without errors and delays.</p><p>Next up was hooking this up with my development workflow, where I decided to use Visual Studio Code over Jetbrains because — well — <strong><em>it’s fun!</em></strong></p><p><strong>Debugging Vercel apps in Visual Studio Code</strong></p><p>Some setup is needed to enable debugging and not quite intuitive, so here is a recipe.</p><ul><li>You need a launch.json (This file is generated when you open the run / Debug view in VS code with Cmd + Shift + D if using OSX)</li></ul><p>Use the following configuration</p><pre>{<br>  &quot;version&quot;: &quot;0.2.0&quot;,<br>    &quot;configurations&quot;: [<br>        {<br>            &quot;type&quot;: &quot;node&quot;,<br>            &quot;request&quot;: &quot;attach&quot;,<br>            &quot;name&quot;: &quot;Attach vercel dev&quot;,<br>            &quot;skipFiles&quot;: [<br>                &quot;&lt;node_internals&gt;/**&quot;<br>            ],<br>            &quot;port&quot;: 9229,<br>            &quot;sourceMaps&quot;: true,<br>            &quot;cwd&quot;: &quot;${workspaceRoot}&quot;,<br>        }<br>    ]<br>}</pre><p>This will tell VS Code how to attach to the running node process.</p><ul><li>Next up, you need to start the process locally with debug enabled.</li></ul><p>This is accomplished by running the following command (instead of the standard <em>vercel dev</em>)</p><blockquote>NODE_OPTIONS=’ — inspect’ vercel dev</blockquote><ul><li>Once that is done, you can start the debugger in VS Code with Run -&gt; Start debug.</li></ul><p>If the gods are at your side, you’ll be greeted with this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*CW-Sj9bBJrRjFCZwvrTjtQ.png" /></figure><p>Boom. Now you can work on your serverless function locally and deploy it whenever your wish.</p><blockquote>NOTE: Do mind that you should not have any credentials, secrets or sensetive uris stored in your application. If anything, you can provide these as environment variables in Vercel.</blockquote><p>All code is available at <a href="https://github.com/jancalve/serverless-ics-to-rest">https://github.com/jancalve/serverless-ics-to-rest</a></p><p>The end result was a happy GPT. It lived happily ever after it had its leg duct-taped with some serverless JSON.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*2QbBBjYzjsFBdPph" /></figure><p>Once I added the address of my calender as input to the custom action, it successfully invoked the endpoint, got the response in JSON just the way it likes it, and was able to do its magic.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/525/1*6tOL3nV6TalGdycmyqwRyw.png" /></figure><p><strong>Conclusion</strong></p><p>All in all my experience with serverless was positive.</p><p>I got an endpoint up and running in ~5 minutes, configured VS Code and debugging in ~30 minutes and ChatGPT was so kind to do the brunt of the coding work in ~1 hour in total.</p><p>As for ChatGPT and the intended purpose — it seems to “miss” instructions like checking for time conflicts as more instructions are provided in the context. Hopefully GPT 4o will improve it in that regard as it supposedly has better reasoning abilities.</p><p>Until then, I recommend having specialized GPTs with a minimum of instructions as they seem to perform better — at least in my experience.</p><p>Next up is how to convince the wife in using this. That might be a more daunting task!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3b32bdefacd4" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Integrating Spring Cloud Gateway and React with Keycloak using Token Relay pattern]]></title>
            <link>https://medium.com/@jancalve/integrating-spring-cloud-gateway-and-react-with-keycloak-using-token-relay-pattern-86f2a564fd16?source=rss-730e54a706e3------2</link>
            <guid isPermaLink="false">https://medium.com/p/86f2a564fd16</guid>
            <category><![CDATA[java]]></category>
            <category><![CDATA[spring-boot]]></category>
            <category><![CDATA[spring-cloud-gateway]]></category>
            <category><![CDATA[oauth2]]></category>
            <category><![CDATA[api-gateway]]></category>
            <dc:creator><![CDATA[Jan Christian Alvestad]]></dc:creator>
            <pubDate>Thu, 11 Jul 2024 09:07:31 GMT</pubDate>
            <atom:updated>2025-01-04T23:13:21.749Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*RKQa98l92be97Yd5SNBmqQ.jpeg" /></figure><p>Given the extraordinary amount of different guides out there, I figured this warrants its own, user-friendly tale of how to accomplish this feat.</p><p>As usual, I’ll write from my own experience from a real-world application where the roses arent’t as red as they might seem in tutorials.</p><h3>What is Token Relay</h3><p>“Token relay” is a fancy term meaning you have a intermediary server (such as Spring Cloud Gateway) which holds the user session — either in-memory or persisted to a database or Redis.</p><p>The client only has a relation to the session id, and the gateway server will retrieve the JWT obtained during authentication to the underlying resource servers and handle all the nasty stuff like token refresh which the client <strong><em>could</em></strong> handle — but it’s really cumbersome.</p><p>Pros</p><ul><li>Simplicity</li><li>Minimal complexity on the frontend</li></ul><p>Cons</p><ul><li>Frontend has no access to the JWT, which might contain various snacks such as permissions, idle-time (nice if you would want to show a “Time until logout”), user name / email, etc. So you might require an extra call to get that information.</li></ul><h3>Authentication flow</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/804/0*O5JeBkTsevJSVRHY.png" /></figure><h3>Prerequisites</h3><p>Gateway application</p><p><strong>pom.xml</strong> &lt;parent&gt;<br> &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;<br> &lt;artifactId&gt;spring-boot-starter-parent&lt;/artifactId&gt;<br> &lt;version&gt;3.0.12&lt;/version&gt;<br> &lt;relativePath/&gt;<br> &lt;/parent&gt;<br>...<br><br> &lt;dependencyManagement&gt;<br> &lt;dependencies&gt;<br> &lt;dependency&gt;<br> &lt;groupId&gt;org.springframework.cloud&lt;/groupId&gt;<br> &lt;artifactId&gt;spring-cloud-dependencies&lt;/artifactId&gt;<br> &lt;version&gt;2022.0.1&lt;/version&gt;<br> &lt;type&gt;pom&lt;/type&gt;<br> &lt;scope&gt;import&lt;/scope&gt;<br> &lt;/dependency&gt;<br>&lt;dependencyManagement&gt;<br>...<br> &lt;dependencies&gt;<br> &lt;dependency&gt;<br> &lt;groupId&gt;org.springframework.cloud&lt;/groupId&gt;<br> &lt;artifactId&gt;spring-cloud-starter&lt;/artifactId&gt;<br> &lt;/dependency&gt;<br><br> &lt;dependency&gt;<br> &lt;groupId&gt;org.springframework.cloud&lt;/groupId&gt;<br> &lt;artifactId&gt;spring-cloud-starter-gateway&lt;/artifactId&gt;<br> &lt;/dependency&gt;<br><br> &lt;dependency&gt;<br> &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;<br> &lt;artifactId&gt;spring-boot-starter-oauth2-client&lt;/artifactId&gt;<br> &lt;/dependency&gt;<br><br> &lt;dependency&gt;<br> &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;<br> &lt;artifactId&gt;spring-boot-starter-security&lt;/artifactId&gt;<br> &lt;/dependency&gt;<br>&lt;/dependencies&gt;@Configuration<br>@EnableWebFluxSecurity<br>public class SpringSecurityConfiguration {<br><br><br> final WebSessionServerSecurityContextRepository webSessionServerSecurityContextRepository = new WebSessionServerSecurityContextRepository();<br><br> @Bean<br> @Order(0)<br> public SecurityWebFilterChain keycloakLoginSecurityFilterChain(ServerHttpSecurity http){<br><br> List&lt;String&gt; patterns = Arrays.asList(&quot;/login/**&quot;, &quot;/oauth2/**&quot;);<br> MultiPatternMatcher matcher = new MultiPatternMatcher(patterns);<br> http<br> .securityMatcher(matcher)<br> .securityContextRepository(webSessionServerSecurityContextRepository)<br> .authorizeExchange((exchanges) -&gt; exchanges.anyExchange().oauth2Login().authorizationRedirectStrategy(new DefaultServerRedirectStrategy()).authenticationSuccessHandler(customOAuth2AuthenticationSuccessHandler()).authenticationFailureHandler(customOAuth2AuthenticationFailureHandler()));<br><br> return http.build();<br> }<br><br><br> @Bean<br> @Order(1)<br> public SecurityWebFilterChain keycloakSecurityFilterChain(ServerHttpSecurity http) {<br><br> List&lt;String&gt; patterns = Arrays.asList(&quot;/api/**&quot;);<br> MultiPatternMatcher matcher = new MultiPatternMatcher(patterns);<br><br> // Store the CSRF token in the cookie and header (which the CSRF header value is validated against)<br> final CookieServerCsrfTokenRepository cookieServerCsrfTokenRepository = CookieServerCsrfTokenRepository.withHttpOnlyFalse();<br> // Required to read the CSRF token from header instead of the POST body<br> final ServerCsrfTokenRequestAttributeHandler serverCsrfTokenRequestAttributeHandler = new ServerCsrfTokenRequestAttributeHandler();<br><br> CsrfWebFilter csrfWebFilter = new CsrfWebFilter();<br> csrfWebFilter.setRequestHandler(serverCsrfTokenRequestAttributeHandler);<br> csrfWebFilter.setCsrfTokenRepository(cookieServerCsrfTokenRepository);<br><br> http<br> .securityMatcher(matcher)<br> .securityContextRepository(webSessionServerSecurityContextRepository)<br> .csrf(csrf -&gt; csrf<br> .csrfTokenRequestHandler(serverCsrfTokenRequestAttributeHandler)<br> .csrfTokenRepository(cookieServerCsrfTokenRepository)<br> .requireCsrfProtectionMatcher(new MycompanyCsrfRequestMatcher()))<br> .authorizeExchange((exchanges) -&gt; exchanges.anyExchange().authenticated().and().oauth2Login());<br><br> return http.build();<br> }<br><br><br> @Bean<br> public Oauth2AuthenticationSuccessHandler customOAuth2AuthenticationSuccessHandler() {<br> return new Oauth2AuthenticationSuccessHandler();<br> }<br><br> @Bean<br> public ServerAuthenticationFailureHandler customOAuth2AuthenticationFailureHandler() {<br> return new Oauth2AuthenticationFailureHandler();<br> }<br><br>}<br><br><br>public class Oauth2AuthenticationSuccessHandler implements ServerAuthenticationSuccessHandler {<br><br> private static final Logger LOG = LoggerFactory.getLogger(Oauth2AuthenticationSuccessHandler.class);<br><br> @Value(&quot;https://${my.frontend.url}&quot;)<br> private String frontendUrl;<br><br> @Override<br> public Mono&lt;Void&gt; onAuthenticationSuccess(WebFilterExchange webFilterExchange, Authentication authentication) {<br> LOG.info(String.format(&quot;Authentication success: %s&quot;, authentication.getPrincipal().toString()));<br> webFilterExchange.getExchange().getResponse().setStatusCode(HttpStatus.SEE_OTHER);<br> webFilterExchange.getExchange().getResponse().getHeaders().setLocation(URI.create(frontendUrl));<br> return webFilterExchange.getExchange().getResponse().setComplete();<br> }<br>}<br><br>public class Oauth2AuthenticationFailureHandler implements ServerAuthenticationFailureHandler {<br> private static final Logger LOG = LoggerFactory.getLogger(Oauth2AuthenticationFailureHandler.class);<br><br> @Override<br> public Mono&lt;Void&gt; onAuthenticationFailure(WebFilterExchange webFilterExchange, AuthenticationException exception) {<br> LOG.info(String.format(&quot;Authentication failure for path %s &quot;, webFilterExchange.getExchange().getRequest().getPath().toString()), exception);<br><br> webFilterExchange.getExchange().getResponse().setStatusCode(HttpStatus.FORBIDDEN);<br> return webFilterExchange.getExchange().getResponse().setComplete();<br><br> }<br>}</p><p>This will set up your gateway with a in-memory session store (webSessionServerSecurityContextRepository) and redirect the user back to your frontend when the authentication is complete.</p><p>application.properties</p><pre>spring.security.oauth2.client.provider.my-keycloak-provider.issuer-uri=https://&lt;keycloak_host&gt;/realms/&lt;realm&gt;<br><br>spring.security.oauth2.client.registration.keycloak.provider=my-keycloak-provider<br>spring.security.oauth2.client.registration.keycloak.client-id=&lt;gateway_client_id&gt;*<br>spring.security.oauth2.client.registration.keycloak.client-secret=&lt;gateway_client_secret&gt;*<br>spring.security.oauth2.client.registration.keycloak.authorization-grant-type=authorization_code<br>spring.security.oauth2.client.registration.keycloak.scope=openid<br>spring.security.oauth2.client.registration.keycloak.redirect-uri=https://${FRONTEND_URL}/login/oauth2/code/{registrationId}</pre><p><em>gateway_client_id and gateway_client_secret are configured in Keycloak in the next section</em></p><h3>Keycloak</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*eX_Yld8csOqcUo2_mgTUKA.png" /></figure><p>Client access settings:</p><p>NB: This shows a “Allow all” setting to rule out any issues you might have early on.</p><p>For production you <strong><em>must</em></strong> set a stricter filter for allowed redirect URIs and Web origins.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*VR65c4UP4QtTJRQ6q3ufiw.png" /></figure><h3>Frontend</h3><p>The biggest challenge I faced was solving how to do the keycloak redirect in the frontend.</p><p>In my use-case, I wanted the redirect to happen in response to a POST.</p><p>This caused issues with our relatively modern React frontend as the redirect is not automatically followed and do not cause a full page navigation — leading to CORS issues.</p><p>The nicest hack I could think of ended up like this using nginx as a reverse proxy:</p><ul><li>rewrite the redirect to a custom 401 (which the frontend is able to intercept)</li><li>Set a custom header OAuth-Redirect in the response</li><li>In the frontend errorhandler, we pick up if it’s a redirect or another type of 401.</li><li>If it’s a redirect, we trigger a full page navigation using window.location</li></ul><pre>    location /api/ {<br>        # Intercept 302 responses<br>        proxy_intercept_errors on;<br>        error_page 302 = @handle_redirect;<br>        ...<br>    }<br><br>     location @handle_redirect {<br>            # Use internal mechanism to capture the redirect URL<br>            set $saved_redirect_location &#39;$upstream_http_location&#39;;<br>            add_header Content-Type application/json always;<br>            add_header OAuth-Redirect &quot;true&quot; always;<br><br>            # Send a custom response to the client<br>            return 401 &quot;{\&quot;redirectURL\&quot;: \&quot;$saved_redirect_location\&quot;}&quot;;<br><br>        }<br><br>        # This location block is configured to match requests for two specific paths using a regular expression:<br>        #<br>        # The regular expression `~ ^/(oauth2/|login/oauth2/code/)` is used to match URLs that start with either<br>        # &#39;/oauth2/&#39; or &#39;/login/oauth2/code/&#39;.<br>        #<br>        # - The `~` symbol specifies that a case-sensitive regular expression match is used.<br>        # - The `^` symbol asserts the start of the path in the URL.<br>        # - The forward slash `/` after `^` ensures that the match starts right after the initial slash in the URI.<br>        # - The parentheses `()` group the two different path options.<br>        # - Inside the parentheses, `oauth2/` matches any path that starts with `/oauth2/`.<br>        # - The pipe symbol `|` acts as an &#39;OR&#39; operator, allowing for one of the multiple options to match.<br>        # - Following the pipe, `login/oauth2/code/` matches any path that starts with `/login/oauth2/code/`.<br>        #<br>        # Any request that matches either of these paths will be handled by this block, and the configurations within it<br>        # (like proxy_pass, proxy_set_header, etc.) will be applied to those requests.<br>        location ~ ^/(oauth2/|login/oauth2/code/) {<br>            proxy_pass http://GATEWAY_NAME:8080$request_uri;<br>            proxy_http_version 1.1;<br>            proxy_set_header X-Forwarded-Host $host:$server_port;<br>            proxy_set_header X-Forwarded-Server $host;<br>            proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;<br>            proxy_buffering off;<br>            proxy_buffers 8 16k;<br>            proxy_buffer_size 16k;<br>            proxy_read_timeout 120;<br>        }</pre><pre>     // Check if we&#39;re being redirected to authenticate to keycloak<br>      const isOAuthRedirect = response.headers.get(&#39;Mycompany-OAuth-Redirect&#39;);<br>      if (isOAuthRedirect) {<br>        try {<br>          const jsonData = await response.json();<br><br>          if (jsonData &amp;&amp; jsonData.redirectURL) {<br>            window.location.href = jsonData.redirectURL;<br>          }<br>        } catch (ignored) {<br>          captureException(ignored, {});<br>        }<br>      }</pre><p>Whew! That’s a mouthful. But it works!</p><p>If anyone knows a nicer way - please do send me a message. Until then, I hope this helps other frustrated souls out there trying to accomplish this.</p><p><strong>References</strong></p><p><a href="https://www.learnnowlab.com/Spring-Cloud-Gateway-with-Spring-Security/">https://www.learnnowlab.com/Spring-Cloud-Gateway-with-Spring-Security/</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=86f2a564fd16" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Advanced Mocking with WireMock Standalone]]></title>
            <link>https://medium.com/@jancalve/advanced-mocking-with-wiremock-standalone-tales-from-the-trench-05ca86b22dc1?source=rss-730e54a706e3------2</link>
            <guid isPermaLink="false">https://medium.com/p/05ca86b22dc1</guid>
            <category><![CDATA[java]]></category>
            <category><![CDATA[testing]]></category>
            <category><![CDATA[wiremock]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[mocking]]></category>
            <dc:creator><![CDATA[Jan Christian Alvestad]]></dc:creator>
            <pubDate>Thu, 11 Jul 2024 08:41:55 GMT</pubDate>
            <atom:updated>2024-07-11T12:25:23.417Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*L8Hsps0TUbkPavxQxikLKQ.jpeg" /></figure><p>My problem statement is this:</p><p>In our application, we have a multitude of tests labeled as “integration tests” because they make external calls to numerous services.</p><p>This leads to brittle tests, as external providers can go up and down without notice, especially in a test environment.</p><p>Additionally, as the number of tests grows, the time spent on these calls increases, resulting in poor scalability.</p><p>A very simplified diagram:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/670/1*4xg9blkEn55nH8-0BPuvOw.png" /></figure><p>In order to solve this conundrum I tried <a href="https://wiremock.org/">Wiremock</a></p><h3>A quick primer on Wiremock</h3><blockquote>WireMock is a tool for mocking HTTP services. It enables developers to simulate and test how their applications interact with APIs by creating, managing, and verifying mock HTTP endpoints, making it easier to test applications without relying on real external services.</blockquote><p>I had some experience using WireMock programatically and heard it could run standalone — which seemed like a perfect fit.</p><p>Wiremock is available as a standalone server at <a href="https://hub.docker.com/r/wiremock/wiremock">https://hub.docker.com/r/wiremock/wiremock</a> and looks like this out-of-the-box:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/717/1*kR50bCUpYizBl6l7lWFrzg.png" /></figure><p>It sports a recorder which is very useful:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/995/1*rEzdQZfmNTD7i9oJfDFy2g.png" /></figure><p>The recording feature is quite powerful — it will record any incoming call before it proxies it to the real service, then record the response from that service.</p><p>This is quite convenient as you’ll quickly get your mocks set up and ready to go.</p><p><em>NB: I haven’t tried it with mocking than one more domain. </em><a href="https://wiremock.org/docs/multi-domain-mocking/"><em>Multi-domain mocking </em></a><em>is supported by the Java API, but for the standalone version of WireMock I suppose you’d have to put a reverse proxy in front.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/590/1*xD3hXc9c38O4GmMxurrtcg.png" /></figure><p>The workflow I started out with was as such:</p><ul><li>Start my app and configure it to contact the wiremock instance instead of the actual 3rd party server</li><li>Before doing any API calls, enter the actual 3rd party server URL and start the recording</li><li>When done recording whichever calls I wanted to mock, stop the recording</li><li>The generated stubs are placed in /home/wiremock/mappings — they can also be viewed in the Wiremock Web UI after stopping the recording by going to &lt;wiremock_host&gt;/__admin/mappings</li><li>By default, any recorded stub mappings will be used for subsequent requests</li></ul><p>And that’s how easy it should be — in theory..</p><h3>It all sounds good — in theory</h3><p>Sounds like this would solve all problems, right?</p><p>When trying this out in practice quickly ran into a speed bump — all of my REST and SOAP requests have a unique attribute (MessageId) for tracing the request.</p><p>This caused none of the generated stubs to match!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/987/1*08okzHJpfhAJ0-5gqRrIxg.png" /></figure><p>So I have 3 options</p><p>Option 1 — Manually write the generated stub matcher</p><p>Option 2 — Manually replace all instances of MessageId</p><p>Option 3 — Write a custom matcher(s) to ignore the field</p><p>As Option 3 is the least sucky approach (as we can use a single matcher), I went ahead and tried that.</p><p>I started with <a href="https://github.com/wiremock/wiremock-extension-template">https://github.com/wiremock/wiremock-extension-template</a> which is a very nice template for writing a WireMock extension.</p><p>However, I do not recommend trying to use maven instead of gradle as that will lead you down a very dark and soul-crushing rabbit hole trying to figure out why on earth creating a shaded jar in maven differs from gradle.</p><p>Writing the required extensions were — fortunately — much easier:</p><pre>package org.wiremock.extensions.template.extensions;<br><br>import com.fasterxml.jackson.databind.ObjectMapper;<br>import com.fasterxml.jackson.databind.node.ObjectNode;<br>import com.github.tomakehurst.wiremock.extension.Parameters;<br>import com.github.tomakehurst.wiremock.http.Request;<br>import com.github.tomakehurst.wiremock.matching.EqualToJsonPattern;<br>import com.github.tomakehurst.wiremock.matching.MatchResult;<br>import com.github.tomakehurst.wiremock.matching.RequestMatcherExtension;<br><br>public class IgnoreMessageIdMatcherRest extends RequestMatcherExtension {<br><br>    public static final String MATCHER_NAME = &quot;ignore-messageid-matcher-rest&quot;;<br><br>    @Override<br>    public MatchResult match(Request request, Parameters parameters) {<br>        String contentType = request.getHeader(&quot;Content-Type&quot;);<br>        if (contentType != null &amp;&amp; contentType.contains(&quot;application/json&quot;)) {<br>            try {<br>                String requestBody = request.getBodyAsString();<br>                if (!requestBody.isEmpty()) {<br>                    ObjectMapper mapper = new ObjectMapper();<br>                    ObjectNode jsonNode = (ObjectNode) mapper.readTree(requestBody);<br>                    jsonNode.remove(&quot;messageId&quot;);<br>                    String modifiedJson = mapper.writeValueAsString(jsonNode);<br><br>                    // Use the default JSON matcher<br>                    return new EqualToJsonPattern(modifiedJson, true, true).match(modifiedJson);<br>                }<br>            } catch (Exception e) {<br>                e.printStackTrace();<br>            }<br>        }<br>        // Default no match if conditions are not met or an error occurs<br>        return MatchResult.noMatch();<br>    }<br><br>    @Override<br>    public String getName() {<br>        return MATCHER_NAME;<br>    }<br>}</pre><pre>package org.wiremock.extensions.template.extensions;<br><br>import com.github.tomakehurst.wiremock.extension.Parameters;<br>import com.github.tomakehurst.wiremock.http.Request;<br>import com.github.tomakehurst.wiremock.matching.EqualToXmlPattern;<br>import com.github.tomakehurst.wiremock.matching.MatchResult;<br><br><br>import javax.xml.transform.OutputKeys;<br>import javax.xml.transform.Transformer;<br>import javax.xml.transform.TransformerFactory;<br>import javax.xml.transform.dom.DOMSource;<br>import javax.xml.transform.stream.StreamResult;<br>import java.io.StringWriter;<br><br>import javax.xml.parsers.DocumentBuilder;<br>import javax.xml.parsers.DocumentBuilderFactory;<br>import java.io.ByteArrayInputStream;<br>import java.io.InputStream;<br>import org.w3c.dom.Document;<br>import org.w3c.dom.NodeList;<br>import com.github.tomakehurst.wiremock.matching.RequestMatcherExtension;<br><br>public class IgnoreMessageIdMatcherSoap extends RequestMatcherExtension {<br><br>    @Override<br>    public MatchResult match(Request request, Parameters parameters) {<br>        try {<br>            if (request.getHeader(&quot;Content-Type&quot;).contains(&quot;xml&quot;)) {<br>                String xmlString = request.getBodyAsString();<br>                InputStream is = new ByteArrayInputStream(xmlString.getBytes());<br><br>                DocumentBuilderFactory dbFactory = DocumentBuilderFactory.newInstance();<br>                DocumentBuilder dBuilder = dbFactory.newDocumentBuilder();<br>                Document doc = dBuilder.parse(is);<br><br>                // Remove the MessageId node<br>                NodeList metadataNodes = doc.getElementsByTagName(&quot;Metadata&quot;);<br>                if (metadataNodes.getLength() &gt; 0) {<br>                    NodeList children = metadataNodes.item(0).getChildNodes();<br>                    for (int i = 0; i &lt; children.getLength(); i++) {<br>                        if (children.item(i).getNodeName().equals(&quot;MessageId&quot;)) {<br>                            metadataNodes.item(0).removeChild(children.item(i));<br>                            break;<br>                        }<br>                    }<br>                }<br><br>                String modifiedXml = convertDocumentToString(doc);<br><br>                return new EqualToXmlPattern(modifiedXml).match(modifiedXml);<br>            }<br>        } catch (Exception e) {<br>            e.printStackTrace();<br>        }<br>        return MatchResult.noMatch();<br>    }<br><br>    @Override<br>    public String getName() {<br>        return &quot;ignore-messageid-matcher-soap&quot;;<br>    }<br><br>    private String convertDocumentToString(Document doc) {<br>        try {<br>            TransformerFactory transformerFactory = TransformerFactory.newInstance();<br>            Transformer transformer = transformerFactory.newTransformer();<br><br>            // Set properties for the transformer<br>            transformer.setOutputProperty(OutputKeys.INDENT, &quot;yes&quot;);<br>            transformer.setOutputProperty(OutputKeys.ENCODING, &quot;UTF-8&quot;);<br>            transformer.setOutputProperty(&quot;{http://xml.apache.org/xslt}indent-amount&quot;, &quot;2&quot;);<br><br>            DOMSource domSource = new DOMSource(doc);<br>            StringWriter writer = new StringWriter();<br>            StreamResult result = new StreamResult(writer);<br><br>            transformer.transform(domSource, result);<br><br>            return writer.toString();<br>        } catch (Exception e) {<br>            throw new RuntimeException(&quot;Error converting document to string&quot;, e);<br>        }<br>    }<br><br>}</pre><h3>Embedding this in a speedy workflow</h3><p>To create a new container with the captured stubs, I used Jib:</p><pre>jib {<br>    from {<br>        image = &#39;wiremock/wiremock:3.5.4-1@sha256:6e9dcfd84cbec2daa7b12f4797a7e7d8f75b5c381df70ed00d2744c4de5360a4&#39;<br>    }<br>    to {<br>        image = imageRepoValue ?: project.imageRepo<br>    }<br>    container {<br>        ports = [&#39;8080&#39;]<br>        environment = [&#39;WIREMOCK_OPTS&#39;: &#39;--verbose&#39;]<br>        entrypoint = [&#39;/docker-entrypoint.sh&#39;, &#39;--verbose&#39;, &#39;--disable-gzip&#39;, &#39;--global-response-templating&#39;, &#39;--proxy-all=https://my-3rd-party:8080&#39;]<br>    }<br>    extraDirectories {<br>        paths {<br>            path {<br>                from = file(&#39;build/libs&#39;)<br>                into = &#39;/var/wiremock/extensions&#39;<br>            }<br>            path {<br>                from = file(&#39;src/main/resources/mappings&#39;)<br>                into = &#39;/home/wiremock/mappings&#39;<br>            }<br>            path {<br>                from = file(&#39;src/main/resources/__files&#39;)<br>                into = &#39;/home/wiremock/__files&#39;<br>            }<br>        }<br>    }<br>}</pre><p>This builds an image from the base image, overlays stub mappings from src/main/resources/mappings, and copies the compiled jar to the WireMock extension directory. This allows the extensions to be loaded by WireMock on startup.</p><p>However, a significant drawback is the need to modify stubs manually to use custom matchers instead of the defaults. To automate this, I created a script:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*CDBl8i_tbK3S-SXdB8Hfcw.png" /></figure><p>Great success! The extensions are loaded by Wiremock.</p><p>Unfortunately, a big con of this is that you still have to modify your stubs as there is no way of letting Wiremock know you want to use a custom matcher instead of the defaults (equalsToJson and equalsToXml).</p><p>In essence, we need to replace</p><pre>  &quot;bodyPatterns&quot;: [<br>      {<br>          &quot;equalToJson&quot;: &quot;{\&quot;messageId\&quot;:\&quot;29276649138818817068\&quot;,\&quot;my-attribute\&quot;:\&quot;123\&quot;}&quot;,<br>          &quot;ignoreArrayOrder&quot;: true,<br>          &quot;ignoreExtraElements&quot;: true<br>      }<br>  ]</pre><p>with</p><pre>  &quot;customMatcher&quot;: {<br>      &quot;name&quot;: &quot;ignore-messageid-matcher-rest&quot;,<br>      &quot;parameters&quot;: {<br>          &quot;expectedJson&quot;: &quot;{\&quot;messageId\&quot;:\&quot;29276649138818817068\&quot;,\&quot;fodselsnr\&quot;:\&quot;123\&quot;}&quot;<br>      }<br>  }</pre><p>As such, I created a script to do that as doing it manually is very tedious when you have a lot of stubs:</p><pre>import json<br>import os<br><br># Directory containing the JSON files<br>directory = &quot;./src/main/resources/mappings&quot;<br><br># Iterate over all JSON files in the directory<br>for filename in os.listdir(directory):<br>    if filename.endswith(&quot;.json&quot;):<br>        file_path = os.path.join(directory, filename)<br>        print(f&quot;Processing {file_path}&quot;)<br><br>        # Read the JSON file<br>        with open(file_path, &#39;r&#39;) as file:<br>            data = json.load(file)<br>        <br>        # Modify the JSON data<br>        for mapping in data.get(&#39;mappings&#39;, []):<br>            request = mapping.get(&#39;request&#39;, {})<br>            body_patterns = request.get(&#39;bodyPatterns&#39;, [])<br>            <br>            # Prepare the customMatcher object<br>            custom_matcher = None<br>            for pattern in body_patterns:<br>                if &#39;equalToXml&#39; in pattern:<br>                    custom_matcher = {<br>                        &quot;name&quot;: &quot;ignore-messageid-matcher-soap&quot;,<br>                        &quot;parameters&quot;: {<br>                            &quot;expectedXml&quot;: pattern[&#39;equalToXml&#39;]<br>                        }<br>                    }<br>                elif &#39;equalToJson&#39; in pattern:<br>                    custom_matcher = {<br>                        &quot;name&quot;: &quot;ignore-messageid-matcher-rest&quot;,<br>                        &quot;parameters&quot;: {<br>                            &quot;expectedJson&quot;: pattern[&#39;equalToJson&#39;]<br>                        }<br>                    }<br>            <br>            # Replace bodyPatterns with customMatcher if found<br>            if custom_matcher:<br>                request[&#39;customMatcher&#39;] = custom_matcher<br>                if &#39;bodyPatterns&#39; in request:<br>                    del request[&#39;bodyPatterns&#39;]<br><br>        # Write the modified data back to the file<br>        with open(file_path, &#39;w&#39;) as file:<br>            json.dump(data, file, indent=4)<br><br>        print(f&quot;Finished processing {file_path}&quot;)<br><br>print(&quot;All files processed.&quot;)<br><br></pre><p><strong>Final Workflow:</strong></p><ol><li>Start the server.</li><li>Capture stubs.</li><li>Copy the stubs to a JSON file in src/main/resources/mappings.</li><li>Run the script to clean the stubs.</li><li>Skaffold detects changes and redeploys the app.</li><li>Verify stubbing works correctly.</li></ol><p>Phew!</p><h4>Conclusion</h4><p>All in all, I’d rate this approach as “possible, but not optimal”.</p><p>I hope WireMock adds support for ignoring specific fields to streamline this process and eliminate the need for manual stub modification and redeployment.</p><h4>Disclaimer</h4><p>I initially tried using a RequestFilter instead of a RequestMatcher. However, this modified the actual request, sending it without a messageId to the third-party server, which is bad practice. Switching to a request matcher was a better solution.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=05ca86b22dc1" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Using ChatGPT, DALL-E, Polly and FFMPEG to generate a movie]]></title>
            <link>https://medium.com/@jancalve/using-chatgpt-dall-e-2-polly-and-ffmpeg-to-build-a-movie-generator-in-java-and-kotlin-b804f93bad06?source=rss-730e54a706e3------2</link>
            <guid isPermaLink="false">https://medium.com/p/b804f93bad06</guid>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[artificial-intelligence]]></category>
            <category><![CDATA[storytelling]]></category>
            <category><![CDATA[java]]></category>
            <category><![CDATA[ai]]></category>
            <dc:creator><![CDATA[Jan Christian Alvestad]]></dc:creator>
            <pubDate>Sat, 11 Mar 2023 01:51:04 GMT</pubDate>
            <atom:updated>2023-05-25T12:49:12.557Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*f5pl-5tuXzV5_j_iC4qF2A.png" /></figure><p>The advent of ChatGPT and DALL-E 2 has finally made my latest pet project possible. Finally I can provide bedtime stories on-demand for my 5 year old daughter in her native language.</p><p>To do this, I built a video generation system dubbed “Storybook” using Java, Kotlin and the AI services ChatGPT, DALL-E 2 and Amazon Polly. In this article, I’ll walk you through how I did it and provide the source code.</p><p>As a taste — here is the end result which took about 2 minutes to generate: <a href="https://www.youtube.com/watch?v=VKbURJ14s9Y">https://www.youtube.com/watch?v=VKbURJ14s9Y</a></p><p><strong>Program sequence flow:</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/701/1*8t3CW_nekDwAGuVgpBKaGg.png" /></figure><ul><li>I used Java and Kotlin as my programming language(s) as I am most comfortable with those. The OpenAI library selection for Java is horrendous and outdated, but the Kotlin libraries are quite nice to use and up-to-date.</li><li>I used OpenAI’s GPT-3 model to generate stories based on a user-provided plot. GPT-3 is a powerful natural language processing model that can generate human-like text. With GPT-3, my system can generate unique and creative stories for each plot that the user provides.</li><li>Once I had a story, I wanted to create a video with images to accompany it. I used OpenAI’s DALL-E, an image generation model, to generate images for each paragraph of the story. DALL-E can take textual input and create unique images based on the text. With DALL-E, my system could generate beautiful and unique images to match each paragraph of the story.</li><li>Creating Audio with Amazon Polly Next, I needed to create audio for each paragraph of the story. I used Amazon Polly, a text-to-speech service, to generate audio for each paragraph of the story. With Amazon Polly, my system could generate high-quality audio files that matched each paragraph of the story.</li><li>Combining Images and Audio with FFMPEG Finally, I used FFMPEG, a popular multimedia framework, to combine the generated images and audio into a single video file. With FFMPEG, my system could create a video that combined the generated images and audio for each paragraph of the story.</li></ul><p><strong>Cost</strong></p><p>This project uses a lot of different services, but all in all I estimate the cost to be roughly 0.1$ per story depending on how long it is.</p><p>Challenges</p><p>The main challenge here is to make ChatGPT generate relevant keywords for DALL-E. This has improved a lot since the first video (where the paragraph was fed raw to DALL-E), but it is still hard to make it generate images relevant to the story context.</p><p>Currenly asking chatGPT to describe the paragraph using keywords seems to work okay, but it takes a lot of “prompt engineering” and could probably be done even better.</p><p><strong>Conclusion</strong></p><p>I think this POC has been a resounding success. My 5-year-old approved it — especially after hearing a story of how she and her best friend were on a perilous quest to get ice cream :D</p><p>This also shows how things that were simply “impossible” to do last year is a piece of cake in 2023. I have a feeling these new AI services will fuel a boom of new services — and combining them such as this POC will compromise a bit of them.</p><p>Who knows — give it another year or two and suddenly you have ChatGPT writing a script with some new AI service creating the video for each scene containing actors who lease their 3D models.</p><p>I’ve decided to <a href="https://github.com/jancalve/Storybook">open-source this POC</a> for anyone to have fun with. This could easily be used for something else than bedtime stories, such as marketing videos, cartoons, etc.<br>All it takes is a bit of DALL-E 2 and ChatGPT tweaking ;)</p><p>I hope this article inspires you to explore the new possibilities of AI.</p><p>Feel free to use my source code as a base for your new project and give me a chime if you make a bedtime-story-as-a-service!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b804f93bad06" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Writing good software architecture diagrams]]></title>
            <link>https://medium.com/@jancalve/writing-good-software-architecture-diagrams-15c51eca4ce7?source=rss-730e54a706e3------2</link>
            <guid isPermaLink="false">https://medium.com/p/15c51eca4ce7</guid>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[diagramming]]></category>
            <category><![CDATA[software-architect]]></category>
            <category><![CDATA[software-architecture]]></category>
            <category><![CDATA[application-architecture]]></category>
            <dc:creator><![CDATA[Jan Christian Alvestad]]></dc:creator>
            <pubDate>Wed, 22 Feb 2023 22:23:44 GMT</pubDate>
            <atom:updated>2023-02-23T10:49:47.273Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*j4KSaoDtbObXvQpIAQOFGw.png" /></figure><p>Software architecture diagrams come in all shapes and sizes.</p><p>Since early in my career I have been subjected to many different diagrams which certainly did not lack in creativity.</p><p>However, most (all?) of them failed to capture and communicate what is important in a clear and concise manner.</p><p>Some started out at a high level and suddenly boiled down to a low level view of what it was trying to communicate — or they used different color coding schemes to emphasize significance. Others had the opinion of “size matters” and used bigger boxes for important things (yet over time — those small boxes grew to bigger components and it lost all relevance).</p><p>I have done many of the same sins — In many different tools. Whiteboard, MS Paint, Photshop, Gliffy, draw.io, Visio — you name it, I’ve done it.</p><p>Countless hours have been spent updating these diagrams, and many more trying to align arrows and angles in perfect orientation (to scratch my inner feng shui alignment OCD).</p><p>So what has been my redemption?</p><p>The “<strong>C4 model</strong>”</p><p>Being less destructive than it might initially sound — A C4 model is represented by <strong>a set of diagrams that each describe a different level of detail about your software code</strong>. These different levels help you to communicate abstract ideas in a visual way and from different points of view.</p><p>Shameless plug from wikipedia:</p><blockquote>The C4 model documents the architecture of a <a href="https://en.wikipedia.org/wiki/Software_system">software system</a>, by showing multiple points of view that explain the decomposition of a system into containers and <a href="https://en.wikipedia.org/wiki/Component-based_software_engineering">components</a>, the relationship between these elements, and, where appropriate, the relation with its users.</blockquote><blockquote>The viewpoints are organized according to their hierarchical level:</blockquote><blockquote>Context diagrams (level 1): show the system in scope and its relationship with users and other systems;</blockquote><blockquote>Container diagrams (level 2): decompose a system into interrelated containers. A container represents an application or a data store;</blockquote><blockquote>Component diagrams (level 3): decompose containers into interrelated components, and relate the components to other containers or other systems;</blockquote><blockquote>Code diagrams (level 4): provide additional details about the design of the architectural elements that can be mapped to code. The C4 model relies at this level on existing notations such as <a href="https://en.wikipedia.org/wiki/Unified_Modeling_Language">Unified Modelling Language (UML)</a>, <a href="https://en.wikipedia.org/wiki/Entity%E2%80%93relationship_model">Entity Relation Diagrams (ERD)</a> or diagrams generated by <a href="https://en.wikipedia.org/wiki/Integrated_development_environment">Integrated Development Environments (IDE)</a>.</blockquote><blockquote>For level 1 to 3, the C4 model uses 5 basic diagramming elements: persons, software systems, containers, components and relationships. The technique is not prescriptive for the layout, shape, colour and style of these elements. Instead, the C4 model recommends using simple diagrams based on nested boxes in order to facilitate interactive collaborative drawing. The technique also promotes good modelling practices such as providing a title and legend on every diagram, and clear unambiguous labelling in order to facilitate the understanding by the intended audience.</blockquote><blockquote><strong>The C4 model facilitates collaborative visual architecting and evolutionary architecture in the context of agile teams where more formal documentation methods and up-front architectural design are not desired.</strong></blockquote><p>I am a big fan of evolutionary architecture so this fits the bill perfectly.</p><p>As an example — See how easy it is to read and understand each of these diagrams.</p><p><strong>Level 1 — System context</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/555/0*wH8Y3t8GJUt3T-Iz" /></figure><p><strong>Level 2 — Container diagram</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*fycwtVRM2i2LWly9" /></figure><p><strong>Level 3 — Component diagram</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/566/0*eHl0jW4o28xNy_SB" /></figure><p>Still — this alone does not solve the problem of spending (wasting?) hours to update the model after some time. This is inevitable — especially as the architecture evolves.</p><p>Enter PlantUML</p><p>What is so great about this tool?</p><p>Well — PlantUML is an open-source tool allowing users to create diagrams from a plain text language. This means you no longer have to fire up some heavy program / plugin to update your diagrams — you can model it in code.</p><p>Compared to other tools (such as <a href="https://structurizr.com/">Structurizr</a>) — PlantUML is mature, battle-tested and free to use.</p><p>And what do we usually do with code?</p><p>We store it in version control such as GIT — which in turn facilitates collaboration and gives us the added benefit of knowing what changed when — giving us the complete evolutionary history of an application!</p><p>For instance — here is the code for the Level 1 diagram:</p><pre>@startuml<br>!include C4_Context.puml<br><br>LAYOUT_WITH_LEGEND()<br><br>title System Context diagram for Internet Banking System<br><br>Person(customer, &quot;Personal Banking Customer&quot;, &quot;A customer of the bank, with personal bank accounts.&quot;)<br>System(banking_system, &quot;Internet Banking System&quot;, &quot;Allows customers to view information about their bank accounts, and make payments.&quot;)<br><br>System_Ext(mail_system, &quot;E-mail system&quot;, &quot;The internal Microsoft Exchange e-mail system.&quot;)<br>System_Ext(mainframe, &quot;Mainframe Banking System&quot;, &quot;Stores all of the core banking information about customers, accounts, transactions, etc.&quot;)<br><br>Rel(customer, banking_system, &quot;Uses&quot;)<br>Rel_Back(customer, mail_system, &quot;Sends e-mails to&quot;)<br>Rel_Neighbor(banking_system, mail_system, &quot;Sends e-mails&quot;, &quot;SMTP&quot;)<br>Rel(banking_system, mainframe, &quot;Uses&quot;)<br>@enduml</pre><p>Neat.</p><p>There are some supplementary diagrams as well such as:</p><ul><li><a href="https://github.com/plantuml-stdlib/C4-PlantUML/blob/master/samples/C4CoreDiagrams.md#system-landscape-diagram">System Landscape Diagram</a></li><li><a href="https://github.com/plantuml-stdlib/C4-PlantUML/blob/master/samples/C4CoreDiagrams.md#dynamic-diagram">Dynamic Diagram</a></li><li><a href="https://github.com/plantuml-stdlib/C4-PlantUML/blob/master/samples/C4CoreDiagrams.md#deployment-diagram">Deployment Diagram</a></li></ul><p>As for tooling support, there are plugins available for <a href="https://github.com/qjebbs/vscode-plantuml">Visual Studio Code</a> and <a href="https://plugins.jetbrains.com/plugin/7017-plantuml-integration">IntelliJ IDEA</a>.</p><p>Most of these plugins default to an open PlantUML server, but have the option of using a local PlantUML server which is as easy as..</p><pre>docker run -d -p 8080:8080 plantuml/plantuml-server:tomcat</pre><p>Now there are some drawbacks.</p><ul><li>PlantUML (and other similar tools) can be tricky to position with regards to arrows, boxes etc. when diagrams get complex.</li><li>Generating these diagrams require a server component whereas others (such as MermaidJS) are more smooth to integrate into ex. a Github page.</li></ul><p>But all in all it is a fair tradeoff. I think it does a decent job positioning stuff most of the time and generating updated diagrams on the fly could easily be achieved by a simple Jenkins job / GitHub action.</p><p>And there you have it! May your diagrams be blessed from this day on.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=15c51eca4ce7" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[An introduction]]></title>
            <link>https://medium.com/@jancalve/i-am-a-38-year-old-father-of-two-with-16-years-of-experience-in-java-currently-working-as-a-tech-e318f2d22518?source=rss-730e54a706e3------2</link>
            <guid isPermaLink="false">https://medium.com/p/e318f2d22518</guid>
            <category><![CDATA[sharing-is-caring]]></category>
            <category><![CDATA[architecture]]></category>
            <category><![CDATA[introducing-myself]]></category>
            <category><![CDATA[programming]]></category>
            <dc:creator><![CDATA[Jan Christian Alvestad]]></dc:creator>
            <pubDate>Wed, 22 Feb 2023 08:12:54 GMT</pubDate>
            <atom:updated>2023-02-22T22:27:58.654Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*DcFrCrGU0ggotI53_zhs_w.png" /><figcaption>Photo by Sigmund on Unsplash</figcaption></figure><p>An introduction</p><p>I am a 38 year old father of two with 16 years of experience in Java currently working as a tech lead at a major Norwegian company.</p><p>As someone who has benefited greatly from the community of developers sharing their ideas and insights, I have decided to pay it forward and share my own tips and tricks. I believe that sharing knowledge is crucial to the growth of the tech industry, and can help other developers avoid common pitfalls and save time.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*es1ZB5bV0Hbl41nWBXYsog.png" /><figcaption>Photo by Júnior Ferreira on Unsplash</figcaption></figure><p>In this blog, I will be sharing my old and new experiences during my journey with a focus on Java, tools, pet-projects and my personal tricks for more efficient and effective coding.</p><p>My goal is to provide value to developers of all skill levels and to encourage collaboration and learning within the tech community. I hope that my insights will help other developers improve their programming skills and overcome any challenges they may face.</p><p>//JC</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e318f2d22518" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>