<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: RIK</title>
    <description>The latest articles on DEV Community by RIK (@satyaaytas).</description>
    <link>https://dev.to/satyaaytas</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F1852114%2Fa15dded7-7e71-4f34-932d-0b43687e1182.jpeg</url>
      <title>DEV Community: RIK</title>
      <link>https://dev.to/satyaaytas</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/satyaaytas"/>
    <language>en</language>
    <item>
      <title>Few hacks a dev needs</title>
      <dc:creator>RIK</dc:creator>
      <pubDate>Sun, 07 Jun 2026 11:18:34 +0000</pubDate>
      <link>https://dev.to/satyaaytas/few-hacks-a-dev-needs-3o25</link>
      <guid>https://dev.to/satyaaytas/few-hacks-a-dev-needs-3o25</guid>
      <description>&lt;p&gt;Few things that I adopted, which has helped me to be better developer. To be honest, I forget things quite fast. Journaling becomes more than just a thing to me. Helps me to keep whatever I did on check. Of course, readME files are one of the things that strikes in our mind at first.&lt;/p&gt;

&lt;p&gt;What inspired me are the daily scrum calls which are involved when most of us report to our seniors. Here is one typical format:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;DAILY STANDUP RECORDS
...
...
...
DAY 5 (31 May 2026)
OBJECTIVE: resolving JIRA-19
WINS: 
1) added a props functionality to the interface
2) the prompt given to the LLM has been updated
BLOCKAGES: 
1) the LLM still halucinates
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This is used for daily scrum. I even keep a track on weekly updates to pick the crux of the sprint I performed for the last 7 days in the following manner:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight markdown"&gt;&lt;code&gt;&lt;span class="gu"&gt;### Sprint 2: Gateway service designing skeleton (Week 4 - May 2026)&lt;/span&gt;

&lt;span class="gs"&gt;**Jira Epic:**&lt;/span&gt;
1) RAG-8 adding loggers and dockerfile def in a gateway
2) RAG-6 sketch system diagrams

&lt;span class="gs"&gt;**Sprint Summary Wins:**&lt;/span&gt;
1) updated cls, package dia of ingestion
2) created activity dia of ingestion
3) updated package dia of gateway
4) logger file and docker file for gateway service has been added
5) dockerfile of gate3way is deployed to dockerhub

&lt;span class="gs"&gt;**Sprint Summary Blockages:**&lt;/span&gt;
1) No blockages found
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;As the fragment, shown above says JIRA-19, one thing I use for sure is JIRA, especially the scrum dashboard. No issue with using Kanban dashboard. I make sure that appropriate GitHub repo has been integrated to JIRA.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fotuq26q6mfufdpwzw7ie.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fotuq26q6mfufdpwzw7ie.png" alt=" " width="800" height="418"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Notice that RAG-6, RAG-3 and so on are termed as JIRA ticket ID or simply ticket ID. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fgo6grzfnna9xnxyutz7k.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fgo6grzfnna9xnxyutz7k.png" alt=" " width="800" height="418"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;If you hover over the small vertical symbol you can track the committed message and the date when you did. This can be done using a trick called as &lt;strong&gt;smart commits&lt;/strong&gt;, often used in git command.&lt;/p&gt;

&lt;p&gt;First you create JIRA task under &lt;strong&gt;To Do&lt;/strong&gt; column after clicking at &lt;strong&gt;+ CREATE&lt;/strong&gt;, add a bit of description as well, a unique JIRA ticket ID shall be assigned. The small vertical button wont be visible yet.&lt;/p&gt;

&lt;p&gt;To connect to that JIRA task, commit messages need to be framed as followed. But make sure that you &lt;strong&gt;stage&lt;/strong&gt; the changes you did in your workspace using &lt;strong&gt;git add&lt;/strong&gt; command.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git commit &lt;span class="nt"&gt;-m&lt;/span&gt; &lt;span class="s2"&gt;"RAG-7 #to-do #comment started working on documentation"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This is for local commits. For updating the same to the remote server, where your JIRA account is hosted, git push command needs to be used.&lt;/p&gt;

&lt;p&gt;Now you will notice that, that button has appeared. Often due to latency, the button wont be readily visible. Since there is a space between TO DO, a hyphen is added and dont forget # symbol. Internally regex operation is involved where it checks for ticket ID, the status which you are in.&lt;/p&gt;

