<?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 Daniel Gospodinow on Medium]]></title>
        <description><![CDATA[Stories by Daniel Gospodinow on Medium]]></description>
        <link>https://medium.com/@danielgospodinow?source=rss-50de0258a02b------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/2*kNEXxnPCB5_RwiU9I2SHCA.jpeg</url>
            <title>Stories by Daniel Gospodinow on Medium</title>
            <link>https://medium.com/@danielgospodinow?source=rss-50de0258a02b------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 29 Nov 2026 23:40:08 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@danielgospodinow/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[A WoW Addon’s Distributed Log Problem]]></title>
            <link>https://medium.com/@danielgospodinow/a-wow-addons-distributed-log-problem-aeabb3ee44f3?source=rss-50de0258a02b------2</link>
            <guid isPermaLink="false">https://medium.com/p/aeabb3ee44f3</guid>
            <category><![CDATA[distributed-systems]]></category>
            <category><![CDATA[software-engineering]]></category>
            <category><![CDATA[software-development]]></category>
            <dc:creator><![CDATA[Daniel Gospodinow]]></dc:creator>
            <pubDate>Sun, 22 Nov 2026 10:02:36 GMT</pubDate>
            <atom:updated>2026-11-22T10:02:36.793Z</atom:updated>
            <content:encoded><![CDATA[<h4>Keeping a guild’s shared kill list in sync over a chat channel with no server and no memory.</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*Uf8D83zKG2gJBYkL" /><figcaption>Photo by <a href="https://unsplash.com/@bostonpubliclibrary?utm_source=medium&amp;utm_medium=referral">Boston Public Library</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>I play <strong>World of Warcraft: Forever</strong> with a guild of (mostly software engineer) friends. One of us randomly came up with the idea to have an addon that tracks all enemy players that are harrasing us and we called it <strong>Guild Vendetta</strong>. It keeps a shared list of every enemy player who has killed someone in the guild, and when one of them appears on your screen, it flashes red, posts a warning and plays a sound.</p><p><a href="https://github.com/danielgospodinow/guild-vendetta">GitHub - danielgospodinow/guild-vendetta: A WoW Forever addon that tracks enemy players that have killed you or your guildies</a></p><p>The addon itself was the easy part. The interesting part turned out to be a classic <strong>distributed-systems problem</strong> in an unusual place: keeping one shared log in agreement across every guild member, with no backend (server and DB), over a chat channel with minimal retention.</p><p>This is how that works, starting from the simplest protocol that’s correct and adding two optimizations that make it cheap.</p><h3>What the addon does</h3><p>When a guild member dies to enemy players in world PvP, the addon records the kill: who died, every enemy who took part, who landed the killing blow, levels, zone and map coordinates. Later, when we spot one of those enemies, our screens flash red and we get an alert. When a guildmate takes a listed enemy down, they get credit. And we also keep a leaderboard of the best revengers in our guild.</p><h3>The constraints</h3><p>WoW addons are Lua code running inside the game client, in a sandbox. These limits shaped every decision:</p><ul><li><strong>No network access.</strong> Addons can’t make HTTP requests or open sockets, so a server is out of reach from inside the game. (I briefly planned a companion desktop app with a Go service and a Postgres database, then dropped it once the in-game protocol worked.)</li><li><strong>One local file, written late.</strong> Each addon gets a saved-data file, but the game writes it only on logout, /reload or a clean exit. An addon can&#39;t force a save.</li><li><strong>One shared channel.</strong> C_ChatInfo.SendAddonMessage(prefix, text, &quot;GUILD&quot;) delivers a hidden message to every guild member who is online right now. It never shows up in chat.</li><li><strong>The channel has no memory.</strong> Nothing is stored. If you’re offline when a message goes out, you never see it.</li><li><strong>Tiny, throttled messages.</strong> 255 bytes each. The client throttles bursts, and the budget is shared with every other addon.</li><li><strong>No combat log.</strong> WoW: Forever blocks the combat log for addons. I found that out with a small probe addon in the live client after my first build tripped a “blocked action” error. Kills come from Blizzard’s death recap instead, which is readable a second after you die.</li></ul><p>In other words: <strong>A broadcast bus with no persistence, tiny frames and a rate limit, whose members come and go at random. Every member has to hold a full copy of the data, and the copies have to be reconciled through that bus.</strong></p><h3>The shape of the solution</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*RBDBVSXXnChMtGYUme66KA.png" /></figure><ul><li><strong>Every player keeps a local log</strong>, an append-only set of events in the addon’s saved file.</li><li><strong>Things that happen are broadcast live</strong>, one message per event, and everyone online appends it.</li><li><strong>Logs are reconciled when they drift.</strong> Every addon regularly broadcasts a hash of its whole log; a mismatch starts a short exchange with whoever is online.</li><li><strong>Everything on screen is computed from the local log.</strong> The list, the scores and the leaderboard are views, never stored state.</li></ul><h3>A log that can’t conflict</h3><p>The log holds three kinds of event:</p><ol><li>a KILL (a guildmate died),</li><li>a REMOVE (someone took an enemy off the list),</li><li>and a VENDETTA (a guildmate helped take down a listed enemy).</li></ol><p>Here&#39;s a real kill from my saved file:</p><pre>[&quot;K:Todor Zhivkoff:1795288823&quot;] = {<br>  k = &quot;K&quot;, t = 1795288823,<br>  vic = &quot;Todor Zhivkoff&quot;, vlvl = 32, vclass = &quot;PALADIN&quot;,<br>  zone = &quot;Alterac Mountains&quot;, sub = &quot;The Headland&quot;, map = 1416, x = 0.399, y = 0.920,<br>  en = {<br>    { n = &quot;Yasashii Hinghtclaw&quot;, g = &quot;Player-6842-00C4852A&quot;, c = &quot;DRUID&quot;,   r = &quot;NightElf&quot;, l = 37, kb = true  },<br>    { n = &quot;Muffe Kung&quot;,          g = &quot;Player-6948-05F3FBB6&quot;, c = &quot;WARRIOR&quot;, r = &quot;Human&quot;,    l = 32, kb = false },<br>  },<br>}</pre><p>Four rules make this easy to replicate:</p><ol><li><strong>Events never change.</strong> Removing an enemy doesn’t edit or delete anything; it appends a REMOVE. Two players can disagree about <em>which</em> events they hold, never about what an event says.</li><li><strong>IDs come from the content.</strong> K:Todor Zhivkoff:1795288823 is type, victim and the second of death. Every client derives the same ID for the same event, so duplicates are recognized on sight. IDs are never sent, so nobody can pair a valid ID with different content.</li><li><strong>Merging is a set union.</strong> Take every ID from both sides. Arrival order doesn’t matter, and receiving something twice changes nothing. In CRDT terms, it’s a grow-only set.</li><li><strong>The screen is a function of the log.</strong> An enemy is listed if they have a kill from the last 14 days that’s newer than their latest removal.</li></ol><p>With this model there’s nothing to resolve. Syncing reduces to one question: <em>which events does the other side lack?</em></p><h3>Why “send me everything since time T” doesn’t work</h3><p>The first idea most people have is a watermark: remember the newest event you’ve seen, and ask for anything newer. It loses data.</p><p>Say Thrall dies at 10:00 while he’s the only one online, so only he has that kill. At 12:00 Jaina logs in and syncs with Todor, so her watermark becomes 12:00. When Thrall comes online at 14:00, Jaina asks for events after 12:00 and never gets his 10:00 kill. The order in which events <em>happen</em> isn’t the order in which they <em>become known</em>. The protocol has to compare what each side actually holds.</p><h3>The simplest protocol that works</h3><p>Here’s the baseline:</p><ol><li>Every addon periodically broadcasts a <strong>heartbeat</strong>: one hash of its whole log.</li><li>Anyone who sees a hash different from their own <strong>sends all of their events</strong>.</li><li>Everyone keeps whatever is new to them from everyone else’s messages.</li></ol><p>It’s correct, and it converges in one step: after a single round, every online player holds the union of everyone’s events. I kept it as my reference point for correctness.</p><p>It’s also expensive, in two ways:</p><ul><li><strong>Many identical answers.</strong> When a newcomer with an empty log sends a heartbeat, <em>every</em> guildmate who is in sync sees a different hash, and every one of them dumps the same log. Twenty guildmates online and in-sync — twenty identical streams of events. It’s just redundant spam.</li><li><strong>The whole log for every drift.</strong> A player who missed 2 events still receives everything. And since their own hash differs from everyone else’s, they send their entire log back too, in case they hold something the others lack.</li></ul><h3>Optimization 1: answer sorting</h3><p>Every message is a broadcast, so every request is seen by every online guildmate, and guildmates with identical logs would send byte-for-byte identical answers. Only one of them needs to speak.</p><h4>First attempt: random waits</h4><p>My first version had each player wait a random 1 to 5 seconds before answering, and skip anything someone else had already sent in the meantime. Usually the earliest player speaks and the rest stay quiet.</p><p>It breaks when two waits end close together. If two players start within about half a second, neither has seen the other’s first message, so both start sending. From then on they move at the same pace, one event every 0.4 seconds, so neither ever sees the other’s copy before sending its own. The whole answer goes out twice, and the more players are online, the more likely that near-tie becomes. I measured it in a simulator, with a newcomer catching up on 20 events:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Zzv5PbRp33SnU1zkBxA4ag.png" /></figure><h4>What shipped: a turn order everyone computes the same way</h4><p>Instead of chance, every client computes the same ranking from the same inputs, without sending a single coordination message:</p><ol><li>Each addon remembers every guildmate it has heard on the channel in the last 10 minutes. Heartbeats keep everyone’s list the same.</li><li>For a request, each addon scores every name as hash(name | requester | request), where the request is the message type plus a hash of its contents.</li><li>Sorted by score, place 0 answers after half a second, and each later place waits 2 seconds more. An addon only needs to know its own place.</li></ol><p>These are the real scores the addon computes when a newcomer, Rexxar, sends his login heartbeat with four guildmates online:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jqaVRhqTfIya3V0VYhPdSA.png" /></figure><p>Because the request is part of the hash, the order changes with every request, so no single player ends up doing all the sending. For Rexxar’s very next request, Jaina goes first.</p><p>Fallback comes for free. When a player’s turn arrives, it sends only what hasn’t appeared on the channel since the request came in. If place 0 answered, everyone after it stays quiet. If place 0 is AFK or on a loading screen, place 1 answers two seconds later, then place 2, and so on. If place 0 stops halfway, place 1 sends only the rest, and since it started later at the same pace, it never collides with an event still in flight.</p><p>The 2-second spacing is the real fix: unlike random waits, two players never start within half a second of each other unless their lists of who’s online disagree. That can briefly happen to someone who just logged in, so anyone online for less than 6 minutes waits 4 extra seconds and acts as a late backup.</p><p>Why not whisper answers directly to the player who asked? Because the others stay quiet precisely because they see the answer go by. A whisper is invisible to them, so they’d all answer too. Broadcasting also lets any bystander missing the same events pick them up for free.</p><h3>Optimization 2: precise event sending</h3><p>Sorting gets the guild down to one answer per version of the log. The second optimization makes that answer contain only what’s missing, in two steps.</p><h4>Step 1: compare a summary per unit</h4><p>Events are grouped into <em>units</em>. Each of the last 15 days is a unit, written as days since 1970 (20778 is 21 November 2026). Anything older falls into a 30-day block, written m plus the block number. For each unit, the summary lists how many events it holds and a hash of their IDs:</p><pre>m690:1:585697855;20777:1:2408568836;20778:3:2395705750</pre><p>The heartbeat hash is simply a hash of this summary. When two summaries differ, the units that match can be skipped entirely.</p><h4>Step 2: compare fingerprints inside the units that differ</h4><p>For each unit it disagrees on, a player lists a 6-character fingerprint of every event it holds there. An empty list means “I have nothing here, send me all of it.” All the lists go out in one message:</p><pre>20778:1900282881:1hj0ek,lmywsf|20777:0:</pre><p>Now the other side knows exactly which events are missing, and sends only those. If the list shows events <em>it</em> lacks, it replies with its own fingerprints and gets those back. The exchange ends when neither side is missing anything.</p><p>Why 30-day blocks? Leaderboard credits never expire, so without blocks every day that ever had one would stay in the summary forever, and a year-old guild would send 300+ entries on every check. With blocks, a year of history is about 28 units, two messages. A missing credit from months ago is still found exactly: its block differs, and the block’s fingerprints pinpoint it.</p><h3>The whole exchange</h3><p>Login and /reload use the same check as the periodic heartbeat: 8 seconds after you log in, your addon broadcasts the hash of its log.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*z2yax2R3WFY78aI34LZBAw.png" /></figure><p>That’s four message types in total:</p><ol><li><strong>B</strong> (heartbeat),</li><li><strong>H</strong> (summary),</li><li><strong>I</strong> (fingerprint lists),</li><li>and <strong>E</strong> (an event).</li></ol><p>Every message starts with a 5-character header, so a payload too long for 255 bytes can be split into parts and put back together.</p><h3>What it looks like on the wire</h3><p>These transcripts are real output from the addon’s code, run as several simulated players. Four guildmates are online and in sync, each holding the same 5 events.</p><p><strong>A brand-new player with an empty log:</strong></p><pre>t=0.0  Rexxar Misha         B 5381<br>t=0.8  Sylvanas Windrunner  H m690:1:585697855;20777:1:2408568836;20778:3:2395705750<br>t=5.7  Rexxar Misha         I 20778:0:|20777:0:|m690:0:<br>t=6.4  Jaina Proudmoore     E R~1795289699~Player-6948-05F3FBB6~Thrall Durotan<br>t=6.5  Jaina Proudmoore     E V~1795289633~Player-6842-00C4852A~Yasashii Hinghtclaw~...<br>t=6.6  Jaina Proudmoore     E K~1795289030~Todor Zhivkoff~...<br>t=6.7  Jaina Proudmoore     E K~1795202630~Sylvanas Windrunner~...<br>t=6.8  Jaina Proudmoore     E V~1790105030~Player-6948-0ABCDEF1~Gankston Doe~...</pre><p>An empty log hashes to 5381. All four guildmates would send the same summary; Sylvanas is first in line, and the others stay quiet. Rexxar has nothing in any unit, so he asks for all three at once. For that request Jaina is first, and she sends the five events while the others watch them go by. Eight messages, each event sent once.</p><p><strong>A returning player missing 2 of the 5 events:</strong></p><pre>t=0.0  Garrosh Hellscream   B 28244048<br>t=0.7  Jaina Proudmoore     H m690:1:585697855;20777:1:2408568836;20778:3:2395705750<br>t=5.5  Garrosh Hellscream   I 20778:1900282881:1hj0ek,lmywsf|20777:0:<br>t=6.2  Todor Zhivkoff       E V~1795289633~Player-6842-00C4852A~Yasashii Hinghtclaw~...<br>t=6.3  Todor Zhivkoff       E K~1795202630~Sylvanas Windrunner~...</pre><p>The two-month-old block matches and costs nothing. Only the two missing events cross the channel: five messages in total.</p><p><strong>A </strong><strong>/reload while up to date:</strong></p><pre>t=0.0  Todor Zhivkoff       B 2163612622</pre><p>Everyone computes the same hash, and nobody answers. That’s what almost every login, reload and periodic heartbeat looks like.</p><p>Compared with the simple protocol, on a 300-event log:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*MqncYIV9xPkUb7Tk--fAZw.png" /></figure><h3>Smaller details that mattered</h3><ul><li><strong>Heartbeats heal more than logins.</strong> The same check runs every 4 to 6 minutes, so an event missed during a loading screen is repaired within minutes, without anyone reloading.</li><li><strong>Heartbeats are jittered and patient.</strong> Each addon picks a random moment in that window, so the guild doesn’t beat in lockstep, and skips its heartbeat while it still has messages to send.</li><li><strong>Login sends a hash, not the summary.</strong> An earlier version sent the full summary at login. The hash costs one extra round when you’re behind, but makes the common case, a reload with nothing new, a single tiny message.</li><li><strong>Hashes detect change; they don’t provide security.</strong> The protocol uses djb2, which is fast and identical on every client. Trust stays inside the guild: only guild-channel messages are accepted, incoming events are validated, and any member may add or remove entries.</li><li><strong>The game’s memory is part of the design.</strong> An event reaches disk only at logout, so a crash can lose it locally. But guildmates who received the broadcast give it back at the next login. The only real loss window is a crash in the split second before anyone received it.</li><li><strong>Names have two parts.</strong> Characters in WoW: Forever are named like “Todor Zhivkoff”, and the realm comes back empty, so enemies are tracked by their character ID, with the name as a fallback.</li></ul><h3>How I tested it</h3><p>You can’t script the game from outside, so most testing happens in plain Lua with the game’s API stubbed out:</p><ul><li><strong>Unit tests</strong> cover encoding, the computed views, removal rules, 30-day blocks and fingerprint lists.</li><li><strong>A multi-client smoke test</strong> loads the addon several times and plays out deaths, live sync, removals, login catch-up, heartbeat healing and alerts. Its timers honor real delays. An earlier harness fired every timer at once, which hid exactly the near-tie problem that broke random waits.</li><li><strong>A scale check</strong> asserts that a newcomer gets each missing event exactly once with 5 or 15 guildmates online, and with half of them AFK. It fails against the random-wait version, which sent 40 messages to deliver 20 events.</li><li><strong>Captured transcripts</strong> like the ones above come straight from the code. Capturing them is how I noticed that an earlier version needed about 35 messages to deliver one missing event, which led to the fingerprint step.</li></ul><h3>What I’d take away</h3><ul><li><strong>Start with the simplest correct protocol, then optimize.</strong> “If your hash differs, send me everything” was the reference. Each optimization had to keep its guarantee and earn its place in measured traffic.</li><li><strong>Immutability removes most of the hard parts.</strong> Immutable events, IDs derived from content and union merge mean no conflicts, no ordering problems and no consensus.</li><li><strong>On a shared bus, deterministic coordination beats randomness.</strong> If everyone can compute who goes first from data they already have, nobody has to talk about who talks.</li><li><strong>Measure before trusting intuition.</strong> Random backoff looked fine on paper. Measured, it sent up to seven times the traffic it needed.</li></ul><p>The addon, the tests and a full protocol reference are on GitHub: <a href="https://github.com/danielgospodinow/guild-vendetta">github.com/danielgospodinow/guild-vendetta</a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=aeabb3ee44f3" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Prometheus. What’s That?]]></title>
            <description><![CDATA[<div class="medium-feed-item"><p class="medium-feed-image"><a href="https://levelup.gitconnected.com/prometheus-whats-that-711be6d934f?source=rss-50de0258a02b------2"><img src="https://cdn-images-1.medium.com/max/2600/1*WXdJXyaZGm8HKyPhT7TC0w.png" width="3454"></a></p><p class="medium-feed-snippet">Hands-on introduction to software monitoring and metrics visualization with Prometheus and Grafana</p><p class="medium-feed-link"><a href="https://levelup.gitconnected.com/prometheus-whats-that-711be6d934f?source=rss-50de0258a02b------2">Continue reading on Level Up Coding »</a></p></div>]]></description>
            <link>https://levelup.gitconnected.com/prometheus-whats-that-711be6d934f?source=rss-50de0258a02b------2</link>
            <guid isPermaLink="false">https://medium.com/p/711be6d934f</guid>
            <category><![CDATA[instrumentation]]></category>
            <category><![CDATA[grafana]]></category>
            <category><![CDATA[monitoring]]></category>
            <category><![CDATA[hands-on-tutorials]]></category>
            <category><![CDATA[prometheus]]></category>
            <dc:creator><![CDATA[Daniel Gospodinow]]></dc:creator>
            <pubDate>Fri, 26 Jul 2024 16:00:45 GMT</pubDate>
            <atom:updated>2024-07-26T16:00:45.707Z</atom:updated>
        </item>
        <item>
            <title><![CDATA[Apache Mesos. What’s That?]]></title>
            <description><![CDATA[<div class="medium-feed-item"><p class="medium-feed-image"><a href="https://medium.com/better-programming/apache-mesos-whats-that-75a1cd8a4b6c?source=rss-50de0258a02b------2"><img src="https://cdn-images-1.medium.com/max/2600/1*bcHx9rT3SjPhZ_osRlGxdw.png" width="2880"></a></p><p class="medium-feed-snippet">The operating system for data centers</p><p class="medium-feed-link"><a href="https://medium.com/better-programming/apache-mesos-whats-that-75a1cd8a4b6c?source=rss-50de0258a02b------2">Continue reading on Better Programming »</a></p></div>]]></description>
            <link>https://medium.com/better-programming/apache-mesos-whats-that-75a1cd8a4b6c?source=rss-50de0258a02b------2</link>
            <guid isPermaLink="false">https://medium.com/p/75a1cd8a4b6c</guid>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[cluster-management]]></category>
            <category><![CDATA[distributed-systems]]></category>
            <category><![CDATA[apache-mesos]]></category>
            <category><![CDATA[servers]]></category>
            <dc:creator><![CDATA[Daniel Gospodinow]]></dc:creator>
            <pubDate>Tue, 06 Jul 2021 18:20:19 GMT</pubDate>
            <atom:updated>2021-07-06T18:52:16.803Z</atom:updated>
        </item>
        <item>
            <title><![CDATA[Lyft Envoy. What’s That?]]></title>
            <description><![CDATA[<div class="medium-feed-item"><p class="medium-feed-image"><a href="https://medium.com/better-programming/what-is-lyft-envoy-9dfb45470f19?source=rss-50de0258a02b------2"><img src="https://cdn-images-1.medium.com/max/2265/1*WBgru4d1lsORR61EbNKq4w.png" width="2265"></a></p><p class="medium-feed-snippet">Envoy is an open-source cloud-native proxy focused on solving important distributed system pitfalls</p><p class="medium-feed-link"><a href="https://medium.com/better-programming/what-is-lyft-envoy-9dfb45470f19?source=rss-50de0258a02b------2">Continue reading on Better Programming »</a></p></div>]]></description>
            <link>https://medium.com/better-programming/what-is-lyft-envoy-9dfb45470f19?source=rss-50de0258a02b------2</link>
            <guid isPermaLink="false">https://medium.com/p/9dfb45470f19</guid>
            <category><![CDATA[debugging]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[microservices]]></category>
            <category><![CDATA[open-source]]></category>
            <category><![CDATA[devops]]></category>
            <dc:creator><![CDATA[Daniel Gospodinow]]></dc:creator>
            <pubDate>Tue, 02 Jun 2020 15:30:07 GMT</pubDate>
            <atom:updated>2020-06-05T15:09:15.633Z</atom:updated>
        </item>
        <item>
            <title><![CDATA[Data Structures. What’s a List?]]></title>
            <description><![CDATA[<div class="medium-feed-item"><p class="medium-feed-image"><a href="https://medium.com/better-programming/data-structures-whats-a-list-ca04b0ba9fa2?source=rss-50de0258a02b------2"><img src="https://cdn-images-1.medium.com/max/2600/1*RrbsorsjEN6rqvhGaB_P9g.png" width="2960"></a></p><p class="medium-feed-snippet">A detailed guide to the list data structure and its implementations&#x200A;&#x2014;&#x200A;array list and linked list</p><p class="medium-feed-link"><a href="https://medium.com/better-programming/data-structures-whats-a-list-ca04b0ba9fa2?source=rss-50de0258a02b------2">Continue reading on Better Programming »</a></p></div>]]></description>
            <link>https://medium.com/better-programming/data-structures-whats-a-list-ca04b0ba9fa2?source=rss-50de0258a02b------2</link>
            <guid isPermaLink="false">https://medium.com/p/ca04b0ba9fa2</guid>
            <category><![CDATA[arraylist]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[technology]]></category>
            <category><![CDATA[data-structures]]></category>
            <category><![CDATA[linked-lists]]></category>
            <dc:creator><![CDATA[Daniel Gospodinow]]></dc:creator>
            <pubDate>Thu, 26 Sep 2019 13:39:37 GMT</pubDate>
            <atom:updated>2019-10-02T06:56:01.555Z</atom:updated>
        </item>
        <item>
            <title><![CDATA[OSGi. What’s That?]]></title>
            <description><![CDATA[<div class="medium-feed-item"><p class="medium-feed-image"><a href="https://medium.com/swlh/osgi-whats-that-f15183822805?source=rss-50de0258a02b------2"><img src="https://cdn-images-1.medium.com/max/2600/0*SHLxeRR7Eay2aw04" width="4867"></a></p><p class="medium-feed-snippet">The Java specification that you probably haven&#x2019;t heard of</p><p class="medium-feed-link"><a href="https://medium.com/swlh/osgi-whats-that-f15183822805?source=rss-50de0258a02b------2">Continue reading on The Startup »</a></p></div>]]></description>
            <link>https://medium.com/swlh/osgi-whats-that-f15183822805?source=rss-50de0258a02b------2</link>
            <guid isPermaLink="false">https://medium.com/p/f15183822805</guid>
            <category><![CDATA[java]]></category>
            <category><![CDATA[plugins]]></category>
            <category><![CDATA[specifications]]></category>
            <category><![CDATA[modularity]]></category>
            <category><![CDATA[osgi]]></category>
            <dc:creator><![CDATA[Daniel Gospodinow]]></dc:creator>
            <pubDate>Mon, 12 Aug 2019 12:11:01 GMT</pubDate>
            <atom:updated>2020-05-29T17:11:51.790Z</atom:updated>
        </item>
        <item>
            <title><![CDATA[University. Why It’s Good for Software Engineers?]]></title>
            <description><![CDATA[<div class="medium-feed-item"><p class="medium-feed-image"><a href="https://medium.com/better-programming/university-why-its-good-for-software-engineers-12b0a2689a20?source=rss-50de0258a02b------2"><img src="https://cdn-images-1.medium.com/max/2600/0*_2dsaV8IJ3OlnE5L" width="5472"></a></p><p class="medium-feed-snippet">University pros and cons compared to other learning approaches</p><p class="medium-feed-link"><a href="https://medium.com/better-programming/university-why-its-good-for-software-engineers-12b0a2689a20?source=rss-50de0258a02b------2">Continue reading on Better Programming »</a></p></div>]]></description>
            <link>https://medium.com/better-programming/university-why-its-good-for-software-engineers-12b0a2689a20?source=rss-50de0258a02b------2</link>
            <guid isPermaLink="false">https://medium.com/p/12b0a2689a20</guid>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[computer-science]]></category>
            <category><![CDATA[university]]></category>
            <category><![CDATA[software-engineering]]></category>
            <category><![CDATA[education]]></category>
            <dc:creator><![CDATA[Daniel Gospodinow]]></dc:creator>
            <pubDate>Mon, 12 Aug 2019 00:53:29 GMT</pubDate>
            <atom:updated>2020-09-01T15:11:50.371Z</atom:updated>
        </item>
        <item>
            <title><![CDATA[Develop Your Own Background Manager]]></title>
            <link>https://medium.com/bitsrc/develop-your-own-background-manager-3b68f139e24e?source=rss-50de0258a02b------2</link>
            <guid isPermaLink="false">https://medium.com/p/3b68f139e24e</guid>
            <category><![CDATA[unsplash]]></category>
            <category><![CDATA[technology]]></category>
            <category><![CDATA[nodejs]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[web-development]]></category>
            <dc:creator><![CDATA[Daniel Gospodinow]]></dc:creator>
            <pubDate>Tue, 23 Jul 2019 15:14:31 GMT</pubDate>
            <atom:updated>2020-06-01T07:45:05.519Z</atom:updated>
            <content:encoded><![CDATA[<h4>Build a desktop background manager with Nodejs and Unsplash API</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*HhSLEEDqjQ24FzEX" /><figcaption>Photo by <a href="https://unsplash.com/@cristina_gottardi?utm_source=medium&amp;utm_medium=referral">Cristina Gottardi</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><h3>Overview</h3><p>Okay, so the idea is to build a simple cross-platform software utility that changes your desktop background image on a regular basis.</p><p>It would be nice if we have control over the size of images (e.g. <em>1920x1080</em>, etc) and the kind of images that are put on our desktop (e.g. <em>cats</em>, <em>dogs</em>, <em>nature</em>, <em>nice-looking girls</em>, etc). Further things that need to be considered are the configurable setup of the time interval over which the background wallpaper will be changed, the kind of strategy for image storage and image storage maintenance.</p><p>For image resources, we’ll use the <a href="https://unsplash.com/developers"><strong>Unsplash API</strong></a>,<strong> </strong>which is also used by our beloved <strong>Medium</strong>. This <strong>API </strong>is wonderful because it offers us an outstanding set of high-quality images that are free to use. Additionally, it has an intuitive and easy to use interface.</p><h3>Development</h3><p>Okay, so here’s the basic logic for our application — <em>“Download an image and store it in a folder which is properly maintained. Afterward, set the newly downloaded image as a desktop background. Repeat that on a regular schedule.”</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*bZ3Ik7BbO5Ve4lnV" /><figcaption>Planning @ Photo by <a href="https://unsplash.com/@kaleidico?utm_source=medium&amp;utm_medium=referral">Kaleidico</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>We’ll do it in five steps.</p><ol><li>Ensure storage folder existence.</li><li>Cleanup storage folder.</li><li>Download a new wallpaper.</li><li>Set it as a desktop background.</li><li>Repeat at a given interval.</li></ol><p>Yes, the order of the steps really matters!</p><h4>Ensure storage folder existence</h4><p>We’ll need to have a folder in which we’ll store our images.</p><p>Let’s make it happen with the help of the build-in <a href="https://nodejs.org/api/fs.html"><strong>fs</strong></a> module!</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/5eb6dd582f67e9d356adb1dcbbe8b449/href">https://medium.com/media/5eb6dd582f67e9d356adb1dcbbe8b449/href</a></iframe><p>We also need to ensure the folder’s existence in case someone deletes it without our acknowledgment. This can be done easily if we just run this function every time before executing one of the steps that follow up next.</p><h4>Cleanup storage folder</h4><p>In order to prevent too many disk usage, we will clean up some images when a certain folder capacity is reached.</p><p>The capacity limit should be somehow balanced in order to prevent the folder from taking too much space and to also make sure that if a user likes a certain desktop wallpaper he can go in that storage folder and save it for further use.</p><p>This task can also be accomplished with the help of the build-in <a href="https://nodejs.org/api/fs.html"><strong>fs</strong></a> module.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/6cb63e3ff605c03bbaccf9639c6ed28b/href">https://medium.com/media/6cb63e3ff605c03bbaccf9639c6ed28b/href</a></iframe><p>For example, a folder capacity of size 10 is kind of okay. This means that all the time there will be a maximum of 10<strong><em> </em></strong>images, so when an 11th image comes in for storage, one of the 10 will be removed in order to make space for the new one.</p><h4>Download a new wallpaper and set it as a desktop background</h4><p>So next, we need a mechanism for downloading images and setting them as desktop background wallpapers.</p><p>First, we need to get a link from which we can download a wallpaper.</p><p>Here the <strong>Unsplash API</strong> comes into play. We’ll use this <a href="https://source.unsplash.com/featured/$%7BimageResolution%7D?${imageCategories}"><strong>https://source.unsplash.com/featured/</strong></a> endpoint to collect new images from the <strong>Unsplash</strong> website.</p><p>With an <a href="https://www.tutorialspoint.com/http/http_methods"><strong>HTTP GET request</strong></a><strong> </strong>and the <a href="https://www.npmjs.com/package/node-fetch"><strong>fetch</strong></a> module for <strong>Nodejs</strong>, we’ll collect a new wallpaper URL from that endpoint.</p><p>Secondly, let’s search for a Nodejs image download mechanism in <strong>Google</strong>. After a quick “<em>nodejs donwload image</em>” search, we see that <strong>Google</strong> is judging us for the typing mistake that we’ve made. After fixing the error and searching again, we find the <a href="https://www.npmjs.com/package/image-downloader"><strong>Node Image Downloader</strong></a> module for downloading images from a given URL.</p><p>Okay, now that we have everything needed to change the desktop background, we can easily do it as it follows:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/13c3a11b5bff9cf74f7d1de234631ee5/href">https://medium.com/media/13c3a11b5bff9cf74f7d1de234631ee5/href</a></iframe><p>The <em>imageResolution</em> function parameter defines the wanted resolution of the image which the <strong>Unsplash API </strong>should return to us, whereas the <em>imageCategories </em>function parameter tells the <strong>API </strong>what kind of images to return to us.</p><p>The function is an <em>async</em> function in order to use the <a href="https://javascript.info/async-await"><strong>async/await mechanism</strong></a> for handling <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"><strong>JavaScript promises</strong></a>.</p><p>Okay, now that we’ve got this working, let’s move on.</p><h4>Repeat at a given interval</h4><p>Now the last thing that we need to do is to repeat the whole process over and over.</p><p>We have two mechanisms with which we can accomplish this:</p><ul><li>The <a href="https://nodejs.org/api/timers.html#timers_setinterval_callback_delay_args"><strong>setInterval()</strong></a> function.</li><li>The<strong> </strong><a href="https://www.npmjs.com/package/node-schedule"><strong>schedule</strong></a> module.</li></ul><p>We’ll use the latter approach because it provides wider functionality and the code looks more beautiful with it.</p><p>So at last, we just chain together, one after another, the three functions that take care of our app’s logic.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/03f235d7e3e6437eef90e40de695f681/href">https://medium.com/media/03f235d7e3e6437eef90e40de695f681/href</a></iframe><p>The first argument in the <a href="https://www.npmjs.com/package/node-schedule"><strong>scheduleJob()</strong></a><strong> </strong>function represents a <a href="https://en.wikipedia.org/wiki/Cron"><strong>cron</strong></a> expression, which basically defines the interval over which the function will be executed.</p><p>In our case, the <em>“0 * * * *” </em>cron expression instructs an execution of the function, provided as a second argument, at every round hour.</p><p>For this to work, we need to make sure the functions in the previous steps are made <em>async</em>.</p><h3>Final result</h3><p>The application is ready!</p><p>The only thing that’s left to be done is the merging of all the development parts together, but there’s no need for that because I’ll directly provide the source code for you down below and also at <a href="https://github.com/danielgospodinow/Screentopia"><strong>GitHub</strong></a>.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/b6362d3a82011ebce8059a3df9a034c1/href">https://medium.com/media/b6362d3a82011ebce8059a3df9a034c1/href</a></iframe><p>Note that in order to run the snippet above, you’ll need to be familiar with the process of running <strong>Nodejs</strong> applications. If you aren’t, just download the sources from <a href="https://github.com/danielgospodinow/Screentopia"><strong>GitHub</strong></a><strong> </strong>and follow <a href="https://stackoverflow.com/a/40090802"><strong>these</strong></a> instructions.</p><h3>Conclusion</h3><p>Here you go! You just found out how you can develop your own desktop background manager.</p><p>And yeah, <strong>Nodejs </strong>is a famous, wonderful, and powerful tool with which software applications are just a pleasure to make. I totally recommend checking it out if you still haven’t.</p><h3>Learn More</h3><ul><li><a href="https://blog.bitsrc.io/your-web-app-backend-is-not-an-api-lets-face-it-5b8d738458a6">Your Web App Backend is NOT an API. Let’s Face it!</a></li><li><a href="https://blog.bitsrc.io/how-we-successfully-share-and-reuse-code-between-microservices-at-scale-20fcfaebc6d0">How we Share and Reuse Code between Microservices with Bit</a></li><li><a href="https://blog.bitsrc.io/make-your-graphql-api-easier-to-adopt-through-components-d84810e75eea">Make your GraphQL API Easier To Adopt Through Components</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3b68f139e24e" width="1" height="1" alt=""><hr><p><a href="https://medium.com/bitsrc/develop-your-own-background-manager-3b68f139e24e">Develop Your Own Background Manager</a> was originally published in <a href="https://medium.com/bitsrc">Bits and Pieces</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Internet of Things. What’s That?]]></title>
            <description><![CDATA[<div class="medium-feed-item"><p class="medium-feed-image"><a href="https://medium.com/swlh/internet-of-things-whats-that-d3fb018aa7b8?source=rss-50de0258a02b------2"><img src="https://cdn-images-1.medium.com/max/2600/0*ZbTfwYKudLHpIreB" width="6720"></a></p><p class="medium-feed-snippet">A practical overview of the Internet of Things</p><p class="medium-feed-link"><a href="https://medium.com/swlh/internet-of-things-whats-that-d3fb018aa7b8?source=rss-50de0258a02b------2">Continue reading on The Startup »</a></p></div>]]></description>
            <link>https://medium.com/swlh/internet-of-things-whats-that-d3fb018aa7b8?source=rss-50de0258a02b------2</link>
            <guid isPermaLink="false">https://medium.com/p/d3fb018aa7b8</guid>
            <category><![CDATA[what-is-iot]]></category>
            <category><![CDATA[internet-of-things]]></category>
            <category><![CDATA[whats-internet-of-things]]></category>
            <category><![CDATA[iot]]></category>
            <category><![CDATA[iot-explained]]></category>
            <dc:creator><![CDATA[Daniel Gospodinow]]></dc:creator>
            <pubDate>Tue, 25 Jun 2019 09:06:01 GMT</pubDate>
            <atom:updated>2019-10-01T15:52:05.562Z</atom:updated>
        </item>
    </channel>
</rss>