Snippets Collections
Get-Help
   [[-Name] <String>]
   [-Path <String>]
   [-Category <String[]>]
   [-Component <String[]>]
   [-Functionality <String[]>]
   [-Role <String[]>]
   -ShowWindow
   [<CommonParameters>]
// Ensure object exists
currentAccount ||= {};

// Ensure movementsDates exists if currentAccount already has it defined
currentAccount.movementsDates ||= [];

// Add the current date in ISO format to the movementsDates array
currentAccount.movementsDates.push(new Date().toISOString());

console.log(currentAccount.movementsDates);
$category = CategoryModel::query()->whereJsonContains('slug->' . app()->getLocale(), $category)->first();
dd($category->toArray());
'policy' => Rule::requiredIf(function ()  {
                return request()->status == 1 && request()->is_single == 1;
            }),



  public function messages()
    {
        return [
            'policy.required' => 'Please select Policy if you select "Single" Option',
        ];
    }
dependencies:
  dartz: ^0.10.1
class Animal {

    // Method in the superclass

    void sound() {

        System.out.println("Animal makes a sound");

    }

}

class Dog extends Animal {

    // Overriding the sound method in the subclass

    @Override

    void sound() {

        System.out.println("Dog barks");

    }

}

class Cat extends Animal {

    // Overriding the sound method in the subclass

    @Override

    void sound() {

        System.out.println("Cat meows");

    }

}

public class Main {

    public static void main(String[] args) {

        Animal myDog = new Dog();

        Animal myCat = new Cat();

        myDog.sound(); // Outputs: Dog barks

        myCat.sound(); // Outputs: Cat meows

    }

}

<!DOCTYPE html>
<html>
 <head>
   <meta charset="UTF-8">
   <meta name="viewport" content="width=device-width, initial-scale=1.0">
   <title>My Mobile-First Approach</title>
   <style>
     /* Default styles for mobile */
     .grid-container-flex {
       display: flex;
       flex-direction: column;
       background-color: purple;
       font-size: 0.9rem;
       color: white;
       margin-top: 1rem;
       height: 9em;
     }

     .grid-container-grid {
       display: grid;
       grid-template-columns: 20em;
       height: 8em;
       font-size: 1.1rem;
     }

     /* Media query for tablets */
     @media (min-width: 768px) {
       .grid-container-flex {
         font-size: 1.3rem;
       }

       .grid-container-grid {
         grid-template-columns: none;
         height: 10em;
       }
     }

     /* Media query for desktops */
     @media (min-width: 1024px) {
       .grid-container-flex {
         font-size: 2rem;
       }

       .grid-container-grid {
         grid-template-columns: none;
         height: 12em;
       }
     }
   </style>
 </head>
 <body>
   <header>
     <h1>My Mobile-First Approach HTML Structuring</h1>
     <nav>
       <a href="">Home</a>
       <a href="">Shop</a>
       <a href="">Contact</a>
       <a href="">Store</a>
     </nav>
   </header>

   <main>
     <section class="grid-container-flex">
       <h2>About Us</h2>
       <p>We work with skilled artisans and select premium materials to craft footwear that stands the test of time</p>
     </section>

     <section class="grid-container-grid">
       <h2>Our Products</h2>
       <ul>
         <li>Men's shoes</li>
         <li>Women's Shoes</li>
         <li>Kid's Shoes</li>
       </ul>
     </section>

     <section>
       <h2>Contact Us</h2>
       <form>
         <label for="name">Name:</label>
         <input type="text" id="name" name="name">

         <label for="email">Email:</label>
         <input type="email" id="email" name="email">

         <label for="message">Message:</label>
         <textarea id="message" name="message"></textarea>

         <input type="submit" value="Send Message">
       </form>
     </section>
   </main>

   <footer>
     <p>&copy; 2023 My Mobile-First Approach Example. All rights reserved.</p>
   </footer>
 </body>
</html>
public class SumAvg {
    public static void main(String[] args) {
        int[] array = {1, 2, 3, 4, 5, 6};
        int sum = 0;
        
        for (int i = 0; i < array.length; i++) {
            sum += array[i];
        }
        
        double avg = (double) sum / array.length;
        
        System.out.println("Sum: " + sum);
        System.out.println("Average: " + avg);
    }
}
public class Command {
    public static void main(String[] args) {
        if (args.length > 0) {
            // Loop through each command-line argument
            for (int i = 0; i < args.length; i++) {
                // Print each argument along with its length
                System.out.println(args[i] + " " + args[i].length());
            }

            // Print the total number of arguments
            System.out.println("Total number of arguments: " + args.length);
        }
    }
}
// Custom exception class extending Exception

class CustomException extends Exception {

    public CustomException(String message) {

        super(message);

    }

}

// Custom error class extending Error

class CustomError extends Error {

    public CustomError(String message) {

        super(message);

    }

}

public class ThrowableAndExceptionDemo {

    public static void main(String[] args) {

        try {

            // Triggering custom exception

            triggerCustomException();

        } catch (CustomException e) {

            System.out.println("Caught custom exception: " + e.getMessage());

        } catch (Exception e) {

            System.out.println("Caught general exception: " + e.getMessage());

        }

        try {

            // Triggering custom error

            triggerCustomError();

        } catch (CustomError e) {

            System.out.println("Caught custom error: " + e.getMessage());

        } catch (Error e) {

            System.out.println("Caught general error: " + e.getMessage());

        }

        System.out.println("Program completed.");

    }

    // Method to trigger custom exception

    public static void triggerCustomException() throws CustomException {

        throw new CustomException("This is a custom exception.");

    }

    // Method to trigger custom error

    public static void triggerCustomError() {

        throw new CustomError("This is a custom error.");

    }

}

