Friday, 14 July 2023

Hello World!! 

Data Visualization Project: Census of India 2011 - Population of Religious Groups in a State

Project's Link - https://amanraj1212.pythonanywhere.com

My Portfolio website's Link - https://amanraj-website.netlify.app

This is a full stack project from development to deployment.


I have created an intriguing data visualization project focused on the Census of India 2011. This project aims to provide insights into the population distribution of different religious groups across a particular state. By utilizing the data from the Census, I have implemented a bar graph visualization that effectively represents the population numbers for each religious group.


The visualization allows users to explore and compare the population of various religious groups within the selected state. By presenting the data in a bar graph format, it becomes easy to comprehend the relative sizes and proportions of each religious group. This visualization enables users to identify trends, patterns, and disparities in the population distribution, facilitating a better understanding of the demographics within the state.


Through this project, I have successfully combined data analysis, visualization techniques, and web development skills to create an informative and interactive tool. It provides a visual representation of the religious diversity within the chosen state based on the Census data from 2011.


Overall, my data visualization project offers a valuable resource for individuals interested in exploring the population distribution of religious groups in a specific state. It highlights the power of data visualization in conveying complex information effectively and engagingly.


Feel free to visit my website and explore my data visualization project further. It's a great opportunity to gain insights into the Census of India 2011 and appreciate the power of data visualization in understanding demographic trends.

Sunday, 11 June 2023

Here is a Java practice problem taken from HackerRank that tests your knowledge of strings. The problem involves arranging strings in lexicographical order and capitalizing the first letter of each word. It's a great exercise for revision and practice. Here's the problem description and a sample solution:

Problem statement:

Given two strings of lowercase English letters, and B, perform the following operation:

  1. Sum of length of and B.
  2. Determine if is lexicographically larger than B(i.e.: comes after A in dictionary?).
  3. Capitalize the first letter of and B and print them on a single line, separated by a space.

Input Format

The first line contains a string A. The second line contains another string B. The strings are comprised of only lowercase English letters.

Output Format

There are three lines of output:
For the first line, sum the lengths of and B.
For the second line, write Yes if is lexicographically greater than otherwise print No instead.
For the third line, capitalize the first letter in both A and and print them on a single line, separated by a space.

Sample Input
 hello
 java
Sample Input
 9
 No
 Hello Java
Explanation

String is “hello” and is “java”. has a length of 5, and has a length of 4; the sum of their lengths is 9.
When sorted alphabetically/lexicographically, “hello” precedes “java”; therefore, is not greater than and the answer is No. When you capitalize the first letter of both and and then print them separated by a space, you get “Hello Java”.

// My solution:

import java.io.*;
import java.util.*;

public class Solution {

    public static void main(String[] args) {
         
        Scanner scanner = new Scanner(System.in);
        String A = scanner.nextLine();
        String B = scanner.nextLine();
        scanner.close();
        String lCaseA= A.toLowerCase();
        String lCaseB=B.toLowerCase();
        System.out.println(lCaseA.length()+lCaseB.length());
        String flag="Yes";
        int min=lCaseB.length();
        if(lCaseA.length()<=lCaseB.length()) min=lCaseA.length();
        //System.out.println(max);
        int i=0;
        while(i<min)
        {
           if((int)lCaseA.charAt(i)<(int)lCaseB.charAt(i))
           {
              flag="No";
              break;
           }
           else if((int)lCaseA.charAt(i)==(int)lCaseB.charAt(i))
           {
            i++;   
            flag="No";
            continue;
           }
           else
           {
            break;
           }
         
        }
      //System.out.println(lCaseA);
      //System.out.println(lCaseB);
      System.out.println(flag);   
      
      String ucase=" ";
       Scanner scaner=new Scanner(lCaseA);
       while(scaner.hasNext())
       {
        String word=scaner.next();
        ucase+=Character.toUpperCase(word.charAt(0))+word.substring(1)+" ";

       }
       System.out.print(ucase.trim()+" ");
       scaner.close();
       
       String ucase1=" ";
       Scanner scaner1=new Scanner(lCaseB);
       while(scaner1.hasNext())
       {
        String word1=scaner1.next();
        ucase1+=Character.toUpperCase(word1.charAt(0))+word1.substring(1)+" ";

       }
       System.out.println(ucase1.trim());
       scaner1.close();
    }
}