&lt;p&gt;Similary when the task is in progress then&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git commit &lt;span class="nt"&gt;-m&lt;/span&gt; &lt;span class="s2"&gt;"RAG-7 #in-progress #comment docs on loader finished embedding initiated"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The card under To Do shall shift automatically under In Progress.&lt;/p&gt;

&lt;p&gt;This helps to visually track my progress.&lt;/p&gt;

&lt;p&gt;As as alternative YOUTRACK is also a good option, a product of JetBrains. Whereas, JIRA is a product of Atlassian.&lt;/p&gt;

&lt;p&gt;Third is using docker. I really adore the following docker command:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;docker run &lt;span class="nt"&gt;-it&lt;/span&gt; &lt;span class="nt"&gt;--name&lt;/span&gt; my-container &lt;span class="nt"&gt;--mount&lt;/span&gt; &lt;span class="nb"&gt;type&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="nb"&gt;bind&lt;/span&gt;,src&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="si"&gt;$(&lt;/span&gt;&lt;span class="nb"&gt;pwd&lt;/span&gt;&lt;span class="si"&gt;)&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;,target&lt;span class="o"&gt;=&lt;/span&gt;/app my-image:latest
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;it&lt;/strong&gt; flag is the interactive terminal, &lt;strong&gt;my-container&lt;/strong&gt; is the custom container name, which is optional, mount helps in making changes in your container, which gets reflected back the directory where my project originally is located, this is why pwd is used which stands for print working directory and my-image:latest is the image name. Make sure to create an image at first using docker build command.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight docker"&gt;&lt;code&gt;docker build -t &amp;lt;image_name&amp;gt; .
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;'.' includes everything which I stated in my dockerfile, often recommended the avoid cache and virtual env files, to keep it light.&lt;/p&gt;

&lt;p&gt;After a few days when you are done with building a particular phase of project, you can deploy the docker image to DockerHub in order to keep a track on which version you are working on. &lt;/p&gt;

&lt;p&gt;Right before deployment, make sure a repo is built where the local image will be stored. For checking whether your DockerHub account is connected to your local machine, use:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;docker login
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If some error occurs related to docker hub account is not connected, just check it out in Google.&lt;/p&gt;

&lt;p&gt;For connect to the remote repo using docker tag command:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;docker tag my-image:latest rik7/ingestion:v1
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;here :latest and :v1 are the tags you give, by default if no tag is assigned then :latest is assigned. rik7 is my account username, ingestion is the repo name where v1 is storing the version-1 of the local docker image.&lt;/p&gt;

&lt;p&gt;Lastly use docker push command, to save it in remote server where your dockerhub account is hosted.&lt;/p&gt;

&lt;p&gt;For testing purpose, I &lt;strong&gt;pull&lt;/strong&gt; the required docker image and use &lt;strong&gt;docker run&lt;/strong&gt; command.&lt;/p&gt;

&lt;p&gt;To conclude, this helps me to revise what i did and keep a track on whatever changes I did.&lt;/p&gt;

</description>
      <category>career</category>
      <category>devjournal</category>
      <category>productivity</category>
      <category>softwaredevelopment</category>
    </item>
    <item>
      <title>Resolving inter-service communication issue</title>
      <dc:creator>RIK</dc:creator>
      <pubDate>Thu, 21 May 2026 13:16:57 +0000</pubDate>
      <link>https://dev.to/satyaaytas/resolving-inter-service-communication-issue-10bk</link>
      <guid>https://dev.to/satyaaytas/resolving-inter-service-communication-issue-10bk</guid>
      <description>&lt;blockquote&gt;
&lt;p&gt;This week was heck of a roller coaster of emotions, trying to solve an issue. All I faced is the same error again and again. Precisely, error code 307 and 422 that is Temporary Redirect Unprocessable Entity respectively.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Started with a simple notebook for gateway service just like I did for ingestion service at its starting phase. But here is a catch, this time i am dealing gateway service, meaning I need to use uvicorn  command here. In case of ingestion service, when I started, all I did is assign a file path to a variable, pass it to PyPDFLoader, split the returned Document into chunks and store them into a storage, called as vector store.&lt;/p&gt;

&lt;p&gt;I used uvicorn when I was ready with all the class definitions and folder structures, just to wrap the core script around fastapi and deal with api testing using postman. The functionality that I assigned for gateway is different. As the name suggests, it shall act as a mediator between the client and the backend. For that I need to connect gateway service to ingestion service.&lt;/p&gt;

