Snippets Collections
#include <iostream>
#include <SFML/Graphics.hpp>
#include <SFML/Audio.hpp>

using namespace std;

// Initializing Dimensions.
// resolutionX and resolutionY determine the rendering resolution.
// Don't edit unless required. Use functions on lines 43, 44, 45 for resizing the game window.
const int resolutionX = 960;
const int resolutionY = 960;
const int boxPixelsX = 32;
const int boxPixelsY = 32;
const int gameRows = resolutionX / boxPixelsX; // Total rows on grid
const int gameColumns = resolutionY / boxPixelsY; // Total columns on grid

// Initializing GameGrid.
int gameGrid[gameRows][gameColumns] = {};

// The following exist purely for readability.
const int x = 0;
const int y = 1;
const int exists = 2;                                    //bool exists;//                       
const int direction = 3;
/////////////////////////////////////////////////////////////////////////////
//                                                                         //
// Write your functions declarations here. Some have been written for you. //
//                                                                         //
/////////////////////////////////////////////////////////////////////////////

void drawPlayer(sf::RenderWindow& window, float player[], sf::Sprite& playerSprite);
void movePlayer(float player[],float bullet[]);
void moveBullet(float bullet[], sf::Clock& bulletClock);
void drawBullet(sf::RenderWindow& window, float bullet[], sf::Sprite& bulletSprite);
void drawShrooms(sf::RenderWindow& window, int shroom[][2], sf::Sprite& shroomSprite,int maxShrooms);
void initializeShrooms(int shroom[][2],int maxShrooms);
void initialize_centipede(float centipede[12][4],int totalSegments);
void drawCentipede(sf::RenderWindow& window, float centipede[12][4], sf::Sprite& centipedeSprite,const int totalSegments); 
void move_centipede(float centipede[12][4], sf::Clock& bulletClock);   

int main()
{
	srand(time(0));
  /*
  //centipede stuff:
  const int totalSegments = 12;
float centipede[totalSegments][2]; // 2D array to store x and y positions of each segment

// Initialize centipede positions (for example, starting from the top left)
const int startX = 100; // Adjust as needed
const int startY = 100; // Adjust as needed
const int segmentGap = 20; // Gap between segments

for (int i = 0; i < totalSegments; ++i) {
    centipede[i][0] = startX + i * segmentGap; // x position
    centipede[i][1] = startY; // y position (same for all segments in this example)
    
}
                     */

       



	// Declaring RenderWindow.
	sf::RenderWindow window(sf::VideoMode(resolutionX, resolutionY), "Centipede", sf::Style::Close | sf::Style::Titlebar);

	// Used to resize your window if it's too big or too small. Use according to your needs.
	window.setSize(sf::Vector2u(640, 640)); // Recommended for 1366x768 (768p) displays.
	//window.setSize(sf::Vector2u(1280, 1280)); // Recommended for 2560x1440 (1440p) displays.
	// window.setSize(sf::Vector2u(1920, 1920)); // Recommended for 3840x2160 (4k) displays.
	
	// Used to position your window on every launch. Use according to your needs.
	window.setPosition(sf::Vector2i(100, 0));

	// Initializing Background Music.
	sf::Music bgMusic;
	bgMusic.openFromFile("Centipede_Skeleton/Music/field_of_hopes.ogg");
	bgMusic.play();
	bgMusic.setVolume(50);

	// Initializing Background.
	sf::Texture backgroundTexture;
	sf::Sprite backgroundSprite;
	backgroundTexture.loadFromFile("Centipede_Skeleton/Textures/background.png");
	backgroundSprite.setTexture(backgroundTexture);
	backgroundSprite.setColor(sf::Color(255, 255, 255, 200)); // Reduces Opacity to 25%
        
	// Initializing Player and Player Sprites.
	float player[2] = {};
	player[x] = (gameColumns / 2) * boxPixelsX;
	player[y] = (gameColumns * 3 / 4) * boxPixelsY;
	sf::Texture playerTexture;
	sf::Sprite playerSprite;
	playerTexture.loadFromFile("Centipede_Skeleton/Textures/player.png");
	playerSprite.setTexture(playerTexture);
	playerSprite.setTextureRect(sf::IntRect(0, 0, boxPixelsX, boxPixelsY));
	
	sf::Clock playerClock;

	// Initializing Bullet and Bullet Sprites.
	float bullet[3] = {};                              
	                                  //bool bullet1[3];
	bool request = false;
	bullet[x] = player[x];
	bullet[y] = player[y] - boxPixelsY;
	bullet[exists] = false;
	sf::Clock bulletClock;
	sf::Texture bulletTexture;
	sf::Sprite bulletSprite;
	bulletTexture.loadFromFile("Centipede_Skeleton/Textures/bullet.png");
	bulletSprite.setTexture(bulletTexture);
	bulletSprite.setTextureRect(sf::IntRect(0, 0, boxPixelsX, boxPixelsY));
	
	//initializing centipede
	const int totalSegments = 12;
	float centipede[totalSegments][4];
	
	//centipede[x] = (gameColumns / 2) * boxPixelsX;           //the position from where centipede will start its journey x-co-ordinate//
	//centipede[y] = (gameColumns * 3 / 4) * boxPixelsY;         //the position from where centipede will start its journey y-co-ordinate//
	//centipede[1][exists] = false;
	for(int i=0;i<totalSegments;i++){
 
	centipede[i][exists] = true;
	
	
	                                 }
	               
	sf::Texture centipedeTexture;
	sf::Sprite centipedeSprite;
	centipedeTexture.loadFromFile("Centipede_Skeleton/Textures/c_body_left_walk.png");
	centipedeSprite.setTexture(centipedeTexture);
	centipedeSprite.setTextureRect(sf::IntRect(0, 0, boxPixelsX, boxPixelsY));
	
	sf::Clock centipedeClock;
	
	//initializing shrooms:
	const int maxShrooms = 18;
	int shroom[maxShrooms][2] = {};
        
	sf::Texture shroomTexture;
	sf::Sprite shroomSprite;
	shroomTexture.loadFromFile("Centipede_Skeleton/Textures/mushroom.png");
	shroomSprite.setTexture(shroomTexture);
	shroomSprite.setTextureRect(sf::IntRect(0, 0, boxPixelsX, boxPixelsY));
      
        initializeShrooms(shroom,maxShrooms);           //calling shroom's function to initialize position;
	while(window.isOpen()) {

		///////////////////////////////////////////////////////////////
		//                                                           //
		// Call Your Functions Here. Some have been written for you. //
		// Be vary of the order you call them, SFML draws in order.  //
		//                                                           //
		///////////////////////////////////////////////////////////////

		window.draw(backgroundSprite);
		
		drawPlayer(window, player, playerSprite);
		movePlayer(player,bullet);
		/*shootBullet(bullet,request);
		if(request){
		bullet[exists] = true;
		request = false;          
		    }                       */  
		
		if (bullet[exists] == true) {
			moveBullet(bullet, bulletClock);
			drawBullet(window, bullet, bulletSprite);
			
		}
		
		
		drawShrooms(window,shroom,shroomSprite,maxShrooms);
		
		
		//initialize_centipede(centipede,totalSegments);
		drawCentipede(window, centipede, centipedeSprite,totalSegments);
		move_centipede(centipede,centipedeClock);
		
		
		
           sf::Event e;
		while (window.pollEvent(e)) {
			if (e.type == sf::Event::Closed) {
				return 0;
			}
		
		}		
		window.display();
		window.clear();
	}
	 
	
	
 }

////////////////////////////////////////////////////////////////////////////
//                                                                        //
// Write your functions definitions here. Some have been written for you. //
//                                                                        //
////////////////////////////////////////////////////////////////////////////

