Search This Blog

2025/04/01

Poem - Shatrubodh

Shatrubodh

ershe purmesha ne jo harla shiv shivashi
dhadili klishtyata bahu shiv sansari
ladhati putra pityachi,mata putrashi
pati patnishi,patni patnishi
bhav bhavashi,aptya eshatya eka meke

pari shiva swaicchene banala raja sarvacha
rakishito hit jo bharat vanshache
shartubodh khara karine tarka dushtya
thevava bhav shivanshi pandhirivari jo shivsakha
yudhya-samayi dhadila dhartivar prajahita

ruktacha sandun sada,rakshila hirva chuda
rakshito soundrya bharatiche sosat war
chahu vedhila parkiye ani skaviye buddhi-bhrashta
mata jis shatru vatato bara buddhi tinhe bahu kashitli
ershe karanyas bhed bharata lekura,aanit aav matrutyvacha

shresht bharatputra to shiva
paravatit vasato dweshya zara tayachya
thai thai tis diste maher
mhanun magun hi tij nahi milala putra shiva saman
pativrtya parvatiche dav ha begadi,
tij hava putra jo nagavi jagas houn gulam ticha

savatra jari tayasi lekure patichi
japala prajabhav kshtriye Jivapad
kela nyay prasangi houn jivawar udhar
ershe nasavile lekuri bharatichi parvitine
tij pasi bharata che gyan sarva sada sarvada
parvati khele shivashi khel rakta-charit

Kona nase soyare sutak krandanate satat
ma bharati oaze tijvari
santati klechashache ,apure panache
pari sattabrasht tichi lekare tyaas bhase swa-janani savatra
gojiri ti savat parvati tine kele ankit bharatichi lekure

prem bharatiche atarkya
lekaru udand wanshavelivari
lekaras priya sasar je dharile savate
je udhalte dhan kale nasavina shtratej bhart vanshache
raja sharire bahu kashitila parvate pari nahi harila

ladhti je ya udandate virrudha
putra jari te khare bharatiche
sambraham baharala bharati
saundraya dhurta te che lobhas
shtrateja rakshiti mata bhumiputra

Bhartis priya savatra lekure
dura sarite swatache matrutya
kartvya jari shreshtya pari
dolhas kartvya sangito karmya yog
Tygave te pativryata je aviveki

shreshtvya kartya kathorcha sakha
pari tayacha sos kari veda pisa
pariksha keli kartya kathorchi sawali
parmeshu heva bharatputrancha

nakarti lekare parmesha bahu sayase
jari annaile song shreshtyacha
usane jivan ,udhar shrimanti
bahugyani zalye dushtya chor
para tayasi nahi bharat putrachi sar


Yuti parvati chi aani je je irshe harile
shiva chya shreshtve,parmeshu bahu aanadi
tayache patni-putra asun sare gyan pari
tyansi hava sopa marg jyat nakot kahi kashtya
parmeshu khelavitio swa kutumba houn sam asam

shiva priya shtreya,santati sukha,sharir swastya
shatra tej,brahma tej,pragati prani matra
shiva aveharle khote parmeshu,praja sukhe aanila sanatanu
jayat nahi vyakti bhed anaisargeek
je rakshil prajela vikshipt parmeshapasun


2025/03/13

Multiplcation of Decimal using Matrix

Here is my another implementation of multiplication of decimal
number.As my previous blog i am using matrix & tables of 1to 9,
to complete whole multiplication.
Multiplication of rational numbercan also be implemented using
same algorithm just by converting those fractions by sufficient
power of ten & then readjusting result decimal point.

Code:

from collections import defaultdict
import math


decimalMultiplicand: int = 378
decimalMultiplier: int = 24
# 378/23 = 8694

def decimalToArray(n):
return [int(digit) for digit in str(n)]

def getMultiplication(multiplicand: int, multiplier: int):
try:
multiplicandArray = decimalToArray(decimalMultiplicand)
multiplierArray = decimalToArray(multiplier)