public class String_Builder {
    public static void main(String[] args) {
        StringBuilder s = new StringBuilder("hellooooooo");
        System.out.println(s);

        // Deleting characters from index 0 to 2 (exclusive)
        System.out.println(s.delete(0, 3));

        // Deleting the character at index 5
        System.out.println(s.deleteCharAt(5));

        // Inserting "Raghu" at index 3
        System.out.println(s.insert(3, "Varshith"));

        // Printing the length of the StringBuilder
        System.out.println(s.length());

        // Finding the last index of the string "oo"
        System.out.println(s.lastIndexOf("oo"));
    }
}
public class StringMethodsExample {
    public static void main(String[] args) {
        String str = "Hello, World!";

        // Length of the string
        int length = str.length();
        System.out.println("Length of the string: " + length);

        // Concatenation
        String newStr = str.concat(" How are you?");
        System.out.println("Concatenated string: " + newStr);

        // Substring
        String substring = str.substring(7);
        System.out.println("Substring from index 7: " + substring);

        // Character at a specific index
        char charAtIndex = str.charAt(0);
        System.out.println("Character at index 0: " + charAtIndex);

        // Index of a specific character
        int indexOfComma = str.indexOf(",");
        System.out.println("Index of comma: " + indexOfComma);

        // Conversion to lowercase and uppercase
        String lowercase = str.toLowerCase();
        String uppercase = str.toUpperCase();
        System.out.println("Lowercase: " + lowercase);
        System.out.println("Uppercase: " + uppercase);

        // Checking for presence of a substring
        boolean containsHello = str.contains("Hello");
        System.out.println("Contains 'Hello': " + containsHello);

        // Removing leading and trailing whitespaces
        String stringWithSpaces = "   Trim me   ";
        String trimmedString = stringWithSpaces.trim();
        System.out.println("Trimmed string: " + trimmedString);
    }
}
public class Student
{
	private String name;
	private String rollno;
	private int age;
	
	//Constructor
	public Student(String name,String rollno,int age)
	{
		this.name=name;
		this.rollno=rollno;
		this.age=age;
	}
	
	//Method
	public void display()
	{
		System.out.println("Name: "+this.name);
		System.out.println("Roll No: "+this.rollno);
		System.out.println("Age: "+this.age);
		
	}	
}
////////////////////////////////////////////////////////////////
public class StudentTest
{
	public static void main(String[] args)
	{
		Student s1= new Student("John","A100",22);
		Student s2= new Student("Abhi","5S0",18);
		
		s1.display();
		s2.display();
	}
}
public class MyMath{
    public static int add(int a, int b){
        return a+b;
    }
    public static double add(double a, double b){
        return a+b;

    }
    public static long add(long a,long b){
        return a+b;

    }
    public static float add(float a,float b){
        return a+b;
    }

}

///

public class MyMathTest{
    public static void main(String[] args){
        System.out.println(MyMath.add(1,2));
        System.out.println(MyMath.add(1234L,1432L));
        System.out.println(MyMath.add(1.27,24.8));
        System.out.println(MyMath.add(1.23F,1.45F));

    }
}
public class ExceptionHandlingDemo {

    public static void main(String[] args) {

        try {

            // Attempt to divide by zero

            int result = divide(10, 0);

            System.out.println("Result: " + result);

        } catch (ArithmeticException e) {

            // This block will execute when an ArithmeticException is caught

            System.out.println("Error: Division by zero is not allowed.");

        } finally {

            // This block will always execute

            System.out.println("This is the finally block, it always executes.");

        }

        try {

            // Attempt to access an invalid array index

            int[] array = {1, 2, 3};

            System.out.println("Array element: " + array[5]);

        } catch (ArrayIndexOutOfBoundsException e) {

            // This block will execute when an ArrayIndexOutOfBoundsException is caught

            System.out.println("Error: Array index out of bounds.");

        } finally {

            // This block will always execute

            System.out.println("This is the finally block for array access, it always executes.");

        }

        try {

            // Manually throwing an exception

            throwException();

        } catch (Exception e) {

            // This block will execute when a general Exception is caught

            System.out.println("Caught an exception: " + e.getMessage());

        } finally {

            // This block will always execute

            System.out.println("This is the finally block for throwException, it always executes.");

        }

    }

    // Method to demonstrate exception handling

    public static int divide(int a, int b) throws ArithmeticException {

        return a / b;

    }

    // Method to demonstrate manually throwing an exception

    public static void throwException() throws Exception {

        throw new Exception("This is a manually thrown exception.");

    }

}

public class StringBuilderDemo {

    public static void main(String[] args) {

        // Creating a StringBuilder object

        StringBuilder sb = new StringBuilder("Hello");

        // 1. append()

        sb.append(" World");

        System.out.println("After append: " + sb);

        // 2. insert()

        sb.insert(5, ",");

        System.out.println("After insert: " + sb);

        // 3. replace()

        sb.replace(5, 6, "!");

        System.out.println("After replace: " + sb);

        // 4. delete()

        sb.delete(5, 6);

        System.out.println("After delete: " + sb);

        // 5. deleteCharAt()

        sb.deleteCharAt(5);

        System.out.println("After deleteCharAt: " + sb);

        // 6. reverse()

        sb.reverse();

        System.out.println("After reverse: " + sb);

        

        // Reversing back to original for further operations

        sb.reverse();

        // 7. setCharAt()

        sb.setCharAt(5, '-');

        System.out.println("After setCharAt: " + sb);

        // 8. substring()

        String subStr = sb.substring(0, 5);

        System.out.println("Substring (0, 5): " + subStr);

        // 9. length()

        int length = sb.length();

        System.out.println("Length of StringBuilder: " + length);

        // 10. capacity()

        int capacity = sb.capacity();

        System.out.println("Capacity of StringBuilder: " + capacity);

        // Additional methods for better understanding

        // Ensure Capacity

        sb.ensureCapacity(50);

        System.out.println("New Capacity after ensureCapacity(50): " + sb.capacity());

        // Trim to Size

        sb.trimToSize();

        System.out.println("Capacity after trimToSize: " + sb.capacity());

    }

}
public class StringBufferDemo {

