<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Hiro on Medium]]></title>
        <description><![CDATA[Stories by Hiro on Medium]]></description>
        <link>https://medium.com/@laciferin?source=rss-4142d6db8ecb------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*byqxir1_tr8W0pDp</url>
            <title>Stories by Hiro on Medium</title>
            <link>https://medium.com/@laciferin?source=rss-4142d6db8ecb------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Thu, 25 Jun 2026 11:54:05 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@laciferin/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com" rel="hub"/>
        <item>
            <title><![CDATA[Loadbalancing MultiDBs & DB Replicas in]]></title>
            <link>https://laciferin.medium.com/loadbalancing-multidbs-db-replicas-in-22718db8fa7c?source=rss-4142d6db8ecb------2</link>
            <guid isPermaLink="false">https://medium.com/p/22718db8fa7c</guid>
            <category><![CDATA[database]]></category>
            <category><![CDATA[golang]]></category>
            <category><![CDATA[load-balancing]]></category>
            <category><![CDATA[db-replicas]]></category>
            <dc:creator><![CDATA[Hiro]]></dc:creator>
            <pubDate>Mon, 19 Jun 2023 02:17:14 GMT</pubDate>
            <atom:updated>2023-06-19T02:20:16.857Z</atom:updated>
            <content:encoded><![CDATA[<h3>Loadbalancing DB Replicas in Golang</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*w4tleOrD5kq9HGuT" /></figure><p>A month ago, I was working on a Golang project. This project is related to some authorization data. To make it short, this project must be deployed in multi-region because of the needs of our services.</p><p>We use a global database with replicated database for all regions. In our case, for example, our application is deployed in us-west-2 and ap-southeast-1 region. If drawn into a diagram, it will look like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/671/0*5WZ7b25oFgTpWeK_.png" /></figure><p>So there is nothing wrong with this. But the problem is, when handling the connection separation, I take time to understand how to do this in Golang with ease. I searched for a library that can help with this, and I found one, DBResolver from Gorm, but the problem is that we’re not using Gorm. With some tradeoffs, I decided to write my library that will utilize the connection separations for the Database in Golang.</p><h3>Introducing Golang dbresolver for Built-In Golang sql.DB</h3><p>Moving from the abovementioned problem, I created my own Golang library to handle database connections.</p><ul><li><a href="https://github.com/bxcodec/dbresolver">https://github.com/bxcodec/dbresolver</a></li></ul><h3>Use case 1: separated RW and RO database connection</h3><p>Imagine you’re building an application (e.g., a media platform like Medium.com) with heavy read operations (query) to the database. Let’s say your database limit connection is only 100, but you have a lot of concurrent users coming in and eventually using all the maximum connections to the database. This will impact performance and user experience.</p><p>How to handle this easily is by replicating the DB and separating between the “Write” and “Read” databases. In this case, we will define one Primary (master/leader) database and create other replicas depending on needs (maybe 2–3 replicas for read-only).</p><p>So to summarize:</p><ul><li>You have your application deployed</li><li>Your application is heavy on reading operations</li><li>Your DBs replicated to multiple replicas for faster queries</li><li>You separate the connections for optimized query</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*VtMYofm0KqkEdb1m.png" /></figure><p>usecase#1 dbresolver</p><h3>Use case 2: cross-region database</h3><p>This is a similar use case to use case#1. The difference is that in use case #1, your application is only deployed and running in 1 region. In this use case, you need to serve a multi-region application but still want to make it consistent across regions.</p><p>Let’s say an authorization and authentication service may be an example for this use case. Since it is heavy on reading operations, e.g., Select User info, get user permission list, get user role, etc., and since it’s an authorization system, it should be available globally. So if we block some users’ access, it should be blocked in every region. That’s why we need to ensure the application is deployed across all regions.</p><ul><li>Your application deployed to multi regions.</li><li>You have your Databases configured globally.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*x9mnrPeIfywDta9z.png" /></figure><p>usecase#2 dbresolver</p><h3>Using dbresolver</h3><p>Based on the use cases I mentioned above, building it with the builtin *sql.DB will take time. Worry not. I created this library to save you time when facing similar use cases.</p><p>Here’s the main features:</p><ul><li>Clear differentiation between Primary and Replicas.<br>With this library, you can define your primary and replicas explicitly without worrying about wrong configurations.</li><li>ReadWrite to Primary, ReadOnly to Replicas<br>All write operations will automatically go to the Primary and read operations to replicas (currently only support round-robin if has using more than one replicas).<br>So whenever you call these functions (Exec, ExecContext, Begin, BeginTx) in your application, it will automatically be using the primary database. But if you use these functions (Query, QueryContext, QueryRow, QueryRowContext), it will automatically be using the replicas database.</li></ul><p>example</p><h3>Example With Use Case 1: Multi Readers in One Region</h3><p>To give an example of how to use it with a multi-reader database, here’s the code:</p><p>It’s pretty clear here — we only need to define all of our readers’ connections. And initialize the library. After that, we can use it for our database operation in our application.</p><h3>Example With Use Case 2: Multi-Region Application</h3><p>And this is an example of how to use it with multi-region applications.</p><p>This example is quite different. With use case #1, we need to declare all our connection strings explicitly. Here, you only need to declare one reader, but you need to do a kind of branching logic, like if region is &#39;us-west-2&#39; then use the &#39;us-west-2 environments</p><p>The rest of it will be handled by the library.</p><h3>GitHub Repository</h3><p>Sounds awesome? Exactly, now you can save your time more on your business logic. Let this library handle your connection database.</p><p>Find the GitHub repo here:</p><ul><li><a href="https://github.com/bxcodec/dbresolver">https://github.com/bxcodec/dbresolver</a></li></ul><p>And feel free to raise an issue or PR if you have a better idea for improving this tiny yet useful library.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=22718db8fa7c" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[“Go Image Slicer: The Easy Way to Slice and Join Images in Go”]]></title>
            <link>https://laciferin.medium.com/go-image-slicer-the-easy-way-to-slice-and-join-images-in-go-2d1a8f390185?source=rss-4142d6db8ecb------2</link>
            <guid isPermaLink="false">https://medium.com/p/2d1a8f390185</guid>
            <category><![CDATA[split-images-in-go]]></category>
            <category><![CDATA[golang]]></category>
            <category><![CDATA[image-slicer]]></category>
            <category><![CDATA[slice-images-in-go]]></category>
            <category><![CDATA[go]]></category>
            <dc:creator><![CDATA[Hiro]]></dc:creator>
            <pubDate>Fri, 12 May 2023 23:07:38 GMT</pubDate>
            <atom:updated>2023-06-09T03:27:03.782Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/50/0*0pYWHjFNl7L-8u_l" /></figure><p>Introducing Go Image Slicer: The Comprehensive Go Package for Image Slicing and Joining, Filling the Gap in Go’s Image Processing Landscape</p><p>I was tasked with building a puzzle game in Go, but I struggled to find a reliable library or article on how to slice images. Eventually, I had to settle for using Python’s image-slicer and build a Python microservice — Game-Engine — instead. However, after gaining a deep understanding of how image-slicer worked in Python, I decided to fill the gap in Go and create my own image-slicing library. This led me to create Go Image Slicer, a powerful and easy-to-use package for slicing and joining images in Go.</p><p>This tutorial will assume you have some basic <strong>Go</strong> programming knowledge (e.g. Syntax and Fundamentals Concept). If you don’t know what Go is or how to write basic Go programming, I recommend you to start learning from here first ( <a href="https://go.dev/tour/">https://go.dev/tour</a>/).</p><p>1. Install Go 1.19+ (Learn how to install Go here <a href="https://go.dev/doc/install">https://go.dev/doc/install</a>)</p><p>1. Create Project Directory</p><pre>mkdir go-slice-images</pre><p>2. Init the Go Modules</p><pre>go mod init example/go-slice-images</pre><pre>go get github.com/golangFame/imageslicer</pre><p>2. Lets write a program to slice an image and save the tiles to a directory</p><p>slice images into 2*2 grid and save ’em in the “sliced_tiles” directory</p><p>3. Run the program</p><pre>go run slice_image_2*2.go</pre><ol><li><a href="https://github.com/golangFame/imageslicer">https://github.com/golangFame/imageslicer</a><a href="https://github.com/goferHiro/image-slicer/tree/main/examples/basic">/tree/main/examples/basic</a></li><li><a href="https://gist.github.com/Nasfame/3dd713bbc4b36c64590f39d3dc58904b">https://gist.github.com/Nasfame/3dd713bbc4b36c64590f39d3dc58904b</a></li></ol><pre>Join(tiles,grid) (img image.Image, err error)</pre><p>2. Try out other easily available functions such as reading image for base64, urls and local paths.</p><pre>GetImageFromBase64(base64str) (img image.Image, err error)<br>GetImageFromUrl(imgUrl) (img image.Image)<br>GetImageFromPath(imgLocalPath) (img image.Image, err error)</pre><p>3. Checkout the tests integrated to the code repo.</p><p>4. Checkout Go <a href="https://go.dev/doc/tutorial/workspaces">Workspaces</a></p><p><em>Originally published at </em><a href="https://medium.com/@goferhiro/go-image-slicer-the-easy-way-to-slice-and-join-images-in-go-db26de93fc5e?source=user_profile---------0----------------------------"><em>https://medium.com</em></a><em> on May 12, 2023.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2d1a8f390185" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Companies I am not interested in !]]></title>
            <link>https://laciferin.medium.com/companies-i-am-not-interested-in-4eaf2dd45b80?source=rss-4142d6db8ecb------2</link>
            <guid isPermaLink="false">https://medium.com/p/4eaf2dd45b80</guid>
            <category><![CDATA[goferhiro]]></category>
            <category><![CDATA[hiro-connect]]></category>
            <category><![CDATA[laciferin]]></category>
            <category><![CDATA[connect-with-me]]></category>
            <category><![CDATA[blacklist]]></category>
            <dc:creator><![CDATA[Hiro]]></dc:creator>
            <pubDate>Wed, 03 May 2023 16:48:02 GMT</pubDate>
            <atom:updated>2023-05-04T01:40:43.576Z</atom:updated>
            <content:encoded><![CDATA[<h3>Companies I am not interested in !</h3><p>I have chosen not to pursue opportunities with the following companies !!</p><figure><img alt="“Black”listed companies" src="https://cdn-images-1.medium.com/max/1024/1*p-nhPBQiORGlS1h5XeqREw.jpeg" /></figure><ul><li><a href="https://www.xldynamics.com/">XL Dynamics</a></li><li><a href="https://www.linkedin.com/company/nuvento/?originalSubdomain=in"><strong>Nuvento</strong></a></li><li><a href="https://in.linkedin.com/company/fynd-shopsense">Fynd</a></li><li><a href="https://www.linkedin.com/company/cloudcollabtechnologies/?originalSubdomain=in">Cloud Collab</a></li><li><a href="https://www.linkedin.com/company/pyorxyz/">Pyor</a></li><li><a href="http://hypertest.co">Hypertest</a></li><li><a href="https://zopsmart.com">ZopSmart</a></li><li><a href="https://bzinga.com/">Bzinga</a></li><li><a href="https://www.linkedin.com/company/zeptonow/?original_referer=laciferin">Zepto</a></li></ul><p><em>I have either worked with these companies in the past and have decided to explore new work environments, or I have interviewed with them and had negative experiences. Additionally, I have researched their work culture and have had conversations with current and former employees, and based on that information, I have determined that these companies would not be a good fit for me. It’s important to me to work for a company whose values and culture align with my own, and unfortunately, I do not see that alignment with these particular companies.</em></p><p>While I really appreciate their interest in my skills and experience, I think that these companies are not the right fit for me at this time. I kindly request that recruiters from these companies do not contact me in the future. Thank you for your understanding.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/850/0*aHAoAXp1eiMEMDg-.jpg" /><figcaption>“The only way to do great work is to love what you do.” — Steve Jobs</figcaption></figure><p>P.S — I want to reiterate that my sole intention in sharing this list of companies is to save everyone’s time. I believe that it’s important to be transparent about my preferences and avoid wasting anyone’s time, including my own and that of recruiters from these companies. Thank you for your understanding.</p><p>Those interesting in connecting me — <a href="https://jeyserhiro.github.io/hiro_connect/#contact">Contact Me</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4eaf2dd45b80" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>