void drawPlayer(sf::RenderWindow& window, float player[], sf::Sprite& playerSprite) {
	playerSprite.setPosition(player[x], player[y]); 
	window.draw(playerSprite);
}




void drawBullet(sf::RenderWindow& window, float bullet[], sf::Sprite& bulletSprite) {
	bulletSprite.setPosition(bullet[x], bullet[y]);
	window.draw(bulletSprite);
	
    }





                 
                       



void moveBullet(float bullet[], sf::Clock& bulletClock) {
 float bullet_speed = 10.0f;
        
    
 	if (bulletClock.getElapsedTime().asMilliseconds() < 10)
		return;
        
	bulletClock.restart(); 
	bullet[y] += -32;	 
	if (bullet[y] < -32)    
       {  bullet[exists] = false; }
		
                                               }  
                                               


       
                                               
                                               


void drawShrooms(sf::RenderWindow& window, int shroom[][2], sf::Sprite& shroomSprite,int maxShrooms){
     
     for(int i=0;i<maxShrooms;i++){
                          
                          
                          
                          shroomSprite.setPosition(shroom[i][x],shroom[i][y]);
                          window.draw(shroomSprite);                            
                                                                                  } 
                                                                                      
                  } 

void initializeShrooms(int shroom[][2],int maxShrooms){
                                                                                                
                                                                                               
     for(int i=0;i<maxShrooms;i++){
                          shroom[i][x] =     rand()%gameRows * boxPixelsX; 
                          shroom[i][y] =     rand()%gameColumns * boxPixelsY;            
                                                                }
                                                                        }
                                                                                                                                                               
void movePlayer(float player[],float bullet[]) {
    float movementSpeed = 5.0f;
    int bottomLimit = resolutionY - (6 * boxPixelsY); // Calculate the bottom limit
    
    if (sf::Keyboard::isKeyPressed(sf::Keyboard::W) && player[y] > bottomLimit) {
        player[y] -= movementSpeed + 3;
    }
    if (sf::Keyboard::isKeyPressed(sf::Keyboard::S) && player[y] < resolutionY - boxPixelsY) {
        player[y] += movementSpeed + 3;
    }
    if (sf::Keyboard::isKeyPressed(sf::Keyboard::D) && player[x] < resolutionX - boxPixelsX) {
        player[x] += movementSpeed + 3;
    }
    if (sf::Keyboard::isKeyPressed(sf::Keyboard::A) && player[x] > 0) {
        player[x] -= movementSpeed + 3;
    }
    
    if(sf::Keyboard::isKeyPressed(sf::Keyboard::Space) && bullet[exists]==false){
    
    bullet[exists] = true;
    bullet[x] = player[x];
    bullet[y] = player[y] - boxPixelsY;
    
}
    }

void initialize_centipede(float centipede[12][4],int totalSegments){
     
     for(int i=0;i<gameRows;i++){
         for(int j=0;j<totalSegments;j++){
     centipede[j][x] = boxPixelsX*j;
     centipede[i][y] = boxPixelsY*i;
     centipede[j][exists] = true;
     centipede[j][direction] = 1;              //1 for right and 0 for left;
     
     

                                             }
                                                 }
             
             
                                                       }   

void drawCentipede(sf::RenderWindow& window, float centipede[12][4], sf::Sprite& centipedeSprite,const int totalSegments) {
    const int segmentWidth = boxPixelsX; // Width of each centipede segment
    const int segmentHeight = boxPixelsY; // Height of each centipede segment

    
    for (int i = 0; i < totalSegments; ++i) {
        
        centipedeSprite.setPosition(centipede[i][x], centipede[i][y]);
        window.draw(centipedeSprite);
    }
}


        
                                            
void move_centipede(float centipede[12][4], sf::Clock& centipedeClock){  
int totalSegments = 12;
    //initialize_centipede(centipede,12);
   
         
         
         
         
 	if (centipedeClock.getElapsedTime().asMilliseconds() < 10)
		return;
        
	centipedeClock.restart();


for(int j=0;j<gameRows;j++){

   centipede[12][j] += 32; 

	for(int i=0;i<12;i++){
	
	    
	
	
	if(centipede[i][x]<900){ 
	                                                                     //tsudo x-resolution = 900
	   centipede[i][x] += 32;
		
		
		               }
	               
	else{
	
	
	centipede[i][x] -= 32; 
	                              }		               
		               
		               }
	
	                              
	                              
	                                 
	                                   }
	                                        }
	                                    
	 
	/*if (centipede[x] < -32)    
         bullet[exists] = false;      
                                                     }
		
                                                
                                                       
                                                 */
                                                                                              /*  direction 1 = right;
                                                                                                  direction 0 = left;   */
            
                        
                                
                                                             
                                                                     
                                         
                                             

 
           
                                                                  
                        /* TO DO centipede sprite,centepede movement,mushrooms alignment i-e above a particulr row number,*/
# sincronizar el listado de ramas
git fetch -p

# ver últimos commits
git log 
# ver últimos commits bonitos
git log --pretty=oneline

# eliminar rama local que ya ha sido pusheada
git branch -d localBranchName
# eliminar rama local que aún no ha sido pusheada ni mergeada
git branch -D localBranchName
# eliminar rama remota
git push origin --delete remoteBranchName

#include <iostream>

using namespace std;

int dvejetai(int x) {
    int count = 0;

    while (x > 0) {
        if (x % 10 == 2) {
            count++;
        }
        x /= 10;
    }

    return count;
}

int main() {
    int x;
    cout << "Įveskite dviženklį teigiamą skaičių: ";
    cin >> x;

 if (x < 10 || x > 99) {
        cout << "Įvestas skaičius nėra dviženklis." << endl;
        return 1;
    }

    int totalSum = 0;

    for (int i = 0; i < x; ++i) {
        if (i % 2 == 0) {
            totalSum += dvejetai(i);
        }
    }

    cout << "Sunaudojo dvejetų skaičiui parašyti " << x << " yra: " << totalSum <<" dvejetai." <<endl;

    return 0;
}
#include <fstream>
#include <iostream>

using namespace std;

int main() 
{
 
   int n, s1,s2,s3;
   cin>>n;
   
   if(n%2==0) cout<<"Lyginis";
   else cout<<"Nelyginis";
   
   // skaicius n trizenklis.Kaip rasti jo skaitmenis?
   s1=n/100;
   s2=(n/10)%10;
   s3=n%10;//paskutinis skaitmuo bet kuriuo atveju
   
   




return 0;
}
#include <fstream>
#include <iostream>

using namespace std;

int main() 
{
 
   int n;
   cin>>n;
   
   if(n%2==0) cout<<"Lyginis";
   else cout<<"Nelyginis";




return 0;
}
#include <fstream>
#include <iostream>

using namespace std;

int main() 
{
 
    int n;
    int kiek=0;
    cin>>n;
    while(n!=0){
        if (n%2==1) n=n-1;
        else n=n/2;
        kiek++;
    }
    cout<<kiek;

return 0;
}
Arrange the following work steps in the correct chronological order of their creation.
#include <fstream>
#include <iostream>

using namespace std;

int main() 
{
    ifstream df("U1.txt");
    if(df.fail()) cout<<"Nera failo!";
    else {
        int n;
        df>>n;
        int kiek=0;
        for(int d=1; d<=n; d++)
        {
            if(n % d==0) kiek++;   
            }
            ofstream rf("U1rez.txt");
            rf<<kiek;
            rf.close();
    }
    

return 0;
}
#include <fstream>
#include <iostream>

using namespace std;

