Monday, 25 December 2023

Top UI Libraries for React Development! 🎨✨

 🚀 Exploring Top UI Libraries for React Development! 🎨✨


Material-UI | Ant Design| Chakra UI | Tailwind CSS with React | Semantic UI React

Are you diving into React development and wondering which UI library to leverage for your project? 🤔 Look no further! Here's a roundup of some commonly used UI libraries that can supercharge your React applications:


Material-UI: 🛠️ With its adherence to Google's Material Design principles, Material-UI provides a vast array of pre-built components to create sleek, consistent, and visually appealing user interfaces effortlessly.

Ant Design: 🐜🎨 Known for its enterprise-level quality components, Ant Design follows a comprehensive design system and offers a rich collection of customizable UI components tailored for complex application needs.

Chakra UI: 🌟 Prioritizing developer experience and accessibility, Chakra UI offers a modular set of components and styling primitives for creating responsive and consistent UIs with ease.

Semantic UI React: 📐🔍 Following Semantic UI's principles, this library delivers a variety of components with consistent theming and integration capabilities, making UI development straightforward.

Tailwind CSS with React: 🎉🖌️ Though not a conventional UI library, the powerful utility-first approach of Tailwind CSS combined with React enables rapid UI component creation by composing utility classes.
Whether it's adhering to design principles, emphasizing developer experience, or offering customization, these UI libraries provide a robust toolkit for React developers to craft stunning and functional user interfaces.

🚀 Which UI library is your go-to choice for React projects? Share your experiences and preferences in the comments below! Let's spark a conversation on crafting exceptional user interfaces with React! 🔥✨
hashtagReact hashtagUIDesign hashtagUIFrameworks hashtagFrontendDevelopment hashtagMaterialUI hashtagAntDesign hashtagChakraUI hashtagSemanticUI hashtagTailwindCSS hashtagDeveloperTools hashtagCodingLife

Sunday, 23 January 2022

Level Order Traversal

 Level Order Traversal:

Level by Level
Approch

    1. Created a Queue,
    2. push the root and null
    3. in while loop traverse the tree
    4. create temp print and pop the root 
    5. push the left and right of the root and continue the while loop 
    

static void printlevelOrder(Node root) {
        Queue<Node> q = new LinkedList<Node>();
        q.add(root);
        q.add(null);
        while (!q.isEmpty()) {
            Node curr = q.poll();
            if (curr == null) {
                if (q.isEmpty()) {
                    return;
                }
                q.add(null);
                System.out.println();
                continue;
            }
            System.out.print(curr.data + " ");
            if (curr.left != null) {
                q.add(curr.left);
            }
            if (curr.right != null) {
                q.add(curr.right);
            }
        }
    }

Saturday, 22 January 2022

Height , Size , Maximum and Minimum of Binary Tree

 Height of Binary Tree:


Height of Binary Tree can be calculated by recursive call of left and right nodes 

static int height(Node root) {
        if (root == null) {
            return 0;
        }
        return Math.max(height(root.left), height(root.right)) + 1;
    }

Recursive stack of height function


Size of Binary Tree:

 static int size(Node root) {
        if (root == null) {
            return 0;
        }
        return size(root.left) + size(root.right) + 1;
    }

Minimum of Binary Tree:
static int minimum(Node root) {
        if (root == null) {
            return Integer.MAX_VALUE;
        }
        return Math.min(root.data, Math.min(minimum(root.left), minimum(root.right)));
    }

Maximum of Binary Tree:

static int maximum(Node root) {
        if (root == null) {
            return Integer.MIN_VALUE;
        }
        return Math.max(root.data, Math.max(maximum(root.left), maximum(root.right)));
    }


Reference Video: 
Anuj Bhaiya(Hindi) : https://www.youtube.com/watch?v=hyAqgckHUiA&list=PLUcsbZa0qzu3yNzzAxgvSgRobdUUJvz7p


Trees - Data Structure || Implementation & PreOrder PostOrder and InOrder Traversal

 Tree  - means root, parent and child nodes, leaf nodes

Root - at the top of the Tree
Internal  Nodes - parent and child
Leaf - Nodes at the end of the tree 

Binary  Tree - At most 0,1, 2 child nodes.
Full Binary Tree/Strict Binary Tree - 0 or 2 Children.
ACBT Almost Complete Binary Tree :
    1. Complete the tree with Left to Right 
    2. Complete the tree with level

Complete Binary Tee :  Except children at leaf every level needs to filled with children

Binary Search Tree:  height = log(n)

Inserted Left element are need to smaller and Right element need to greater.

How to insert and traverse the Binary search tree:

