Snippets Collections
CookieManager.getInstance().setAcceptThirdPartyCookies(webView, true)
https://webview-api-for-ads-test.glitch.me#webview-settings-tests
import android.webkit.CookieManager
import android.webkit.WebView

class MainActivity : AppCompatActivity() {
  lateinit var webView: WebView

  override fun onCreate(savedInstanceState: Bundle?) {
    super.onCreate(savedInstanceState)
    setContentView(R.layout.activity_main)
    webView = findViewById(R.id.webview)

    // Let the web view accept third-party cookies.
    CookieManager.getInstance().setAcceptThirdPartyCookies(webView, true)
    // Let the web view use JavaScript.
    webView.settings.javaScriptEnabled = true
    // Let the web view access local storage.
    webView.settings.domStorageEnabled = true
    // Let HTML videos play automatically.
    webView.settings.mediaPlaybackRequiresUserGesture = false

    // Load the URL for optimized web view performance.
    webView.loadUrl("https://webview-api-for-ads-test.glitch.me")
  }
}
import android.webkit.CookieManager
import android.webkit.WebView

class MainActivity : AppCompatActivity() {
  lateinit var webView: WebView

  override fun onCreate(savedInstanceState: Bundle?) {
    super.onCreate(savedInstanceState)
    setContentView(R.layout.activity_main)
    webView = findViewById(R.id.webview)

    // Let the web view accept third-party cookies.
    CookieManager.getInstance().setAcceptThirdPartyCookies(webView, true)
    // Let the web view use JavaScript.
    webView.settings.javaScriptEnabled = true
    // Let the web view access local storage.
    webView.settings.domStorageEnabled = true
    // Let HTML videos play automatically.
    webView.settings.mediaPlaybackRequiresUserGesture = false
  }
}
import android.webkit.CookieManager;
import android.webkit.WebView;

public class MainActivity extends AppCompatActivity {
  private WebView webView;

  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    webView = findViewById(R.id.webview);

    // Let the web view accept third-party cookies.
    CookieManager.getInstance().setAcceptThirdPartyCookies(webView, true);
    // Let the web view use JavaScript.
    webView.getSettings().setJavaScriptEnabled(true);
    // Let the web view access local storage.
    webView.getSettings().setDomStorageEnabled(true);
    // Let HTML videos play automatically.
    webView.getSettings().setMediaPlaybackRequiresUserGesture(false);
  }
}
CookieManager.getInstance().setAcceptThirdPartyCookies(webView, true);
async function createVirtualMachines() {
    createResourceGroup();
    createVirtualNetwork();
    createSubnet();
    createNetworkInterface(resourceGroupName, location, interfaceName);
    const parameter: VirtualMachine = {
        location: location,
        hardwareProfile: {
            vmSize: "Standard_D2_v2",
        },
        storageProfile: {
            imageReference: {
                sku: "2016-Datacenter",
                publisher: "MicrosoftWindowsServer",
                version: "latest",
                offer: "WindowsServer"
            },
            osDisk: {
                caching: "ReadWrite",
                managedDisk: {
                    storageAccountType: "Standard_LRS"
                },
                name: "myVMosdisk",
                createOption: "FromImage"
            },
            dataDisks: [
                {
                    diskSizeGB: 1023,
                    createOption: "Empty",
                    lun: 0
                },
                {
                    diskSizeGB: 1023,
                    createOption: "Empty",
                    lun: 1
                }
            ]
        },
        osProfile: {
            adminUsername: "testuser",
            computerName: "myVM",
            adminPassword: "Placeholder",
            windowsConfiguration: {
                enableAutomaticUpdates: true // need automatic update for reimage
            }
        },
        networkProfile: {
            networkInterfaces: [
                {
                    id: "/subscriptions/" + subscriptionId + "/resourceGroups/" + resourceGroupName + "/providers/Microsoft.Network/networkInterfaces/" + interfaceName + "",
                    primary: true
                }
            ]
        }
    };
    const poller_result = await computeClient.virtualMachines.beginCreateOrUpdateAndWait(resourceGroupName, virtualMachineName, parameter);
    console.log(poller_result);
    const res = await computeClient.virtualMachines.get(resourceGroupName, virtualMachineName);
    console.log(res);
}
Sorry, Google Voice isn't supported in your country yet
// tailwind.config.js
module.exports = {
  theme: {
    extend: {
      colors: {
        primary: '#FF6347',
        secondary: '#32CD32',
        accent: '#FFD700',
      },
    },
  },
};
npm install @azure/arm-netapp
Copy
import OpenAI from "npm:openai";
import OpenAI from "https://deno.land/x/openai@v4.47.1/mod.ts";

const client = new OpenAI();
This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion
sudo rm -fv /etc/apt/sources.list.d/thorium.list && \
sudo wget --no-hsts -P /etc/apt/sources.list.d/ \
http://dl.thorium.rocks/debian/dists/stable/thorium.list && \
sudo apt update

sudo apt install thorium-browser
from azure.ai.ml import MLClient
from azure.ai.ml.entities import (
    ManagedOnlineEndpoint,
    ManagedOnlineDeployment,
    Model,
    Environment,
    CodeConfiguration,
)
registry_name = "HuggingFace"
model_name = "bert_base_uncased"
model_id = f"azureml://registries/{registry_name}/models/{model_name}/labels/latest"from azure.ai.ml import MLClient
from azure.ai.ml.entities import (
    ManagedOnlineEndpoint,
    ManagedOnlineDeployment,
    Model,
    Environment,
    CodeConfiguration,
)
registry_name = "HuggingFace"
model_name = "bert_base_uncased"
model_id = f"azureml://registries/{registry_name}/models/{model_name}/labels/latest"
Yes. In Bluetooth mode, you can use tandem mode to connect a second controller to your wirelessly connected Stadia Controller.
<body style="font-family: 'Poppins', Arial, sans-serif">
    <table width="100%" border="0" cellspacing="0" cellpadding="0">
        <tr>
            <td align="center" style="padding: 20px;">
                <table class="content" width="600" border="0" cellspacing="0" cellpadding="0" style="border-collapse: collapse; border: 1px solid #cccccc;">
                    <!-- Header -->
                    <tr>
                        <td class="header" style="background-color: #345C72; padding: 40px; text-align: center; color: white; font-size: 24px;">
                        Responsive Email Template
                        </td>
                    </tr>

                    <!-- Body -->
                    <tr>
                        <td class="body" style="padding: 40px; text-align: left; font-size: 16px; line-height: 1.6;">
                        Hello, All! <br>
                        Lorem odio soluta quae dolores sapiente voluptatibus recusandae aliquam fugit ipsam.
                        <br><br>
                            Lorem ipsum dolor sit amet consectetur adipisicing elit. Veniam corporis sint eum nemo animi velit exercitationem impedit. Incidunt, officia facilis  atque? Ipsam voluptas fugiat distinctio blanditiis veritatis.            
                        </td>
                    </tr>

                    <!-- Call to action Button -->
                    <tr>
                        <td style="padding: 0px 40px 0px 40px; text-align: center;">
                            <!-- CTA Button -->
                            <table cellspacing="0" cellpadding="0" style="margin: auto;">
                                <tr>
                                    <td align="center" style="background-color: #345C72; padding: 10px 20px; border-radius: 5px;">
                                        <a href="https://www.yourwebsite.com" target="_blank" style="color: #ffffff; text-decoration: none; font-weight: bold;">Book a Free Consulatation</a>
                                    </td>
                                </tr>
                            </table>
                        </td>
                    </tr>
                    <tr>
                        <td class="body" style="padding: 40px; text-align: left; font-size: 16px; line-height: 1.6;">
                            Lorem ipsum dolor sit amet consectetur adipisicing elit. Veniam corporis sint eum nemo animi velit exercitationem impedit.             
                        </td>
                    </tr>
                    <!-- Footer -->
                    <tr>
                        <td class="footer" style="background-color: #333333; padding: 40px; text-align: center; color: white; font-size: 14px;">
                        Copyright &copy; 2024 | Your brand name
                        </td>
                    </tr>
                </table>
            </td>
        </tr>
    </table>
