<?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"><channel><title><![CDATA[Anjas Dev Blog]]></title><description><![CDATA[Anjas Dev Blog]]></description><link>https://blog.anja-stricker.de</link><generator>RSS for Node</generator><lastBuildDate>Tue, 14 Apr 2026 17:37:32 GMT</lastBuildDate><atom:link href="https://blog.anja-stricker.de/rss.xml" rel="self" type="application/rss+xml"/><language><![CDATA[en]]></language><ttl>60</ttl><item><title><![CDATA[How to Solve Leetcode 3381: Maximum Subarray Sum with Length Divisible by k]]></title><description><![CDATA[Intuition
We aim to find the maximum sum of a subarray whose length is divisible by k. Instead of examining all possible subarrays, which would be inefficient, we employ a snake-like sliding trick. This involves moving forward one step at a time, kee...]]></description><link>https://blog.anja-stricker.de/how-to-solve-leetcode-3381-maximum-subarray-sum-with-length-divisible-by-k</link><guid isPermaLink="true">https://blog.anja-stricker.de/how-to-solve-leetcode-3381-maximum-subarray-sum-with-length-divisible-by-k</guid><category><![CDATA[3381]]></category><category><![CDATA[leetcode]]></category><category><![CDATA[maximum subarray sum]]></category><category><![CDATA[subarray]]></category><dc:creator><![CDATA[Anja Stricker]]></dc:creator><pubDate>Thu, 27 Nov 2025 15:29:12 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1764257268240/12125df9-9590-4831-9db9-d8c1283a7eb1.jpeg" length="0" type="image/jpeg"/><content:encoded><![CDATA[<h1 id="heading-intuition">Intuition</h1>
<p>We aim to find the maximum sum of a subarray whose length is divisible by <code>k</code>. Instead of examining all possible subarrays, which would be inefficient, we employ a <strong>snake-like sliding trick</strong>. This involves moving forward one step at a time, keeping track of the “weak front” numbers that might limit our sum, and extending the subarray only if the new number increases the total. Imagine it like a snake: the head moves forward, the tail (weak numbers) is dropped when necessary, and the sum grows as we progress.</p>
<h1 id="heading-approach">Approach</h1>
<ol>
<li><p>Maintain a <strong>minPrefix array</strong> of size <code>k</code> to store the smallest running sums for each remainder modulo <code>k</code>.</p>
<ul>
<li>Initialize with <code>[0, ∞, ∞, …]</code> (length k). The initial 0 represents an empty subarray with sum 0, while ∞ indicates that no valid subarray exists yet for other remainders.</li>
</ul>
</li>
<li><p>Iterate through <code>nums</code>:</p>
<ul>
<li><p><strong>Update the running total</strong>.</p>
</li>
<li><p><strong>Evaluate the current sum</strong> by subtracting the smallest prefix for the same remainder (<code>total - minPrefix[length % k]</code>). If this exceeds <code>maxSum</code>, update <code>maxSum</code>.</p>
</li>
<li><p><strong>Update minPrefix</strong> for <code>length % k</code> with the smaller of itself or the running total, preserving the “weak front” numbers as candidates for future subarrays.</p>
</li>
</ul>
</li>
<li><p>This method naturally handles subarrays of lengths <code>k, 2k, 3k…</code> without additional loops.</p>
</li>
</ol>
<p><strong>Example:</strong> <code>nums = [-5,1,2,-3,4], k = 2</code></p>
<ul>
<li><p>Start: <code>minPrefix = [0, ∞]</code></p>
</li>
<li><p>Index 0 (<code>-5</code>) → only 1 item → invalid → shift → <code>minPrefix = [0, -5]</code></p>
</li>
<li><p>Index 1 (<code>1</code>) → running sum = -4 → better than -5 → update → <code>minPrefix = [-4, -5]</code></p>
<ul>
<li><strong>We retain only the weakest numbers at the front</strong>; update index 0 from 0 → -4.</li>
</ul>
</li>
<li><p>Index 2 (<code>2</code>) → use <code>minPrefix[1] = -5</code> → sum = 3 → maxSum updated</p>
</li>
<li><p>Index 4 (<code>4</code>) → use <code>minPrefix[0] = -4</code> → sum = 4 → maxSum updated</p>
</li>
</ul>
<p>If the array is extended later (e.g., <code>10</code> at the end), we <strong>replace one of the weak numbers</strong> in <code>minPrefix</code> based on <code>index % k</code> and continue. The snake keeps moving forward, only discarding weak numbers that hinder the sum.</p>
<p>I watched NeetCode's approach on YouTube but wanted to explain it in my own terms here. You should definitely watch his video too! <a target="_blank" href="https://www.youtube.com/watch?v=8rwW3iKqP34">Watch NeetCode's Video</a></p>
<h1 id="heading-complexity">Complexity</h1>
<ul>
<li><p>Time complexity: O(n) — we traverse the array once.</p>
</li>
<li><p>Space complexity: O(k) — minPrefix array of size k.</p>
</li>
</ul>
<h1 id="heading-code">Code</h1>
<pre><code class="lang-javascript"><span class="hljs-keyword">var</span> maxSubarraySum = <span class="hljs-function"><span class="hljs-keyword">function</span>(<span class="hljs-params">nums, k</span>) </span>{
    <span class="hljs-keyword">var</span> minPrefix = <span class="hljs-keyword">new</span> <span class="hljs-built_in">Array</span>(k).fill(<span class="hljs-literal">Infinity</span>);
    minPrefix[<span class="hljs-number">0</span>] = <span class="hljs-number">0</span>;

    <span class="hljs-keyword">var</span> total = <span class="hljs-number">0</span>;      <span class="hljs-comment">// running sum</span>
    <span class="hljs-keyword">var</span> maxSum = -<span class="hljs-literal">Infinity</span>;

    <span class="hljs-keyword">for</span> (<span class="hljs-keyword">let</span> i = <span class="hljs-number">0</span>; i &lt; nums.length; i++) {
        total += nums[i];
        <span class="hljs-keyword">let</span> length = i + <span class="hljs-number">1</span>;
        <span class="hljs-keyword">let</span> mod = length % k;

        <span class="hljs-comment">// check if current subarray ending here gives a bigger sum</span>
        <span class="hljs-keyword">let</span> addSum = total - minPrefix[mod];
        <span class="hljs-keyword">if</span> (addSum &gt; maxSum) {
            maxSum = addSum;
        }

        <span class="hljs-comment">// update the “weak front” for this modulo</span>
        minPrefix[mod] = <span class="hljs-built_in">Math</span>.min(minPrefix[mod], total);
    }

    <span class="hljs-keyword">return</span> maxSum;
};
</code></pre>
]]></content:encoded></item><item><title><![CDATA[Understanding Offset and Cursor Pagination: Pros, Cons, and Practical UX Examples]]></title><description><![CDATA[How would you solve infinite scroll? With pagination, right? Okay, so we pick e.g 3 items every time and load the next section of them until we get them all. Done ✔ Classic Offset pagination.
With prisma ( an ORM tool for JS/TS ), you would make the ...]]></description><link>https://blog.anja-stricker.de/cursor-based-pagination</link><guid isPermaLink="true">https://blog.anja-stricker.de/cursor-based-pagination</guid><category><![CDATA[Pagination]]></category><category><![CDATA[JavaScript]]></category><category><![CDATA[TypeScript]]></category><category><![CDATA[prisma]]></category><category><![CDATA[Databases]]></category><category><![CDATA[infinite scrolling]]></category><category><![CDATA[performance]]></category><category><![CDATA[examples]]></category><category><![CDATA[orm]]></category><category><![CDATA[sorting]]></category><category><![CDATA[nestjs]]></category><dc:creator><![CDATA[Anja Stricker]]></dc:creator><pubDate>Tue, 07 Oct 2025 14:06:16 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1759845605056/512200e3-2870-4b8b-8523-1f843a5a165b.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>How would you solve infinite scroll? With pagination, right? Okay, so we pick e.g 3 items every time and load the next section of them until we get them all. Done ✔ Classic Offset pagination.</p>
<p>With prisma ( an ORM tool for JS/TS ), you would make the request like so:</p>
<pre><code class="lang-javascript"><span class="hljs-keyword">const</span> results = <span class="hljs-keyword">await</span> prisma.items.findMany({
  <span class="hljs-attr">skip</span>: <span class="hljs-number">3</span>,
  <span class="hljs-attr">take</span>: <span class="hljs-number">3</span>,
})
</code></pre>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1759842138344/9b4e5df3-1547-42f2-9a06-bd41fac4bf97.png" alt class="image--center mx-auto" /></p>
<p>BUT… what if we want to get data from two completely different tables? And they only have a date in common, and you want them to be sorted? Can we just pick 10 from one and 10 from the other? NO!</p>
<p>Lets think in dates: Imagine getting 3 entries from <strong>July only</strong> ( first table ) and then 3 entries from <strong>July and September mixed!</strong> ( second table ). Then we load the next page and get more from <strong>July</strong> on the first dataset, but already <strong>September</strong> data on the second dataset. This will result in a date mismatch, <strong><mark>with nothing truly sorted.</mark></strong> 😭</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1759843410749/0b307ded-549e-4017-9e39-d092ef189d7d.png" alt class="image--center mx-auto" /></p>
<p>And dont start with “we can sort in the frontend afterwards”. Imagine having a lot of data and then sorting the whole thing after each fetch… not ideal, right?</p>
<p>So, should we just paginate by passing a date frame instead of a page? Then we might fetch from August to September initially, but what if there's no data in that time frame? To trigger a fetch with infinite scroll, we need to get to the end of the list / screen. And just calling the endpoint until you finally get the desired data does not sound very elegant. Then we might get jagged loading indicators. Meh. 😭</p>
<p>So, what solution would consider all edge cases and work in all scenarios?</p>
<p>Cursor-based pagination! ✨</p>
<p>I hit this exact wall. And i want to help you so you don’t need to undergo the same hell! In this post, I’ll break down <strong>offset vs. cursor pagination</strong>. When each works, when it breaks, and how cursors quietly fixed my Timeline. Bonus: <strong>NestJS + Prisma</strong> code you can paste in. Let’s dig in!</p>
<p><img src="https://media1.giphy.com/media/v1.Y2lkPTc5MGI3NjExeHI0dzFvbGVoOGxkZGFuaXJ5amQ1ZHFrZGRrN3RmbmV1ZzB2eDMwbCZlcD12MV9pbnRlcm5hbF9naWZfYnlfaWQmY3Q9Zw/t3sZxY5zS5B0z5zMIz/giphy.gif" alt class="image--center mx-auto" /></p>
<h2 id="heading-1-introduction-why-this-topic-matters">1. Introduction: Why this topic matters</h2>
<p>This might sound basic to some, but for me it was a total <em>“ohhh, so that’s how it should work”</em> moment. Figured I’d share, so you can skip the headaches I went through. ✍️</p>
<p>You might be thinking: <em>“Why would we even merge two tables with different schemas and creation dates into one endpoint? Who does that?”</em> Well… sometimes you can’t just cram everything into one neat schema. Sure, an audit log with <code>title</code>, <code>message</code>, and <code>date</code> sounds clean. But when the customer wants extra info on certain entries, and you don’t want to dump JSON blobs into a message field, you need a different plan.</p>
<p>JSON columns? Yeah, nah. They’re messy, fragile, and a pain to migrate when schemas change. Keeping separate tables for detailed data and merging them only when needed is usually cleaner.</p>
<p>You might think <em>“But you could just make two different endpoints, and then merge it in the frontend”</em> Well that kills lazy loading and proper pagination.</p>
<p>See, i thought the exact way, but trust me, cursor-based pagination is not that tricky, and soooo easy to implement. Let me show you how!</p>
<p><img src="https://media0.giphy.com/media/v1.Y2lkPTc5MGI3NjExNXJtem1wY2Q1MHA2dTBwaWVteWlycXg0aGJ1emJmbmE4cHBnMDJqdSZlcD12MV9pbnRlcm5hbF9naWZfYnlfaWQmY3Q9Zw/mPKa6OI5oRsmextwBq/giphy.gif" alt class="image--center mx-auto" /></p>
<hr />
<h2 id="heading-2-what-is-offset-pagination">2. What is Offset Pagination?</h2>
<p>With offset pagination, you can define the page you want to load, and how many items that page should contain. In Prisma you would use skip and take, like shown below.</p>
<p>Example with NestJS + Prisma:</p>
<pre><code class="lang-typescript"><span class="hljs-keyword">async</span> getItems(page: <span class="hljs-built_in">number</span>, limit: <span class="hljs-built_in">number</span>) {
  <span class="hljs-keyword">const</span> skip = (page - <span class="hljs-number">1</span>) * limit;
  <span class="hljs-keyword">return</span> <span class="hljs-built_in">this</span>.prisma.item.findMany({
    skip,
    take: limit,
    orderBy: { createdAt: <span class="hljs-string">'desc'</span> },
  });
}
</code></pre>
<p><strong>Pros:</strong></p>
<ul>
<li><p>Easy to understand and implement</p>
</li>
<li><p>Fine for small, static datasets</p>
</li>
<li><p>You can jump to any page immediately.</p>
</li>
<li><p>You can paginate in any sort order. For example sorting by first name etc.</p>
</li>
</ul>
<p><strong>Cons:</strong></p>
<ul>
<li><p>Performance drops with high <code>skip</code> values</p>
</li>
<li><p>Offset pagination does not scale at database level.If you skip 300,000 records, the database STILL needs to traverse the first 300,000 records before returning your desired 10 items. This is bad for performance</p>
</li>
</ul>
<p><strong>Use Case:</strong></p>
<ul>
<li>Shallow pagination of a small result set. For example blog posts.</li>
</ul>
<hr />
<h2 id="heading-3-what-is-cursor-based-pagination">3. What is Cursor-Based Pagination?</h2>
<p>Cursor-based pagination uses <code>cursor</code> and <code>take</code> to return a limited set of results before or after a given cursor. The cursor can be a ID or a timestamp.</p>
<pre><code class="lang-javascript"><span class="hljs-keyword">const</span> myCursor = lastId; <span class="hljs-comment">// Example: 52 </span>
<span class="hljs-keyword">const</span> secondQueryResults = <span class="hljs-keyword">await</span> prisma.post.findMany({
  <span class="hljs-attr">take</span>: <span class="hljs-number">4</span>,
  <span class="hljs-attr">skip</span>: <span class="hljs-number">1</span>,
  <span class="hljs-attr">cursor</span>: {
    <span class="hljs-attr">id</span>: myCursor,
  },
})

