<?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 Eran Perera on Medium]]></title>
        <description><![CDATA[Stories by Eran Perera on Medium]]></description>
        <link>https://medium.com/@eran.perera2010?source=rss-f311f3b8c88b------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*1nZqnO9H1PygIfEd</url>
            <title>Stories by Eran Perera on Medium</title>
            <link>https://medium.com/@eran.perera2010?source=rss-f311f3b8c88b------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 21 Nov 2026 13:01:42 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@eran.perera2010/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[External Drive Not Mounting on Linux]]></title>
            <link>https://medium.com/@eran.perera2010/external-drive-not-mounting-on-linux-0c7a4039897f?source=rss-f311f3b8c88b------2</link>
            <guid isPermaLink="false">https://medium.com/p/0c7a4039897f</guid>
            <category><![CDATA[windows]]></category>
            <category><![CDATA[operating-systems]]></category>
            <category><![CDATA[linux]]></category>
            <category><![CDATA[hard-drive-repair]]></category>
            <category><![CDATA[debugging]]></category>
            <dc:creator><![CDATA[Eran Perera]]></dc:creator>
            <pubDate>Fri, 06 Nov 2026 10:34:28 GMT</pubDate>
            <atom:updated>2026-11-06T15:33:09.107Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*wPr_t-bN1iIt5QdHPpfJNg.png" /></figure><p>A while back, I switched to Arch Linux because, why not? Since then, it has been quite the journey: learning new things and having to get my hands dirty quite often, which, of course, is fun in its own way. Recently, I ran into an interesting issue where my external drive wouldn’t mount, leaving me unable to access my files. I knew there was nothing wrong with the drive itself, since it worked fine on my Windows machine, so the problem had to be on the Linux side. The drive used to be in my old laptop, which ran Windows, before I salvaged it for external use. This article covers how I went about finding the problem and fixing it. If you’re on a different Linux distro, the steps should be pretty much the same, just with different commands. So if you’ve faced this problem too, you might be interested in the rest of this article.</p><h3>The Problem</h3><p>When I plugged my drive and tried to mount it I got the following error:</p><pre>Unable to mount My External Drive<br><br>Error mounting /dev/sda3 at /run/media/&lt;user&gt;/My External Drive:<br>wrong fs type, bad option, bad superblock on /dev/sda3, missing codepage<br>or helper program, or other error</pre><p>The message is pretty generic and doesn’t tell what the actual problem is, therefore I decided to go into the kernel log with the following command, which btw is used to examine issues such as these and also for diagnosing boot failues and driver crashes:</p><pre>sudo dmesg | grep -i ntfs | tail -10</pre><p>Arch’s file manager mounts NTFS with the in-kernel <strong><em>ntfs3</em></strong> driver. That driver refuses to mount any volume that is marked dirty or hibernated, and it reports the refusal as the abovevague error. But using the diagnostic message tool I was able to find the following:</p><pre>[   22.690461] ntfs3: Enabled Linux POSIX ACLs support<br>[   22.690467] ntfs3: Read-only LZX/Xpress compression included<br>[   22.691843] ntfs3(sda3): It is recommended to use chkdsk.<br>[   23.032297] ntfs3(sda3): volume is dirty and &quot;force&quot; flag is not set!<br>[ 1022.295055] ntfs3(sda3): It is recommended to use chkdsk.<br>[ 1022.352404] ntfs3(sda3): volume is dirty and &quot;force&quot; flag is not set! </pre><blockquote><em>Spoiler: this was not the real cause…</em></blockquote><p>But the point of this article is show what I learned by guiding you through the steps I took so on we go…</p><p>Now I had plugged this into windows as well and windows fast startup could also cause these flags, since with it a windows shutdown is more like a hibernate so NTFS volumes are left as in use (can avoid by ejecting mostly). So I tried using <strong><em>ntfsfix</em></strong> from the <strong><em>ntfs-3g</em></strong> tools.</p><p>There was a packaging gotcha first. Installing ntfs-3g did not provide the command:</p><pre>$ sudo pacman -S ntfs-3g<br>...<br>Optional dependencies for ntfs-3g<br>    ntfsprogs: userspace utilities</pre><pre>$ sudo ntfsfix -d /dev/sda3<br>sudo: ntfsfix: command not found</pre><p>The optional-dependency note is the hint: the utilities live in a separate package. If you’re unsure which package provides a command, pacman -F will tell you.</p><pre>sudo pacman -S ntfsprogs<br># or, to find the package for any command:<br>sudo pacman -Fy &amp;&amp; pacman -F ntfsfix</pre><p>With <strong><em>ntfsfix</em></strong> installed, I ran and the output showed a different problem:</p><pre>$ sudo ntfsfix -d /dev/sda3<br>Mounting volume... Windows is hibernated, refused to mount.<br>FAILED<br>Attempting to correct errors...<br>Processing $MFT and $MFTMirr...<br>Reading $MFT... OK<br>Reading $MFTMirr... OK<br>Comparing $MFTMirr to $MFT... OK<br>Processing of $MFT and $MFTMirr completed successfully.<br>Setting required flags on partition... OK<br>Going to empty the journal ($LogFile)... OK<br>Windows is hibernated, refused to mount.<br>Remount failed: Operation not permitted</pre><p>A hibernated volume is stricter than a dirty one. Linux tools won’t write to it, because Windows could resume later and overwrite the changes. <strong><em>ntfsfix</em></strong> can&#39;t clear this state.</p><p>The standard advice is to fix it from Windows, and I tried all of it, the steps are below:</p><ol><li>Disabled hibernation and Fast Startup with powercfg /h off in an admin terminal.</li><li>Ran chkdsk F: /f on the external drive. Use your drive&#39;s actual letter. Running it on a letter that doesn&#39;t exist gives Cannot open volume for direct access.</li><li>Did a full shutdown with shutdown /s /t 0.</li></ol><p>None of it helped. Mounting with <strong><em>ntfs-3g</em></strong> directly still gave the same verdict, though it did fall back to read-only:</p><pre>$ sudo mount -t ntfs-3g /dev/sda3 /mnt/ext<br>Windows is hibernated, refused to mount.<br>Falling back to read-only mount because the NTFS partition is in an<br>unsafe state. Please resume and shutdown Windows fully (no hibernation<br>or fast restarting.)<br>Could not mount read-write, trying read-only</pre><p>If you just need your files, this read-only mount is a safe way to copy them off.</p><h3>The real cause</h3><p>The real problem was a stale hiberfil.sys. <strong><em>ntfs-3g </em></strong>decides a volume is hibernated by looking for an active hiberfil.sys in the root of that partition. Wndows keeps this file on it’s own system drive, not on an external disk. So with the drive mounted read-only, I checked:</p><pre>$ ls -la /mnt/ext | grep -i -E &quot;hiberfil|windows|pagefile&quot;<br>-rwxrwxrwx 1 root root 8384401408 Jan  2  2024 hiberfil.sys<br>drwxrwxrwx 1 root root       4096 Feb  1  2026 Windows Files<br><br>$ lsblk -o NAME,SIZE,LABEL,MODEL,TRAN<br>NAME          SIZE LABEL              MODEL           TRAN<br>sda         931.5G                    &lt;USB HDD model&gt; usb<br>├─sda1        260M SYSTEM<br>├─sda2         16M<br>├─sda3      930.3G My External Drive<br>└─sda4       1006M<br>nvme0n1     476.9G                    &lt;NVMe SSD model&gt; nvme<br>├─nvme0n1p1   100M                                    nvme<br>...</pre><p>This confirmed two things:</p><ul><li><strong><em>sda</em></strong> is the USB drive, so I was working on the right partition.</li><li>The 8 GB hiberfil.sys dates from January 2024. The disk was once a laptop&#39;s internal Windows drive, and the file survived when it became an external drive. (Windows Files is just an ordinary folder, not a Windows install.)</li></ul><p>The current Windows install never reads or clears that old file. That’s why no amount of Fast Startup settings or chkdsk changed anything. The leftover SYSTEM partitions are the old install’s boot, reserved an recovery partitions, and I am just gonna leave them be since it doesn’t matter.</p><h3>The Solution</h3><p>Now that the problem is identified it can be solved by removing this file with ntfs-3g, then running the fix to clear up the flag.</p><ol><li>Remove the stale hibernation file. The remove_hiberfile mount option deletes hiberfil.sys and mounts read-write. Only use it when the file is a leftover like this once because on a windows partition, it throws away the saved Windows session.</li></ol><pre>sudo umount /mnt/ext<br>sudo mount -t ntfs-3g -o remove_hiberfile /dev/sda3 /mnt/ext<br>ls -la /mnt/ext | grep -i hiberfil   # should print nothing<br>sudo umount /mnt/ext</pre><p>2. Clear the dirty flag. The file manager still would fail since the kernels btfs3 driver also rejects dirty volumes. With the hibernation file gone, ntfsfix could finally clear the flag:</p><pre>sudo ntfsfix -d /dev/sda3</pre><p>Now after unplugging and replugging, the drive mounted normally from the file manager with read-write permission, and as a bonus removing the file freed about 8GB.</p><p>Of course, this may not be your exact problem, which is why I’ve listed every step I took to find it. This was the first time I’d had to deal with something like this, and it was definitely interesting. Hopefully, this article will help others who are stuck with the same issue.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=0c7a4039897f" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Introduction to Agile]]></title>
            <link>https://medium.com/@eran.perera2010/introduction-to-agile-99e5e1f38b01?source=rss-f311f3b8c88b------2</link>
            <guid isPermaLink="false">https://medium.com/p/99e5e1f38b01</guid>
            <category><![CDATA[agile]]></category>
            <category><![CDATA[software]]></category>
            <category><![CDATA[agile-methodology]]></category>
            <category><![CDATA[tech-team]]></category>
            <category><![CDATA[sdlc]]></category>
            <dc:creator><![CDATA[Eran Perera]]></dc:creator>
            <pubDate>Sun, 08 Mar 2026 15:59:59 GMT</pubDate>
            <atom:updated>2026-03-08T15:59:59.417Z</atom:updated>
            <content:encoded><![CDATA[<h3>Agile Mindset</h3><p>Agile is not just some SDLC cycle that you follow, it is a mindset that we take to thinking about how we are going to work as a team, this mindset can be a change in how we even make up our team like having generalists instead of specialists in a team that can meddle with any area, it’s not just a matter of separating tasks into certain iterations such as development, testing, etc. Agile starts by addressing the agile mindset, the team should be open to continuous improvement and change.</p><p>First step to thinking like an agile team is “ <strong>Focusing on the why”,</strong> when having sprints which generally last about 2 weeks, what we should understand is why shorter sprints improve the team’s agility, instead of “how to finish the work by 2 weeks”.</p><p>The key importance of agile in software development comes when working with knowledge workers compared to traditional workers, in places like a factory the project manager can gain the relevant expertise in the areas as he/she climbs up the ladder and take a more directive approach to get the work done, but when developing software it does not work the same, each person specializes in an area and it may seem impossible for a project manager to master each area such as a database engineer, software developer, and infrastructure specialist would in a team, which may need the project managers to take a more supportive role. This is why agile teams tend to be more self-organised, promoting collective decision making among the whole team, which gives these knowledge workers the flexibility they need to create a successful plan, but it’s not all free rein to let them go nuts.</p><p>The thing with working on software systems unlike something like a bridge or building, you can’t always plan everything at the start and hope everything will go according to it, software is not set in stone even as developing, integrated third party services may change causing the app to change as well, which is why doing work in short sprints brings an advantage, because the closer we get to the final product the more expensive changes will be. But the agile methodology allows the freedom to take only the minimum amount of decisions needed to get started and be flexible to make changes as the product develops, when working in short sprints, making it possible to change according to the need as the software develops without incurring too much expenses towards the product’s end.</p><p>Which can be explained by the cone of uncertainty:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/742/1*vUgAd9PbVbK93ydc37nuhQ.png" /></figure><ul><li>It costs the least to plan and make changes at the very beginning of the cone of uncertainty, but unfortunately, that’s when you know the least about what it will take to deliver the product. As your team goes further into the cone, it becomes more expensive to make changes, but at the same time, the team becomes clearer on how it will deliver the product. Therefore, you must make decisions early when you know the least about how things will turn out.</li></ul><p>According to the Agile Manifesto, there are certain values that an agile team should consider to take proper advantage of, that is, by focusing more on:</p><ul><li>Individuals and interactions over processes and tools</li><li>Working software over comprehensive documentation</li><li>Customer collaboration over contract negotiation</li><li>Responding to change over following a strict plan</li></ul><p>Note that we shouldn’t disregard the others but give more chance to those that allow flexibility, these only provide the bigger, more abstracted picture of the agile mindset, and not the practical way of working.</p><p>In an agile team, it is better not to have a huge workload but instead break and deliver the workload in small batches, which helps to increase the overall team’s efficiency by focusing only on the deliverables for the upcoming sprint and adding them to the Sprint backlog.</p><h3>User Stories</h3><p>Though not a must, these help have conversations about the product and how to implement it; organisations will often confuse user stories with project requirements. But user stories should not have detailed information about how the team will deliver the product. Instead, it should be a high-level value statement that serves as a reminder for the product owner to discuss with the team.</p><p>User Stories are used to focus on the value that the product is targeting, which helps the development team figure out how to implement it. Note that in user stories, we don’t go into technical things such as how or where to place buttons, but instead focus on what the product’s value is and what it needs.</p><p>User stories are different from a system requirements document; a requirements document is meant to keep the team focused and limited to what’s in it, but user stories are meant to allow developers to ask the right questions and plan the requirements based on them.</p><p>User story format:</p><p>As a user [user], I want [some feature] so that I can [get some value].</p><p>Incorrect user stories:</p><ul><li>“As a mobile user, I want to set the application to only download when I am connected to wifi” — (no value statement)</li><li>“As a mobile user, I want to upload my location and make changes to my profile so that I can share my location with my friends.” — ( it is not independent, has two features)</li></ul><h3>Prioritizing Work</h3><p>When delivering software, we start with the feature that has the highest value in the software and work our way down in priority. Teams can help visualise the most used features in the application with the help of taskboards.</p><p>A taskboard is a simple swim lane diagram. It is called this because, like a swimming pool, it has lines breaking the board into vertical columns. These columns can be addressed as work queues, which are mainly separated into to-do, doing, done, and the first column will be the user stories. The user stories will be listed in priority from top to bottom, and the tasks to complete those user stories are added to the to-do column.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/743/1*BBqZMLaBiQajFoTWcuJC6g.png" /></figure><p>When prioritizing work, the team should always focus on delivering working software not Figma prototypes or presentations. The Agile Manifesto says that “working software” is the primary measure of progress, so that means that the product shown at the end of each sprint could be acceptable without any further testing or deployment for that feature.</p><h3>How Do Sprints Work?</h3><p>The team initially keeps a spring planning meeting on the first day of the spring to plan all the sprint work, then every morning, the team should attend the daily scrum/standup, which goes for about 15 minutes for the developers to coordinate their work and share about the progress they’re making. Then, at the end of the sprint, there will be a sprint review where the customer will give feedback on the work that was completed during the sprint, which may go on for about 2 hours.</p><p>So, to summarise the main spring elements:</p><ol><li>Sprint Planning — Held on the first day of the sprint to decide what will be delivered and how the work will be achieved.</li><li>Daily Scrums — A 15-minute daily standup meeting where developers synchronise their work and create a plan for the next 24 hours.</li><li>Sprint Review — Conducted at the end of the sprint to present the completed work to stakeholders and gather feedback.</li><li>Sprint Retrospective — An internal meeting for the Scrum team to reflect on the sprint and identify ways to improve processes for the next iteration.</li></ol><p>This is followed in iterations to deliver software features; generally, it is done incrementally to provide a new feature every sprint. Still, agile teams also work iteratively to improve what they have built as well.</p><h3>Popular Agile Frameworks</h3><p>This is where we dive into how we can apply the <strong>Agile Mindset.</strong> The key frameworks we’re going to talk about are:</p><ol><li>Scrum</li><li>Extreme programming</li><li>Kanban</li></ol><h3>Scrum Framework</h3><p>Scrum is one of the most widely used Agile frameworks. It is an <strong>Empirical Process Control Framework</strong>, meaning it relies on transparency, inspection, and adaptation to guide development.</p><p>While Agile is a <strong>mindset</strong> defined by values and principles, Scrum is a <strong>practical implementation</strong> of that mindset. It provides a structured way to apply Agile through;</p><ul><li>Roles (Product Owner, Scrum Master, Developers)</li><li>Events (sprints, daily scrum, reviews, retrospectives)</li><li>Artifacts (product backlog, sprint backlog, increment)</li></ul><p>FYI, a P<strong>roduct Backlog</strong> is a complete, prioritized list of all features, enhancements, fixes, and requirements for the product, whereas a S<strong>print Backlog</strong> is a subset of items selected <em>from the product backlog</em> that the team commits to completing in a single sprint.</p><h3>Extreme Programming (XP) Framework</h3><p>This framework allows agile teams to adapt quickly and make changes to the constant fluctuations of the product. This framework focuses solely on software development and is built around disciplined engineering practices that make change safe and efficient.</p><p>Key practices of XP include:</p><ol><li>Agile Planning — work is planned in small increments with continuous customer involvement to ensure the highest-value features are always developed first.</li><li>Continuous Integration — code is integrated and tested frequently (multiple times a day) to detect and resolve issues early.</li><li>Software Refactoring — code is continuously improved to keep it clean, maintainable, and adaptable.</li><li>Test Driven Development — developers write automated tests before writing the actual code, ensuring high quality and confidence when making changes.</li></ol><p>Extreme Programming supports rapid adaptation to change by enforcing strong technical practices that ensure software remains flexible, high quality, and always ready for deployment, unlike Scrum, which focuses on Roles, Events, and Artefacts. XP also has these, but they are more informal and focus more on user stories, tests, and code rather than formal backlogs and process structures.</p><h3>Kanban Framework</h3><p>Kanban is a scheduling system that was used in lean manufacturing. Kanban lets the team display their work on a kanban board. This framework allows the team to bring lean thinking to software development, which focuses on what’s valuable to the customer and continuously improving it over time. A <strong>Kanban board</strong> is used to represent the stages of work using columns (e.g., <em>To Do, In Progress, Testing, Done</em>). Tasks move from left to right across the board as they progress. Unlike Scrum, Kanban <strong>does not</strong> <strong>use fixed-length sprints</strong>; instead, work is delivered continuously based on capacity.</p><p>Key principles of Kanban include:</p><ol><li><strong>Visualising the workflow</strong> to increase transparency.</li><li><strong>Limiting Work in Progress (WIP)</strong> to avoid overloading the team and ensure focus.</li><li><strong>Using a pull system</strong>, where team members pull the next highest-priority task when they have capacity.</li><li><strong>Continuous improvement</strong> and aligning with lean thinking by constantly optimising flow and reducing waste.</li></ol><h3>Differences Between Scrum, XP, and Kanban</h3><p>Scrum clearly stands apart from the other two frameworks because it follows a <strong>highly structured, sprint-based approach</strong>, defined by <strong>specific roles (Product Owner, Scrum Master, Developers), timeboxed events (Sprint Planning, Daily Scrum, Sprint Review, Sprint Retrospective), and artefacts (Product Backlog, Sprint Backlog, Increment).</strong></p><p>In contrast, <strong>Extreme Programming (XP) and Kanban are more flexible and flow-based</strong> frameworks. They do not rely on fixed sprints or formal roles to the same extent. However, they differ in their core focus:</p><ul><li><strong>XP (Extreme Programming)</strong> emphasises <strong>technical excellence and software quality</strong> through engineering practices such as Test-Driven Development (TDD), Continuous Integration, Pair Programming, and Refactoring.</li><li><strong>Kanban</strong> emphasises workflow efficiency and process optimisation by visualising work on a Kanban board and limiting Work in Progress (ongoing tasks) to improve flow and reduce bottlenecks.</li></ul><p>XP focuses on how to build software well, while Kanban focuses on how to move work efficiently through the development process.</p><h3>Main Roles in an Agile Team</h3><p>Product Owner</p><ol><li>Owns the product (not necessarily the client, typically an internal employee)</li><li>Responsible for direction and prioritisation</li><li>Have the authority to make real-time decisions</li><li>Integrated into the team</li><li>A single person is responsible for managing the product backlog for the features needed for the system.</li></ol><p>Product Manager</p><ol><li>Works on long-term strategy</li><li>Creates the budget</li><li>Looks at competing products</li><li>Bring in the product owner</li></ol><p>Scrum Master</p><ol><li>More of a trainer or coach</li><li>Administrative worker</li><li>Can be the spear or even the shield of the team</li><li>Conflict negotiation</li></ol><p><em>Originally published at </em><a href="https://erantimothyblogs.notion.site/Introduction-to-Agile-29128ea35fa280649d1cc463758b65e8"><em>https://erantimothyblogs.notion.site</em></a><em>.<br>Hit me up at </em><a href="https://www.erantimothy.dev/">erantimothy.dev</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=99e5e1f38b01" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Managing Custom and Self Signed SSL/TLS Certs in MSYS2 UCRT64]]></title>
            <link>https://medium.com/@eran.perera2010/managing-custom-and-self-signed-ssl-tls-certs-in-msys2-ucrt64-8220a7ab8794?source=rss-f311f3b8c88b------2</link>
            <guid isPermaLink="false">https://medium.com/p/8220a7ab8794</guid>
            <category><![CDATA[msys2]]></category>
            <category><![CDATA[ssl-certificate]]></category>
            <category><![CDATA[zsh]]></category>
            <category><![CDATA[windows]]></category>
            <category><![CDATA[shell]]></category>
            <dc:creator><![CDATA[Eran Perera]]></dc:creator>
            <pubDate>Mon, 02 Feb 2026 11:03:54 GMT</pubDate>
            <atom:updated>2026-02-02T11:03:54.255Z</atom:updated>
            <content:encoded><![CDATA[<p>What started with trying out Linux turned out into an addiction of configs, and shells specifically Zsh as of now, which I wanted to use on my windows machine as well. Which is when I came across MSYS2, specifically UCRT64 in this case, since it supports using Zsh natively in windows. Now for anyone wondering why I’m going through all these problems with windows instead of just using linux…, well your right but that’s a story for another time. This article is just for anyone (mostly shell newbies like me) who came across the same certificate issues as I did when configuring this in windows.</p><p>MSYS2 (UCRT64) uses <strong>its own CA trust store</strong>, separate from Windows. Any SSL/TLS inspection, self-signed certificate, or corporate root CA may cause tools like curl, git, npm, or docker to fail with errors. In my case I had an issue with the certificate injected by Kaspersky getting rejected as a self-signed certificate with the below error:</p><pre>SSL certificate OpenSSL verify result: self-signed certificate in certificate chain (19)</pre><p>If you have come across this error or a similar error you can follow through with this article, note that I have narrowed down the problem to Kaspersky, but you can also follow this for any other certificate issues in Windows and MSYS2.</p><p>The below diagram shows the flow of what we are going to do to solve this issue:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*DsYoVouWizk3fBWEvsqzKQ.png" /></figure><h3>Getting the Certificate from Windows</h3><p>To get the certificate from windows you can open <strong>windows run</strong> and enter certmgr.msc to open the certification manager in windows and find the specific certificate that&#39;s causing an issue and export in Base 64 encoded format (note that it is important to export as Base 64 to make sure that it is compatible with MSYS2).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/448/1*C6vQ55syaidB2ix77Gbi-g.png" /><figcaption>Opening certificate manager in windows</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/931/1*-wEUoSON2eEYY2aOiLvCcQ.png" /><figcaption>Export a Specific Cert</figcaption></figure><p>When you select export just follow the instructions to export a Base 64 file of the certificate</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/661/1*Ld02ukZmVB6RtpakRS8pvQ.png" /><figcaption>Getting a Base64 Encoded .cem file</figcaption></figure><p>The file will by default get exported to C:/Windows/System32/ which you can then move or copy into MSYS2.</p><p><em>NOTE: MSYS2 home path is set to C:\msys64\home\&lt;username&gt;, assuming you download it at the root of the C drive.</em></p><h3>Setting Up Certificate path in MSYS2 UCRT64</h3><p>MSYS2 relies on pacman (the Arch Linux package manager) and mirrors the directory structure followed by Arch&#39;s packaging philosophy, which uses standard Linux paths like /etcand /usr .</p><p>MSYS2 also uses the p11-kit , which is a software package in Linux that provides a standard way for different applications and libraries to load, enumerate, and coordinate the use of PKCS#11 modules, which is a standard for accessing cryptographic devices. Which brings us to the next step which is to create the directory to store the certifications.</p><pre>mkdir -p /etc/pki/ca-trust-source/anchors</pre><p>This is where the certificates would reside, similarly if you wish to block a certificate you can create a directory called /blocklist in the ca-trust-source directory.</p><pre>trust-source/anchors/   ← “I explicitly trust these”<br>trust-source/blocklist/ ← “I explicitly distrust these”</pre><p>After making the directory you can then copy over the certificate from the windows folder over to the msys2 directory.</p><pre># cp /path/to/your/certificate.cer /etc/pki/ca-trust/source/anchors/&lt;cert-name&gt;.crt<br>cp C:/Windows/System32/kaspersky.cer /etc/pki/ca-trust/source/anchors/kaspersky.crt</pre><p>The above command will copy over the ceritificate and also rename it from “.cer” to “.crt”, which isn’t mandatory since it is in Base64 encoded format but is better for clarity.</p><h3>Rebuild the Trust Store</h3><p>After adding the required certificates (if more than one add all), and then update the system wide Certificate Authority (CA) trust store, which consolidates various certificate sources into a single, unified format in the /etc/pki/ca-trusted/extracted/ directory. To do this we just have to run the below command:</p><pre>update-ca-trust</pre><p>NOTE: prefix with sudo keyword if you get permission issues</p><h3>Verify the Certificate</h3><p>Next and final step is to verify the certificate is now trusted by MSYS2, which can be done with the following command:</p><pre># trust list | grep -i &quot;&lt;cert name&gt;&quot;<br>trust list | grep -i &quot;kasperky&quot;</pre><p>which would give an output similar to the image shown below:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/689/1*AMijcu5-RZWsoJO7fIz7NQ.png" /><figcaption>trust command output</figcaption></figure><p>You can then send the curl request that was not working earlier without getting blocked my MSYS2, Banzaiii.</p><p>Everything is a learning process, I made a lot of mistakes trying to solve this as well, hopefully this may help any MSYS2 newbies if they come across this issue as well, some of the common problems I faced was:</p><ul><li>SSL certificate verify failed: which could be caused due to the ceritificate not being in Base64 encoded format</li><li>Trust list command returns empty: make sure that you copy the certificate to the correct directory (can vary from distro, for MSYS2 it’s the one I mentioned above)</li></ul><p>Hope this article helped you and feel free to share it with anyone who may need this. Cheers.</p><p><em>Originally published at </em><a href="https://erantimothyblogs.notion.site/Managing-Custom-and-Self-Signed-SSL-TLS-Certs-in-MSYS2-UCRT64-2fb28ea35fa280b4840bd3452f512851"><em>https://erantimothyblogs.notion.site</em></a><em>.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8220a7ab8794" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Design Patterns in Java]]></title>
            <link>https://medium.com/@eran.perera2010/design-patterns-in-java-b38338b9d32a?source=rss-f311f3b8c88b------2</link>
            <guid isPermaLink="false">https://medium.com/p/b38338b9d32a</guid>
            <category><![CDATA[design-patterns]]></category>
            <category><![CDATA[software-engineering]]></category>
            <category><![CDATA[spring]]></category>
            <category><![CDATA[java]]></category>
            <category><![CDATA[programming]]></category>
            <dc:creator><![CDATA[Eran Perera]]></dc:creator>
            <pubDate>Tue, 28 Oct 2025 06:46:10 GMT</pubDate>
            <atom:updated>2025-10-28T06:53:53.658Z</atom:updated>
            <cc:license>http://creativecommons.org/publicdomain/zero/1.0/</cc:license>
            <content:encoded><![CDATA[<h3>Introduction</h3><p>This article covers some of the most commonly used design patterns in Java (and Spring). We discuss about various Creational, Structural and behavioural/Operational Patterns at a very basic level to be able to better understand the idea and implementation behind these design patterns.</p><p>In Java, many design patterns help solve common issues developers face when building apps. These design patterns can be found in the book the Gang of Four authored in their book Design Patterns. These design patterns can be segregated into 3 main categories:</p><ol><li>Creational Patterns: Focus’ on the creation of objects</li><li>Behavioral Patterns: Focus’ on the communication between objects</li><li>Structural Patterns: Focus’ on the object composition and interfaces</li></ol><p>The commonly used design patterns that developers use in Spring which we can see generally everywhere in the spring framework fall among these 3 main categories. Some of the most frequently used design patterns would be:</p><ol><li>Inversion of Control (IoC Pattern)</li><li>Proxy Pattern</li><li>Factory Pattern (the IoC container itself is based on the factory patter)</li><li>Singleton and Prototype Pattern</li><li>Template Pattern</li><li>MVC Pattern</li></ol><h3>What is IoC?</h3><ul><li>Often called dependency injection</li><li>An Architectural pattern for regulating control of dependencies to the container instead of the developer</li></ul><p>The central container constructs and maintains all object references and hands them to objects that need it at runtime. Spring manages your dependencies and objects are injected at runtime.</p><p>By allowing the IoC to handle the construction of dependencies we can:</p><p>Reduce the noise in the code</p><p>Reduce object coupling</p><p>Reduce any defects from incorrect construction</p><p>since spring IoC manages all of these for us.</p><p>Spring’s ApplicationContext is the IoC container that handles dependecy injection for us, another pattern used is also the BeanFactory but ApplicationContext is mainly used as it is a more advanced version of BeanFactory.</p><h3>Creational Patterns</h3><h4>Factory Pattern</h4><p>The core of the IoC container, the BeanFactory is a Factory Pattern. It allows construction of similar classes of different types using a factory pattern. Constructed objects are from objects that share a common interface or class. This encapsulation to an interface allows Spring to handle what types of objects are needed at runtime.</p><p>The Strategy to create factories are:</p><ol><li>To code to an interface</li><li>Create a common interface (like a parent class)</li><li>Create a class with instances of the interface (like child classes based on super class)</li><li>Implement concrete classes from the interface</li></ol><p>We can take it a step further with <strong>Abstract Factory Pattern</strong></p><ul><li>Becomes a factory of factories</li><li>Adds powerful level of abstraction if you have a bunch of types with a bunch of types</li></ul><h4>Builder Pattern</h4><p>The builder pattern is used throughout the spring framework. Lombok also has an @Builder annotation to help implement builder methods. The builder pattern is used by chaining multiple methods, each method returns the object reference and the build method returns a fully constructed object. This functionality can be combined into one class however it is not usually done that way since it would often require statics. We generally use two classes one is the concrete implementation and the other is the builder.</p><ul><li>Useful when object creation has many parameters and those parameters are optional, since we can called only the required setter methods and finally build the object (instead of having many constructors)</li><li>Can make the code easier (depends on the person)</li></ul><p>The strategy to create a builder pattern is as follows:</p><ol><li>Create a base class with all args constructor.</li><li>Create builder class with attribute an setter for each argument in the base class (each setter should return builder)</li><li>Create a build method that will construct and return base class.</li></ol><h4>Singleton Pattern</h4><p>Every bean by default in spring is a singleton. Singletons need to be thread-safe, how singletons work is that the class stores a reference to an instance of itself, the constructor has to be private since the singleton pattern doesn’t allow to make more objects, and there is a “getInstance” method that returns the reference of the created singleton object and if the object is not created then it will create an object in a thread-safe manner.</p><p>When to use singleton pattern:</p><ul><li>when there is expensive object creation such as a handle to a database</li><li>Control concurrency-associated shared resources</li><li>Storing static state for multiple parts of the application instead of having multiple instances of the state.</li></ul><p>To create a singleton:</p><ol><li>Create a private constructor</li><li>Create an instance handle as a class attribute</li><li>Static getInstance method that synchronizes on the object to reduce thread safety risks</li><li>Create an instance if it doesn’t exist or else return the existing instance</li></ol><h4>Prototype Pattern</h4><p>To use the prototype pattern in spring we have to mark the bean as prototype, and in the prototype pattern new instances are created. Instance is cloned at runtime to give new instances that aren’t the prototype, the same behavior and state.</p><p>In Java this is done with the cloneable interface, and usually prototypes are deep clones of objects</p><p>The prototype pattern can be used:</p><ul><li>when object creation is expensive but the wrapper needs to be unique meaning there is state but the state is uniquely maintained</li><li>with objects that must act thread safe but need to store state, where the state for each instance is stored but appears thread safe to the external view</li><li>Cost savings on object creation</li></ul><p>How to create Prototype Pattern:</p><ol><li>Create an abstract base class that implements cloneable</li><li>Extend that class with prototypes</li><li>Override clone method to provide class-specific behavior</li><li>Clone sensitive sub-objects to prevent threading issues</li></ol><h3>Structural Patterns</h3><h4>Adapter Pattern</h4><p>The adapter pattern is used in spring generally for integration with Channel Adapters for communication with different systems or internal operations of AspectJ and used during load. Two different interfaces share a common operation treating them as the same, therefore it could be a wrapper class that holds an instance of one interface and implements the other. Shared operation of the wrapper interface is implemented to call the shared operation of wrapped interface.</p><p>This pattern can be useful when :</p><ul><li>Legacy or third party code that needs to fit into the code</li><li>Shared functionality on disparate objects to reduce code and code complexity</li><li>Coding to interfaces is very common therefore using this pattern reduces code while improving readablity</li></ul><p>How to implement this strategy:</p><ol><li>Two interfaces that share a method</li><li>Implement both with concrete classes</li><li>Create wrapper class that extends one and has instance of the other</li><li>Implementation in adapter calls instance method.</li></ol><h4>Decorator Pattern</h4><p>This is used to add responsibility to an object dynamically at runtime, which promotes composition instead of inheritance since we are composing/adding properties to an object instead of inheriting from it. Inherited base classes compose new behavior/responsibility. This pattern lets an object be open for extension and closed for modification while adding responsibilities.</p><p>Why use this pattern:</p><ul><li>Promote composition over inheritance</li><li>Add behavior without modifying the code</li><li>Support non-breaking changes</li><li>Remove behaviour through encapsulation via decoration</li></ul><p>Implementing this strategy:</p><ol><li>Create base abstract class</li><li>Build decorator abstract class extending base class</li><li>Build decorators that extend decorator abstract class</li><li>Decorators maintain instance of base abstract class with constructor injection</li></ol><h4>Proxy Pattern</h4><p>Since spring 4 every bean gets a proxy around it, proxies are usually added through annotation and revolves around Aspect Oriented Programming (AOP). in this pattern we use an intermediary object in place of the real one. The intermediary can control instantiation of the real object and also add behaviour to the real object.</p><p>Why use this pattern:</p><ul><li>Expensive operations need to be protected and called only when needed</li><li>Add behaviour to a method when called in specific situations</li><li>Remote object access</li></ul><p>How to implement the proxy pattern:</p><ol><li>Start with an interface</li><li>Create real object to extend interface</li><li>Create a proxy object to extend the interface; keep a handle on the realobject.</li><li>Create an object; add behaviour and other protections as needed.</li></ol><p>Though Proxy Patterns are not generally used with plain Java, but rather used with AOP, such as @Transactional or @Cacheable.</p><h3>Behavioural Patterns</h3><h4>Repository Pattern</h4><p>Spring data is mostly based on the Repository Pattern, this can be implemented in JDBC as well but we generally use JPA to use repository services with JDBC.</p><p>This is not a Gang of Four Pattern, this patterns lets us do simple operations of an entitiy or business object without knowledge of other entites (like JOINS or relations). The data access operations are hidden under the abstraction</p><p>Why use this pattern:</p><ul><li>Databases have become the bottleneck, therefore using this makes data access more easier</li><li>Prevent data access logic from leaking into the business logic</li><li>Provide layer of abstraction to hide internals</li><li>Focus on single business objects at a time</li></ul><p>To Implement the Repository Pattern:</p><ol><li>Start with the Repository interface or create your own interface with generics</li><li>Define common data access methods</li><li>Apply business object to a Repository instance</li><li>Leverage data access logic under the hood</li></ol><h4>Template Pattern</h4><p>Spring mostly provides required templates and it is very seldom that templates are made from scratch. This pattern is generally used for remote system calls. It provides common behaviour that spans concrete implementations. Some template examples would be JDBC, JMS, Rest, etc.</p><p>The idea behind the template pattern is that common boilerplate code is hidden in a base class, and variant code with extended functionality is handled in concrete implementations that extend the base class.</p><p>Why would we use this pattern:</p><ul><li>Encourages the DRY principle and reduces code redundancy</li><li>Error-prone code can be solved once and reused</li><li>Make common tasks such as connecting and closing connections to a database to a template instead of re-implementing repeatedly</li></ul><p>How to implement this pattern:</p><ol><li>Create base abstract class</li><li>Define template method</li><li>Implement algorithm, extracting shared code paths into abstract methods</li><li>Mark template method as final</li><li>Concrete implementations implement abstract methods from base class</li></ol><h4>MVC Pattern</h4><p>A very common pattern used in spring web development is the Model View Controller Pattern, where we separate our code into these 3 main sections. The model delivers data to the view, and the view delivers the experience based on the data to the consumer, the controller handles the logic of populating the model, selecting the view and bridging them together.</p><ul><li>Improves developer efficiency by separating responsibilities</li><li>Dynamic and multiple view selection with same controller/model</li><li>Modify view without modifying the business logic</li></ul><p>How to implement this:</p><ol><li>Use an engine to engage template for the view like thymeleaf</li><li>Create View</li><li>Create Model</li><li>Create controller to populate model and return it with the view</li></ol><h3>Additional Patterns</h3><ul><li>Observer Pattern</li><li>Command Pattern</li><li>Mediator Pattern</li><li>Interpreter Pattern</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b38338b9d32a" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>