int main() 
{
ifstream duom ("U1.txt");
int a,b,c;
duom>>a>>b>>c;
duom.close();
int x, y;
ofstream rez("U1rez.txt");
for(int x=-3; x<=3; x++)
{
    y=a*x*x+b*x+c;
    rez<<"Kai x="<<x<<", tai y="<<y<<endl;
}
rez.close();
return 0;
}
#include <fstream>
#include <iostream>

using namespace std;

int main() {
  ifstream df ("U1.txt");
  ofstream rf ("U1rez.txt");
  int a,n;
  df >> a >> n;
  int suma=0;
  for (int i = a; i <= n; i++) 
  {
  suma=suma + i;
  
  }
  rf<<suma;
  df.close();
  rf.close();
  return 0;
}
#include <fstream>
#include <iostream>

int main() {
  ifstream df("U1.txt");
  ofstream rf("U1rez.txt");
  int n;
  df >> n;
  for (int i = 1; i <= n; i++) {
    rf << "*\n";
  }
  df.close();
  rf.close();
  return 0;
}
# settings.py

MIDDLEWARE = [
    "django.middleware.cache.UpdateCacheMiddleware", # add this middleware
    "django.middleware.common.CommonMiddleware",
    "django.middleware.cache.FetchFromCacheMiddleware", # add this middleware
]

CACHE_MIDDLEWARE_SECONDS = 60 * 15 # time the cached data should last
# core/settings.py 

# other settings....

CACHES = {
        "default": {
            "BACKEND": "django_redis.cache.RedisCache",
            "LOCATION": "redis://redis:6379/",
            "OPTIONS": {
                "CLIENT_CLASS": "django_redis.client.DefaultClient"
            },
        }
    }
def generate_database_backup():
    host = os.environ.get("DATABASE_HOST")  # Database host
    port = os.environ.get("DATABASE_PORT")  # Database port
    db_name = os.environ.get("POSTGRES_DB")  # Database name
    db_username = os.environ.get("POSTGRES_USER")  # Database username
    db_password = os.environ.get("POSTGRES_PASSWORD")  # Database password
    current_datetime = datetime.now()
    date_folder = current_datetime.strftime("%Y-%m-%d")  # Date folder
    download_sql_file = f'db_backup_{db_name}_{current_datetime.strftime("%Y-%m-%d_%H:%M")}.sql'  # SQL file name
    compressed_sql_file = f"{download_sql_file}.zip"  # Compressed SQL file name
    # zip_file_name = f'backup_{db_name}_{current_datetime.strftime("%H:%M")}.zip'  # Zip file name
    s3_bucket_name = settings.AWS_STORAGE_BUCKET_NAME  # Name of your S3 bucket
    s3_key = f"dailyDataBaseBackup/{date_folder}/{compressed_sql_file}"  # Key (path) under which the file will be stored in S3
    aws_access_key_id = settings.AWS_ACCESS_KEY_ID
    aws_secret_access_key = settings.AWS_SECRET_ACCESS_KEY

    # Calculate the date 1 month ago from today in UTC
    one_month_ago = datetime.now(timezone.utc) - timedelta(days=30)

    # Upload the backup file to S3
    s3 = boto3.client(
        "s3",
        aws_access_key_id=aws_access_key_id,
        aws_secret_access_key=aws_secret_access_key,
    )

    # List objects in the S3 bucket
    objects = s3.list_objects_v2(Bucket=s3_bucket_name)["Contents"]

    # Iterate through the objects and delete backup files older than 1 month
    for obj in objects:
        key = obj["Key"]
        last_modified = obj["LastModified"]

        # Check if the key represents a compressed SQL backup file and if it's older than 1 month
        if (
            key.startswith("dailyDataBaseBackup/")
            and key.endswith(".sql.gz")
            and last_modified < one_month_ago
        ):
            s3.delete_object(Bucket=s3_bucket_name, Key=key)

    # Command to create a database backup file
    backup_command = f"export PGPASSWORD='{db_password}' && pg_dump -h {host} -p {port} -U {db_username} {db_name} -w --clean > {download_sql_file}"

    print(f"Running command: {backup_command}")
    exit_code = subprocess.call(backup_command, shell=True)

    if exit_code == 0:

        # Compress the SQL backup file using gzip
        
        # Create a zip archive of the compressed SQL file
        with zipfile.ZipFile(compressed_sql_file, "w", zipfile.ZIP_DEFLATED) as zipf:
            zipf.write(compressed_sql_file, os.path.basename(compressed_sql_file))

        # Upload the new backup file to S3
       
    
        with open(compressed_sql_file, "rb") as file:
            s3.upload_fileobj(file, s3_bucket_name, s3_key)

            # Remove the files from the project folder
        os.remove(compressed_sql_file)
        os.remove(download_sql_file)
        # os.remove(zip_file_name)

        # db_backup_{db_name}_2023-10-11_11:00.sql.gz

        # Get the full S3 file path
        s3_file_path = f"https://{s3_bucket_name}.s3.amazonaws.com/{s3_key}"

        sender_email = settings.DEFAULT_FROM_EMAIL
        password = settings.EMAIL_HOST_PASSWORD
        receiver_email = "devteam@hikartech.in"
        context = ssl.create_default_context()
        msg = MIMEMultipart("alternative")
        msg["Subject"] = "Database Backup For Hikemm"
        msg["From"] = sender_email
        msg["To"] = receiver_email
        body = f"""

        <!DOCTYPE html>
        <html>
        <head>
            <meta charset="UTF-8">
            <title>Link to S3 File</title>
        </head>
        <body>
            <h1>Link to S3 File</h1>
            <p>Dear all,</p>
            <p>I hope this email finds you well. I wanted to share a link to an S3 file that you might find useful:</p>
            <p><a href="{s3_file_path}"> S3 File URL</a> </p>
            <p>You can click on the link above to access the file. If you have any trouble accessing it or need further assistance, please don't hesitate to reach out to me.</p>
            <p>Thank you, and have a great day!</p>
            <p>Best regards</p>
        </body>
        </html>



        
"""

        html_part = MIMEText(body, "html")
        msg.attach(html_part)
        message = msg.as_bytes()
        email_client = boto3.client(
            "ses",
            aws_access_key_id=settings.AWS_ACCESS_KEY_ID,
            aws_secret_access_key=settings.AWS_SECRET_ACCESS_KEY,
            region_name="ap-south-1",
        )
        response = email_client.send_raw_email(
            Source=sender_email,
            Destinations=[receiver_email],
            RawMessage={"Data": message},
        )
        message_id = response["MessageId"]
        logger.error(f"Email sent successfully {message_id}")




RUN apt-get update && apt-get install -y postgresql-client  # add this in docker file 
// Loop through each item in the order
                        // This loop processes each individual item within the order to extract its specific info
                        foreach ($order->get_items() as $item_id => $item) {

                            // Retrieve the ID of the product associated with the current item in the order
                            $product_id = $item->get_product_id();
                            // Check if the current item's product ID matches the product ID we're processing in this loop iteration
                            if ($product_id == $pid) {
                                // Get the total price and subtotal price specific to this order item
                                // These values are specific to each item in the order, rather than the order as a whole
                                $line_total = wc_get_order_item_meta($item_id, '_line_total', true);
                                $line_subtotal = wc_get_order_item_meta($item_id, '_line_subtotal', true);
                                // ... extract other relevant data ... for now the amounts are ok
            
                                // Build the report entry for this product
                                array_push($order_data,[
                                    'order_id'         => $order_id,
                                    'customer_first'   => $order->get_billing_first_name(),
                                    'customer_last'    => $order->get_billing_last_name(),
                                    'order_created'    => date("d/m/Y",strtotime($order->get_date_created())),
                                    'email'            => $order->get_billing_email(),
                                    'phone'            => $order->get_billing_phone(),
                                    'orders_status'    => $order_status,
                                    'invoice_no'       => $formatted_invoice_number,
                                    'credit_note'      => $credit_note,
                                    'invoice_date'     => $invoice_date,
                                    'credit_note_date' => $credit_note_date,//date("d/m/Y",strtotime($credit_note_date)),
                                    'wooco_currency'   => $currency_symbol,
                                    'gross'            => round($line_subtotal,2),
                                    'discount'         => round($order->get_total_discount(),2),
                                    'net_total'        => round($line_total,2),
                                    'course_id'        => self::get_product_sku($pid),
                                    'course_start'     => $course_start,
                                    'course_ends'      => $course_end,
                                    'student_id'       => $assign_student_id_value
                                ]);
                            }  
                        }
