Code in Cafe

  • Hello I am Rahul Rajput, a Backend Developer based in India. I write code to create simple and usable website in Ruby, Python and Elixir that works flawlessely.
  • I like to work on example project also called MVPs and blog writing.
  • Share this blog with your friends if you find it useful.

Cover Image Alpine example code

Access AlpineJS x-data variable outside scope

I was big fan of jQuery before I started using AlpineJS!. Alpine is so easy and seamless that I fell in love with it instantly. One more thing that you might want to consider is its size. Alpine is very small in comparison of jQuery, Vue, Angular etc. Alpine was previously called Tailwind of JavaScript. If you don’t know about Tailwind, Man you should read it. If you wanted to learn about AlpineJS basics and other concepts click here....

July 24, 2021 · 3 min · Rahul Rajput

How to create a simple password saver in python

In this example program, we are building a python program to safely store and retrieve the password. It stores passwords in a file. Passwords are totally secured. This program also contains a master password to use the application. Option available in the program is you can get previously-stored password. You can also add your new password. You can also check for all stored usernames. So let’s start writing Python Program to build a Simple Password Saver....

May 5, 2020 · 7 min · Rahul Rajput

Tax calculating program in Python

This program is used to calculate tax in the Python programming language. This Tax calculating algorithm is very in this program we can improve this algorithm a lot. Note: this is a very basic implementation of tax calculation. One should not use this to calculate the real tax to submit in real life, this is just a simulator for practice purposes. Algorithm First, we are asking for user input to get the total income and total saving, then we are checking for total taxable income by reducing savings from total_income....

February 12, 2020 · 2 min · Rahul Rajput

Second Equation of motion in C language

The second equation of motion is used to calculate the displacement of an object under constant acceleration. Algorithm Without wasting any of your precious time let’s try to understand how second equation of motion is implemented The second equation of motion is s = u*t + 1/2 * a * t * t s: total displacement u: initial velocity t: time taken by the journey a: constant acceleration We are considering u=0 if you want you can set initialVelocity variable value as per your choice, or you can ask it from user....

February 12, 2020 · 2 min · Rahul Rajput

Third Equation of motion using C language

The third equation of motion is used to deduce the relation between initial velocity, final velocity, displacement, and acceleration without time. Algorithm Without wasting any of your precious time let’s try to understand how this algorithm is implemented. Third equation of motion is v * v = u * u + 2 * a * s s: total displacement u: initial velocity v: final velocity a: constant acceleration In function CalculateDisplacement, we are calculating the value of displacement....

February 11, 2020 · 2 min · Rahul Rajput

First Equation of motion implementation in C

The first equation of motion is used to calculate the final velocity of an object under constant acceleration. Algorithm Without wasting any of your precious time let’s try to understand how the algorithm is implemented. The first equation of motion is v = u + a * t u: initial velocity t: time taken by the journey a: constant acceleration as you can see in our program we are considering u=0 if you want you can set initialVelocity variable value as per your choice or you can ask it from user too, accel=5 and timeOfJourney=7....

February 2, 2020 · 2 min · Rahul Rajput

Bubble sort code in Python

Bubble sort is the simplest Sorting algorithm available. It works by repeatedly swapping the adjacent or neighbor element if they are in the wrong order. Working Actually in the first-pass bubble sort sets the largest element to its position, in the second pass algorithm sets the second largest element this continues till the list or array is not finally sorted. Here is the example image. To work with the algorithm you first have to understand what is swapping and how it is done....

November 17, 2019 · 2 min · Rahul Rajput