<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>Misframe</title>
    <link>https://misfra.me/</link>
    <description>Notes on software, systems, and life by Preetam Jinka.</description>
    <language>en</language>
    <generator>Hugo -- gohugo.io</generator>
    <copyright>Copyright © Preetam Jinka</copyright>
    <atom:link href="https://misfra.me/index.xml" rel="self" type="application/rss+xml"/>
    <lastBuildDate>Mon, 09 Nov 2026 00:00:00 &#43;0000</lastBuildDate>
    
    <item>
      <title>When Will We Stop Reading Code?</title>
      <link>https://misfra.me/2026/when-will-we-stop-reading-code/</link>
      <guid isPermaLink="true">https://misfra.me/2026/when-will-we-stop-reading-code/</guid>
      <pubDate>Mon, 09 Nov 2026 00:00:00 &#43;0000</pubDate>
      <dc:creator>Preetam Jinka</dc:creator>
      <category>Programming</category>
      
      <description>&lt;p&gt;In 2023 I wrote &lt;a href=&#34;https://funnelstory.substack.com/p/can-github-copilot-make-you-a-worse&#34;&gt;Can GitHub Copilot make you a worse programmer?&lt;/a&gt;. At the time, Copilot was one of the first introductions of AI into mainstream programming. My main predictions were:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Copilot would boost productivity for senior programmers but dull their chops&lt;/li&gt;
&lt;li&gt;Prevent junior programmers from building expertise through repetition&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;In some ways I was right, and in other ways I completely missed the broader changes. When I wrote about programming in that post, it was more about physically writing lines of code. I didn&amp;rsquo;t consider software engineering as a broader topic. Now I&amp;rsquo;m prompting and guiding agents, not typing out code.&lt;/p&gt;
&lt;h3 id=&#34;writing-was-the-first-step&#34;&gt;Writing was the first step&lt;/h3&gt;
&lt;p&gt;Historically, a &lt;a href=&#34;https://en.wikipedia.org/wiki/Computer_(occupation)&#34;&gt;computer was a person&lt;/a&gt;. When computing devices were invented, the code they executed was written by humans. Eventually, higher-level languages and compilers took over the role of writing machine code. Today, the code computers execute is, at least in my world, almost entirely written by agents. The higher level language now is English and the prompts I provide to agents.&lt;/p&gt;
&lt;h3 id=&#34;reviewing-is-the-bottleneck&#34;&gt;Reviewing is the bottleneck&lt;/h3&gt;
&lt;p&gt;OK, sure. I&amp;rsquo;m not writing code anymore. What about reviewing code? If writing code requires 1x effort, I&amp;rsquo;d say reviewing it takes 0.25x effort. Earlier this year, AI assisted coding was like 4x the velocity of doing it manually. At that pace, it was reasonable to still review code manually. Today, it feels more like 100x. Reviewing code the same way isn&amp;rsquo;t practical anymore.&lt;/p&gt;
&lt;p&gt;My solution is to use tooling and AI to support reviews at that scale. What I review is shifting from the lines of code to the API contracts, architecture changes, invariants, algorithms, schemas, and specifications.&lt;/p&gt;
&lt;h3 id=&#34;what-i-still-need-to-read&#34;&gt;What I still need to read&lt;/h3&gt;
&lt;p&gt;Programming languages and compilers have well-defined and specific behavior. The transformation from a high level language to machine code is precise. The prompts I provide my agents in English generally are not. Agents also do not always write excellent code. That means I still need to confirm:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;it does what I intended&lt;/li&gt;
&lt;li&gt;it follows my style and conventions&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;The top frontier agents often seem to intuitively “get” what I prompt them to do, but I find that other models struggle. They might think too shallowly or treat a symptom of a bug instead of the root cause.&lt;/p&gt;
&lt;p&gt;I’ve found (especially with frontier LLMs) that with solid rules and guidance files (AGENTS.md, CLAUDE.md), code review skills, charters, code maps, and package maps, agents are better at finding bugs and enforcing consistent style—and doing it systematically.&lt;/p&gt;
&lt;p&gt;I’m having them do more and more code reviews. And as time goes on, the proportion of PRs where I still read the diff is decreasing. Reviewing a change doesn&amp;rsquo;t always require me to read its implementation.&lt;/p&gt;
&lt;p&gt;The changes where I definitely don’t need to read the code are those isolated to a single file or package, with no changes to APIs or package interfaces. When a change crosses package boundaries or involves something beyond straightforward CRUD, that’s where I’ll at least take a peek.&lt;/p&gt;
&lt;p&gt;Agents do what I prompt them to do, and often I don’t tell them to think through the long-term consequences of their work.&lt;sup id=&#34;fnref:1&#34;&gt;&lt;a href=&#34;https://misfra.me/2026/when-will-we-stop-reading-code/#fn:1&#34; class=&#34;footnote-ref&#34; role=&#34;doc-noteref&#34;&gt;1&lt;/a&gt;&lt;/sup&gt; As an architect (and especially as a technical founder), I know that decisions I make today may affect things tomorrow, a week from now, or even a year from now. That makes me more careful about how I design or implement things. For now, those are decisions where I still want to understand the implementation.&lt;/p&gt;
&lt;p&gt;LLMs are improving every week. These limitations and problems are temporary. As with SQL, where humans declare what a query should return and a machine planner and executor determine execution, what will matter most is how I define the intent and objective. Then let the machines and agents figure out how to execute.&lt;/p&gt;
&lt;p&gt;What I learned from my own experience is that more of my work building software now is about thinking through architecture (the structure and processes involved in software), requirements, specifications, and UX. Turns out this is way more complex to reason through than individual lines of code and things like how to best write a certain for-loop.&lt;/p&gt;
&lt;p&gt;It’s been a while since I’ve written any significant code by hand. I may have gotten a little rusty with my programming. But what I have been improving a lot is software design and architecture, and reasoning through complexity.&lt;/p&gt;
&lt;p&gt;I still wonder what will happen to the junior programmers who are yet to put in all their reps. I learned a lot by writing code and living with my mistakes. Whether that kind of experience will still be worth it in the future, I don&amp;rsquo;t know. Knowing assembly isn&amp;rsquo;t as useful as it once used to be.&lt;/p&gt;
&lt;p&gt;So the question is not whether I will stop reading code. It will happen. The question is how long it will take to get there.&lt;/p&gt;
&lt;div class=&#34;footnotes&#34; role=&#34;doc-endnotes&#34;&gt;
&lt;hr&gt;
&lt;ol&gt;
&lt;li id=&#34;fn:1&#34;&gt;
&lt;p&gt;Even if I prompt them to do that, it’s not the same as being trained to do it intuitively. See &lt;a href=&#34;https://funnelstory.ai/blog/engineering/reasoning-is-trained-not-prompted&#34;&gt;https://funnelstory.ai/blog/engineering/reasoning-is-trained-not-prompted&lt;/a&gt;&amp;#160;&lt;a href=&#34;https://misfra.me/2026/when-will-we-stop-reading-code/#fnref:1&#34; class=&#34;footnote-backref&#34; role=&#34;doc-backlink&#34;&gt;&amp;#x21a9;&amp;#xfe0e;&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;/div&gt;
</description>
      <content:encoded>&lt;p&gt;In 2023 I wrote &lt;a href=&#34;https://funnelstory.substack.com/p/can-github-copilot-make-you-a-worse&#34;&gt;Can GitHub Copilot make you a worse programmer?&lt;/a&gt;. At the time, Copilot was one of the first introductions of AI into mainstream programming. My main predictions were:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Copilot would boost productivity for senior programmers but dull their chops&lt;/li&gt;
&lt;li&gt;Prevent junior programmers from building expertise through repetition&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;In some ways I was right, and in other ways I completely missed the broader changes. When I wrote about programming in that post, it was more about physically writing lines of code. I didn&amp;rsquo;t consider software engineering as a broader topic. Now I&amp;rsquo;m prompting and guiding agents, not typing out code.&lt;/p&gt;
&lt;h3 id=&#34;writing-was-the-first-step&#34;&gt;Writing was the first step&lt;/h3&gt;
&lt;p&gt;Historically, a &lt;a href=&#34;https://en.wikipedia.org/wiki/Computer_(occupation)&#34;&gt;computer was a person&lt;/a&gt;. When computing devices were invented, the code they executed was written by humans. Eventually, higher-level languages and compilers took over the role of writing machine code. Today, the code computers execute is, at least in my world, almost entirely written by agents. The higher level language now is English and the prompts I provide to agents.&lt;/p&gt;
&lt;h3 id=&#34;reviewing-is-the-bottleneck&#34;&gt;Reviewing is the bottleneck&lt;/h3&gt;
&lt;p&gt;OK, sure. I&amp;rsquo;m not writing code anymore. What about reviewing code? If writing code requires 1x effort, I&amp;rsquo;d say reviewing it takes 0.25x effort. Earlier this year, AI assisted coding was like 4x the velocity of doing it manually. At that pace, it was reasonable to still review code manually. Today, it feels more like 100x. Reviewing code the same way isn&amp;rsquo;t practical anymore.&lt;/p&gt;
&lt;p&gt;My solution is to use tooling and AI to support reviews at that scale. What I review is shifting from the lines of code to the API contracts, architecture changes, invariants, algorithms, schemas, and specifications.&lt;/p&gt;
&lt;h3 id=&#34;what-i-still-need-to-read&#34;&gt;What I still need to read&lt;/h3&gt;
&lt;p&gt;Programming languages and compilers have well-defined and specific behavior. The transformation from a high level language to machine code is precise. The prompts I provide my agents in English generally are not. Agents also do not always write excellent code. That means I still need to confirm:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;it does what I intended&lt;/li&gt;
&lt;li&gt;it follows my style and conventions&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;The top frontier agents often seem to intuitively “get” what I prompt them to do, but I find that other models struggle. They might think too shallowly or treat a symptom of a bug instead of the root cause.&lt;/p&gt;
&lt;p&gt;I’ve found (especially with frontier LLMs) that with solid rules and guidance files (AGENTS.md, CLAUDE.md), code review skills, charters, code maps, and package maps, agents are better at finding bugs and enforcing consistent style—and doing it systematically.&lt;/p&gt;
&lt;p&gt;I’m having them do more and more code reviews. And as time goes on, the proportion of PRs where I still read the diff is decreasing. Reviewing a change doesn&amp;rsquo;t always require me to read its implementation.&lt;/p&gt;
&lt;p&gt;The changes where I definitely don’t need to read the code are those isolated to a single file or package, with no changes to APIs or package interfaces. When a change crosses package boundaries or involves something beyond straightforward CRUD, that’s where I’ll at least take a peek.&lt;/p&gt;
&lt;p&gt;Agents do what I prompt them to do, and often I don’t tell them to think through the long-term consequences of their work.&lt;sup id=&#34;fnref:1&#34;&gt;&lt;a href=&#34;https://misfra.me/2026/when-will-we-stop-reading-code/#fn:1&#34; class=&#34;footnote-ref&#34; role=&#34;doc-noteref&#34;&gt;1&lt;/a&gt;&lt;/sup&gt; As an architect (and especially as a technical founder), I know that decisions I make today may affect things tomorrow, a week from now, or even a year from now. That makes me more careful about how I design or implement things. For now, those are decisions where I still want to understand the implementation.&lt;/p&gt;
&lt;p&gt;LLMs are improving every week. These limitations and problems are temporary. As with SQL, where humans declare what a query should return and a machine planner and executor determine execution, what will matter most is how I define the intent and objective. Then let the machines and agents figure out how to execute.&lt;/p&gt;
&lt;p&gt;What I learned from my own experience is that more of my work building software now is about thinking through architecture (the structure and processes involved in software), requirements, specifications, and UX. Turns out this is way more complex to reason through than individual lines of code and things like how to best write a certain for-loop.&lt;/p&gt;
&lt;p&gt;It’s been a while since I’ve written any significant code by hand. I may have gotten a little rusty with my programming. But what I have been improving a lot is software design and architecture, and reasoning through complexity.&lt;/p&gt;
&lt;p&gt;I still wonder what will happen to the junior programmers who are yet to put in all their reps. I learned a lot by writing code and living with my mistakes. Whether that kind of experience will still be worth it in the future, I don&amp;rsquo;t know. Knowing assembly isn&amp;rsquo;t as useful as it once used to be.&lt;/p&gt;
&lt;p&gt;So the question is not whether I will stop reading code. It will happen. The question is how long it will take to get there.&lt;/p&gt;
&lt;div class=&#34;footnotes&#34; role=&#34;doc-endnotes&#34;&gt;
&lt;hr&gt;
&lt;ol&gt;
&lt;li id=&#34;fn:1&#34;&gt;
&lt;p&gt;Even if I prompt them to do that, it’s not the same as being trained to do it intuitively. See &lt;a href=&#34;https://funnelstory.ai/blog/engineering/reasoning-is-trained-not-prompted&#34;&gt;https://funnelstory.ai/blog/engineering/reasoning-is-trained-not-prompted&lt;/a&gt;&amp;#160;&lt;a href=&#34;https://misfra.me/2026/when-will-we-stop-reading-code/#fnref:1&#34; class=&#34;footnote-backref&#34; role=&#34;doc-backlink&#34;&gt;&amp;#x21a9;&amp;#xfe0e;&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;/div&gt;
</content:encoded>
    </item>
    
    <item>
      <title>Software design</title>
      <link>https://misfra.me/2026/software-design/</link>
      <guid isPermaLink="true">https://misfra.me/2026/software-design/</guid>
      <pubDate>Sat, 22 Aug 2026 00:00:00 &#43;0000</pubDate>
      <dc:creator>Preetam Jinka</dc:creator>
      <category>Programming</category>
      
      <description>&lt;p&gt;When we founded FunnelStory in 2022, I was the only person writing code. We didn&amp;rsquo;t have a team yet.