Right side nodes will be greater than root
Left side nodes will be less than root


Pre Order, In Order, Post Order:


InOrder  - Left Root Right
PreOrder - Root Left Right
Post Order - Left Right Root




import java.util.Scanner;

class tree {
    static Scanner sc = new Scanner(System.in);

    public static void main(String args[]) {
        Node root = createTree();
        inOrder(root);
        System.out.println();
        preOrder(root);
        System.out.println();
        postOrder(root);
    }

    static Node createTree() {
        Node root = null;
        System.out.println("Enter the data");
        int data = sc.nextInt();
        if (data == -1) {
            return null;
        }
        root = new Node(data);
        System.out.println("Enter the left " + data);
        root.left = createTree();
        System.out.println("Enter the right" + data);
        root.right = createTree();
        return root;
    }

    static void inOrder(Node root) {
        if (root == null) {
            return;
        }
        inOrder(root.left);
        System.out.print(root.data + " ");
        inOrder(root.right);
    }

    static void preOrder(Node root) {
        if (root == null) {
            return;
        }
        System.out.print(root.data + " ");
        preOrder(root.left);
        preOrder(root.right);
    }

    static void postOrder(Node root) {
        if (root == null) {
            return;
        }
        postOrder(root.left);
        postOrder(root.right);
        System.out.print(root.data + " ");
    }
}

class Node {
    Node left;
    Node right;
    int data;

    Node(int d) {
        this.data = d;
    }

}

 Input :

2 4 7 -1 -1 -1 1 8 -1 -1 3 -1 -1 

Output:

Video Reference:

Anuj Bhaiya : 

Implementation : https://www.youtube.com/watch?v=QhIM-G7FAow
Traversal Techniques : https://www.youtube.com/watch?v=cFRRgwPIk2s



Tuesday, 11 January 2022

Cron Tabs | Cron Jobs Linux Administration

 

Cron daemon to shedule tasks that run repeatly after specific times

crontab- l list current user crontable
crontab -e edit current user crontable
crontab -d delete current user crontable


cat job1
crontab 
ping apple.com

job 1
ping robo.com
job2
ping google.com
crontab -e 
select-editor
42 19 19 10 5 /home/mycronjobs/job1
42 19  * * * /home/mycronjobs/job2
:w
ps aux | grep ping 
ps procss 

kill  psid 
kill 22780








Wildcards, Alias, Grep, pipes, Shell variables, Environment variables Linux Administration

Linux Administration 
wildcard * ? []
Examples 
delete music files .mp3  >10 

rm musicfiles-1?.mp3


?- only one character 
rm music file-?.mp3

* one or more 
rm music-file-*

ls

rm txtfile-[1234]

rm file-moves-[Aa]


PIPES
pipes || are used to direct the output from one command to another

GREP
finding the matching patern

cat fruits | grep Orange
onlu 

cat vegetables |grep carrot

 cat vegetables |grep carrot | sort

uniq : unique no and count

cat Numbers | uniq -c

cat fruits | grep ap | sort

Alias in shell
shortcut to your own command
To list already seted alias ->  alias

uptime
alias u='uptime'
u
alias doc = 'libreoffice -writer'
doc

Linux environment variables:
=> Storing a value in a location filename, text,a num, other type of data;
=> Application setting to different application
Private to currently running shell
'MYVAR = private; OURVAR = shared; printenv'
shell executes the printenv  it exports as OURVAR but not as MYVAR
print env  passed to child variables




To see shell variables :
set | less
HISTFILE
To print environment variables 
printenv
user =cam 
 

MYTESTVAR='This my ada'
Set | grep MYTESTVAR 
>'This my ada'
exist only shell session 
printenv | grep MYTESTVAR
>no data


echo $MYTESTVAR"
shell to environment var
export $MYTESTVAR"
printenv | grep MYTESTVAR
echo $MYTESTVAR"

Demoting the env var
export -n MYTESTVAR
printenv | grep MYTESTVAR
>no data

MYDIR='/home/Musicc'
echo $MYDIR

ls $MYDIR 
setting the shell variables
vi ~/.bash_profile
setting the env variables
vi /etc/profile



Tuesday, 24 August 2021

Firebase Login and Signup app Android Studio v1

Github Link:

https://github.com/mur4l33/firebaseapp

Firebase Android Studio:

Output:


Home page

    

    









=>signup wih Firebase and go to console 
=>create a google-service.json file with your proper packagename 
=>download and keep your google-service.json in app folder of your app



