instruction stringlengths 11 298 |
|---|
Create a SQL script that defines a table for storing employee records, including fields for ID, name, department, and hire date. Include constraints to ensure the ID is unique and the hire date cannot be in the future. |
Write a SQL query that retrieves all customers from a database who have made purchases within the last 30 days, along with their total purchase amount. Ensure you use appropriate joins if necessary. |
Develop a bash script that monitors disk usage on a Linux system and sends an alert email if usage exceeds 80%. The script should run every hour using cron jobs. |
Construct a SQL stored procedure that accepts a product ID as input and returns the current stock level and price of that product. Handle cases where the product does not exist gracefully. |
Write a PowerShell script that checks the status of services on a Windows machine and restarts any service that is stopped. Log the actions taken by the script to a file. |
Create a bash script that automates the backup of a specified directory to a remote server via SCP. The script should include error handling to manage failed transfers. |
Implement a PowerShell function that takes a string as input and reverses it. Additionally, check if the reversed string is a palindrome and return a message indicating whether it is or not. |
Write a C program that implements a simple linked list data structure, allowing users to add, remove, and display elements. Include functions for memory management to prevent leaks. |
Design a SQL query that calculates the average salary of employees grouped by department, ensuring to exclude departments with no employees. |
Create a C++ class that represents a basic calculator capable of performing addition, subtraction, multiplication, and division. Implement exception handling for division by zero. |
Design a SQL database schema for an online bookstore. Include tables for books, authors, and customers. Write queries to retrieve the top 5 bestselling books and all books by a specific author. |
Create a Python script that fetches weather data from a public API and stores it in a SQLite database. The script should run daily and log any errors encountered during execution. |
Implement a simple banking application in Java where users can create accounts, deposit money, withdraw money, and check their balance. Ensure proper exception handling for invalid operations. |
Write a C++ program that simulates a basic ATM interface allowing users to check balance, deposit funds, and withdraw cash. Use classes to encapsulate account details and transactions. |
Develop a SQL query to find duplicate entries in a user table based on email addresses and write a procedure to delete those duplicates while keeping one entry per email. |
Create a Java application that reads a list of products from a JSON file and allows users to search for products by name or category. Implement sorting functionality as well. |
Build a Java program that implements a basic version of the game |
Tic-Tac-Toe |
with a command-line interface. Allow two players to take turns and display the winner at the end. |
Write a JavaScript function that takes a string input and returns the number of vowels and consonants in that string. Ensure the function is case-insensitive and handles special characters appropriately. |
Implement a GoLang service that uses goroutines to concurrently process multiple requests for calculating Fibonacci numbers. Each request should return the result after computing it asynchronously. |
Create a C# console application that interacts with PyTorch via a REST API to train a simple neural network model on a dataset of your choice. Display training progress and results in the console. |
Create a PowerShell script that accepts a directory path as input and lists all files in the directory along with their sizes. The script should also allow filtering by file extension, such as '.txt' or '.jpg'. |
Write a C# console application that implements a simple task manager. Users should be able to add tasks with descriptions and due dates, mark them as complete, and list all tasks sorted by due date. |
Develop a JavaScript function that takes an array of numbers and returns a new array containing only the prime numbers from the original array. Include error handling for non-numeric inputs. |
Implement a basic linked list in C. The program should support adding elements to the list, removing elements, and displaying the contents of the list in order. |
Create a SQL query that retrieves the top 5 highest-paid employees from an 'employees' table, including their names and salaries. Ensure the results are ordered by salary in descending order. |
Build a JavaScript countdown timer that counts down from a specified number of seconds to zero. When the timer reaches zero, it should display an alert message saying 'Time's up!'. |
Write a Python script that generates a random password based on user-defined criteria: length, inclusion of uppercase letters, lowercase letters, digits, and special characters. The generated password should be printed to the console. |
Design a Java class that represents a Book with attributes like title, author, and ISBN. Implement methods to compare two books for equality based on their ISBNs and to print book details. |
Create a Java program that simulates a simple ATM machine where users can check their balance, deposit money, and withdraw money. Use appropriate exception handling for insufficient funds. |
Write a Bash script that monitors disk usage on your system and sends an email alert if any partition exceeds a specified threshold (e.g., 90% usage). |
Create a simple command-line calculator in C++ that supports addition, subtraction, multiplication, and division. The program should accept two numbers and an operator as input from the user and display the result. Ensure to handle division by zero gracefully. |
Build a dynamic web page using JavaScript that displays a list of random quotes fetched from a public API. Include functionality for users to add their own quotes which will be stored temporarily during the session. |
Write a PowerShell script that retrieves system information such as CPU usage, memory usage, and disk space. Format the output neatly and allow the user to export this information to a text file if desired. |
Implement a basic linked list in C. Provide functions to insert, delete, and display elements of the list. Additionally, include error handling for invalid operations like deleting from an empty list. |
Create a simple quiz application using JavaScript where users can answer multiple-choice questions. Keep track of scores and provide feedback at the end of the quiz based on the user's performance. |
Design a SQL database schema for a library management system. Include tables for books, authors, members, and loans. Write queries to retrieve all books currently checked out along with member details. |
Develop a bash script that monitors a specified directory for any new files added. When a new file is detected, log its name and timestamp into a separate log file. |
Write a GoLang application that implements a RESTful API for managing a collection of tasks (CRUD operations). Each task should have a title, description, and completion status. |
Create a bash script that automates the backup of a specified directory to a remote server via SCP. Include options for scheduling the backups and logging the results of each operation. |
Using CherryPy, create a small web application in Python that allows users to submit feedback through a form. Store the feedback in memory and display it on another page. |
Create a bash script that monitors a specified directory for any new files. When a new file is detected, the script should log the filename and timestamp to a separate log file. Ensure the script runs continuously in the background until manually stopped. |
Write a GoLang program that implements a simple REST API for managing a list of books. The API should support adding, deleting, and retrieving book information stored in memory, with each book having a title, author, and publication year. |
Develop a C program that simulates a basic ATM machine. The program should allow users to check their balance, deposit money, and withdraw money while ensuring proper error handling for insufficient funds or invalid inputs. |
Create a bash script that automates the process of backing up a specified directory to a remote server using rsync. The script should accept command line arguments for the source directory and destination server details. |
Implement a C++ class that represents a 2D point and includes methods for calculating the distance between two points, as well as translating the point by a given offset. Provide a demonstration of its usage in the main function. |
Write a C# console application that connects to a PostgreSQL database and retrieves all records from a specified table. The application should display the results in a user-friendly format and handle any potential connection errors gracefully. |
Design an SQL query that finds the top three employees with the highest salaries from an 'employees' table. Include necessary joins if the data is spread across multiple tables related to departments and positions. |
Create a C program that reads a string input from the user and counts the number of vowels and consonants in it. The program should ignore spaces and punctuation and print the counts accordingly. |
Develop a PowerShell script that generates a report of all running processes on the system, including their CPU and memory usage. The report should be saved to a text file with a timestamp in the filename. |
Write a Java application that simulates a simple banking system where users can create accounts, deposit, and withdraw money. The application should store account information in memory and ensure thread safety during concurrent access. |
Create a bash script that monitors system resource usage (CPU, memory) and logs the data to a file every minute. The script should also send an alert if CPU usage exceeds 80% or memory usage exceeds 75%. |
Write a C program that implements a simple command-line calculator supporting addition, subtraction, multiplication, and division. It should handle invalid input gracefully and allow continuous calculations until the user decides to exit. |
Develop a C# console application that manages a library of books. Users should be able to add new books, remove existing ones, and search for books by title or author. Include basic validation for book entries. |
Implement a JavaScript function that takes an array of numbers and returns a new array containing only the prime numbers from the original array. Ensure the solution is efficient and handles edge cases appropriately. |
Create a bash script that automates the process of backing up a specified directory to a remote server using rsync. The script should accept parameters for the source directory and destination server details, including SSH credentials. |
Write a Python program that uses NumPy to generate a random matrix of size n x n and calculates its determinant. The program should prompt the user for the value of n and handle any exceptions related to invalid inputs. |
Design a bash script that checks for the presence of specific services running on a Linux machine (e.g., Apache, MySQL). If any service is not running, the script should attempt to start it and log the actions taken. |
Create a JavaScript web application that fetches and displays weather information based on user input for a city name. Use a public API to retrieve the weather data and present it in a user-friendly format. |
Write a Java program that simulates a basic ATM interface allowing users to check their balance, deposit money, and withdraw cash. Implement appropriate error handling for insufficient funds and invalid transactions. |
Develop a GoLang application that reads a list of integers from standard input, sorts them using a sorting algorithm of your choice, and prints the sorted list to the console. |
Create a simple web application using JavaScript that allows users to input their favorite books. The app should store the data in local storage and display the list of books with options to edit or delete entries. |
Develop a console-based C# application that simulates a basic banking system. Users should be able to create accounts, deposit money, withdraw money, and check their balance. Ensure proper validation for transactions. |
Write an SQL query to find the top 5 employees with the highest salaries from a table named 'employees'. Include their names and departments in the output. |
Construct an SQL statement that retrieves all products from a 'products' table where the stock is below a certain threshold, ordered by price in ascending order. |
Implement a C# class representing a Rectangle with properties for width and height. Include methods to calculate the area and perimeter, as well as a method to determine if it is a square. |
Create a Python script that fetches weather data from a public API and displays the current temperature and conditions for a given city. Handle any potential errors gracefully. |
Build a JavaScript function that takes an array of numbers and returns a new array containing only the even numbers. Make sure to handle edge cases like empty arrays or non-numeric values appropriately. |
Design a C# program that reads a string input from the user and counts the number of vowels and consonants in the string. Display the results in a user-friendly format. |
Write an SQL command to update the status of orders in an 'orders' table to 'shipped' where the shipping date is today. Ensure you consider only orders that are currently marked as 'pending'. |
Create a JavaScript function that interacts with OpenSearch to perform a search query based on user input. The function should return and display the titles of the first five matching documents. |
Create a simple web application using JavaScript that allows users to create, read, update, and delete notes. Each note should have a title and content, and the data should be stored in local storage. |
Write a GoLang program that implements a basic HTTP server with two endpoints: one for returning the current time in JSON format and another for returning a greeting message. Ensure proper error handling is included. |
Develop a bash script that monitors disk usage on a Linux system. The script should send an alert email if the disk usage exceeds 80%. |
Create a PowerShell script that retrieves information about all running processes on a Windows machine and outputs it to a text file, including process name, ID, and memory usage. |
Design a SQL query that creates a table named 'employees' with fields for id, name, position, and salary. Additionally, write a query to insert at least three records into this table. |
Implement a PowerShell function that takes a directory path as input and lists all files within that directory, along with their sizes and last modified dates. |
Write a C# console application that connects to a MongoDB database, inserts a new document representing a book (with title, author, and publication year), and then retrieves and displays all books from the collection. |
Create a bash script that automates the backup of a specified directory by compressing its contents into a tar.gz file and saving it to a designated backup location. |
Develop a bash script that generates a random password of a specified length, ensuring it includes uppercase letters, lowercase letters, numbers, and special characters. |
Write a Python program that interacts with a Cassandra database to store user profiles. Each profile should include a username, email, and age, and the program should allow adding and retrieving profiles. |
Create a simple command-line calculator in C that supports addition, subtraction, multiplication, and division. The program should accept two numbers and an operator as input from the user and display the result. Ensure to handle division by zero gracefully. |
Develop a basic text-based RPG game in C++ where players can create characters with attributes like health, strength, and agility. Implement a combat system where characters can attack each other until one is defeated. Include a simple menu for starting a new game or loading an existing character. |
Write a PowerShell script that retrieves the current weather information for a specified city using a public API. The script should output the temperature, humidity, and a brief description of the weather conditions. |
Implement a console-based todo list application in C#. Users should be able to add tasks, mark them as complete, and delete them. Store the tasks in memory during runtime and allow users to view all tasks at any time. |
Create a simple banking system simulation in C++. Allow users to create accounts, deposit money, withdraw money, and check their balance. Each account should have a unique ID and support multiple transactions before exiting the program. |
Build a web scraper in JavaScript that fetches titles and links from a given website's homepage. Use Node.js and ensure the scraper handles errors appropriately if the site is down or unreachable. |
Design a SQL database schema for a library management system. Create tables for books, members, and loans, including appropriate relationships between them. Write queries to retrieve available books and loan history for a specific member. |
Write a C program that implements a linked list data structure. Include functions to insert, delete, and search for elements within the list. Demonstrate the functionality through a simple menu-driven interface. |
Create a multi-threaded C program that simulates a producer-consumer problem using semaphores. Implement shared buffers and ensure proper synchronization between threads while producing and consuming items. |
Develop a simple RESTful API in GoLang that manages a collection of books. Implement endpoints to create, read, update, and delete book records, ensuring data validation and error handling throughout the process. |
Create a PowerShell script that retrieves the current system's environment variables and outputs them in a formatted table. The script should allow for filtering by variable name using command line arguments. |
Write a JavaScript function that takes an array of numbers and returns a new array containing only the prime numbers from the original array. Ensure to include comments explaining your logic and any helper functions used. |
Implement a simple memory allocator in C that mimics malloc and free functionality. It should manage a fixed-size block of memory and handle allocation requests while keeping track of allocated and free blocks. |
Develop a C++ class representing a basic stack data structure with methods for push, pop, and checking if the stack is empty. Include exception handling for underflow conditions when popping from an empty stack. |
Create a C++ program that simulates a basic banking system where users can create accounts, deposit money, withdraw money, and check their balance. Use classes to represent accounts and ensure proper encapsulation of account details. |
Write a Python script that fetches weather data from a public API based on user input for location. The script should display the temperature, humidity, and weather condition in a readable format. |
Design a SQL query that retrieves all employees from a company database who have been hired within the last year and sorts them by their hire date in descending order. Assume you have access to a table named 'employees' with relevant fields. |
Create a GoLang application that uploads files to Google Cloud Storage (GCS). The app should accept file paths as command-line arguments and upload each specified file to a designated GCS bucket, printing success or error messages accordingly. |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.