Today, the back-end is about 500k lines of code. We&amp;rsquo;re a team of 5, so on average each person manages about 100k lines.&lt;/p&gt;
&lt;p&gt;I used to be able to remember how I wrote every package, API, and test. Now agents are writing thousands of new lines a week.
I can&amp;rsquo;t expect to remember all of the codebase in fine detail. This is not just an AI problem. This would also be the case
if our team expanded from 5 to 25.&lt;/p&gt;
&lt;p&gt;As an architect, the only way to make sense of things is with abstractions. Just like how higher-level languages help you reason about
programs better than machine code or assembly, abstractions let you reason about programs at a level higher than individual
lines of code. At an architecture level, I think about the infra pieces, subsystems, components, and how they interact.
Within the codebase we have to get into package design, defining interfaces, code readability, and testing. Abstraction has to work
at multiple scales.&lt;/p&gt;
&lt;img class=&#34;mf-ink&#34; src=&#34;https://misfra.me/img/2026/tree-structures.png&#34; alt=&#34;&#34;&gt;
&lt;p&gt;A few weeks ago I decided I needed to relearn software architecture and software design principles. I have a good intuition about these
things, but when you&amp;rsquo;re dealing with a team of engineers and their agents, it&amp;rsquo;s really important to codify this kind of intuition in
order to avoid slop. In my 15 years of writing software professionally&lt;sup id=&#34;fnref:1&#34;&gt;&lt;a href=&#34;https://misfra.me/2026/software-design/#fn:1&#34; class=&#34;footnote-ref&#34; role=&#34;doc-noteref&#34;&gt;1&lt;/a&gt;&lt;/sup&gt;, entirely at startups, I rarely needed to think about
how to design software and abstractions. We were too busy building something to get the company to the next stage.&lt;/p&gt;
&lt;p&gt;I&amp;rsquo;m starting with &lt;em&gt;A Philosophy of Software Design&lt;/em&gt; (&lt;a href=&#34;https://www.amazon.com/dp/1732102201&#34;&gt;Amazon&lt;/a&gt;) by John Ousterhout&lt;sup id=&#34;fnref:2&#34;&gt;&lt;a href=&#34;https://misfra.me/2026/software-design/#fn:2&#34; class=&#34;footnote-ref&#34; role=&#34;doc-noteref&#34;&gt;2&lt;/a&gt;&lt;/sup&gt;. If you want a brief introduction, Ousterhout gave a talk (&lt;a href=&#34;https://www.youtube.com/watch?v=bmSAYlu0NcY&#34;&gt;YouTube&lt;/a&gt;) that covers the highlights of the book.&lt;/p&gt;
&lt;p&gt;The book has motivated me to start to write down some high-level principles for how we write Go code.
While we already had a basic &amp;ldquo;style guide&amp;rdquo; and &lt;a href=&#34;https://cursor.com/docs/rules&#34;&gt;Cursor rules&lt;/a&gt;, they just described
some patterns and code snippets, and not really design principles to follow.&lt;/p&gt;
&lt;p&gt;A great perspective from its conclusion:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;This book is about one thing: complexity. Dealing with complexity is the most
important challenge in software design. It is what makes systems hard to build
and maintain, and it often makes them slow as well.&lt;/p&gt;
&lt;p&gt;[&amp;hellip;]&lt;/p&gt;
&lt;p&gt;The reward for being a good designer is that you get to spend a larger fraction
of your time in the design phase, which is fun. Poor designers spend most of
their time chasing bugs in complicated and brittle code. If you improve your
design skills, not only will you produce higher quality software more quickly, but
the software development process will be more enjoyable.&lt;/p&gt;&lt;/blockquote&gt;
&lt;p&gt;These days, while my agents are churning away on user stories or bug fixes, I&amp;rsquo;m spending most of my time reading and thinking
about design principles. I think this is how software engineers should be thinking about staying relevant. AI can already do a
lot, but where human engineers play an important role is bringing context and judgment.&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;Software engineering is what happens to programming when you add time and other people.&lt;br&gt;
&lt;a href=&#34;https://www.acm.org/articles/people-of-acm/2026/russ-cox&#34;&gt;https://www.acm.org/articles/people-of-acm/2026/russ-cox&lt;/a&gt;&lt;/p&gt;&lt;/blockquote&gt;
&lt;p&gt;Time and other people is the context. Knowing proper design and having good taste is judgment.&lt;/p&gt;
&lt;div class=&#34;footnotes&#34; role=&#34;doc-endnotes&#34;&gt;
&lt;hr&gt;
&lt;ol&gt;
&lt;li id=&#34;fn:1&#34;&gt;
&lt;p&gt;I mean writing software for a paycheck. My first ever internship was the summer before my senior year of high school, in 2011. The year before I built the website for my sister&amp;rsquo;s college club for money, but I&amp;rsquo;m not really counting that one.&amp;#160;&lt;a href=&#34;https://misfra.me/2026/software-design/#fnref:1&#34; class=&#34;footnote-backref&#34; role=&#34;doc-backlink&#34;&gt;&amp;#x21a9;&amp;#xfe0e;&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li id=&#34;fn:2&#34;&gt;
&lt;p&gt;Ousterhout created Tcl and also worked on the Raft consensus algorithm.&amp;#160;&lt;a href=&#34;https://misfra.me/2026/software-design/#fnref:2&#34; class=&#34;footnote-backref&#34; role=&#34;doc-backlink&#34;&gt;&amp;#x21a9;&amp;#xfe0e;&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;/div&gt;
</description>
      <content:encoded>&lt;p&gt;When we founded FunnelStory in 2022, I was the only person writing code. We didn&amp;rsquo;t have a team yet.
Today, the back-end is about 500k lines of code. We&amp;rsquo;re a team of 5, so on average each person manages about 100k lines.&lt;/p&gt;
&lt;p&gt;I used to be able to remember how I wrote every package, API, and test. Now agents are writing thousands of new lines a week.
I can&amp;rsquo;t expect to remember all of the codebase in fine detail. This is not just an AI problem. This would also be the case
if our team expanded from 5 to 25.&lt;/p&gt;
&lt;p&gt;As an architect, the only way to make sense of things is with abstractions. Just like how higher-level languages help you reason about
programs better than machine code or assembly, abstractions let you reason about programs at a level higher than individual
lines of code. At an architecture level, I think about the infra pieces, subsystems, components, and how they interact.
Within the codebase we have to get into package design, defining interfaces, code readability, and testing. Abstraction has to work
at multiple scales.&lt;/p&gt;
&lt;img class=&#34;mf-ink&#34; src=&#34;https://misfra.me/img/2026/tree-structures.png&#34; alt=&#34;&#34;&gt;
&lt;p&gt;A few weeks ago I decided I needed to relearn software architecture and software design principles. I have a good intuition about these
things, but when you&amp;rsquo;re dealing with a team of engineers and their agents, it&amp;rsquo;s really important to codify this kind of intuition in
order to avoid slop. In my 15 years of writing software professionally&lt;sup id=&#34;fnref:1&#34;&gt;&lt;a href=&#34;https://misfra.me/2026/software-design/#fn:1&#34; class=&#34;footnote-ref&#34; role=&#34;doc-noteref&#34;&gt;1&lt;/a&gt;&lt;/sup&gt;, entirely at startups, I rarely needed to think about
how to design software and abstractions. We were too busy building something to get the company to the next stage.&lt;/p&gt;
&lt;p&gt;I&amp;rsquo;m starting with &lt;em&gt;A Philosophy of Software Design&lt;/em&gt; (&lt;a href=&#34;https://www.amazon.com/dp/1732102201&#34;&gt;Amazon&lt;/a&gt;) by John Ousterhout&lt;sup id=&#34;fnref:2&#34;&gt;&lt;a href=&#34;https://misfra.me/2026/software-design/#fn:2&#34; class=&#34;footnote-ref&#34; role=&#34;doc-noteref&#34;&gt;2&lt;/a&gt;&lt;/sup&gt;. If you want a brief introduction, Ousterhout gave a talk (&lt;a href=&#34;https://www.youtube.com/watch?v=bmSAYlu0NcY&#34;&gt;YouTube&lt;/a&gt;) that covers the highlights of the book.&lt;/p&gt;
&lt;p&gt;The book has motivated me to start to write down some high-level principles for how we write Go code.
While we already had a basic &amp;ldquo;style guide&amp;rdquo; and &lt;a href=&#34;https://cursor.com/docs/rules&#34;&gt;Cursor rules&lt;/a&gt;, they just described
some patterns and code snippets, and not really design principles to follow.&lt;/p&gt;
&lt;p&gt;A great perspective from its conclusion:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;This book is about one thing: complexity. Dealing with complexity is the most
important challenge in software design. It is what makes systems hard to build
and maintain, and it often makes them slow as well.&lt;/p&gt;
&lt;p&gt;[&amp;hellip;]&lt;/p&gt;
&lt;p&gt;The reward for being a good designer is that you get to spend a larger fraction
of your time in the design phase, which is fun. Poor designers spend most of
their time chasing bugs in complicated and brittle code. If you improve your
design skills, not only will you produce higher quality software more quickly, but
the software development process will be more enjoyable.&lt;/p&gt;&lt;/blockquote&gt;
&lt;p&gt;These days, while my agents are churning away on user stories or bug fixes, I&amp;rsquo;m spending most of my time reading and thinking
about design principles. I think this is how software engineers should be thinking about staying relevant. AI can already do a
lot, but where human engineers play an important role is bringing context and judgment.&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;Software engineering is what happens to programming when you add time and other people.&lt;br&gt;
&lt;a href=&#34;https://www.acm.org/articles/people-of-acm/2026/russ-cox&#34;&gt;https://www.acm.org/articles/people-of-acm/2026/russ-cox&lt;/a&gt;&lt;/p&gt;&lt;/blockquote&gt;
&lt;p&gt;Time and other people is the context. Knowing proper design and having good taste is judgment.&lt;/p&gt;
&lt;div class=&#34;footnotes&#34; role=&#34;doc-endnotes&#34;&gt;
&lt;hr&gt;
&lt;ol&gt;
&lt;li id=&#34;fn:1&#34;&gt;
&lt;p&gt;I mean writing software for a paycheck. My first ever internship was the summer before my senior year of high school, in 2011. The year before I built the website for my sister&amp;rsquo;s college club for money, but I&amp;rsquo;m not really counting that one.&amp;#160;&lt;a href=&#34;https://misfra.me/2026/software-design/#fnref:1&#34; class=&#34;footnote-backref&#34; role=&#34;doc-backlink&#34;&gt;&amp;#x21a9;&amp;#xfe0e;&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li id=&#34;fn:2&#34;&gt;
&lt;p&gt;Ousterhout created Tcl and also worked on the Raft consensus algorithm.&amp;#160;&lt;a href=&#34;https://misfra.me/2026/software-design/#fnref:2&#34; class=&#34;footnote-backref&#34; role=&#34;doc-backlink&#34;&gt;&amp;#x21a9;&amp;#xfe0e;&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;/div&gt;
</content:encoded>
    </item>
    
    <item>
      <title>Zeigarnik effect and notetaking</title>
      <link>https://misfra.me/2026/zeigarnik-effect-notetaking/</link>
      <guid isPermaLink="true">https://misfra.me/2026/zeigarnik-effect-notetaking/</guid>
      <pubDate>Wed, 15 Jul 2026 00:00:00 &#43;0000</pubDate>
      <dc:creator>Preetam Jinka</dc:creator>
      <category>Notes</category>
      
      <description>&lt;p&gt;I often have a lot of random thoughts floating around in my head, like things to do, unsolved work problems, what to pick up at the grocery store, and so on. I have a fear of forgetting things. Trying to keep track of everything, especially unfinished thoughts, takes up a lot of mental bandwidth.&lt;/p&gt;
&lt;p&gt;Shortly after college, I noticed that writing things down really helps to clear things out. It&amp;rsquo;s not that I got anything done or solved a problem, but the fact that it was down somewhere other than my head freed up my mind.&lt;/p&gt;
&lt;img class=&#34;mf-ink&#34; src=&#34;https://misfra.me/img/2026/zeigarnik-notetaking.png&#34; alt=&#34;&#34;&gt;
&lt;p&gt;This reminds me of the &lt;a href=&#34;https://en.wikipedia.org/wiki/Zeigarnik_effect&#34;&gt;Zeigarnik effect&lt;/a&gt;, which is the idea that unfinished tasks stay on your mind.&lt;/p&gt;
&lt;p&gt;I get a lot of clarity writing things down even if I don&amp;rsquo;t need to read it again. It&amp;rsquo;s like the thoughts are moved, not copied, from my head onto a page.&lt;/p&gt;
</description>
      <content:encoded>&lt;p&gt;I often have a lot of random thoughts floating around in my head, like things to do, unsolved work problems, what to pick up at the grocery store, and so on. I have a fear of forgetting things. Trying to keep track of everything, especially unfinished thoughts, takes up a lot of mental bandwidth.&lt;/p&gt;
&lt;p&gt;Shortly after college, I noticed that writing things down really helps to clear things out. It&amp;rsquo;s not that I got anything done or solved a problem, but the fact that it was down somewhere other than my head freed up my mind.&lt;/p&gt;
&lt;img class=&#34;mf-ink&#34; src=&#34;https://misfra.me/img/2026/zeigarnik-notetaking.png&#34; alt=&#34;&#34;&gt;
&lt;p&gt;This reminds me of the &lt;a href=&#34;https://en.wikipedia.org/wiki/Zeigarnik_effect&#34;&gt;Zeigarnik effect&lt;/a&gt;, which is the idea that unfinished tasks stay on your mind.&lt;/p&gt;
&lt;p&gt;I get a lot of clarity writing things down even if I don&amp;rsquo;t need to read it again. It&amp;rsquo;s like the thoughts are moved, not copied, from my head onto a page.&lt;/p&gt;
</content:encoded>
    </item>
    
    <item>
      <title>Keeping my voice</title>
      <link>https://misfra.me/2026/keeping-my-voice/</link>
      <guid isPermaLink="true">https://misfra.me/2026/keeping-my-voice/</guid>
      <pubDate>Sun, 12 Apr 2026 00:00:00 &#43;0000</pubDate>
      <dc:creator>Preetam Jinka</dc:creator>
      <category>Reflection</category>
      
      <description>&lt;p&gt;I use AI at work a lot. The reason why is that my ultimate objective at work is to solve customer problems and sustain the business through growth. AI helps me do that by generating code or drafting documents. What matters is that the objective gets met, not that I was the one who physically typed out every word or line of code.&lt;/p&gt;
&lt;p&gt;Whether we&amp;rsquo;re talking about documents or code, while the solutions are majorly mine, they&amp;rsquo;re not my style or my voice. For Go code, Cursor rules and skills get pretty close to my style, but they&amp;rsquo;re not perfect. For other kinds of writing I have given up on them trying to mimic my style. If I&amp;rsquo;m reviewing work that AI generated for me, it&amp;rsquo;s practically the same as if I&amp;rsquo;m reviewing something from someone else. It doesn&amp;rsquo;t make a difference for the business.&lt;/p&gt;
&lt;p&gt;Writing this blog is different. My objective of this blog to not only record and communicate my ideas, but to also improve my writing and thinking. When &lt;a href=&#34;https://misfra.me/2025/fatherhood/&#34;&gt;my daughter&lt;/a&gt; gets around to reading these posts, I want her to see my writing and see my voice. Not just my ideas with an LLM&amp;rsquo;s voice.&lt;/p&gt;
&lt;p&gt;Even though &amp;ldquo;writing&amp;rdquo; these posts is a whole lot more &lt;a href=&#34;https://misfra.me/2025/writing-is-fun-again-with-llms/&#34;&gt;fun&lt;/a&gt; with AI, I can&amp;rsquo;t lose my own voice in the process. So these posts will no longer have AI-assisted content. It&amp;rsquo;ll take more time and it&amp;rsquo;ll be less &amp;ldquo;fun,&amp;rdquo; but I think in the long run it&amp;rsquo;ll help me keep and evolve my writing voice.&lt;/p&gt;
&lt;p&gt;I&amp;rsquo;m still planning on using AI to think through ideas, do research, and get feedback after publishing. I think that&amp;rsquo;s a sustainable balance.&lt;/p&gt;
</description>
      <content:encoded>&lt;p&gt;I use AI at work a lot. The reason why is that my ultimate objective at work is to solve customer problems and sustain the business through growth. AI helps me do that by generating code or drafting documents. What matters is that the objective gets met, not that I was the one who physically typed out every word or line of code.&lt;/p&gt;
&lt;p&gt;Whether we&amp;rsquo;re talking about documents or code, while the solutions are majorly mine, they&amp;rsquo;re not my style or my voice. For Go code, Cursor rules and skills get pretty close to my style, but they&amp;rsquo;re not perfect. For other kinds of writing I have given up on them trying to mimic my style. If I&amp;rsquo;m reviewing work that AI generated for me, it&amp;rsquo;s practically the same as if I&amp;rsquo;m reviewing something from someone else. It doesn&amp;rsquo;t make a difference for the business.&lt;/p&gt;
&lt;p&gt;Writing this blog is different. My objective of this blog to not only record and communicate my ideas, but to also improve my writing and thinking. When &lt;a href=&#34;https://misfra.me/2025/fatherhood/&#34;&gt;my daughter&lt;/a&gt; gets around to reading these posts, I want her to see my writing and see my voice. Not just my ideas with an LLM&amp;rsquo;s voice.&lt;/p&gt;
&lt;p&gt;Even though &amp;ldquo;writing&amp;rdquo; these posts is a whole lot more &lt;a href=&#34;https://misfra.me/2025/writing-is-fun-again-with-llms/&#34;&gt;fun&lt;/a&gt; with AI, I can&amp;rsquo;t lose my own voice in the process. So these posts will no longer have AI-assisted content. It&amp;rsquo;ll take more time and it&amp;rsquo;ll be less &amp;ldquo;fun,&amp;rdquo; but I think in the long run it&amp;rsquo;ll help me keep and evolve my writing voice.&lt;/p&gt;
&lt;p&gt;I&amp;rsquo;m still planning on using AI to think through ideas, do research, and get feedback after publishing. I think that&amp;rsquo;s a sustainable balance.&lt;/p&gt;
</content:encoded>
    </item>
    
    <item>
      <title>Statistics is hard</title>
      <link>https://misfra.me/2026/statistics-is-hard/</link>
      <guid isPermaLink="true">https://misfra.me/2026/statistics-is-hard/</guid>
      <pubDate>Thu, 08 Jan 2026 00:00:00 &#43;0000</pubDate>
      <dc:creator>Preetam Jinka</dc:creator>
      <category>Reflection</category>
      
      <description>&lt;p&gt;I&amp;rsquo;ve been thinking about how statistics and probability are really non-intuitive. When you&amp;rsquo;re programming, if you&amp;rsquo;re wrong, it&amp;rsquo;s obvious. Your code won&amp;rsquo;t compile, or when you run it, the output is clearly broken. With statistics, you can be doing it completely wrong and have no idea.&lt;/p&gt;
&lt;p&gt;In programming, you get feedback. You access an array index that doesn&amp;rsquo;t exist, your program crashes. You use the wrong variable name, you get a compilation error. You divide by the wrong number, the result looks wrong.&lt;/p&gt;
&lt;p&gt;In statistics, formulas work with whatever data you feed in. They&amp;rsquo;ll give you an answer. But that doesn&amp;rsquo;t mean the answer is right.&lt;/p&gt;
&lt;p&gt;A lot of statistical methods assume your data is independent and identically distributed (iid). If you&amp;rsquo;re measuring website traffic over time and treating each day as independent, you&amp;rsquo;re violating that assumption. Today&amp;rsquo;s traffic is obviously correlated with yesterday&amp;rsquo;s. The formula will still run and produce numbers, but the output isn&amp;rsquo;t reliable. There&amp;rsquo;s no compiler to tell you that.&lt;/p&gt;
&lt;p&gt;You might calculate a p-value or run a regression, and everything looks fine. The numbers are there. The math checks out. But if your data violates the assumptions, you&amp;rsquo;re in undefined behavior territory. The results might still be directionally correct, or they might be completely wrong.&lt;/p&gt;
&lt;p&gt;Statistics is also about hypothesis testing. When you see statistical output, you have to know what question it&amp;rsquo;s actually answering. Say you train a linear model to predict house prices with features like square footage, bedrooms, and neighborhood. You might look at the weights and think &amp;ldquo;neighborhood has the highest weight, so it&amp;rsquo;s the most important factor.&amp;rdquo; But that&amp;rsquo;s not necessarily what the weights tell you. They&amp;rsquo;re affected by the scale of variables and correlations between features. If you want to know what matters most for prediction, you&amp;rsquo;d need to actually test the model&amp;rsquo;s performance. If you want causal effects, that&amp;rsquo;s a different thing entirely.&lt;/p&gt;
&lt;p&gt;There&amp;rsquo;s also a lot of human judgment. You have to choose which data to include, how to handle missing values and outliers, pick hyperparameters. There&amp;rsquo;s no formula that tells you the &amp;ldquo;right&amp;rdquo; values. Two people working on the same problem will make different choices. Even when you have metrics like precision and recall, you still need agreement on thresholds, edge cases, what the ground truth even is.&lt;/p&gt;
&lt;p&gt;Run enough tests and you&amp;rsquo;ll find &amp;ldquo;significant&amp;rdquo; results just by chance. Correlation doesn&amp;rsquo;t mean causation. Statistical significance doesn&amp;rsquo;t mean practical significance.&lt;/p&gt;
&lt;p&gt;LLMs make this worse. They&amp;rsquo;ll generate statistical code without checking if your data meets assumptions. And because the output looks professional and the code runs, it&amp;rsquo;s easy to think you did it right. The LLM is just another tool that works with whatever you feed it. Just like the statistical formulas themselves.&lt;/p&gt;</description>
      <content:encoded>&lt;p&gt;I&amp;rsquo;ve been thinking about how statistics and probability are really non-intuitive. When you&amp;rsquo;re programming, if you&amp;rsquo;re wrong, it&amp;rsquo;s obvious. Your code won&amp;rsquo;t compile, or when you run it, the output is clearly broken. With statistics, you can be doing it completely wrong and have no idea.&lt;/p&gt;
&lt;p&gt;In programming, you get feedback. You access an array index that doesn&amp;rsquo;t exist, your program crashes. You use the wrong variable name, you get a compilation error. You divide by the wrong number, the result looks wrong.&lt;/p&gt;
&lt;p&gt;In statistics, formulas work with whatever data you feed in. They&amp;rsquo;ll give you an answer. But that doesn&amp;rsquo;t mean the answer is right.&lt;/p&gt;
&lt;p&gt;A lot of statistical methods assume your data is independent and identically distributed (iid). If you&amp;rsquo;re measuring website traffic over time and treating each day as independent, you&amp;rsquo;re violating that assumption. Today&amp;rsquo;s traffic is obviously correlated with yesterday&amp;rsquo;s. The formula will still run and produce numbers, but the output isn&amp;rsquo;t reliable. There&amp;rsquo;s no compiler to tell you that.&lt;/p&gt;
&lt;p&gt;You might calculate a p-value or run a regression, and everything looks fine. The numbers are there. The math checks out. But if your data violates the assumptions, you&amp;rsquo;re in undefined behavior territory. The results might still be directionally correct, or they might be completely wrong.&lt;/p&gt;
&lt;p&gt;Statistics is also about hypothesis testing. When you see statistical output, you have to know what question it&amp;rsquo;s actually answering. Say you train a linear model to predict house prices with features like square footage, bedrooms, and neighborhood. You might look at the weights and think &amp;ldquo;neighborhood has the highest weight, so it&amp;rsquo;s the most important factor.&amp;rdquo; But that&amp;rsquo;s not necessarily what the weights tell you. They&amp;rsquo;re affected by the scale of variables and correlations between features. If you want to know what matters most for prediction, you&amp;rsquo;d need to actually test the model&amp;rsquo;s performance. If you want causal effects, that&amp;rsquo;s a different thing entirely.&lt;/p&gt;
&lt;p&gt;There&amp;rsquo;s also a lot of human judgment. You have to choose which data to include, how to handle missing values and outliers, pick hyperparameters. There&amp;rsquo;s no formula that tells you the &amp;ldquo;right&amp;rdquo; values. Two people working on the same problem will make different choices. Even when you have metrics like precision and recall, you still need agreement on thresholds, edge cases, what the ground truth even is.&lt;/p&gt;
&lt;p&gt;Run enough tests and you&amp;rsquo;ll find &amp;ldquo;significant&amp;rdquo; results just by chance. Correlation doesn&amp;rsquo;t mean causation. Statistical significance doesn&amp;rsquo;t mean practical significance.&lt;/p&gt;
&lt;p&gt;LLMs make this worse. They&amp;rsquo;ll generate statistical code without checking if your data meets assumptions. And because the output looks professional and the code runs, it&amp;rsquo;s easy to think you did it right. The LLM is just another tool that works with whatever you feed it. Just like the statistical formulas themselves.&lt;/p&gt;</content:encoded>
    </item>
    
    <item>
      <title>The Best SEO is Great Content</title>
      <link>https://misfra.me/2025/best-seo-is-great-content/</link>
      <guid isPermaLink="true">https://misfra.me/2025/best-seo-is-great-content/</guid>
      <pubDate>Tue, 30 Dec 2025 00:00:00 &#43;0000</pubDate>
      <dc:creator>Preetam Jinka</dc:creator>
      <category>Reflection</category>
      
      <description>&lt;p&gt;There is an entire industry built around &amp;ldquo;optimizing&amp;rdquo; content. We are told to chase keywords, engineer backlinks, and structure paragraphs to please an algorithm. But after years of writing here on &lt;a href=&#34;https://www.misfra.me&#34;&gt;Misframe&lt;/a&gt; and for the engineering blog at &lt;a href=&#34;https://funnelstory.ai&#34;&gt;FunnelStory&lt;/a&gt;, I’ve found that the best growth hack is actually much simpler.&lt;/p&gt;
&lt;p&gt;The best SEO is just great content.&lt;/p&gt;
&lt;p&gt;When I look at the posts that have really taken off, they weren&amp;rsquo;t the ones where I used a clickbaity title or filled the page with keywords. They were the ones where I simply shared something I learned.&lt;/p&gt;
&lt;p&gt;The problem with this strategy is that it is hard work. It isn&amp;rsquo;t attractive because it falls into the category of &amp;ldquo;get popular slowly&amp;rdquo; rather than &amp;ldquo;hack the algorithm for quick views.&amp;rdquo; To write great content, you first have to &lt;em&gt;do&lt;/em&gt; something meaningful. You have to build the software, debug the nasty failure, or deeply explore a new technology. Only then do you have something worthwhile to write about.&lt;/p&gt;
&lt;p&gt;I use a simple heuristic to decide what is worth publishing: if it took a long time to figure out, write about it. Time spent figuring something out is a reliable proxy for value.&lt;/p&gt;
&lt;p&gt;If you spent hours debugging something or researching a niche topic, the solution is valuable. It is likely nontrivial, which means other people are probably looking for it right now. People like reading about genuine exploration; it is much more engaging than standard content marketing.&lt;/p&gt;
&lt;p&gt;I have seen this play out repeatedly. Recently, I wrote a post that hit the front page of Hacker News (&lt;a href=&#34;https://news.ycombinator.com/item?id=46316295&#34;&gt;Scaling Go Testing with Contract and Scenario Mocks &lt;/a&gt;). HN is huge and has a low tolerance for fluff. I didn&amp;rsquo;t try to game the system; I just wrote about something interesting, and they upvoted it because it was substantive. Similarly, when I wrote &lt;a href=&#34;https://funnelstory.ai/blog/engineering/practical-patterns-for-go-iterators&#34;&gt;Practical Patterns for Go Iterators&lt;/a&gt;, it was picked up by newsletters and circulated through the Go community naturally, not because of keywords, but because it was useful.&lt;/p&gt;
&lt;p&gt;This is the core of what I try to do with Misframe. Do interesting things. Learn and explore. Write about it to share.&lt;/p&gt;
&lt;p&gt;We should stop writing for search engines. These days, LLMs are effectively the new search engines anyway, so &amp;ldquo;optimizing for LLMs&amp;rdquo; is likely the new SEO. Optimizing for humans will, by default, make content better for LLMs.&lt;/p&gt;
&lt;p&gt;That said, there is still some value in technical SEO. It isn&amp;rsquo;t about gaming the system, but about being &amp;ldquo;search engine friendly.&amp;rdquo; Even if you have great content, technical issues like a slow site or broken canonical tags can hurt your discovery. SEO strategies are useful for fixing the impediments to your content, but they won&amp;rsquo;t make bad content good. It always starts with the content.&lt;/p&gt;
</description>
      <content:encoded>&lt;p&gt;There is an entire industry built around &amp;ldquo;optimizing&amp;rdquo; content. We are told to chase keywords, engineer backlinks, and structure paragraphs to please an algorithm. But after years of writing here on &lt;a href=&#34;https://www.misfra.me&#34;&gt;Misframe&lt;/a&gt; and for the engineering blog at &lt;a href=&#34;https://funnelstory.ai&#34;&gt;FunnelStory&lt;/a&gt;, I’ve found that the best growth hack is actually much simpler.&lt;/p&gt;
&lt;p&gt;The best SEO is just great content.&lt;/p&gt;
&lt;p&gt;When I look at the posts that have really taken off, they weren&amp;rsquo;t the ones where I used a clickbaity title or filled the page with keywords. They were the ones where I simply shared something I learned.&lt;/p&gt;
&lt;p&gt;The problem with this strategy is that it is hard work. It isn&amp;rsquo;t attractive because it falls into the category of &amp;ldquo;get popular slowly&amp;rdquo; rather than &amp;ldquo;hack the algorithm for quick views.&amp;rdquo; To write great content, you first have to &lt;em&gt;do&lt;/em&gt; something meaningful. You have to build the software, debug the nasty failure, or deeply explore a new technology. Only then do you have something worthwhile to write about.&lt;/p&gt;
&lt;p&gt;I use a simple heuristic to decide what is worth publishing: if it took a long time to figure out, write about it. Time spent figuring something out is a reliable proxy for value.&lt;/p&gt;
&lt;p&gt;If you spent hours debugging something or researching a niche topic, the solution is valuable. It is likely nontrivial, which means other people are probably looking for it right now. People like reading about genuine exploration; it is much more engaging than standard content marketing.&lt;/p&gt;
&lt;p&gt;I have seen this play out repeatedly. Recently, I wrote a post that hit the front page of Hacker News (&lt;a href=&#34;https://news.ycombinator.com/item?id=46316295&#34;&gt;Scaling Go Testing with Contract and Scenario Mocks &lt;/a&gt;). HN is huge and has a low tolerance for fluff. I didn&amp;rsquo;t try to game the system; I just wrote about something interesting, and they upvoted it because it was substantive. Similarly, when I wrote &lt;a href=&#34;https://funnelstory.ai/blog/engineering/practical-patterns-for-go-iterators&#34;&gt;Practical Patterns for Go Iterators&lt;/a&gt;, it was picked up by newsletters and circulated through the Go community naturally, not because of keywords, but because it was useful.&lt;/p&gt;
&lt;p&gt;This is the core of what I try to do with Misframe. Do interesting things. Learn and explore. Write about it to share.&lt;/p&gt;
&lt;p&gt;We should stop writing for search engines. These days, LLMs are effectively the new search engines anyway, so &amp;ldquo;optimizing for LLMs&amp;rdquo; is likely the new SEO. Optimizing for humans will, by default, make content better for LLMs.&lt;/p&gt;
&lt;p&gt;That said, there is still some value in technical SEO. It isn&amp;rsquo;t about gaming the system, but about being &amp;ldquo;search engine friendly.&amp;rdquo; Even if you have great content, technical issues like a slow site or broken canonical tags can hurt your discovery. SEO strategies are useful for fixing the impediments to your content, but they won&amp;rsquo;t make bad content good. It always starts with the content.&lt;/p&gt;
</content:encoded>
    </item>
    
    <item>
      <title>Fatherhood</title>
      <link>https://misfra.me/2025/fatherhood/</link>
      <guid isPermaLink="true">https://misfra.me/2025/fatherhood/</guid>
      <pubDate>Sat, 01 Nov 2025 00:00:00 &#43;0000</pubDate>
      <dc:creator>Preetam Jinka</dc:creator>
      <category>Parenting</category>
      
      <description>&lt;p&gt;I&amp;rsquo;m a dad now!&lt;/p&gt;
&lt;p&gt;Becoming a parent is an incredible process. In the past 9+ months we&amp;rsquo;ve been observing our little one go from a 10-week blob with a tiny heartbeat to an independent human being. I&amp;rsquo;ve had that time to think about parenting and fatherhood. Now that our little girl is here, this post is mostly for her to look back on someday.&lt;/p&gt;
&lt;div class=&#34;mf-captioned-image&#34;&gt;
&lt;img src=&#34;https://misfra.me/img/2025/hand.jpg&#34; alt=&#34;My daughter&#39;s hand&#34; width=400&gt;
&lt;div class=&#34;mf-caption&#34;&gt;My daughter&#39;s hand&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;I also want to write more about parenting. My parents tell me stories about what I was like as a baby, but those are 30+ year old memories. They never wrote things down as they happened. I have that opportunity now. It’ll be good for us to reflect on later.&lt;/p&gt;
&lt;p&gt;I&amp;rsquo;ve had this blog for over a decade. I&amp;rsquo;ve been writing since high school. It feels special to think that my daughter might someday read through all of it and get to know who her dad was through the years.&lt;/p&gt;
&lt;h3 id=&#34;optimism&#34;&gt;Optimism&lt;/h3&gt;
&lt;blockquote&gt;
&lt;p&gt;“To choose to be a parent is to be an optimist; you wouldn’t bring a child into the world if you weren’t.”&lt;/p&gt;&lt;/blockquote&gt;
&lt;p&gt;I read a quote like this somewhere and it really stuck with me. I wish I could remember where.&lt;/p&gt;
&lt;p&gt;Parenthood is the most deliberate form of optimism. You’re betting that the world will be good enough for your child, and that you’ll do your part to make it better.&lt;/p&gt;
&lt;h3 id=&#34;learning-and-teamwork&#34;&gt;Learning and teamwork&lt;/h3&gt;
&lt;p&gt;Before the hospital, I had never changed a diaper (well, not on a real baby). And I&amp;rsquo;d never really held a newborn. By the second day, I was doing both on autopilot. Some things you learn by reading; others you learn because you have to. I&amp;rsquo;m like 80% sure a lot of this is from human instinct. Surely a lot of this stuff is in our genes.&lt;/p&gt;
&lt;p&gt;Parenting is an enormous team effort. You’ll know this if you ever have to do triple feeding &amp;ndash; how much it matters for both parents to work well together. I&amp;rsquo;m fortunate my wife and I make a good team (one of the nurses even pointed that out). I&amp;rsquo;ve realized that parenting is just a continuous stream of new problems to solve. Having a partner with whom you can do complex problem solving is really important.&lt;/p&gt;
&lt;h3 id=&#34;what-i-want-for-my-daughter&#34;&gt;What I want for my daughter&lt;/h3&gt;
&lt;p&gt;I know what it’s like to grow up as a boy. Having a daughter is going to be a completely different experience. I&amp;rsquo;m excited to be a girl dad!&lt;/p&gt;
&lt;p&gt;My wife and I are both immigrants. Our families went through their own challenges — H-1B visas, naturalization, and the long process of building a life in a new country. Our parents moved their families to a completely different culture so that we could have better opportunities.&lt;/p&gt;
&lt;p&gt;Our daughter, on the other hand, is born in California — a citizen, with parents who both work in tech in the Bay Area. That’s a huge privilege. Somehow we’ll have to make sure she doesn’t take it for granted — that she still learns the value of effort, curiosity, and growth.&lt;/p&gt;
&lt;p&gt;My goal is simple: to be the best parent I can be. I don&amp;rsquo;t have any expectations in return, but I do have certain hopes. I want her to grow up as an open-minded, curious, and well-rounded person. Growing up, I loved tinkering with hobbies, playing instruments, and figuring things out. These days I get the same joy from cooking, picking up Hindi, and learning about parenting. I hope she finds her own versions of that — things that make her curious and keep her growing.&lt;/p&gt;
&lt;hr&gt;
&lt;h3 id=&#34;appendix-random-things-ive-learned&#34;&gt;Appendix: random things I’ve learned&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Process:&lt;/strong&gt; it’s fascinating how structured the medical side of pregnancy is. Once you’re expecting, you basically have nine months of appointments already mapped out.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;OBs:&lt;/strong&gt; surprisingly data-driven. When we asked questions, the answer was usually “here’s what the data says” (or “there’s no data on that”).&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Newborn stomachs:&lt;/strong&gt; tiny. They need to be fed every ~3 hours. The only thing they can consume is milk, which gives them both hydration and calories. The schedule is wild, but you adapt. I haven’t had a sleep stretch longer than 3 hours in weeks.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Tracking:&lt;/strong&gt; it’s important to track pees and poops. Pees show hydration and food intake; poops just confirm that everything’s working internally.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Sleep:&lt;/strong&gt; newborns don’t really have a day/night rhythm yet — they just cycle through feeding and sleeping.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;White noise:&lt;/strong&gt; surprisingly effective. The womb is a noisy place.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Change:&lt;/strong&gt; things shift every week. What worked yesterday might not today.&lt;/li&gt;
&lt;/ul&gt;
&lt;hr&gt;
&lt;p&gt;Even though the past few weeks have been the most sleep-deprived and physically demanding of my life, it&amp;rsquo;s also been the most fun I&amp;rsquo;ve ever had. Waking up at 3 AM to change and feed my daughter isn&amp;rsquo;t exactly fun in the moment, but it&amp;rsquo;s more time to spend with her — and I&amp;rsquo;ll take every bit of it. Hopefully she doesn&amp;rsquo;t grow up too fast.&lt;/p&gt;
&lt;p&gt;I&amp;rsquo;ve been writing this blog for over a decade. It feels special to think that someday, my daughter might read these posts and see not just who her dad was, but what he cared about, and how much he was still learning.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;References:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&#34;https://paulgraham.com/kids.html&#34;&gt;Paul Graham — Kids&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;strong&gt;Books I found helpful:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;em&gt;We’re Pregnant! The First-Time Dad’s Pregnancy Handbook&lt;/em&gt; — Adrian Kulp. There&amp;rsquo;s a lot of parenting resources, but having a book for new dads that&amp;rsquo;s broken down week-by-week is very convenient.&lt;/li&gt;
&lt;li&gt;&lt;em&gt;Mayo Clinic Guide to a Healthy Pregnancy&lt;/em&gt; — Myra Wick. Similar to the above, but this is more like the Mayo Clinic articles in book form.&lt;/li&gt;
&lt;li&gt;&lt;em&gt;The Happiest Baby on the Block&lt;/em&gt; — Harvey Karp. Recommended by our pediatrician. After starting to read this, I feel like I can calm any baby in 15 minutes!&lt;/li&gt;
&lt;/ul&gt;</description>
      <content:encoded>&lt;p&gt;I&amp;rsquo;m a dad now!&lt;/p&gt;
&lt;p&gt;Becoming a parent is an incredible process. In the past 9+ months we&amp;rsquo;ve been observing our little one go from a 10-week blob with a tiny heartbeat to an independent human being. I&amp;rsquo;ve had that time to think about parenting and fatherhood. Now that our little girl is here, this post is mostly for her to look back on someday.&lt;/p&gt;
&lt;div class=&#34;mf-captioned-image&#34;&gt;
&lt;img src=&#34;https://misfra.me/img/2025/hand.jpg&#34; alt=&#34;My daughter&#39;s hand&#34; width=400&gt;
&lt;div class=&#34;mf-caption&#34;&gt;My daughter&#39;s hand&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;I also want to write more about parenting. My parents tell me stories about what I was like as a baby, but those are 30+ year old memories. They never wrote things down as they happened. I have that opportunity now. It’ll be good for us to reflect on later.&lt;/p&gt;
&lt;p&gt;I&amp;rsquo;ve had this blog for over a decade. I&amp;rsquo;ve been writing since high school. It feels special to think that my daughter might someday read through all of it and get to know who her dad was through the years.&lt;/p&gt;
&lt;h3 id=&#34;optimism&#34;&gt;Optimism&lt;/h3&gt;
&lt;blockquote&gt;
&lt;p&gt;“To choose to be a parent is to be an optimist; you wouldn’t bring a child into the world if you weren’t.”&lt;/p&gt;&lt;/blockquote&gt;
&lt;p&gt;I read a quote like this somewhere and it really stuck with me. I wish I could remember where.&lt;/p&gt;
&lt;p&gt;Parenthood is the most deliberate form of optimism. You’re betting that the world will be good enough for your child, and that you’ll do your part to make it better.&lt;/p&gt;
&lt;h3 id=&#34;learning-and-teamwork&#34;&gt;Learning and teamwork&lt;/h3&gt;
&lt;p&gt;Before the hospital, I had never changed a diaper (well, not on a real baby). And I&amp;rsquo;d never really held a newborn. By the second day, I was doing both on autopilot. Some things you learn by reading; others you learn because you have to. I&amp;rsquo;m like 80% sure a lot of this is from human instinct. Surely a lot of this stuff is in our genes.&lt;/p&gt;
&lt;p&gt;Parenting is an enormous team effort. You’ll know this if you ever have to do triple feeding &amp;ndash; how much it matters for both parents to work well together. I&amp;rsquo;m fortunate my wife and I make a good team (one of the nurses even pointed that out). I&amp;rsquo;ve realized that parenting is just a continuous stream of new problems to solve. Having a partner with whom you can do complex problem solving is really important.&lt;/p&gt;
&lt;h3 id=&#34;what-i-want-for-my-daughter&#34;&gt;What I want for my daughter&lt;/h3&gt;
&lt;p&gt;I know what it’s like to grow up as a boy. Having a daughter is going to be a completely different experience. I&amp;rsquo;m excited to be a girl dad!&lt;/p&gt;
&lt;p&gt;My wife and I are both immigrants. Our families went through their own challenges — H-1B visas, naturalization, and the long process of building a life in a new country. Our parents moved their families to a completely different culture so that we could have better opportunities.&lt;/p&gt;
&lt;p&gt;Our daughter, on the other hand, is born in California — a citizen, with parents who both work in tech in the Bay Area. That’s a huge privilege. Somehow we’ll have to make sure she doesn’t take it for granted — that she still learns the value of effort, curiosity, and growth.&lt;/p&gt;
&lt;p&gt;My goal is simple: to be the best parent I can be. I don&amp;rsquo;t have any expectations in return, but I do have certain hopes. I want her to grow up as an open-minded, curious, and well-rounded person. Growing up, I loved tinkering with hobbies, playing instruments, and figuring things out. These days I get the same joy from cooking, picking up Hindi, and learning about parenting. I hope she finds her own versions of that — things that make her curious and keep her growing.&lt;/p&gt;
&lt;hr&gt;
&lt;h3 id=&#34;appendix-random-things-ive-learned&#34;&gt;Appendix: random things I’ve learned&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Process:&lt;/strong&gt; it’s fascinating how structured the medical side of pregnancy is. Once you’re expecting, you basically have nine months of appointments already mapped out.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;OBs:&lt;/strong&gt; surprisingly data-driven. When we asked questions, the answer was usually “here’s what the data says” (or “there’s no data on that”).&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Newborn stomachs:&lt;/strong&gt; tiny. They need to be fed every ~3 hours. The only thing they can consume is milk, which gives them both hydration and calories. The schedule is wild, but you adapt. I haven’t had a sleep stretch longer than 3 hours in weeks.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Tracking:&lt;/strong&gt; it’s important to track pees and poops. Pees show hydration and food intake; poops just confirm that everything’s working internally.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Sleep:&lt;/strong&gt; newborns don’t really have a day/night rhythm yet — they just cycle through feeding and sleeping.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;White noise:&lt;/strong&gt; surprisingly effective. The womb is a noisy place.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Change:&lt;/strong&gt; things shift every week. What worked yesterday might not today.&lt;/li&gt;
&lt;/ul&gt;
&lt;hr&gt;
&lt;p&gt;Even though the past few weeks have been the most sleep-deprived and physically demanding of my life, it&amp;rsquo;s also been the most fun I&amp;rsquo;ve ever had. Waking up at 3 AM to change and feed my daughter isn&amp;rsquo;t exactly fun in the moment, but it&amp;rsquo;s more time to spend with her — and I&amp;rsquo;ll take every bit of it. Hopefully she doesn&amp;rsquo;t grow up too fast.&lt;/p&gt;
&lt;p&gt;I&amp;rsquo;ve been writing this blog for over a decade. It feels special to think that someday, my daughter might read these posts and see not just who her dad was, but what he cared about, and how much he was still learning.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;References:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&#34;https://paulgraham.com/kids.html&#34;&gt;Paul Graham — Kids&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;strong&gt;Books I found helpful:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;em&gt;We’re Pregnant! The First-Time Dad’s Pregnancy Handbook&lt;/em&gt; — Adrian Kulp. There&amp;rsquo;s a lot of parenting resources, but having a book for new dads that&amp;rsquo;s broken down week-by-week is very convenient.&lt;/li&gt;
&lt;li&gt;&lt;em&gt;Mayo Clinic Guide to a Healthy Pregnancy&lt;/em&gt; — Myra Wick. Similar to the above, but this is more like the Mayo Clinic articles in book form.&lt;/li&gt;
&lt;li&gt;&lt;em&gt;The Happiest Baby on the Block&lt;/em&gt; — Harvey Karp. Recommended by our pediatrician. After starting to read this, I feel like I can calm any baby in 15 minutes!&lt;/li&gt;
&lt;/ul&gt;</content:encoded>
    </item>
    
    <item>
      <title>mitm-proxy</title>
      <link>https://misfra.me/2025/mitm-proxy/</link>
      <guid isPermaLink="true">https://misfra.me/2025/mitm-proxy/</guid>
      <pubDate>Sun, 24 Aug 2025 00:00:00 &#43;0000</pubDate>
      <dc:creator>Preetam Jinka</dc:creator>
      <category>Programming</category>
      
      <description>&lt;p&gt;Every once in a while I have the need to inspect traffic from an app on my iPhone. I used to use the Postman Mac app and the built-in proxy feature, but recently they updated it to require registration and sign-in.&lt;/p&gt;
&lt;p&gt;Instead of trying to find another tool, I wrote my own Go program: &lt;a href=&#34;https://github.com/Preetam/mitm-proxy&#34;&gt;&lt;strong&gt;mitm-proxy&lt;/strong&gt;&lt;/a&gt;. It runs as an HTTP/HTTPS man-in-the-middle proxy, generates TLS certs on the fly, and logs all requests/responses into a local SQLite database.&lt;/p&gt;
</description>
      <content:encoded>&lt;p&gt;Every once in a while I have the need to inspect traffic from an app on my iPhone. I used to use the Postman Mac app and the built-in proxy feature, but recently they updated it to require registration and sign-in.&lt;/p&gt;
&lt;p&gt;Instead of trying to find another tool, I wrote my own Go program: &lt;a href=&#34;https://github.com/Preetam/mitm-proxy&#34;&gt;&lt;strong&gt;mitm-proxy&lt;/strong&gt;&lt;/a&gt;. It runs as an HTTP/HTTPS man-in-the-middle proxy, generates TLS certs on the fly, and logs all requests/responses into a local SQLite database.&lt;/p&gt;
</content:encoded>
    </item>
    
    <item>
      <title>Running PRs</title>
      <link>https://misfra.me/2025/running-prs/</link>
      <guid isPermaLink="true">https://misfra.me/2025/running-prs/</guid>
      <pubDate>Mon, 16 Jun 2025 00:00:00 &#43;0000</pubDate>
      <dc:creator>Preetam Jinka</dc:creator>
      <category>Health</category>
      
      <description>&lt;p&gt;This past month I hit two personal records for my mile time:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;June 4: 7:48&lt;/li&gt;
&lt;li&gt;June 14: 7:27&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Sub-7:30! I’m getting much faster. What’s interesting is that the bottleneck keeps changing. A few months ago it was my legs; these days it’s my cardio. I can now hold 9 mph for 2–3 minutes, but afterward my heart and lungs work harder than my legs.&lt;/p&gt;
&lt;p&gt;Interval training has been a big help—sprinting in short bursts makes me more comfortable hitting Zone 5 and holding longer strides. Now I need to switch gears and build a stronger base with more Zone 2 runs (easy pace, longer distances). Zone 2 work is great for improving base endurance—see &lt;a href=&#34;https://peterattiamd.com/exercising-for-longevity-peter-on-zone-2-and-zone-5-training/&#34;&gt;Peter Attia on Zone 2 and Zone 5 Training&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;I’m also trying out the “12-3-30” treadmill routine (12 % incline, 3 mph, 30 minutes)—it’s a solid low-impact cardio session. Walking uphill at that incline engages your calves, quads, hamstrings, and glutes while steadily elevating your heart rate, making it an accessible way to boost aerobic fitness and leg strength.&lt;/p&gt;
&lt;p&gt;My next goals:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Hit a sub-25:00 5K (current record: just under 30 minutes).&lt;/li&gt;
&lt;li&gt;Improve aerobic endurance, not just speed—fast is fun, but I want to run longer and recover better.&lt;/li&gt;
&lt;li&gt;Stretch more (and maybe read while I do it).&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;I’m not training for a race right now, but I like having milestones to track. We’ll see how far this momentum goes.&lt;/p&gt;
</description>
      <content:encoded>&lt;p&gt;This past month I hit two personal records for my mile time:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;June 4: 7:48&lt;/li&gt;
&lt;li&gt;June 14: 7:27&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Sub-7:30! I’m getting much faster. What’s interesting is that the bottleneck keeps changing. A few months ago it was my legs; these days it’s my cardio. I can now hold 9 mph for 2–3 minutes, but afterward my heart and lungs work harder than my legs.&lt;/p&gt;
&lt;p&gt;Interval training has been a big help—sprinting in short bursts makes me more comfortable hitting Zone 5 and holding longer strides. Now I need to switch gears and build a stronger base with more Zone 2 runs (easy pace, longer distances). Zone 2 work is great for improving base endurance—see &lt;a href=&#34;https://peterattiamd.com/exercising-for-longevity-peter-on-zone-2-and-zone-5-training/&#34;&gt;Peter Attia on Zone 2 and Zone 5 Training&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;I’m also trying out the “12-3-30” treadmill routine (12 % incline, 3 mph, 30 minutes)—it’s a solid low-impact cardio session. Walking uphill at that incline engages your calves, quads, hamstrings, and glutes while steadily elevating your heart rate, making it an accessible way to boost aerobic fitness and leg strength.&lt;/p&gt;
&lt;p&gt;My next goals:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Hit a sub-25:00 5K (current record: just under 30 minutes).&lt;/li&gt;
&lt;li&gt;Improve aerobic endurance, not just speed—fast is fun, but I want to run longer and recover better.&lt;/li&gt;
&lt;li&gt;Stretch more (and maybe read while I do it).&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;I’m not training for a race right now, but I like having milestones to track. We’ll see how far this momentum goes.&lt;/p&gt;
</content:encoded>
    </item>
    
    <item>
      <title>Writing is fun again (with LLMs)</title>
      <link>https://misfra.me/2025/writing-is-fun-again-with-llms/</link>
      <guid isPermaLink="true">https://misfra.me/2025/writing-is-fun-again-with-llms/</guid>
      <pubDate>Fri, 06 Jun 2025 00:00:00 &#43;0000</pubDate>
      <dc:creator>Preetam Jinka</dc:creator>
      <category>Reflection</category>
      
      <description>&lt;p&gt;After I started &lt;a href=&#34;https://funnelstory.ai/&#34;&gt;FunnelStory&lt;/a&gt;, I just stopped writing. As a founder, you always have a list of ten other things that need to get done, and writing never felt like the most important one. It took up too much time. Ever since I started using LLMs for writing, though, I&amp;rsquo;ve found a flow that works. It’s becoming fun, and I&amp;rsquo;m now writing more.&lt;/p&gt;
&lt;p&gt;To be clear, I&amp;rsquo;m not using these tools for lazy content generation. I don&amp;rsquo;t just give it a title, copy and paste the result, and call it a day. That would be creating &lt;a href=&#34;https://en.wikipedia.org/wiki/AI_slop&#34;&gt;AI slop&lt;/a&gt;, and it defeats the entire purpose of having a personal blog where I share my own thoughts.&lt;/p&gt;
&lt;p&gt;Writing is really two different things. First, there&amp;rsquo;s the work of figuring out what you want to say. You have a concept, you think through the main points, and you figure out how to make it all flow. This takes time. Second, you have to actually put the words on the page, which is mostly just typing.&lt;/p&gt;
&lt;p&gt;For me, the fun in writing is the process. It&amp;rsquo;s enjoyable to take a concept, think deeply about it, really digest it down, and then share it for others to read and comment on. LLMs take away the grunt work and give me more time for the actual thinking. They even help with the digesting part, since I can go back and forth on ideas with them.&lt;/p&gt;
&lt;p&gt;It reminds me of when &lt;a href=&#34;https://www.linkedin.com/in/nathankontny/&#34;&gt;Nate Kontny&lt;/a&gt; had Draftin.com, a writing app where you could pay $5 and get someone to review your writing for 15 minutes. He said it was like having a college-educated friend read your work. Having an LLM is like that, but it costs way less than $5 and it’s there all the time.&lt;/p&gt;
&lt;p&gt;Now I find myself writing a lot more. The ideas and points are still mine, but I have a helper to get the words down and act as a feedback partner. I’d rather have this, where I can get one or two posts out a month, instead of doing it all by myself and maybe publishing one thing a year.&lt;/p&gt;
&lt;p&gt;I do wish all the text sounded more like me, though. But I think there are ways to improve that with better prompting or even fine-tuning. I need to experiment. If I figure it out, I&amp;rsquo;ll make sure to share what works in a future post.&lt;/p&gt;
</description>
      <content:encoded>&lt;p&gt;After I started &lt;a href=&#34;https://funnelstory.ai/&#34;&gt;FunnelStory&lt;/a&gt;, I just stopped writing. As a founder, you always have a list of ten other things that need to get done, and writing never felt like the most important one. It took up too much time. Ever since I started using LLMs for writing, though, I&amp;rsquo;ve found a flow that works. It’s becoming fun, and I&amp;rsquo;m now writing more.&lt;/p&gt;
&lt;p&gt;To be clear, I&amp;rsquo;m not using these tools for lazy content generation. I don&amp;rsquo;t just give it a title, copy and paste the result, and call it a day. That would be creating &lt;a href=&#34;https://en.wikipedia.org/wiki/AI_slop&#34;&gt;AI slop&lt;/a&gt;, and it defeats the entire purpose of having a personal blog where I share my own thoughts.&lt;/p&gt;
&lt;p&gt;Writing is really two different things. First, there&amp;rsquo;s the work of figuring out what you want to say. You have a concept, you think through the main points, and you figure out how to make it all flow. This takes time. Second, you have to actually put the words on the page, which is mostly just typing.&lt;/p&gt;
&lt;p&gt;For me, the fun in writing is the process. It&amp;rsquo;s enjoyable to take a concept, think deeply about it, really digest it down, and then share it for others to read and comment on. LLMs take away the grunt work and give me more time for the actual thinking. They even help with the digesting part, since I can go back and forth on ideas with them.&lt;/p&gt;
&lt;p&gt;It reminds me of when &lt;a href=&#34;https://www.linkedin.com/in/nathankontny/&#34;&gt;Nate Kontny&lt;/a&gt; had Draftin.com, a writing app where you could pay $5 and get someone to review your writing for 15 minutes. He said it was like having a college-educated friend read your work. Having an LLM is like that, but it costs way less than $5 and it’s there all the time.&lt;/p&gt;
&lt;p&gt;Now I find myself writing a lot more. The ideas and points are still mine, but I have a helper to get the words down and act as a feedback partner. I’d rather have this, where I can get one or two posts out a month, instead of doing it all by myself and maybe publishing one thing a year.&lt;/p&gt;
&lt;p&gt;I do wish all the text sounded more like me, though. But I think there are ways to improve that with better prompting or even fine-tuning. I need to experiment. If I figure it out, I&amp;rsquo;ll make sure to share what works in a future post.&lt;/p&gt;
</content:encoded>
    </item>
    
    <item>
      <title>SQLite Transactions and Virtual Tables</title>
      <link>https://misfra.me/2025/sqlite-transactions-and-virtual-tables/</link>
      <guid isPermaLink="true">https://misfra.me/2025/sqlite-transactions-and-virtual-tables/</guid>
      <pubDate>Thu, 17 Apr 2025 00:00:00 &#43;0000</pubDate>
      <dc:creator>Preetam Jinka</dc:creator>
      <category>Programming</category>
      
      <description>&lt;p&gt;In my &lt;a href=&#34;https://misfra.me/2025/virtual-tables-in-sqlite-with-go/&#34;&gt;previous post&lt;/a&gt; I introduced SQL virtual tables and how to use them in Go—registering modules per connection, defining schemas, and querying external sources as regular tables.&lt;/p&gt;
&lt;p&gt;Now let’s dive into more advanced virtual-table implementations: those that support writes and full transactional behavior.&lt;/p&gt;
&lt;h3 id=&#34;writes-and-transaction-support-in-virtual-tables&#34;&gt;Writes and Transaction Support in Virtual Tables&lt;/h3&gt;
&lt;p&gt;SQLite’s virtual-table interface isn’t read-only. By implementing &lt;a href=&#34;https://sqlite.org/vtab.html#xupdate&#34;&gt;&lt;code&gt;xUpdate&lt;/code&gt;&lt;/a&gt; you can expose writable tables over any data source. But true transactional integrity requires more than just row-level updates—it requires hooks for transaction boundaries:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;&lt;code&gt;xBegin&lt;/code&gt;&lt;/strong&gt;: Signal the start of a transaction.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;&lt;code&gt;xSync&lt;/code&gt;&lt;/strong&gt;: Prepare work for a durable commit; failures here abort everything.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;&lt;code&gt;xCommit&lt;/code&gt;&lt;/strong&gt;: Finalize the transaction (cleanup only).&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;&lt;code&gt;xRollback&lt;/code&gt;&lt;/strong&gt;: Revert changes if the transaction is aborted.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;But what happens when your virtual table is modified alongside other virtual tables—or normal tables? How does SQLite ensure everything commits or rolls back atomically?&lt;/p&gt;
&lt;h3 id=&#34;sqlite-transactions-under-the-hood&#34;&gt;SQLite Transactions Under the Hood&lt;/h3&gt;
&lt;p&gt;Before tackling vtable hooks, let’s review how SQLite handles transactions by default.&lt;/p&gt;
&lt;h4 id=&#34;rollback-journals&#34;&gt;Rollback Journals&lt;/h4&gt;
&lt;p&gt;In its simplest mode, SQLite uses a rollback journal. Before overwriting any page, it writes the original page to a journal file. If something goes wrong, SQLite restores from the journal to guarantee atomicity.&lt;/p&gt;
&lt;p&gt;&lt;em&gt;Note: SQLite also supports WAL mode, but that’s outside the scope of this post.&lt;/em&gt;&lt;/p&gt;
&lt;h4 id=&#34;super-journals-for-multiple-databases&#34;&gt;Super-Journals for Multiple Databases&lt;/h4&gt;
&lt;p&gt;If you attach additional databases, a single rollback journal per file can’t coordinate commits across them. Enter the super-journal: a top-level journal file that spans all affected databases, ensuring a multi-file commit remains atomic.&lt;/p&gt;
&lt;p&gt;For multiple virtual tables within the same database file, however, the standard rollback journal suffices; no super-journal is required. In all cases—whether multiple vtables in one file or across attached databases—virtual-table hooks (&lt;code&gt;xSync&lt;/code&gt;, &lt;code&gt;xCommit&lt;/code&gt;, &lt;code&gt;xRollback&lt;/code&gt;) are invoked as part of SQLite’s transaction process.&lt;/p&gt;
&lt;h3 id=&#34;two-phase-commit-with-virtual-tables&#34;&gt;Two-Phase Commit with Virtual Tables&lt;/h3&gt;
&lt;p&gt;SQLite’s two-phase commit breaks down as follows:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Phase One (&lt;code&gt;xSync&lt;/code&gt;)&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;SQLite writes and syncs all pages (or journals) to disk for every B-tree and attached database.&lt;/li&gt;
&lt;li&gt;For virtual tables, it invokes each module’s &lt;code&gt;xSync&lt;/code&gt; hook. If any &lt;code&gt;xSync&lt;/code&gt; fails, the entire transaction is rolled back—atomicity is preserved.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Phase Two (Cleanup)&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Once durability is guaranteed, SQLite cleans up journal files and finalizes the commit.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;Below is the core of phase-two logic from &lt;a href=&#34;https://github.com/sqlite/sqlite/blob/dc2d79f80fab9bda99ad95f4c7de752feefa927a/src/vdbeaux.c#L3141-L3159&#34;&gt;&lt;code&gt;vdbeaux.c&lt;/code&gt;&lt;/a&gt;. Notice that errors are deliberately ignored—this is purely cleanup:&lt;/p&gt;
&lt;pre&gt;&lt;code class=&#34;language-c&#34;&gt;/* All files and directories have already been synced, so the following
** calls to sqlite3BtreeCommitPhaseTwo() are only closing files and
** deleting or truncating journals. If something goes wrong while
** this is happening we don&#39;t really care. The integrity of the
** transaction is already guaranteed, but some stray &#39;cold&#39; journals
** may be lying around. Returning an error code won&#39;t help matters.
*/
disable_simulated_io_errors();
sqlite3BeginBenignMalloc();
for(i=0; i&amp;lt;db-&amp;gt;nDb; i++){
  Btree *pBt = db-&amp;gt;aDb[i].pBt;
  if( pBt ){
    sqlite3BtreeCommitPhaseTwo(pBt, 1);
  }
}
sqlite3EndBenignMalloc();
enable_simulated_io_errors();

/* Now perform virtual-table cleanup */
sqlite3VtabCommit(db);
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;And in &lt;a href=&#34;https://github.com/sqlite/sqlite/blob/dc2d79f80fab9bda99ad95f4c7de752feefa927a/src/vtab.c#L1016-L1032&#34;&gt;&lt;code&gt;vtab.c&lt;/code&gt;&lt;/a&gt;, the virtual-table commit hook is similarly treated as best-effort:&lt;/p&gt;
&lt;pre&gt;&lt;code class=&#34;language-c&#34;&gt;/* From vtab.c: errors in xCommit are ignored—this is purely cleanup. */
int sqlite3VtabCommit(sqlite3 *db){
  callFinaliser(db, offsetof(sqlite3_module,xCommit));
  return SQLITE_OK;
}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Because &lt;code&gt;xSync&lt;/code&gt; already ensured all data is safely on disk, SQLite ignores return codes from &lt;code&gt;xCommit&lt;/code&gt; and &lt;code&gt;xRollback&lt;/code&gt;. These hooks should only remove temporary state (journals, locks) and must not perform work that can fail.&lt;/p&gt;
&lt;h3 id=&#34;implications-for-virtual-table-authors&#34;&gt;Implications for Virtual-Table Authors&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Durability must go in &lt;code&gt;xSync&lt;/code&gt;.&lt;/strong&gt; Anything that can fail—network I/O, disk writes—belongs in &lt;code&gt;xSync&lt;/code&gt; so errors here abort the transaction.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;&lt;code&gt;xRollback&lt;/code&gt; may still be called after &lt;code&gt;xSync&lt;/code&gt;.&lt;/strong&gt; Even though xSync needs to take care of durability, operations may still need to be rolled back if another &lt;code&gt;xSync&lt;/code&gt; failed.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Keep &lt;code&gt;xCommit&lt;/code&gt; and &lt;code&gt;xRollback&lt;/code&gt; idempotent.&lt;/strong&gt; Perform only cleanup; avoid any operation that can fail.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;By now, you should understand how SQLite’s rollback and super-journal mechanisms coordinate atomic commits, and how your virtual tables hook into that two-phase process to ensure consistency across both built-in and custom tables.&lt;/p&gt;
</description>
      <content:encoded>&lt;p&gt;In my &lt;a href=&#34;https://misfra.me/2025/virtual-tables-in-sqlite-with-go/&#34;&gt;previous post&lt;/a&gt; I introduced SQL virtual tables and how to use them in Go—registering modules per connection, defining schemas, and querying external sources as regular tables.&lt;/p&gt;
&lt;p&gt;Now let’s dive into more advanced virtual-table implementations: those that support writes and full transactional behavior.&lt;/p&gt;
&lt;h3 id=&#34;writes-and-transaction-support-in-virtual-tables&#34;&gt;Writes and Transaction Support in Virtual Tables&lt;/h3&gt;
&lt;p&gt;SQLite’s virtual-table interface isn’t read-only. By implementing &lt;a href=&#34;https://sqlite.org/vtab.html#xupdate&#34;&gt;&lt;code&gt;xUpdate&lt;/code&gt;&lt;/a&gt; you can expose writable tables over any data source. But true transactional integrity requires more than just row-level updates—it requires hooks for transaction boundaries:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;&lt;code&gt;xBegin&lt;/code&gt;&lt;/strong&gt;: Signal the start of a transaction.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;&lt;code&gt;xSync&lt;/code&gt;&lt;/strong&gt;: Prepare work for a durable commit; failures here abort everything.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;&lt;code&gt;xCommit&lt;/code&gt;&lt;/strong&gt;: Finalize the transaction (cleanup only).&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;&lt;code&gt;xRollback&lt;/code&gt;&lt;/strong&gt;: Revert changes if the transaction is aborted.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;But what happens when your virtual table is modified alongside other virtual tables—or normal tables? How does SQLite ensure everything commits or rolls back atomically?&lt;/p&gt;
&lt;h3 id=&#34;sqlite-transactions-under-the-hood&#34;&gt;SQLite Transactions Under the Hood&lt;/h3&gt;
&lt;p&gt;Before tackling vtable hooks, let’s review how SQLite handles transactions by default.&lt;/p&gt;
&lt;h4 id=&#34;rollback-journals&#34;&gt;Rollback Journals&lt;/h4&gt;
&lt;p&gt;In its simplest mode, SQLite uses a rollback journal. Before overwriting any page, it writes the original page to a journal file. If something goes wrong, SQLite restores from the journal to guarantee atomicity.&lt;/p&gt;
&lt;p&gt;&lt;em&gt;Note: SQLite also supports WAL mode, but that’s outside the scope of this post.&lt;/em&gt;&lt;/p&gt;
&lt;h4 id=&#34;super-journals-for-multiple-databases&#34;&gt;Super-Journals for Multiple Databases&lt;/h4&gt;
&lt;p&gt;If you attach additional databases, a single rollback journal per file can’t coordinate commits across them. Enter the super-journal: a top-level journal file that spans all affected databases, ensuring a multi-file commit remains atomic.&lt;/p&gt;
&lt;p&gt;For multiple virtual tables within the same database file, however, the standard rollback journal suffices; no super-journal is required. In all cases—whether multiple vtables in one file or across attached databases—virtual-table hooks (&lt;code&gt;xSync&lt;/code&gt;, &lt;code&gt;xCommit&lt;/code&gt;, &lt;code&gt;xRollback&lt;/code&gt;) are invoked as part of SQLite’s transaction process.&lt;/p&gt;
&lt;h3 id=&#34;two-phase-commit-with-virtual-tables&#34;&gt;Two-Phase Commit with Virtual Tables&lt;/h3&gt;
&lt;p&gt;SQLite’s two-phase commit breaks down as follows:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Phase One (&lt;code&gt;xSync&lt;/code&gt;)&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;SQLite writes and syncs all pages (or journals) to disk for every B-tree and attached database.&lt;/li&gt;
&lt;li&gt;For virtual tables, it invokes each module’s &lt;code&gt;xSync&lt;/code&gt; hook. If any &lt;code&gt;xSync&lt;/code&gt; fails, the entire transaction is rolled back—atomicity is preserved.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Phase Two (Cleanup)&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Once durability is guaranteed, SQLite cleans up journal files and finalizes the commit.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;Below is the core of phase-two logic from &lt;a href=&#34;https://github.com/sqlite/sqlite/blob/dc2d79f80fab9bda99ad95f4c7de752feefa927a/src/vdbeaux.c#L3141-L3159&#34;&gt;&lt;code&gt;vdbeaux.c&lt;/code&gt;&lt;/a&gt;. Notice that errors are deliberately ignored—this is purely cleanup:&lt;/p&gt;
&lt;pre&gt;&lt;code class=&#34;language-c&#34;&gt;/* All files and directories have already been synced, so the following
** calls to sqlite3BtreeCommitPhaseTwo() are only closing files and
** deleting or truncating journals. If something goes wrong while
** this is happening we don&#39;t really care. The integrity of the
** transaction is already guaranteed, but some stray &#39;cold&#39; journals
** may be lying around. Returning an error code won&#39;t help matters.
*/
disable_simulated_io_errors();
sqlite3BeginBenignMalloc();
for(i=0; i&amp;lt;db-&amp;gt;nDb; i++){
  Btree *pBt = db-&amp;gt;aDb[i].pBt;
  if( pBt ){
    sqlite3BtreeCommitPhaseTwo(pBt, 1);
  }
}
sqlite3EndBenignMalloc();
enable_simulated_io_errors();

/* Now perform virtual-table cleanup */
sqlite3VtabCommit(db);
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;And in &lt;a href=&#34;https://github.com/sqlite/sqlite/blob/dc2d79f80fab9bda99ad95f4c7de752feefa927a/src/vtab.c#L1016-L1032&#34;&gt;&lt;code&gt;vtab.c&lt;/code&gt;&lt;/a&gt;, the virtual-table commit hook is similarly treated as best-effort:&lt;/p&gt;
&lt;pre&gt;&lt;code class=&#34;language-c&#34;&gt;/* From vtab.c: errors in xCommit are ignored—this is purely cleanup. */
int sqlite3VtabCommit(sqlite3 *db){
  callFinaliser(db, offsetof(sqlite3_module,xCommit));
  return SQLITE_OK;
}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Because &lt;code&gt;xSync&lt;/code&gt; already ensured all data is safely on disk, SQLite ignores return codes from &lt;code&gt;xCommit&lt;/code&gt; and &lt;code&gt;xRollback&lt;/code&gt;. These hooks should only remove temporary state (journals, locks) and must not perform work that can fail.&lt;/p&gt;
&lt;h3 id=&#34;implications-for-virtual-table-authors&#34;&gt;Implications for Virtual-Table Authors&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Durability must go in &lt;code&gt;xSync&lt;/code&gt;.&lt;/strong&gt; Anything that can fail—network I/O, disk writes—belongs in &lt;code&gt;xSync&lt;/code&gt; so errors here abort the transaction.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;&lt;code&gt;xRollback&lt;/code&gt; may still be called after &lt;code&gt;xSync&lt;/code&gt;.&lt;/strong&gt; Even though xSync needs to take care of durability, operations may still need to be rolled back if another &lt;code&gt;xSync&lt;/code&gt; failed.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Keep &lt;code&gt;xCommit&lt;/code&gt; and &lt;code&gt;xRollback&lt;/code&gt; idempotent.&lt;/strong&gt; Perform only cleanup; avoid any operation that can fail.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;By now, you should understand how SQLite’s rollback and super-journal mechanisms coordinate atomic commits, and how your virtual tables hook into that two-phase process to ensure consistency across both built-in and custom tables.&lt;/p&gt;
</content:encoded>
    </item>
    
    <item>
      <title>The 3 Stages of Startup Enlightenment</title>
      <link>https://misfra.me/2025/3-stages-startup-enlightenment/</link>
      <guid isPermaLink="true">https://misfra.me/2025/3-stages-startup-enlightenment/</guid>
      <pubDate>Sun, 16 Mar 2025 00:00:00 &#43;0000</pubDate>
      <dc:creator>Preetam Jinka</dc:creator>
      <category>Reflection</category>
      
      <description>&lt;p&gt;When I joined my second startup as a full-time engineer, I noticed something interesting about how my understanding evolved. I spent over five years at VividCortex—a database observability platform similar to Datadog or New Relic—before moving to ShiftLeft, an application security startup. At VividCortex, I was deep into databases and observability. But at ShiftLeft, I had to learn the language of security from scratch. At first, I didn’t even know that some of the static analysis solutions we were building were possible. Terms like RASP, SCA, SAST, and DAST were completely new to me, and it took months to grasp their differences and trade-offs. Eventually, I understood why we chose SAST and what the name &amp;ldquo;ShiftLeft&amp;rdquo; actually meant.&lt;/p&gt;
&lt;p&gt;Over time, I realized startup engineers go through three distinct stages of understanding:&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Stage 1: Laying the Foundation&lt;/strong&gt;&lt;br&gt;
In this initial stage, you’re answering basic but critical questions: What exactly are we building? Who is it for? How are users actually using it? At ShiftLeft, this meant immersing myself in security terminology and learning entirely new concepts. At first, everyone around you seems like an expert, simply because they speak a language you&amp;rsquo;re still trying to decode. You’re mostly absorbing information and trying to get oriented.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Stage 2: Evaluating the Product&lt;/strong&gt;&lt;br&gt;
Once you&amp;rsquo;ve learned the fundamentals, you move into evaluating what’s actually built. Startups typically go through a period of rapid iteration to find product-market fit—experimenting frequently and discarding ideas quickly. As a result, the final product often contains engineering vestiges from earlier attempts. At this stage, if something about the product seems odd or confusing, you begin to realize it’s not necessarily due to your lack of understanding—maybe it just wasn’t implemented correctly. You become comfortable forming your own opinions. You realize not everyone is an expert, and some decisions were simply compromises or mistakes made along the way.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Stage 3: Achieving Enlightenment&lt;/strong&gt;&lt;br&gt;
After several years, you reach a point where your understanding goes beyond what already exists. By now you have deep insights into your customers, the product, and the broader market. You start to clearly see gaps, and you begin to form strong ideas about how things can be improved. This stage is about recognizing what&amp;rsquo;s possible, rather than accepting things as they are. It takes real depth—usually at least three or four years—to get to this level of understanding.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Takeaways&lt;/strong&gt;&lt;br&gt;
If you&amp;rsquo;re interested in solving hard problems and deeply understanding a space, you have to push through the first two stages. Without investing that time, your understanding remains shallow, stuck at the surface. Spending about four years at one company can give you enough depth to genuinely innovate and shape the future of the product. If you hop between companies every year or two, you might never reach the stage of true enlightenment—where you don&amp;rsquo;t just understand the problems deeply, but can actually start solving them.&lt;/p&gt;
</description>
      <content:encoded>&lt;p&gt;When I joined my second startup as a full-time engineer, I noticed something interesting about how my understanding evolved. I spent over five years at VividCortex—a database observability platform similar to Datadog or New Relic—before moving to ShiftLeft, an application security startup. At VividCortex, I was deep into databases and observability. But at ShiftLeft, I had to learn the language of security from scratch. At first, I didn’t even know that some of the static analysis solutions we were building were possible. Terms like RASP, SCA, SAST, and DAST were completely new to me, and it took months to grasp their differences and trade-offs. Eventually, I understood why we chose SAST and what the name &amp;ldquo;ShiftLeft&amp;rdquo; actually meant.&lt;/p&gt;
&lt;p&gt;Over time, I realized startup engineers go through three distinct stages of understanding:&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Stage 1: Laying the Foundation&lt;/strong&gt;&lt;br&gt;
In this initial stage, you’re answering basic but critical questions: What exactly are we building? Who is it for? How are users actually using it? At ShiftLeft, this meant immersing myself in security terminology and learning entirely new concepts. At first, everyone around you seems like an expert, simply because they speak a language you&amp;rsquo;re still trying to decode. You’re mostly absorbing information and trying to get oriented.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Stage 2: Evaluating the Product&lt;/strong&gt;&lt;br&gt;
Once you&amp;rsquo;ve learned the fundamentals, you move into evaluating what’s actually built. Startups typically go through a period of rapid iteration to find product-market fit—experimenting frequently and discarding ideas quickly. As a result, the final product often contains engineering vestiges from earlier attempts. At this stage, if something about the product seems odd or confusing, you begin to realize it’s not necessarily due to your lack of understanding—maybe it just wasn’t implemented correctly. You become comfortable forming your own opinions. You realize not everyone is an expert, and some decisions were simply compromises or mistakes made along the way.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Stage 3: Achieving Enlightenment&lt;/strong&gt;&lt;br&gt;
After several years, you reach a point where your understanding goes beyond what already exists. By now you have deep insights into your customers, the product, and the broader market. You start to clearly see gaps, and you begin to form strong ideas about how things can be improved. This stage is about recognizing what&amp;rsquo;s possible, rather than accepting things as they are. It takes real depth—usually at least three or four years—to get to this level of understanding.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Takeaways&lt;/strong&gt;&lt;br&gt;
If you&amp;rsquo;re interested in solving hard problems and deeply understanding a space, you have to push through the first two stages. Without investing that time, your understanding remains shallow, stuck at the surface. Spending about four years at one company can give you enough depth to genuinely innovate and shape the future of the product. If you hop between companies every year or two, you might never reach the stage of true enlightenment—where you don&amp;rsquo;t just understand the problems deeply, but can actually start solving them.&lt;/p&gt;
</content:encoded>
    </item>
    
    <item>
      <title>Virtual Tables in SQLite with Go</title>
      <link>https://misfra.me/2025/virtual-tables-in-sqlite-with-go/</link>
      <guid isPermaLink="true">https://misfra.me/2025/virtual-tables-in-sqlite-with-go/</guid>
      <pubDate>Wed, 19 Feb 2025 00:00:00 &#43;0000</pubDate>
      <dc:creator>Preetam Jinka</dc:creator>
      <category>Programming</category>
      
      <description>&lt;p&gt;SQLite’s virtual tables let you expose external data sources as if they were normal tables. The &lt;a href=&#34;https://github.com/mattn/go-sqlite3&#34;&gt;go-sqlite3&lt;/a&gt; package includes an &lt;a href=&#34;https://github.com/mattn/go-sqlite3/blob/7658c06970ecf5588d8cd930ed1f2de7223f1010/_example/vtable/main.go&#34;&gt;example&lt;/a&gt; of how to register a custom module, but it doesn’t cover cases where you need to initialize the module differently per connection.&lt;/p&gt;
&lt;p&gt;A common use case is multitenancy—where each database connection needs its own configuration, like an API key. The standard approach of registering a virtual table using &lt;code&gt;ConnectHook&lt;/code&gt; applies globally, making it difficult to provide per-connection parameters dynamically. Instead, we can wrap the SQLite driver in a &lt;code&gt;driver.Connector&lt;/code&gt; and use &lt;code&gt;sql.OpenDB&lt;/code&gt;, allowing each instance of SQLite to behave differently.&lt;/p&gt;
&lt;h3 id=&#34;the-problem&#34;&gt;The Problem&lt;/h3&gt;
&lt;p&gt;If you register a virtual table globally using &lt;code&gt;ConnectHook&lt;/code&gt;, every connection to the database gets the same setup. This works fine for things like defining a custom SQL function (e.g., adding regex support), but not if you need connection-specific behavior.&lt;/p&gt;
&lt;p&gt;For example, say you’re building a virtual table that pulls data from an external API, and each tenant has a different API key. The table should return different results depending on which tenant&amp;rsquo;s key is in use. But with &lt;code&gt;ConnectHook&lt;/code&gt;, there&amp;rsquo;s no clean way to register a new module per tenant dynamically.&lt;/p&gt;
&lt;h3 id=&#34;the-solution-using-a-driverconnector-wrapper&#34;&gt;The Solution: Using a &lt;code&gt;driver.Connector&lt;/code&gt; Wrapper&lt;/h3&gt;
&lt;p&gt;To demonstrate, here’s a proof-of-concept where a virtual table returns different data based on an initialized runtime parameter. You can imagine this being an API key, where each connection gets a unique key, and the virtual table fetches different data accordingly.&lt;/p&gt;
&lt;h4 id=&#34;full-program&#34;&gt;Full Program&lt;/h4&gt;
&lt;pre&gt;&lt;code class=&#34;language-go&#34;&gt;package main

import (
	&amp;quot;context&amp;quot;
	&amp;quot;database/sql&amp;quot;
	&amp;quot;database/sql/driver&amp;quot;
	&amp;quot;fmt&amp;quot;
	&amp;quot;log&amp;quot;

	&amp;quot;github.com/mattn/go-sqlite3&amp;quot;
)

// SQLiteConnector wraps the SQLite driver and registers virtual table modules.
type SQLiteConnector struct {
	driver *sqlite3.SQLiteDriver
}

// Connect creates a new SQLite connection.
func (s *SQLiteConnector) Connect(ctx context.Context) (driver.Conn, error) {
	return s.driver.Open(&amp;quot;&amp;quot;)
}

// Driver returns the underlying driver.
func (s *SQLiteConnector) Driver() driver.Driver {
	return s.driver
}

// NewSQLiteConnector returns a connector that registers the provided modules.
func NewSQLiteConnector(modules map[string]sqlite3.Module) *SQLiteConnector {
	d := &amp;amp;sqlite3.SQLiteDriver{
		ConnectHook: func(conn *sqlite3.SQLiteConn) error {
			for name, module := range modules {
				if err := conn.CreateModule(name, module); err != nil {
					return err
				}
			}
			return nil
		},
	}
	return &amp;amp;SQLiteConnector{driver: d}
}

// exampleModule implements a virtual table module that returns data based on a parameter.
type exampleModule struct {
	param string
}

// Create declares the virtual table schema.
func (m *exampleModule) Create(c *sqlite3.SQLiteConn, args []string) (sqlite3.VTab, error) {
	schema := fmt.Sprintf(&amp;quot;CREATE TABLE %s (value TEXT)&amp;quot;, args[0])
	if err := c.DeclareVTab(schema); err != nil {
		return nil, err
	}
	return &amp;amp;exampleTable{param: m.param}, nil
}

// Connect is the same as Create.
func (m *exampleModule) Connect(c *sqlite3.SQLiteConn, args []string) (sqlite3.VTab, error) {
	return m.Create(c, args)
}

// DestroyModule is a no-op.
func (m *exampleModule) DestroyModule() {}

// exampleTable holds the parameter that influences query results.
type exampleTable struct {
	param string
}

// Open returns a cursor that iterates over example data.
func (t *exampleTable) Open() (sqlite3.VTabCursor, error) {
	return &amp;amp;exampleCursor{param: t.param, index: 0, data: []string{&amp;quot;foo&amp;quot;, &amp;quot;bar&amp;quot;, &amp;quot;baz&amp;quot;}}, nil
}

// BestIndex provides a default index result.
func (t *exampleTable) BestIndex(csts []sqlite3.InfoConstraint, ob []sqlite3.InfoOrderBy) (*sqlite3.IndexResult, error) {
	return &amp;amp;sqlite3.IndexResult{IdxNum: 0, IdxStr: &amp;quot;default&amp;quot;}, nil
}

func (t *exampleTable) Disconnect() error { return nil }
func (t *exampleTable) Destroy() error    { return nil }

// exampleCursor iterates over the dataset.
type exampleCursor struct {
	param string
	index int
	data  []string
}

// Column returns the value for the given column.
func (cur *exampleCursor) Column(ctx *sqlite3.SQLiteContext, col int) error {
	ctx.ResultText(fmt.Sprintf(&amp;quot;%s_%s&amp;quot;, cur.param, cur.data[cur.index]))
	return nil
}

// Filter resets the cursor.
func (cur *exampleCursor) Filter(idxNum int, idxStr string, vals []any) error {
	cur.index = 0
	return nil
}

// Next advances the cursor.
func (cur *exampleCursor) Next() error {
	cur.index++
	return nil
}

// EOF returns true if all rows have been iterated.
func (cur *exampleCursor) EOF() bool {
	return cur.index &amp;gt;= len(cur.data)
}

// Rowid returns the current row id.
func (cur *exampleCursor) Rowid() (int64, error) {
	return int64(cur.index), nil
}

// Close cleans up the cursor (no-op in this case).
func (cur *exampleCursor) Close() error {
	return nil
}

func main() {
	run(&amp;quot;tenantA&amp;quot;)
	run(&amp;quot;tenantB&amp;quot;)
}

func run(param string) {
	// Create a new SQLite connector with the &amp;quot;example&amp;quot; module registered.
	db := sql.OpenDB(NewSQLiteConnector(map[string]sqlite3.Module{
		&amp;quot;example&amp;quot;: &amp;amp;exampleModule{param: param},
	}))
	defer db.Close()

	// Create the virtual table using the registered module.
	_, err := db.Exec(&amp;quot;CREATE VIRTUAL TABLE example_table USING example&amp;quot;)
	if err != nil {
		log.Fatal(err)
	}

	// Query the virtual table.
	rows, err := db.Query(&amp;quot;SELECT value FROM example_table&amp;quot;)
	if err != nil {
		log.Fatal(err)
	}
	defer rows.Close()

	// Display the results.
	fmt.Printf(&amp;quot;Results for %s:\n&amp;quot;, param)
	for rows.Next() {
		var value string
		if err := rows.Scan(&amp;amp;value); err != nil {
			log.Fatal(err)
		}
		fmt.Println(value)
	}
}
&lt;/code&gt;&lt;/pre&gt;
&lt;h3 id=&#34;running-the-example&#34;&gt;Running the Example&lt;/h3&gt;
&lt;p&gt;Since virtual tables require a specific build tag in &lt;code&gt;go-sqlite3&lt;/code&gt;, you have to run the program like this:&lt;/p&gt;
&lt;pre&gt;&lt;code class=&#34;language-sh&#34;&gt;go run -tags &#39;sqlite_vtable&#39; main.go
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;You should see this as the output:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;Results for tenantA:
tenantA_foo
tenantA_bar
tenantA_baz
Results for tenantB:
tenantB_foo
tenantB_bar
tenantB_baz
&lt;/code&gt;&lt;/pre&gt;
&lt;h3 id=&#34;how-it-works&#34;&gt;How It Works&lt;/h3&gt;
&lt;p&gt;Instead of relying on &lt;code&gt;ConnectHook&lt;/code&gt; at the global level, this approach uses &lt;code&gt;sql.OpenDB&lt;/code&gt; with a custom connector, allowing each database instance to register its own virtual table module with unique runtime parameters.&lt;/p&gt;
&lt;p&gt;In the example above, we initialize two separate SQLite instances, one for &lt;code&gt;&amp;quot;tenantA&amp;quot;&lt;/code&gt; and one for &lt;code&gt;&amp;quot;tenantB&amp;quot;&lt;/code&gt;. Each instance registers the &lt;code&gt;&amp;quot;example&amp;quot;&lt;/code&gt; module with a different value for &lt;code&gt;param&lt;/code&gt;. When queried, the virtual table returns results that incorporate the parameter—just like an API-driven virtual table would behave differently based on the API key in use.&lt;/p&gt;
&lt;p&gt;This method provides flexibility when working with SQLite in multitenant applications, enabling per-connection behavior without modifying the global driver state.&lt;/p&gt;
&lt;hr&gt;
&lt;p&gt;With this approach, you can dynamically configure SQLite virtual tables at runtime—whether it’s for API-backed datasets, tenant-specific views, or other custom behavior.&lt;/p&gt;</description>
      <content:encoded>&lt;p&gt;SQLite’s virtual tables let you expose external data sources as if they were normal tables. The &lt;a href=&#34;https://github.com/mattn/go-sqlite3&#34;&gt;go-sqlite3&lt;/a&gt; package includes an &lt;a href=&#34;https://github.com/mattn/go-sqlite3/blob/7658c06970ecf5588d8cd930ed1f2de7223f1010/_example/vtable/main.go&#34;&gt;example&lt;/a&gt; of how to register a custom module, but it doesn’t cover cases where you need to initialize the module differently per connection.&lt;/p&gt;
&lt;p&gt;A common use case is multitenancy—where each database connection needs its own configuration, like an API key. The standard approach of registering a virtual table using &lt;code&gt;ConnectHook&lt;/code&gt; applies globally, making it difficult to provide per-connection parameters dynamically. Instead, we can wrap the SQLite driver in a &lt;code&gt;driver.Connector&lt;/code&gt; and use &lt;code&gt;sql.OpenDB&lt;/code&gt;, allowing each instance of SQLite to behave differently.&lt;/p&gt;
&lt;h3 id=&#34;the-problem&#34;&gt;The Problem&lt;/h3&gt;
&lt;p&gt;If you register a virtual table globally using &lt;code&gt;ConnectHook&lt;/code&gt;, every connection to the database gets the same setup. This works fine for things like defining a custom SQL function (e.g., adding regex support), but not if you need connection-specific behavior.&lt;/p&gt;
&lt;p&gt;For example, say you’re building a virtual table that pulls data from an external API, and each tenant has a different API key. The table should return different results depending on which tenant&amp;rsquo;s key is in use. But with &lt;code&gt;ConnectHook&lt;/code&gt;, there&amp;rsquo;s no clean way to register a new module per tenant dynamically.&lt;/p&gt;
&lt;h3 id=&#34;the-solution-using-a-driverconnector-wrapper&#34;&gt;The Solution: Using a &lt;code&gt;driver.Connector&lt;/code&gt; Wrapper&lt;/h3&gt;
&lt;p&gt;To demonstrate, here’s a proof-of-concept where a virtual table returns different data based on an initialized runtime parameter. You can imagine this being an API key, where each connection gets a unique key, and the virtual table fetches different data accordingly.&lt;/p&gt;
&lt;h4 id=&#34;full-program&#34;&gt;Full Program&lt;/h4&gt;
&lt;pre&gt;&lt;code class=&#34;language-go&#34;&gt;package main

import (
	&amp;quot;context&amp;quot;
	&amp;quot;database/sql&amp;quot;
	&amp;quot;database/sql/driver&amp;quot;
	&amp;quot;fmt&amp;quot;
	&amp;quot;log&amp;quot;

	&amp;quot;github.com/mattn/go-sqlite3&amp;quot;
)

// SQLiteConnector wraps the SQLite driver and registers virtual table modules.
type SQLiteConnector struct {
	driver *sqlite3.SQLiteDriver
}

// Connect creates a new SQLite connection.
func (s *SQLiteConnector) Connect(ctx context.Context) (driver.Conn, error) {
	return s.driver.Open(&amp;quot;&amp;quot;)
}

// Driver returns the underlying driver.
func (s *SQLiteConnector) Driver() driver.Driver {
	return s.driver
}

// NewSQLiteConnector returns a connector that registers the provided modules.
func NewSQLiteConnector(modules map[string]sqlite3.Module) *SQLiteConnector {
	d := &amp;amp;sqlite3.SQLiteDriver{
		ConnectHook: func(conn *sqlite3.SQLiteConn) error {
			for name, module := range modules {
				if err := conn.CreateModule(name, module); err != nil {
					return err
				}
			}
			return nil
		},
	}
	return &amp;amp;SQLiteConnector{driver: d}
}

// exampleModule implements a virtual table module that returns data based on a parameter.
type exampleModule struct {
	param string
}

// Create declares the virtual table schema.
func (m *exampleModule) Create(c *sqlite3.SQLiteConn, args []string) (sqlite3.VTab, error) {
	schema := fmt.Sprintf(&amp;quot;CREATE TABLE %s (value TEXT)&amp;quot;, args[0])
	if err := c.DeclareVTab(schema); err != nil {
		return nil, err
	}
	return &amp;amp;exampleTable{param: m.param}, nil
}

// Connect is the same as Create.
func (m *exampleModule) Connect(c *sqlite3.SQLiteConn, args []string) (sqlite3.VTab, error) {
	return m.Create(c, args)
}

// DestroyModule is a no-op.
func (m *exampleModule) DestroyModule() {}

// exampleTable holds the parameter that influences query results.
type exampleTable struct {
	param string
}

// Open returns a cursor that iterates over example data.
func (t *exampleTable) Open() (sqlite3.VTabCursor, error) {
	return &amp;amp;exampleCursor{param: t.param, index: 0, data: []string{&amp;quot;foo&amp;quot;, &amp;quot;bar&amp;quot;, &amp;quot;baz&amp;quot;}}, nil
}

// BestIndex provides a default index result.
func (t *exampleTable) BestIndex(csts []sqlite3.InfoConstraint, ob []sqlite3.InfoOrderBy) (*sqlite3.IndexResult, error) {
	return &amp;amp;sqlite3.IndexResult{IdxNum: 0, IdxStr: &amp;quot;default&amp;quot;}, nil
}

func (t *exampleTable) Disconnect() error { return nil }
func (t *exampleTable) Destroy() error    { return nil }

// exampleCursor iterates over the dataset.
type exampleCursor struct {
	param string
	index int
	data  []string
}

// Column returns the value for the given column.
func (cur *exampleCursor) Column(ctx *sqlite3.SQLiteContext, col int) error {
	ctx.ResultText(fmt.Sprintf(&amp;quot;%s_%s&amp;quot;, cur.param, cur.data[cur.index]))
	return nil
}

// Filter resets the cursor.
func (cur *exampleCursor) Filter(idxNum int, idxStr string, vals []any) error {
	cur.index = 0
	return nil
}

// Next advances the cursor.
func (cur *exampleCursor) Next() error {
	cur.index++
	return nil
}

// EOF returns true if all rows have been iterated.
func (cur *exampleCursor) EOF() bool {
	return cur.index &amp;gt;= len(cur.data)
}

// Rowid returns the current row id.
func (cur *exampleCursor) Rowid() (int64, error) {
	return int64(cur.index), nil
}

// Close cleans up the cursor (no-op in this case).
func (cur *exampleCursor) Close() error {
	return nil
}

func main() {
	run(&amp;quot;tenantA&amp;quot;)
	run(&amp;quot;tenantB&amp;quot;)
}

func run(param string) {
	// Create a new SQLite connector with the &amp;quot;example&amp;quot; module registered.
	db := sql.OpenDB(NewSQLiteConnector(map[string]sqlite3.Module{
		&amp;quot;example&amp;quot;: &amp;amp;exampleModule{param: param},
	}))
	defer db.Close()

	// Create the virtual table using the registered module.
	_, err := db.Exec(&amp;quot;CREATE VIRTUAL TABLE example_table USING example&amp;quot;)
	if err != nil {
		log.Fatal(err)
	}

	// Query the virtual table.
	rows, err := db.Query(&amp;quot;SELECT value FROM example_table&amp;quot;)
	if err != nil {
		log.Fatal(err)
	}
	defer rows.Close()

	// Display the results.
	fmt.Printf(&amp;quot;Results for %s:\n&amp;quot;, param)
	for rows.Next() {
		var value string
		if err := rows.Scan(&amp;amp;value); err != nil {
			log.Fatal(err)
		}
		fmt.Println(value)
	}
}
&lt;/code&gt;&lt;/pre&gt;
&lt;h3 id=&#34;running-the-example&#34;&gt;Running the Example&lt;/h3&gt;
&lt;p&gt;Since virtual tables require a specific build tag in &lt;code&gt;go-sqlite3&lt;/code&gt;, you have to run the program like this:&lt;/p&gt;
&lt;pre&gt;&lt;code class=&#34;language-sh&#34;&gt;go run -tags &#39;sqlite_vtable&#39; main.go
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;You should see this as the output:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;Results for tenantA:
tenantA_foo
tenantA_bar
tenantA_baz
Results for tenantB:
tenantB_foo
tenantB_bar
tenantB_baz
&lt;/code&gt;&lt;/pre&gt;
&lt;h3 id=&#34;how-it-works&#34;&gt;How It Works&lt;/h3&gt;
&lt;p&gt;Instead of relying on &lt;code&gt;ConnectHook&lt;/code&gt; at the global level, this approach uses &lt;code&gt;sql.OpenDB&lt;/code&gt; with a custom connector, allowing each database instance to register its own virtual table module with unique runtime parameters.&lt;/p&gt;
&lt;p&gt;In the example above, we initialize two separate SQLite instances, one for &lt;code&gt;&amp;quot;tenantA&amp;quot;&lt;/code&gt; and one for &lt;code&gt;&amp;quot;tenantB&amp;quot;&lt;/code&gt;. Each instance registers the &lt;code&gt;&amp;quot;example&amp;quot;&lt;/code&gt; module with a different value for &lt;code&gt;param&lt;/code&gt;. When queried, the virtual table returns results that incorporate the parameter—just like an API-driven virtual table would behave differently based on the API key in use.&lt;/p&gt;
&lt;p&gt;This method provides flexibility when working with SQLite in multitenant applications, enabling per-connection behavior without modifying the global driver state.&lt;/p&gt;
&lt;hr&gt;
&lt;p&gt;With this approach, you can dynamically configure SQLite virtual tables at runtime—whether it’s for API-backed datasets, tenant-specific views, or other custom behavior.&lt;/p&gt;</content:encoded>
    </item>
    
    <item>
      <title>Objectives for 2025</title>
      <link>https://misfra.me/2024/objectives-for-2025/</link>
      <guid isPermaLink="true">https://misfra.me/2024/objectives-for-2025/</guid>
      <pubDate>Thu, 26 Dec 2024 00:00:00 &#43;0000</pubDate>
      <dc:creator>Preetam Jinka</dc:creator>
      <category>Objectives</category>
      
      <description>&lt;p&gt;Happy holidays! It feels like 2024 flew by. This year we traveled to India, Spain, the Maldives, and Italy. I got to try a bunch of different cuisines and take more travel photos than ever before. On the health side, I spent a lot of time on diet and exercise and managed to run close to 200 miles—the most I’ve ever done in a year.&lt;/p&gt;
&lt;p&gt;In 2025, I want to keep focusing on those same things, but with more specific goals. The major areas are fitness, food, photography, and reading.&lt;/p&gt;
&lt;h3 id=&#34;fitness&#34;&gt;Fitness&lt;/h3&gt;
&lt;p&gt;I want to run 300 miles this year. That’s 25 miles a month, with some buffer for extra effort when I’m feeling good. Running became a core part of my routine in 2024, and I want to build on that momentum.&lt;/p&gt;
&lt;p&gt;I also want to finally get abs. It’s been on my list for years, and while it might sound superficial, the discipline required to get there aligns with other fitness goals. Beyond that, I want to focus on a more defined physique overall, combining cardio, strength training, and better posture work.&lt;/p&gt;
&lt;h3 id=&#34;food&#34;&gt;Food&lt;/h3&gt;
&lt;p&gt;My wife and I have been cooking at home more often, trying out new dishes almost every week. In 2025, I want to create v1 of a cookbook. Nothing too polished—just something fun that collects our favorite recipes. It’d be great to print a few copies and share them with friends and family during the holidays.&lt;/p&gt;
&lt;p&gt;&lt;img src=&#34;https://misfra.me/img/2024/food.jpg&#34; alt=&#34;Some dishes we&amp;rsquo;ve cooked at home&#34;&gt;&lt;/p&gt;
&lt;h3 id=&#34;photography&#34;&gt;Photography&lt;/h3&gt;
&lt;p&gt;I want to keep improving my travel and food photography. Travel photography helps me document the places we visit, and food photography will be especially useful for the cookbook.&lt;/p&gt;
&lt;h3 id=&#34;reading&#34;&gt;Reading&lt;/h3&gt;
&lt;p&gt;I want to finish 12 books this year—one per month. If I can consistently carve out 10 minutes a day, this should be an easy goal to hit.&lt;/p&gt;
&lt;hr&gt;
&lt;p&gt;2025 is all about focusing on both body and mind. I’m doubling down on what worked in 2024 and raising the bar a little higher. Here’s to another year of growth, creativity, and good food!&lt;/p&gt;
&lt;hr&gt;
&lt;p&gt;From previous years:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;(2024 was skipped 😅)&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://misfra.me/2022/objectives-for-2023/&#34;&gt;2023&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://misfra.me/2022/objectives-for-2022/&#34;&gt;2022&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://misfra.me/2021/objectives-for-2021/&#34;&gt;2021&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://misfra.me/2020/01/objectives-for-2020/&#34;&gt;2020&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
</description>
      <content:encoded>&lt;p&gt;Happy holidays! It feels like 2024 flew by. This year we traveled to India, Spain, the Maldives, and Italy. I got to try a bunch of different cuisines and take more travel photos than ever before. On the health side, I spent a lot of time on diet and exercise and managed to run close to 200 miles—the most I’ve ever done in a year.&lt;/p&gt;
&lt;p&gt;In 2025, I want to keep focusing on those same things, but with more specific goals. The major areas are fitness, food, photography, and reading.&lt;/p&gt;
&lt;h3 id=&#34;fitness&#34;&gt;Fitness&lt;/h3&gt;
&lt;p&gt;I want to run 300 miles this year. That’s 25 miles a month, with some buffer for extra effort when I’m feeling good. Running became a core part of my routine in 2024, and I want to build on that momentum.&lt;/p&gt;
&lt;p&gt;I also want to finally get abs. It’s been on my list for years, and while it might sound superficial, the discipline required to get there aligns with other fitness goals. Beyond that, I want to focus on a more defined physique overall, combining cardio, strength training, and better posture work.&lt;/p&gt;
&lt;h3 id=&#34;food&#34;&gt;Food&lt;/h3&gt;
&lt;p&gt;My wife and I have been cooking at home more often, trying out new dishes almost every week. In 2025, I want to create v1 of a cookbook. Nothing too polished—just something fun that collects our favorite recipes. It’d be great to print a few copies and share them with friends and family during the holidays.&lt;/p&gt;
&lt;p&gt;&lt;img src=&#34;https://misfra.me/img/2024/food.jpg&#34; alt=&#34;Some dishes we&amp;rsquo;ve cooked at home&#34;&gt;&lt;/p&gt;
&lt;h3 id=&#34;photography&#34;&gt;Photography&lt;/h3&gt;
&lt;p&gt;I want to keep improving my travel and food photography. Travel photography helps me document the places we visit, and food photography will be especially useful for the cookbook.&lt;/p&gt;
&lt;h3 id=&#34;reading&#34;&gt;Reading&lt;/h3&gt;
&lt;p&gt;I want to finish 12 books this year—one per month. If I can consistently carve out 10 minutes a day, this should be an easy goal to hit.&lt;/p&gt;
&lt;hr&gt;
&lt;p&gt;2025 is all about focusing on both body and mind. I’m doubling down on what worked in 2024 and raising the bar a little higher. Here’s to another year of growth, creativity, and good food!&lt;/p&gt;
&lt;hr&gt;
&lt;p&gt;From previous years:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;(2024 was skipped 😅)&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://misfra.me/2022/objectives-for-2023/&#34;&gt;2023&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://misfra.me/2022/objectives-for-2022/&#34;&gt;2022&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://misfra.me/2021/objectives-for-2021/&#34;&gt;2021&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://misfra.me/2020/01/objectives-for-2020/&#34;&gt;2020&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
</content:encoded>
    </item>
    
    <item>
      <title>Book review: Excellent Advice for Living</title>
      <link>https://misfra.me/2024/book-review-excellent-advice-for-living/</link>
      <guid isPermaLink="true">https://misfra.me/2024/book-review-excellent-advice-for-living/</guid>
      <pubDate>Mon, 22 Jul 2024 00:00:00 &#43;0000</pubDate>
      <dc:creator>Preetam Jinka</dc:creator>
      <category>Review</category>
      
      <description>&lt;p&gt;A few years ago &lt;a href=&#34;https://kk.org/&#34;&gt;Kevin Kelly&lt;/a&gt; shared a video with &lt;a href=&#34;https://www.youtube.com/watch?v=Zz70rcguxwk&#34;&gt;68 Bits of Unsolicited Advice&lt;/a&gt;.
I&amp;rsquo;m a huge fan of that video. I watched it several times over the years and shared it and the written version&lt;sup&gt;1&lt;/sup&gt; with friends and family.&lt;/p&gt;
&lt;p&gt;Since then Kevin published a book titled &lt;a href=&#34;https://kk.org/books/excellent-advice-for-living&#34;&gt;Excellent Advice for Living&lt;/a&gt; with those 68 bits and many more. It&amp;rsquo;s fun, useful, and a quick read. I finished it in 3 sittings.
It&amp;rsquo;ll stay on my bookshelf for a while since there&amp;rsquo;s so much worth rereading. It&amp;rsquo;s a good gift book.&lt;/p&gt;
&lt;hr&gt;
&lt;p&gt;&lt;sup&gt;1&lt;/sup&gt; They were all available on his &lt;a href=&#34;https://kk.org/thetechnium/68-bits-of-unsolicited-advice/&#34;&gt;blog&lt;/a&gt;, but the original list has been removed. You can find an archived version &lt;a href=&#34;https://web.archive.org/web/20200429043521/https://kk.org/thetechnium/68-bits-of-unsolicited-advice/&#34;&gt;here&lt;/a&gt;.&lt;/p&gt;
</description>
      <content:encoded>&lt;p&gt;A few years ago &lt;a href=&#34;https://kk.org/&#34;&gt;Kevin Kelly&lt;/a&gt; shared a video with &lt;a href=&#34;https://www.youtube.com/watch?v=Zz70rcguxwk&#34;&gt;68 Bits of Unsolicited Advice&lt;/a&gt;.
I&amp;rsquo;m a huge fan of that video. I watched it several times over the years and shared it and the written version&lt;sup&gt;1&lt;/sup&gt; with friends and family.&lt;/p&gt;
&lt;p&gt;Since then Kevin published a book titled &lt;a href=&#34;https://kk.org/books/excellent-advice-for-living&#34;&gt;Excellent Advice for Living&lt;/a&gt; with those 68 bits and many more. It&amp;rsquo;s fun, useful, and a quick read. I finished it in 3 sittings.
It&amp;rsquo;ll stay on my bookshelf for a while since there&amp;rsquo;s so much worth rereading. It&amp;rsquo;s a good gift book.&lt;/p&gt;
&lt;hr&gt;
&lt;p&gt;&lt;sup&gt;1&lt;/sup&gt; They were all available on his &lt;a href=&#34;https://kk.org/thetechnium/68-bits-of-unsolicited-advice/&#34;&gt;blog&lt;/a&gt;, but the original list has been removed. You can find an archived version &lt;a href=&#34;https://web.archive.org/web/20200429043521/https://kk.org/thetechnium/68-bits-of-unsolicited-advice/&#34;&gt;here&lt;/a&gt;.&lt;/p&gt;
</content:encoded>
    </item>
    
    <item>
      <title>Teaching a 3-Year-Old and LLMs</title>
      <link>https://misfra.me/2024/3-year-old-and-llms/</link>
      <guid isPermaLink="true">https://misfra.me/2024/3-year-old-and-llms/</guid>
      <pubDate>Tue, 16 Jul 2024 00:00:00 &#43;0000</pubDate>
      <dc:creator>Preetam Jinka</dc:creator>
      <category>Reflection</category>
      
      <description>&lt;p&gt;This past holiday weekend, my wife and I traveled to the East Coast to visit family. Spending time with my 3-year-old niece was a highlight, and one of our experiences sparked some interesting thoughts about LLMs.&lt;/p&gt;
&lt;p&gt;My parents got her a tricycle earlier this year, and watching her learn to ride it around the house was entertaining.&lt;/p&gt;
&lt;p&gt;Before this weekend, she relied on others to push her around while she did some basic steering. She didn’t know how to pedal on her own yet. Simply explaining how to do it wasn’t enough &amp;ndash; she’s only 3. Demonstrating wasn’t an option either—I’m a bit too big for her tricycle! So how did she learn? Instead of pushing her tricycle around the whole house, I gave her an initial push and encouraged her to keep going. Soon she figured out how to push the pedals correctly. Sounds a lot like prompting an LLM!&lt;/p&gt;
&lt;p&gt;When she reached the end of the room, she didn’t know how to turn back. I told her to make a U-turn, but the problem was she had no idea what that meant. She’s never done a U-turn before! I had to guide her through making a U-turn a few times, and then she understood what to do when she ended up at the edge of the room. Sounds like giving few-shot examples to an LLM! We&amp;rsquo;ve encountered this a lot when building our chatbot at &lt;a href=&#34;https://funnelstory.ai/&#34;&gt;FunnelStory&lt;/a&gt;. LLMs, which are trained on mostly public datasets, aren’t familiar with concepts in our unique startup product/platform.&lt;/p&gt;
&lt;p&gt;Sometimes, family members stood in her path. Instead of running into them, I told her to say “beep beep” so they’d move. A simple prompt, but effective!&lt;/p&gt;
&lt;p&gt;She also sometimes got stuck going around the kitchen island. Initially, she didn’t realize she could go back and make wider turns. I taught her that sometimes you need to go back and try again. After a couple of tries, she mastered it, and didn’t need someone to get her unstuck.&lt;/p&gt;
&lt;p&gt;This experience made me think about prompting, few-shot examples, and thought engineering with LLMs. Just like with kids, while LLMs might not get it right the first time, they have the potential to learn. If we assume they can do it and just need the right training or prompting, we can get more creative and find better solutions.&lt;/p&gt;
</description>
      <content:encoded>&lt;p&gt;This past holiday weekend, my wife and I traveled to the East Coast to visit family. Spending time with my 3-year-old niece was a highlight, and one of our experiences sparked some interesting thoughts about LLMs.&lt;/p&gt;
&lt;p&gt;My parents got her a tricycle earlier this year, and watching her learn to ride it around the house was entertaining.&lt;/p&gt;
&lt;p&gt;Before this weekend, she relied on others to push her around while she did some basic steering. She didn’t know how to pedal on her own yet. Simply explaining how to do it wasn’t enough &amp;ndash; she’s only 3. Demonstrating wasn’t an option either—I’m a bit too big for her tricycle! So how did she learn? Instead of pushing her tricycle around the whole house, I gave her an initial push and encouraged her to keep going. Soon she figured out how to push the pedals correctly. Sounds a lot like prompting an LLM!&lt;/p&gt;
&lt;p&gt;When she reached the end of the room, she didn’t know how to turn back. I told her to make a U-turn, but the problem was she had no idea what that meant. She’s never done a U-turn before! I had to guide her through making a U-turn a few times, and then she understood what to do when she ended up at the edge of the room. Sounds like giving few-shot examples to an LLM! We&amp;rsquo;ve encountered this a lot when building our chatbot at &lt;a href=&#34;https://funnelstory.ai/&#34;&gt;FunnelStory&lt;/a&gt;. LLMs, which are trained on mostly public datasets, aren’t familiar with concepts in our unique startup product/platform.&lt;/p&gt;
&lt;p&gt;Sometimes, family members stood in her path. Instead of running into them, I told her to say “beep beep” so they’d move. A simple prompt, but effective!&lt;/p&gt;
&lt;p&gt;She also sometimes got stuck going around the kitchen island. Initially, she didn’t realize she could go back and make wider turns. I taught her that sometimes you need to go back and try again. After a couple of tries, she mastered it, and didn’t need someone to get her unstuck.&lt;/p&gt;
&lt;p&gt;This experience made me think about prompting, few-shot examples, and thought engineering with LLMs. Just like with kids, while LLMs might not get it right the first time, they have the potential to learn. If we assume they can do it and just need the right training or prompting, we can get more creative and find better solutions.&lt;/p&gt;
</content:encoded>
    </item>
    
    <item>
      <title>Running Goal Achieved</title>
      <link>https://misfra.me/2024/running-goal-achieved/</link>
      <guid isPermaLink="true">https://misfra.me/2024/running-goal-achieved/</guid>
      <pubDate>Sun, 30 Jun 2024 00:00:00 &#43;0000</pubDate>
      <dc:creator>Preetam Jinka</dc:creator>
      <category>Health</category>
      
      <description>&lt;p&gt;I started running more last month, and my goal for this month was 50 miles. I achieved my goal! In fact, I ran 53.2 miles this month.&lt;/p&gt;
&lt;p&gt;While I didn&amp;rsquo;t improve my fastest mile time, I did manage to hit a couple of other personal records:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Best 5K (3.1 miles) time: 27:57 (9:01 mile avg)&lt;/li&gt;
&lt;li&gt;Longest run of 4 miles: 43:25 (10:51 mile avg)&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;img src=&#34;https://misfra.me/img/2024/june_running.png&#34; alt=&#34;Running pace chart&#34;&gt;&lt;/p&gt;
&lt;p&gt;A few things I&amp;rsquo;ve learned since the beginning of the month:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Cardio can improve pretty quickly. At this point, it&amp;rsquo;s my legs holding me back, not my cardiovascular system.&lt;/li&gt;
&lt;li&gt;Warming up is important. It takes me at least half a mile to find my rhythm. Until then, my muscles are still tight and I don&amp;rsquo;t use the best form. If I push myself to go fast before being warmed up, I risk injury due to poor form.&lt;/li&gt;
&lt;li&gt;Proper running shoes help. I tried to do a quick jog with my Allbirds Tree Runners, and it was very uncomfortable! The midsole cushioning is great for walking since you first make contact with your heel, but it&amp;rsquo;s terrible for running when you use more of the front of your foot.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;What&amp;rsquo;s next? I need a break! The 4-mile run was the one that got me over 50 miles, and I definitely think I pushed myself too hard on that one. I&amp;rsquo;m giving my legs a break for a few days.&lt;/p&gt;
&lt;p&gt;Will I go for another ambitious goal next month? While I could try to hit 60 miles, I don&amp;rsquo;t want to. I&amp;rsquo;m comfortable with running now, but I want to diversify my gym time for other activities like weight lifting and HIIT.
I also need to read more. A good idea would be to read while I stretch. I need to do more of that too!&lt;/p&gt;
</description>
      <content:encoded>&lt;p&gt;I started running more last month, and my goal for this month was 50 miles. I achieved my goal! In fact, I ran 53.2 miles this month.&lt;/p&gt;
&lt;p&gt;While I didn&amp;rsquo;t improve my fastest mile time, I did manage to hit a couple of other personal records:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Best 5K (3.1 miles) time: 27:57 (9:01 mile avg)&lt;/li&gt;
&lt;li&gt;Longest run of 4 miles: 43:25 (10:51 mile avg)&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;img src=&#34;https://misfra.me/img/2024/june_running.png&#34; alt=&#34;Running pace chart&#34;&gt;&lt;/p&gt;
&lt;p&gt;A few things I&amp;rsquo;ve learned since the beginning of the month:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Cardio can improve pretty quickly. At this point, it&amp;rsquo;s my legs holding me back, not my cardiovascular system.&lt;/li&gt;
&lt;li&gt;Warming up is important. It takes me at least half a mile to find my rhythm. Until then, my muscles are still tight and I don&amp;rsquo;t use the best form. If I push myself to go fast before being warmed up, I risk injury due to poor form.&lt;/li&gt;
&lt;li&gt;Proper running shoes help. I tried to do a quick jog with my Allbirds Tree Runners, and it was very uncomfortable! The midsole cushioning is great for walking since you first make contact with your heel, but it&amp;rsquo;s terrible for running when you use more of the front of your foot.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;What&amp;rsquo;s next? I need a break! The 4-mile run was the one that got me over 50 miles, and I definitely think I pushed myself too hard on that one. I&amp;rsquo;m giving my legs a break for a few days.&lt;/p&gt;
&lt;p&gt;Will I go for another ambitious goal next month? While I could try to hit 60 miles, I don&amp;rsquo;t want to. I&amp;rsquo;m comfortable with running now, but I want to diversify my gym time for other activities like weight lifting and HIIT.
I also need to read more. A good idea would be to read while I stretch. I need to do more of that too!&lt;/p&gt;
</content:encoded>
    </item>
    
    <item>
      <title>Running</title>
      <link>https://misfra.me/2024/running/</link>
      <guid isPermaLink="true">https://misfra.me/2024/running/</guid>
      <pubDate>Thu, 06 Jun 2024 00:00:00 &#43;0000</pubDate>
      <dc:creator>Preetam Jinka</dc:creator>
      <category>Health</category>
      
      <description>&lt;p&gt;I started running more consistently to improve my cardio. In the past I mostly used to run to prepare for 5Ks, but besides that I never made a habit of running. That changed last month. Last month I ran the most I&amp;rsquo;ve ever run in a single month, hit my personal best mile time, and my best two-mile time. I ran a total of about 26 miles and my best mile time was 8:38 (average of 2 miles).&lt;/p&gt;
&lt;p&gt;Yesterday I hit another personal best mile time of 8:21.&lt;/p&gt;
&lt;p&gt;&lt;img src=&#34;https://misfra.me/img/2024/running_chart.jpeg&#34; alt=&#34;Running pace chart&#34;&gt;&lt;/p&gt;
&lt;p&gt;Here are some things I&amp;rsquo;ve learned over the past month:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Stride length matters a lot. I&amp;rsquo;m 5&#39;7&amp;quot; and wear 32&amp;quot; inseam pants, so I proportionally have longer legs. I learned I can run a lot faster when I can loosen up my legs and make bigger strides.&lt;/li&gt;
&lt;li&gt;Stretch before and after running. I&amp;rsquo;m not so good at stretching after.&lt;/li&gt;
&lt;li&gt;Do different kinds of runs. I can&amp;rsquo;t try to hit a PR on every run. I mix things up with some easy runs, and some interval runs. For interval runs I try to hit 9 mph for 30 to 60 seconds at a time, and then walk for a bit.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;My goal this month is to hit 50 miles. As of June 6 I already ran 12 miles (2 miles a day). I need to run 19 more times. Seems doable, considering I run almost everyday now. The chart also shows my pace is improving about 7 seconds a day, so I think I should be able to get down to an 8 minute mile too.&lt;/p&gt;
</description>
      <content:encoded>&lt;p&gt;I started running more consistently to improve my cardio. In the past I mostly used to run to prepare for 5Ks, but besides that I never made a habit of running. That changed last month. Last month I ran the most I&amp;rsquo;ve ever run in a single month, hit my personal best mile time, and my best two-mile time. I ran a total of about 26 miles and my best mile time was 8:38 (average of 2 miles).&lt;/p&gt;
&lt;p&gt;Yesterday I hit another personal best mile time of 8:21.&lt;/p&gt;
&lt;p&gt;&lt;img src=&#34;https://misfra.me/img/2024/running_chart.jpeg&#34; alt=&#34;Running pace chart&#34;&gt;&lt;/p&gt;
&lt;p&gt;Here are some things I&amp;rsquo;ve learned over the past month:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Stride length matters a lot. I&amp;rsquo;m 5&#39;7&amp;quot; and wear 32&amp;quot; inseam pants, so I proportionally have longer legs. I learned I can run a lot faster when I can loosen up my legs and make bigger strides.&lt;/li&gt;
&lt;li&gt;Stretch before and after running. I&amp;rsquo;m not so good at stretching after.&lt;/li&gt;
&lt;li&gt;Do different kinds of runs. I can&amp;rsquo;t try to hit a PR on every run. I mix things up with some easy runs, and some interval runs. For interval runs I try to hit 9 mph for 30 to 60 seconds at a time, and then walk for a bit.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;My goal this month is to hit 50 miles. As of June 6 I already ran 12 miles (2 miles a day). I need to run 19 more times. Seems doable, considering I run almost everyday now. The chart also shows my pace is improving about 7 seconds a day, so I think I should be able to get down to an 8 minute mile too.&lt;/p&gt;
</content:encoded>
    </item>
    
    <item>
      <title>The next decade</title>
      <link>https://misfra.me/2023/30/</link>
      <guid isPermaLink="true">https://misfra.me/2023/30/</guid>
      <pubDate>Thu, 23 Nov 2023 00:00:00 &#43;0000</pubDate>
      <dc:creator>Preetam Jinka</dc:creator>
      
      
      <description>&lt;p&gt;I turned 30 this month. While I could write a lot to reflect on my 20s, for this post I thought it would be
better to think more about the future and where I&amp;rsquo;d like to go in the next decade.
The way I invested my time in my 20s made a big difference in where I am now.
Just like with financial investing, over the course of a decade many small things ended up compounding in significant ways.
For the next decade I need to think about what else will pay off, especially considering &lt;a href=&#34;https://misfra.me/2021/the-medium-term/&#34;&gt;the medium term&lt;/a&gt;.&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;It&amp;rsquo;s not that we have a short time to live, but that we waste much of it.&lt;br&gt;
— Seneca&lt;/p&gt;&lt;/blockquote&gt;
&lt;p&gt;I&amp;rsquo;ve always considered my 30s to be when I would be at my peak (or at least beginning my peak).
Most of my 20s were spent focusing on school, then work, then figuring out how to live more independently.
There was a lot of doing things for the first time and figuring things out. It wasn&amp;rsquo;t always easy.&lt;/p&gt;
&lt;p&gt;Now I feel like I figured out a decent amount, and most importantly &lt;em&gt;got pretty good at figuring things out&lt;/em&gt;.
Getting good at figuring things out means I am getting better at learning, growing, and doing more things for
the first time. And I hope it also means it can get easier.&lt;/p&gt;
&lt;p&gt;With accelerated learning and growth what I focus on now can set the direction for a decade. This is what I&amp;rsquo;m investing in:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;Family:&lt;/strong&gt; I&amp;rsquo;m starting my 30s newly married. There&amp;rsquo;s a lot more that goes into marriage beyond navigating through life as a shared experience with another person. This is a huge part of my life and also very new, so there will be a lot of learning to do.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Health:&lt;/strong&gt; This decade is probably when I&amp;rsquo;m going to hit the peak of my health. I&amp;rsquo;m starting to focus more on diet and exercise. My wife has been really helpful with this.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Time for myself:&lt;/strong&gt; As a founder and being newly married I find myself not making as much time for myself. I used to be really independent in my 20s, and now it&amp;rsquo;s like I have a hard time finding free time. I can&amp;rsquo;t believe it&amp;rsquo;s November and I&amp;rsquo;ve only published one other blog post this year.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;I&amp;rsquo;m looking forward to the rest of my 30s! And now, with the end of the year coming up, it&amp;rsquo;s time to reflect back on 2023 and plan for 2024.&lt;/p&gt;
</description>
      <content:encoded>&lt;p&gt;I turned 30 this month. While I could write a lot to reflect on my 20s, for this post I thought it would be
better to think more about the future and where I&amp;rsquo;d like to go in the next decade.
The way I invested my time in my 20s made a big difference in where I am now.
Just like with financial investing, over the course of a decade many small things ended up compounding in significant ways.
For the next decade I need to think about what else will pay off, especially considering &lt;a href=&#34;https://misfra.me/2021/the-medium-term/&#34;&gt;the medium term&lt;/a&gt;.&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;It&amp;rsquo;s not that we have a short time to live, but that we waste much of it.&lt;br&gt;
— Seneca&lt;/p&gt;&lt;/blockquote&gt;
&lt;p&gt;I&amp;rsquo;ve always considered my 30s to be when I would be at my peak (or at least beginning my peak).
Most of my 20s were spent focusing on school, then work, then figuring out how to live more independently.
There was a lot of doing things for the first time and figuring things out. It wasn&amp;rsquo;t always easy.&lt;/p&gt;
&lt;p&gt;Now I feel like I figured out a decent amount, and most importantly &lt;em&gt;got pretty good at figuring things out&lt;/em&gt;.
Getting good at figuring things out means I am getting better at learning, growing, and doing more things for
the first time. And I hope it also means it can get easier.&lt;/p&gt;
&lt;p&gt;With accelerated learning and growth what I focus on now can set the direction for a decade. This is what I&amp;rsquo;m investing in:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;Family:&lt;/strong&gt; I&amp;rsquo;m starting my 30s newly married. There&amp;rsquo;s a lot more that goes into marriage beyond navigating through life as a shared experience with another person. This is a huge part of my life and also very new, so there will be a lot of learning to do.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Health:&lt;/strong&gt; This decade is probably when I&amp;rsquo;m going to hit the peak of my health. I&amp;rsquo;m starting to focus more on diet and exercise. My wife has been really helpful with this.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Time for myself:&lt;/strong&gt; As a founder and being newly married I find myself not making as much time for myself. I used to be really independent in my 20s, and now it&amp;rsquo;s like I have a hard time finding free time. I can&amp;rsquo;t believe it&amp;rsquo;s November and I&amp;rsquo;ve only published one other blog post this year.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;I&amp;rsquo;m looking forward to the rest of my 30s! And now, with the end of the year coming up, it&amp;rsquo;s time to reflect back on 2023 and plan for 2024.&lt;/p&gt;
</content:encoded>
    </item>
    
    <item>
      <title>CTEs as lookup tables</title>
      <link>https://misfra.me/2023/ctes-as-lookup-tables/</link>
      <guid isPermaLink="true">https://misfra.me/2023/ctes-as-lookup-tables/</guid>
      <pubDate>Wed, 11 Jan 2023 00:00:00 &#43;0000</pubDate>
      <dc:creator>Preetam Jinka</dc:creator>
      <category>Programming</category>
      
      <description>&lt;p&gt;In the past I&amp;rsquo;ve had to write queries to convert data in a table into user-friendly display text.
One way to do this is with CASE expressions. For example, let&amp;rsquo;s say you have a table with a column being a country code,
and you want to add the country name in the final result.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;sqlite&amp;gt; SELECT code FROM data;
+------+
| code |
+------+
| us   |
| fr   |
| in   |
+------+
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;One approach is to use a CASE expression in your query like this:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;sqlite&amp;gt; SELECT code,
   ...&amp;gt; CASE code
   ...&amp;gt;   WHEN &#39;us&#39; THEN &#39;United States&#39;
   ...&amp;gt;   WHEN &#39;fr&#39; THEN &#39;France&#39;
   ...&amp;gt;   WHEN &#39;in&#39; THEN &#39;India&#39;
   ...&amp;gt;  END AS country
   ...&amp;gt; FROM data;
+------+---------------+
| code |    country    |
+------+---------------+
| us   | United States |
| fr   | France        |
| in   | India         |
+------+---------------+
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;The downside is that it&amp;rsquo;s harder to read, and if you need to do something similar elsewhere in the query, you&amp;rsquo;ll
have to repeat the expression.&lt;/p&gt;
&lt;p&gt;An alternative is to use a CTE like this:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;sqlite&amp;gt; WITH countries (code, name) AS (
   ...&amp;gt;   SELECT * FROM (VALUES
   ...&amp;gt;     (&#39;us&#39;, &#39;United States&#39;), (&#39;fr&#39;, &#39;France&#39;), (&#39;in&#39;, &#39;India&#39;)
   ...&amp;gt;   ) AS codes
   ...&amp;gt; )
   ...&amp;gt; SELECT data.code, name FROM data LEFT JOIN countries ON countries.code = data.code;
+------+---------------+
| code |     name      |
+------+---------------+
| us   | United States |
| fr   | France        |
| in   | India         |
+------+---------------+
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Now the &lt;code&gt;countries&lt;/code&gt; CTE becomes a lookup table that you can reference several times in your queries.&lt;/p&gt;
&lt;p&gt;This approach works with SQLite and PostgreSQL.&lt;/p&gt;
</description>
      <content:encoded>&lt;p&gt;In the past I&amp;rsquo;ve had to write queries to convert data in a table into user-friendly display text.
One way to do this is with CASE expressions. For example, let&amp;rsquo;s say you have a table with a column being a country code,
and you want to add the country name in the final result.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;sqlite&amp;gt; SELECT code FROM data;
+------+
| code |
+------+
| us   |
| fr   |
| in   |
+------+
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;One approach is to use a CASE expression in your query like this:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;sqlite&amp;gt; SELECT code,
   ...&amp;gt; CASE code
   ...&amp;gt;   WHEN &#39;us&#39; THEN &#39;United States&#39;
   ...&amp;gt;   WHEN &#39;fr&#39; THEN &#39;France&#39;
   ...&amp;gt;   WHEN &#39;in&#39; THEN &#39;India&#39;
   ...&amp;gt;  END AS country
   ...&amp;gt; FROM data;
+------+---------------+
| code |    country    |
+------+---------------+
| us   | United States |
| fr   | France        |
| in   | India         |
+------+---------------+
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;The downside is that it&amp;rsquo;s harder to read, and if you need to do something similar elsewhere in the query, you&amp;rsquo;ll
have to repeat the expression.&lt;/p&gt;
&lt;p&gt;An alternative is to use a CTE like this:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;sqlite&amp;gt; WITH countries (code, name) AS (
   ...&amp;gt;   SELECT * FROM (VALUES
   ...&amp;gt;     (&#39;us&#39;, &#39;United States&#39;), (&#39;fr&#39;, &#39;France&#39;), (&#39;in&#39;, &#39;India&#39;)
   ...&amp;gt;   ) AS codes
   ...&amp;gt; )
   ...&amp;gt; SELECT data.code, name FROM data LEFT JOIN countries ON countries.code = data.code;
+------+---------------+
| code |     name      |
+------+---------------+
| us   | United States |
| fr   | France        |
| in   | India         |
+------+---------------+
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Now the &lt;code&gt;countries&lt;/code&gt; CTE becomes a lookup table that you can reference several times in your queries.&lt;/p&gt;
&lt;p&gt;This approach works with SQLite and PostgreSQL.&lt;/p&gt;
</content:encoded>
    </item>
    
  </channel>
</rss>