<span class="hljs-comment">// Example: 1, 3, 4, 52, 10, 7, 100, 89, 62</span>
<span class="hljs-comment">// With cursor based pagination we would return: 10, 7, 100, 89</span>
<span class="hljs-comment">// ( since we skipped 52 itself )</span>
</code></pre>
<ul>
<li><p>Instead of <code>OFFSET</code>, use a unique field like <code>createdAt</code> or <code>id</code></p>
</li>
<li><p>Remembers the "last seen item" (cursor) and continues from there</p>
</li>
</ul>
<p><strong>Pros:</strong></p>
<ul>
<li><p>Infinite scroll with merged datasets</p>
</li>
<li><p>It scales and is better for performance</p>
</li>
</ul>
<p><strong>Cons:</strong></p>
<ul>
<li><p>Sorting is only possible by cursor, which has to be unique.</p>
</li>
<li><p>You cannot jump to a specific page, you will need to get all data in order.</p>
</li>
</ul>
<p><strong>Use Case:</strong></p>
<ul>
<li><p>Infinite Scroll!</p>
</li>
<li><p>Paging through an result set in batches.</p>
</li>
</ul>
<hr />
<h2 id="heading-4-time-range-pagination">4. Time-Range Pagination</h2>
<p>I thought: “Why not just paginate by day or week?” But what if there’s <strong>no data</strong> in that range? Right: empty page. Terrible UX. Cursor-based pagination skips empty ranges and shows the next real items instead. Super neat, right?</p>
<p>So don’t do time-ranged pagination, its super weird to test and creates bugs.</p>
<hr />
<h2 id="heading-5-real-world-example-merged-timeline-from-multiple-tables">5. Real-World Example: Merged timeline from multiple tables</h2>
<p>Let’s think about one example: Audit logs for social media. You want to see chronologically when a <strong>post</strong> got created and when <strong>comments</strong> got in. They are not grouped. You just see a list of: ok there was a post, then 10 comments on that post, then another post, 2 comments on the older post again, 4 on the new one and so on. So → we have two tables. Both tables contain a <code>creationDate</code>.</p>
<p>We want to merge <code>posts</code> and <code>comments</code> in one feed, sorted chronologically. <strong>Problem:</strong></p>
<ul>
<li><code>OFFSET</code> grabs 10 posts + 10 comments → what if the first 10 comments we load where created after the first 30 posts? Weird example, BUT it can happen. Then we have a chronological problem. Just like the simple example i showed at the start of this blog!</li>
</ul>
<p><strong>Cursor solves this:</strong></p>
<ul>
<li><p>Fetch e.g. 10 items per table <strong>before a timestamp cursor ( first one is now )</strong></p>
</li>
<li><p>Merge → sort by date → trim to 10 → save new cursor → repeat</p>
</li>
</ul>
<p>This is a neat example: ( fetching 3 items, and trimming at 3 )</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1759844781701/b0e33bb1-5604-45f9-b642-8cb22effc5a6.png" alt class="image--center mx-auto" /></p>
<hr />
<h2 id="heading-6-code-cursor-pagination-with-prisma-amp-nestjs">6. Code: Cursor Pagination with Prisma &amp; NestJS</h2>
<p>This is how the logic could look like for our problem with merging two databases.</p>
<p>Its a special case, but it works!</p>
<pre><code class="lang-ts"><span class="hljs-keyword">async</span> getTimeline(cursor?: <span class="hljs-built_in">string</span>, limit = <span class="hljs-number">10</span>) {
  <span class="hljs-keyword">const</span> where = cursor ? { createdAt: { lt: <span class="hljs-keyword">new</span> <span class="hljs-built_in">Date</span>(cursor) } } : {};

  <span class="hljs-keyword">const</span> [posts, comments] = <span class="hljs-keyword">await</span> <span class="hljs-built_in">Promise</span>.all([
    <span class="hljs-built_in">this</span>.prisma.post.findMany({ where, take: limit, orderBy: { createdAt: <span class="hljs-string">'desc'</span> } }),
    <span class="hljs-built_in">this</span>.prisma.comment.findMany({ where, take: limit, orderBy: { createdAt: <span class="hljs-string">'desc'</span> } }),
  ]);

  <span class="hljs-keyword">const</span> merged = [...posts.map(<span class="hljs-function"><span class="hljs-params">p</span> =&gt;</span> ({ ...p, <span class="hljs-keyword">type</span>: <span class="hljs-string">'post'</span> })), ...comments.map(<span class="hljs-function"><span class="hljs-params">c</span> =&gt;</span> ({ ...c, <span class="hljs-keyword">type</span>: <span class="hljs-string">'comment'</span> }))];
  <span class="hljs-keyword">const</span> sorted = merged.sort(<span class="hljs-function">(<span class="hljs-params">a, b</span>) =&gt;</span> b.createdAt.getTime() - a.createdAt.getTime());
  <span class="hljs-keyword">const</span> items = sorted.slice(<span class="hljs-number">0</span>, limit);
  <span class="hljs-keyword">const</span> nextCursor = items.at(<span class="hljs-number">-1</span>)?.createdAt.toISOString() ?? <span class="hljs-literal">null</span>;

  <span class="hljs-keyword">return</span> { items, nextCursor };
}
</code></pre>
<hr />
<h2 id="heading-7-conclusion">7. Conclusion</h2>
<p>Offset isn’t “wrong” — but often not the right tool. If your use case is more complex than “show me the next 10 items,” cursor-based pagination is worth considering. It’s more robust, more performant, and… a real UX lifesaver. Also, usual infinite scroll with no sorting logic will love this pagination method!</p>
<p>And hey — now you know that pagination is more than just <code>LIMIT</code> and <code>OFFSET</code>. 😉</p>
<p>Write your thoughts in the comments below!</p>
<p>Have a nice day!</p>
]]></content:encoded></item><item><title><![CDATA[Take care of your Mental Health as a Developer]]></title><description><![CDATA[Introduction
Ever felt like your passion for coding slowly turned into a daily battle? Picture this: drowning in multiple projects, losing the joy you once found in your work. I've been there. Join me on a journey where the weight of responsibility a...]]></description><link>https://blog.anja-stricker.de/improve-your-mental-health-as-a-developer</link><guid isPermaLink="true">https://blog.anja-stricker.de/improve-your-mental-health-as-a-developer</guid><category><![CDATA[mentalhealth]]></category><category><![CDATA[burnout]]></category><category><![CDATA[Burnout recovery]]></category><category><![CDATA[Developer]]></category><dc:creator><![CDATA[Anja Stricker]]></dc:creator><pubDate>Wed, 01 Nov 2023 18:49:02 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1698862731305/de9e3955-01c2-4ebd-87a9-409d677ddcc4.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<h2 id="heading-introduction"><strong>Introduction</strong></h2>
<p>Ever felt like your passion for coding slowly turned into a daily battle? Picture this: drowning in multiple projects, losing the joy you once found in your work. I've been there. Join me on a journey where the weight of responsibility almost crushed my enthusiasm, but a colleague's advice sparked a change. Let me share how I rediscovered balance and mental peace in a coding chaos.</p>
<h2 id="heading-slowly-burning-down">Slowly burning down</h2>
<p>As developers, we often find ourselves entangled in the web of multitasking, juggling various projects simultaneously. The weight of responsibilities can gradually burgeon, transforming our passion for coding into a burden. I recently traversed this challenging terrain, feeling the weight of increasing pressure overshadow the joy I once found in my work.</p>
<p>Balancing multiple projects soon became an overwhelming endeavor, and the mounting responsibility took a toll on my mental well-being. The internal disruption became a daily struggle, gradually chipping away at my enthusiasm. The tipping point arrived when I found myself returning home devoid of joy, emotions bottled up until they couldn't be contained any longer.</p>
<h2 id="heading-revelation-and-turning-point"><strong>Revelation and Turning Point</strong></h2>
<p>Acknowledging the damaging impact on my mental health became a pivotal moment. Feeling weighed down by my struggles, I reached out to a colleague who'd been through similar situations. Their experience offered me priceless advice and support.</p>
<p><em>“Don't let the projects consume you!”</em> my colleague advised.</p>
<p><em>“While it's commendable to invest yourself in your work, maintaining a healthy emotional distance is vital. Your heart can be in the project, but remember, it's still work. When you return home, create that space for yourself, allowing room to rest and recharge.”</em></p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1698862947586/89e64b5b-0138-48d1-ba73-a6bf187f161c.jpeg" alt class="image--center mx-auto" /></p>
<h2 id="heading-8-essential-advices">8 Essential Advices</h2>
<ol>
<li><p><strong>Setting Realistic Goals:</strong> Embrace the essence of setting achievable goals. Instead of aiming for the impossible, break down tasks into smaller, manageable components. Realistic targets not only boost productivity but also alleviate the mental strain. Celebrate small victories along the way.</p>
</li>
<li><p><strong>Take Breaks and Disconnect:</strong> In a world connected by technology, it's easy to be consistently plugged into work. Don't forget the importance of breaks. Step away from the screen, go for a walk, exercise, or engage in hobbies. These pauses rejuvenate the mind and allow fresh perspectives.</p>
</li>
<li><p><strong>Establish Boundaries:</strong> Define work hours and respect them. Setting boundaries ensures a healthy work-life balance. Let colleagues and clients know your availability, fostering a culture of respect for personal time. <mark>Leaving early doesn't make you a jerk; it's about self-care, and that means better project outcomes for the company in the long run!</mark></p>
<p> Self-imposed expectations often lead us down a path of self-destruction. The belief that we must conquer every task at the cost of our mental well-being is flawed. When something isn’t feasible, you should communicate it promptly. Working through the night may seem like a solution, but it typically <strong>worsens</strong> the problem.</p>
</li>
<li><p><strong>Continuous Learning and Growth:</strong> Keep learning, not just in your coding niche, but also about stress management and mental health. Explore mindfulness, meditation, or other practices that help in maintaining emotional equilibrium.</p>
</li>
<li><p><strong>Seek Support Networks:</strong> Build a support network within the development community or beyond. Engage with like-minded individuals, share experiences, and learn from others' coping strategies. Don't hesitate to seek professional help if the stress becomes overwhelming.</p>
<p> I used to believe that everyone operated as flawless machines, effortlessly managing immense pressure while radiating happiness. It's only recently that I've come to understand how many conceal their pain and struggles to present a polished facade. However, it's vital to embrace our humanity and imperfections rather than striving for an unattainable perfection. This is a lesson I learned while having deep conversations with my colleagues.</p>
</li>
<li><p><strong>Reflect and Adapt:</strong> Regularly reflect on your work habits and stress triggers. Adapt and evolve strategies to manage stress effectively. Not all solutions work for everyone, so be open to trying different methods until you find what suits you best.</p>
</li>
<li><p><strong>Cultivate Positivity:</strong> Fostering a positive outlook can significantly impact mental well-being. Embrace gratitude, celebrate achievements, and acknowledge progress made, no matter how small.</p>
</li>
<li><p><strong>Normalize Open Conversations:</strong> Cultivate a work culture that normalizes discussions on mental health. Encourage open conversations and support amongst team members. Collective support goes a long way in alleviating stress and fostering a healthy work environment.</p>
</li>
</ol>
<p>Remember, prioritizing mental health is a journey, not a destination. By incorporating these practices into your routine, you can steadily enhance your well-being and find a healthier balance between work and life.</p>
<h2 id="heading-the-key-to-reducing-pressure-is-communication"><strong>The key to reducing pressure is communication.</strong></h2>
<p>One crucial lesson resonated profoundly: <strong>communication is crucial</strong>. Hiding our struggles may seem a sign of strength, <mark>but reaching out is where true strength lies. </mark> My colleague emphasized the importance of voicing our struggles, be it to a Project Manager or someone in a position of authority. They, too, are human and may not be able to tell what's going on inside us unless we say it.</p>
<p><em>“Say no when needed”</em> my colleague emphasized. <em>“Don't succumb to the pressure of saying yes to everything. It's okay to communicate delays or when a workload becomes unmanageable. There's no need to bear the weight alone.”</em></p>
<h2 id="heading-conclusion-striking-a-balance"><strong>Conclusion: Striking a Balance</strong></h2>
<p>The journey toward balance and mental well-being is ongoing. As developers, we are driven by a passion for our craft. But learning to separate, communicate, and accept personal boundaries is important for our overall health and longevity in the industry.</p>
<p>Let's strive for a balance that nurtures our passion without compromising our mental health. <mark>Remember, taking care of oneself is not a sign of weakness, but a testament to strength and resilience!</mark></p>
<p><strong>Hope you enjoyed reading my blog post!</strong></p>
<p>Feel free to share any additional mental health management tips or strategies in the comments below! Your insights and experiences could greatly help others navigating similar challenges.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1698863120326/80964e3d-f552-49fa-accf-1cb878ccf4bb.jpeg" alt class="image--center mx-auto" /></p>
]]></content:encoded></item><item><title><![CDATA[Solving ESLint Problems]]></title><description><![CDATA[Introduction to the Problem
Today, I had an extremely challenging day wrestling with a perplexing error message. It threw me off balance and consumed my entire day. Let me walk you through the roller-coaster of emotions and problem-solving that I wen...]]></description><link>https://blog.anja-stricker.de/solving-eslint-problems</link><guid isPermaLink="true">https://blog.anja-stricker.de/solving-eslint-problems</guid><category><![CDATA[eslint]]></category><category><![CDATA[vscode extensions]]></category><category><![CDATA[VSCode Tips]]></category><category><![CDATA[vscode]]></category><category><![CDATA[Nx]]></category><dc:creator><![CDATA[Anja Stricker]]></dc:creator><pubDate>Sat, 29 Jul 2023 13:07:45 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1690630006253/d40b4f37-8317-45b5-8238-b52725a6def0.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<h2 id="heading-introduction-to-the-problem">Introduction to the Problem</h2>
<p>Today, I had an extremely challenging day wrestling with a perplexing error message. It threw me off balance and consumed my entire day. Let me walk you through the roller-coaster of emotions and problem-solving that I went through.</p>
<p>The day started with an error message that left me scratching my head:</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1690634559347/55b108ac-5f95-4cb8-886f-3960c7d0c24f.png" alt class="image--center mx-auto" /></p>
<p>The error says, that it needs the <code>parserOptions</code> value set in the <code>.eslintrc.json</code> which needs the path to your <code>tsconfig.json</code> file. Ok! Let’s add it…</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1690634759067/8f78bc7c-3100-4250-98d2-209cfacef642.png" alt class="image--center mx-auto" /></p>
<p>I diligently added the required line to the <code>.eslintrc.json</code> file, hoping it would resolve the issue. Alas, when I ran ESLint again, to my dismay, I was greeted by the same stubborn error. Frustration crept in.</p>
<p>I had a similar problem like this before and only had to add the lines from above inside the <code>.eslintrc.json</code> files inside the respective packages (folders), and not in the root file itself. But since I already have it that way, it cannot be the problem this time …</p>
<p>Let give Google a shot.</p>
<h2 id="heading-panic-mode-trying-everything"><strong>Panic Mode: Trying Everything</strong></h2>
<p>After scrolling through the search results, I gained a bit of panic. No one has my issue!? How can this be?!</p>
<p>I tried narrowing down the issue, and it looked like I was not able to resolve typed problems by <code>@typescript-eslint/parser</code>, but why are the other ones working!? I tried following the ESLint installation site. Changing paths. Nothing helped.</p>
<p>The thing was, it was already working on another (but older) project. Are the dependencies the issue? I tried following this hint and used the exact ones as the old project does, but it was still not working.</p>
<p>Panic is rising.</p>
<p>I created a new clean project generated by <code>nx</code>. Another one just like mine. Same thing, doesn’t work.</p>
<p>I created a new, clean standalone project for <code>react.js</code>. This time it worked? I am completely confused. I tried running the linting command in the terminal and this works apparently? I was thinking… if it works in the terminal, then the project itself is correctly configured. I am not seeing the error in VS Code… so it’s the ESLint plug-in?</p>
<h2 id="heading-a-glimpse-of-hope-checking-the-extension"><strong>A Glimpse of Hope: Checking the Extension</strong></h2>
<p>I’ve googled about the ESLint plug-in, and found something very interesting. There is a settings file in which I can set the working directories. I was very hopeful and tried that out. There is a new update which allows u to use “auto”. I typed that in and saved.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1690635093048/ef81ad82-67a9-475d-a4bf-905b2b588069.png" alt class="image--center mx-auto" /></p>
<p>Nothing happened. My anger grew. I wanted to flip tables. What was going on?!</p>
<p>One LAST brain cell kept holding onto hope and said to me, “try reloading the extension”. I did. And to my upper surprise, it worked!</p>
<h2 id="heading-conclusion">Conclusion</h2>
<p>My emotions were mixed—relieved to have found a solution, yet annoyed that it was a single word and a reload away all along. I felt both elated and exhausted.</p>
<p>As I couldn't find a single solution to this peculiar problem on the internet, I realized I must share my experience and newfound solution to help others save their precious time and sanity.</p>
<p>I'm still uncertain why the extension worked flawlessly before in different projects, but not this time. Perhaps the new project structure played a role, but I'm as perplexed as ever. I will keep a watchful eye on this and update you in a future post if I make any new discoveries. For now, I've learned to approach extensions with a healthy dose of skepticism 🫠</p>
<p><strong>Hope you enjoyed reading my blog post!</strong></p>
]]></content:encoded></item><item><title><![CDATA[Why Using Index as Key in React.js Map Function Can Cause Problems and How to Fix Them]]></title><description><![CDATA[Introduction
Are you a React Developer looking to ace your next interview? Then you need to know about the problem with using index as a key in a React.js map function. In this blog post, I'll explain why using unique keys is important, how it can im...]]></description><link>https://blog.anja-stricker.de/why-using-index-as-key-in-reactjs-map-function-can-cause-problems-and-how-to-fix-them</link><guid isPermaLink="true">https://blog.anja-stricker.de/why-using-index-as-key-in-reactjs-map-function-can-cause-problems-and-how-to-fix-them</guid><category><![CDATA[React]]></category><category><![CDATA[Mapping]]></category><category><![CDATA[Performance Optimization]]></category><category><![CDATA[indexing]]></category><category><![CDATA[list]]></category><dc:creator><![CDATA[Anja Stricker]]></dc:creator><pubDate>Mon, 10 Apr 2023 14:52:55 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1681138207768/ecb9061e-1e71-4404-8f91-ed0a4aaf4ff0.jpeg" length="0" type="image/jpeg"/><content:encoded><![CDATA[<h2 id="heading-introduction">Introduction</h2>
<p>Are you a React Developer looking to ace your next interview? Then you need to know about the problem with using index as a <code>key</code> in a React.js map function. In this blog post, I'll explain why using unique keys is important, how it can improve performance, and how it can make you a better developer. Don't miss out on this crucial topic!</p>
<h2 id="heading-the-problem-with-using-index-as-the-key">The Problem with Using Index as the Key</h2>
<p>When you use the <code>map()</code> function in React to render a list of items, it's essential to assign a unique <code>key</code> to each element. The <code>key</code> is used by React to identify which elements have changed, which can help improve the performance of your application.</p>
<p>However, a common mistake is to use the index of the element as the <code>key</code>. While this may seem like a reasonable solution, it can cause issues when the order of the list is changed. When the order of the list changes, React may not be able to correctly identify which elements have changed, resulting in unnecessary DOM updates and potentially slowing down your application.</p>
<h2 id="heading-an-example-of-the-problem">An Example of the Problem</h2>
<p>Let's say we have a list of items that we want to render in our React application. We fetch the data from an API and display it using the <code>map()</code> function:</p>
<pre><code class="lang-javascript"><span class="hljs-keyword">const</span> items = [
  { <span class="hljs-attr">id</span>: <span class="hljs-number">1</span>, <span class="hljs-attr">name</span>: <span class="hljs-string">'Item 1'</span> },
  { <span class="hljs-attr">id</span>: <span class="hljs-number">2</span>, <span class="hljs-attr">name</span>: <span class="hljs-string">'Item 2'</span> },
  { <span class="hljs-attr">id</span>: <span class="hljs-number">3</span>, <span class="hljs-attr">name</span>: <span class="hljs-string">'Item 3'</span> },
];

<span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">MyList</span>(<span class="hljs-params"></span>) </span>{
  <span class="hljs-keyword">return</span> (
    <span class="xml"><span class="hljs-tag">&lt;<span class="hljs-name">ul</span>&gt;</span>
      {items.map((item, index) =&gt; (
        <span class="hljs-tag">&lt;<span class="hljs-name">li</span> <span class="hljs-attr">key</span>=<span class="hljs-string">{index}</span>&gt;</span>{item.name}<span class="hljs-tag">&lt;/<span class="hljs-name">li</span>&gt;</span>
      ))}
    <span class="hljs-tag">&lt;/<span class="hljs-name">ul</span>&gt;</span></span>
  );
}
</code></pre>
<p>At this point, everything works as expected, and the list renders correctly:</p>
<ul>
<li><p>Item 1</p>
</li>
<li><p>Item 2</p>
</li>
<li><p>Item 3</p>
</li>
</ul>
<p>However, let's say we decide to reorder the list by swapping the positions of Item 2 and Item 3:</p>
<pre><code class="lang-javascript"><span class="hljs-keyword">const</span> items = [
  { <span class="hljs-attr">id</span>: <span class="hljs-number">1</span>, <span class="hljs-attr">name</span>: <span class="hljs-string">'Item 1'</span> },
  { <span class="hljs-attr">id</span>: <span class="hljs-number">3</span>, <span class="hljs-attr">name</span>: <span class="hljs-string">'Item 3'</span> },
  { <span class="hljs-attr">id</span>: <span class="hljs-number">2</span>, <span class="hljs-attr">name</span>: <span class="hljs-string">'Item 2'</span> },
];
</code></pre>
<p>If we rerender the list using the same <code>map()</code> function, React will not be able to correctly identify which elements have changed, since we're still using the index as the <code>key</code>. As a result, React will needlessly update all of the list items, even though only the positions of Item 2 and Item 3 have changed. This can lead to performance issues in larger applications with many elements.</p>
<h2 id="heading-the-solution">The Solution</h2>
<p>Using a Unique Identifier as the Key To solve this problem, we can use a unique identifier as the <code>key</code> instead of the index. In our previous example, we could use the <code>id</code> property of each item as the <code>key</code>:</p>
<pre><code class="lang-javascript"><span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">MyList</span>(<span class="hljs-params"></span>) </span>{
  <span class="hljs-keyword">return</span> (
    <span class="xml"><span class="hljs-tag">&lt;<span class="hljs-name">ul</span>&gt;</span>
      {items.map((item) =&gt; (
        <span class="hljs-tag">&lt;<span class="hljs-name">li</span> <span class="hljs-attr">key</span>=<span class="hljs-string">{item.id}</span>&gt;</span>{item.name}<span class="hljs-tag">&lt;/<span class="hljs-name">li</span>&gt;</span>
      ))}
    <span class="hljs-tag">&lt;/<span class="hljs-name">ul</span>&gt;</span></span>
  );
}
</code></pre>
<p>By using the <code>id</code> property as the <code>key</code>, React can more efficiently identify which elements have changed and which ones can be reused from the previous render. This can help improve the performance of your application, especially in larger lists.</p>
<h2 id="heading-conclusion">Conclusion</h2>
<p>In this blog post, we've discussed the importance of using a unique identifier as the <code>key</code> in React's <code>map()</code> function. In summary, using the index of an array as the <code>key</code> prop in React's <code>map()</code> function can cause issues when the list items can be added, removed, or reordered. To avoid these problems, you should always use a unique identifier as the <code>key</code> prop instead. This will help React more efficiently identify the elements in the list that need to be updated, resulting in better performance and fewer potential bugs.</p>
<p>Thank you for reading! I hope you found this blog post helpful. If you have any questions or comments, please feel free to share them in the comments section below.</p>
]]></content:encoded></item><item><title><![CDATA[Hello World!]]></title><description><![CDATA[Introduction
Welcome to my new developer blog! My name is Anja and I want to introduce myself! As a creative full-stack developer for almost 6 years, I have always been interested in finding new and innovative ways to solve problems and build softwar...]]></description><link>https://blog.anja-stricker.de/hello-world</link><guid isPermaLink="true">https://blog.anja-stricker.de/hello-world</guid><category><![CDATA[Hello World]]></category><category><![CDATA[introduction]]></category><category><![CDATA[software development]]></category><category><![CDATA[full stack]]></category><category><![CDATA[Full Stack Development]]></category><dc:creator><![CDATA[Anja Stricker]]></dc:creator><pubDate>Sat, 07 Jan 2023 19:23:42 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/stock/unsplash/alCEnNmzhPE/upload/5dba38c35cfbc06289f2dbbb86d8ce75.jpeg" length="0" type="image/jpeg"/><content:encoded><![CDATA[<h3 id="heading-introduction">Introduction</h3>
<p>Welcome to my new developer blog! My name is Anja and I want to introduce myself! As a creative full-stack developer for almost 6 years, I have always been interested in finding new and innovative ways to solve problems and build software. In this blog, I plan to share my experiences, insights, and tips for other developers who are looking to tap into their creativity and become more well-rounded professionals.</p>
<p>Over the years, I have had the opportunity to work with a wide range of technologies, including languages such as C#, Python, and JavaScript, as well as frameworks like React, React Native, Angular, Express.js, and Node.js. Each of these technologies has its own unique strengths and capabilities, and I have enjoyed the challenge of learning and mastering them.</p>
<h3 id="heading-background">Background</h3>
<p>As a full-stack developer, I have the unique opportunity to work on both the front-end and back-end of web and software applications. This requires a diverse set of skills, including proficiency in programming languages as well as a strong understanding of database design and server-side technologies.</p>
<p>However, being a full-stack developer is about more than just technical expertise. It also requires creativity, adaptability, and the ability to think outside the box. In my experience, incorporating a creative mindset into my work as a developer has helped me to come up with unique solutions to challenging problems and to continuously learn and grow as a professional.</p>
<p>In addition to my full-time job, I also work on my own software company side hustle. As a developer, I always want to learn new things and be on the cutting edge of technology. Since I also like to draw in my free time besides developing, I am a very creative person who has a sense for good and appealing application designs.</p>
<h3 id="heading-main-points">Main points</h3>
<p>In this blog, I plan to cover a variety of topics related to being a creative full-stack developer. This will include:</p>
<ul>
<li><p>Tips for staying up to date with the latest technologies and best practices</p>
</li>
<li><p>Strategies for incorporating creativity into your work as a developer</p>
</li>
<li><p>Become a productive developer using effective time management techniques</p>
</li>
<li><p>Personal case studies of projects where I have used my creativity to solve problems or build something new</p>
</li>
<li><p>Advice for other developers looking to improve their skills and become more well-rounded professionals</p>
</li>
</ul>
<h3 id="heading-conclusion">Conclusion</h3>
<p>I hope you will join me on this journey as I share my experiences and insights as a creative full-stack developer. Whether you are just starting in your career or are an experienced professional looking to expand your skills, I believe there is always something new to learn and ways to grow as a developer.</p>
<h3 id="heading-questions-for-discussion">Questions for discussion</h3>
<p>As I will continue to publish content on this blog, I want to make sure that I am covering topics that are of interest to you! With that in mind, I would love to hear from you about the topics you would like to see me write about. Please share your ideas and suggestions in the comments below!</p>
]]></content:encoded></item></channel></rss>