[cap] => stdClass Object
(
	// Meta capabilities

	[edit_post]		 => "edit_{$capability_type}"
	[read_post]		 => "read_{$capability_type}"
	[delete_post]		 => "delete_{$capability_type}"

	// Primitive capabilities used outside of map_meta_cap():

	[edit_posts]		 => "edit_{$capability_type}s"
	[edit_others_posts]	 => "edit_others_{$capability_type}s"
	[publish_posts]		 => "publish_{$capability_type}s"
	[read_private_posts]	 => "read_private_{$capability_type}s"

	// Primitive capabilities used within map_meta_cap():

	[read]                   => "read",
	[delete_posts]           => "delete_{$capability_type}s"
	[delete_private_posts]   => "delete_private_{$capability_type}s"
	[delete_published_posts] => "delete_published_{$capability_type}s"
	[delete_others_posts]    => "delete_others_{$capability_type}s"
	[edit_private_posts]     => "edit_private_{$capability_type}s"
	[edit_published_posts]   => "edit_published_{$capability_type}s"
	[create_posts]           => "edit_{$capability_type}s"
)
curl -v --trace out.txt http://google.com
cat out.txt
const header = document.querySelector('header');
let lastScroll = 0;
const scrollThreshold = 10; 

window.addEventListener('scroll', () => {
    const currentScroll = window.scrollY;

    if (currentScroll > lastScroll && currentScroll > scrollThreshold) {
        header.classList.add('small');
    } else if (currentScroll === 0) {
        header.classList.remove('small');
    }

    lastScroll = currentScroll;
});

const hamburger = document.querySelector(".hamburger");
const navmenu = document.querySelector(".nav-menu");

hamburger.addEventListener("click", () => {
    hamburger.classList.toggle("active");
    navmenu.classList.toggle("active");
});

document.querySelectorAll(".nav-link").forEach(n => n.addEventListener("click", () => {
    hamburger.classList.remove("active");
    navmenu.classList.remove("active");
}));
t = int(input(""))
p = 0
mylist = []
if t >= 0 and t < 101:
    while p<t:
        a = int(input("a "))
        b = int(input("b "))
        c = int(input("c "))
        if a <= 20000 and a >= 1:
            if b <= 20000 and a >=1:
                if c <= 20000 and c >=1:
                    if a+b<=c or a+c<=b or b+c<=a:
                        txt = ("nelze sestrojit")
                    else:
                        if a == b and b == c and c == a:
                            txt = ("rovnostranny")
                        elif a == b or b == c or c == a:
                            txt = ("rovnoramenny")
                        else:
                            txt = ("obecny")
                else:
                    txt = ("moc velké nebo malé číslo")
            else:
                txt = ("moc velké nebo malé číslo")
        else:
            txt = ("moc velké nebo malé číslo")
        p = p+1
        mylist.append(txt)
        print(p)
    print(mylist)
else:
    print("syntax")
def res(vys):
    for x in vys:
        print(x)
try:
    s = int(input("s "))
    p = 0
    lst = []
    if s >=1 and s <=100:
        while p<s:
            z = input("z ")
            if len(z) >= 1 and len(z) <= 50:
                try:
                    num = int(z)
                    kys = type(num) == int
                except:
                    kys = z.isupper()     
                if kys == True:
                    pal = z[::-1]
                    if z == pal:
                        txt = "yes"
                    else:
                        txt = "no"
                else:
                    txt = "syntax"
            else:
                txt = "syntax"
            p = p+1
            lst.append(txt)
            print("")
        res(lst)
    else:
        print("syntax")
except:
    print("syntax")
3. Longest Substring Without Repeating Characters


class Solution {
    public int lengthOfLongestSubstring(String s) {
        int arr[]=new int[122];
        char c[]=s.toCharArray();
        int m=0,m1=0;
        for(int i=0;i<c.length;i++){
            if(arr[c[i]]==0){
                arr[c[i]]=1;
                m++;
            } else {
                // m1=Math.max(m1,m);
                Arrays.fill(arr,0);
                m=0;i--;
            }
            m1=Math.max(m1,m);
        }
        return m1;
    }
}
Expert Answer

General Guidance

The answer provided below has been developed in a clear step by step manner.Step: 1

To print DFS of a graph:
Code in JAVA:

import java.io.*;

import java.util.*;

class Graph {

private int V; // No. of vertices

private LinkedList adj[]; //Adjacency Lists

// Constructor

Graph(int v)

{

V = v;

adj = new LinkedList[v];

for (int i = 0; i < v; ++i)

adj[i] = new LinkedList();

}

// Function to add an edge into the graph

void addEdge(int u, int v)

{

adj[u].add(v);

}

// A function used by DFS

void calc(int v, boolean vis[])

{

// Mark the current node as visited and print it

vis[v] = true;

System.out.print(v + " ");

// Recur for all the vertices adjacent to this vertex

Iterator i = adj[v].listIterator();

while (i.hasNext())

{

int n = i.next();

if (!vis[n])

calc(n, vis);

}

}

void DFS(int v)

{

// Mark all the vertices as not visited(set as false by default in java)

boolean vis[] = new boolean[V];

// Call the recursive function to print DFS traversal.

calc(v, vis);

}

public static void main(String args[])

{

Graph g = new Graph(8);

g.addEdge(0, 1);

g.addEdge(3, 2);

g.addEdge(5, 2);

g.addEdge(3, 5);

g.addEdge(3, 4);

g.addEdge(4, 6);

g.addEdge(6, 3);

g.addEdge(6, 7);

g.addEdge(7, 1);

System.out.print("DFS traversal from vertex 3 is: ");

g.DFS(3);

}

}

Input:
Vertex a = 0 Vertex b = 1
Vertex c = 2 Vertex d = 3
Vertex e = 4 Vertex f = 5
Vertex g = 6 Vertex h = 7
Output:
DFS traversal from vertex 3 is: 3 2 5 4 6 7 1
DFS is d c f e g h a
Time complexity: O(V + E)
Auxiliary Space: O(V)
Explanation:Please refer to solution in this step.Step: 2

To print BFS of a graph:
Code in JAVA:

import java.io.*;

import java.util.*;

class Graph

