<?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"><channel><title><![CDATA[Untitled Publication]]></title><description><![CDATA[Untitled Publication]]></description><link>https://probablyarth.hashnode.dev</link><image><url>https://cdn.hashnode.com/res/hashnode/image/upload/v1677049553006/xZWQJgOI7.png</url><title>Untitled Publication</title><link>https://probablyarth.hashnode.dev</link></image><generator>RSS for Node</generator><lastBuildDate>Sat, 28 Nov 2026 04:26:44 GMT</lastBuildDate><atom:link href="https://probablyarth.hashnode.dev/rss.xml" rel="self" type="application/rss+xml"/><language><![CDATA[en]]></language><ttl>60</ttl><item><title><![CDATA[How I implemented Java Code Testing without any build automation tool for my school's club]]></title><description><![CDATA[As a core member of the open-source club at scaler school of technology, I was tasked to write a GitHub workflow that would test contributor's solution for…]]></description><link>https://probablyarth.hashnode.dev/how-i-implemented-java-code-testing-without-any-build-automation-tool-for-my-schools-club</link><guid isPermaLink="true">https://probablyarth.hashnode.dev/how-i-implemented-java-code-testing-without-any-build-automation-tool-for-my-schools-club</guid><category><![CDATA[Java]]></category><category><![CDATA[GitHub]]></category><category><![CDATA[github-actions]]></category><category><![CDATA[Workflow Automation]]></category><dc:creator><![CDATA[probablyArth]]></dc:creator><pubDate>Thu, 21 Sep 2023 07:50:53 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1695282463546/d11574bd-3665-41e0-ac18-25e2cdb74572.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>As a core member of the open-source club at <a target="_blank" href="https://www.scaler.com/school-of-technology/">scaler school of technology</a>, I was tasked to write a GitHub workflow that would test contributor's solution for a given DSA problem.</p>
<h2 id="heading-the-desired-folder-structure">The Desired Folder Structure</h2>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1695280753311/0fceec11-8ff1-46dd-a44a-1f45adccbea6.png" alt class="image--center mx-auto" /></p>
<p>This was the folder structure I had in mind. First I thought I should go for a testing library in Java, so I scoured the internet and found junit5.</p>
<h2 id="heading-the-problem-with-testing-libraries">The problem with testing libraries</h2>
<p>Testing libraries are fairly easy to set up and plug into GitHub workflows, but there's one major flaw, they are only customizable to some extent.</p>
<p>The desired flow I had in mind was ~</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1695280345649/dab6e7cd-77ca-425b-80d8-b00e7e2d9253.png" alt class="image--center mx-auto" /></p>
<p>This was somewhat achievable with testing libraries, but they require build automation tools like Maven, which means that the folder structures would become more complicated and I wanted to keep it very simple so that my fellow batchmates wouldn't get confused too much.</p>
<h2 id="heading-my-solution-to-the-problem">My Solution to the problem</h2>
<p>I then decided that I would write a custom GitHub workflow to tackle this problem.</p>
<p>Just look for file changes inside <code>javaProblems</code> directory, see which file was changed and run the test file in that file's folder. It should be pretty simple, huh?</p>
<p>Or so I thought...</p>
<h3 id="heading-while-this-was-very-simple-there-were-a-few-gotchas">While this was very simple, there were a few gotchas.</h3>
<ul>
<li><p>the tests would run even if only the <code>readme.md</code> file was changed.</p>
</li>
<li><p>the tests would run even if I wanted to add a new problem, which contained empty boilerplate <code>Solution.java</code> file.</p>
</li>
</ul>
<h3 id="heading-how-i-tackled-them">How I tackled them</h3>
<ul>
<li><p>To tackle the first problem, I wrote a shell script to loop through the changed files and if the filename starts with <code>javaProblems/</code> which is the root directory for all the problems folders and if the filename ends with <code>.java</code> only then should it proceed further.</p>
<ul>
<li><p>Then to get which problem's solution was edited, I used the <code>awk</code> command which I learned in the CLI &amp; shell-scripting class at my school.</p>
</li>
<li><p>Here's an example of how the <code>file</code> variable looked like - <code>javaProblems/problem1/Solution.java</code></p>
</li>
<li><p>I had to extract the <code>problem1</code> identifier, I used <code>-F/</code> in <code>awk</code> to divide the file name by <code>/</code>Then I returned the second field from the result which would be <code>problemX</code> .</p>
</li>
<li><p>then I <code>cd</code> into <code>javaProblems/problemX</code> then ran the tests inside that folder and <code>cd</code>'d out.</p>
<pre><code class="lang-bash">  <span class="hljs-keyword">for</span> file <span class="hljs-keyword">in</span> <span class="hljs-variable">${{ steps.changed-files.outputs.all_changed_files }</span>}; <span class="hljs-keyword">do</span>
              <span class="hljs-keyword">if</span> [[ <span class="hljs-string">"<span class="hljs-variable">$file</span>"</span> == javaProblems/* &amp;&amp; <span class="hljs-string">"<span class="hljs-variable">$file</span>"</span> == *.java ]]; <span class="hljs-keyword">then</span>
                folderName=$(awk -F/ <span class="hljs-string">'{print $2}'</span> &lt;&lt;&lt; <span class="hljs-string">"<span class="hljs-variable">$file</span>"</span>)
                <span class="hljs-built_in">echo</span> <span class="hljs-string">"Running Tests for <span class="hljs-variable">$folderName</span>"</span>
                <span class="hljs-built_in">cd</span> <span class="hljs-string">"javaProblems/<span class="hljs-variable">$folderName</span>"</span>
                javac Test.java
                java Test
                <span class="hljs-built_in">cd</span> ../..
              <span class="hljs-keyword">fi</span>
            <span class="hljs-keyword">done</span>
</code></pre>
</li>
</ul>
</li>
<li><p>To tackle the second problem, I added an <code>if</code> condition in the workflow file</p>
<ul>
<li><p>Once the PR is labeled with <code>java-problem-solution</code> only then should it run the tests.</p>
</li>
<li><pre><code class="lang-yaml">  <span class="hljs-attr">on:</span>
    <span class="hljs-attr">pull_request:</span>
      <span class="hljs-attr">types:</span> [<span class="hljs-string">labeled</span>]
      <span class="hljs-attr">paths:</span>
        <span class="hljs-bullet">-</span> <span class="hljs-string">"javaProblems/**"</span>
  <span class="hljs-attr">jobs:</span>
    <span class="hljs-attr">test-java-solutions:</span>
      <span class="hljs-attr">if:</span> <span class="hljs-string">${{</span> <span class="hljs-string">github.event.label.name</span> <span class="hljs-string">==</span> <span class="hljs-string">'java-problem-solution'</span> <span class="hljs-string">}}</span>
</code></pre>
</li>
</ul>
</li>
</ul>
<h2 id="heading-but-how-were-the-test-files-implemented-without-any-testing-libraries">But how were the Test files implemented without any testing libraries?</h2>
<p>Let's take an example:</p>
<p>Suppose this is the <code>readme.md</code> file for the problem</p>
<pre><code class="lang-markdown"><span class="hljs-section"># Max and Min of an Array</span>

You are given an array <span class="hljs-code">`A`</span> of type <span class="hljs-code">`int[]`</span>.
Return an <span class="hljs-code">`array`</span> such that:

<span class="hljs-bullet">-</span> <span class="hljs-code">`array[0]`</span> is the minimum of the array <span class="hljs-code">`A`</span>
<span class="hljs-bullet">-</span> <span class="hljs-code">`array[1]`</span> is the maximum of the array <span class="hljs-code">`A`</span>

<span class="hljs-code">```
# Example input
A = [1, 2, 3, 4, 5, 6, 7]

# Example output
[1, 7]
```</span>
</code></pre>
<p>Here's how the boilerplate <code>Solution.java</code> file looks like -</p>
<pre><code class="lang-java"><span class="hljs-comment">// Solution.java</span>
<span class="hljs-keyword">public</span> <span class="hljs-class"><span class="hljs-keyword">class</span> <span class="hljs-title">Solution</span> </span>{
    <span class="hljs-keyword">public</span> <span class="hljs-keyword">int</span>[] solve(<span class="hljs-keyword">int</span>[] A) {
        <span class="hljs-keyword">return</span> <span class="hljs-keyword">new</span> <span class="hljs-keyword">int</span>[] {};
    }
}
</code></pre>
<p>To Test the solution inside the <code>Test.java</code> file I would instantiate a new <code>Solution</code> object, pass in the input inside the <code>solve</code> method and compare the returned answer with the actual answer.</p>
<p>If they are not the same, then it would throw an error.</p>
<pre><code class="lang-java"><span class="hljs-comment">// Test.java</span>
<span class="hljs-keyword">import</span> java.util.logging.Level;
<span class="hljs-keyword">import</span> java.util.logging.Logger;

<span class="hljs-keyword">public</span> <span class="hljs-class"><span class="hljs-keyword">class</span> <span class="hljs-title">Test</span> </span>{
    <span class="hljs-function"><span class="hljs-keyword">public</span> <span class="hljs-keyword">static</span> <span class="hljs-keyword">void</span> <span class="hljs-title">main</span><span class="hljs-params">(String[] args)</span> <span class="hljs-keyword">throws</span> Exception </span>{
        Logger logger = Logger.getLogger(Logger.GLOBAL_LOGGER_NAME);
        Solution solveSolution = <span class="hljs-keyword">new</span> Solution();
        <span class="hljs-keyword">int</span>[] ans = solveSolution.solve(<span class="hljs-keyword">new</span> <span class="hljs-keyword">int</span>[] { <span class="hljs-number">2</span>, <span class="hljs-number">3</span>, <span class="hljs-number">4</span>, <span class="hljs-number">1</span>, <span class="hljs-number">1</span>, <span class="hljs-number">7</span>, <span class="hljs-number">8</span> });
        <span class="hljs-keyword">int</span> min, max;
        <span class="hljs-keyword">try</span> {
            min = ans[<span class="hljs-number">0</span>];
            max = ans[<span class="hljs-number">1</span>];
        } <span class="hljs-keyword">catch</span> (Exception e) {
            logger.log(Level.SEVERE, <span class="hljs-string">"Runtime error"</span>);
            System.exit(<span class="hljs-number">1</span>);
            <span class="hljs-keyword">throw</span> <span class="hljs-keyword">new</span> Error(<span class="hljs-string">"Runtime Error"</span>);
        }
        <span class="hljs-keyword">if</span> (min != <span class="hljs-number">1</span> || max != <span class="hljs-number">8</span>) {
            logger.log(Level.SEVERE, <span class="hljs-string">"Wrong solution!"</span>);
            System.exit(<span class="hljs-number">1</span>);
            <span class="hljs-keyword">throw</span> <span class="hljs-keyword">new</span> Exception(<span class="hljs-string">"Wrong solution!"</span>);
        }
        System.out.print(<span class="hljs-string">"Testcase passed!"</span>);
    }
}
</code></pre>
<p>And tada 🎉, then I had a working solution that fulfilled every single desired behavior I had thought of.</p>
]]></content:encoded></item><item><title><![CDATA[2022 Wrapup]]></title><description><![CDATA[I know I know I'm a little late, but let me introduce myself]]></description><link>https://probablyarth.hashnode.dev/2022-wrapup</link><guid isPermaLink="true">https://probablyarth.hashnode.dev/2022-wrapup</guid><category><![CDATA[WeMakeDevs]]></category><category><![CDATA[Developer]]></category><category><![CDATA[Open Source]]></category><category><![CDATA[wrapup2022]]></category><category><![CDATA[Experience ]]></category><dc:creator><![CDATA[probablyArth]]></dc:creator><pubDate>Sun, 12 Mar 2023 17:20:36 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1678641414147/9a0d4723-7c41-4271-9648-054ad18be4f2.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>Hi, I'm Arth, a full-stack developer from India straight out of high school, I sometimes contribute to open-source projects whenever I can and build projects that excite me.</p>
<p>Let's start with the stats</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1678630212829/b02b0a28-65f1-4b1e-8dad-6ffc13f1f3ab.png" alt class="image--center mx-auto" /></p>
<p>Not bad but eh, not as good as I'd like it to be.</p>
<p>Some cool stuff and projects I did (chronologically from the start).</p>
<h2 id="heading-numbers-converter">Numbers Converter</h2>
<p><a target="_blank" href="https://numbers-converter.vercel.app/"><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1678637530200/96a629fb-4eef-4b7b-b00d-956b25656706.png" alt class="image--center mx-auto" /></a></p>
<p>A web app for the interconversion of numbers between different number systems with decent UI.</p>
<h2 id="heading-react-workshop">React Workshop</h2>
<p><a target="_blank" href="https://www.linkedin.com/posts/probablyarth_reactjs-activity-6908441422685683712-nZTU?utm_source=share&amp;utm_medium=member_desktop"><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1678637790723/b42aec7a-3d2d-433b-9978-ce982f3facfa.jpeg" alt class="image--center mx-auto" /></a></p>
<p>Yes sir! yo-boi hosted a workshop and taught react while building the same numbers-converter app from above on the <a target="_blank" href="https://markitup.in/">MarkitUpX discord server</a>.</p>
<h2 id="heading-discord-homepage-clone">Discord homepage clone</h2>
<p><a target="_blank" href="https://discord-clone-arththapa.vercel.app/"><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1678637984130/87a0482b-0b2a-495c-bafa-7b7a8ce4c053.png" alt class="image--center mx-auto" /></a></p>
<p>Pixel-perfect clone of the discord homepage, nothing complex I just wanted to see how well I can reproduce from the design.</p>
<h2 id="heading-bun-a-js-runtime-faster-than-the-bolts-run-yt-video">Bun, a JS runtime faster than the bolt's run (YT video)</h2>
<p><a target="_blank" href="https://www.youtube.com/watch?v=hqBf63Dz1vo&amp;t=20s"><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1678639833069/101e01e4-4eb1-4878-8891-89680dab79a0.png" alt class="image--center mx-auto" /></a></p>
<p>made a short and informative video about then newly released framework <a target="_blank" href="https://bun.sh/">BunJS</a>, it is pretty fast. It took me a good amount of time to make and edit the video and it paid off! Reached 1k+ views within the first week!</p>
<h2 id="heading-build-and-deploy-a-pokedex-webapp-with-svelte-js-on-vercel-in-under-9-minutes">BUILD and DEPLOY a Pokedex webapp with svelte js on Vercel in Under 9 minutes</h2>
<p><a target="_blank" href="https://www.youtube.com/watch?v=tqZ0XO41zAo&amp;t=7s"><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1678639963494/2b48a01d-885f-4b84-bd60-cc03ccf7f70d.png" alt class="image--center mx-auto" /></a></p>
<p>Yes!! Another video and this one wasn't short at all, it took many MANY hours to make and I'm very proud of it!</p>
<h2 id="heading-social-house-11-voice-dating-web-app-for-a-client">Social House - 1:1 Voice dating web app for a client</h2>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1678634700404/02738c27-aba2-42ca-a7f7-aacc44c8d3bc.png" alt class="image--center mx-auto" /></p>
<p>A one-on-one voice-dating web app for a freelance client written in MERN and it was without typescript btw 🥲 but still it was cool enough, after completing that I got very confident in my developer skills and since then I have the mindset that I can build anything I want for the web, literally. Cannot leave a link to this since it's a private project 🤐</p>
<h2 id="heading-ballerina-coding-challenge-2022">Ballerina Coding Challenge 2022</h2>
<p><a target="_blank" href="https://twitter.com/ballerinalang/status/1578415902969630722"><img src="https://pbs.twimg.com/media/Feeo4mpXwAAqChE?format=jpg&amp;name=medium" alt="Image" /></a></p>
<p>Bagged my first hackathon (1000 USD). Won 3rd position among 7,500 developers around the world. Learned a brand new networking-based language named Ballerina</p>
<h2 id="heading-meet-scheduler-not-really">Meet Scheduler (not really)</h2>
<p>Sign up, Log in and check each other's schedule. A python school project. Nothing much to it, just a tkinter python app for my school project.</p>
<h2 id="heading-ezedit-edit-docx-for-free">EzEdit (Edit DOCX for free)</h2>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1678634956838/a00be83f-affd-410a-8270-8dc81990c568.png" alt /></p>
<p>Another cool thing I made was a free DOCX editor it was for a <a target="_blank" href="https://slingshotahead.com/">slingshot</a> challenge. You can learn more about them through the link, I have a very unfortunate and hilarious story that involves slingshot xD which I will probably share in a future blog, it's short and truly hilarious.</p>
<p>I made a web app using <a target="_blank" href="https://nextjs.org/">NextJS</a> and basically, the goal was to provide some form of interconversion in HTML/MD &lt;-&gt; DOCX. Now I didn't have much time in hand because of school and this was supposed to complete in a week so instead of trying to write a parser I immediately started looking for parser libraries in JS that perform interconversion b/w HTML and DOCX and to my surprise there were many but none of them performed the whole interconversion they were mostly one way and most of them weren't even working! But I did find a workaround for that and I will probably post it in a future blog I found it to be very smart and hilarious at the same time.</p>
<p>👇 Comment down below how you think I solved it!</p>
<h2 id="heading-modest-static-website">Modest (static website)</h2>
<p><a target="_blank" href="http://modestbykms.vercel.app"><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1678635419276/236b6cdd-463c-4693-a59d-7962b125c988.png" alt /></a></p>
<p>Made a website that revolves around sustainable development, I kinda like how I made the UI, tailwind CSS is truly amazing.</p>
<p>This was a submission for an inter-school competition, finished 2nd</p>
<h2 id="heading-concluding">Concluding</h2>
<p>And that's about almost everything I did in the last year, managed to do it whilst studying for 12th boards on the side so I'd say that's a win.</p>
<p>There are a few stories I would like to share and some of them are hilarious as I mentioned haha. You can be the first one to know about them if you follow me! 😁</p>
]]></content:encoded></item><item><title><![CDATA[Jason, a simple typesafe JSON ORM for your standalone application needs]]></title><description><![CDATA[Jason is a simple typesafe JSON ORM library for typescript. It has a mongoose-like Model class structure. Made with ❤️ by @probablyarth]]></description><link>https://probablyarth.hashnode.dev/jason-a-simple-typesafe-json-orm-for-your-standalone-application-needs</link><guid isPermaLink="true">https://probablyarth.hashnode.dev/jason-a-simple-typesafe-json-orm-for-your-standalone-application-needs</guid><category><![CDATA[json]]></category><category><![CDATA[orm]]></category><category><![CDATA[TypeScript]]></category><category><![CDATA[json-db]]></category><category><![CDATA[jsondb]]></category><dc:creator><![CDATA[probablyArth]]></dc:creator><pubDate>Wed, 22 Feb 2023 08:06:50 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1677050404449/3d11119e-f3c1-4e71-8b93-0d462f8840e5.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<h2 id="heading-background">Background</h2>
<p>I was making a side project which required a Database, the project was a self-hosted type of application for which the end user would have to host it locally by himself to use the project, it wouldn't make much sense if the end user had to do this much hassle to use my project! So I saw a problem and I solved it, if it was a problem for me, I'm sure someone else also needs something like this.</p>
<p>But there are already ORMs in the market for JSON you say? Well, I didn't find any of them good for my liking (personal preference), I liked the Mongoose library for mongoDB in which you can just pass the interface of your model into the constructor and it returns an object with CRUD methods.</p>
<p>This library is bare minimum and complex queries should be implemented by your own logic on top of the library like getting the records by Jason and applying your own logic to perform complex queries on them, (not keeping time complexity in mind because it's supposed to be for standalone software or very small scale project).</p>
<p>But I really enjoyed working on this so I might try to build a query builder on top of it!</p>
<h2 id="heading-installing">Installing</h2>
<pre><code class="lang-bash"><span class="hljs-comment"># using npm</span>
npm install @probablyarth/jason
<span class="hljs-comment"># using yarn</span>
yarn add @probablyarth/jason
</code></pre>
<p>Here is an example of how to use the library</p>
<pre><code class="lang-typescript"><span class="hljs-keyword">import</span> { Init, Model } <span class="hljs-keyword">from</span> <span class="hljs-string">"@probablyarth/jason"</span>;

Init(<span class="hljs-string">"path/to/database.json"</span>);

<span class="hljs-keyword">interface</span> IUser {
  name?: <span class="hljs-built_in">string</span>;
  age?: <span class="hljs-built_in">number</span>;
}

<span class="hljs-keyword">const</span> userModel = <span class="hljs-keyword">new</span> Model&lt;IUser&gt;(<span class="hljs-string">"users"</span>);

<span class="hljs-keyword">const</span> userId = userModel.insertOne({
  name: <span class="hljs-string">"probablyarth"</span>,
  age: <span class="hljs-number">17</span>,
});

<span class="hljs-keyword">const</span> user = userModel.findById(userId);

<span class="hljs-built_in">console</span>.log(user);
</code></pre>
<p>You can also use it without types,</p>
<pre><code class="lang-javascript"><span class="hljs-keyword">import</span> { Init, Model } <span class="hljs-keyword">from</span> <span class="hljs-string">"@probablyarth/jason"</span>;

Init(<span class="hljs-string">"path/to/database.json"</span>);

<span class="hljs-keyword">const</span> userModel = <span class="hljs-keyword">new</span> Model(<span class="hljs-string">"users"</span>);

<span class="hljs-keyword">const</span> userId = userModel.insertOne({
  <span class="hljs-attr">name</span>: <span class="hljs-string">"probablyarth"</span>,
  <span class="hljs-attr">age</span>: <span class="hljs-number">17</span>,
});

<span class="hljs-keyword">const</span> user = userModel.findById(userId);

<span class="hljs-built_in">console</span>.log(user);
</code></pre>
<p>You can go <a target="_blank" href="https://github.com/probablyArth/jason/blob/main/examples.ts">here</a> for more examples</p>
<h2 id="heading-check-it-out-on-github">Check it out on GitHub!</h2>
<p><a target="_blank" href="https://github.com/probablyArth/jason">Jason on GitHub</a></p>
<p>It'd be great if you could leave a ⭐️ on GitHub! Some traction would help in fine-tuning this library!</p>
<h2 id="heading-tl-dr">TL: DR;</h2>
<p>Do you like the mongoose library but need an easy-to-set-up database solution for your standalone application? Jason may be the right option for you!</p>
]]></content:encoded></item></channel></rss>