</body>
Here are the detailed solutions to the questions in each set from the provided document:

### SET-1

1. **Draw an ER Diagram using basic and advanced ER concepts for an Online book store:**
   - Identify entities such as `Books`, `Authors`, `Customers`, `Orders`, `Reviews`.
   - Relationships could include `authored_by` between `Books` and `Authors`, `placed_by` between `Orders` and `Customers`, `reviews` between `Customers` and `Books`.

2. **Create a PL/SQL function to calculate the factorial of a number:**
   ```sql
   CREATE OR REPLACE FUNCTION calculate_factorial(n IN NUMBER) RETURN NUMBER IS
     result NUMBER := 1;
   BEGIN
     FOR i IN 1..n LOOP
       result := result * i;
     END LOOP;
     RETURN result;
   END;
   ```

3. **Retrieve all nurses who are registered:**
   ```sql
   SELECT * FROM Nurse WHERE registered = 'Y';
   ```

4. **Add a new column "phone" to the nurse table:**
   ```sql
   ALTER TABLE Nurse ADD phone VARCHAR2(15);
   ```

5. **Update the registered status of Nurse 'Laverne Roberts' to 'N':**
   ```sql
   UPDATE Nurse SET registered = 'N' WHERE name = 'Laverne Roberts';
   ```

6. **Create a view to display the names and positions of nurses:**
   ```sql
   CREATE VIEW NurseNamesPositions AS
   SELECT name, position FROM Nurse;
   ```

7. **Retrieve the names and positions of all employees (nurses and physicians):**
   ```sql
   SELECT name, position FROM Nurse
   UNION
   SELECT name, position FROM Physician;
   ```

8. **Retrieve the names of all department heads and their respective department names:**
   ```sql
   SELECT d.name AS DepartmentName, e.name AS DepartmentHead
   FROM Department d
   JOIN Employee e ON d.head_id = e.id;
   ```

9. **Retrieve the names of nurses and their respective departments (using nested queries):**
   ```sql
   SELECT n.name, d.name AS DepartmentName
   FROM Nurse n
   JOIN Department d ON n.department_id = d.id;
   ```

10. **Remove the department with department id 2 from the department table:**
    ```sql
    DELETE FROM Department WHERE id = 2;
    ```

### SET-2

1. **Draw an ER Diagram using basic and advanced ER concepts for Online banking:**
   - Entities: `Customers`, `Accounts`, `Transactions`, `Loans`.
   - Relationships: `holds` between `Customers` and `Accounts`, `performs` between `Accounts` and `Transactions`, `has_loan` between `Customers` and `Loans`.

2. **Create a PL/SQL procedure with an OUT parameter to calculate the square and cube of a number:**
   ```sql
   CREATE OR REPLACE PROCEDURE calc_square_cube (n IN NUMBER, square OUT NUMBER, cube OUT NUMBER) AS
   BEGIN
     square := n * n;
     cube := n * n * n;
   END;
   ```

3. **Write a SQL query to display the students who are not from Telangana or Andhra Pradesh:**
   ```sql
   SELECT * FROM Students WHERE state NOT IN ('Telangana', 'Andhra Pradesh');
   ```

4. **Create a view to display the columns Sid Sname for students belonging to Telangana:**
   ```sql
   CREATE VIEW TelanganaStudents AS
   SELECT Sid, Sname FROM Students WHERE state = 'Telangana';
   ```

5. **Display all the female students enrolled under Compcourse and who belong to OBC:**
   ```sql
   SELECT * FROM Students WHERE gender = 'Female' AND course = 'Compcourse' AND category = 'OBC';
   ```

6. **Display the student ids, names, and their percentage:**
   ```sql
   SELECT Sid, Sname, (marks_obtained/total_marks)*100 AS percentage FROM Students;
   ```

7. **Display the students in the ascending order of their names for each course:**
   ```sql
   SELECT * FROM Students ORDER BY course, Sname ASC;
   ```

8. **Write a SQL query to delete all the students' records who have enrolled for Compcourse and who are born after 2002:**
   ```sql
   DELETE FROM Students WHERE course = 'Compcourse' AND birth_date > DATE '2002-01-01';
   ```

9. **Write a SQL query to resize the column state to varchar2(40):**
   ```sql
   ALTER TABLE Students MODIFY state VARCHAR2(40);
   ```

10. **Write a SQL query to display all the student names where the length of the name is 5 characters:**
    ```sql
    SELECT Sname FROM Students WHERE LENGTH(Sname) = 5;
    ```

### SET-3

1. **Draw an ER Diagram using basic and advanced ER concepts for Online Auction System:**
   - Entities: `Auctions`, `Bidders`, `Items`, `Bids`.
   - Relationships: `places` between `Bidders` and `Bids`, `belongs_to` between `Bids` and `Auctions`, `offers` between `Auctions` and `Items`.

2. **Write a PL/SQL program to find the area of a circle:**
   ```sql
   CREATE OR REPLACE PROCEDURE find_area_circle (radius IN NUMBER, area OUT NUMBER) AS
   BEGIN
     area := 3.14159 * radius * radius;
   END;
   ```

3. **Change the position of Physician 'John Dorian' to 'Senior Staff Internist':**
   ```sql
   UPDATE Physician SET position = 'Senior Staff Internist' WHERE name = 'John Dorian';
   ```

4. **Create a view to display the names and positions of physicians who are not interns:**
   ```sql
   CREATE VIEW PhysiciansNotInterns AS
   SELECT name, position FROM Physician WHERE position != 'Intern';
   ```

5. **Retrieve all physicians who are attending physicians:**
   ```sql
   SELECT * FROM Physician WHERE position = 'Attending Physician';
   ```

6. **Retrieve the names of physicians and the departments they belong to (using nested queries):**
   ```sql
   SELECT p.name, d.name AS DepartmentName
   FROM Physician p
   JOIN Department d ON p.department_id = d.id;
   ```

7. **Retrieve the names of physicians who have "Physician" in their position:**
   ```sql
   SELECT name FROM Physician WHERE position LIKE '%Physician%';
   ```

8. **Retrieve the names of nurses who are registered and belong to the Surgery department:**
   ```sql
   SELECT n.name FROM Nurse n
   JOIN Department d ON n.department_id = d.id
   WHERE n.registered = 'Y' AND d.name = 'Surgery';
   ```

9. **Retrieve the names and total number of physicians in each department:**
   ```sql
   SELECT d.name AS DepartmentName, COUNT(p.id) AS NumberOfPhysicians
   FROM Department d
   JOIN Physician p ON d.id = p.department_id
   GROUP BY d.name;
   ```

10. **Delete all nurses who are not registered:**
    ```sql
    DELETE FROM Nurse WHERE registered = 'N';
    ```

### SET-4

1. **Draw an ER Diagram using basic and advanced ER concepts for Library Management system:**
   - Entities: `Books`, `Authors`, `Members`, `Loans`.
   - Relationships: `written_by` between `Books` and `Authors`, `borrowed_by` between `Loans` and `Members`, `contains` between `Loans` and `Books`.

2. **Create a PL/SQL function with parameters to calculate the area of a rectangle:**
   ```sql
   CREATE OR REPLACE FUNCTION calculate_area_rectangle(length IN NUMBER, width IN NUMBER) RETURN NUMBER IS
     area NUMBER;
   BEGIN
     area := length * width;
     RETURN area;
   END;
   ```