alternateMultiplicationSequenceDict = defaultdict(list)

# finding size of each decimal number
multiplicandLength = len(multiplicandArray)
multiplierLength = len(multiplierArray)

total = multiplicandLength + multiplierLength
muliplicationMatrix = [[] * total for _ in range(total)]

print(f"Multiplying:'{multiplicand}' by '{multiplier}'")

# i counter for operand & j counter for operator
i = 0
while i < multiplicandLength:
j = 0
while j < multiplierLength:
k = multiplicandArray[multiplicandLength - i - 1]
l = multiplierArray[multiplierLength - j - 1]

multiplication = k * l
zeroPosition = multiplication % 10
onePosition = multiplication // 10

alternateMultiplicationSequenceDict[zeroPosition].append({
"operandDecimalPosition": i,
"operatorDecimalPosition": j,
"multipleOfTen": False
})

alternateMultiplicationSequenceDict[onePosition].append({
"operandDecimalPosition": i,
"operatorDecimalPosition": j,
"multipleOfTen": True
})

muliplicationMatrix[i+j].append(zeroPosition)
muliplicationMatrix[i+j+1].append(onePosition)

j = j+1

i = i+1

i = 0
rowSum =0
multiplication = 0
while i < total:
j = 0
while j < len(muliplicationMatrix[i]):
rowSum = rowSum + muliplicationMatrix[i][j]
j=j+1
zeroPosition = rowSum % 10
onePosition = rowSum // 10

rowSum = onePosition
if multiplication <= 0:
multiplication =zeroPosition
else:
multiplication = zeroPosition * 10 ** i + multiplication
i=i+1

print(f"Result:{multiplicand} * {multiplier}={multiplication}")
except Exception as e:
print(f"An error occured:{e}")
raise

getMultiplication(decimalMultiplicand, decimalMultiplier)


Code seems to useful to build decimal circuit that can replace binary circuit
for specific purpose of mathematical calculations.

2025/03/07

Automating installation of MS-Window Application Packages using Chocolatey

What is Package Manager?
    A Package Manager is a tool that helps you install, update, configure, and remove software
    in a consistent and automated way. Instead of manually downloading and installing software
    from websites, a package manager simplifies the process with a single command.
   
Why To Use a Package Manager?
    a)Saves Time – No need to manually search, download, and install software.
    b)Automates Updates – Keeps software up-to-date automatically.
    c)Manages Dependencies – Ensures required components are installed.
    e)Uninstalls Cleanly – Removes software and its related files properly.
    f)Works in Scripts – Great for IT automation and DevOps.


What is Chocolatey - Windows Package Manager?
    Chocolatey is a powerful package manager for Windows, similar to apt (Ubuntu) or brew (macOS).
    It automates software installation, updates, and management using simple PowerShell commands.

1. Installing Chocolatey
    Chocolatey requires Powershell (Admin) and .NET Framework 4+. To install it, follow these steps:

    Step 1: Open Powershell as Administrator
        Press Win + X → Click Powershell (Admin) or Terminal (Admin).

    Step 2: Run the Install Command

        Powershell Command:

            Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1'))
            This will download and install Chocolatey.

    Step 3: Verify Installation
            Close and reopen Powershell, then run:

        Powershell Command:
            choco --version
            If Chocolatey is installed correctly, you’ll see its version number.

    Step 4: Using Chocolatey To Install a Package
        To install software (e.g., Google Chrome), run:
            Powershell  Command:
                choco install googlechrome -y
                (-y automatically agrees to prompts.)

        To Update a Package run:

            Powershell  Command:
                choco upgrade googlechrome -y
           
        To Uninstall a Package run:

            Powershell  Command:
                choco uninstall googlechrome -y
               
        To Search for a Package

            Powershell  Command:
                choco search notepad++
               
        To List Installed Packages

            Powershell  Command:
                choco list --localonly
               
        To Install Multiple Packages at Once

            Powershell  Command:
                choco install vscode git nodejs -y
               
        To Update All Installed Packages

            Powershell  Command:
                choco upgrade all -y