&lt;p&gt;I installed all the necessary libraries in a virtual environment, namely fastapi, uvicorn and httpx, activated the virtual environment. I had an impression that i need use schema validation for the incoming data, convert it to dictionary using .model_dump() and then pass it to httpx.AsyncClient().post(), since i am using post operation.&lt;/p&gt;

&lt;p&gt;The post operation has been used because the file shall be uploaded using postman, shall help to store the embeddings in a database. That uploaded file shall be of type UploadFile imported from fastapi library. At the end i stated uvicorn.run() statement to activate my gateway service..&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;This is where the story begins...&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;I encountered my first issue in jupiter notebook running a uvicorn statement from where gateway service shall begin to run. I forgot that even jupiter notebook run on a server and since i am running it locally, of course it shall run on localhost. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fy8jrwq8bww4a5hypshb1.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fy8jrwq8bww4a5hypshb1.png" alt=" " width="798" height="117"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;What I discovered is that while stating on jupyter it is incorrect to  use uvicorn statement as:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fq9mramqaa9mtfqtmeayv.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fq9mramqaa9mtfqtmeayv.png" alt=" " width="208" height="169"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The reason the first method did helped because a jupyter notebook is not just a text document, it is an active web application. It requires its own constantly running event loop in the background to handle cell executions, process outputs, and communicate with your browser. When I called uvicorn.run(), uvicorn attempts to start a brand new event loop to listen for incoming web requests. Python's standard asyncio library strictly forbids starting a new event loop while one is already running in the same thread. It throws the RuntimeError to prevent the two managers from fighting over control.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;By thread I mean a worker which executes a set of instructions available as a recipe.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;instead the following code fragment needs to be used:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F4teaesq5lrtq3bsy8wb4.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F4teaesq5lrtq3bsy8wb4.png" alt=" " width="800" height="326"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;A simple screenshot captured from my github repo. The output was previously showcased after running that cell and then commented it out.&lt;/p&gt;

&lt;p&gt;Another alternative can by stating the following in a notebook cell :&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="o"&gt;%%&lt;/span&gt;&lt;span class="n"&gt;writefile&lt;/span&gt; &lt;span class="n"&gt;main&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;py&lt;/span&gt;
&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;fastapi&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;FastAPI&lt;/span&gt;
&lt;span class="n"&gt;app&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;FastAPI&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;

&lt;span class="nd"&gt;@app.get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;/&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;read_root&lt;/span&gt;&lt;span class="p"&gt;():&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Hello&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;World&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;this shall automatically create a main.py file sibling to the notebook file and the following uvicorn command can be used:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="o"&gt;!&lt;/span&gt;uvicorn main:app &lt;span class="nt"&gt;--port&lt;/span&gt; 8001 &lt;span class="nt"&gt;--reload&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;However my issue has not finished yet. This was just the first part.&lt;br&gt;
The second part is while uploading a pdf in postman, and clicking on Send button, I faced a series on errors one after another.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fe9uy4a842nbug9qv84xr.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fe9uy4a842nbug9qv84xr.png" alt=" " width="667" height="205"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;now even after making some amendments in jupyter notebook, i encountered the error which is shown previously in my codebase. I had to restart the session again and again, may be because of the fact that the previously compiled python script persisted even after making changes. So i shifted to simple .py file which was a better option.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fqmkym95v2ibycm7o9rz5.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fqmkym95v2ibycm7o9rz5.png" alt=" " width="799" height="279"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;After I was fed up of facing the same error for 2 days, I browsed in google "do i need schema validation using pydantic when a function param of type fastapi.UploadFile, wrapped around the given pydantic model and apply .model_dump() just to be passed in httpx.AsyncClient() ?"&lt;/p&gt;

&lt;p&gt;The answer was, only when multiple parameters are passed in the function, in this the function name is &lt;strong&gt;forward_to_ingestion&lt;/strong&gt;, but this time i have only 1 param.&lt;/p&gt;

&lt;p&gt;Plus I was mixing things up unncessarily putting .model_dump() after wrapping Around IngestionSchema pydantic class not reallizing that I already put UploadFile at the function header to begin with. I removed the schema defintion then.&lt;/p&gt;