3. **Write a query in SQL to display all the information of the employees:**
   ```sql
   SELECT * FROM Employees;
   ```

4. **Write a query in SQL to find the salaries of all employees:**
   ```sql
   SELECT Salary FROM Employees;
   ```

5. **Write a query in SQL to display the unique designations for the employees:**
   ```sql
   SELECT DISTINCT Designation FROM Employees;
   ```

6. **Write a query in SQL to list the emp_name and salary increased by 15%:**
   ```sql
   SELECT emp_name, salary * 1.15 AS IncreasedSalary FROM Employees;
   ```

7. **Write a query in SQL to list the emp_id, salary, and dept_id of all the employees:**
   ```sql
   SELECT emp_id, salary, dept_id FROM Employees;
   ```

8. **Write a query in SQL to list the employees who joined before 1991:**
   ```sql
   SELECT * FROM Employees WHERE joining_date < DATE '1991-01-01';
   ```

9. **Write a query in SQL to display the average salaries of all the employees who work as ANALYST:**
   ```sql
   SELECT AVG(salary) AS AvgSalary FROM Employees WHERE designation = 'ANALYST';
   ```

10. **Create a view to display the employees whose name consists third letter as ‘A’ and salary is between 2600 to 3200:**
    ```sql
    CREATE VIEW SpecificEmployees

 AS
    SELECT * FROM Employees
    WHERE SUBSTR(emp_name, 3, 1) = 'A' AND salary BETWEEN 2600 AND 3200;
    ```

### SET-5

1. **Draw an ER Diagram using basic and advanced ER concepts for Hospital Management system:**
   - Entities: `Patients`, `Doctors`, `Nurses`, `Departments`, `Appointments`.
   - Relationships: `assigned_to` between `Patients` and `Doctors`, `works_in` between `Nurses` and `Departments`, `scheduled_for` between `Appointments` and `Patients`.

2. **Write a PL/SQL Function program to use INOUT:**
   ```sql
   CREATE OR REPLACE PROCEDURE calc_area_perimeter_rectangle(length IN NUMBER, width IN NUMBER, area OUT NUMBER, perimeter OUT NUMBER) AS
   BEGIN
     area := length * width;
     perimeter := 2 * (length + width);
   END;
   ```

3. **Display the structure of nurse and physician tables:**
   ```sql
   DESC Nurse;
   DESC Physician;
   ```

4. **Retrieve the names of all physicians who have a Senior Attending position:**
   ```sql
   SELECT name FROM Physician WHERE position = 'Senior Attending';
   ```

5. **Retrieve the names of physicians who are not heads of any department:**
   ```sql
   SELECT p.name FROM Physician p
   LEFT JOIN Department d ON p.id = d.head_id
   WHERE d.head_id IS NULL;
   ```

6. **Retrieve the names of physicians whose positions start with 'Surgical':**
   ```sql
   SELECT name FROM Physician WHERE position LIKE 'Surgical%';
   ```

7. **Retrieve the names of physicians who have the same position as Nurse 'Carla Espinosa':**
   ```sql
   SELECT p.name FROM Physician p
   JOIN Nurse n ON p.position = n.position
   WHERE n.name = 'Carla Espinosa';
   ```

8. **Modify the data type of the "ssn" column in the physician table:**
   ```sql
   ALTER TABLE Physician MODIFY ssn VARCHAR2(20);
   ```

9. **Remove the department with department id 1 from the department table:**
    ```sql
    DELETE FROM Department WHERE id = 1;
    ```

10. **Create a view to display the names and SSNs of physicians with the position 'Attending Physician':**
    ```sql
    CREATE VIEW AttendingPhysicians AS
    SELECT name, ssn FROM Physician WHERE position = 'Attending Physician';
    ```

### SET-6

1. **Draw an ER Diagram using basic and advanced ER concepts for Online food order system:**
   - Entities: `Customers`, `Restaurants`, `Orders`, `MenuItems`, `Delivery`.
   - Relationships: `places` between `Customers` and `Orders`, `contains` between `Orders` and `MenuItems`, `delivered_by` between `Delivery` and `Orders`.

2. **Create a PL/SQL procedure with parameters to calculate the square of a number:**
   ```sql
   CREATE OR REPLACE PROCEDURE calc_square (n IN NUMBER, square OUT NUMBER) AS
   BEGIN
     square := n * n;
   END;
   ```

3. **Display Supplier numbers and Supplier names whose name starts with ‘R’:**
   ```sql
   SELECT supplier_number, supplier_name FROM Suppliers WHERE supplier_name LIKE 'R%';
   ```

4. **Display the name of suppliers who supply Processors and whose city is Delhi:**
   ```sql
   SELECT s.supplier_name FROM Suppliers s
   JOIN Supplies sp ON s.supplier_id = sp.supplier_id
   WHERE sp.item_name = 'Processor' AND s.city = 'Delhi';
   ```

5. **Display the names of suppliers who supply the same items as supplied by Ramesh:**
   ```sql
   SELECT DISTINCT s2.supplier_name FROM Suppliers s1
   JOIN Supplies sp1 ON s1.supplier_id = sp1.supplier_id
   JOIN Supplies sp2 ON sp1.item_name = sp2.item_name
   JOIN Suppliers s2 ON sp2.supplier_id = s2.supplier_id
   WHERE s1.supplier_name = 'Ramesh' AND s2.supplier_name != 'Ramesh';
   ```

6. **Write a SQL query to increase the price of Keyboard by 200:**
   ```sql
   UPDATE Items SET price = price + 200 WHERE item_name = 'Keyboard';
   ```

7. **Write a SQL query to display supplier numbers, supplier names, and item_price for suppliers in Delhi in the ascending order of item_price:**
   ```sql
   SELECT s.supplier_number, s.supplier_name, i.price
   FROM Suppliers s
   JOIN Supplies sp ON s.supplier_id = sp.supplier_id
   JOIN Items i ON sp.item_id = i.item_id
   WHERE s.city = 'Delhi'
   ORDER BY i.price ASC;
   ```

8. **Write a SQL query to add a new column called CONTACTNO:**
   ```sql
   ALTER TABLE Suppliers ADD CONTACTNO VARCHAR2(15);
   ```

9. **Delete the record whose item_price is the lowest of all the items supplied:**
   ```sql
   DELETE FROM Items WHERE price = (SELECT MIN(price) FROM Items);
   ```

10. **Create a view on the table which displays only supplier numbers and supplier names:**
    ```sql
    CREATE VIEW SupplierInfo AS
    SELECT supplier_number, supplier_name FROM Suppliers;
    ```

### SET-7

1. **Draw an ER Diagram using basic and advanced ER concepts for Hotel Management system:**
   - Entities: `Guests`, `Rooms`, `Reservations`, `Services`, `Staff`.
   - Relationships: `reserves` between `Guests` and `Reservations`, `provides` between `Services` and `Guests`, `assigned_to` between `Staff` and `Rooms`.

2. **Write a PL/SQL Program to print the salary changes when the salary is changed by using a trigger:**
   ```sql
   CREATE OR REPLACE TRIGGER salary_change_trigger
   BEFORE UPDATE OF salary ON Employees
   FOR EACH ROW
   BEGIN
     DBMS_OUTPUT.PUT_LINE('Old Salary: ' || :OLD.salary || ', New Salary: ' || :NEW.salary);
   END;
   ```

3. **Find courses with credit hours greater than the average:**
   ```sql
   SELECT * FROM Courses WHERE credit_hours > (SELECT AVG(credit_hours) FROM Courses);
   ```

4. **Retrieve students with last name starting with 'D':**
   ```sql
   SELECT * FROM Students WHERE last_name LIKE 'D%';
   ```

