<?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 Trishan Fernando on Medium]]></title>
        <description><![CDATA[Stories by Trishan Fernando on Medium]]></description>
        <link>https://medium.com/@trishan-fernando?source=rss-c716cd23d9db------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*SnJr8U1rPV6Z-Oak72SMew.jpeg</url>
            <title>Stories by Trishan Fernando on Medium</title>
            <link>https://medium.com/@trishan-fernando?source=rss-c716cd23d9db------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 22 Nov 2026 17:26:05 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@trishan-fernando/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[How Can You Edit Code Inside a “Video”?]]></title>
            <link>https://medium.com/linkit-intecs/how-can-you-edit-code-inside-a-video-4e9072a7c493?source=rss-c716cd23d9db------2</link>
            <guid isPermaLink="false">https://medium.com/p/4e9072a7c493</guid>
            <category><![CDATA[code]]></category>
            <category><![CDATA[python]]></category>
            <category><![CDATA[event-sourcing]]></category>
            <category><![CDATA[event-driven-architecture]]></category>
            <category><![CDATA[system-design-concepts]]></category>
            <dc:creator><![CDATA[Trishan Fernando]]></dc:creator>
            <pubDate>Mon, 24 Aug 2026 22:28:29 GMT</pubDate>
            <atom:updated>2026-08-31T06:08:29.760Z</atom:updated>
            <content:encoded><![CDATA[<h4>CODE THROUGH TIME</h4><h4>Event-based recording, state reconstruction, snapshots, and branching behind interactive coding playback</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*sA-EVU4JsfW-1ubOWTCoAA.png" /></figure><p>The first time I tried an interactive coding lesson, I assumed it was just another video tutorial with a code editor beside it.</p><p>The instructor was explaining the code while typing, deleting lines, moving between files, and running the program. Everything looked like a normal recorded tutorial. But then I clicked on the code just to see what would happen.</p><p>The cursor appeared inside the editor.</p><p>I changed one of the values, clicked Run, and the program executed my edited version instead of the instructor’s original code. That was the moment I got confused. If I was watching a video, how was I able to change the code inside it?</p><p>Because a normal video cannot do that. A screen recording only stores pixels. If the instructor types const score = 10, the recording does not store it as JavaScript that we can edit later. It stores an image of those characters inside a video frame. It may look like code, but technically, it is no longer code.</p><p>At first, I thought maybe the platform was placing a hidden editor on top of the video. But that still wouldn’t explain how the code changes stayed synchronized with the instructor’s voice, how we could move backward and forward through the lesson, or how the editor could return to the correct state at any point.</p><p>Then I realized I was probably using the wrong mental model. Maybe the editor was never recorded as a video in the first place.</p><p>Instead of recording what appeared on the screen, the platform could record what the instructor did inside the editor: inserting text, deleting text, moving the cursor, opening files, and running the code. During playback, those actions could be repeated inside a real code editor while the instructor’s audio plays alongside them.</p><p>That explanation led me to a much more interesting question: how would we design a recording system that plays like a video but still behaves like an actual code editor?</p><p>The exact implementation used by platforms such as Scrimba is not publicly available, so this article is not an explanation of their private internal architecture. Instead, we are going to explore one practical way such a system could be designed using event-based recording, state reconstruction, snapshots, and branching.</p><h3><strong>A Normal Video Is the Wrong Mental Model</strong></h3><pre>Screen → Pixels → Frames → Video</pre><p>That’s the pipeline behind every screen recording - Zoom calls, YouTube tutorials, all of it. It’s also exactly why none of it should be editable: once code becomes pixels, there’s no code left in there to edit.</p><p>So if interactivity is the goal, recording the screen itself is not enough.</p><p>What if we record what changed instead of recording what the screen looked like?</p><h3><strong>Record Operations, Not Pixels</strong></h3><p>Imagine starting with an empty editor and typing:</p><pre>const x = 10;</pre><p>Instead of saving thousands of visual frames, the system can record meaningful editor operations against a timeline:</p><pre>0 ms session started<br>1240 ms cursor moved<br>1730 ms text inserted: “const x = 10;”<br>4100 ms text deleted: “10”<br>4450 ms text inserted: “500”</pre><p>A simplified operation might look like this:</p><pre>{<br> “atMs”: 4450,<br> “type”: “TEXT_INSERTED”,<br> “offset”: 10,<br> “text”: “500”<br>}</pre><p>The important change is conceptual. The recording no longer says, ‘this is what the screen looked like at 4.45 seconds.’ It says, ‘this operation happened at 4.45 seconds.’</p><p>A real editor would usually expose richer change objects than these toy examples. It may report ranges, offsets, multiple edits in one transaction, undo metadata, file changes, selections, and more. But the central idea remains the same: preserve structured changes to state.</p><h3><strong>The Editor Is State</strong></h3><p>To replay operations, we need something for those operations to act on. That something is state.</p><p>For a tiny editor, state might be only the current text:</p><pre>state = {<br> content: “const x = 10;”<br>}</pre><p>A real coding environment may need considerably more:</p><pre>ProjectState<br> ├─ files<br> ├─ active file<br> ├─ file contents<br> ├─ cursor / selection<br> ├─ editor metadata<br> └─ possibly preview/output state</pre><p>Every recorded operation transforms one state into another. The whole replay engine can be summarized with one small rule:</p><pre>newState = applyEvent(oldState, event)</pre><p>If applyEvent is deterministic, then the same initial state plus the same ordered operations should always produce the same result.</p><p>That property is more important than it looks. Seeking, replaying, snapshotting, and branching all depend on being able to reconstruct state reliably.</p><h3><strong>Playback Is State Reconstruction</strong></h3><p>Suppose the recording contains five operations:</p><pre>E1 → E2 → E3 → E4 → E5</pre><p>Starting from the initial editor state, playback applies them in order as the playback clock advances:</p><pre>S0 — E1 → S1 — E2 → S2 — E3 → S3 — E4 → S4 — E5 → S5</pre><p>That means pressing Play does not have to mean decoding visual frames. It can mean moving a logical clock forward and applying every operation whose scheduled time has been reached.</p><pre>while playing:<br> now = playbackClock.currentTime() <br>while nextEvent.atMs &lt;= now:<br> state = applyEvent(state, nextEvent)<br> nextEvent++<br>render(state)</pre><p>The editor shown to the viewer can still be a real browser code editor. The playback engine is simply controlling its state.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*QHD2Kx3Be0TZl_nl8-V9hA.png" /></figure><h3><strong>The Voice Can Still Be Normal Audio</strong></h3><p>The instructor’s voice does not need the same treatment. Audio can remain an ordinary media stream while editor operations are replayed separately.</p><pre>Audio timeline<br>0 ───────────────────────────────── 20:00<br>Editor operations<br>   ↑     ↑     ↑    ↑      ↑<br> type select file delete insert</pre><p>Both systems share a timeline. At 12.4 seconds, the audio should be around 12.4 seconds and the editor should represent every operation that belongs before that point.</p><p>So the thing that feels like a video player can conceptually be closer to this:</p><pre>audio player<br> +<br>playback clock<br> +<br>event/operation log<br> +<br>real code editor</pre><h3><strong>Seeking Is Where It Gets More Interesting</strong></h3><p>Playing forward is only half the problem. Users expect to drag a timeline backward and forward instantly.</p><p>The simplest implementation of seek is brutally straightforward: reset to the initial state and replay every operation up to the requested time.</p><pre>seek(12:37)<br> ↓<br>reset to initial state<br> ↓<br>replay E1, E2, E3 …<br> ↓<br>stop when event time &gt; 12:37</pre><p>For short sessions that may be perfectly fine. But the cost grows with the number of operations. A long recording can contain tens of thousands of changes, and rebuilding from zero for every scrub of the timeline becomes wasteful.</p><h3><strong>Snapshots Turn Replay Into a Practical Seek System</strong></h3><p>A common answer is to introduce checkpoints, usually called snapshots.</p><pre>00:00 [Initial State]<br> ↓ events<br>05:00 [Snapshot A]<br> ↓ events<br>10:00 [Snapshot B]<br> ↓ events<br>15:00 [Snapshot C]</pre><p>If the viewer jumps to 12:37, the system can load the latest valid snapshot before that time, then replay only the operations between the snapshot and the target.</p><pre>Snapshot B @ 10:00<br> +<br>operations from 10:00 → 12:37<br> ↓<br>state at 12:37</pre><p>The distinction matters: the event history explains how the state evolved; the snapshot is only a shortcut for reconstruction. If a snapshot disappears, the state should still be reproducible from an earlier checkpoint or the initial state.</p><p><strong>Why Editing the “Video” Is Not the Hardest Part</strong></p><p>Once playback is happening inside a real code editor, allowing the viewer to edit that code is surprisingly ordinary. Pause the replay, stop applying recorded operations, and let the editor behave like an editor again.</p><p>The difficult question is what happens to history after the viewer changes something.</p><p>Suppose the original recording is:</p><pre>A → B → C → D → E</pre><p>The viewer pauses at C and starts editing. If those edits simply overwrite the original state, continuing the lesson becomes ambiguous. The original future expected state D, but the learner now has something else.</p><p>A cleaner model is to branch the timeline.</p><h3><strong>Branching the Timeline</strong></h3><pre>original: A → B → C → D → E<br>                   \<br>learner:            X → Y → Z</pre><p>The original history remains unchanged. The learner’s branch records only the operations that happened after the fork.</p><p>Branch metadata can be surprisingly small:</p><pre>branchId: learner-1<br>parentBranch: original<br>forkAfterSequence: 381<br>forkAtMs: 124000</pre><p>Reconstructing the learner branch means reproducing the parent history only up to the fork, then applying the learner’s operations.</p><pre>parent events ≤ fork point<br> +<br>learner branch events<br> ↓<br>learner state</pre><p>This looks a little like Git because both systems model histories that diverge from a known point. That does not mean Git must be involved internally. The shared concept is branching history, not necessarily the implementation.</p><h3><strong>Timestamps Are Not Enough</strong></h3><p>There is another subtle problem hiding in the event log: time and order are not always the same thing.</p><p>Suppose two operations both have a timestamp of 4200 ms. Which one should be applied first?</p><p>If one inserts text and another deletes a nearby range, reversing them might produce a completely different document.</p><p>A robust event usually needs an authoritative sequence in addition to playback time:</p><pre>{<br> “sequence”: 143,<br> “atMs”: 4200,<br> “type”: “TEXT_INSERTED”,<br> “payload”: { … }<br>}</pre><pre>atMs → when it should appear during playback<br>sequence → the exact order it must be applied</pre><p>That small distinction becomes essential once current state is derived from history. One missing, duplicated, or incorrectly ordered operation can corrupt every state that follows it.</p><h3><strong>This Starts to Resemble Event Sourcing</strong></h3><p>At this point the architecture has a familiar shape:</p><pre>initial state<br> +<br>ordered history of events<br> ↓<br>current state</pre><p>That is close to the mental model used in event sourcing.</p><p>Consider a bank account. A conventional system might store only the current balance:</p><pre>balance = 8000</pre><p>An event-sourced model might preserve the events that produced it:</p><pre>AccountCreated<br>MoneyDeposited(5000)<br>MoneyDeposited(5000)<br>MoneyWithdrawn(2000)</pre><p>Replay those events and the balance can be reconstructed.</p><p>Now compare that with an editor history:</p><pre>FileCreated<br>TextInserted<br>TextDeleted<br>FileSelected<br>TextInserted</pre><p>The resemblance is obvious: both preserve changes and derive state from them.</p><p>But it is worth being careful with the terminology. An interactive editor replay system is not automatically a textbook event-sourced application. Event sourcing is a broader architectural choice about what data is authoritative and how domain state is persisted. Replay systems can borrow the same ideas without sharing every event-sourcing constraint or trade-off.</p><h3><strong>A Simplified Architecture</strong></h3><p>Putting the pieces together, one possible architecture looks like this:</p><pre>                 ┌──────── Audio ────────┐<br>                 │                       │<br>Real Editor → Recorder → Event Log       │<br>     ↑           │         │             │<br>     │           │         ├→ Snapshots  │<br>     │           │         └→ Branches   │<br>     │           │                       │<br>     └──── Playback Engine ← Timeline ───┘</pre><p>During recording, the editor emits structured changes and the recorder timestamps them. During playback, a clock advances through the event stream and reconstructs editor state. Seeking can start from snapshots. Editing can fork the history into a branch. Audio runs alongside the same timeline.</p><p>The pieces themselves are not especially exotic. The cleverness comes from composing them into an interaction that feels as simple as watching a video.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*oAGt7guC9dJckHKEFCTk6Q.png" /></figure><h3><strong>There Are Still Hard Problems</strong></h3><p>The simplified design hides plenty of engineering details that become important in a production system.</p><p>Take schema evolution. Every event has a shape, a type, a set of fields, an implicit contract with whatever reads it. A recording made two years ago was written against whatever event shape the recorder used at the time. If the player has since evolved; a field renamed, a new operation type added, an old one split into two. That old recording doesn’t automatically still make sense to it. And unlike a video file, where a codec either decodes or it doesn’t, an event log can decode successfully and still reconstruct the <em>wrong</em> state, silently. Persisted events tend to outlive the code that produced them, so the player has to keep understanding shapes it may no longer emit - versioning them, migrating them, or writing adapters for the old ones.</p><p>The rest of the hard problems mostly cluster around one question: what counts as an event in the first place? Recording every keystroke is noisy and device-dependent; recording the whole file after every edit wastes space; cursor movement, selections, scrolling, terminal output, and undo/redo all raise the same judgment call - essential to the lesson, or just noise around the resulting code? Execution is its own separate problem: HTML, CSS, and JavaScript can run safely in a restricted browser sandbox, but arbitrary server-side languages need real isolation, resource limits, and security controls.</p><h3><strong>The Bigger Idea: Record Change, Not Appearance</strong></h3><p>The most interesting part of this design is not really coding tutorials. It is the choice of representation.</p><p>Sometimes the useful thing to preserve is not what a system looked like, but how it changed.</p><p>A video preserves appearance. An event log preserves transitions.</p><p>Once transitions are preserved, other capabilities become possible: replaying history, inspecting it, rebuilding old states, jumping through time, branching from a historical state, or producing different derived views from the same history.</p><p>That is why similar ideas show up in systems that otherwise look unrelated: source-control histories, event-sourced applications, audit logs, game replays, time-travel debuggers, collaborative editors, and database logs.</p><p>They are not all the same technology. But many of them ask a similar question:</p><p>If I know what happened, can I reconstruct what existed?</p><h3><strong>So Is It Really a Video?</strong></h3><p>From the user’s perspective, calling the experience a video is perfectly reasonable. There is a play button, a timeline, a voice, and something happening on screen over time.</p><p>Technically, though, the more useful mental model is different:</p><pre>audio<br>+<br>playback timeline<br>+<br>structured editor operations<br>+<br>state reconstruction<br>+<br>a real editable code environment</pre><p>Go back to that moment from the start of this piece, three minutes into a lesson, clicking into someone else’s code and hitting run. It felt like editing a video. But with an architecture like this, there doesn’t need to be a frozen frame under your cursor at all — just a history of what happened, structured well enough to reconstruct the code and let you continue from there.2</p><p>That’s the trick. Not magic. Just a system that refused to flatten a program’s history into pixels when it could keep it as data instead.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4e9072a7c493" width="1" height="1" alt=""><hr><p><a href="https://medium.com/linkit-intecs/how-can-you-edit-code-inside-a-video-4e9072a7c493">How Can You Edit Code Inside a “Video”?</a> was originally published in <a href="https://medium.com/linkit-intecs">LinkIT</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Why Modern Applications Use JWT Instead of Sessions]]></title>
            <link>https://blog.stackademic.com/why-modern-applications-use-jwt-instead-of-sessions-9369d938ec88?source=rss-c716cd23d9db------2</link>
            <guid isPermaLink="false">https://medium.com/p/9369d938ec88</guid>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[backend-development]]></category>
            <category><![CDATA[software-engineering]]></category>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[security]]></category>
            <dc:creator><![CDATA[Trishan Fernando]]></dc:creator>
            <pubDate>Fri, 29 May 2026 12:31:20 GMT</pubDate>
            <atom:updated>2026-06-01T06:58:21.203Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*DfbCSie9JEMsu8RLo0bSyA.png" /></figure><h4><strong>BACKEND FUNDAMENTALS</strong></h4><h4>Most developers use JWTs long before they understand them. Let’s fix that.</h4><h3>Introduction</h3><p>You have built a good working frontend application, setup a working database and all are done and now it ready to publish but then you hit the wall of User Login.</p><p>Suddenly, you are drowning in a sea of acronyms and security concepts. Sessions, cookies, OAuth, stateless APIs, and the most common buzzword of them all is <strong>JWT</strong> (JSON Web Token).</p><p>So, what do you do? You go to Stack Overflow, find some JWT code block, and copy-paste it directly. Or you ask an LLM to generate something and drop it in without really reading it and you don’t even know what actually happens under the hood. Or maybe you’re already using JWT but only because a senior dev told you to, and now you have a template you blindly copy into every new project that needs auth.</p><p>Isn’t it?<br>If yes, this article is for you. No magic. By the end, you’ll have a mental model solid enough that when you do write the implementation, nothing will feel like magic.</p><h3>The Big Distinction: Authentication vs. Authorization</h3><p>Before touching JWT specifically, you need to have proper idea of the two words straight. Because they get mixed up constantly, even by developers who’ve been shipping code for years.</p><p><strong>Authentication</strong> is <em>who you are</em>. It’s the process of verifying identity. When you enter your username and password, the system is authenticating you by confirming that you are who you claim to be.</p><p><strong>Authorization</strong> is <em>what you’re allowed to do</em>. Once the system knows who you are, authorization decides your permissions. Can you read this resource? Delete that record? Access the admin panel?</p><p>Think of it this way: authentication is showing your ID at the door. Authorization is the bouncer checking whether your name is on the VIP list.</p><p>JWT plays a role in both. But understanding the distinction matters, because confusing the two leads to security holes. Authentication answers “is this person real?” Authorization answers “does this person have access?”</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-MmsidLCZd-QC-L9olvWnA.png" /></figure><h3>The Hotel Keycard Analogy</h3><p>Let’s take a simple analogy that makes the JWT flow click intuitively.</p><p>Imagine you just arrived at a hotel. You walk up to the front desk and say <em>“Hi, I have a reservation under John Doe.”</em></p><p>The receptionist doesn’t just give you a room key. First, they ask your ID or Passport or Driver’s license and then after they verified you are the actually John Doe they will give you the keycard and this is the basically the <strong>Authentication (AuthN)</strong> which answers the <em>“Who are you?”</em> in a system.</p><p>After you got that keycard, with this keycard in hand, you walk over to the VIP lounge. You swipe the card, the light turns green, and the doors open.</p><p>Notice what <em>didn’t</em> happen at the VIP lounge: The door didn’t ask for your name. It didn’t ask for your passport. It didn’t even call down to the front desk to ask the receptionist if you were allowed inside and that is the <strong>Authorization (AuthZ) </strong>which answers the <em>“What are you allowed to do?”</em></p><p>That keycard is a JWT.<br>JWT (JSON Web Token) is simply a digital keycard given to the user after they successfully log in. For the rest of their session, they don’t need to verify their identity again and again. Instead, they just present their JWT with each request and the server reads it.<br>What makes this so powerful is that the JWT already contains the user’s identity and permissions. That means the server doesn’t have to check the database on every request to verify who the user is or what they’re allowed to do. The token itself acts as proof.</p><h3>How Traditional Sessions Work - And Why They Break Down</h3><p>First we need to get a brief idea why we moved into JWT. <br>With traditional session-based authentication, When user logs in:</p><ul><li>User sends username/password.</li><li>Server validates credentials.</li><li>Server creates a session object in the memory or database.</li><li>Server generates a random session ID.</li><li>Session ID is stored in the browser as a cookie.</li><li>Browser sends that cookie with every request.</li><li>Server looks up the session ID and finds the logged-in user.</li></ul><p>This works fine, but this model is stateful. That means the server needs to remember who you are, and that information must be available every time you send a request. To do that, the server has to store session data somewhere, usually in memory, Redis, or a database.</p><p>For a small application with a few users, this isn’t a problem. But imagine an application with millions of users. The server now has to maintain session information for every active user, which increases storage requirements and infrastructure complexity.</p><p>Things become even more challenging when the application starts scaling across multiple servers behind a load balancer. If Server A creates your session but your next request is routed to Server B, Server B has no idea who you are unless all servers share the same session store. This often requires additional components such as Redis or a centralized database, introducing extra complexity and potential bottlenecks.</p><p>On top of that, every authenticated request typically requires looking up session information before the server can identify the user. At large scale, these lookups add unnecessary overhead.</p><p>This is the problem JWT was designed to solve. Instead of the server remembering every user, the user carries proof of their identity in the form of a signed token. The server no longer needs to store or retrieve session data for every request. It simply verifies the token and trusts the information inside it. This shifts authentication from a stateful model to a stateless one, making it easier to build scalable modern applications and APIs.</p><h3>Anatomy of a JWT</h3><p>A JWT is a string. If you’ve seen one, it looks like three chunks of characters separated by dots:</p><pre>eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VySWQiOjQyLCJyb2xlIjoiYWRtaW4iLCJpYXQiOjE2MjAwMDAwMDAsImV4cCI6MTYyMDAwMzYwMH0.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c</pre><p>Three parts, separated by . -each one serving a distinct purpose.</p><ol><li><strong>Header</strong></li></ol><p>The first part is the header. Decoded, it’s a small JSON object that describes the token itself .Specifically, what signing algorithm was used. Something like:</p><pre>{<br>  &quot;alg&quot;: &quot;HS256&quot;,<br>  &quot;typ&quot;: &quot;JWT&quot;<br>}</pre><p>HS256 means HMAC with SHA-256 — a symmetric signing algorithm. You&#39;ll also see RS256 (RSA, asymmetric) in production systems. The header tells the server how to verify the token&#39;s signature.</p><p><strong>2. Payload</strong></p><p>The second part is the payload - the actual data. This is where the useful information lives: who the user is, what their role is, when the token was issued, when it expires. These fields are called <strong>claims</strong>.</p><pre>{<br>  &quot;userId&quot;: 42,<br>  &quot;role&quot;: &quot;admin&quot;,<br>  &quot;iat&quot;: 1620000000,<br>  &quot;exp&quot;: 1620003600<br>}</pre><p>iat is &quot;issued at.&quot; exp is &quot;expires at.&quot; Both are Unix timestamps.</p><p>Here’s the most important thing to understand about the payload, and the thing developers most frequently get wrong: <strong>the payload is encoded, not encrypted.</strong> Base64URL encoding is not security. It’s just a way to represent binary data as text. Anyone who gets their hands on your JWT can decode the payload and read everything in it. Paste any JWT into <a href="https://jwt.io/">jwt.io</a> and you’ll see this immediately.</p><p>This means you should never put sensitive information in a JWT payload. No passwords, no credit card numbers, nothing you wouldn’t want readable.</p><p><strong>3. Signature</strong></p><p>The third part is the signature, and this is what makes JWT trustworthy.</p><p>The signature is generated by taking the encoded header, the encoded payload, combining them, and running them through the signing algorithm using a secret key that only the server knows:</p><pre>HMACSHA256(<br>  base64UrlEncode(header) + &quot;.&quot; + base64UrlEncode(payload),<br>  secret<br>)</pre><p>When the server receives a JWT, it re-runs this process using its own secret key and compares the result to the signature on the token. If they match, the token is valid and untampered. If even a single character in the payload was changed, the signature won’t match, and the token gets rejected.</p><p>This is the core guarantee of JWT: the server doesn’t need to store anything. It just verifies the math.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*fVHR7WqoU9Xw86_pY53CXA.png" /></figure><h3>The Pros and Cons</h3><p>JWT isn’t perfect. It’s a tool that fits certain problems well and fits others poorly. You should know both sides.</p><p><strong>Pros</strong></p><p><em>Stateless scalability.</em> Since the server doesn’t store session state, any server in your cluster can verify any token. No shared session store needed. This is JWT’s strongest argument in distributed or microservice architectures.</p><p><em>Self-contained.</em> The token carries its own data. The token can carry information such as the user’s ID, role, and claims, reducing the need for database lookups on every request.</p><p><em>Cross-domain flexibility.</em> Cookies have domain restrictions. Tokens sent in HTTP headers don’t. This makes JWT a natural fit for APIs consumed by mobile apps, third-party clients, or separate frontend domains.</p><p><strong>Cons</strong></p><p><em>The logout problem.</em> This is JWT’s most uncomfortable weakness. Because the server does not maintain a record of every issued token, it cannot automatically invalidate a specific token before it expires. If a user logs out, you can delete the token from the client, but if someone else already has a copy of that token, it’s valid until expiry. Mitigation strategies exist (token blocklists, short expiry + refresh tokens), but none are as clean as just deleting a session.</p><p><em>Payload size.</em> A session cookie is just an ID; maybe 20–30 bytes. A JWT carrying user data and claims can easily hit a few hundred bytes, and it travels with every single request. In high-frequency API environments, this overhead adds up.</p><p><em>No built-in revocation.</em> Related to logout there’s no standard mechanism to say, “this specific token is no longer valid.” You have to build that yourself if you need it.</p><h3>Conclusion</h3><p>JWT isn’t complicated once you strip away the jargon. It’s a token, a signed, self-contained piece of data that lets a server verify who you are without having to remember you. The three parts each have a job: the header describes the algorithm, the payload carries the data, and the signature guarantees integrity.</p><p>The key mental shift is stateful vs. stateless authentication. Sessions require the server to remember who you are, while JWTs allow you to carry proof of your identity with every request. That tradeoff is what gives JWT its scalability benefits, but it also introduces challenges such as token revocation and logout handling. Understanding this tradeoff is far more important than memorizing JWT syntax or libraries</p><p>The next time you see a JWT in an Authorization header, you’ll know that it’s not magic. It’s simply a signed piece of data that allows a server to trust the information it receives without having to store session state.</p><p>Now that the theory is solid, Part 2 is where we open VS Code, write the actual implementation in Node.js and Express, and see exactly how a token gets created, signed, sent, and verified step by step. Stay tuned to dive into the full implementation next.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9369d938ec88" width="1" height="1" alt=""><hr><p><a href="https://blog.stackademic.com/why-modern-applications-use-jwt-instead-of-sessions-9369d938ec88">Why Modern Applications Use JWT Instead of Sessions</a> was originally published in <a href="https://blog.stackademic.com/">Stackademic</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[I Thought print() Was Enough. I Was Wrong.]]></title>
            <link>https://blog.stackademic.com/i-thought-print-was-enough-i-was-wrong-66a90e987e36?source=rss-c716cd23d9db------2</link>
            <guid isPermaLink="false">https://medium.com/p/66a90e987e36</guid>
            <category><![CDATA[learning]]></category>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[education]]></category>
            <category><![CDATA[python]]></category>
            <category><![CDATA[python-programming]]></category>
            <dc:creator><![CDATA[Trishan Fernando]]></dc:creator>
            <pubDate>Thu, 09 Apr 2026 09:50:25 GMT</pubDate>
            <atom:updated>2026-04-15T08:20:18.957Z</atom:updated>
            <content:encoded><![CDATA[<h4>Python Debugging</h4><h4>What changed when my code stopped being simple</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*QowBKJENMM8mOKQrDN7_YQ.png" /></figure><p>If you’ve ever worked with Python, you’ve definitely hit that moment, your code got unexpected error or worse, nothing happens at all. No output, No Crash, No error, just silence.</p><p>Then what you are doing is before anything, you are just adding few of print(&quot;function done&quot;)to check functions are working of print(&quot;value of x: &quot;, x) to check variables or something like that. don’t say you haven’t done this at least once. I also did this and I kept using print() much longer than I should have, because it just works. No setup, no imports, no docs to read. Just print and move on and it was totally okay for a while but then I realized this is not gonna work for everywhere.</p><p>When I am working with the larger projects, I faced the real issue. Up to here, print()was annoying sometimes but it was manageable. but then when my code grows, multiple thread running, multiple requests sending requests and getting responses and then with my print() functions my terminal got messy. For example look at the below code block; we most probably write like this one</p><pre>import requests<br><br>def fetch_user(user_id):<br>    print(f&quot;fetching user {user_id}&quot;)<br>    response = requests.get(f&quot;jsonplaceholder.typicode.com/users/{user_id}&quot;)<br><br>    if response.status_code != 200:<br>        print(&quot;something went wrong&quot;)<br>        return None<br><br>    print(&quot;got response&quot;)<br>    return response.json()<br><br>def process_users(user_ids):<br>    print(&quot;starting...&quot;)<br>    for uid in user_ids:<br>        data = fetch_user(uid)<br>        if data:<br>            print(&quot;processing&quot;, uid)<br>            # do stuff<br><br>process_users([1, 2, 1263, 4, 5])</pre><p>You will see an output like below with</p><pre>starting...<br>fetching user 1<br>got response<br>processing 1<br>fetching user 2<br>something went wrong<br>fetching user 3<br>got response<br>processing 3<br>fetching user 4<br>got response<br>processing 4<br>fetching user 5<br>something went wrong</pre><p>At first, the problem just looks like formatting. When you use print(), your output is just plain text, so if you want timestamps, labels, or any kind of structure, you have to add them manually every single time to keep it consistent. Then you might think, “What if I create a custom function for this?” So, you write a little helper. def log(msg): print(f&quot;[INFO] {msg}&quot;). It feels clever. And then you need levels, so you add a parameter. Then you need file output. Then filters. Then you realize you’ve spent two hours building something that already exists, formatting and then suddenly you realize you’re reinventing the wheel. That wheel, of course, is Python’s <strong>logging </strong>module.</p><p>So, I just opened the logging module’s docs and at first, it felt like this is more complicated than print() . Loggers, formatters, levels etc… It was like why this much thing to print a few words with time stamps. But when you got it, you’ll definitely realize there is no big thing and the whole module is based on 4 main moving parts and it is very simple.</p><p>Think this logging module as an office team. Logger is the man who shouts the message. Every time something happens in your code; a function runs, a request fails, a value looks off. The logger is the one raising their hand and saying “hey, something happened here.”<br>The Level is how loud they’re shouting. Is this just a quiet heads-up? That’s DEBUG. Something the team should know? then INFO. Something that might be a problem? it’s a WARNING. Actually broken? ERROR. Everything on fire? CRITICAL, and <br>The Handler decides who’s listening. Should this message go to the terminal? To a file? Both? The handler routes it.<br>The Formatter is how the message is written down. Is it just the text? Does it include the time, the severity, which file it came from?<br>That’s it. That’s the whole module in few lines.</p><p>In code here is the minimum setup.</p><pre>import logging<br><br>logging.basicConfig(<br>    level=logging.DEBUG,<br>    format=&quot;%(asctime)s  %(levelname)-8s  %(message)s&quot;,<br>    datefmt=&quot;%H:%M:%S&quot;<br>)<br><br>logger = logging.getLogger(__name__)<br></pre><p>That __name__ part tells the logger which module it belongs to. When your project grows across multiple files, each file gets its own logger with its own name, so when something breaks you know exactly which file the message came from. Not just “something went wrong” but “something went wrong in fetch_user in users.py at 10:42.”</p><p>5 lines first and then you don’t need to use print(&quot;Something happened&quot;) and you can use logger.info(&quot;Something happened&quot;) and you will get an output like this</p><pre>10:42:01  INFO      something happened</pre><p>Timestamp. Level. Message. No manual formatting. No custom helper functions. Already better than anything print() was giving you.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*f0fPteVZavkTaMIQHs27FA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*nM5cEwB0Ht4t-3bkd4PmvQ.png" /></figure><p>this is not just about better formatting it is also about the control.</p><p>Let’s say you’ve got a script that works. Time to push it. And then you remember that there are print() statements everywhere. Some are printing variable values. Some are printing internal state. Maybe one is accidentally printing something a user shouldn&#39;t see. So you go hunting. Ctrl+F, print(). Delete. Scroll. Delete. Repeat. And you <em>will</em> miss one. or delete something that you shouldn’t. Everyone does.</p><p>With logging, none of that exists. You just change one line.</p><p>In development:</p><pre>logging.basicConfig(level=logging.DEBUG)</pre><p>In Production,</p><pre>logging.basicConfig(level=logging.WARNING)</pre><p>And now, every DEBUG and INFO message goes silent automatically. Same code. Nothing deleted. Nothing missed. In production you don’t want DEBUG messages because they’re noisy, they can expose internal logic, and on a busy server they’ll flood your log files fast. One line change handles all of that.</p><p>These Levels work like a filter threshold. If you set WARNING, you&#39;ll only see WARNING, ERROR, and CRITICAL. Everything below that is silenced.</p><p>So no, print() isn’t wrong. It got us here, and it’ll still have its place for quick one-off checks. But it was never built for what we’re asking it to do in real projects.<br>The logging module exists exactly for this. And as you’ve seen, the basic setup is five lines. That’s it. You’re already most of the way there.<br>There’s a lot more to explore beyond what we covered here; file handlers, custom log levels, logging across multiple modules. But that’s for another day. For now, the docs are linked below if you want to go deeper.<br>Next time your terminal is a mess and you’re staring at a wall of prints then you’ll know what to reach for.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=66a90e987e36" width="1" height="1" alt=""><hr><p><a href="https://blog.stackademic.com/i-thought-print-was-enough-i-was-wrong-66a90e987e36">I Thought print() Was Enough. I Was Wrong.</a> was originally published in <a href="https://blog.stackademic.com/">Stackademic</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The Google Tools Nobody Taught You in University (But You Should Know)]]></title>
            <link>https://medium.com/linkit-intecs/the-google-tools-nobody-taught-you-in-university-but-you-should-know-7a59e5bb775d?source=rss-c716cd23d9db------2</link>
            <guid isPermaLink="false">https://medium.com/p/7a59e5bb775d</guid>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[google]]></category>
            <category><![CDATA[education]]></category>
            <category><![CDATA[ai-tools]]></category>
            <category><![CDATA[ai]]></category>
            <dc:creator><![CDATA[Trishan Fernando]]></dc:creator>
            <pubDate>Thu, 15 Jan 2026 12:08:11 GMT</pubDate>
            <atom:updated>2026-01-23T03:22:36.593Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*dVB3lb5lLu42vii_VxqS1g.png" /><figcaption>AI-Generated Image</figcaption></figure><h4>Early Access</h4><h4>These tools aren’t in your syllabus. But they probably should be.</h4><p>Universities teach us algorithms, programming languages, and design principles and we definitely need those fundamentals. But they rarely talk about the modern tools that are actually used in the industry, or what is really happening inside it.<br>While many of us stay stuck in classical workflows, Google is experimenting in public with a new generation of tools that help people learn faster, build smarter, and create with less friction. Most students don’t even know they exist.<br>Some students are already gaining a real advantage by using them.</p><blockquote>The question is , which group are you in?</blockquote><p>So, let’s look at those tools and get a brief idea about each tool; what they do, who they’re for.</p><h3>1. NotebookLM - Your AI Study Partner</h3><p>What is NotebookLM?</p><blockquote>NotebookLM is an AI-powered research assistant designed to help you refine and organize your ideas.</blockquote><p>Simply, we can say it is an AI-first note-taking and learning assistant.</p><p>You can upload your own resources like PDFs, articles, notes ,or even search Google and turn those resources into a notebook. Then you can ask questions from the sources.</p><p>NotebookLM can generate</p><ul><li>Quizzes</li><li>Flashcards</li><li>Mind Maps</li><li>Reports</li><li>Audio/Video Overviews</li><li>Infographics (New)</li><li>Slides (New)</li></ul><p>Honestly, this tool has come a very long way since its first public release.</p><p><strong>Why should we care about this ?</strong></p><p>for students, Instead of passively reading notes, highlighting all over the books, you can interact with your notes, question them, understand concepts faster. You really feel the difference when you use it.</p><p><strong>How would I use this ?</strong></p><p>During reading weeks, my go-to study buddy is NotebookLM. I use it for lecture notes, understanding concepts, exam preparation, check my knowledge and doing more in a very limited time.</p><p><a href="https://notebooklm.google.com/">NotebookLM</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*o0enfg9OvvKZK_UqMWBY3g.png" /></figure><h3><strong>2. Code Wiki - The Living Tech Spec</strong></h3><p>What is Code Wiki ?</p><blockquote>Code Wiki is a platform that maintains a continuously updated, structured wiki for code repositories.</blockquote><p>If you have ever worked on a real-world project or an open-source project, you already know the most painful part. It is nothing but reading the legacy code.</p><blockquote>Reading existing code is the one of the biggest, most expensive bottlenecks in software development. - Google Developer’s Blog</blockquote><p>Code Wiki tries to solve this problem.</p><ul><li>Updates documentation after every commit, so it is always up to date</li><li>Generates live diagrams</li></ul><p>You can use Gemini Chat to understand the whole repository and explain things with direct links to the code. This tool is great for understanding a project’s architecture, design patterns and overall structure without wasting weeks.</p><p>The most interesting part is how it can visualize complex codebases using diagrams. That can save lot of time. But this is an experimental tool. So there can be mistakes, wrong explanations, and limitations. You should use it as an assistant, not as a replacement for your own understanding.</p><p>But if you have ever struggled with legacy code for weeks, you should definitely Code Wiki a try.</p><p>Currently, Code Wiki only supports popular public repositories. But Google has already mentioned that they will extend the public repositories and private repository support is coming in the future.</p><p>Try <a href="https://codewiki.google/">Code Wiki</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Yrh4QbyZwIutsZX8ywRCwg.png" /></figure><h3>3. Antigravity - The Autonomous Developer</h3><p>What is Antigravity ?</p><blockquote><strong>Google Antigravity</strong>, a new <strong>agentic development platform</strong> designed to help you work at a higher, task-oriented level.</blockquote><p><strong>The Pain Point:</strong> “It’s 2 AM. You’re stuck on a bug that ‘should be simple.’ Your database integration isn’t working. Stack Overflow has 47 tabs open. Your group project is due in 6 hours. You know what needs to happen, you just don’t know how to make it happen.”</p><p><strong>What Antigravity Actually Does:</strong> Think of it as pair programming with a senior developer who never gets tired. But instead of just suggesting code, Antigravity:</p><ul><li>Breaks down your task into clear steps</li><li>Actually executes and tests code</li><li>Shows you screenshots and recordings of what it’s doing</li><li>Creates artifacts you can inspect and verify</li><li>Operates across your editor, terminal, and browser</li></ul><p>Regular Coding assistants give you suggestions, autocomplete. Antigravity gives you a roadmap and does the work while showing it process.</p><p>You understand an algorithm conceptually but can’t implement it? Antigravity helps. Database integration breaking your project? It can debug and fix it. Got a brilliant idea but don’t know where to start? It’ll show you the path forward, step by step.</p><p>This tool is powerful, but it’s not perfect. There are performance issues and occasional misunderstandings and can make mistakes. So be the driver, not the passenger. Review what it does. Understand the decisions it makes, and learn from the process.</p><p>Don’t let AI replace your learning. Use it to accelerate it.</p><p><a href="https://antigravity.google/download">Antigravity</a> (Available for Windows/Mac OS / Linux)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*evC6OstzmCC2_UrHFQnwFg.png" /></figure><h3>4. Stitch - The Prompt-to-Product Designer</h3><p>What is Stitch ?</p><blockquote>AI-powered UI/UX design tool that generates mobile and web interfaces from text prompts or images</blockquote><p>“You have a brilliant app idea for your capstone project. You need to show an MVP for submission, but you are struggling with figma and can’t even make at least the landing page. By the time you have something presentable, you’ve lost momentum on the actual logic.”</p><p><strong>What Stitch Does:</strong></p><ul><li>Describe your UI in plain English or upload a sketch</li><li>Generates complete UI designs for web/mobile</li><li>Exports directly to Figma for refinement (only in fast mode)</li><li>Provides production-ready HTML/CSS code</li><li>New feature: connect screens into working prototypes</li></ul><p>Working on your capstone project or making a UI for a competition with strict deadlines? Describe your app in Stitch. Get a working prototype in minutes. Export to Figma to add your personal touch, or grab the code and start building the backend logic immediately.</p><p>It’s experimental. Designs can be generic. Think of it as your UI intern, great for first drafts, but you’ll want to refine the output.</p><p><a href="https://stitch.withgoogle.com/">Stitch</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rBP8mKBW3Z3OPBTxyQ0MPg.png" /></figure><h3>5. Flow - The Cinematic Storyteller</h3><p>What is Flow ?</p><blockquote>Google Flow is an AI-powered filmmaking tool that helps creators generate cinematic video clips, scenes, and stories from text prompts or existing images</blockquote><p>Need a customized animation video for your presentation ? Need a demo video for your project ? Need a short cinematic story for an idea in your head, but you don’t know animation or video editing?</p><p>That’s where Flow becomes your friend.</p><p>Flow doesn’t just generate random video clips. It focuses on storytelling.</p><p>Google Flow :</p><ul><li>Generate scenes from text prompts</li><li>Use images as starting points</li><li>Create smooth transitions between scenes</li><li>Build complete video narratives, not just isolated clips</li></ul><p>Flow Uses Google’s Veo model for realistic motion and physics.</p><p>This requires a Google AI Pro subscription (not free like most others).But students can get AI Pro subscription for free for their university ID.</p><p><a href="https://labs.google/flow/about">Flow</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Ph-2E4yOhCRUYU_IHabmZQ.png" /></figure><h3>Beyond the Essentials: Two More to Explore</h3><p>If you’ve made it this far and want to dive deeper, here are two more experimental tools worth knowing about:</p><h4>6. Opal - The Instant App Architect</h4><p>Opal lets you build AI-powered mini-apps without touching any code. It’s a visual workflow builder where you drag, drop, and connect AI models to create custom tools or automations in minutes. Perfect for students or anyone who wants to quickly prototype ideas or automate boring tasks,no servers, no deployment headaches.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Yq-H6nysear3bJ97r1NUjg.png" /></figure><h4>7. Pomelli - The AI Brand Strategist</h4><p>Analyses your website to create a “Business DNA” profile - your colors, fonts, tone, and visuals. Then generates on-brand social media campaigns, ads, and content. Most useful if you’re working on side projects, building a portfolio, or running a student organization and need quick, consistent marketing that feels authentic.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_dH2Gs9DE1dLILTpQbLcfA.png" /></figure><h3>Conclusion</h3><p>These tools may change. Some may improve and some may disappear. But what matters is not the tools themselves. It’s the mindset of exploring early.</p><p>University teaches us fundamentals. That’s important.<br>But curiosity teaches us the future.</p><p>These tools are already shaping how people learn, build, and create.<br>So again, the question is: will you be ahead of the curve, or playing catch-up?</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7a59e5bb775d" width="1" height="1" alt=""><hr><p><a href="https://medium.com/linkit-intecs/the-google-tools-nobody-taught-you-in-university-but-you-should-know-7a59e5bb775d">The Google Tools Nobody Taught You in University (But You Should Know)</a> was originally published in <a href="https://medium.com/linkit-intecs">LinkIT</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[GitPulse: GitHub Trending Tool]]></title>
            <link>https://trishan-fernando.medium.com/gitpulse-github-trending-tool-8ab2c4257da3?source=rss-c716cd23d9db------2</link>
            <guid isPermaLink="false">https://medium.com/p/8ab2c4257da3</guid>
            <category><![CDATA[python]]></category>
            <category><![CDATA[github]]></category>
            <category><![CDATA[tools]]></category>
            <category><![CDATA[rest-api]]></category>
            <category><![CDATA[command-line]]></category>
            <dc:creator><![CDATA[Trishan Fernando]]></dc:creator>
            <pubDate>Tue, 23 Dec 2025 06:37:02 GMT</pubDate>
            <atom:updated>2026-02-05T14:54:26.566Z</atom:updated>
            <content:encoded><![CDATA[<h4>Learning by shipping</h4><h4>From black-box page to installable CLI in Python</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ywL8dQ3IYJhNSc2TbIBGCg.jpeg" /></figure><p>I didn’t build GitPulse to solve a critical global problem. I built it to learn.</p><p>I wanted to understand how CLI tools feel to the user, how to integrate complex APIs, and how to transform raw data into something useful. Honestly? Building because you’re curious is the best way to grow as a developer.</p><p><strong>The Challenge: Finding a “Trending” Endpoint that Doesn’t Exist</strong> This project was inspired by the <a href="https://roadmap.sh/">Roadmap.sh</a> backend project suggestions. I quickly ran into a roadblock: <strong>GitHub doesn’t actually provide a “Trending” endpoint in its REST API.</strong> The “Trending” page on GitHub’s website is a bit of a “black box” — it uses a secret algorithm to track star velocity.</p><p>To build GitPulse, I had to create my own definition of “Trending.” So, I decided to define trending as a combination of:</p><ul><li><strong>Freshness</strong> — repositories created within a recent time window</li><li><strong>Popularity</strong> — repositories with a high star count</li></ul><p>In practice, this means:</p><blockquote><em>“Show me repositories created recently that are getting a lot of stars.”</em></blockquote><p>This definition is simple, transparent, and achievable using GitHub’s Search API.</p><h3>Getting Our Hands Dirty with the GitHub REST API</h3><p>Before writing any code, I spent time exploring the GitHub API documentation. Within minutes, I found the endpoint I needed:</p><pre>https://api.github.com/search/repositories</pre><p>But there was a catch: this endpoint <strong>requires</strong> a query parameter (q). Without it, you get a validation error.</p><h3>Building the Query Step by Step</h3><p>The q parameter is flexible and powerful. Let me show you how I built it up:</p><p><strong>Step 1: Filter by language</strong></p><pre>https://api.github.com/search/repositories?q=language:python</pre><p>This returns up to 30 Python repositories, sorted by “best match” (GitHub’s default).</p><p><strong>Step 2: Sort by stars</strong></p><pre>https://api.github.com/search/repositories?q=language:python&amp;sort=stars&amp;order=desc</pre><p>Now we get the most-starred Python repos. The sort parameter can be:</p><ul><li>stars (what we want!)</li><li>forks</li><li>updated</li><li>help-wanted-issues</li></ul><p>The order parameter defaults to desc, but you can change it to asc if needed.</p><p><strong>Step 3: Limit the results</strong></p><pre>https://api.github.com/search/repositories?q=language:python&amp;sort=stars&amp;order=desc&amp;per_page=3</pre><p>The per_page parameter controls how many results you get (default is 30, max is 100).</p><p>This gives us the <strong>top 3 most-starred Python repositories</strong> on GitHub.</p><h3>Adding the Time Component</h3><p>Now for the crucial part: making it show <em>recent</em> trending repos,</p><p><strong>Created vs Pushed: Which Date Should I Use?</strong></p><p>This led me to an interesting question: what makes a repo “trending”?</p><ul><li><strong>Created date</strong> (`created:&gt;date`): Shows brand new projects launching</li><li><strong>Pushed date</strong> (`pushed:&gt;date`): Shows actively maintained projects with recent updates.</li></ul><p>Both have merit! A repo created yesterday with 1000 stars is definitely trending. But so is a popular repo that just pushed a major update.</p><p><strong>My solution? :</strong> I built support for BOTH. Users can choose which “trending” they want to see. For the default behavior, I chose `pushed` because it captures both new projects AND established ones with recent activity.</p><h3><strong>Building the Date Filter</strong></h3><p>GitHub’s search API supports flexible date queries:</p><pre># After a specific date<br>q=pushed:&gt;2025–12–16<br># Between two dates (two ways to write it)<br>q=pushed:&gt;2025–12–16 pushed:&lt;2025–12–23<br>q=pushed:2025–12–16..2025–12–23<br># Both work the same way!</pre><h3>Putting It All Together</h3><p>Here’s what a complete GitPulse API call looks like:</p><pre>curl &quot;https://api.github.com/search/repositories?q=language:python+pushed:2025-12-16..2025-12-23&amp;sort=stars&amp;order=desc&amp;per_page=10&quot;</pre><p>Breaking it down:</p><ul><li>q=language:python — Filter by language</li><li>+pushed:2025–12–16..2025–12–23` — Date range (note the `+` separating queries)</li><li>`&amp;sort=stars` — Sort by star count (default = best match)</li><li>`&amp;order=desc` — Highest stars first (default = desc)</li><li>`&amp;per_page=10` — Limit results (default = 30)</li></ul><p><strong>Important</strong>: Multiple search qualifiers in `q` are separated by `+` (URL-encoded space) or actual spaces.</p><blockquote><strong>Pro tip</strong>: You can test these URLs directly in your browser or use `curl` to see the JSON response. This helped me understand the data structure before writing code.</blockquote><h3>From API Exploration to Actual Code</h3><p>Now that we understand the GitHub REST API, it’s time to actually build the tool.</p><p>Before jumping straight into coding, the first thing we need is a proper folder structure. Writing everything in a single file — like a 500-line script — will only give you headaches later when you try to debug, edit, or extend the code. Keeping the project maintainable with a clear structure is always a best practice.</p><p>So instead of doing that, I went with a simple modular architecture. Nothing fancy — just splitting the code into logical parts where each file has a clear responsibility.</p><p>Here’s the folder structure:</p><pre>GitPulse/<br>├── cli.py # Handles user input &amp; arguments<br>├── github_api.py # Talks to GitHub API<br>├── formatter.py # Displays results beautifully<br>├── utils.py # Date calculations<br>└── config.py # Constants &amp; defaults</pre><p>This way, the code stays clean, readable, and much easier to work with as the project grows.</p><p>Here is the Repo Link and you can go through it.<br><a href="https://github.com/Trishan0/github-trending-cli">https://github.com/Trishan0/github-trending-cli</a></p><h3>Handling the Command Line</h3><p>I used the python’s built-in “argparse” library to handle the CLI arguments. It&#39;s straightforward once you get the hang of it.</p><p>You may have heard of Python’s other built-in module, “sys”, and its “sys.argv” list, which can also handle basic CLI arguments. But using it means you have to check for options, convert types and handle errors.</p><p>That’s why we use “argparse”. It makes things much easier:</p><ul><li>Automatically parses arguments (like numbers or strings)</li><li>Handle optional flags (like --calendar) easily.</li><li>Support default values for arguments</li><li>Generates help messages with -h / --help automatically</li><li>Gives clean errors if something is missing or wrong rather than crashing.</li></ul><p>If you’re new to argparse, I found these resources helpful:</p><ul><li><a href="https://docs.python.org/3/howto/argparse.html">Official Python argparse tutorial</a></li><li><a href="https://realpython.com/command-line-interfaces-python-argparse/">Real Python’s argparse guide</a></li></ul><h3>The Date Range Feature</h3><p>When I started to write the date filtering logic , I realized that “Last week” could mean two things</p><ul><li>Last 7 days from today</li><li>Previous Monday-Sunday</li></ul><p>So I decided to support for both since it wasn’t much extra work.</p><p>Here is the function — <a href="https://github.com/Trishan0/github-trending-cli/blob/a0f9aaca4adc169290a6be2f2f5353cadd5b2ed2/GitPulse/utils.py#L36-L62">GitHub</a></p><pre>def get_date_ranges(duration: str, calendar_mode: bool = False) -&gt; str:<br>    &quot;&quot;&quot;<br>    Get date range string for GitHub API based on duration.<br>    <br>    Args:<br>        duration: &#39;day&#39;, &#39;week&#39;, &#39;month&#39;, or &#39;year&#39;<br>        calendar_mode: If True, use calendar-based ranges<br>                      If False, use rolling ranges (last X days)<br>    &quot;&quot;&quot;<br>    if calendar_mode:<br>        # Calendar-based: previous calendar week/month/year<br>        if duration == &quot;week&quot;:<br>            return get_previous_week_range()  # Last Mon-Sun<br>        elif duration == &quot;month&quot;:<br>            return get_last_month_range()     # Previous calendar month<br>        # ... and so on<br>    else:<br>        # Rolling: last X days from today<br>        days_map = {&quot;day&quot;: 1, &quot;week&quot;: 7, &quot;month&quot;: 30, &quot;year&quot;: 365}<br>        return get_last_x_days(days_map.get(duration, 7))</pre><p>By default, --duration week shows the last 7 days. Add --calendar and it shows the previous calendar week instead.</p><h3>Making It a Real CLI Tool</h3><p>Now the next part is making this as a CLI Tool like git, then you can make it work like how git works in the cmd , <br>git status</p><p>so for that first we need to make this as an installable package</p><p>I used `pyproject.toml` to configure the package:</p><pre>[project.scripts]<br>gitpulse = &quot;GitPulse.cli:main&quot;</pre><p>full pyproject.toml file you can see from the<a href="https://github.com/Trishan0/github-trending-cli"> github repo</a></p><p>After running `pip install -e .`, I could use `gitpulse` anywhere in my terminal — no more `python cli.py`.</p><p>This transformed it from “a Python script” to “a real tool.”</p><h3>See It In Action</h3><p>Here’s GitPulse running with different options:</p><pre>gitpulse --duration week --language python --limit 5</pre><figure><img alt="[Screenshot or terminal output showing the beautiful Rich table]" src="https://cdn-images-1.medium.com/max/904/1*G1HHq7_0pENMGMB2CpAVeg.png" /></figure><p>The tool displays:<br>- Repository names and descriptions<br>- Star and fork counts (formatted nicely: 1.2k, 45.3k)<br>- Programming languages<br>- Direct links to repos</p><h3>Wrapping Up</h3><p>That’s GitPulse. A simple CLI tool that shows GitHub trending repos. Nothing fancy, but it taught me how real command-line tools work.</p><p>The code’s on <a href="https://github.com/Trishan0/github-trending-cli">GitHub</a>. if you want to check it out or build something similar.</p><p>If you’re learning backend development, pick a project and just build it. You’ll learn more from one project than from ten tutorials.</p><p>This article was also published on the <a href="https://blog.rotaractmora.org/the-google-tools-nobody-taught-you-in-university-but-you-should-know/">Rotaract Mora Blog</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8ab2c4257da3" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Perplexity's Thinking Browser : Comet]]></title>
            <link>https://trishan-fernando.medium.com/perplexitys-thinking-browser-comet-da022d83e170?source=rss-c716cd23d9db------2</link>
            <guid isPermaLink="false">https://medium.com/p/da022d83e170</guid>
            <category><![CDATA[artificial-intelligence]]></category>
            <category><![CDATA[technology]]></category>
            <category><![CDATA[google]]></category>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[ai]]></category>
            <dc:creator><![CDATA[Trishan Fernando]]></dc:creator>
            <pubDate>Thu, 25 Sep 2025 14:01:30 GMT</pubDate>
            <atom:updated>2025-09-25T14:21:57.948Z</atom:updated>
            <content:encoded><![CDATA[<h3>Comet Browser : Perplexity’s Thinking Browser</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*zb-Yn9SHKPBePV538LJ-Pg.jpeg" /></figure><p>We&#39;ve all been living in browsers for years now — Chrome, Edge, Safari… they all kinda feel the same. Open tabs, search things, maybe add a couple of extensions, repeat. Useful? Sure. Fun? Not so much.</p><p>And then Comet from Perplexity. And honestly, it doesn&#39;t just feel like another browser — it feels like a new class. It&#39;s as if having an AI buddy floating right amidst your browsing life.</p><p><a href="https://pplx.ai/trishan-fernando">Get Early Access &amp; Download Comet</a></p><p>Comet is not available for free it needs the 200$ Perplexity Subscription with an invitation. But you can get it through partners for free if you are a university Student.</p><p>Get Early Access With Your University Email.Use your University email to Verify that you are a student</p><p><a href="https://pplx.ai/trishan-fernando">Get Early Access &amp; Download Comet</a></p><p><strong>What&#39;s the excitement about?</strong></p><p>Comet isn&#39;t all about &quot;opening sites faster.&quot; It&#39;s about doing things with your browser instead of just staring at it.</p><p>Got 10 tabs open doing research? Tell Comet to summarize them into one neat note.</p><p>Shopping for a laptop? Have it search deals on websites and show you the top choices.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*WCImGdyB6jZoasyw2wd-LA.png" /></figure><p>Writing an email? Cross out a couple of pages and voila — it writes something that even sounds logical.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*iZM4ujRAniuuxEOktS9dkQ.png" /></figure><p>Doing a project? Keep your tabs + notes + AI summaries all bundled up in a neat space you can return to.</p><p>It is like the distinction between you driving a vehicle and having a vehicle that helps you drive, monitors your schedule, and maybe even helps you save money on fuel in the bargain.</p><p><strong>What people are saying</strong></p><p>I’ve been skimming through Reddit, X, and LinkedIn, and the vibe is clear: folks are hyped. People call it “futuristic,” “the only browser that actually boosts productivity,” and “perfect for research.” Students, writers, and even devs juggling docs love that it cuts down tab chaos.</p><p>Of course, there&#39;s a catch — some grumblings that it&#39;s invite-only for certain plans, and pricing debates. Totally fair. But that&#39;s what you get when you&#39;re not building another browser, you&#39;re trying to rethink how we browse period.</p><p><strong>One heads-up though ????</strong></p><p>AI browsers are new territory. Security researchers raise the alarms for dangers like nefarious sites trying to trick the AI into making bad decisions (autofilling data, risky clicks, etc.). So yeah — Comet does have a future vibe to it, but maybe don&#39;t fling your banking login data at it just yet.</p><p><strong>Why I think this matters</strong></p><p>Comet is the first browser I&#39;ve used that truly seems to be built for the way we actually work in 2025: multitasking, info overload, constant context-switching. Instead of just allowing us to have more tabs, it processes them.</p><p>And for real? Once you get a taste of it, browsing with a &quot;regular&quot; browser again feels… kinda like using a Nokia brick phone once you&#39;ve had a smartphone.</p><p>And Comet is only given access to their partners only and this need to pay 200$(Perplexity Pro) If you are an university student , you can get the early access from the below invitation link for 100% Free.</p><p><a href="https://pplx.ai/trishan-fernando">Get Early Access to download Comet</a></p><p>Stay Tuned with me to more updated Stuff in technology !</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=da022d83e170" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Adding Field Attributes to multiple fields at once in Odoo]]></title>
            <link>https://trishan-fernando.medium.com/adding-field-attributes-to-multiple-fields-at-once-in-odoo-19587d396c85?source=rss-c716cd23d9db------2</link>
            <guid isPermaLink="false">https://medium.com/p/19587d396c85</guid>
            <category><![CDATA[python]]></category>
            <category><![CDATA[erp]]></category>
            <category><![CDATA[odoo]]></category>
            <category><![CDATA[odoo-development]]></category>
            <dc:creator><![CDATA[Trishan Fernando]]></dc:creator>
            <pubDate>Wed, 02 Apr 2025 18:42:47 GMT</pubDate>
            <atom:updated>2025-04-02T18:42:47.792Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/937/1*GkyJ_55zYd5nzvGCuNVYqg.png" /></figure><p>When developing in Odoo, you might encounter situations where you need to add the same attribute to multiple fields. For instance, imagine you have a model with 20–30 fields and later decide to enable tracking on all of them. Adding the tracking attribute manually to each field definition would be time-consuming and potentially error-prone.</p><p>This article explores how to leverage Odoo’s fields_get() method to identify fields and modify their attributes programmatically, saving significant development time.</p><h3>Understanding fields_get()</h3><p>Odoo provides a built-in method called fields_get() that returns all fields and their attributes for a specific model. This method has two optional arguments: field name and field attributes.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*hknNVibuwi6xiEOsfwZU1Q.png" /></figure><h3>Example Usage</h3><p>Here’s a simple example of how to use fields_get() to view all fields and their attributes in a model:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*zv92rFMwmQ1w-MI0nFDi9Q.png" /></figure><p>When executed, this function will output something like:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Tf_O5eR5LqFejXxGfO808w.png" /></figure><h3>Practical Use Case: Adding Tracking to Multiple Fields</h3><p>Let’s look at a practical scenario where this approach is particularly useful. Imagine you’ve created a model with numerous fields, and after development, you decide that all fields should be tracked for audit purposes. Instead of modifying each field definition individually, you can use the following function:</p><pre>def add_attribute(self):<br>    model_obj = self.env[&#39;your.model.name&#39;]<br>    fields = model_obj.fields_get()<br>    print(type(fields))<br>    <br>    for field_name, field_attrs in fields.items():<br>        <br>        # Get the field object from the model&#39;s _fields dictionary<br>        field_obj = model_obj._fields.get(field_name)<br>        <br>        if field_obj:<br>            <br>            # Check if tracking attribute is not already set or is False<br>            if not getattr(field_obj, &#39;tracking&#39;, False):<br>                <br>                # Skip fields that cannot be tracked<br>                if field_obj.type == &#39;one2many&#39; or (field_obj.compute and not field_obj.store):<br>                    print(f&quot;Field {field_name} cannot be tracked (one2many or computed non-stored).&quot;)<br>                    continue<br>                <br>                # Set tracking attribute to True<br>                field_obj.tracking = True<br>                print(f&quot;Field {field_name} is now tracked.&quot;)<br>            else:<br>                print(f&quot;Field {field_name} is already tracked.&quot;)<br>        else:<br>            print(f&quot;Field {field_name} not found in model.&quot;)</pre><p>This function iterates through all fields in the specified model and sets the tracking attribute to True for eligible fields. It also includes validation to skip fields that cannot be tracked (like one2many fields or computed non-stored fields).</p><h3>Beyond Tracking: Additional Applications</h3><p>While our example focuses on adding tracking, this technique can be applied to modify any field attribute programmatically. Some other potential uses include:</p><ul><li>Adding specific groups to field access rights</li><li>Modifying string attributes for internationalization</li><li>Changing widget attributes for better UI display</li><li>Setting default values across multiple fields</li></ul><h3>Important Considerations</h3><p>When using this approach, keep these points in mind:</p><ol><li><strong>Environment Impact</strong>: This modification happens at runtime and may not persist after server restart unless you’re modifying the actual field definitions in the Python code.</li><li><strong>Production Caution</strong>: Be careful when applying this in production environments, as modifying field attributes can have system-wide effects.</li><li><strong>Performance</strong>: For very large models, iterating through all fields could impact performance.</li></ol><h3>Conclusion</h3><p>This approach provides an alternative method for modifying field attributes in Odoo models with multiple fields. While direct field definition remains the standard practice for most development scenarios, understanding how to programmatically modify attributes can be useful in specific situations where bulk changes are needed.</p><p>The technique leverages Odoo’s built-in functionality to access field definitions, offering a way to make consistent changes across many fields without manual intervention.</p><p>Stay Tuned !</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=19587d396c85" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[OWL JS 01 — Why Odoo Created OWL: A Framework Built for Modularity]]></title>
            <link>https://trishan-fernando.medium.com/owl-js-01-why-odoo-created-owl-a-framework-built-for-modularity-1c65356afac7?source=rss-c716cd23d9db------2</link>
            <guid isPermaLink="false">https://medium.com/p/1c65356afac7</guid>
            <category><![CDATA[owl-j]]></category>
            <category><![CDATA[owls]]></category>
            <category><![CDATA[odoo]]></category>
            <category><![CDATA[odoo-development]]></category>
            <category><![CDATA[odoo-erp]]></category>
            <dc:creator><![CDATA[Trishan Fernando]]></dc:creator>
            <pubDate>Mon, 31 Mar 2025 19:45:40 GMT</pubDate>
            <atom:updated>2025-03-31T19:45:40.139Z</atom:updated>
            <content:encoded><![CDATA[<h3>OWL JS 01 — Why Odoo Created OWL: A Framework Built for Modularity</h3><figure><img alt="Cover Image" src="https://cdn-images-1.medium.com/max/937/1*MOxITpXzdsJ9WLALK7Sj0w.png" /></figure><p>In the JavaScript ecosystem filled with established frameworks like React and Vue, Odoo’s decision to create their own framework — OWL (Odoo Web Library) — might seem counterintuitive. After all, why reinvent the wheel? This article explores the key reasons behind this strategic choice and highlights what makes OWL uniquely suited for Odoo’s specific needs.</p><h3>The Core Challenge: Extreme Modularity</h3><p>At the heart of Odoo’s decision lies one fundamental characteristic: <strong>Odoo is extremely modular</strong>. This means:</p><ul><li>Core components don’t know beforehand what files will be loaded or executed</li><li>The UI state is determined entirely at runtime</li><li>Standard build toolchains aren’t viable</li><li>Odoo isn’t just an application with a UI; it’s an application that generates a dynamic UI</li></ul><p>This modularity creates unique requirements that most established frameworks aren’t designed to address.</p><h3>Key Considerations Behind Creating OWL</h3><h3>1. Technical Independence</h3><p>Odoo needed to maintain control over their technology stack without depending on decisions made by large companies like Facebook (React) or Google. If these companies changed their licensing or technical direction, it could create significant problems for Odoo’s specialized needs.</p><h3>2. Class Components</h3><p>While modern frameworks are moving away from class components toward functional approaches, Odoo specifically benefits from class-based architecture:</p><ul><li>Inheritance provides an effective way to share code between generic components</li><li>Each class method serves as an extension point for addons</li><li>Components can be monkey-patched to add behavior from outside</li></ul><h3>3. JIT Template Compilation</h3><p>Odoo’s dynamic nature requires just-in-time compilation:</p><ul><li>Templates are stored as XML in a database and customized via XPaths</li><li>Templates need to be fetched and compiled at the last possible moment</li><li>The system must be able to generate and compile templates at runtime</li></ul><h3>4. Minimal Tooling Requirements</h3><p>OWL is designed to work with minimal mandatory tooling:</p><ul><li>Templates are compiled by the browser using built-in XML parsers</li><li>Components can be written with template strings</li><li>The framework can be integrated with a simple &lt;script&gt; tag</li><li>No complex build pipeline is required on production servers</li></ul><h3>5. XML-Based Templates</h3><p>Odoo stores templates as XML documents, allowing for powerful customization through XPaths. This feature is central to Odoo’s modularity but isn’t well-supported by other frameworks.</p><h3>6. Simplified Developer Experience</h3><p>OWL prioritizes straightforward APIs:</p><ul><li>Uses familiar class-based components</li><li>Features an explicit reactivity system</li><li>Implements clear scoping rules</li><li>Avoids unnecessary complexity</li></ul><h3>7. Optional Reactivity and Concurrency</h3><p>OWL offers:</p><ul><li>A reactive system that can be optionally disabled when not needed</li><li>A powerful yet simple concurrent mode for managing asynchronous state changes</li></ul><h3>Conclusion</h3><p>Creating OWL wasn’t a decision Odoo made lightly. While established frameworks excel in their designed contexts, Odoo’s unique requirements demanded something different. OWL represents a framework built specifically for extreme modularity, just-in-time compilation, and developer accessibility — making it the right tool for Odoo’s specialized ecosystem.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1c65356afac7" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Set a Logo to a Email Template in Odoo]]></title>
            <link>https://trishan-fernando.medium.com/set-a-logo-to-a-email-template-in-odoo-43b092a0486e?source=rss-c716cd23d9db------2</link>
            <guid isPermaLink="false">https://medium.com/p/43b092a0486e</guid>
            <category><![CDATA[odoo]]></category>
            <category><![CDATA[odoo-development]]></category>
            <category><![CDATA[xml]]></category>
            <category><![CDATA[python]]></category>
            <dc:creator><![CDATA[Trishan Fernando]]></dc:creator>
            <pubDate>Tue, 24 Sep 2024 10:07:59 GMT</pubDate>
            <atom:updated>2024-09-24T10:07:59.891Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*69joQFLsavmnhMcp_oBuuA.png" /></figure><p>In this article, we&#39;ll guide you through the process of adding a company logo to your Odoo email templates</p><p>In this guide, I am using a logo stored in the description folder of the module. To begin, you need to add your desired logo to this folder, which will later be used in the mail template.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/251/1*mmdHTpD9dkEW3yHpX5iyOg.png" /></figure><p>Next, we need to create two fields — one to store the image and another to store the image’s URL path. These fields should be added to the model that is referenced in the mail template’s model_id field (highlighted in the image below).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/555/1*91li7Kwukyq5c3QS5ameiQ.png" /></figure><pre>logo_img = fields.Image(string=&quot;Logo Image&quot;, default=lambda self: self._logo_image())<br>logo_url = fields.Char(string=&quot;Logo URL&quot;, compute=&#39;_compute_logo_url&#39;, store=True)</pre><p>The logo_img field is used to store the image within the module, and I&#39;ll explain the lambda function below. The purpose of this lambda function is to set the image from the description folder as the default for the logo_img field, which will then be used in the email template.</p><p>The lambda function allows you to set a default image for the logo_img field. Here&#39;s the function, and remember to import the necessary libraries (os and base64) at the beginning of your file:</p><pre>import base64<br>import os<br><br># a function to set a default image for logo_image field.<br> def _logo_image(self):<br> # Get the path of the current file (model file)<br> current_dir = os.path.dirname(os.path.abspath(__file__))<br> # Navigate up to the module root, then to the static folder<br> module_root = os.path.dirname(current_dir) # Go up one level to the module root<br> image_path = os.path.join(module_root, &#39;static&#39;, &#39;description&#39;, &#39;your_logo.png&#39;)<br> try:<br> with open(image_path, &#39;rb&#39;) as f:<br> return base64.b64encode(f.read())<br> except Exception as e:<br> print(f&quot;Error loading default image: {e}&quot;)<br> return False</pre><p>To verify that this function works, you can display the logo_img field in your form view, where you should be able to see the image from the description folder as the default.</p><p>Next, we need to obtain the URL of the default image. While hardcoding the URL is an option, it’s not ideal. Instead, we can write a function to dynamically generate the URL and store it in the logo_url field we created earlier. Here&#39;s the function:</p><pre>@api.depends(&#39;logo_img&#39;)<br>def _compute_logo_url(https://medium.com/self):<br>    base_url = self.env[&#39;ir.config_parameter&#39;].sudo().get_param(&#39;web.base.url&#39;)<br>    for record in self:<br>        record.logo_url = f&quot;{base_url}/Module_name/static/description/icon.png&quot;<br>        print(&#39;logo url is =&#39;,record.logo_url)</pre><p>Finally, add the generated URL to the src attribute of the img tag in your email template like this:</p><pre>&lt;img t-att-src=&quot;object.logo_url&quot; alt=&quot;Logo&quot;/&gt;</pre><p>If the email still doesn’t display the logo within the template, navigate to <strong>Settings &gt; Technical &gt; Email Templates</strong> in Odoo, search for your email template by name, delete it, and then upgrade your module. After that, check if the email template is updated and working correctly.</p><p>Thank you for following along!</p><p><strong>P.S.</strong> — I’m also a beginner in Odoo development. I wrote this because I encountered the same issue and couldn’t find a proper solution. If you know of an easier way to achieve this or spot any mistakes, please let me know!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=43b092a0486e" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>