<?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 Sithum Bopitiya on Medium]]></title>
        <description><![CDATA[Stories by Sithum Bopitiya on Medium]]></description>
        <link>https://medium.com/@sithumonline?source=rss-31fd9c360862------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*LGwRhWk3kR1zw-puoDUQzQ.jpeg</url>
            <title>Stories by Sithum Bopitiya on Medium</title>
            <link>https://medium.com/@sithumonline?source=rss-31fd9c360862------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 28 Nov 2026 18:13:27 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@sithumonline/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[Journey to cross-platform GUI]]></title>
            <link>https://medium.com/@sithumonline/journey-to-cross-platform-gui-39f8b3b8f1de?source=rss-31fd9c360862------2</link>
            <guid isPermaLink="false">https://medium.com/p/39f8b3b8f1de</guid>
            <dc:creator><![CDATA[Sithum Bopitiya]]></dc:creator>
            <pubDate>Wed, 24 Apr 2024 02:28:40 GMT</pubDate>
            <atom:updated>2024-04-24T02:28:40.020Z</atom:updated>
            <content:encoded><![CDATA[<p>My problem is simple, I want to virtualize large JSON files.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xPwOYlf9_cIqh-dXUn60FA.png" /></figure><p>Like any other person, first I checked what the existing solutions were. And <a href="https://jsoncrack.com/editor">JSON Crack</a> was the best tool I found for it, but it had a limitation: even as a paid tool it couldn’t handle large JSON files. So I decided to write my own visualizer.</p><h4>Golang based GUI</h4><p>Since Golang is my go-to language, I tried to find a Golang library or framework that gave a good enough node editor. Unfortunately, I couldn’t find any library for that.</p><p><a href="https://github.com/sithumonline/json_x/blob/317d3393c06f09c4b7f793b38a6aac86f3a723f6/main.go#L283">json_x/main.go at 317d3393c06f09c4b7f793b38a6aac86f3a723f6 · sithumonline/json_x</a></p><h4>JavaScript</h4><p>For JavaScript, I found an awesome library called <a href="https://reactflow.dev/">React Flow</a>. React Flow worked very well for small JSON files, however, when it came to large JSON files it started to cause some rendering issues like some connections between nodes not being visible and having to drag the node around to show the connections.</p><p>The second main problem with React Flow was the layout algorithm. <a href="https://github.com/kieler/elkjs">Elkjs</a> is the best layout library that I found for node graphs. It also works very well for small JSON, but it does not return anything when it comes to large JSON files.</p><p><a href="https://github.com/sithumonline/json_x/blob/POC/my-react-app/src/App.jsx">json_x/my-react-app/src/App.jsx at POC · sithumonline/json_x</a></p><h4>Golang + JavaScript</h4><p>I found a nice Golang library called <a href="https://github.com/nulab/autog">autog</a> for layout calculation. What I did was populate the Jsx template file with Golang and then bundle it using <a href="https://github.com/evanw/esbuild">esbuild</a> on demand. However, even after feeding the data to React flow, It couldn’t render large JSON files properly as I said before.</p><p><a href="https://github.com/sithumonline/json_x/blob/317d3393c06f09c4b7f793b38a6aac86f3a723f6/main.go#L348">json_x/main.go at 317d3393c06f09c4b7f793b38a6aac86f3a723f6 · sithumonline/json_x</a></p><h4><strong>It’s time for a desktop app</strong></h4><p>After several failed attempts to build a web app, I decided to build a desktop app. I realized that because of JavaScript’s failure, Electron or Flutter couldn’t do it.</p><p>First I tried <a href="https://qtnodes.readthedocs.io/en/master/overview.html">qtnodes</a> from QT but had difficulties configuring the package with QT. Then I tried PyQt with <a href="https://chantonic.com/NodeGraphQt/api/index.html">NodeGraphQt</a>, and it worked but it didn’t give me the look and feel (user experience) I needed.</p><p><a href="https://github.com/sithumonline/json_x/blob/POC/my-python-app_3/main.py">json_x/my-python-app_3/main.py at POC · sithumonline/json_x</a></p><p>After that, I tried <a href="https://dearpygui.readthedocs.io/en/latest/">Dear PyGui </a>and <a href="https://pygraphviz.github.io/">PyGraphviz</a> via <a href="https://networkx.org/">NetworkX</a> for layout algorithms. It worked really well even if it had little lag on the UI when rendering large JSON files. However, the problem started when I was trying to build a binary for sharing. I realized there isn’t any solid way to ship binary for Python apps.</p><p><a href="https://github.com/sithumonline/json_x/blob/POC/my-python-app_4/main.py">json_x/my-python-app_4/main.py at POC · sithumonline/json_x</a></p><h3><strong>Dear ImGui</strong></h3><p>I had never written a real C++ app before and was worried if I could make it. The library configuration took a long time and I somehow managed to configure ImGui plus OpenGl. I used <a href="https://github.com/Nelarius/imnodes">Imnodes</a> as my node editor.</p><p><a href="https://github.com/sithumonline/json_x/tree/main">GitHub - sithumonline/json_x</a></p><h4><strong>Json X</strong> was born</h4><p>A cross platform solution to unravel JSON structures into intuitive graphs to see the connections between properties crystal clear.<br>Built to help navigate JSON with ease, it helps simplify workflows and spend less time wrestling with complex data!</p><p><a href="https://sithum.online/json_x/">JSON X - Visualize, Parse and Format JSON</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=39f8b3b8f1de" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Why Node.js is slow?]]></title>
            <link>https://medium.com/@sithumonline/why-node-js-is-slow-6c3b66079474?source=rss-31fd9c360862------2</link>
            <guid isPermaLink="false">https://medium.com/p/6c3b66079474</guid>
            <dc:creator><![CDATA[Sithum Bopitiya]]></dc:creator>
            <pubDate>Fri, 03 Feb 2023 02:55:03 GMT</pubDate>
            <atom:updated>2023-02-03T04:58:20.062Z</atom:updated>
            <content:encoded><![CDATA[<p>My dear friends and I are making benchmarks against web servers when we have free time. What we found can be controversial and I am not going to tell my conclusion is fully accurate. Maybe you have a better idea about this therefore feel free to add your idea as well.</p><h3>Benchmark methodology</h3><p>Our benchmark method is very simple, we implement two endpoints without using any 3rd party lib.</p><ol><li>Small — sends the response right back.</li><li>Big — prints 1–50000 then it sends the response.</li></ol><p>We used a benchmark tool called <strong>wrk</strong> (<a href="https://github.com/wg/wrk">https://github.com/wg/wrk</a>), and we send 20 parallel requests for 5s to each endpoint separately.</p><h3>Big</h3><p>Send 20 parallel requests for 5s to the big endpoint.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*USxAWe0BMkhvkDP9" /></figure><p>The first time we noticed Node.js couldn’t handle the concurrent big request but Golang handled it like cream.</p><h3>Small</h3><p>Send 20 parallel requests for 5s to the small endpoint.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*JJ4mhXZOsQIW9UeM" /></figure><p>Node.js is significantly slow.</p><h3>Big and Small</h3><p>Send 20 parallel requests for 5s to both big and small endpoints.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*_XGJXEr5Rqo_Eypl" /></figure><h3>How Golang works on CPU</h3><p>Most of the time goroutines are running on multiple CPUs simultaneously.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*bD67LQOraFWBzN2K" /></figure><p>Source: <a href="https://github.com/sithumonline/go-profiler-notes/blob/main/guide/README.md">https://github.com/sithumonline/go-profiler-notes/blob/main/guide/README.md</a></p><h3>How Node.js works on CPU</h3><p>Sounds like Node.js also can take advantage of multiple CPUs, but it relies on an event loop therefore Node.js is single treading as well as multi threading.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/837/0*eiMRaHKlcLlaV5Ku" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/838/0*WVDfxDOU-nerZlD1" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/839/0*aNOsPLe76oLrRI26" /></figure><p>Source: <a href="https://o7planning.org/11951/nodejs-event-loop">https://o7planning.org/11951/nodejs-event-loop</a></p><h3>Where is the Node.js bottleneck</h3><p>Let’s start most controversial part.</p><p>Both Node.js and Golang are garbage collection languages, Node.js uses <em>young generation </em>and Golang uses<em> stop the world</em> garbage collection method that difference is a reason for the lack of performers.</p><p>Golang uses its own scheduler for jobs done by Node.js event loop and it runs when the garbage collector stops the runtime, therefore, I assume that is the main bottleneck of Node.js when we compare high-level architecture.</p><p><a href="https://programming-language-benchmarks.vercel.app/javascript-vs-go">Javascript VS Go benchmarks</a></p><p>Code: <a href="https://github.com/sithumonline/BigSmall">https://github.com/sithumonline/BigSmall</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6c3b66079474" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Buildpacks, Docker and Kubernetes]]></title>
            <link>https://medium.com/sliit-foss/buildpacks-docker-and-kubernetes-f58fc542829?source=rss-31fd9c360862------2</link>
            <guid isPermaLink="false">https://medium.com/p/f58fc542829</guid>
            <category><![CDATA[kubernetes]]></category>
            <category><![CDATA[docker]]></category>
            <category><![CDATA[cloud-native]]></category>
            <category><![CDATA[buildpack]]></category>
            <category><![CDATA[cloud-native-buildpacks]]></category>
            <dc:creator><![CDATA[Sithum Bopitiya]]></dc:creator>
            <pubDate>Thu, 17 Dec 2020 13:42:45 GMT</pubDate>
            <atom:updated>2020-12-17T13:42:45.060Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*CrXhj6U72_eBkf3G6xdnNA.png" /></figure><h3>What’s Buildpacks?</h3><p><a href="https://buildpacks.io/">Buildpacks</a> creates docker images for your apps with zero config.</p><h3>How to create docker image with buildpacks?</h3><p><strong>Install pack</strong></p><p>First of all, you must have a pack.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/10eb9fc3ea88fbe50d152e7d07164a13/href">https://medium.com/media/10eb9fc3ea88fbe50d152e7d07164a13/href</a></iframe><p><strong>Select a builder</strong></p><p>You must decide which builder you will gonna use to build image.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/48e36ac481621d02b6b450a731ed70e2/href">https://medium.com/media/48e36ac481621d02b6b450a731ed70e2/href</a></iframe><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*vll7sVa0rpXnJXUdstFTGA.png" /></figure><p>Now you can see list of cool builders.</p><p><strong>Build your image</strong></p><p>You’ve already decided which builder you’re gonna use. So, now you can build your image.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/73a11b791814542a648f85f1b78b2e73/href">https://medium.com/media/73a11b791814542a648f85f1b78b2e73/href</a></iframe><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*88G4KuYNcwI77XnL7PDlWQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*UVnPKzgNXKlxfFn4hMiskA.png" /></figure><p>Now, your docker is image ready…!!!</p><p><strong>Push your docker image</strong></p><p>You can push your image to container registry.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/0353012a8264cd80748c524a74f0d07c/href">https://medium.com/media/0353012a8264cd80748c524a74f0d07c/href</a></iframe><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*4XalKwH0fGhkEl3TlWmAuA.png" /></figure><p>If you did it successfully, you can see it on the docker hub.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/978/1*QWEOW6G_E6oetcLO_wf4Lg.png" /></figure><h3>Deploy your docker image to Kubernetes</h3><p>This is the time to deploy your newly created image.</p><p><strong>Create kubernetes objects</strong></p><p>We use <a href="https://en.wikipedia.org/wiki/YAML">YAML</a> to create <a href="https://kubernetes.io/docs/concepts/overview/working-with-objects/kubernetes-objects/">kubernets objects</a>.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/eaa8a7167ca77efa5bfc2e6c83e2e935/href">https://medium.com/media/eaa8a7167ca77efa5bfc2e6c83e2e935/href</a></iframe><p>Deployment — Group of pods</p><p>NodePort — Service; It’ll route traffic from port 3001 to host port 8080</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/779/1*zzyQgv-4WL01P9kWkr2sUg.png" /></figure><p><strong>Minikube</strong></p><p><a href="https://minikube.sigs.k8s.io/docs/">minikube</a> allows us to set up kubernetes cluster on our daily driver.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/5711d7c2f16b6c827386517b8bf95943/href">https://medium.com/media/5711d7c2f16b6c827386517b8bf95943/href</a></iframe><figure><img alt="" src="https://cdn-images-1.medium.com/max/641/1*sI2cUielfSwAsVpBlIRlgQ.png" /></figure><p><strong>Deploy to Kubernetes</strong></p><p>After the started minikube, You can deploy your docker to kubernetes.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/6defb2180e032586a4910b745295d58a/href">https://medium.com/media/6defb2180e032586a4910b745295d58a/href</a></iframe><figure><img alt="" src="https://cdn-images-1.medium.com/max/734/1*1duzNO-Jhx_jZDz9AU_CDw.png" /></figure><p><strong>View the deployment</strong></p><p>You can get the list of pods.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/f9724668fcbad333dc8c086e4b1e6491/href">https://medium.com/media/f9724668fcbad333dc8c086e4b1e6491/href</a></iframe><figure><img alt="" src="https://cdn-images-1.medium.com/max/759/1*QgAiZsv868EgiE0NzUKVcw.png" /></figure><p>You can view the details of each pod.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/652810f9e161676c9f936423222e208e/href">https://medium.com/media/652810f9e161676c9f936423222e208e/href</a></iframe><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*u8sXOnQDbMTMgt14a9D0RA.png" /></figure><p><strong>View the service</strong></p><p>You can get the list of services.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/74aab7afd3e96e60c68fa2d556356868/href">https://medium.com/media/74aab7afd3e96e60c68fa2d556356868/href</a></iframe><figure><img alt="" src="https://cdn-images-1.medium.com/max/890/1*icnviFl82X_CGQQngSwU3A.png" /></figure><p>You can view the details of each service.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/3907111abc8b4405f81156a14d1556f2/href">https://medium.com/media/3907111abc8b4405f81156a14d1556f2/href</a></iframe><figure><img alt="" src="https://cdn-images-1.medium.com/max/724/1*r7MB_4esJBBhZ9lv4dJsYw.png" /></figure><p><strong>Test the deployment</strong></p><p>If you did all the steps successfully, you can visit your web app via the browser.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*GkGQTX3E-A23NtCutaOviA.png" /></figure><p>Don’t forget to stop minikude.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/3568d311d50d7fdd1158e7f4241ab6ce/href">https://medium.com/media/3568d311d50d7fdd1158e7f4241ab6ce/href</a></iframe><p>If you have any questions regarding this article, feel free to drop a comment below or <a href="https://twitter.com/sithumonline">tweet</a>.</p><p><strong>Reference</strong></p><ul><li><a href="https://buildpacks.io/docs/">Getting Started · Cloud Native Buildpacks</a></li><li><a href="https://minikube.sigs.k8s.io/docs/">Welcome!</a></li><li><a href="https://kubernetes.io/docs/concepts/overview/working-with-objects/kubernetes-objects/">Understanding Kubernetes Objects</a></li><li><a href="https://docs.docker.com/get-started/kube-deploy/">Deploy to Kubernetes</a></li><li><a href="https://kubernetes.io/docs/tasks/inject-data-application/define-environment-variable-container/">Define Environment Variables for a Container</a></li><li><a href="https://kubernetes.io/docs/concepts/services-networking/connect-applications-service/">Connecting Applications with Services</a></li><li><a href="https://create-react-app.dev/docs/adding-custom-environment-variables/">Adding Custom Environment Variables | Create React App</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f58fc542829" width="1" height="1" alt=""><hr><p><a href="https://medium.com/sliit-foss/buildpacks-docker-and-kubernetes-f58fc542829">Buildpacks, Docker and Kubernetes</a> was originally published in <a href="https://medium.com/sliit-foss">SLIIT FOSS Community</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>