5. **Change the instructor's name of a specific course:**
   ```sql
   UPDATE Courses SET instructor_name = 'New Instructor' WHERE course_id = 101;
   ```

6. **Create a view for students with GPA > 3.8:**
   ```sql
   CREATE VIEW HighGPAStudents AS
   SELECT * FROM Students WHERE GPA > 3.8;
   ```

7. **Find courses taken by students with high GPA:**
   ```sql
   SELECT DISTINCT c.course_name FROM Courses c
   JOIN Enrollments e ON c.course_id = e.course_id
   JOIN Students s ON e.student_id = s.student_id
   WHERE s.GPA > 3.8;
   ```

8. **Retrieve students enrolled in multiple courses:**
   ```sql
   SELECT s.student_name FROM Students s
   JOIN Enrollments e ON s.student_id = e.student_id
   GROUP BY s.student_name HAVING COUNT(e.course_id) > 1;
   ```

9. **Count students enrolled in courses with credit hours less than 4:**
   ```sql
   SELECT c.course_name, COUNT(e.student_id) AS NumberOfStudents
   FROM Courses c
   JOIN Enrollments e ON c.course_id = e.course_id
   WHERE c.credit_hours < 4
   GROUP BY c.course_name;
   ```

10. **Alter the students table to add a new column 'Rank':**
    ```sql
    ALTER TABLE Students ADD Rank NUMBER;
    ```

### SET-8

1. **Draw an ER Diagram using basic and advanced ER concepts for “Flipkart”:**
   - Entities: `Users`, `Products`, `Orders`, `Categories`, `Reviews`.
   - Relationships: `places` between `Users` and `Orders`, `contains` between `Orders` and `Products`, `categorized_as` between `Products` and `Categories`.

2. **Create a trigger to update the Instructor's Name in Courses table when it is updated in Students table:**
   ```sql
   CREATE OR REPLACE TRIGGER update_instructor_name
   AFTER UPDATE OF instructor_name ON Students
   FOR EACH ROW
   BEGIN
     UPDATE Courses SET instructor_name = :NEW.instructor_name
     WHERE instructor_id = :OLD.instructor_id;
   END;
   ```

3. **Alter students table to add Email column:**
   ```sql
   ALTER TABLE Students ADD Email VARCHAR2(50);
   ```

4. **Update Email for a specific student:**
   ```sql
   UPDATE Students SET Email = 'newemail@example.com' WHERE student_id = 101;
   ```

5. **Find courses with enrollments having students with GPA less than any specific value:**
   ```sql
   SELECT DISTINCT c.course_name FROM Courses c
   JOIN Enrollments e ON c.course_id = e.course_id
   JOIN Students s ON e.student_id = s.student_id
   WHERE s.GPA <

 3.0;
   ```

6. **Create a view for students in a specific course:**
   ```sql
   CREATE VIEW SpecificCourseStudents AS
   SELECT s.student_name FROM Students s
   JOIN Enrollments e ON s.student_id = e.student_id
   WHERE e.course_id = 101;
   ```

7. **Retrieve students enrolled in courses taught by a specific instructor:**
   ```sql
   SELECT s.student_name FROM Students s
   JOIN Enrollments e ON s.student_id = e.student_id
   JOIN Courses c ON e.course_id = c.course_id
   WHERE c.instructor_name = 'Dr. Smith';
   ```

8. **Count the number of students per course:**
   ```sql
   SELECT c.course_name, COUNT(e.student_id) AS NumberOfStudents
   FROM Courses c
   JOIN Enrollments e ON c.course_id = e.course_id
   GROUP BY c.course_name;
   ```

9. **Find courses not taken by any students:**
   ```sql
   SELECT * FROM Courses c
   WHERE NOT EXISTS (
     SELECT 1 FROM Enrollments e WHERE c.course_id = e.course_id
   );
   ```

10. **Alter the table to drop the Email column:**
    ```sql
    ALTER TABLE Students DROP COLUMN Email;
    ```

### SET-9

1. **Draw an ER Diagram using basic and advanced ER concepts for Inventory Management System:**
   - Entities: `Products`, `Suppliers`, `Orders`, `Warehouses`.
   - Relationships: `supplies` between `Suppliers` and `Products`, `stored_in` between `Products` and `Warehouses`, `contains` between `Orders` and `Products`.

2. **Create a trigger to log changes in inventory quantities:**
   ```sql
   CREATE OR REPLACE TRIGGER log_inventory_changes
   AFTER UPDATE OF quantity ON Inventory
   FOR EACH ROW
   BEGIN
     INSERT INTO InventoryLog (product_id, old_quantity, new_quantity, change_date)
     VALUES (:OLD.product_id, :OLD.quantity, :NEW.quantity, SYSDATE);
   END;
   ```

3. **Add a new column 'Discount' to the Orders table:**
   ```sql
   ALTER TABLE Orders ADD Discount NUMBER(5,2);
   ```

4. **Update the discount for a specific order:**
   ```sql
   UPDATE Orders SET Discount = 10 WHERE order_id = 102;
   ```

5. **Find products with quantity less than a specified threshold:**
   ```sql
   SELECT * FROM Products WHERE quantity < 50;
   ```

6. **Create a view to display the details of products from a specific supplier:**
   ```sql
   CREATE VIEW SupplierProducts AS
   SELECT p.* FROM Products p
   JOIN Supplies s ON p.product_id = s.product_id
   WHERE s.supplier_id = 201;
   ```

7. **Retrieve orders containing products from a specific warehouse:**
   ```sql
   SELECT o.order_id, o.order_date FROM Orders o
   JOIN OrderDetails od ON o.order_id = od.order_id
   JOIN Products p ON od.product_id = p.product_id
   WHERE p.warehouse_id = 301;
   ```

8. **Count the number of products supplied by each supplier:**
   ```sql
   SELECT s.supplier_name, COUNT(p.product_id) AS NumberOfProducts
   FROM Suppliers s
   JOIN Supplies sp ON s.supplier_id = sp.supplier_id
   JOIN Products p ON sp.product_id = p.product_id
   GROUP BY s.supplier_name;
   ```

9. **Find suppliers who do not supply any products:**
   ```sql
   SELECT * FROM Suppliers s
   WHERE NOT EXISTS (
     SELECT 1 FROM Supplies sp WHERE s.supplier_id = sp.supplier_id
   );
   ```

10. **Alter the Orders table to drop the Discount column:**
    ```sql
    ALTER TABLE Orders DROP COLUMN Discount;
    ```

This detailed summary provides the necessary SQL statements and PL/SQL code snippets required for each of the tasks in the provided document, along with a brief explanation of the ER diagrams that should be created for each scenario.
devpod up https://github.com/madskristensen/NpmTaskRunner
{
	"name": "test",
	"version": "1.0.0",
	"scripts": {
		"watch-test": "mocha --watch --reporter spec test",
		"build-js": "browserify -t reactify app/js/main.js | uglifyjs -mc > static/bundle.js"
	}
}
{    "name": "test",    "version": "1.0.0",    "scripts": {        "watch-test": "mocha --watch --reporter spec test",        "build-js": "browserify -t reactify app/js/main.js | uglifyjs -mc > static/bundle.js"    }}
npm install --save auto-counter-ui
public interface MyNum{
  public abstract double getNum();
}
public class LambdaDemo{
  public static void main(String[] args){
    MyNum.num=()->123.456;
    S.o.p("This is the value:"+num.getNum());
    num->Math.random()*100;
    S.o.p("This is random value:"+num.getNum());
    S.o.p("This is one more random value:"+num.getNum());
  }
}
OUTPUT:
123.456
420
640
import java.util.Scanner;
import java.util.function.Function;

