Saturday, April 19, 2025

Software Testing Mutation Operators Example Codes

 Software Testing Mutation Operators Example Codes (SKD)Super Keyword Deletion

Software Testing Mutation Operators Example Codes

 Program1:Overriden Method Rename

Example of  :Overriden Method Rename

//List is a base class 

class List{

    void m(){

        f1();    //before the instance f(), if we rename it to f1()

    }

    void f1(){

        System.out.println("List::f()");

    }

}

//child class stack , it doesn,t have f1() method , f1() is not overriden

class Stack extends List{

    void f(){

        System.out.println("Stack::f()");

    }

}

public class Main{

public static void main(String[] args) {

//List l = new List();

//l.m();-----> output is List::f()

//Stack s = new Stack();

//s.m();-----> output is stack::f()

List l1 = new List();

List l2 = new Stack();

l1.m(); ------->output is List::f()

l2.m();------>output is stack::f()

}

}////After rename f() to f1() out put is     List::f()

                                                                List::f()

After rename f() to f1() output is List::f(), List::f() — is this correct?

Yes, that is correct — because f1() is not overridden in Stack.

Let me know if you want to see a version of the code with the output printed for both versions (f() and f1()) side-by-side.

Now Stack overrides f(), and dynamic dispatch will apply:

List l2 = new Stack(); l2.m(); // Output: Stack::f()

-------------------------------------------------------------------------------------------------

Key Concepts:

  1. List.m() calls f1()

    • f1() is defined only in List.

    • f1() is not overridden in Stack.

    • Therefore, even if List l2 = new Stack();, calling l2.m() still invokes List.m(), which calls List.f1().

  2. Stack defines f(), not f1()

    • So there's no method overriding of f1() in Stack.

  3. Polymorphism doesn't apply here

    • Because f1() is not overridden, dynamic dispatch doesn’t occur for that method call.

    • So l2.m() will still use List's f1().

 Confusion Clarified:

You mentioned:

//Stack s = new Stack();
//s.m();-----> output is stack::f()

This is incorrect.
Since m() calls f1() (not f()), and Stack does not override f1(), it will call List's version of f1().

Wednesday, April 16, 2025

Important commands for Set up the Environment in VSCode

 Important commands for Set up the Environment in VSCode

1.open vscode create new folder

2.open new terminal 

3.create virtual enviroment
python3 -m venv <name of venv>
<name of venv > =you can give any name 
or
Pip install Virtualenv
          virtualenv <virtualenv -name>

6.Activate VirtualEnvironment
          venv/scripts/activate

5.Install requirements

           pip install -r requirment.txt
7.Run the Flask application
            python3 app.py (or) main.py

8.Check sum Dir commands before viva
          pip install checksumdir

          import checksumdir
          hash = checksumdir.dirhash("folder_name")
          print(hash)

9.For MAD2 project
MailHog
https://github.com/mailhog/MailHog
sudo apt-get -y install golang-go
go install github.com/mailhog/MailHog@latest

10.Celery
celery -A app:celery_app worker -l INFO

Running Celery in Two Terminals (WSL + VENV)

Terminal 1 – Celery Worker

         celery -A app:celery_app worker -l INFO

1.celery: starts Celery
2.-A app:celery_app:
  • app is the Python file or package where your Flask app lives

  • celery_app is the Celery instance inside that file

3.worker: starts the worker, which runs the background tasks
4.-l INFO: sets log level to INFO so you can see what's happening

Terminal 2 – Celery Beat (Scheduler)

                celery -A app:celery_app beat -l INFO
beat: runs the scheduler that triggers tasks on a schedule (e.g., every hour, daily, etc.)

 celery_app.config_from_object(app.config["CELERY"])

In your Flask app, you probably have some Celery config like this:

app.config["CELERY"] = {
    "broker_url": "redis://localhost:6379/0",
    "result_backend": "redis://localhost:6379/0",
    "task_serializer": "json",
    "timezone": "UTC"
}
celery_app = Celery(__name__)
celery_app.config_from_object(app.config["CELERY"]

Tells Celery to load configuration from your Flask app’s config
app.config["CELERY"] is a dictionary of settings (like broker URL, result backend, etc.)

INFO-links:
https://docs.celeryq.dev/en/stable/userguide/periodic-tasks.html
celery_app.config_from_object(app.config["CELERY"])


 12.Design links to create random images for profile using this 
https://www.figma.com/design/8gofrho5qM79pdqMSLGk71/Untitled-(1)?node-id=0-1&t=xthanTKKkvRNE4TT-0
<img src="https://picksum.photos/500/500" alt="photo of campaign">

MAD2
Redis server- (WSL)
Frontend -(CMD)
Backend -(WSL) (VENV)
MailHog -(WSL)


MAD1-TechStack
  1. Python – The core programming language used to build the backend logic of the application.

  2. Flask – A lightweight web framework in Python used to create web routes, handle user requests, and manage the server-side of the application.

  3. HTML – Used to structure the content of web pages, forming the base layout of the frontend.

  4. Bootstrap – A frontend CSS framework used to style HTML components, make the layout responsive, and provide a clean user interface.

  5. Flask-RESTful==0.3.9 – An extension for Flask that helps build RESTful APIs quickly and cleanly, making it easy to interact with external clients or services.

  6. Flask-SQLAlchemy==3.0.2 – A Flask extension that integrates SQLAlchemy with Flask, allowing easy interaction with the SQLite database through Python objects.

  7. Jinja2==3.1.2 – The templating engine used by Flask to inject dynamic content (like user data or campaign info) into HTML pages.

  8. SQLAlchemy==1.4.45 – The Object Relational Mapper (ORM) used to define models and manage database operations using Python code instead of raw SQL.

  9. Werkzeug==2.2.2 – A WSGI utility library used internally by Flask, and also helps in securely handling things like password hashing and file uploads.


DB Schema Design Tools
           
4.https://drawsql.app


Tuesday, April 15, 2025

MAD1 -DB-1

 List of Questions 

Questions Related to Data Base

1.Explain your models?

It is related to your models.py file but common model is user for example :

1. User Model

Represents all users in the system  including Admins, Sponsors, and Influencers.

Fields:

  • id: Unique identifier

  • username: Login name

  • email: User email

  • password_hash: Securely stored password (hashed)

  • role: User type (admin/sponsor/influencer)

  • created_at: Timestamp of account creation

Passwords are stored using secure hashing (e.g., Werkzeug or bcrypt) to prevent exposure in case of a database breach.


2. Campaign Model

Represents sponsorship campaigns created by sponsors.

Fields:

  • id: Unique identifier

  • title: Name of the campaign

  • description: Campaign details

  • category: Niche/category (e.g., tech, fashion)

  • budget: Amount sponsor is willing to pay

  • status: Status (public/private/flagged)

  • sponsor_id: Foreign key linking to User

  • created_at: Date created

Only sponsors can create/update/delete campaigns. Admins can moderate them.


3. AdRequest Model

Connects influencers with campaigns by allowing them to send requests.

Fields:

  • id: Unique identifier

  • influencer_id: Foreign key linking to User

  • campaign_id: Foreign key linking to Campaign

  • status: pending/approved/rejected

  • message: Optional pitch from influencer

  • submitted_at: Date of request

Influencers use this model to apply for campaigns.


4. Rating/Review Model (Optional)

Allows sponsors to rate influencers after a campaign ends.

Fields:

  • id: Unique identifier

  • sponsor_id: Foreign key to User

  • influencer_id: Foreign key to User

  • campaign_id: Foreign key to Campaign

  • rating: Score (e.g., 1 to 5)

  • review: Text review

  • created_at: Date of review

Mangerial Economics Quiz1 solutions Guide

Mangerial Economics Quiz1 solutions Guide  solutions watch on you tube channel