&lt;p&gt;At that time i used .model_dump, hoping this would return a json data, but where is the key, i completely forgot that it is simply a variable incoming before which the content within the uploaded file needs to read. At least i did the right thing to use await and .read() for that.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fikfykuaubdsjkwq61399.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fikfykuaubdsjkwq61399.png" alt=" " width="799" height="255"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The result is still the same..made me check what mistake did i commit in ingestion service, in an isolated fashion, no inter service communication in this case. Was running fine..&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fc832vyam9rbh6zja9u5n.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fc832vyam9rbh6zja9u5n.png" alt=" " width="671" height="294"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;i passed the same snippet to AI, told me to use&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight ruby"&gt;&lt;code&gt;&lt;span class="n"&gt;tempfile&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="no"&gt;NamedTemporaryFile&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;helps to keep memory leakage in check and for security reasons.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F6n89rmfsebg49x5rt84a.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F6n89rmfsebg49x5rt84a.png" alt=" " width="798" height="116"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;meanwhile i also faced 307 error code..specifying /ingest/&lt;/p&gt;

&lt;p&gt;I removed the trailing slash in postman, after I crashed into another error&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fkhyrtogyxwef5zgk5j9u.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fkhyrtogyxwef5zgk5j9u.png" alt=" " width="798" height="104"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The terminal showed this&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fbm8u1uz21n3eadqfymll.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fbm8u1uz21n3eadqfymll.png" alt=" " width="800" height="171"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;One thing i was sure there is something still missing in my gateway service. I passed this snippet:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fear3cjdubbu22ahfke6a.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fear3cjdubbu22ahfke6a.png" alt=" " width="550" height="282"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;it simply added follow_redirects=True because of the fact that &lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;httpx does not follow HTTP redirects by default, which is crucial for forwarding files and post data.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;I then encountered another problem this time it timeout error, not shown in postman but in terminal.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fiw5i71uj7y2jakvl2zy7.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fiw5i71uj7y2jakvl2zy7.png" alt=" " width="799" height="202"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In postman the same internal server error is shown.&lt;/p&gt;

&lt;p&gt;I then specified timeout argument as well.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fq7tqavsppowah1wofz2z.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fq7tqavsppowah1wofz2z.png" alt=" " width="800" height="299"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;And I did not believe, it really worked...after seeing this in postman&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fvupnfxhaooy8i5o7vfm6.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fvupnfxhaooy8i5o7vfm6.png" alt=" " width="800" height="185"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Yes it is my fault that i should have specified status code as 201 since 200 is the default status code under gateway service, which helps in debugging.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F7ll0jeo2gupo7egebwh5.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F7ll0jeo2gupo7egebwh5.png" alt=" " width="796" height="101"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;whereas the terminal where ingestion was active shown this as output&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fq7n9ghjcjm5sxobovkpr.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fq7n9ghjcjm5sxobovkpr.png" alt=" " width="800" height="162"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;But this taught me one thing is to NEVER GIVE UP!!&lt;/p&gt;

</description>
      <category>devjournal</category>
      <category>microservices</category>
      <category>python</category>
      <category>rag</category>
    </item>
    <item>
      <title>Resolving deletion in AVL trees</title>
      <dc:creator>RIK</dc:creator>
      <pubDate>Sat, 16 May 2026 08:35:12 +0000</pubDate>
      <link>https://dev.to/satyaaytas/resolving-deletion-in-avl-trees-117a</link>
      <guid>https://dev.to/satyaaytas/resolving-deletion-in-avl-trees-117a</guid>
      <description>&lt;p&gt;Started solving for AVL (Adelson-Velsky and Landis, named after its inventors) trees, 3 week back but now i am finally done. For starters like me, got to understand on how efficiently does stack data structure work. Even while dealing with search operations, had to use stack just to keep track on which set of nodes I traversed on. Of course the node traversal starts from the root node.&lt;/p&gt;

&lt;p&gt;All this is done for practice sake and clear my understanding regarding data structures and algorithms. That's why I have used C programming, to get to know the nuts and bolts...&lt;/p&gt;

&lt;p&gt;The searching operation is after all the most basic of all in a tree, especially search trees, decreases your traversal effort and stops wasting time, dealing with nodes, where you think "that's not where my key is.."&lt;/p&gt;

&lt;p&gt;Built a dedicated files, named as helpers.C where i defined all the possible definitions of stack, right from push, pop and stacktop. Even mentioned definition displaying the nodes from top to bottom for debugging sake. It is easier to manage all the members of stack like top, size and an array into a single entity so I also defined a structure.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F21y0d70c7yk29o8ihtq7.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F21y0d70c7yk29o8ihtq7.png" alt=" " width="588" height="910"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;However make sure to include the necessary header files and the files, defined by you.&lt;/p&gt;