public class LambdaStringCase {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        System.out.print("Enter a string: ");
        String input = scanner.nextLine();

        Function<String, String> toUpperCase = str -> str.toUpperCase();

        Function<String, String> toLowerCase = str -> str.toLowerCase();

        String upperCaseString = toUpperCase.apply(input);
        System.out.println("Uppercase: " + upperCaseString);

        String lowerCaseString = toLowerCase.apply(input);
        System.out.println("Lowercase: " + lowerCaseString);
    }
}
import java.util.*; 
 
public class TreeSetDemo 
{    
    class MyComparator implements Comparator<String> 
 { public int compare(String s1, String s2) 
  { if(s1.compareTo(s2)<0)  
   return -1; 
    if(s1.compareTo(s2)>0)  
     return +1; 
    return 0; 
  } 
 } 
 public static void main(String[] args) 
 { 
  TreeSet<String> ts =  
                 new TreeSet<>(new TreeSetDemo().new MyComparator()); 
  ts.add("hello"); ts.add("world"); ts.add("version"); 
  ts.add("main"); ts.add("method"); 
   
  System.out.println("Contents: " + ts); 
  System.out.println(); 
   
  System.out.println("Higher than \"main\": " + ts.higher("main")); 
  System.out.println("Lower than \"main\": " + ts.lower("main")); 
  System.out.println(); 
     
  SortedSet s = ts.tailSet("method"); 
  System.out.println("TailSet from \"method\": " + s); 
  s = ts.headSet("method"); 
  System.out.println("HeadSet from \"method\": " + s); 
  System.out.println(); 
   
  Iterator it = ts.iterator(); 
  System.out.print("Iteration: "); 
  while(it.hasNext()) 
   System.out.print(it.next()+" "); 
   
  System.out.println(); 
  System.out.println(); 
  Iterator it2 = ts.descendingIterator(); 
  System.out.print("Iteration Descending: "); 
  while(it2.hasNext()) 
   System.out.print(it2.next()+" "); 
   
  System.out.println(); 
  System.out.println("First one: " + ts.pollFirst()); 
  System.out.println("Last one: " + ts.pollLast()); 
  System.out.println("Contents: " + ts); 
  } 
}
public class Pair<K, V> {
    private K key;
    private V value;

    public Pair(K key, V value) {
        this.key = key;
        this.value = value;
    }

    public K getKey() {
        return this.key;
    }

    public V getValue() {
        return this.value;
    }

    public static void main(String[] args) {
        Pair<Integer, String> p1 = new Pair<>(123, "Generics");
        Integer key = p1.getKey();
        String value = p1.getValue();
        System.out.println("Key: " + key);
        System.out.println("Value: " + value);
    }
}
import java.util.*; 
 
public class import java.util.*; 
 
public class TreeMapDemo 
{ 
 public static void main(String[] args) 
 { 
  TreeMap<String, Integer> tm = new TreeMap<>(); 
  tm.put("Anand", 20); 
  tm.put("Mary", 20); 
  tm.put("Ravi", 21); 
  tm.put("John",19); 
  System.out.println("Contents: "+tm); 
   
  System.out.println(); 
  Set<String> keys = tm.keySet(); 
  for(String k: keys) 
   System.out.println(k+" -- "+tm.get(k)); 
   
  System.out.println(); 
   
  Set<Map.Entry<String, Integer>> entries = tm.entrySet(); 
  for(Map.Entry<String,Integer> each: entries) 
   System.out.println(each.getKey()+" -- "+each.getValue()); 
   
  System.out.println(); 
 } 
}  
{ 
 public static void main(String[] args) 
 { 
  TreeMap<String, Integer> tm = new TreeMap<>(); 
  tm.put("Anand", 20); 
  tm.put("Mary", 20); 
  tm.put("Ravi", 21); 
  tm.put("John",19); 
  System.out.println("Contents: "+tm); 
   
  System.out.println(); 
  Set<String> keys = tm.keySet(); 
  for(String k: keys) 
   System.out.println(k+" -- "+tm.get(k)); 
   
  System.out.println(); 
   
  Set<Map.Entry<String, Integer>> entries = tm.entrySet(); 
  for(Map.Entry<String,Integer> each: entries) 
   System.out.println(each.getKey()+" -- "+each.getValue()); 
   
  System.out.println(); 
 } 
} 
import java.util.*;
class StackULLC{
	public static void main(String args[]){
		Scanner sc = new Scanner(System.in);
		LinkedList l = new LinkedList();
		int op=0;
		System.out.println("1.Push\n2.Pop\n3.Display\n4.Exit");
		while(op!=4){
			System.out.print("Enter option:");
			op = sc.nextInt();
			switch(op){
				case 1: System.out.println("Enter data: ");
						int d = sc.nextInt();
						l.addFirst(d);
						break;
				case 2: System.out.println("Poped: "+l.removeFirst());
						break;
				case 3: 
				LinkedList temp =new LinkedList(l);
				while(!temp.isEmpty()){
					System.out.print(temp.getFirst()+"   ");
					temp.removeFirst();	
				};System.out.println();
				break;
				case 4: break;
			}
		}
	}
}
import java.util.ArrayList;

public class Stack<E extends Number> {
    private ArrayList<E> list;

    public Stack(ArrayList<E> list) {
        this.list = list;
    }

    public void push(E element) {
        list.add(element);
    }

    public E pop() {
        if (list.isEmpty()) {
            throw new IllegalStateException("Stack is empty");
        }
        return list.remove(list.size() - 1);
    }

    public int size() {
        return list.size();
    }

    public double average() {
        if (list.isEmpty()) {
            return 0.0;
        }
        double sum = 0.0;
        for (E element : list) {
            sum += element.doubleValue();
        }
        return sum / list.size();
    }

    public boolean compareAverage(Stack<? extends Number> other) {
        return Double.compare(this.average(), other.average()) == 0;
    }

    public static void main(String[] args) {
        Stack<Integer> s1 = new Stack<>(new ArrayList<>());
        s1.push(1);
        s1.push(2);
        s1.push(3);
        s1.push(4);
        s1.push(5);
        System.out.println("Integer stack average: " + s1.average());

        Stack<Double> s2 = new Stack<>(new ArrayList<>());
        s2.push(1.1);
        s2.push(2.2);
        s2.push(3.3);
        s2.push(4.4);
        s2.push(5.5);
        System.out.println("Double stack average: " + s2.average());

        System.out.println("Same average? " + s1.compareAverage(s2));
    }
}
import java.util.*;
 
public class GenStackAL<T> {
    ArrayList<T> stack;
	GenStackAL(ArrayList<T> stack){
		this.stack=stack;
	}
	void push(T a){
        stack.add(a);
	}
	T pop(){
		if(stack.size()==0){
			return null;
		}
		else{
            T i= stack.remove(stack.size()-1);
			return i;
		}
		
	}
	void display(){
		if(stack.size()==0){
			System.out.println("Stack is empty");
		}
		else{
			for(int i=stack.size()-1;i>=0;i--){
				System.out.println(stack.get(i));
			}
		}
	}
	
	public static void main(String args[]){
		Scanner sc= new Scanner(System.in);
		ArrayList<Integer> a= new ArrayList<>();
		GenStackAL<Integer> s1= new GenStackAL<>(a);
		
		int op=0;
		Integer ele;
		System.out.println("1.push\n2.pop\n3.Display\n4.Exit");
		while(op!=4){
			
			System.out.print("Enter option: ");
			op=sc.nextInt();
			switch(op){
				case 1:
					System.out.println("enter element to push: ");
					ele = sc.nextInt();
					s1.push(ele);
					break;
				case 2:
					ele=s1.pop();
					if(ele==null){
						System.out.println("Stack is empty");
					}
					else{
						System.out.println("Poped element:"+ele);
					}
					break;
				case 3:
					s1.display();
					break;
				case 4:
					return;
				default :
					System.out.println("Enter valid option");
					
			}
		}
	}
}
import java.util.*;