{

private int V; // No. of vertices

private LinkedList adj[]; //Adjacency Lists

// Constructor

Graph(int v)

{

V = v;

adj = new LinkedList[v];

for (int i=0; i
adj[i] = new LinkedList();

}

// Function to add an edge into the graph

void addEdge(int u,int v)

{

adj[u].add(v);

}

// prints BFS traversal from a given source s

void BFS(int s)

{

// Mark all the vertices as not visited(By default set as false)

boolean vis[] = new boolean[V];

// Create a queue for BFS

LinkedList q = new LinkedList();

// Mark the current node as visited and enqueue it

vis[s]=true;

q.add(s);

while (q.size() != 0)

{

// Dequeue a vertex from queue and print it

s = q.poll();

System.out.print(s+" ");

// Get all adjacent vertices of the dequeued vertex s if a adjacent has not been visited, then mark it visited and enqueue it

Iterator i = adj[s].listIterator();

while (i.hasNext())

{

int n = i.next();

if (!vis[n])

{

vis[n] = true;

q.add(n);

}

}

}

}

public static void main(String args[])

{

Graph g = new Graph(8);

g.addEdge(0, 1);

g.addEdge(3, 2);

g.addEdge(5, 2);

g.addEdge(3, 5);

g.addEdge(3, 4);

g.addEdge(4, 6);

g.addEdge(6, 3);

g.addEdge(6, 7);

g.addEdge(7, 1);

System.out.print("BFS traversal from vertex 0 is: ");

g.BFS(0);

}

}

Input:
Vertex a = 0 Vertex b = 1
Vertex c = 2 Vertex d = 3
Vertex e = 4 Vertex f = 5
Vertex g = 6 Vertex h = 7
Output:
BFS traversal from vertex 0 is: 0 1
BFS is a b Time Complexity: O(V+E)
Auxiliary Space: O(V)
Explanation:
The above code is for printing bfs(breadth first search) of a graph.

Answer:

I have added code for both DFS and BFS of a graph.
You can directly copy and paste the code in any JAVA compiler.
DFS is d c f e g h a (from node d)
BFS is a b (from node a)
Time complexity: O(V + E), where V is the number of vertices and E is the number of edges in the graph.
Auxiliary Space: O(V)
class Node {
    int key, height;
    Node left, right;
    Node(int d) {
        key = d;
        height = 1;
    }
}
class AVLTree {
    Node root;
    int height(Node N) {
        if (N == null)
            return 0;
        return N.height;
    }
    int max(int a, int b) {
        return (a > b) ? a : b;
    }
    Node rightRotate(Node y) {
        Node x = y.left;
        Node T2 = x.right;
        x.right = y;
        y.left = T2;
        y.height = max(height(y.left), height(y.right)) + 1;
        x.height = max(height(x.left), height(x.right)) + 1;
        return x;
    }
    Node leftRotate(Node x) {
        Node y = x.right;
        Node T2 = y.left;
        y.left = x;
        x.right = T2;
        x.height = max(height(x.left), height(x.right)) + 1;
        y.height = max(height(y.left), height(y.right)) + 1;
        return y;
    }
    int getBalance(Node N) {
        if (N == null)
            return 0;
        return height(N.left) - height(N.right);
    }
    Node insert(Node node, int key) {
        if (node == null)
            return (new Node(key));
        if (key < node.key)
            node.left = insert(node.left, key);
        else if (key > node.key)
            node.right = insert(node.right, key);
        else
            return node;
        node.height = 1 + max(height(node.left), height(node.right));
        int balance = getBalance(node);
        if (balance > 1 && key < node.left.key)
            return rightRotate(node);
        if (balance < -1 && key > node.right.key)
            return leftRotate(node);
        if (balance > 1 && key > node.left.key) {
            node.left = leftRotate(node.left);
            return rightRotate(node);
        }
        if (balance < -1 && key < node.right.key) {
            node.right = rightRotate(node.right);
            return leftRotate(node);
        }

        return node;
    }
    void preOrder(Node node) {
        if (node != null) {
            System.out.print(node.key + " ");
            preOrder(node.left);
            preOrder(node.right);
        }
    }
    void inOrder(Node node) {
        if (node != null) {
            inOrder(node.left);
            System.out.print(node.key + " ");
            inOrder(node.right);
        }  }
    public static void main(String[] args) {
        AVLTree tree = new AVLTree();
        int[] sequence = {3, 2, 1, 4, 5, 6, 7, 8, 9};
       for (int key : sequence) {
            tree.root = tree.insert(tree.root, key);
        }
        System.out.println("Preorder traversal of constructed AVL tree is:");
        tree.preOrder(tree.root);

        System.out.println("\nInorder traversal of constructed AVL tree is:");
        tree.inOrder(tree.root);
    }}
public class SearchAlgorithms {
    public static int linearSearch(int[] array, int target) {
        for (int i = 0; i < array.length; i++) {
            if (array[i] == target) {
                return i;
            }
        }
        return -1;
    }
    public static int binarySearch(int[] array, int target) {
        int left = 0;
        int right = array.length - 1;
        while (left <= right) {
            int mid = left + (right - left) / 2;
            if (array[mid] == target) {
                return mid;
            } else if (array[mid] < target) {
                left = mid + 1;
            } else {
                right = mid - 1;
            }
        }
        return -1;
    }
    public static void main(String[] args) {
        int[] array = {2, 5, 8, 12, 16, 23, 38, 45, 50};
        int targetLinear = 16;
        int targetBinary = 38;
        int linearResult = linearSearch(array, targetLinear);
        if (linearResult != -1) {
            System.out.println("Linear Search: Element " + targetLinear + " found at index " + linearResult);
        } else {
            System.out.println("Linear Search: Element " + targetLinear + " not found in the array");
        }
        int binaryResult = binarySearch(array, targetBinary);
        if (binaryResult != -1) {
            System.out.println("Binary Search: Element " + targetBinary + " found at index " + binaryResult);
        } else {
            System.out.println("Binary Search: Element " + targetBinary + " not found in the array");
        }
    }
}

import java.util.Iterator;
import java.util.LinkedList;

class Graph {

    private int V;
    private LinkedList<Integer>[] adj;
    Graph(int v) {
        V = v;
        adj = new LinkedList[v];
        for (int i = 0; i < v; ++i)
            adj[i] = new LinkedList<>();
    }
    void addEdge(int u, int v) {
        adj[u].add(v);
    }
    void BFS(int s) {
        boolean vis[] = new boolean[V];
        LinkedList<Integer> queue = new LinkedList<>();
        vis[s] = true;
        queue.add(s);
        while (!queue.isEmpty()) {
            s = queue.poll();
            System.out.print(s + " ");
            Iterator<Integer> i = adj[s].listIterator();
            while (i.hasNext()) {
                int n = i.next();
                if (!vis[n]) {
                    vis[n] = true;
                    queue.add(n);
                }
            }
        }
    }

    public static void main(String args[]) {
        Graph g = new Graph(8);
        g.addEdge(0, 1);
        g.addEdge(3, 2);
        g.addEdge(5, 2);
        g.addEdge(3, 5);
        g.addEdge(3, 4);
        g.addEdge(4, 6);
        g.addEdge(6, 3);
        g.addEdge(6, 7);
        g.addEdge(7, 1);

        System.out.print("BFS traversal from vertex 0 is: ");
        g.BFS(0);
    }
}

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

class Graph{
    private int V;
    private LinkedList<Integer>[] adj;
    Graph(int v) {
        V = v;
        adj = new LinkedList[v];
        for (int i = 0; i < v; ++i)
            adj[i] = new LinkedList<>();
    }
    void addEdge(int u, int v) {
        adj[u].add(v);
    }
    void calc(int v, boolean vis[]) {
        vis[v] = true;
        System.out.print(v + " ");
        Iterator<Integer> i = adj[v].listIterator();
        while (i.hasNext()) {
            int n = i.next();
            if (!vis[n])
                calc(n, vis);
        }
    }
    void DFS(int v) {
         boolean vis[] = new boolean[V];
        calc(v, vis);
    }