    public static void main(String[] args) {

        // Creating a StringBuffer object

        StringBuffer sb = new StringBuffer("Hello");

        // 1. append()

        sb.append(" World");

        System.out.println("After append: " + sb);

        // 2. insert()

        sb.insert(5, ",");

        System.out.println("After insert: " + sb);

        // 3. replace()

        sb.replace(5, 6, "!");

        System.out.println("After replace: " + sb);

        // 4. delete()

        sb.delete(5, 6);

        System.out.println("After delete: " + sb);

        // 5. deleteCharAt()

        sb.deleteCharAt(5);

        System.out.println("After deleteCharAt: " + sb);

        // 6. reverse()

        sb.reverse();

        System.out.println("After reverse: " + sb);

        

        // Reversing back to original for further operations

        sb.reverse();

        // 7. setCharAt()

        sb.setCharAt(5, '-');

        System.out.println("After setCharAt: " + sb);

        // 8. substring()

        String subStr = sb.substring(0, 5);

        System.out.println("Substring (0, 5): " + subStr);

        // 9. length()

        int length = sb.length();

        System.out.println("Length of StringBuffer: " + length);

        // 10. capacity()

        int capacity = sb.capacity();

        System.out.println("Capacity of StringBuffer: " + capacity);

        // Additional methods for better understanding

        // Ensure Capacity

        sb.ensureCapacity(50);

        System.out.println("New Capacity after ensureCapacity(50): " + sb.capacity());

        // Trim to Size

        sb.trimToSize();

        System.out.println("Capacity after trimToSize: " + sb.capacity());

    }

}
//Producer-Consumer Inter-thread communication

//Table.java 

public class Table
{
	private String obj;
	private boolean empty = true;
	 
	public synchronized void put(String obj)
	{  
	   if(!empty)
	    {   try
		    {  wait();
			}catch(InterruptedException e)
			{ e.printStackTrace(); }
		}
				
		this.obj = obj; 
		empty = false;
		System.out.println(Thread.currentThread().getName()+" has put "+obj);
		notify();
		
	}
	
	public synchronized void get()
	{   
	    if(empty)
	    {   try
		    {   wait();
			}catch(InterruptedException e)
			{ e.printStackTrace(); }
		}
		
		empty = true;
		System.out.println(Thread.currentThread().getName()+" has got "+obj);
		notify();		
	}
	
	public static void main(String[] args)
	{
		Table table = new Table();
		
		Runnable p = new Producer(table);
		Runnable c = new Consumer(table);
		
		Thread pthread = new Thread(p, "Producer");
		Thread cthread = new Thread(c, "Consumer");
		
		pthread.start(); cthread.start();
		
		try{ pthread.join(); cthread.join(); }
		catch(InterruptedException e){ e.printStackTrace(); }
	}
}

/////////////Producer.java

public class Producer implements Runnable
{   private Table table;

	public Producer(Table table)
	{ this.table = table; }
	
	public void run()
	{   java.util.Scanner scanner = new java.util.Scanner(System.in);
		for(int i=1; i <= 5; i++)
		{   System.out.println("Enter text: ");
	        table.put(scanner.next());	
            try{ Thread.sleep(1000); }	
			catch(InterruptedException e){ e.printStackTrace(); }		
		}
	}
}

///////////Consumer.java

public class Consumer implements Runnable
{   
	private Table table;

	public Consumer(Table table)
	{ this.table = table; }
	
	public void run()
	{   for(int i=1; i <= 5; i++){ 
			table.get();
		}
		
	}
}

import java.io.*;
public class OutputStreamDemo{
	public static void main(String[] args){
		FileInputStream fis = null;
		FileOutputStream fos = null;
		try{
			fis = new FileInputStream("input.txt");
			fos = new FileOutputStream("output.txt");
			System.out.println("Available data "+fis.available()+" data");
			int c = fis.read();
			while(c!=-1){
				fos.write((char)c);
				c = fis.read();
			}
		}
		catch(IOException ie){
			ie.printStackTrace();
		}
		finally{
			try{
				if(fis!=null)
					fis.close();
			}
			catch(IOException ie){
				ie.printStackTrace();
			}                                    
			try{
				if(fos!=null)
					fos.close();
			}
			catch(IOException ie){
				ie.printStackTrace();
			}
		}
	}
}
import java.io.*;

public class InputStreamDemo{
	public static void main(String[] args){
	FileInputStream fis = null;
	try{
		fis = new FileInputStream("InputStreamDemo.java");
		System.out.println("Available data: "+fis.available()+" bytes");
		int c = fis.read();
		while(c!=-1){
			System.out.println((char)c);
			c = fis.read();
		}
	}
	catch(IOException ie){
		ie.printStackTrace();
	}
	finally{
		try{
			if(fis!=null)
				fis.close();
		}
		catch(IOException ie){
			ie.printStackTrace();
		}
	}
	}
}
Producer-Consumer Inter-thread communication

Table.java 

public class Table
{
	private String obj;
	private boolean empty = true;
	 
	public synchronized void put(String obj)
	{  
	   if(!empty)
	    {   try
		    {  wait();
			}catch(InterruptedException e)
			{ e.printStackTrace(); }
		}
				
		this.obj = obj; 
		empty = false;
		System.out.println(Thread.currentThread().getName()+" has put "+obj);
		notify();
		
	}
	