class Node {
    String key;
    String value;
    Node next;

    Node(String key, String value) {
        this.key = key;
        this.value = value;
        this.next = null;
    }
}

class SeparateChaining {
    private Node[] table;
    private int size;

    SeparateChaining(int capacity) {
        table = new Node[capacity];
        size = capacity;
    }

    private int hash(String key) {
        return Math.abs(key.hashCode()) % size;
    }

    public void put(String key, String value) {
        int index = hash(key);
        Node newNode = new Node(key, value);
        if (table[index] == null) {
            table[index] = newNode;
        } else {
            Node current = table[index];
            while (current.next != null) {
                if (current.key.equals(key)) {
                    current.value = value;
                    return;
                }
                current = current.next;
            }
            current.next = newNode;
        }
    }

    public String get(String key) {
        int index = hash(key);
        Node current = table[index];
        while (current != null) {
            if (current.key.equals(key)) {
                return current.value;
            }
            current = current.next;
        }
        return null;
    }

    public void print() {
        System.out.println("Hash Table (Separate Chaining)");
        for (int i = 0; i < size; i++) {
            Node current = table[i];
            System.out.print("Index " + i + ": ");
            while (current != null) {
                System.out.print("(" + current.key + ", " + current.value + ") -> ");
                current = current.next;
            }
            System.out.println("null");
        }
    }
}

public class Main {
    public static void main(String args[]) {
        Scanner scanner = new Scanner(System.in);
        System.out.println("Enter size of hash table:");
        int size = scanner.nextInt();
        SeparateChaining separateChaining = new SeparateChaining(size);

        System.out.println("Enter key-value pairs (key value):");
        for (int i = 0; i < size; i++) {
            String key = scanner.next();
            String value = scanner.next();
            separateChaining.put(key, value);
        }

        separateChaining.print();

        System.out.println("Enter a key to retrieve its value:");
        String key = scanner.next();
        String retrievedValue = separateChaining.get(key);
        if (retrievedValue != null) {
            System.out.println("Value for key " + key + " is: " + retrievedValue);
        } else {
            System.out.println("Key not found.");
        }
        scanner.close();
    }
}


/*OUTPUT--Chatgpt*/

Enter size of hash table:
5
Enter key-value pairs (key value):
A 1
B 2
C 3
D 4
E 5
Hash Table (Separate Chaining)
Index 0: (A, 1) -> null
Index 1: (B, 2) -> null
Index 2: (C, 3) -> (D, 4) -> null
Index 3: (E, 5) -> null
Index 4: null
Enter a key to retrieve its value:
D
Value for key Bob is: 4
import java.util.*;
class GenStack<T>{
	T stack[];
	int top=-1;
	GenStack(T stack[]){
		this.stack=stack;
	}
	void push(T a){
		if((top+1)==stack.length){
			System.out.println("Stack is full");
		}
		else{
			stack[top+1]=a;
			top=top+1;
		}
	}
	T pop(){
		if(top== -1){
			System.out.println("Stack is empty");
			return null;
		}
		else{
			T i= stack[top];
			top--;
			return i;
		}
		
	}
	void display(){
		if(top==-1){
			System.out.println("Stack is empty");
		}
		else{
			for(int i=top;i>-1;i--){
				System.out.println(stack[i]);
			}
		}
	}
	public static void main(String args[]){
		Scanner sc= new Scanner(System.in);
		System.out.print("Enter size of stack");
		int n=sc.nextInt();
		Integer a[]= new Integer[n];
		GenStack<Integer> s1= new GenStack<Integer>(a);
		s1.push(101);
		s1.push(102);
		s1.push(103);
		s1.push(104);
		s1.push(105);
		s1.display();
		Integer i =s1.pop();
		System.out.println("poped : "+i);
	}
}
import java.util.*;

public class QuadraticProbing<T>
{   
	private static final int DEFAULT_TABLE_SIZE = 101;
	private HashEntry<T>[] array;
	private int currentSize;
	
	public QuadraticProbing()
	{	this(DEFAULT_TABLE_SIZE); }
	
	public QuadraticProbing(int size)
	{	array = new HashEntry[size]; 
		makeEmpty();
	}
	
	public void makeEmpty()
	{   currentSize = 0;
		for(int i=0; i<array.length; i++)
			array[i] = null;
	}
	
	public boolean contains(T element)
	{
		int currentPos = findPos(element);
		return isActive(currentPos);
	}
	
	private int findPos(T element)
	{
		int offset = 1;
		int currentPos = myhash(element);
		while(array[currentPos]!=null&&!array[currentPos].element.equals(element))
		{
			currentPos += offset;
			offset += 2;
			if(currentPos>=array.length)
				currentPos -= array.length;
		}
		return currentPos;
	}
	
	private boolean isActive(int currentPos)
	{
		return array[currentPos]!=null && array[currentPos].isActive;
	}
	
	public void insert(T element)
	{
		int currentPos = findPos(element);
		if(isActive(currentPos))
			return;
		array[currentPos] = new HashEntry<>(element, true);
	}
	
	public void remove(T element)
	{
		int currentPos = findPos(element);
		if(isActive(currentPos))
				array[currentPos].isActive = false;
	}
	
	private int myhash(T element)
	{   
		int hashValue = element.hashCode();
		hashValue %= array.length;
		if(hashValue < 0)
			hashValue += array.length;
		return hashValue;
	}
	
	private static class HashEntry<T>
	{
		public T element;
		public boolean isActive;
		
		public HashEntry(T e)
		{ this(e, true); }
		
		public HashEntry(T e, boolean i)
		{ element = e; isActive = i; }
		
		public T getElement(){ return this.element; }
	}
	
	public void showAll()
	{   for(HashEntry each: array)
			if(each != null)
				System.out.print(each.getElement()+"  ");
			else
				System.out.print("None ");
	}
	
	public static void main(String[] args)
	{
		QuadraticProbing<Integer> sc = new QuadraticProbing(10);
		sc.insert(89); sc.insert(18); sc.insert(49); sc.insert(58); sc.insert(69); 
		sc.showAll();
		
	}
}
 
import java.util.LinkedList;
 
class GenericQueue<T> {
    private LinkedList<T> queue;
 
    public GenericQueue() {
        queue = new LinkedList<>();
    }
 
    // Method to add an element to the queue
    public void enqueue(T element) {
        queue.addLast(element);
    }
 
    // Method to remove and return the element at the front of the queue
    public T dequeue() {
        if (isEmpty()) {
            throw new IllegalStateException("Queue is empty");
        }
        return queue.removeFirst();
    }
 
    // Method to check if the queue is empty
    public boolean isEmpty() {
        return queue.isEmpty();
    }
 
    // Method to get the size of the queue
    public int size() {
        return queue.size();
    }
}
 
public class Main {
    public static void main(String[] args) {
        GenericQueue<String> stringQueue = new GenericQueue<>();
 
        // Enqueue some elements
        stringQueue.enqueue("First");
        stringQueue.enqueue("Second");
        stringQueue.enqueue("Third");
 
        // Dequeue and print elements
        System.out.println("Dequeueing elements:");
        while (!stringQueue.isEmpty()) {
            System.out.println(stringQueue.dequeue());
        }
    }
}
 
public class Container {
    private Object obj;

    public Container(Object obj) {
        this.obj = obj;
    }

    public Object getObj() {
        return this.obj;
    }

    public void showType() {
        System.out.println("Type is: " + obj.getClass().getName());
    }

