<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/">
    <channel>
        <title>Rybarix</title>
        <link>https://rybarix.com</link>
        <description>Learnings and dev logs from rybarix.com</description>
        <lastBuildDate>Sat, 02 May 2026 20:33:23 GMT</lastBuildDate>
        <docs>https://validator.w3.org/feed/docs/rss2.html</docs>
        <generator>https://github.com/jpmonette/feed</generator>
        <language>en</language>
        <copyright>All rights reserved 2026, Sandro Rybarik</copyright>
        <category>TIL</category>
        <category>Dev Log</category>
        <item>
            <title><![CDATA[Uperfect external monitor with coil whine]]></title>
            <link>https://rybarix.com/tils/uperfect-coil-whine.html</link>
            <guid isPermaLink="false">https://rybarix.com/tils/uperfect-coil-whine.html</guid>
            <pubDate>Tue, 17 Mar 2026 00:00:00 GMT</pubDate>
            <content:encoded><![CDATA[<p>If you have problem with uperfect monitor and you are using with MacBook then this is for you.</p>
<p>The coil whine is present when the display is powered only from MacBook.</p>
<p>Uperfect monitors support power pass through which actually removes the coil whine.</p>
<p>So plug MacBook power source into the monitor and connect monitor to the MacBook. This way the mac gets all the power and the monitor won&#39;t whine.</p>
]]></content:encoded>
            <category>TIL</category>
        </item>
        <item>
            <title><![CDATA[Swift state management]]></title>
            <link>https://rybarix.com/tils/swift-state.html</link>
            <guid isPermaLink="false">https://rybarix.com/tils/swift-state.html</guid>
            <pubDate>Mon, 23 Feb 2026 00:00:00 GMT</pubDate>
            <content:encoded><![CDATA[<h2><code>@State</code></h2>
<p>Marks view&#39;s property as reactive. Like React&#39;s <code>useState()</code> or Vue&#39;s <code>ref()</code>.<br>Triggers rendering when changed.</p>
<h2><code>@Binding</code></h2>
<p>Same concept as <code>v-model</code> in Vue. Marks view&#39;s property for 2-way binding.<br>Modifying the property inside view will propagate changes outside.</p>
<h2><code>ObservableObject</code> Protocol and <code>@ObservedObject</code></h2>
<pre><code class="language-swift">class OrderModelController: ObservableObject {
    // @Published notifies watchers when order is modified
    @Published var order: Order
}


class SomeView: View {
    // This may cause issues during re-render when the @ObservedObject is owned by view and is not injected
    @ObservedObject var orderController = OrderModelController.load()
    // ^ Use @StateObject in this case.
}
</code></pre>
<hr>
<p>In general you want something like this:</p>
<pre><code class="language-swift">// SomeView.swift
class SomeView: View {
    @ObservedObject var injectedState: MyState
    init(myState: MyState) {
        self.injectedState = myState
    }
}

// SomeModel.swift
class SomeModel: ObservableObject {
    @Published var stateVariable: MyState

    init() {
        // initialize model
    }
}

// We are sharing the state from top to the bottom.
// This prop drilling can be mitigated by
// Entrypoint
// MyApp.swift
@main
struct MyApp: App {
    @StateObject private var myState: MyState

    init() {
        self._myState = StateObject(wrappedValue: MyState())
    }

    var body: some View {
        // View here
    }
}
</code></pre>
]]></content:encoded>
            <category>TIL</category>
        </item>
        <item>
            <title><![CDATA[Simpler SQL]]></title>
            <link>https://rybarix.com/tils/simpler-sql.html</link>
            <guid isPermaLink="false">https://rybarix.com/tils/simpler-sql.html</guid>
            <pubDate>Tue, 17 Feb 2026 00:00:00 GMT</pubDate>
            <content:encoded><![CDATA[<p>How to make SQL more readable?</p>
<p>Is it even good question when it is closer to english than any other <em>programming</em> language?</p>
<p>My bet (and hope) is that SQL will be more common knowledge as spreadsheet formulas are.</p>
<p>It&#39;s expressive and quite powerful and get works done. I would say that it is much more easier to write than it is to read.</p>
<p>Composing queries in your head will make sense to you as you go step by step. Reading others larger SQL statements <em>will</em> be challenging as you try understand how the other person went to solve a problem.</p>
<p>Quite a lot of &quot;Explain SQL AI&quot; solutions popped up lately. And I get it that there is a need to break down the SQL to natural language. But the question is: Can you trust it? Nope.</p>
<p>So, we are not leaving the code anytime soon. And that&#39;s good thing! How to present SQL to novices or people new to the field?</p>
<p>If only there was a SQL to Spreadsheet formulas translation. But there isn&#39;t and it wouldn&#39;t make things easier based on my experience with large nested formulas from complicated spreadsheets.</p>
<p>Currently, my best solution is to break the SQL query into series of simpler steps and display it as a visual graph.
Where you start at the left and work towards to the right. It&#39;s not perfect but it is deterministic and doesn&#39;t hide any details. The vision is to invite users to learn not isolate them. At the end of the day, who would take responsibility for outputs that they can&#39;t verify or trust?</p>
<p><img src="/imgs/sqlflow.png" alt="Sql diagram"></p>
<p>A nice side-effect of this approach is the ability to run query partially and understand the temporary results. It&#39;s not perfect but it&#39;s much better than big SQL snippet.</p>
]]></content:encoded>
            <category>TIL</category>
        </item>
        <item>
            <title><![CDATA[Rust enums cost]]></title>
            <link>https://rybarix.com/tils/rs-enum-mem.html</link>
            <guid isPermaLink="false">https://rybarix.com/tils/rs-enum-mem.html</guid>
            <pubDate>Wed, 04 Feb 2026 00:00:00 GMT</pubDate>
            <content:encoded><![CDATA[<p>Something not immediately obvious but obvious after thinking about it for a minute is memory size of tagged unions.</p>
<p>Each Token will take up 40B + size of enum discriminant - 1B (tag) which will be aligned to 8B because entire structure needs to be aligned by the highest data type size (usize or String (ptr inside is 8B)) which is 8B.</p>
<pre><code class="language-rs">struct Span {
    line: usize,   // 8 bytes
    column: usize, // 8 bytes
}

enum Token {
    Identifier {
        name: String,  // 24 bytes
        location: Span // 16 bytes
    },
    Number {
        value: i32,    // 4 bytes
        raw: String    // 24 bytes
    },
    If(Span),          // 16 bytes
}
</code></pre>
]]></content:encoded>
            <category>TIL</category>
        </item>
        <item>
            <title><![CDATA[Sandbox-first language]]></title>
            <link>https://rybarix.com/dev/lang/init.html</link>
            <guid isPermaLink="false">https://rybarix.com/dev/lang/init.html</guid>
            <pubDate>Wed, 04 Feb 2026 00:00:00 GMT</pubDate>
            <content:encoded><![CDATA[<p>I was thinking about this for more than one year now.</p>
<p>It is time to give it a shot and create brand new scripting language that is secure by default.</p>
<p>What security means in this context?</p>
<ul>
<li>capbalities for io, networking etc.</li>
<li>safe to run untrusted code</li>
<li>memory limits and fuel backed into runtime</li>
<li>embeddable into server environments allowing user scripting</li>
<li>allow injecting host functions into the runtime</li>
</ul>
<p>The main goal is to have runtime and allow user scripting without relying on OS APIs.</p>
<p>Every single general-purpose programming language assume that code is written by trusted programmer.</p>
<p>If it was easy to turn any programming language into safe one, this page wouldn&#39;t exist.</p>
<p>Why not WASM?</p>
<p>WASM is promising runtime and combined with WASI, it should be useful for sandboxing other programming languages.</p>
<p>But using WASM prevents to see what would be possible if langauge itself was built with sandboxing in mind from day 1.</p>
]]></content:encoded>
            <category>Dev Log</category>
        </item>
        <item>
            <title><![CDATA[Can you treat AI as a tool?]]></title>
            <link>https://rybarix.com/tils/ai-anthropo.html</link>
            <guid isPermaLink="false">https://rybarix.com/tils/ai-anthropo.html</guid>
            <pubDate>Tue, 13 Jan 2026 00:00:00 GMT</pubDate>
            <content:encoded><![CDATA[<p>You can&#39;t talk to the AI without treating it like a human.</p>
<p>They say: &quot;Treat it like a tool&quot;.</p>
<p>But how can you instruct the tool without &quot;talking&quot; it to it like a human?!</p>
]]></content:encoded>
            <category>TIL</category>
        </item>
    </channel>
</rss>