    public static void main(String args[]) {
        Graph g = new Graph(8);
        g.addEdge(0, 1);
        g.addEdge(3, 2);
        g.addEdge(5, 2);
        g.addEdge(3, 5);
        g.addEdge(3, 4);
        g.addEdge(4, 6);
        g.addEdge(6, 3);
        g.addEdge(6, 7);
        g.addEdge(7, 1);

        System.out.print("DFS traversal from vertex 3 is: ");
        g.DFS(3);
    }
}

 
import java.util.Hashtable;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.Map;

public class BasicHashingTechniques {

    public static void main(String[] args) {
        // HashTable-based Method (Synchronized)
        System.out.println("HashTable-based Method:");
        Hashtable<String, Integer> hashTable = new Hashtable<>();
        hashTable.put("apple", 5);
        hashTable.put("banana", 8);
        hashTable.put("orange", 3);

        for (Map.Entry<String, Integer> entry : hashTable.entrySet()) {
            System.out.println(entry.getKey() + ": " + entry.getValue());
        }

        // HashMap-based Method (Non-synchronized)
        System.out.println("\nHashMap-based Method:");
        HashMap<String, Integer> hashMap = new HashMap<>();
        hashMap.put("apple", 5);
        hashMap.put("banana", 8);
        hashMap.put("orange", 3);

        for (Map.Entry<String, Integer> entry : hashMap.entrySet()) {
            System.out.println(entry.getKey() + ": " + entry.getValue());
        }

        // LinkedHashMap-based Method (Maintains order)
        System.out.println("\nLinkedHashMap-based Method:");
        LinkedHashMap<String, Integer> linkedHashMap = new LinkedHashMap<>();
        linkedHashMap.put("apple", 5);
        linkedHashMap.put("banana", 8);
        linkedHashMap.put("orange", 3);

        for (Map.Entry<String, Integer> entry : linkedHashMap.entrySet()) {
            System.out.println(entry.getKey() + ": " + entry.getValue());
        }
    }
}

import java.awt.*;
import java.awt.event.*;
import java.applet.*;
/*<applet code="LabTask36.class" width="700" height="200"> 
</applet>*/ 
public class LabTask36 extends Applet implements ActionListener 
{ 
 String str="";
 TextField t1,t2,t3;
 Button b1,b2,b3,b4,b5;
 Label l1,l2,l3;
public void init() 
 { 
 l1=new Label("Enter 1st value:");
add(l1);
 l2=new Label("Enter 2nd value:");
add(l2);
 l3=new Label("Result: ");
add(l3);
 t1=new TextField(10);
add(t1);
   t2=new TextField(10);

add(t2);

 t3=new TextField(10);

add(t3);

 b1=new Button("add");

 b2=new Button("sub");

 b3=new Button("mul");

 b4=new Button("div");

 b5=new Button("mod");

add(b1);

add(b2);

add(b3);

add(b4);

add(b5);

l1.setBounds(50,100,100,20);

l2.setBounds(50,140,100,20);

l3.setBounds(50,180,100,20);

t1.setBounds(200,100,100,20);

t2.setBounds(200,140,100,20);

t3.setBounds(200,180,100,20);

b1.setBounds(50,250,50,20);

b2.setBounds(110,250,50,20);

b3.setBounds(170,250,50,20);

b4.setBounds(230,250,50,20);
   b5.setBounds(290,250,50,20);

b1.addActionListener(this);

b2.addActionListener(this);

b3.addActionListener(this);

b4.addActionListener(this);

b5.addActionListener(this);

setLayout(null);

setVisible(true);

setSize(400,350);

setBackground(Color.black);

setForeground(Color.white);

 } 

public void paint(){} 

public void actionPerformed(ActionEvent e) 

 { 

str=e.getActionCommand();

double a=Double.parseDouble(t1.getText());

double b= Double.parseDouble(t2.getText());

if(str=="add") 

 { 

double sum=a+b;

t3.setText(""+sum);

 } 

else if(str=="sub")
  { 

double sub=a-b;

t3.setText(""+sub);

 } 

else if(str=="mul") 

 { 

doublemul=a*b;

t3.setText(""+mul);

 } 

else if(str=="div") 

 { 

double div=a/b;

t3.setText(""+div);

 } 

else if(str=="mod") 

 { 

int x=Integer.parseInt(t1.getText());

int y=Integer.parseInt(t2.getText());

int mod=x%y;

t3.setText(""+mod);

 } 

repaint();

 } 

}
import java.applet.*; 

import java.awt.*; 

/*<applet code="LabTask35.class" width="600" height="800"> 

</applet>*/ 

public class LabTask35 extends Applet 

 { 

public void init() 

 { 

setBackground(Color.black);

setForeground(Color.yellow);

 } 

public void paint(Graphics g) 

 { 

 Font f=new Font("Arial",1,28);

g.setFont(f);

g.drawString("Folks! I'm a Laughing Baby Face",340,550);

g.drawOval(75,460,40,40);

g.fillOval(75,460,40,40);

g.drawLine(147,460,147,560); 

g.drawOval(175,460,40,40); 

g.fillOval(175,460,40,40); 

g.drawOval(20,400,260,260);
   g.drawArc(80,535,135,80,180,180);

 } 

}
import java.applet.*; 

import java.awt.*; 

/*<applet code="LabTask34.class" width="500" height="500"> 

</applet>*/ 

public class LabTask34 extends Applet 

{ 

 String str; 

public void init() 

 { 

str="Welcome to Java Applet"; 

System.out.println("Inside init method"); 

setBackground(Color.cyan); 

setForeground(Color.blue); 

 } 

public void start() 

 { 

System.out.println("Inside start method"); 

 } 

public void paint(Graphics g) 

 { 

 Font f=new Font("Arial",3,27); 

g.setFont(f);
   g.drawString(str,200,200); 
System.out.println("Inside paint method"); 
 } 
public void stop() 
 { 
System.out.println("Inside stop method"); 
 } 
public void destroy() 
 { 
System.out.println("Inside destroy method"); 
 } 
}
import java.util.*; 

public class LabTask33 

{ 

public static void main(String args[]) 

 { 

 //create a HashSet to store Strings 

HashSet<String> hs=new HashSet<String>();

 //Store some String elements 

hs.add("India");

hs.add("America"); 

hs.add("Japan");

hs.add("China"); 

hs.add("America");

 //view the HashSet 

System.out.println ("HashSet = " + hs);

 //add an Iterator to hs 

 Iterator it = hs.iterator ();

 //display element by element using Iterator 

System.out.println("Elements Using Iterator: "); 

while(it.hasNext())
  { 

 String s=(String)it.next(); 

System.out.println(s);

 } 

 //create an empty stack to contain Integer objects 

 Stack<Integer>st=new Stack<Integer>(); 

st.push(new Integer(10));

st.push(new Integer(20));

st.push(new Integer(30)); 

st.push(new Integer(40));

st.push (new Integer(50)); 

System.out.println(st);

System.out.println("Element at top of the stack is: "+st.peek()); 

System.out.println("Removing element at the TOP of the stack: "+st.pop()); 

System.out.println("The new stack is: "+st);

HashMap<Integer,String> hm=new HashMap<Integer,String>(); 

hm.put(new Integer(101),"Naresh");

hm.put(new Integer(102),"Rajesh"); 

hm.put(new Integer(103),"Suresh"); 

hm.put(new Integer(104),"Mahesh"); 

hm.put(new Integer(105),"Ramesh"); 

 Set<Integer> set=new HashSet<Integer>(); 

set=hm.keySet();
   System.out.println(set);

 } 

}
class Display 
{ 
synchronized public void wish(String name) 
{ 
for(int i=0;i<3;i++) 
{ 
System.out.println("Good morning"); 
try 
{ 
Thread.sleep(1000); 
} 
catch(InterruptedException e) 
{} 
System.out.println(name); 
} 
} 
} 
class My extends Thread 
{ 
Display d; 
String name;
  My(Display d,String name) 

{ 

this.d=d; 

this.name=name; 

} 

public void run() 

{ 

d.wish(name); 

} 

} 

class B{ public static void main(String... args) 

{ 

Display d=new Display(); 

My t=new My(d,"Sai "); 

t.start(); 

} 

}
class Sample extends Thread 
{ 
Sample() 
{ 
super(); 
start(); 
} 
public void run() 
{ 
for(int i=0;i<3;i++) 
{ 
try 
{ 
System.out.println(Thread.currentThread().getName()+" - "+i); 
Thread.sleep(1000); 
} 
catch(InterruptedException e) 
{ 
System.out.println("hii");
  } 

} 

} 

} 

class Main 

{ 

public static void main(String[] args) 

{ 

Sample t1=new Sample(); 

for(int i=0;i<3;i++) 

{ 

try 

{ 

System.out.println(Thread.currentThread().getName()+" - "+i); 

Thread.sleep(1000); 

} 

catch(InterruptedException e) 

{ 

System.out.println("hello"); 

} 

} 

} 

}
class A implements Runnable 
{ 
public void run() 
{ 
for(int i=0;i<5;i++) 
{ 
try 
{ 
Thread.sleep(500); 
System.out.println("Hello"); 
} 
catch(Exception e){} 
} 
} 
} 
class B 
{ 
public static void main(String... args) 
{ 
A x=new A();
  Thread t1=new Thread(x);

t1.start(); 

} 

} 

}
class A 