2. Uninstalling Chocolatey          
    To Uninstall Chocolatey (If Needed)

        Powershell  Command:
                choco uninstall chocolatey
               
    Then, manually delete the C:\ProgramData\chocolatey folder.

Why Use Chocolatey?
    a)Automates software installation & updates
    b)Installs software with one command
    c)Manages dependencies
    d)Works well with Powershell and Windows
   
Is Chocolatey Cross-Platform?
    Chocolatey is not cross-platform—it is specifically designed for Windows.
    It relies on Windows-specific technologies like PowerShell, Windows Installer (MSI),
    and the Windows Registry, making it incompatible with Linux or macOS.

    Cross-Platform Alternatives to Chocolatey
    If you need a package manager for other operating systems, here are some alternatives:

    For Windows, macOS, and Linux:
        a)Winget (Windows 10/11's built-in package manager)
        b)Scoop (Windows alternative to Chocolatey, simpler and more developer-focused)
        c)Ninite (Windows, but limited compared to Chocolatey)
       
    For macOS:
        a)Homebrew → The most popular package manager for macOS
            sh Command:
                /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
           
        b)MacPorts → Another option, but Homebrew is more common

    For Linux:
        a)APT (Debian/Ubuntu) → sudo apt install <package>
        b)DNF/YUM (Fedora, RHEL) → sudo dnf install <package>
        c)Pacman (Arch Linux) → sudo pacman -S <package>


Process has been practically validated for on MS-Window 11 for Chocolatey Package Manager.




Automating installation of Visual Studio Code extensions

Usually when we install Visual Studio for say node.js or
angular or react developement we need to install multiple
VS-Code Extension.

   If you have to setup multiple machines with same configuration
doing same task on multiple systems is boaring & kind of tidious.  
One can automate installtion of VS-Code Extension using Bash(.sh) or Window
script(.bat).

As I am planning to do developement on node.js/express.js & Angular.

    List of Required/Desirable Packages for Node.js Developement:
        a)Node.js Extension Pack – A collection of useful extensions for Node.js development.
        b)ESLint – Helps maintain code quality by enforcing linting rules.
        c)Debugger for Node.js – Provides a robust debugging environment.
        d)NPM Intellisense – Auto-suggestions for npm modules.
        e)Path Intellisense – Autocomplete for file paths.
        f)REST Client – Test APIs directly from VS Code.
        g)DotENV – Syntax highlighting for .env files.

    List of Required/Desirable Packages for Angular Extensions:
        a)Angular Language Service – Provides Angular-specific IntelliSense, navigation, and type checking.
        b)Angular Snippets (Version 14+) – John Papa’s Angular snippets for faster coding.
        c)Angular Schematics – Run Angular CLI commands directly inside VS Code.
        d)Material Icon Theme – Adds Angular-related icons for better file visibility.
        e)Prettier - Code Formatter – Ensures consistent code formatting.