// program ends

While the provided solution uses two separate while loops for simplicity,
it is worth mentioning that a dedicated function can be created to encapsulate
the logic of capitalizing the first letter of a word. This approach can make the
code more modular and readable. (For the sake of better understanding I showed
with two separate loops)
By practicing this problem, you will gain a deeper understanding of string
manipulation and improve your ability to solve similar challenges efficiently.
Mastery of these concepts will prove valuable in real-world scenarios where
string handling plays a crucial role. Remember to consider edge cases, such as handling empty strings or strings with
leading/trailing spaces(trim()). Understanding these nuances will enhance the robustness
of your solution and make it applicable in various scenarios. Conclusion: This Java practice problem focusing on arranging strings in lexicographical
order and capitalizing the first letter of each word provides an excellent
opportunity to revise and strengthen your skills in string manipulation.
By understanding and implementing the solution, you will enhance your ability to
work with strings effectively and tackle similar challenges with confidence.
Practice this problem and continue exploring more string-related problems to
expand your knowledge and become proficient in different programming logic.

Sunday, 7 May 2023

Greetings, readers! Today's blog post is going to be a bit different than what I usually write about. Instead of discussing technical topics or sharing my latest projects, I want to talk about something that is often overlooked but can have a significant impact on our personal and professional lives: IMPOSTER SYNDROME. Despite being a common experience, imposter syndrome is not often talked about openly in our ongoing professional journey. Yet, it is a pervasive feeling that many people face at some point in their lives. If you haven't experienced it yet, chances are you will encounter it in the near future. In this blog post, I want to shed light on what imposter syndrome is, why it is so common, and how we can overcome it to continue learning and growing. 


Imposter syndrome is a psychological phenomenon that affects many people, especially those who are high achievers or who are pursuing advanced degrees or careers. It is characterized by feelings of self-doubt and insecurity, and a persistent belief that one's successes are due to luck or external factors rather than one's own abilities.

If you are struggling with imposter syndrome, it can be easy to feel discouraged and give up on your goals. However, it is important to remember that imposter syndrome is a common experience, and that it is possible to overcome it and continue learning and growing.

One of the first steps in overcoming imposter syndrome is to recognize that it is a normal and common experience. Many successful people, including scientists, writers, and entrepreneurs, have struggled with feelings of inadequacy and self-doubt at some point in their careers. By acknowledging that imposter syndrome is a common experience, you can start to let go of some of the shame and stigma that may be associated with it.

Another key to overcoming imposter syndrome is to focus on your strengths and accomplishments. It can be easy to discount or dismiss your achievements when you are feeling self-doubt, but it is important to take time to acknowledge and celebrate your successes. Make a list of your accomplishments, no matter how small, and reflect on the hard work and dedication that went into achieving them.

It can also be helpful to seek out support from others. Talk to friends, family members, or colleagues who can offer encouragement and support. Consider joining a support group or seeking out a mentor who can provide guidance and advice as you navigate your career or academic path.

Finally, remember that learning and growth are ongoing processes. No one is an expert in everything, and it is normal to encounter challenges and setbacks along the way. By viewing these challenges as opportunities for growth and learning, you can overcome imposter syndrome and continue to pursue your goals with confidence and determination.

In summary, imposter syndrome is a common experience that can leave us feeling discouraged and insecure. However, by acknowledging our achievements, seeking support from others, and viewing challenges as opportunities for growth, we can overcome imposter syndrome and continue learning and growing. Remember, you are capable of achieving great things, and you deserve to pursue your dreams with confidence and determination.

Friday, 14 April 2023

                                   Backend Developers Paradise --> DTL (Django Template Language)

If you're a full stack web developer who's been around the block when it comes to frontend and backend development, you may be feeling a pull towards the backend side of things. However, you may not be too keen on making the shift to JavaScript for fetching APIs. Fear not! There's a powerful tool at your disposal that may just tickle your fancy: the Django template language.

Django is a high-level Python web framework that takes care of a lot of the heavy lifting when it comes to building web applications. It's been around for quite some time and has built up a solid reputation in the development community. One of the key features of Django is its templating system, which allows you to create dynamic web pages using a combination of HTML, CSS, and Python.