	public synchronized void get()
	{   
	    if(empty)
	    {   try
		    {   wait();
			}catch(InterruptedException e)
			{ e.printStackTrace(); }
		}
		
		empty = true;
		System.out.println(Thread.currentThread().getName()+" has got "+obj);
		notify();		
	}
	
	public static void main(String[] args)
	{
		Table table = new Table();
		
		Runnable p = new Producer(table);
		Runnable c = new Consumer(table);
		
		Thread pthread = new Thread(p, "Producer");
		Thread cthread = new Thread(c, "Consumer");
		
		pthread.start(); cthread.start();
		
		try{ pthread.join(); cthread.join(); }
		catch(InterruptedException e){ e.printStackTrace(); }
	}
}

Producer.java

public class Producer implements Runnable
{   private Table table;

	public Producer(Table table)
	{ this.table = table; }
	
	public void run()
	{   java.util.Scanner scanner = new java.util.Scanner(System.in);
		for(int i=1; i <= 5; i++)
		{   System.out.println("Enter text: ");
	        table.put(scanner.next());	
            try{ Thread.sleep(1000); }	
			catch(InterruptedException e){ e.printStackTrace(); }		
		}
	}
}

Consumer.java

public class Consumer implements Runnable
{   
	private Table table;

	public Consumer(Table table)
	{ this.table = table; }
	
	public void run()
	{   for(int i=1; i <= 5; i++){ 
			table.get();
		}
		
	}
}

Inter-thread Synchronization example

Users.java


public class Users implements Runnable
{   private Account ac;
    
    public Users(Account ac)
    { this.ac = ac; }
	
    public void run()
    {   
        Thread t = Thread.currentThread();
         
        String name = t.getName();
		for(int i=1; i<=5; i++)
		{
			if (name.equals("John"))
			{  ac.deposit(200); } 
			if (name.equals("Mary"))
			{  ac.withdraw(200); }
		}
    }
}

Account.java

public class Account 
{   private double balance;
    
    public Account(double startBalance)
    { this.balance = startBalance; }
    	
    public   synchronized   void deposit(double amount)
    { Thread t = Thread.currentThread();
	  double bal = this.getBalance(); bal += amount;
	  try{ Thread.sleep(1000); }
      catch(InterruptedException ie)
      { ie.printStackTrace();  }
	  this.balance = bal;
	  System.out.println(t.getName() + " has deposited "+amount); }

    public  synchronized void withdraw(double amount)
    {   Thread t = Thread.currentThread();
        if (this.getBalance()>=amount)
        {   try{ Thread.sleep(1000); }
            catch(InterruptedException ie)
            { ie.printStackTrace();  }
            this.balance -= amount;
            System.out.println(t.getName() + " has withdrawn "+amount);
        }         
    }

    public double getBalance() {   return this.balance; }
}



AcTest.java

public class AcTest
{
    public static void main(String[] args)
    {
        Account a = new Account(5000);
        System.out.println("Current balance: "+a.getBalance());

        Runnable john = new Users(a); Runnable mary = new Users(a);

        Thread t1 = new Thread(john,"John");  Thread t2 = new Thread(mary,"Mary");
        t1.start(); t2.start();
        try{
            t1.join(); t2.join();
        }catch(InterruptedException ie)
        { ie.printStackTrace(); 
        }
        System.out.println("Current balance: "+a.getBalance());
    }
}

Synchronization another example     

Sync.java

public class Sync implements Runnable
{   private Display d;
    private String message;
	public Sync(Display d, String message)
	{ this.d = d; this.message = message; }
	
	public void run()
	{  synchronized(d)
         {      // or syncronize the show method
			d.show(this.message); 
	   }
	}
	
	public static void main(String[] args)
	{   Display d = new Display();
		Runnable r1 = new Sync(d, "First Message");  Runnable r2 = new Sync(d, "Second Message");
		Runnable r3 = new Sync(d, "Third message");
		Thread t1 = new Thread(r1); Thread t2 = new Thread(r2); Thread t3 = new Thread(r3);
		t1.start(); t2.start();t3.start();
	}
}





class Display
{    // 	public synchronized void show(String message)
	public void show(String message)   
	{
		System.out.print("{ " + message);
		try{  Thread.sleep(500); }
		catch(InterruptedException e){ e.printStackTrace(); }
		System.out.println(" }");
	}
	
}
Serialization program with 3 files

import java.io.*;

public class Student implements Serializable
{
	private int id;
	private String name;
	private double percentage;
	
	// use transient and static variables to check if they are saved
	
	public Student(int id, String name, double percentage)
	{
		this.id = id;
		this.name = name;
		this.percentage = percentage;
	}
	
	public String toString()
	{
		return "ID: "+this.id+", Name: "+this.name+", Percentage: "+this.percentage;
	}
}





import java.io.*;

public class SerializationDemo
{
	public static void main(String[] args)
	{
		try(FileOutputStream fos = new FileOutputStream("serial.txt");
		    ObjectOutputStream out = new ObjectOutputStream(fos);
		   )
		   {   System.out.println("Creating a student");
			   Student s = new Student(100, "John", 98.56);
			   System.out.println(s);
			   out.writeObject(s);
			   System.out.println("Object serialized");
		   }
		   catch(FileNotFoundException fe){ fe.printStackTrace();}
		   catch(IOException ie){ ie.printStackTrace(); }
	}
}

import java.io.*;