    public static void main(String[] args) {
        // Container for a String
        Container c1 = new Container("Generics");
        String s = (String) c1.getObj();
        System.out.println("String is: " + s);
        c1.showType();

        // Container for an Integer
        Container c2 = new Container(123);
        int i = (Integer) c2.getObj();
        System.out.println("Integer is: " + i);
        c2.showType();
    }
}


import java.util.*;
class GenQueueAL<T>{
	ArrayList<T> queue;
	GenQueueAL(ArrayList<T> queue){
		this.queue=queue;
	}
	void enqueue(T a){
			queue.add(a);
	}
	T dequeue(){
		T i= null;
		try{
			i= queue.remove(0);
		}catch(Exception e){
			i= null;
		}
		
		return i;
	}
	void display(){
		for(T i:queue){
			System.out.println(i);
		}
	}
	
	public static void main(String args[]){
		Scanner sc= new Scanner(System.in);
		ArrayList<Integer> a= new ArrayList<>();
		GenQueueAL<Integer> q1= new GenQueueAL<Integer>(a);
		int op=0;
		Integer ele;
		System.out.println("1.Enqueue\n2.Dequeue\n3.Display\n4.Exit");
		while(op!=4){
			
			System.out.print("Enter option: ");
			op=sc.nextInt();
			switch(op){
				case 1:
					System.out.println("enter element to enqueue: ");
					ele = sc.nextInt();
					q1.enqueue(ele);
					break;
				case 2:
					ele=q1.dequeue();
					if(ele==null){
						System.out.println("Queue is empty");
					}
					else{
						System.out.println("Dequeued element:"+ele);
					}
					break;
				case 3:
					q1.display();
					break;
				case 4:
					break;
				default :
					System.out.println("Enter valid option");
					
			}
		}
	}
		
		
	}
MyRandom.java:


public interface MyRandom {
    double generate();
}


MyRandomDemo.java:


public class MyRandomDemo {
    public static void main(String[] args) {
        MyRandom random = () -> Math.random();

        System.out.println("Random number: " + random.generate());
    }
}
interface MyFunction<T> {
    T compute(T value);
}

public class GenericLambda {
    public static void main(String[] args) {
        MyFunction<String> reverse = s -> new StringBuilder(s).reverse().toString();
        MyFunction<Integer> factorial = n -> {
            int result = 1;
            for (int i = 2; i <= n; i++) result *= i;
            return result;
        };

        System.out.println("Reversed string: " + reverse.compute("Lambda"));
        System.out.println("Factorial: " + factorial.compute(5));
    }
}
import java.util.*; 
public class LinkedListDemo 
{ 
public static void main(String[] args) 
{ 
LinkedList<String> ll = new LinkedList<>(); 
ll.add("first"); ll.add("second"); ll.add("fourth"); 
System.out.println("Contents: " + ll); 
System.out.println(); 
ll.add(2, "third"); ll.addFirst("zero"); 
System.out.println("Contents: " + ll); 
System.out.println(); 

} 
}
import java.util.Scanner;

interface Factorial {
    int calculate(int n);
}

public class LambdaFactorial {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        System.out.print("Enter a number: ");
        int n = scanner.nextInt();

        Factorial factorial = (num) -> {
            int result = 1;
            for (int i = 2; i <= num; i++) {
                result *= i;
            }
            return result;
        };

        System.out.println("Factorial of " + n + ": " + factorial.calculate(n));
    }
}
import java.util.*; 
 
public class LinkedHashSetDemo 
{ 
 public static void main(String[] args) 
 { 
  LinkedHashSet<String> hs = new LinkedHashSet<>(); 
   
  hs.add("first"); hs.add("second"); hs.add("third");  
  hs.add("fourth"); hs.add("fifth"); hs.add("sixth"); 
   
  System.out.println("Contents: " + hs); 
  System.out.println("Size: " + hs.size()); 
  System.out.println(); 
   
  Object[] arrayS = hs.toArray(); 
  for(Object each: arrayS) 
   System.out.println(each); 
   
  System.out.println(); 
  String[] arrayS2 = new String[hs.size()]; 
  arrayS2 = hs.toArray(arrayS2); 
  for( String each: arrayS2) 
   System.out.println(each); 
   
  System.out.println(); 
  Iterator it = hs.iterator(); 
  while(it.hasNext()) 
   System.out.println(it.next()); 
   
  System.out.println(); 
  System.out.println("Empty? " + hs.isEmpty()); 
  System.out.println(); 
   
  hs.remove("fourth"); 
  System.out.println("Contents: " + hs); 
  System.out.println("Size: " + hs.size()); 
 } 
}  
interface MyOperation {
    void performOperation() throws Exception;
}

public class ExceptionLambdaDemo {
    public static void main(String[] args) {
        MyOperation operation = () -> {
       
            throw new Exception("Exception thrown from lambda expression");
        };

        try {
            operation.performOperation();
        } catch (Exception e) {
            System.out.println("Exception caught: " + e.getMessage());
        }
    }
}
import java.util.*; 
 
public class LinkedHashMapDemo 
{ 
 public static void main(String[] args) 
 { 
  LinkedHashMap<String, Integer> hm = new LinkedHashMap<>(); 
  hm.put("Anand", 20); 
  hm.put("Mary", 20); 
  hm.put("Ravi", 21); 
  hm.put("John",19); 
  System.out.println("Contents: "+hm); 
   
  System.out.println(); 
  Set<String> keys = hm.keySet(); 
  for(String k: keys) 
   System.out.println(k+" -- "+hm.get(k)); 
   
  System.out.println(); 
   
  Set<Map.Entry<String, Integer>> entries = hm.entrySet(); 
  for(Map.Entry<String,Integer> each: entries) 
   System.out.println(each.getKey()+" -- "+each.getValue()); 
   
  System.out.println(); 
 } 
}
interface ExceptionDemo
{ String compute(String s) throws NullPointerException; }

class DemoOfLambdaException
{   public static void main(String[] args)
	{
		ExceptionDemo ed = (str) -> {
		if(str.length()==0 || str==null)
			throw new NullPointerException("No String is available");
		else
			return "The string "+str+" has "+str.length()+" characters.";
	};
	
	java.util.Scanner scan = new java.util.Scanner(System.in);
	System.out.println("Enter a String: ");
	String s = scan.nextLine();
	System.out.println(ed.compute(s));
	}
}
interface Numbers
{ public abstract boolean checkFactor(int n, int m); }

public class LambdaFactor
{
	public static void main(String[] args)
	{
		java.util.Scanner scan = new java.util.Scanner(System.in);
		
		Numbers factor = (n, m) -> (n%m)==0;
		
		System.out.println("Enter two numbers: ");
		int n = scan.nextInt(); int m = scan.nextInt();
		System.out.println(m + " is a factor of " + n + ": " + factor.checkFactor(n, m));
	}
}
import java.util.*;

class LinearProb {
    int csize, maxsize;
    String keys[];
    String vals[];

    LinearProb(int capacity) {
        csize = 0;
        maxsize = capacity;
        keys = new String[maxsize];
        vals = new String[maxsize];
    }

    public int hash(String key) {
        return Math.abs(key.hashCode()) % maxsize; // Corrected hash function
    }

    public void insert(String key, String val) {
        int index = hash(key);
        while (keys[index] != null && !keys[index].equals(key)) {
            index = (index + 1) % maxsize; // Linear probing
        }
        keys[index] = key;
        vals[index] = val;
        csize++;
    }

    public void print() {
        System.out.println("Hash Table");
        for (int i = 0; i < maxsize; i++) {
            if (keys[i] != null) {
                System.out.println(keys[i] + " " + vals[i]);
            }
        }
    }
}