&lt;p&gt;As per an example, i used this.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F0rd2odda6hfb86spmsog.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F0rd2odda6hfb86spmsog.png" alt=" " width="663" height="598"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;As per the newnode is concerned, a pointer is pointing to memory address allocated in heap memory is done, whose left and right child are pointing to null pointers and an assignment of the key, the data is also done. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F1vq1bkvl2hjudpyumenu.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F1vq1bkvl2hjudpyumenu.png" alt=" " width="749" height="393"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Remember, we used stack to store information on which path did we traversed, at the stack top there exists a memory address pointing to a node belonging to the existing tree where an int value of 49 exists. There is another reason behind that, will be covered shortly.&lt;/p&gt;

&lt;p&gt;But what does AVL trees involve ? It involves 3 core steps, calculate the node's height, checkout it balance factor, which is the difference in height of its right branch from its left branch and third if the balance factor's value exceeds a certain threshold, rotation of nodes shall be done. Usually the threshold is beyond -1 (that is more negative than -1, say -2, -3 etc) or +1 (more positive than +1, say 2,3 etc).&lt;/p&gt;

&lt;p&gt;There are 4 types of rotations involved: LL (left-left), LR (left-right), RL (right-left) and RR (right-right). Let me show you with a diagram.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fissnsq1oifx46p9ufkzb.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fissnsq1oifx46p9ufkzb.png" alt=" " width="800" height="563"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The first column shows LL rotation and the second column shows LR rotation.&lt;/p&gt;

&lt;p&gt;Similarly, the next diagram, the first column is about RR rotation and the second one is the RL rotation.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F71sv2mwbz22bk31iiiy3.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F71sv2mwbz22bk31iiiy3.png" alt=" " width="800" height="476"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F4kpzja582g65kzgq2n25.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F4kpzja582g65kzgq2n25.png" alt=" " width="800" height="454"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I guess it looks a bit messy, I shall attach the github repo at the very bottom.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;The main issue i faced is regarding segmentation fault. It is like thorn under my feet. Also during rotation I accidentally connected the leaf node back to the parent, so when in-order or pre-order traversal function are triggered, it used to give stack-overflow, after the flow gets stuck in an unwanted circular loop. Had to sketch diagrams all over again and again.&lt;/p&gt;

&lt;p&gt;It is a hard rule AVL trees, also a BST (Binary Search Tree) that while all the nodes from left to right while using in-order traversal, they must appear sorted, because upon dealing with deletion, getting in touch with the successor node is very important as that node where the data is shall be replaced by its successor's data. So structurally not removing the node to be deleted rather a form of replacement, and going down the line where the actual successor node is, we can use free().&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fxkjambcxxdt4yl7nc2bs.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fxkjambcxxdt4yl7nc2bs.png" alt=" " width="576" height="600"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Let's say we want to delete the root node, which is having a value of  38. We shall go 1 step rightward and in a loop continue moving to the left until there is a dead end. Even here stack shall be used. So that the left and right child pointers of the parent of the successor node, which is holding a value of 46 can be updated. In this case the left child of the parent shall hold the address of the right child of the successor node.&lt;/p&gt;

&lt;p&gt;Now we shall move backwards, popping out address of the nodes stored in stack to check for their balance factor, if balance factor &amp;gt; 1 or &amp;lt; -1, then go for rotation. Of course this shall be done in a loop.&lt;/p&gt;

&lt;p&gt;Yeah in the end, there is another thing to mention, about height of node. It is not a hard and fast rule, but i considered leaf nodes to have height of 0, so what i did is increment by 1 as i move from root node to the destination node, giving me a depth, using which i subtract from st.top (the highest index value). In other words, the longest route in that traversal.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fv1l45ae1k3n9zcjxoznk.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fv1l45ae1k3n9zcjxoznk.png" alt=" " width="800" height="541"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Observe in line number 265. Notice that there 'I' mentioned the last parameter of checkForRotation(), denoting check of rotation where I am dealing with insertion operation and 'D' for deletion.&lt;/p&gt;

&lt;p&gt;PS&lt;br&gt;
github repo: &lt;a href="https://github.com/S-a-t-y-aa-y-t-a-S/DSA/blob/main/avl.C" rel="noopener noreferrer"&gt;https://github.com/S-a-t-y-aa-y-t-a-S/DSA/blob/main/avl.C&lt;/a&gt;&lt;/p&gt;

</description>
      <category>algorithms</category>
      <category>beginners</category>
      <category>computerscience</category>
      <category>dsa</category>
    </item>
  </channel>
</rss>