public class DeserializationDemo
{
	public static void main(String[] args)
	{
		try(FileInputStream fis = new FileInputStream("serial.txt");
		    ObjectInputStream in = new ObjectInputStream(fis);
		   )
		   {   System.out.println("Restoring the object");
			   Student s = (Student)in.readObject();
			   System.out.println(s);
			   System.out.println("Deserialization Done");
		   }
		   catch(ClassNotFoundException ce){ ce.printStackTrace();}
		   catch(IOException ie){ ie.printStackTrace(); }
	}
}
import java.io.*;

public class DirList
{
	public static void main(String[] args)
	{	File f = new File(args[0]);
		if(f.isDirectory())
		{	String[] files = f.list();
			for(String each: files)
				System.out.println(each);
		}
		File f1 = new File(f,"/sub");
		f1.mkdir();
	}
}

import java.io.*;

public class ConsoleDemo
{
	public static void main(String[] args)
	{   		 
		Console c = System.console();
		if(c == null)
			return;
		String s = c.readLine("Enter a String: ");
		char[] p = c.readPassword("Enter a Password: ");
		String pw = String.valueOf(p);
		System.out.println("Entered Details: "+s+", "+pw);
	}
}
import java.io.*;

public class FileDemo
{
	public static void main(String[] args)
	{
		File f = new File("sample.txt");
		
		System.out.println("File name: "+f.getName());
		System.out.println("Path: "+f.getPath());
		System.out.println("Absolute path: "+f.getAbsolutePath());
		System.out.println("Parent: "+f.getParent());
		System.out.println("Exists? "+f.exists());
		System.out.println("Writable? "+f.canWrite());
		System.out.println("Readable? "+f.canRead());
		System.out.println("Directory? "+f.isDirectory());
		System.out.println("File? "+f.isFile());
		System.out.println("Last modified: "+f.lastModified());
		System.out.println("Length: "+f.length()+" bytes");
		
		//File r = new File("Newsample.txt");
		//System.out.println("Renamed? "+f.renameTo(r));
		/* the delete() method is used to delete a file or an empty directory*/ 
		
		//f.delete();
      	// other methods
		System.out.println("Free space: "+f.getFreeSpace());
		System.out.println("Total space: "+f.getTotalSpace());
		System.out.println("Usable space: "+f.getUsableSpace());
		System.out.println("Read-only: "+f.setReadOnly());
		
		
	}
}
import java.io.*;

public class BufferedReaderDemo
{
	public static void main(String[] args)
	{   
		try(FileReader fis = new FileReader("BufferedReaderDemo.java");
		    BufferedReader bis = new BufferedReader(fis);
		   )
		{  int c;
		   while((c=bis.read()) != -1)
		   { System.out.print((char)c);
		   }
		}
		catch(IOException ie){ ie.printStackTrace();}
	}
}

import java.io.*;

public class BufferedWriterDemo
{
	public static void main(String[] args)
	{   
		try(FileReader fr = new FileReader("BufferedWriterDemo.java");
		    BufferedReader br = new BufferedReader(fr);
			FileWriter fw = new FileWriter("target.txt");
			BufferedWriter bw = new BufferedWriter(fw);
		   )
		{  int c;
		   while((c=br.read()) != -1)
		   { bw.write((char)c);
		   }
		   
		}
		catch(IOException ie)
		{ ie.printStackTrace();}
	}
}
<a href="https://maticz.com/medicine-delivery-app-development">Medicince Delivery App Development Company</a>
kubectl port-forward "service/rabbitmq-1-rabbitmq-svc" 15672 -n rabbitmq
import java.io.*;

public class CharArrayReaderDemo
{
	public static void main(String[] args)
	{
		String s = "abcdefghijklmnopqrstuvwxyz";
		char[] c = new char[s.length()];
		s.getChars(0, s.length(), c, 0);
		
		try(CharArrayReader car = new CharArrayReader(c))
		{	int i;
			while((i = car.read()) != -1)
				System.out.print((char)i);
		}		catch(IOException ie){ ie.printStackTrace(); }
	}
}
import java.io.*;

public class CharArrayWriterDemo
{
	public static void main(String[] args)
	{
		String s = "abcdefghijklmnopqrstuvwxyz";
		
		CharArrayWriter bas = new CharArrayWriter();
		char[] a = new char[s.length()];
		s.getChars(0, s.length(), a, 0);
		
		try{ bas.write(a); }
		catch(IOException ie){ ie.printStackTrace(); }
				  
		char[] b = bas.toCharArray();
		for(int c: b)
			System.out.print((char)c);
		System.out.println();
	}
}
import java.io.*;

public class FileReaderDemo
{
	public static void main(String[] args)
	{
		try(FileReader fr = new FileReader("FileReaderDemo.java"))
		{
			int c;
			while((c=fr.read())!= -1)
				System.out.print((char)c);
		}
		catch(IOException ie){ ie.printStackTrace(); }
	}
}

import java.io.*;

public class FileWriterDemo
{
	public static void main(String[] args)
	{
		try(FileReader fr = new FileReader("FileWriterDemo.java");
		    FileWriter fw = new FileWriter("Test2.dat");
		)
		{
			int c;
			while((c=fr.read())!= -1)
				fw.write((char)c);
		}
		catch(IOException ie){ ie.printStackTrace(); }
	}
}
import java.io.*;

public class ByteArrayInputStreamDemo
{
	public static void main(String[] args)
	{
		String s = "abcdefghijklmnopqrstuvwxyz";
		byte[] b = s.getBytes();
		ByteArrayInputStream bas = new ByteArrayInputStream(b);
		for(int i=0; i<2;i++)
		{
			int c;
			while((c=bas.read()) != -1)
			{
				if(i==0)
					System.out.print((char)c);
				else
					System.out.print(Character.toUpperCase((char)c));
			}
			System.out.println();
			bas.reset();
		}
	}
}
import java.io.*;