public class Main {
    public static void main(String args[]) {
        Scanner s = new Scanner(System.in);
        System.out.println("Enter size");
        int capacity = s.nextInt();
        LinearProb lp = new LinearProb(capacity);
        for (int i = 0; i < capacity; i++) {
            System.out.println("Enter key and val");
            lp.insert(s.next(), s.next());
        }
        lp.print();
    }
}


import java.util.*;

interface Value{
	public Double pi();
}
public class LambdaPI{
	public static void main(String args[]){
		Value pi = ()-> {
			return 3.14;
		};
		System.out.print("PI value: "+pi.pi());
	}
}
star

Thu May 30 2024 10:09:57 GMT+0000 (Coordinated Universal Time) https://developers.google.com/ad-manager/mobile-ads-sdk/android/browser/webview

@calazar23 #kotlin

star

Thu May 30 2024 10:09:13 GMT+0000 (Coordinated Universal Time) https://developers.google.com/ad-manager/mobile-ads-sdk/android/browser/webview

@calazar23

star

Thu May 30 2024 10:09:08 GMT+0000 (Coordinated Universal Time) https://developers.google.com/ad-manager/mobile-ads-sdk/android/browser/webview

@calazar23 #kotlin

star

Thu May 30 2024 10:08:32 GMT+0000 (Coordinated Universal Time) https://developers.google.com/ad-manager/mobile-ads-sdk/android/browser/webview

@calazar23 #kotlin

star

Thu May 30 2024 10:08:25 GMT+0000 (Coordinated Universal Time) https://developers.google.com/ad-manager/mobile-ads-sdk/android/browser/webview

@calazar23 #java

star

Thu May 30 2024 10:08:15 GMT+0000 (Coordinated Universal Time) https://developers.google.com/ad-manager/mobile-ads-sdk/android/browser/webview

@calazar23 #java

star

Thu May 30 2024 10:00:23 GMT+0000 (Coordinated Universal Time) https://github.com/Azure/azure-sdk-for-js/blob/main/documentation/next-generation-quickstart.md

@Shookthadev999

star

Thu May 30 2024 10:00:03 GMT+0000 (Coordinated Universal Time) https://voice.google.com/u/0/blocked

@curtisbarry

star

Thu May 30 2024 09:28:59 GMT+0000 (Coordinated Universal Time)

@calazar23

star

Thu May 30 2024 09:12:46 GMT+0000 (Coordinated Universal Time) https://azuresdkdocs.blob.core.windows.net/$web/javascript/azure-arm-netapp/21.0.0/index.html

@Shookthadev999

star

Thu May 30 2024 08:45:10 GMT+0000 (Coordinated Universal Time) https://deno.land/x/openai@v4.47.1

@Shookthadev999

star

Thu May 30 2024 08:45:04 GMT+0000 (Coordinated Universal Time) https://deno.land/x/openai@v4.47.1

@Shookthadev999

star

Thu May 30 2024 07:54:36 GMT+0000 (Coordinated Universal Time) https://forums.garmin.com/sports-fitness/running-multisport/f/forerunner-745/245640/software-version-3-40---forerunner-745---live

@curtisbarry

star

Thu May 30 2024 07:46:54 GMT+0000 (Coordinated Universal Time) https://thorium.rocks/

@Shookthadev999

star

Thu May 30 2024 07:41:21 GMT+0000 (Coordinated Universal Time)

@Shookthadev999 #undefined

star

Thu May 30 2024 07:39:25 GMT+0000 (Coordinated Universal Time) https://support.google.com/stadia/answer/13067284?sjid

@curtisbarry

star

Thu May 30 2024 06:58:17 GMT+0000 (Coordinated Universal Time) https://www.freecodecamp.org/news/how-to-create-a-responsive-html-email-template/

@Disdark10 #html

star

Thu May 30 2024 05:44:49 GMT+0000 (Coordinated Universal Time) https://www.thiscodeworks.com/user/dashboard

@tushar1256

star

Thu May 30 2024 04:10:41 GMT+0000 (Coordinated Universal Time)

@signup

star

Thu May 30 2024 00:48:21 GMT+0000 (Coordinated Universal Time) https://devpod.sh/open#https://github.com/madskristensen/NpmTaskRunner

@shookthacr3ator

star

Thu May 30 2024 00:38:08 GMT+0000 (Coordinated Universal Time) https://github.com/madskristensen/NpmTaskRunner

@shookthacr3ator

star

Thu May 30 2024 00:35:09 GMT+0000 (Coordinated Universal Time) https://marketplace.visualstudio.com/items?itemName

@shookthacr3ator

star

Wed May 29 2024 23:24:37 GMT+0000 (Coordinated Universal Time) https://www.lookmovie2.to/movies/play/14088510-tarot-2024

@curtisbarry

star

Wed May 29 2024 23:19:53 GMT+0000 (Coordinated Universal Time) https://github.com/devcontainers/features/actions/runs/9293386780/job/25576406144

@shookthacr3ator

star

Wed May 29 2024 22:15:51 GMT+0000 (Coordinated Universal Time) https://www.npmjs.com/package/auto-counter-ui

@shookthacr3ator

star

Wed May 29 2024 19:40:23 GMT+0000 (Coordinated Universal Time)

@exam123

star

Wed May 29 2024 19:30:54 GMT+0000 (Coordinated Universal Time)

@exam123

star

Wed May 29 2024 19:30:18 GMT+0000 (Coordinated Universal Time)

@exam123

star

Wed May 29 2024 19:29:59 GMT+0000 (Coordinated Universal Time)

@exam123

star

Wed May 29 2024 19:29:32 GMT+0000 (Coordinated Universal Time)

@exam123

star

Wed May 29 2024 19:29:09 GMT+0000 (Coordinated Universal Time)

@exam123

star

Wed May 29 2024 19:28:10 GMT+0000 (Coordinated Universal Time)

@exam123

star

Wed May 29 2024 19:27:45 GMT+0000 (Coordinated Universal Time)

@exam123

star

Wed May 29 2024 19:27:08 GMT+0000 (Coordinated Universal Time)

@exam123

star

Wed May 29 2024 19:26:45 GMT+0000 (Coordinated Universal Time)

@exam123

star

Wed May 29 2024 19:25:50 GMT+0000 (Coordinated Universal Time)

@exam123

star

Wed May 29 2024 19:25:20 GMT+0000 (Coordinated Universal Time)

@exam123

star

Wed May 29 2024 19:24:38 GMT+0000 (Coordinated Universal Time)

@exam123

star

Wed May 29 2024 19:23:52 GMT+0000 (Coordinated Universal Time)

@exam123

star

Wed May 29 2024 19:22:45 GMT+0000 (Coordinated Universal Time)

@exam123

star

Wed May 29 2024 19:22:20 GMT+0000 (Coordinated Universal Time)

@exam123

star

Wed May 29 2024 19:22:02 GMT+0000 (Coordinated Universal Time)

@exam123

star

Wed May 29 2024 19:21:32 GMT+0000 (Coordinated Universal Time)

@exam123

star

Wed May 29 2024 19:21:08 GMT+0000 (Coordinated Universal Time)

@exam123

star

Wed May 29 2024 19:20:45 GMT+0000 (Coordinated Universal Time)

@exam123

star

Wed May 29 2024 19:20:20 GMT+0000 (Coordinated Universal Time)

@exam123

star

Wed May 29 2024 19:19:50 GMT+0000 (Coordinated Universal Time)

@exam123

star

Wed May 29 2024 19:19:24 GMT+0000 (Coordinated Universal Time)

@exam123

star

Wed May 29 2024 19:18:55 GMT+0000 (Coordinated Universal Time)

@exam123

star

Wed May 29 2024 19:18:33 GMT+0000 (Coordinated Universal Time)

@exam123

Save snippets that work with our extensions

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