{ 

void m1()throws InterruptedException 

{ 

for(int i=0;i<5;i++) 

{ 

Thread.sleep(1000); 

System.out.println("Good Morning"); 

} 

} 

void m2()throws InterruptedException 

{ 

m1(); 

} 

public static void main(String args[])throws InterruptedException 

{ 

A x=new A(); 

x.m2(); 

} 

}
import java.util.*; 

class B extends RuntimeException 

{ 

B(String a) 

{ 

super(a); 

} 

public static void main(String... args) 

{ 

int balance=1700; 

Scanner x=new Scanner(System.in); 

System.out.print("Enter amount=");

int amount=x.nextInt(); 

if(amount>balance) 

{ 

throw new B("Invalid balance"); 

} 

else 

{ 

System.out.println("Your Amount ="+amount); 

} 

} 

}
class A 
{ 
void m1()throws InterruptedException 
{ 
System.out.println("hello"); 
} 
} 
class B extends A 
{ 
void m1()throws InterruptedException 
{ 
for(int i=0;i<5;i++) 
{ 
Thread.sleep(1000); 
System.out.println("Welcome"); 
} 
} 
public static void main(String args[]) 
{ 
B x=new B(); 
try 
{ 
x.m1(); 
}
import java.util.*; 

class Lab26 

{ 

public static void main(String args[]) 

{ 

Scanner x=new Scanner(System.in);

System.out.print("enter size=");

int size=x.nextInt();

 try 

{ 

int a[]=new int[size]; 

} 

catch(Exception e) 

{ 

System.out.println(e); 

System.out.println("array size is negative"); 

System.exit(0); 

} 

finally 

{ 

System.out.println("array size is positive"); 

} 

} }
class Lab25 
{ 
public static void main(String[] args) 
{ 
try 
{ 
int a=17/0; 
} 
catch(Exception x) 
{ 
System.out.println(x); 
} 
System.out.println("rest of the code"); 
} 
}
abstract class A 
{ 
int a=17,b=46; 
void m2() 
{ 
System.out.println("sum="+(a+b)); 
} 
} 
class B extends A 
{ 
void m1() 
{ 
System.out.println("sub="+(b-a)); 
} 
public static void main (String args[]) 
{ 
B x=new B(); 
x.m2(); 
x.m1(); 
} }
import Mypack.Lab23; 
class Circle 
{ 
public static void main(String... Y) 
{ 
Lab23 x=new Lab23(); 
x.m1(5); 
} 
} 
 
package Mypack; 
public class Lab23 
{ 
public void m1(int r) 
{ 
double pi=3.14,area; area=pi*r*r; 
System.out.print("area of circle="+area); 
} }
import pl.B; 
class ex1 
{ 
public static void main(String... Y) 
{ 
B x=new B(); 
x.m1(); 
} 
} 
package pl; 
public class B 
{ 
public void m1() 
{ 
int a=17; 
{ 
System.out.print("a value is="+a); 
} 
} }
final class A 
{ 
final int a=17; 
public static void main(String... args ) 
{ 
A x=new A(); 
x.a=46; 
} 
}
interface A 
{ 
int a=50;
} 
interface B 
{ 
int b=40;
} 
class Task20 implements A,B 
{ 
void stmt() 
{ 
System.out.println("I have Rights on both A & B");
} 
public static void main(String[] args) 
{ 
Task20 x=new Task20();
x.stmt();
System.out.println("Addition is :"+(a+b));
} 
}
class Sample 
{ 
void name() 
{ 
System.out.println("I am Sai");
} 
} 
class Task19 extends Sample 
{ 
void name() 
{ 
super.name();
System.out.println("This is Siva");
} 
public static void main(String[] args) 
{ 
Task19 t=new Task19();
t.name();
} 
}
//Method Overloading 

classMotorBike 

{ 

private String startMethod = "Kick"; 

public void start() 

 { 

System.out.println(startMethod+" starƟng...");

 } 

public void start(String method) 

 { 

this.startMethod = method; 

System.out.println(startMethod+" starƟng...");

 } 

} 

public class LabTask18a 

{ 

public staƟc void main(String args[])

 { 

MotorBike b=new MotorBike(); 

b.start(); 

b.start("Self"); 

 } 

}

//Constructor Overloading 

class LabTask18b 

{ 

 String lang; 

LabTask18b() 

 { 

this.lang="Java"; 

 } 

LabTask18b(String lang) 

 { 

this.lang=lang; 

 } 

public void getLang() 

 { 

System.out.println("Programming Langauage: "+this.lang); 

 } 

public staƟc void main(String[] args) 

 { 

 LabTask18b obj1=new LabTask18b(); 

 LabTask18b obj2=new LabTask18b("C++"); 

obj1.getLang(); 

obj2.getLang(); 

 } 

}
//Method Overloading 

classMotor Bike 

{ 

private String startMethod = "Kick"; 

public void start() 

 { 

System.out.println(startMethod+" starƟng...");

 } 

public void start(String method) 

 { 

this.startMethod = method; 

System.out.println(startMethod+" starƟng...");

 } 

} 

public class LabTask17a 

{ 

public staƟc void main(String args[])

 { 

MotorBike b=new MotorBike(); 

b.start(); 

b.start("Self"); 

 } 

}
//Method Overriding 

classMotor Bike 

{ 

public void start() 

 { 

System.out.println("Using kick paddle to start..."); 

 } 

} 

classSelfStartMotorBike extends MotorBike 

{ 

public void start() 

 { 

System.out.println("Using self start buƩon to start...");

 } 

} 

public class LabTask17b 

{ 

public staƟc void main(String args[])

 { 

SelfStartMotorBike b=new SelfStartMotorBike(); 

b.start(); 

 } 

}
class Animal 
{ 
void eat() 
{ 
System.out.println("eaƟng...");
} 
} 
class Dog extends Animal 
{ 
void bark() 
{ 
System.out.println("barking..."); 
} 
} 
Class BabyDog extends Dog 
{ 
void weep() 
{ 
System.out.println("weeping..."); 
} 
} 
public class LabTask16 
{ 
public staƟc void main(String args[])
 { 
BabyDog d=new BabyDog();
   d.weep(); 

d.bark(); 

d.eat(); 

 } 

}
class LabTask15 
{ 
int a=10;
void friend() 
{ 
System.out.println("my friends");
} 
} 
class Best extends LabTask15 
{ 
int b=20;
void bestu() 
{ 
System.out.println("My Bestie1 is Siva.");
System.out.println("My Bestie2 is Sai.");
} 
public static void main(String[] args) 
{ 
LabTask15 n1=new LabTask15();
System.out.println(n1.a);
  Best n2=new Best();

System.out.println(n2.b);

n2.bestu();

}} 

class A 

{ 

int a=10;

void read() 

{ 

System.out.println("This is read method");

} 

} 

class B extends A 

{ 

int b=20;

void add() 

{ 

System.out.println("This is addition");

} 

}
star

Mon Nov 27 2023 18:02:17 GMT+0000 (Coordinated Universal Time)

@yolobotoffender

star

Mon Nov 27 2023 17:43:58 GMT+0000 (Coordinated Universal Time)

@pag0dy

star

Mon Nov 27 2023 17:12:52 GMT+0000 (Coordinated Universal Time)

@AdomsNavicki

star

Mon Nov 27 2023 16:25:06 GMT+0000 (Coordinated Universal Time)

@AdomsNavicki

star

Mon Nov 27 2023 16:20:23 GMT+0000 (Coordinated Universal Time)

@AdomsNavicki

star

Mon Nov 27 2023 15:57:52 GMT+0000 (Coordinated Universal Time)

@AdomsNavicki

star

Mon Nov 27 2023 15:37:08 GMT+0000 (Coordinated Universal Time) https://www.moodle.tum.de/mod/quiz/attempt.php?attempt

@pimmelpammel

star

Mon Nov 27 2023 15:35:55 GMT+0000 (Coordinated Universal Time)

@AdomsNavicki

star

Mon Nov 27 2023 15:21:29 GMT+0000 (Coordinated Universal Time)

@AdomsNavicki

star

Mon Nov 27 2023 15:13:56 GMT+0000 (Coordinated Universal Time)

@AdomsNavicki

star

Mon Nov 27 2023 14:34:53 GMT+0000 (Coordinated Universal Time)

@AdomsNavicki

star

Mon Nov 27 2023 11:44:32 GMT+0000 (Coordinated Universal Time) https://medium.com/@raykipkorir/what-is-caching-caching-with-redis-in-django-a7d117adfbc5

@Utsav

star

Mon Nov 27 2023 11:41:31 GMT+0000 (Coordinated Universal Time) https://tamerlan.dev/django-caching-using-redis/

@Utsav #python

star

Mon Nov 27 2023 11:17:11 GMT+0000 (Coordinated Universal Time)

@Utsav #db

star

Mon Nov 27 2023 07:13:43 GMT+0000 (Coordinated Universal Time)

@dinovas #php

star

Mon Nov 27 2023 01:09:53 GMT+0000 (Coordinated Universal Time) https://developer.wordpress.org/reference/functions/register_post_type/

@dmsearnbit

star

Sun Nov 26 2023 21:06:05 GMT+0000 (Coordinated Universal Time)

@pag0dy

star

Sun Nov 26 2023 19:53:31 GMT+0000 (Coordinated Universal Time)

@dannyholman #css

star

Sun Nov 26 2023 18:46:33 GMT+0000 (Coordinated Universal Time)

@Matess08 #python

star

Sun Nov 26 2023 18:44:56 GMT+0000 (Coordinated Universal Time)

@Matess08 #python

star

Sun Nov 26 2023 18:03:26 GMT+0000 (Coordinated Universal Time)

@samee

star

Sun Nov 26 2023 17:46:01 GMT+0000 (Coordinated Universal Time) https://cdn.discordapp.com/attachments/1153282397740224542/1178387566370750494/Captura_de_Tela_484.png?ex=6575f5f1&is=656380f1&hm=1cebbd85971136d4f2662942d187e10fde7276dd2f562280cc9523f1210d2774&=$url

@Macaco

star

Sun Nov 26 2023 17:40:18 GMT+0000 (Coordinated Universal Time) http://exedustack.nl/why-112-million-rated-moiss-caicedo-shouldnt-leave-brighton-this-year/

@jack

star

Sun Nov 26 2023 17:37:37 GMT+0000 (Coordinated Universal Time) https://www.programiz.com/java-programming/online-compiler/

@jack

star

Sun Nov 26 2023 17:37:08 GMT+0000 (Coordinated Universal Time) https://www.programiz.com/java-programming/online-compiler/

@jack

star

Sun Nov 26 2023 17:36:42 GMT+0000 (Coordinated Universal Time) https://www.programiz.com/java-programming/online-compiler/

@jack

star

Sun Nov 26 2023 17:36:07 GMT+0000 (Coordinated Universal Time) https://www.programiz.com/java-programming/online-compiler/

@jack

star

Sun Nov 26 2023 17:33:54 GMT+0000 (Coordinated Universal Time) https://www.programiz.com/java-programming/online-compiler/

@jack

star

Sun Nov 26 2023 17:22:44 GMT+0000 (Coordinated Universal Time)

@Java

star

Sun Nov 26 2023 17:20:29 GMT+0000 (Coordinated Universal Time)

@Java

star

Sun Nov 26 2023 17:19:16 GMT+0000 (Coordinated Universal Time)

@Java

star

Sun Nov 26 2023 17:18:19 GMT+0000 (Coordinated Universal Time)

@Java

star

Sun Nov 26 2023 17:16:19 GMT+0000 (Coordinated Universal Time)

@Java

star

Sun Nov 26 2023 17:15:33 GMT+0000 (Coordinated Universal Time)

@Java

star

Sun Nov 26 2023 17:14:15 GMT+0000 (Coordinated Universal Time)

@Java

star

Sun Nov 26 2023 17:13:21 GMT+0000 (Coordinated Universal Time)

@Java

star

Sun Nov 26 2023 17:12:43 GMT+0000 (Coordinated Universal Time)

@Java

star

Sun Nov 26 2023 17:11:58 GMT+0000 (Coordinated Universal Time)

@Java

star

Sun Nov 26 2023 17:11:09 GMT+0000 (Coordinated Universal Time)

@Java

star

Sun Nov 26 2023 17:10:20 GMT+0000 (Coordinated Universal Time)

@Java

star

Sun Nov 26 2023 17:09:42 GMT+0000 (Coordinated Universal Time)

@Java

star

Sun Nov 26 2023 17:09:03 GMT+0000 (Coordinated Universal Time)

@Java

star

Sun Nov 26 2023 17:08:27 GMT+0000 (Coordinated Universal Time)

@Java

star

Sun Nov 26 2023 17:07:44 GMT+0000 (Coordinated Universal Time)

@Java

star

Sun Nov 26 2023 17:07:15 GMT+0000 (Coordinated Universal Time)

@Java

star

Sun Nov 26 2023 17:06:34 GMT+0000 (Coordinated Universal Time)

@Java

star

Sun Nov 26 2023 17:06:03 GMT+0000 (Coordinated Universal Time)

@Java

star

Sun Nov 26 2023 17:04:48 GMT+0000 (Coordinated Universal Time)

@Java

star

Sun Nov 26 2023 17:03:31 GMT+0000 (Coordinated Universal Time)

@Java

star

Sun Nov 26 2023 17:02:33 GMT+0000 (Coordinated Universal Time)

@Java

Save snippets that work with our extensions

Available in the Chrome Web Store Get Firefox Add-on Get VS Code extension