Lets build script for this purpose.

    To install the listed packages we need to run the following command in PowerShell
    or a Window Command Line(cmd):

        Window Terminal/Powershell Command:

            code --install-extension waderyan.nodejs-extension-pack `
                 --install-extension dbaeumer.vscode-eslint `
                 --install-extension ms-vscode.node-debug2 `
                 --install-extension christian-kohler.npm-intellisense `
                 --install-extension christian-kohler.path-intellisense `
                 --install-extension humao.rest-client `
                 --install-extension mikestead.dotenv `
                 --install-extension Angular.ng-template `
                 --install-extension johnpapa.Angular2 `
                 --install-extension cyrilletuzi.angular-schematics `
                 --install-extension PKief.material-icon-theme `
                 --install-extension esbenp.prettier-vscode
         
        We can create a Batch Script for Windows say(install-vscode-extensions.bat)
        Save this as a .bat file and run it:

            install-vscode-extensions.bat file content:

                @echo off
                code --install-extension waderyan.nodejs-extension-pack
                code --install-extension dbaeumer.vscode-eslint
                code --install-extension ms-vscode.node-debug2
                code --install-extension christian-kohler.npm-intellisense
                code --install-extension christian-kohler.path-intellisense
                code --install-extension humao.rest-client
                code --install-extension mikestead.dotenv
                code --install-extension Angular.ng-template
                code --install-extension johnpapa.Angular2
                code --install-extension cyrilletuzi.angular-schematics
                code --install-extension PKief.material-icon-theme
                code --install-extension esbenp.prettier-vscode
                echo All extensions installed successfully!
               
            Run it by double-clicking the .bat file.

    On Linux & MAC os we need to use bash/shell script instead of batch file.

        Shell Script for Linux/macOS say(install-vscode-extensions.sh)
            Save this as a .sh file and run:

        install-vscode-extensions.sh file content:

            #!/bin/bash
            extensions=(
                "waderyan.nodejs-extension-pack"
                "dbaeumer.vscode-eslint"
                "ms-vscode.node-debug2"
                "christian-kohler.npm-intellisense"
                "christian-kohler.path-intellisense"
                "humao.rest-client"
                "mikestead.dotenv"
                "Angular.ng-template"
                "johnpapa.Angular2"
                "cyrilletuzi.angular-schematics"
                "PKief.material-icon-theme"
                "esbenp.prettier-vscode"
            )

            for extension in "${extensions[@]}"; do
                code --install-extension $extension
            done

            echo "All extensions installed successfully!"
       
    Run it using:

    bash
        chmod +x install-vscode-extensions.sh
        ./install-vscode-extensions.sh


Batch Script has been practically validated for on MS-Window 11

2025/02/27

SysV service '/etc/init.d/speech-dispatcher' lacks a native systemd unit file

Problem Statement:
 
Debian 12 boot error
journalctl --pager

Output(Only Part Concerned):
Feb 27 10:13:03 debian systemd-sysv-generator[7216]: SysV service '/etc/init.d/speech-dispatcher'
lacks a native systemd unit file, automatically generating a unit file for compatibility.
Feb 27 10:13:03 debian systemd-sysv-generator[7216]: Please update package to include a native
systemd unit file.

Probable Solution:

systemctl list-unit-files | grep enabled will list all enabled ones.

systemctl | grep running

Command
systemctl list-unit-files --state=enabled
Output:
UNIT FILE STATE PRESET
speech-dispatcher.service generated -
speech-dispatcherd.service disabled enabled

Start the service & verify the status
Run(Shell Terminal Commands):
sudo systemctl status speech-dispatcher.service
sudo systemctl enable speech-dispatcher.service
sudo systemctl start speech-dispatcher.service
sudo systemctl status speech-dispatcher.service



debian systemd-sysv-generator[7216]: SysV service '/etc/init.d/gdomap' lacks a native systemd unit file

Problem Statement:
Debian 12 boot error saying debian systemd-sysv-generator[7216]: SysV
service '/etc/init.d/gdomap' lacks a native systemd unit file.

Verify the error:
journalctl --pager

Output(Only Part Concerned):
Feb 27 10:13:03 debian systemd-sysv-generator[7216]: SysV service '/etc/init.d/gdomap' lacks
a native systemd unit file, automatically generating a unit file for compatibility.
Feb 27 10:13:03 debian systemd-sysv-generator[7216]: Please update package to include a
native systemd unit file.
Feb 27 10:13:03 debian systemd-sysv-generator[7216]: ! This compatibility logic is deprecated,
expect removal soon. !

Probable Solution:
First check the shell script gdomap exist at desired location.In our case '/etc/init.d'

Run(Shell Terminal Commands):
cd /etc/init.d
ls | grep gdomap

If you find gdomap file & its not empty then only systemctl service from init.d may
have failed to start somehow.

Lets try to start that service manually.
Start the gdomap.service & verify the status

sudo systemctl status gdomap.service
sudo systemctl enable gdomap.service
sudo systemctl start gdomap.service
sudo systemctl status gdomap.service

Use journalctl to View Your System's Logs

View journalctl without Paging

To send your logs to standard output and avoid paging them, use 
        the --no-pager option:

journalctl --no-pager

It's not recommended that you do this without first filtering down 
        the number of logs shown.

journalctl -u service-name.service︙

Show Logs within a Time Range

Use the --since option to show logs after a specified date and 
            time:

journalctl --since "2018-08-30 14:10:10"

Use the --until option to show logs up to a specified date and time:

journalctl --until "2018-09-02 12:05:50"

Combine these to show logs between the two times:

journalctl --since "2018-08-30 14:10:10" --until "2018-09-02 12:05:50"


Content is shamelessly copied from:
https://unix.stackexchange.com/questions/225401
/how-to-see-full-log-from-systemctl-status-service

from the answer by: https://unix.stackexchange.com/users/119298
/jeff-schaller 
 
    for purpose of documenting future reference assuming the original 
    content may be removed or altered.

References:
https://www.linode.com/docs/guides/how-to-use-journalctl

2025/02/26

Bash script to collect .mp3 files from album folder to Music folder directly

Suppose you have two folders /home/sangram/Music & /home/sangram/Music/Other,
In Music Folder you only want to keep mp3 files directly.The Other folder 
contain multiple folders each containing mp3 files for different Song Album.
 
Here instead of directly copying mp3 to 'Music' folder i created another folder
in 'Music' folder to collect all such files named 'AllSongs'
 
Then following script will copy all mp3 files from Album folders to mp3.It does
not implement nested folder scenario.Code is Bash Script that can be run as
 
Assume code file name is OrganizeMusicFiles.sh then you need to base folder of
it to make it executable run
chmod +x OrganizeMusicFiles.sh

Then run script as follows  
./OrganizeMusicFiles.sh
 
 
Code: 
 
/bin/bash 
search_dir=/home/sangram/Music/Other
dest_dir=/home/sangram/Music/AllSongs/
echo "Search Directory: $search_dir"
echo "Destination Directory: $dest_dir"
echo "--------------------------------"

touch CopyLog.psv
echo "source|destinaion|time" > CopyLog.psv;

counter=0
break_flag=0
for entry in "$search_dir"/*; do
echo "--------------Folder:$entry------------------"
for inner_entry in "$entry"/*; do
echo "File under consideration is: $inner_entry"

#get file extension
filename=$(basename -- "$inner_entry")
extension="${filename##*.}"
echo "File Extension: $extension"
desired_extensions=("mp3")

if [[ ${desired_extensions[@]} =~ $extension ]]
then
echo "File $inner_entry is mp3"
else
echo "File $inner_entry is not mp3"
continue
fi

echo "Coping File:'$inner_entry' To '$dest_dir'"
echo "cp '$inner_entry' '$dest_dir'"

#logging the copy operation
current_date_time="`date +%Y%m%d%H%M%S`";
echo "'$inner_entry'|'$dest_dir'|'$current_date_time'" >> CopyLog.psv;
echo "\n" >> CopyLog.psv;

cp "$inner_entry" '$dest_dir'
counter=$((counter+1))

#coping only 10 files
if [ $counter -eq 10 ]
then
$break_flag=1
break
fi

echo '--------------------------------'


done
#if inner loop is broken then break outer loop also broken
if [ $break_flag -eq 1 ]
then
break
fi
echo "Total Files Copied: $counter"
break
done
 
I think the code might useful for someone which trying to something similar 
for sake of fun.
 
Happy Coding !
 
 

2025/02/25

How to create bootable USB stick from iso file in Debian GNU/Linux 12 ?

Download ISO file from your preferred distro if that burn on CD/DVD then system can boot
from this CD/DVD.

   I am downloading latest version of Ubuntu from Office Website.

DOWNLOAD URL:https://mirrors.utkarsh2102.org/ubuntu-releases/24.10
             /ubuntu-24.10-desktop-amd64.iso
   	
I found out that downloading from torrent is better else you need to use Download Manager 
Application to avoid interruption in network connection.
   
Path to downloaded ISO
  Find path to downloaded ISO.In my case the path is
	
       	/home/sangram/Downloads/ubuntu-24.10-desktop-amd64.iso
   
Then Find path to your Flash Drive.
	root@debian:/home/sangram/Downloads# blkid
	/dev/sdb4: UUID="4bec5b9b-0399-4625-888e-1f3c7879a2d2" BLOCK_SIZE="4096" 
                        TYPE="ext4" PARTUUID="709020f5-3615-48ae-945e-7aaf90e1c224"
	/dev/sdb2: LABEL="Windows10Extra" BLOCK_SIZE="512" UUID="8E80C8B780C8A6D5" 
                        TYPE="ntfs" PARTUUID="2e556718-1bca-45e6-a8e1-da6176028372"
	/dev/sdb3: UUID="998967c0-01bb-435c-be51-5111ac2f42dd" 
                        TYPE="swap" PARTUUID="7f3e46bb-d429-4255-85b6-d574874b0441"
	/dev/sdb1: LABEL="UbuntuExtra" UUID="32d124b4-f63e-4db8-9862-2bd1ccce96d9" 
                        BLOCK_SIZE="4096" TYPE="ext4" PARTUUID="022273ff-1744-4ddf-918b-454356e51fae"
	/dev/sr0: BLOCK_SIZE="2048" UUID="2002-12-25-13-26-43-00" 
                        LABEL="021225_1321" TYPE="iso9660"
	/dev/sda4: UUID="f2138513-5e98-4fc3-a41d-a43a68a9239b" 
                        BLOCK_SIZE="4096" TYPE="xfs" PARTUUID="869e87f7-04"
	/dev/sda2: BLOCK_SIZE="512" UUID="FA0A69290A68E3DB" TYPE="ntfs" 
                        PARTUUID="869e87f7-02"
	/dev/sda3: BLOCK_SIZE="512" UUID="1EAEDC1BAEDBE973" TYPE="ntfs" 
                        PARTUUID="869e87f7-03"
	/dev/sda1: LABEL="System Reserved" BLOCK_SIZE="512" UUID="201667091666DF72" 
                        TYPE="ntfs" PARTUUID="869e87f7-01"
	/dev/sdc: UUID="C471-F788" BLOCK_SIZE="512" TYPE="vfat"

Here /dev/sdc is my Flash USB Drive on which I want to install Bootable Ubuntu.

Command Format:
	sudo dd if=[path_to_iso] of=[path_to_usb]

Actual command in our case will look like

	sudo dd  bs=4M if=/home/sangram/Downloads/ubuntu-24.10-desktop-amd64.iso 
                       of=/dev/sdc  status=progress oflag=sync
 

2025/02/11

Long Division without rounding in python

 

 
Though Each language has sufficient datatypes yet for certain situation we need 
more mathematical datatypes,I made an attempt to create division algorithm for 
integer which does not rely on rounding end digits or truncating.
 
The limitation of algorithm is due to inherent behavior of python datatype to 
round fraction especially in case float & inability of Decimal to extract 
required fractions natively.
 
Code: 
 
from decimal import Decimal, getcontext

decimalDivident: int = 918
decimalDivisor: int = 139


# decimalDivident: int = 22
# decimalDivisor: int = 7
counter:int = 0;



print(f"Dividing:'{decimalDivident}' by '{decimalDivisor}'")

class RecurringDecimal:
def __init__(self, decimalValue: str, repeatStart: int, repeatEnd: int,stringValue:float):
self.decimalValue = decimalValue # String representation of the decimal
self.stringValue = stringValue # String representation of the decimal
self.repeatStart = repeatStart # Index where repeating part starts
self.repeatEnd = repeatEnd # Index where repeating part ends

def __repr__(self):
return f"RecurringDecimal(decimal='{self.decimal_value}', repeat_start={self.repeat_start}, repeat_end={self.repeat_end})"

def getDivision(divisor: int,divident:int,requiredDecimalFraction:int) -> RecurringDecimal:
division:int = 0
decimalDivision=0.0
remainder:int = 0
repeateEndIndex:int=-1
immediateDivision:int = 0
fractionPosition:int=-1
noOfDecimalAfterFraction:int=0
noOfDigitsInDivision:int=0
noOfDigitsAfterDecimal:int=0
repeateStartIndex:int=-1
reminderList:list=[]
enhancedDouble:RecurringDecimal

try:
print(f"*requiredDecimalFraction:'{requiredDecimalFraction}'")
while noOfDecimalAfterFraction < requiredDecimalFraction:
remainder = divident % divisor
immediateDivision = divident // divisor

if not remainder in reminderList:
reminderList.append(remainder)
elif remainder in reminderList and repeateStartIndex == -1:
repeateStartIndex = reminderList.index(remainder)
repeateEndIndex = len(reminderList) - repeateStartIndex -1


if(immediateDivision > 0):
division = division * 10 + immediateDivision
else:
division = division * 10

# print(f"*division:'{division}'")
divident = remainder

# print(f"#Before Inner While Loop:")
# print(f"#remainder:'{remainder}'")
# print(f"#divisor:'{divisor}'")

#print(f"In Inner While Loop:")
while remainder < divisor:
noOfDigitsAfterDecimal +=1
remainder = remainder * 10
divident = remainder

if fractionPosition == -1:
fractionPosition = len(str(division))

# print(f"##remainder:'{remainder}'")
# print(f"##divisor:'{divisor}'")
# print(f"##divident:'{divident}'")

if fractionPosition != -1:
noOfDecimalAfterFraction = noOfDecimalAfterFraction + 1

# print(f"**After Inner While Loop:")

if requiredDecimalFraction == noOfDecimalAfterFraction:
# print(f"--->No Of Decimal After Fraction'{noOfDecimalAfterFraction}'")
# print(f"--->Required Fractions Received")
break

if remainder ==0:
# print(f"--->Reminder Become Zero'")
break

# print(f"$$$$ division:'{division}'")
noOfDigitsInDivision = len(str(division))

# print(f"$$$$ fractionPosition:'{fractionPosition}'")
# print(f"$$$$ noOfDigitsInDivision:'{noOfDigitsInDivision}'")

if fractionPosition != -1:
decimalDivision =division / (10 ** (noOfDigitsInDivision - fractionPosition))

num_str = str(Decimal(decimalDivision).normalize())
decimal_part = num_str.split(".")[1] if "." in num_str else ""

print("%%% decimal_part:='{decimal_part}'")

if repeateEndIndex > 0:
stringDivision = num_str.split(".")[0] + "." + decimal_part[:repeateStartIndex + repeateEndIndex+1].ljust(repeateStartIndex + repeateEndIndex+1, '0')
else:
stringDivision = num_str.split(".")[0] + "." + decimal_part[:requiredDecimalFraction].ljust(requiredDecimalFraction, '0')


enhancedDouble=RecurringDecimal(decimalDivision,repeateStartIndex,repeateEndIndex,stringDivision)


print(f"$$$$ noOfDigitsAfterDecimal='{noOfDigitsAfterDecimal-1}' immediateDivision='{immediateDivision}'")
print(f"$$$$ repeateStartIndex='{repeateStartIndex}' repeateEndIndex='{repeateEndIndex}'")

return enhancedDouble
except ZeroDivisionError as e:
print("Error:", e)
raise ZeroDivisionError("Division by zero is not allowed.")

enhancedDouble:RecurringDecimal = getDivision(decimalDivisor,decimalDivident,22)
print(f"Division Result:'{enhancedDouble.decimalValue}',Recurring Start Point:'{enhancedDouble.repeatStart}' Recurring End Point:'{enhancedDouble.repeatEnd}' String Value '{enhancedDouble.stringValue}'")