1. Adding in build.gradle (Module):

    Add dependencies :
    implementation 'com.google.firebase:firebase-auth:11.8.0'
    implementation platform('com.google.firebase:firebase-bom:28.2.1')
    implementation 'com.google.firebase:firebase-analytics'

    Add plugin :
    plugins {
        id 'com.android.application'
    }


2. Create text boxes for username and password, Button for signup and Login:

Signup validation 
    1.Check whether text boxes are not empty 
        ==>get string :
            String email=emailId.getText().toString();
            String pass=password.getText().toString();
            
        ==>validate the string :
        
            if(email.isEmpty()){
                emailId.setError("Please enter emailid");
                emailId.requestFocus();
            }else if(pass.isEmpty()){
                password.setError("Please enter password");
                password.requestFocus();
            }else if(email.isEmpty() && pass.isEmpty()){
                Toast.makeText(act3.this,"Fields are empty",Toast.LENGTH_SHORT).show();
            }else if(!(email.isEmpty() && pass.isEmpty())){
            
        ==>==>using firebase Auth createUserWithEmailAndPassword and addOnCompleteListener
        
                mFirebaseAuth.createUserWithEmailAndPassword(email,pass).addOnCompleteListener(act3.this, new OnCompleteListener<AuthResult>() {
                    @Override
                    public void onComplete(Task<AuthResult> task) {
                        if(!task.isSuccessful()){
                            Toast.makeText(act3.this,"Signup error, please Try Again",Toast.LENGTH_SHORT).show();
                        }else{
                            startActivity(new Intent(act3.this,homeActivity.class));
                        }
                    }
                });

            }else{
                Toast.makeText(act3.this,"Error Occurred",Toast.LENGTH_SHORT).show();
            }
        }
            


2. For Login 
    declare mAuthStateListener Object
    
    private FirebaseAuth.AuthStateListener mAuthStateListener;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_fblogin);
        mFirebaseAuth =FirebaseAuth.getInstance();
        emailId=findViewById(R.id.email);
        password=findViewById(R.id.password);
        btnsignIn=findViewById(R.id.signin);
        tvsignIn=findViewById(R.id.textView2);
        
        
    //===>creating a Firebase Auth listener 
        
        mAuthStateListener = new FirebaseAuth.AuthStateListener() {
        // check for session using onAuthStateChanged 
            @Override
            public void onAuthStateChanged(@NonNull FirebaseAuth firebaseAuth) {
                FirebaseUser mFirebaseUser=mFirebaseAuth.getCurrentUser();
                if(mFirebaseUser!=null){
                    Toast.makeText(fblogin.this,"logged in", Toast.LENGTH_SHORT).show();
                    Intent i =new Intent(fblogin.this, homeActivity.class);
                    startActivity(i);
                }else{
                    Toast.makeText(fblogin.this,"Please Login", Toast.LENGTH_SHORT).show();
                }
            }
        };
        
        // signin Listener
        
        btnsignIn.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                String email=emailId.getText().toString();
                String pass=password.getText().toString();
        //validating listener
                if(email.isEmpty()){
                    emailId.setError("Please enter emailid");
                    emailId.requestFocus();
                }else if(pass.isEmpty()){
                    password.setError("Please enter password");
                    password.requestFocus();
                }else if(email.isEmpty() && pass.isEmpty()){
                    Toast.makeText(fblogin.this,"Fields are empty",Toast.LENGTH_SHORT).show();
                }else if(!(email.isEmpty() && pass.isEmpty())){
        //signin with username and password
                    mFirebaseAuth.signInWithEmailAndPassword(email,pass).addOnCompleteListener(fblogin.this, new OnCompleteListener<AuthResult>() {
                        @Override
                        public void onComplete(@NonNull Task<AuthResult> task) {
                            if(!task.isSuccessful()){
                                Toast.makeText(fblogin.this,"Login Error Occurred, Please Try again",Toast.LENGTH_SHORT).show();
                            }else{
                                Intent i =new Intent(fblogin.this, homeActivity.class);
                                startActivity(i);
                            }
                        }
                    });

                }else{
                    Toast.makeText(fblogin.this,"Error Occurred",Toast.LENGTH_SHORT).show();
                }
            }
        });
        tvsignIn.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent =new Intent(fblogin.this, fb.class);
                startActivity(intent);
            }
        });

    }
    @Override
    protected void onStart(){
        super.onStart();
        mFirebaseAuth.addAuthStateListener(mAuthStateListener);
    }


Logout Script:
in some home page
signout=findViewById(R.id.signout);
        signout.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                FirebaseAuth.getInstance().signOut();
                Intent i=new Intent(home.this, fblogin.class);
                startActivity(i);
            }
        });