<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
    <id>https://rybarix.com</id>
    <title>Rybarix</title>
    <updated>2026-03-17T18:17:52.166Z</updated>
    <generator>https://github.com/jpmonette/feed</generator>
    <author>
        <name>Sandro Rybarik</name>
        <uri>https://rybarix.com</uri>
    </author>
    <link rel="alternate" href="https://rybarix.com"/>
    <subtitle>Learnings and dev logs from rybarix.com</subtitle>
    <icon>https://rybarix.com/imgs/favicon.png</icon>
    <rights>All rights reserved 2026, Sandro Rybarik</rights>
    <category term="TIL"/>
    <category term="Dev Log"/>
    <entry>
        <title type="html"><![CDATA[Uperfect external monitor with coil whine]]></title>
        <id>https://rybarix.com/tils/uperfect-coil-whine.html</id>
        <link href="https://rybarix.com/tils/uperfect-coil-whine.html"/>
        <updated>2026-03-17T00:00:00.000Z</updated>
        <content type="html"><![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>
        <category label="TIL"/>
    </entry>
    <entry>
        <title type="html"><![CDATA[Swift state management]]></title>
        <id>https://rybarix.com/tils/swift-state.html</id>
        <link href="https://rybarix.com/tils/swift-state.html"/>
        <updated>2026-02-23T00:00:00.000Z</updated>
        <content type="html"><![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>
        <category label="TIL"/>
    </entry>
    <entry>
        <title type="html"><![CDATA[Simpler SQL]]></title>
        <id>https://rybarix.com/tils/simpler-sql.html</id>
        <link href="https://rybarix.com/tils/simpler-sql.html"/>
        <updated>2026-02-17T00:00:00.000Z</updated>
        <content type="html"><![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>
        <category label="TIL"/>
    </entry>
    <entry>
        <title type="html"><![CDATA[Rust enums cost]]></title>
        <id>https://rybarix.com/tils/rs-enum-mem.html</id>
        <link href="https://rybarix.com/tils/rs-enum-mem.html"/>
        <updated>2026-02-04T00:00:00.000Z</updated>
        <content type="html"><![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>
        <category label="TIL"/>
    </entry>
    <entry>
        <title type="html"><![CDATA[Sandbox-first language]]></title>
        <id>https://rybarix.com/dev/lang/init.html</id>
        <link href="https://rybarix.com/dev/lang/init.html"/>
        <updated>2026-02-04T00:00:00.000Z</updated>
        <content type="html"><![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>
        <category label="Dev Log"/>
    </entry>
    <entry>
        <title type="html"><![CDATA[Can you treat AI as a tool?]]></title>
        <id>https://rybarix.com/tils/ai-anthropo.html</id>
        <link href="https://rybarix.com/tils/ai-anthropo.html"/>
        <updated>2026-01-13T00:00:00.000Z</updated>
        <content type="html"><![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>
        <category label="TIL"/>
    </entry>
</feed>