public class ByteArrayOutputStreamDemo
{
	public static void main(String[] args)
	{
		String s = "abcdefghijklmnopqrstuvwxyz";
		
		ByteArrayOutputStream bas = new ByteArrayOutputStream();
		bas.writeBytes(s.getBytes()); 
		  
		byte[] b = bas.toByteArray();
		for(int c: b)
			System.out.print((char)c);
		System.out.println();
	}
}
import java.io.*;

public class BufferedOutputStreamDemo
{
	public static void main(String[] args)
	{   
		try(FileInputStream fis = 
                     new FileInputStream("BufferedInputStreamDemo.java");
		    BufferedInputStream bis = new BufferedInputStream(fis);
			FileOutputStream fos = new FileOutputStream("target.txt");
			BufferedOutputStream bos = new BufferedOutputStream(fos);
		   )
		{  int c;
		   while((c=bis.read()) != -1)
		   { bos.write((char)c);
		   }
		   
		}
		catch(IOException ie)
		{ ie.printStackTrace();}
	}
}
import java.io.*;

public class BufferedInputStreamDemo
{
	public static void main(String[] args)
	{   
		try(FileInputStream fis = 
                        new FileInputStream("BufferedInputStreamDemo.java");
		    BufferedInputStream bis = new BufferedInputStream(fis);
		   )
		{  int c;
		   while((c=bis.read()) != -1)
		   { System.out.print((char)c);
		   }
		   
		}
		catch(IOException ie)
		{ ie.printStackTrace();}
	}
}
<a href=”https://maticz.com/cryptocurrency-payment-gateway-development”>Crypto Payment Gateway Development</a>
import java.io.*;

public class FileOutputStreamDemo
{
	public static void main(String[] args)
	{   FileOutputStream fos = null;
	    FileInputStream  fis = null;
	    try{
			fis = new FileInputStream("FileOutputStreamDemo.java");
			fos = new FileOutputStream("out.txt");
			
			int c = fis.read();
			while(c != -1)
			{   fos.write((char)c);
				c = fis.read();
			}
		}
		catch(IOException ie)
		{ ie.printStackTrace(); }
		finally
		{   try 
			{    if(fis != null)
					fis.close();
			}catch(IOException ie){ ie.printStackTrace(); }
			try 
			{    if(fos != null)
					fos.close();
			}catch(IOException ie){ ie.printStackTrace(); } 
		}		
	}
}

import java.io.*;

public class FileOutputStreamDemo2
{
	public static void main(String[] args)
	{   
	    try(FileInputStream fis = 
                           new FileInputStream("FileOutputStreamDemo2.java");
	        FileOutputStream  fos = new FileOutputStream("out2.txt", true);
		   )
		{   int c = fis.read();
			while(c != -1)
			{   fos.write((char)c);
				c = fis.read();
			}
		}
		catch(IOException ie)	{ ie.printStackTrace(); }
	}
}
import java.io.*;

public class FileInputStreamDemo
{
	public static void main(String[] args)
	{   FileInputStream fis = null;
	    try{
			fis = new FileInputStream("FileInputStreamDemo.java");
			System.out.println("Available data: "+fis.available()+
                                   " bytes.");
			int c = fis.read();
			while(c != -1)
			{   System.out.print((char)c);
				c = fis.read();
			}
		}
		catch(IOException ie)
		{ ie.printStackTrace(); }
		finally{
			try
			{   if(fis != null)
					fis.close();
			}
			catch(IOException ie)
			{ ie.printStackTrace(); }
		}		
	}
}


import java.io.*;

public class FileInputStreamDemo2
{
	public static void main(String[] args)
	{   // try-with-resources statement  
	    try(FileInputStream fis = 
                   new FileInputStream("FileInputStreamDemo2.java"))
		{
			System.out.println("Available data: "+fis.available()+
                                   " bytes.");
			int c;
			while((c = fis.read()) != -1)
			{   System.out.print((char)c);
				//c = fis.read();
			}
		}
		catch(IOException ie)
		{ ie.printStackTrace(); }
	}
}
import java.io.*;

public class FileOutputStreamDemo
{
	public static void main(String[] args)
	{   FileOutputStream fos = null;
	    FileInputStream  fis = null;
	    try{
			fis = new FileInputStream("FileOutputStreamDemo.java");
			fos = new FileOutputStream("out.txt");
			
			int c = fis.read();
			while(c != -1)
			{   fos.write((char)c);
				c = fis.read();
			}
		}
		catch(IOException ie)
		{ ie.printStackTrace(); }
		finally
		{   try 
			{    if(fis != null)
					fis.close();
			}catch(IOException ie){ ie.printStackTrace(); }
			try 
			{    if(fos != null)
					fos.close();
			}catch(IOException ie){ ie.printStackTrace(); } 
		}		
	}
}

import java.io.*;

public class FileOutputStreamDemo2
{
	public static void main(String[] args)
	{   
	    try(FileInputStream fis = 
                           new FileInputStream("FileOutputStreamDemo2.java");
	        FileOutputStream  fos = new FileOutputStream("out2.txt", true);
		   )
		{   int c = fis.read();
			while(c != -1)
			{   fos.write((char)c);
				c = fis.read();
			}
		}
		catch(IOException ie)	{ ie.printStackTrace(); }
	}
}
import java.io.*;

public class FileInputStreamDemo
{
	public static void main(String[] args)
	{   FileInputStream fis = null;
	    try{
			fis = new FileInputStream("FileInputStreamDemo.java");
			System.out.println("Available data: "+fis.available()+
                                   " bytes.");
			int c = fis.read();
			while(c != -1)
			{   System.out.print((char)c);
				c = fis.read();
			}
		}
		catch(IOException ie)
		{ ie.printStackTrace(); }
		finally{
			try
			{   if(fis != null)
					fis.close();
			}
			catch(IOException ie)
			{ ie.printStackTrace(); }
		}		
	}
}


