instruction_seed stringlengths 0 26.4k | source stringclasses 4
values |
|---|---|
You are tasked with creating a Java program to manage a simple inventory system for a small retail store. The program should allow the user to add new products, update existing products, remove products, and display the current inventory.
You are provided with a partial code snippet that includes the necessary imports... | codefeedback |
You are tasked with implementing a downloader middleware for a web scraping application. The middleware should utilize Selenium to handle the downloading of web pages. The provided code snippet configures the middleware and enables the use of Selenium for web scraping.
Your task is to create a Python class that serves... | codefeedback |
You are tasked with implementing a file processing algorithm that reads a large input file in chunks, processes each chunk, and writes the processed data to an output file. The provided code snippet is a part of the file processing algorithm. It writes the processed data block to a temporary file and measures the time ... | codefeedback |
You are tasked with implementing a method to verify the correctness of a one-shot array or span-to-array conversion. A one-shot array is an array that is only used once and then discarded. The goal is to ensure that the conversion from a span to an array, or the direct usage of the array, produces the expected results.... | codefeedback |
You are tasked with implementing a residual dense block for a convolutional neural network. A residual dense block is a key component in many state-of-the-art deep learning architectures, particularly in image processing tasks. The provided code snippet is the beginning of a Python class that defines a residual dense b... | codefeedback |
You are tasked with implementing a function that calculates the sum of all prime numbers within a given range. A prime number is a natural number greater than 1 that has no positive divisors other than 1 and itself. Your function should take two integers, `start` and `end`, as input and return the sum of all prime numb... | codefeedback |
You are tasked with creating a function to convert durations (in ticks) to note names based on a given time signature. The time signature is represented by the "ppq" (pulses per quarter note) value, and the note names should be in the format of 'quarter', 'eighth', 'eighth triplet', 'sixteenth', 'thirty-second', 'thirt... | codefeedback |
You are tasked with implementing a trait for decoding a custom enum type in Rust. The enum `PowerStatus` represents the power state of a device, with variants `Off` and `On` corresponding to the values 0 and 1, respectively. The trait `AtDecode` provides a method `decode` for decoding the enum from a serial input strea... | codefeedback |
You are tasked with creating a program to manage animations for a mobile application. The program should define a class `AnimationManager` that can create and manage different types of animations. The animations should include rotation animations and group animations. The `AnimationManager` class should provide methods... | codefeedback |
You are tasked with creating a script to automate the process of formatting C source files using the `uncrustify` tool. The `uncrustify` command is used to apply a specific code style configuration to C files. However, due to a known issue with `uncrustify` not being idempotent, it may flip-flop between two indentation... | codefeedback |
You are tasked with creating a PHP class that interacts with a database to retrieve system configuration information. The provided code snippet is a partial implementation of the `System` class, which extends the `Commons` class and is located in the `app\common\model` namespace. The class contains a method `systemBase... | codefeedback |
You are tasked with implementing a URL path parser for a web server framework. The framework has a class `Route` that represents a route definition, and it contains various properties and methods for handling HTTP requests. The code snippet provided defines a route named `_updateForecast` with a specific URL path patte... | codefeedback |
You are tasked with creating a script to automate the generation and execution of training configurations for a deep learning model using the CIFAR-10 dataset. The provided code snippet is part of a larger script that involves modifying a template configuration file, setting environment variables, and executing the tra... | codefeedback |
You are tasked with creating a script to automate the deployment process for a GitHub repository. The script should handle the authentication with GitHub and the deployment to Bintray based on certain conditions.
Your task is to write a Bash script that accomplishes the following:
1. Set up authentication with GitHub ... | codefeedback |
You are tasked with implementing a Python class that performs date and time comparisons. Your class should have a method that compares two given dates and returns the result based on their year, month, day, hour, minute, second, and millisecond values.
You are given a code snippet that calculates a value based on the ... | codefeedback |
You are tasked with implementing a Python class that simulates the behavior of a simple 2D game character. The class, named `GameCharacter`, should have the following functionalities:
1. A method named `calculate_distance` that takes two points as input and returns the Euclidean distance between them.
2. A method name... | codefeedback |
You are given a Python code snippet that involves the use of the `sympy` library. Your task is to create a function that takes a mapping and an expression as input and returns the expression with the mapping applied. The mapping is a dictionary where the keys are original elements and the values are the replacements. T... | codefeedback |
You are tasked with implementing a function that repositions a match within a given line and column in a text document. The function `reposition_match` takes four parameters: `line` (the line number), `col` (the column number), `m` (a match object), and `vv` (a variable). The match object `m` has a property `match` whi... | codefeedback |
You are tasked with implementing a Python function that processes a list of environment variables and their associated file names. The function should perform several operations, including repeating file names and environment variable types, and sorting the optional environment variables. Your task is to complete the i... | codefeedback |
You are tasked with creating a Python class that simulates a simple asynchronous task scheduler. The scheduler should be able to execute tasks concurrently using asynchronous execution. Your task is to implement the `AsyncTaskScheduler` class with the following specifications:
- The `AsyncTaskScheduler` class should h... | codefeedback |
You are given an array of integers `a` of length `n`. Your task is to implement a function `moveZerosToEnd` that moves all the zeros in the array to the end without changing the order of the non-zero elements. The function should take the array `a` and its length `n` as input and should modify the array in-place.
The ... | codefeedback |
You are tasked with implementing a Python function that simulates a simple text-based game. The game involves a character navigating through a grid-based world, represented by a 2D array. The character can move up, down, left, or right within the grid, and the objective is to reach a specific destination coordinate.
Y... | codefeedback |
You are tasked with implementing a specific ETL (Extract, Transform, Load) process using Python. The ETL process involves taking a dictionary of DataFrames as input, performing some transformations on the data, and then returning the transformed data in a new dictionary of DataFrames.
You are provided with a base clas... | codefeedback |
You are tasked with creating a Python function that parses a netlist file and converts it into a Skidl netlist object. The netlist file represents the connections and components of an electronic circuit. The function should take the filename of the netlist file as input and return the corresponding Skidl netlist object... | codefeedback |
You are tasked with implementing a module resolution algorithm for a JavaScript module system. The system uses the `export` statement to make functions and variables available for use in other modules. When a module imports another module using the `import` statement, the module resolution algorithm must determine the ... | codefeedback |
You are tasked with implementing a recursive function to select an element from an array based on a set of indices. The function takes in two parameters: `index_bits_be` - a reference to an array of elements of type `Scalar<F>`, and `array` - a reference to an array of elements of type `Scalar<F>`. The function returns... | codefeedback |
You are tasked with implementing a simple physics simulation for bouncing balls in a 2D space. You are given a `Ball` class in Swift, which inherits from `UIView` and has the following properties:
- `color`: A property representing the color of the ball.
- `elasticity`: A property representing the elasticity of the bal... | codefeedback |
You are tasked with implementing a function to process and analyze a list of detections from a sensor. Each detection is represented as a tuple containing the x and y coordinates of the detected object. The goal is to identify and count the number of unique objects detected within a certain range of each other. Two obj... | codefeedback |
You are tasked with creating a Python function that processes a JSON input to generate a list of commands based on certain criteria. The function should extract specific data from the JSON and use it to construct a list of commands for further processing. The function should handle various conditions and produce the de... | codefeedback |
You are given an array of integers `nums` and an integer `target`. Write a function `twoSum` that takes `nums` and `target` as input and returns the indices of the two numbers such that they add up to the `target`.
You may assume that each input would have exactly one solution, and you may not use the same element twi... | codefeedback |
You are working on a project to model different types of aquifers for a hydrology research institute. Aquifers are underground layers of water-bearing rock, gravel, sand, or silt from which groundwater can be extracted. You have been provided with a Python code snippet that defines two classes, `Aquifer_yr` and `Aquife... | codefeedback |
You are tasked with creating a program that simulates a build system for a software project. The build system uses a domain-specific language (DSL) for defining project requirements and dependencies. Your goal is to implement a simplified version of the build system that can process project requirements and generate th... | codefeedback |
You are tasked with creating a Python function that simulates a simple banking system. The function should allow users to create accounts, deposit funds, withdraw funds, and check their balance. Each account should have a unique account number and should store the account holder's name and current balance. The function... | codefeedback |
You are tasked with implementing a custom content provider for a college database in an Android application. The provided code snippet outlines the initial setup for the content provider, including the definition of the content URI and the base content provider class. Your task is to extend this content provider to han... | codefeedback |
You are working on a project that involves parsing and processing protocol buffer definitions. Protocol buffers are a language-agnostic, platform-neutral way of serializing structured data. Your task is to write a function that extracts and organizes information from a given protocol buffer definition.
You are given a... | codefeedback |
You are working as a bioinformatics analyst at a research institute, and your task is to automate the process of aligning DNA sequencing data using the BWA (Burrows-Wheeler Aligner) tool. The provided code snippet is a part of a shell script that automates the indexing and alignment steps using BWA.
Your task is to wr... | codefeedback |
You are given a string containing a series of characters. Your task is to write a function that finds the longest substring of consecutive vowels (a, e, i, o, u) within the given string. If there are multiple substrings of the same length, return the first one found. If there are no vowels in the string, return an empt... | codefeedback |
You are tasked with implementing a custom logging system in a shell script. The logging system should support different log levels and output messages to both standard output and standard error. You are provided with a code snippet that includes a function for setting the log colors and another function for outputting ... | codefeedback |
You are tasked with creating a Python function that takes a directory path as input and performs a specific operation on the configuration files within that directory. The operation involves loading YAML files, merging their contents into a configuration object, and then returning the merged configuration.
You are pro... | codefeedback |
You are tasked with creating a Python script that simulates a scenario service for a master system. The scenario service is responsible for generating and managing various scenarios that the master system will execute. The scenarios are defined by a set of parameters and actions to be performed.
Your task is to implem... | codefeedback |
You are tasked with implementing a function to extract information about a generator model used in a deep learning framework. The function should take in various arguments related to the generator model and return specific information about its architecture.
You are provided with a code snippet that initializes a gene... | codefeedback |
You are tasked with implementing a class hierarchy for a menu theme system. The provided code snippet shows a private constructor for a class named `MenuTheme`, which takes a `name` and a `value` as parameters. Your task is to create the complete class hierarchy for the menu theme system, including the `MenuTheme` clas... | codefeedback |
You are working on a project that involves integrating SDL Translation Studio with a custom desktop application. As part of this integration, you need to develop a C# program that interacts with the SDL Translation Studio Automation API to perform specific translation tasks.
Your task is to create a C# program that ut... | codefeedback |
You are tasked with creating a program that processes geographical coordinates to determine the distance traveled by a vehicle. The input data consists of latitude and longitude coordinates, which may be provided either as individual points or as a line string. Your task is to develop a function that calculates the tot... | codefeedback |
You are tasked with implementing a custom data structure called `SortedStack` that behaves like a stack but maintains its elements in sorted order. The `SortedStack` class should support the following operations:
1. `push(val)`: Adds a new element `val` to the stack while maintaining the sorted order.
2. `pop()`: Remov... | codefeedback |
You are tasked with implementing a Python class that simulates a download manager. The class, named `DownloadManager`, should support the following functionalities:
1. `add_download(url: str)`: A method to add a new download to the manager. The `url` parameter is a string representing the URL of the file to be downloa... | codefeedback |
You are tasked with implementing a custom event handling system in a C# application. The provided code snippet is a part of a class that manages focus-related events. The `FocusExit` method is called when the focus is about to exit a particular element in the application. Your task is to complete the implementation of ... | codefeedback |
You are working on a project that involves information coupling for various modules related to natural language processing and computer vision. The code snippet provided includes imports from different modules, each responsible for information coupling in a specific domain. Your task is to create a function that dynami... | codefeedback |
You are tasked with creating a custom middleware in a Laravel application to perform authentication checks for specific routes. The middleware should verify if the user making the request has the necessary permissions to access the route.
Your task is to implement a middleware named `PermissionMiddleware` that will c... | codefeedback |
You are tasked with creating a Python function that simulates a simple URL routing system similar to Django's URL patterns. The function should take a list of URL patterns and a URL as input, and then return the corresponding view function for the given URL.
The URL patterns are represented as a list of tuples, where ... | codefeedback |
You are tasked with implementing a color conversion function for a graphics library. The function takes an input color array and converts it to a proper format for further processing. The input color array can be in various formats, such as a list of strings, a numpy array of floats or integers, or a single color value... | codefeedback |
You are tasked with implementing a Python function that performs a specific type of string substitution. The function should take a string and a dictionary of substitutions as input and return the string with the substitutions applied. Substitutions should be performed in a way that ensures no partial substitutions occ... | codefeedback |
You are tasked with implementing a Python class that represents an image processing tool. The class should have a method to resize the image to a specified dimension. Your task is to complete the implementation of the `resize_image` method in the `ImageProcessor` class. The method should take in the new dimensions (wid... | codefeedback |
You are tasked with implementing a function to distribute a given dataset across multiple GPUs using TensorFlow's MirroredStrategy. The function should take the dataset and the number of GPUs as input and return the distributed dataset.
You are given the following code snippet as a starting point:
```python
def main(... | codefeedback |
You are tasked with creating a program to process radio signals received by a software-defined radio (SDR) device. The program needs to incorporate error handling and configuration settings based on external files.
Your program should read the content of a file named "ppm-error.txt" if it exists, and store the content... | codefeedback |
You are tasked with implementing a method to remove all special symbols from a given string. Special symbols are defined as any non-alphanumeric characters, excluding spaces. Your task is to create a Java method that takes a string as input and returns a new string with all special symbols removed.
Create a method wit... | codefeedback |
You are tasked with implementing a user authentication system in Python. Your task is to create a class `User` with the following functionalities:
1. `UpdateUsername(username)`: A method to update the username of the user.
2. `UpdatePassword(password)`: A method to update the password of the user.
The `User` class sho... | codefeedback |
You are given two arrays of integers, A and B. Your task is to write a function `intersect` that returns a list of integers representing the intersection of the two arrays. The intersection is defined as the set of elements that are common to both arrays. Each element in the result should appear as many times as it sho... | codefeedback |
You are tasked with creating a PHP script that interacts with a MySQL database using PDO (PHP Data Objects). Your script should perform the following tasks:
1. Connect to a MySQL database named "modulo_8" hosted on "localhost" with the username "root" and an empty password.
2. Create a new table named "users" with the ... | codefeedback |
You are given a graph represented as an adjacency list and you are required to determine if the graph is bipartite. A graph is bipartite if it can be colored using two colors such that no two adjacent nodes have the same color.
Write a function `isBipartite(graph)` that takes in an adjacency list `graph` and returns `... | codefeedback |
You are tasked with creating a program that analyzes the frequency of words in a given text. Your program should take a string of text as input and output the frequency of each word in the text. For the purpose of this problem, a word is defined as a sequence of characters separated by spaces, and punctuation should be... | codefeedback |
You are tasked with implementing a program that calculates the sum of all prime numbers within a given range. A prime number is a natural number greater than 1 that has no positive divisors other than 1 and itself. Your program should take two integers, `start` and `end`, as input and return the sum of all prime number... | codefeedback |
You are tasked with creating a function that processes HTML table data and generates a specific output based on the content of the table. The function should take an HTML string as input and return a modified version of the HTML with specific changes applied.
The input HTML string will contain a table with multiple ro... | codefeedback |
You are working on a game bot that interacts with an API to equip items, engage in battles, and collect loot. The provided code snippet is a part of the bot's logic. The bot first equips a part using the `api.equip_part` function, then gets an opponent using the `api.get_opponent` function. After that, it iterates thro... | codefeedback |
You are tasked with implementing a Python class for a custom loss layer in a neural network. The provided code snippet is a part of the class definition and contains a method for setting up the layer's parameters and printing their values. Your task is to complete the implementation of the class by defining the missing... | codefeedback |
You are tasked with creating a program that analyzes the frequency of words in a given text. Your program should take a string of text as input and output the frequency of each word in the text. For the purpose of this problem, a word is defined as a sequence of characters separated by spaces. The program should ignore... | codefeedback |
You are tasked with creating a simple event handling system using Java and the Akka framework. Your goal is to implement an event handler that can process events and perform specific actions based on the type of event received.
You are provided with a basic event handling interface `Handler` and a test case using Akka... | codefeedback |
You are tasked with creating a Swift function that takes in an HTML string and returns the count of unique HTML tags present in the string. For the purpose of this problem, an HTML tag is defined as any substring enclosed within angle brackets, such as `<div>`, `<p>`, or `<a href="https://example.com">`.
Your task is ... | codefeedback |
You are tasked with implementing a notification system in a C# application. The system should allow the display of toasts in the notification area, with the ability to set an expiration time, handle click and close events, and utilize a cancellation token.
Your task is to create a class `NotificationManager` with the ... | codefeedback |
You are tasked with implementing a command-line interface for a simple text-based application. The application should support a set of predefined commands, including the ability to add, remove, and list items. Your task is to implement the functionality for the "run_command" function, which takes a command as input and... | codefeedback |
You are tasked with creating a Python function that processes a given text and returns a dictionary containing the frequency of each word in the text. You are provided with a code snippet that sets up a fixture for the text to be used in testing the function.
Your task is to implement the `word_frequency` function, wh... | codefeedback |
You are tasked with creating a script to automate the generation of a README file for a software project. The script should combine content from multiple files and output the final README file.
Write a Bash script that performs the following tasks:
1. Concatenates the content of a file named `readme-intro.md` with the... | codefeedback |
You are tasked with implementing a thread-safe mechanism for managing authentication triggers in a Swift application. The provided code snippet includes the declaration of some relevant properties and a lock object.
You need to create a class `AuthenticationManager` with the following requirements:
1. Implement a meth... | codefeedback |
You are tasked with implementing a Python class that processes image data to identify and remove seams. A seam is a connected path of pixels in an image that has the lowest energy cost. The given code snippet imports the necessary classes `SEAM` and `TileBase` from the module `seam_data`.
Your task is to create a clas... | codefeedback |
You are tasked with implementing a simple memory management system for a programming language that supports object-oriented features. The system should handle the initialization and deinitialization of objects, ensuring that memory is properly allocated and deallocated.
You are given a code snippet representing the st... | codefeedback |
You are given a list of events, each represented by a tuple containing the event name and its start time. Your task is to write a function that takes this list of events and returns a new list containing only the events that do not overlap with each other. Two events are considered to be overlapping if their start time... | codefeedback |
You are tasked with creating a program that performs various operations on three input numbers. The program should calculate the sum, difference, product, quotient, and average of the three numbers. You need to write a C++ program to achieve this functionality.
Your program should prompt the user to enter three number... | codefeedback |
You are tasked with implementing a Python class for a simple ray tracer. The provided code snippet is a part of the `Emissive` class, which is a subclass of the `Material` class. The `Emissive` class is responsible for handling emissive materials in the ray tracer. It takes a color as input and initializes the `texture... | codefeedback |
You are tasked with implementing a function to parse experiment configurations from a file and update certain parameters based on the environment and specific requirements. Your task is to complete the function `parse_experiment_config` which takes the name of the experiment as a string and returns the updated experime... | codefeedback |
You are tasked with implementing a function to calculate the repelling force exerted on an object within a 2D window. The code snippet provided contains part of the logic for this calculation. The window dimensions are represented by `win_width` and `win_height`, and the position of the object is represented by the `po... | codefeedback |
You are tasked with creating a Python class that processes TrueType font files to extract and store information about the font's features. TrueType font files are commonly used for rendering text in various applications. Your task is to implement a class called `FontProcessor` with the following requirements:
1. The c... | codefeedback |
You are working on a distributed task processing system that utilizes Celery, a distributed task queue for Python. In this system, tasks are defined as functions and are executed asynchronously by worker processes. One of the tasks in the system is the `predict_image` task, which is responsible for making predictions o... | codefeedback |
You are tasked with implementing a Swift class that manages a payload string and supports encoding and decoding operations. The class should have the following requirements:
1. Create a class named `PayloadManager` with a property `payloadString` of type `String`.
2. Implement an initializer `init(payload: String)` th... | codefeedback |
You are tasked with implementing a Python function that trains a machine learning model and saves it to a file. The function should take in training data, train the model using a specified algorithm, and then save the trained model to a file in a specified format.
You are provided with the following code snippet as a ... | codefeedback |
You are tasked with creating a script to automate the testing process for a game developed in Roblox. The game is stored in a file named `studio-tests.rbxl`, and the testing script is located at `tests/init.server.lua`. The `run-in-roblox` command is used to execute the testing process. Your goal is to write a Python s... | codefeedback |
You are tasked with implementing a caching mechanism for a web application. The cache will store the results of expensive computations to improve performance. Your goal is to create a generic caching system that can be used to store and retrieve the results of any function. The cache should be able to handle different ... | codefeedback |
You are tasked with designing a data migration script for a legacy system that involves a Django model called `LegacyBillMapping`. This model is used to map legacy bill IDs to modern bill objects in a Django application. The `LegacyBillMapping` model has two fields: `legacy_id` and `bill`. The `legacy_id` field is a ch... | codefeedback |
You are tasked with creating a program to calculate the final amount to be paid for a purchase, along with the installment details, based on the chosen payment method. The program should take the purchase amount and the payment method as input and then output the final amount to be paid and the installment details.
Th... | codefeedback |
You are tasked with implementing a module resolution system for a TypeScript project. The system should be able to resolve and export types and modules from a given file. Your task is to write a function that takes a file path and returns an object containing the exported types and modules.
You are given the following... | codefeedback |
You are tasked with creating a Python function that validates the format of an email address. The function should take a string as input and return True if the input string is in a valid email format, and False otherwise. An email address is considered valid if it follows the standard format of "username@domain.extensi... | codefeedback |
You are tasked with implementing a C++ class that manages information about different types of compilers. The class, `CompilerInfoState`, should be able to store and retrieve information about C++ compilers, Dart analyzers, and fake compilers. The class should also provide a method to update the compiler information an... | codefeedback |
You are working on a software build system that involves evaluating a set of build numbers based on given ranges. The build numbers are used as references for running tests and builds. However, the same build numbers may be referenced multiple times, leading to redundant evaluations and wasted time. To optimize the pro... | codefeedback |
You are tasked with implementing a Python class that represents a multi-level neural network. The class should have an `__init__` method that initializes the network with the given input shape, number of input channels, number of levels, and number of features. The `__init__` method should also print a message indicati... | codefeedback |
You are tasked with creating a program that simulates a simple text-based adventure game. The game will involve the player navigating through different rooms, encountering obstacles, and making decisions that affect the outcome of the game.
Your program should include the following features:
- The game should start wi... | codefeedback |
You are tasked with implementing a class for solving a simplified elastic shell model using a Newton static solver. The given code snippet is part of a larger program and contains a method `fullSimNewtonStaticSolver` within the `ShellSolver` class. The method takes in an `ElasticSetup` object, an `ElasticState` object,... | codefeedback |
You are tasked with implementing a Python class method that calculates distances between two sets of observations. The method should handle two scenarios: when `infos_first` and `infos_second` are both provided, and when either of them is `None`. If either `infos_first` or `infos_second` is `None`, the method should fa... | codefeedback |
You are tasked with creating a Python function that processes a given convolutional neural network (CNN) model and returns the volume size of the output tensor after passing through the model's convolutional base.
The function should take the CNN model as input and return the volume size of the output tensor.
The vol... | codefeedback |
You are tasked with implementing a Python function that can manipulate a list of integers based on a given set of operations. The function should take a list of integers as input and perform the following operations in sequence:
1. Remove all even numbers from the list.
2. Double the value of each remaining number.
3.... | codefeedback |
You are tasked with developing a Python script to parse a configuration file and extract specific key-value pairs. The configuration file follows a simple format where each line consists of a key-value pair separated by a colon. The keys and values may contain alphanumeric characters, underscores, and hyphens. Addition... | codefeedback |
You are tasked with creating a custom error type in Rust for a WebAssembly (Wasm) compiler. The error type should be able to display an error message when encountered during the compilation process. Your goal is to implement the custom error type and handle it appropriately in the given Rust code.
Your task is to comp... | codefeedback |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.