The Django template language is a powerful tool that allows you to create complex, dynamic web pages without having to rely on a lot of JavaScript. With its easy-to-use syntax and powerful features, the Django template language is an excellent choice for developers who want to focus on the backend but still want to create stunning, interactive web pages.

So if you're looking to level up your backend game and want to explore a powerful and flexible tool for creating dynamic web pages, then look no further than the Django template language. Whether you're building a small-scale web application or a large-scale enterprise project, Django has got you covered.

Django Template Language (DTL) is a template language that is an integral part of the Django web framework. DTL provides developers with a powerful and flexible way to create dynamic web pages. With its rich set of features, DTL is an excellent choice for developers who want to create high-quality web applications quickly and efficiently.

One of the key advantages of using DTL is that it is easy to learn and use. The syntax of DTL is simple and straightforward, making it accessible to developers of all skill levels. The template tags and filters provided by DTL make it easy to manipulate data and create dynamic content.

Another advantage of using DTL is its modular design. DTL allows you to create modular templates that can be reused across multiple pages. This makes it easy to maintain consistency across your website and reduces the amount of code you need to write.

DTL also provides built-in security features that prevent common web vulnerabilities such as cross-site scripting (XSS) attacks. It also provides protection against SQL injection attacks by automatically escaping any data that is entered into the templates. This makes DTL a popular choice among developers who value security.

DTL is also highly customizable, allowing developers to create their own template tags and filters. This enables them to extend the functionality of DTL to meet their specific needs, which is a valuable feature for developers working on complex projects.

However, there are some limitations to using DTL. It is primarily a template language and does not support complex logic or control structures. While you can use if/else statements and loops, they are limited in their functionality. Additionally, DTL is not designed to work with dynamic content such as real-time updates or live streaming.

Despite these limitations, DTL remains a powerful tool that offers many benefits to web developers. Its ease of use, security, and performance make it a great choice for creating dynamic and engaging web pages that are easy to maintain and customize. For developers looking to create powerful and scalable web applications, DTL is a valuable tool that should not be overlooked.

In conclusion, Django Template Language is a powerful template language that provides a wide range of features and capabilities for web developers. While it has some limitations, these are outweighed by its many advantages, including its ease of use, security, and performance. Whether you are a beginner or an experienced web developer, DTL is a great choice for creating dynamic and engaging web pages that are easy to maintain and customize.

You can start learning about Django and DTL from its official documentation and from the Youtube channel Geeky Shows (It is long but rock-solid playlist available on youtube)

Sunday, 4 December 2022

Learning more will never be a disadvantage

Hello world, 🙏

Every novice in programming get stuck with a basic problem WHICH LANGUAGE DO THEY PREFER? They are advised by the most to not follow C language. They should directly jump into some language supporting OOPs. Well, I disagree here as C language gives you an encapsulated feel of MEMORY architecture which is paramount topic in CS . Also, learning more will never be a disadvantage. It will only act as a boon.

You can read an article by Mario Galindo Queralt related to this topic below which I found on Quora. I am attaching the link of the same below.

Question:  

Why do universities teach C and C++, though they are regarded as the most difficult languages and there are better alternatives? C and C++ aren’t expanding and will be dead in 30 years, but Stanford, Harvard and U Mich use C++ as a primary language.

 

Answer:

You are totally uninformed. C++ is expanding a lot. The latest version is C++17, next year the C++20 version is being issued, the committee is working hard on C++23 and C++26 is scheduled.

You believe that C and C++ will be dead in 30 years. That belief is based entirely on unsubstantiated speculation. If you don't know anything about the present, less can you know about the future.

In spite of that, 30 years of prognosis in the future is a great deal of time for CS. Therefore, it is feasible to consider that everything, yes EVERYTHING, what exists today in CS will somehow be dead in 30 years. Based on this presumption, should you, and everyone, stop studying absolutely everything today?

Stanford and Harvard are among the most important engineering universities in the world. You must trust their teachers when they choose C and C++ as their primary computer languages. Believe me, they know much more than you.

Therefore, if something is difficult for you, I recommend that you study it more, instead of looking for false arguments to modify what is taught in the university. Do not pretend to teach your teachers, it is the other way around, they are the ones who teach and you who learn.

Regards.

Link to read above on Quora:  Why do universities teach C and C++, though they are regarded as the most difficult languages and there are better alternatives? C and C++ aren’t expanding and will be dead in 30 years, but Stanford, Harvard and U Mich use C++ as a primary language. - Quora