import java.io.*;

public class FileInputStreamDemo2
{
	public static void main(String[] args)
	{   // try-with-resources statement  
	    try(FileInputStream fis = 
                   new FileInputStream("FileInputStreamDemo2.java"))
		{
			System.out.println("Available data: "+fis.available()+
                                   " bytes.");
			int c;
			while((c = fis.read()) != -1)
			{   System.out.print((char)c);
				//c = fis.read();
			}
		}
		catch(IOException ie)
		{ ie.printStackTrace(); }
	}
}
<a href="https://maticz.com/insurance-software-development">Insurance Software Development</a>
Tap to Earn Game Scripts are specialized tools designed to create engaging and interactive "Tap to Earn" games, particularly for platforms like Telegram. These games utilize simple tapping mechanics, allowing users to earn rewards or points with each tap. The scripts simplify the development process, enabling even those with limited coding knowledge to quickly build functional and appealing games.

Hivelance is a top provider of Tap to Earn Game Clone Scripts. Their team of experienced developers will assist you in launching your T2E Telegram games, providing powerful source code with robust security and cutting-edge features.

Know More:

Web - https://www.hivelance.com/tap-to-earn-game-scripts
Telegram - Hivelance
WhatsApp - +918438595928
Mail - Sales@hivelance.com
<a href="https://maticz.com/adventure-game-development">Adventure game development</a>
You are already familiar with an HTML class, but JavaScript also has a class. In JavaScript, a class is like a blueprint for creating objects. It allows you to define a set of properties and methods, and instantiate (or create) new objects with those properties and methods.

The class keyword is used to declare a class. Here is an example of declaring a Computer class:

Example Code
class Computer {};

Classes have a special constructor method, which is called when a new instance of the class is created. The constructor method is a great place to initialize properties of the class. Here is an example of a class with a constructor method:

Example Code
class Computer {
  constructor() {
  }
}

The this keyword in JavaScript is used to refer to the current object. Depending on where this is used, what it references changes. In the case of a class, it refers to the instance of the object being constructed. You can use the this keyword to set the properties of the object being instantiated. Here is an example:

Example Code
class Computer {
  constructor() {
    this.ram = 16;
  }
}

Here is an example of instantiating the Computer class from earlier examples:

Example Code
const myComputer = new Computer();

<Html>  
<head>   
<title>  
Registration Page  
</title>  
</head>  
<body bgcolor="#96D4D4">
<h1>Registration Form</h1>  
<br>  
<form>  
  
<label> Username </label>         
<input type="text" id = "U1" size="15"/> <br> <br>  
<label> Password: </label>     
<input type="password" password="p1" size="15"/> <br> <br>  
  
<label>   
Course :  
</label>   
<select>  
<option value="Course">Course</option>  
<option value="CSE">CSE</option>  
<option value="IT">IT</option>  
<option value="ECE">ECE</option>  
<option value="EEE">EEE</option>  
<option value="CSM">CSM</option>  
<option value="CSD">CSD</option>  
</select>  
<br>  
<br>
<label>   
Section :  
</label><br>  
<input type="radio" name="A"/> A <br>  
<input type="radio" name="B"/> B <br>  <br>
  
<label>   
Gender :  
</label><br>  
<input type="radio" name="male"/> Male <br>  
<input type="radio" name="female"/> Female <br>  
<input type="radio" name="other"/> Other  
<br>  
<br>  
  
<label for="phone">phone:</label>
<input type="text" name="country code"  value="+91" size="2"/>   
<input type="tel" id="phone" name="phone" pattern="[0-9]{3}-[0-9]{2}-[0-9]{3}" size="10"> <br><br>

<label>   
Mail :  
</label><br>  
<input type="email" id="email "name="email"/> <br>  <br>

<label>
State :
</label>
<select>
<option value = "select">select <br>
<option value = "TS">TS <br>
<option value = "AP">AP <br>
<option value = "TN">TN <br>
<option value = "KR">KR <br>
<option value = "BR">BR <br> <br>
</select> <br><br>
<input type="button" value="Submit"/>  
</form> 
 
</body>  
</html>  
import vertexai
from vertexai.generative_models import GenerativeModel

# TODO(developer): Update and un-comment below line
# project_id = "PROJECT_ID"

vertexai.init(project=project_id, location="us-central1")

model = GenerativeModel(model_name="gemini-1.5-flash-001")

response = model.generate_content(
    "What's a good name for a flower shop that specializes in selling bouquets of dried flowers?"
)

print(response.text)
star

Tue Jul 09 2024 01:26:21 GMT+0000 (Coordinated Universal Time) https://learn.microsoft.com/en-za/powershell/module/microsoft.powershell.core/about/about_command_syntax?view

@Dewaldt

star

Tue Jul 09 2024 01:25:37 GMT+0000 (Coordinated Universal Time) https://learn.microsoft.com/en-za/powershell/module/microsoft.powershell.core/get-help?view

@Dewaldt

star

Mon Jul 08 2024 22:54:44 GMT+0000 (Coordinated Universal Time)

@davidmchale #checking #object

star

Mon Jul 08 2024 19:47:45 GMT+0000 (Coordinated Universal Time) https://stackoverflow.com/questions/66080731/laravel-8-x-where-json-search-in-array

@xsirlalo

star

Mon Jul 08 2024 19:30:30 GMT+0000 (Coordinated Universal Time) https://laracasts.com/discuss/channels/laravel/laravel-request-validation-rule-based-on-two-values

@xsirlalo

star

Mon Jul 08 2024 18:16:18 GMT+0000 (Coordinated Universal Time)

@Hussein

star

Mon Jul 08 2024 17:45:51 GMT+0000 (Coordinated Universal Time) https://www.blackbox.ai/playground?action

@j3d1n00b

star

Mon Jul 08 2024 17:40:56 GMT+0000 (Coordinated Universal Time)

@projectrock

star

Mon Jul 08 2024 16:43:52 GMT+0000 (Coordinated Universal Time) https://blog.openreplay.com/mobile-first-approach-with-html-and-css/

@Black_Shadow

star

Mon Jul 08 2024 16:13:52 GMT+0000 (Coordinated Universal Time)

@signup

star

Mon Jul 08 2024 16:13:14 GMT+0000 (Coordinated Universal Time)

@signup

star

Mon Jul 08 2024 16:12:41 GMT+0000 (Coordinated Universal Time)

@projectrock

star

Mon Jul 08 2024 16:12:35 GMT+0000 (Coordinated Universal Time)

@signup

star

Mon Jul 08 2024 16:11:35 GMT+0000 (Coordinated Universal Time)

@signup

star

Mon Jul 08 2024 16:10:29 GMT+0000 (Coordinated Universal Time)

@signup

star

Mon Jul 08 2024 16:09:35 GMT+0000 (Coordinated Universal Time)

@signup

star

Mon Jul 08 2024 16:06:13 GMT+0000 (Coordinated Universal Time)

@projectrock

star

Mon Jul 08 2024 15:45:55 GMT+0000 (Coordinated Universal Time)

@projectrock

star

Mon Jul 08 2024 15:45:11 GMT+0000 (Coordinated Universal Time)

@projectrock

star

Mon Jul 08 2024 15:19:46 GMT+0000 (Coordinated Universal Time)

@signup

star

Mon Jul 08 2024 14:51:56 GMT+0000 (Coordinated Universal Time)

@projectrock

star

Mon Jul 08 2024 14:50:56 GMT+0000 (Coordinated Universal Time)

@projectrock

star

Mon Jul 08 2024 13:59:19 GMT+0000 (Coordinated Universal Time)

@varuntej #java

star

Mon Jul 08 2024 13:19:26 GMT+0000 (Coordinated Universal Time)

@varuntej #java

star

Mon Jul 08 2024 13:18:17 GMT+0000 (Coordinated Universal Time)

@varuntej #java

star

Mon Jul 08 2024 13:17:26 GMT+0000 (Coordinated Universal Time)

@varuntej #java

star

Mon Jul 08 2024 13:15:56 GMT+0000 (Coordinated Universal Time)

@varuntej #java

star

Mon Jul 08 2024 13:15:18 GMT+0000 (Coordinated Universal Time) https://maticz.com/medicine-delivery-app-development

@Ameliasebastian #medicinedeliveryapps

star

Mon Jul 08 2024 13:11:16 GMT+0000 (Coordinated Universal Time)

@emjumjunov

star

Mon Jul 08 2024 13:07:40 GMT+0000 (Coordinated Universal Time)

@varuntej #java

star

Mon Jul 08 2024 13:06:35 GMT+0000 (Coordinated Universal Time)

@varuntej #java

star

Mon Jul 08 2024 13:04:56 GMT+0000 (Coordinated Universal Time)

@varuntej #java

star

Mon Jul 08 2024 13:03:22 GMT+0000 (Coordinated Universal Time)

@varuntej #java

star

Mon Jul 08 2024 13:02:37 GMT+0000 (Coordinated Universal Time)

@varuntej #java

star

Mon Jul 08 2024 13:02:01 GMT+0000 (Coordinated Universal Time)

@varuntej #java

star

Mon Jul 08 2024 13:01:05 GMT+0000 (Coordinated Universal Time) https://maticz.com/cryptocurrency-payment-gateway-development

@Ameliasebastian #cryptopaymentgatewaydevelopmnent

star

Mon Jul 08 2024 12:59:30 GMT+0000 (Coordinated Universal Time)

@varuntej #java

star

Mon Jul 08 2024 12:58:44 GMT+0000 (Coordinated Universal Time)

@varuntej #java

star

Mon Jul 08 2024 12:57:07 GMT+0000 (Coordinated Universal Time)

@varuntej #java

star

Mon Jul 08 2024 12:56:22 GMT+0000 (Coordinated Universal Time)

@varuntej #java

star

Mon Jul 08 2024 12:35:57 GMT+0000 (Coordinated Universal Time) https://maticz.com/insurance-software-development

@Ameliasebastian #insurancesoftware

star

Mon Jul 08 2024 10:45:27 GMT+0000 (Coordinated Universal Time) https://maticz.com/adventure-game-development

@Ameliasebastian #adventuregamedevelopment

star

Mon Jul 08 2024 10:04:36 GMT+0000 (Coordinated Universal Time)

@NoFox420 #javascript

star

Mon Jul 08 2024 10:02:06 GMT+0000 (Coordinated Universal Time)

@user01

star

Mon Jul 08 2024 09:43:27 GMT+0000 (Coordinated Universal Time) https://cloud.google.com/vertex-ai/generative-ai/docs/start/quickstarts/quickstart-multimodal?hl

@Spsypg #python

star

Mon Jul 08 2024 09:43:18 GMT+0000 (Coordinated Universal Time) https://cloud.google.com/vertex-ai/generative-ai/docs/start/quickstarts/quickstart-multimodal?hl

@Spsypg #sh

star

Mon Jul 08 2024 09:43:08 GMT+0000 (Coordinated Universal Time) https://cloud.google.com/vertex-ai/generative-ai/docs/start/quickstarts/quickstart-multimodal?hl

@Spsypg #sh

Save snippets that work with our extensions

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