Friday, 30 September 2022

Problem Statement : 

Program to Implement two Stacks using a Single Array & Check for                                      Overflow & Underflow

My code:


//Here is my solution to this question in C language

//I have taken the size of array containing STACK 1 and STACK 2 as 10. Readers may change it as per their need


#include <stdio.h>

#include <stdlib.h>

#define size 10

int arr[size];

int top1=-1;

int top2=size;

//push() for STACK 1:

void push_stack_1(int value)

{

    if(top1<top2-1)

    {

        top1=top1+1;

        arr[top1]=value;

    }

    else

    {

        printf("STACK 1 OVERFLOW\n");

    }

}

//push() for STACK 2:

void push_stack_2(int value)

{

    if(top1<top2-1)

    {

        top2=top2-1;

        arr[top2]=value;

    }

    else

    {

        printf("STACK 2 OVERFLOW\n");

    }

}


//pop() for STACK 1:

void pop_stack_1()

{

    if(top1>=0)

    {

        int popped_value=arr[top1];

        top1=top1-1; 

        printf("%d is popped from STACK 1\n",popped_value);

    }

    else

    {

        printf("STACK 1 UNDERFLOW\n");

    }

}


//pop() for STACK 2:

void pop_stack_2()

{

    if(top2<size)

    {

        int popped_value=arr[top2];

        top2=top2+1; 

        printf("%d is popped from STACK 2\n",popped_value);

    }

    else

    {

        printf("STACK 2 UNDERFLOW\n");

    }

}


//Displaying


//display() for STACK 1:

void display_stack_1()

{

    int i;

    printf("The values of STACK 1 in LIFO manner is:\n");

    for(i=top1;i>=0;i--)

    {

        printf("%d\n",arr[i]);

    }

}


//display() for STACK 2:

void display_stack_2()

{

    int i;

     printf("The values of STACK 2 in LIFO manner is:\n");

    for(int i=top2;i<size;i++)

    {

        printf("%d\n",arr[i]);

    }

}



 int main()  

{  

  int arr[size];  

  int i;  

  int num_of_ele;  

   

  printf ("We can push a total of 10 values\n"); 

  printf("-----------------------------------------------------------");

printf("\n"); 

   

  //Number of elements pushed in stack 1 is 5 

  //Number of elements pushed in stack 2 is 5 

   

// loop to insert the elements into Stack1    

for (i = 1; i <= 5; i++)  

  {  

    push_stack_1(i);  

    printf ("Value Pushed in Stack 1 is %d\n", i);  

  }  

 printf("-----------------------------------------------------------");

printf("\n");  

// loop to insert the elements into Stack2.    

for (i = 6; i <= 10; i++)  

  {  

    push_stack_2(i);  

    printf ("Value Pushed in Stack 2 is %d\n", i);  

  }  

   

  //Print Both Stacks  

 display_stack_1(); 

 printf("-----------------------------------------------------------");

printf("\n"); 

 display_stack_2 ();  

   

  //Pushing on Stack Full  

  printf ("Pushing Value in Stack 1 is %d\n", 11);  

  push_stack_1 (11); 

  printf ("Pushing Value in Stack 2 is %d\n", 110);  

  push_stack_2 (110);   

printf("-----------------------------------------------------------");

printf("\n");

  //Popping All Elements from Stack 1  

  num_of_ele = top1 + 1;  

  while (num_of_ele)  

  {  

    pop_stack_1 ();  

    num_of_ele--;  

  }  

printf("-----------------------------------------------------------");

printf("\n");

num_of_ele = top2 + 1;  

  while (num_of_ele)  

  {  

    pop_stack_2 ();  

    num_of_ele--;  

  }  

    

  // Trying to Pop the element From the Empty Stack  

printf("-----------------------------------------------------------");

printf("\n");

printf("Trying to Pop the element From the Empty Stack 1\n");

pop_stack_1 ();   

printf("-----------------------------------------------------------");

printf("\n");

printf("Trying to Pop the element From the Empty Stack 2\n");

pop_stack_2 ();   

return 0;  

Good thoughtful question on Binary search on answers

Problem link:  https://leetcode.com/problems/maximize-score-of-numbers-in-ranges/description/ Solution: //import java.util.Arrays; class So...