instruction_seed stringlengths 0 26.4k | source stringclasses 4
values |
|---|---|
You are tasked with creating a program to automate the retrieval of weather information for a given location. The program uses the UIA2Automation library to interact with a legacy weather application. Your task is to implement the `RequestWeatherFor` method, which takes a location as input and retrieves the weather inf... | codefeedback |
You are tasked with implementing a hardware identification (HWID) generation and verification system. The HWID is a unique identifier for a computer's hardware configuration. The system should generate a HWID and compare it with a predefined value to determine if the hardware is authorized. Additionally, the system sho... | codefeedback |
You are tasked with creating a script to automate the setup of log rotation for a web server. The script needs to append a command to the daily cron job file to execute the log rotation configuration file. The log rotation configuration file is located at `/etc/logrotate.conf`, and the daily cron job file is located at... | codefeedback |
You are working on a compiler project and need to implement a new optimization pass for constant folding. Constant folding is the process of recognizing and evaluating constant expressions at compile time rather than at runtime. This optimization can significantly improve the performance of the generated code.
In the ... | 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 the system should be able to handle multiple accounts.
Your task is to... | codefeedback |
You are tasked with implementing a function that checks whether a given string is a palindrome or not. A palindrome is a word, phrase, number, or other sequence of characters that reads the same forward and backward, ignoring spaces, punctuation, and capitalization.
You need to create a function `isPalindrome` that ta... | codefeedback |
You are tasked with creating a Swift function that processes a TOML configuration file to extract translation options for a localization tool. The TOML file contains settings for updating and translating content, including a secret key, file path, and source locale. Your goal is to implement the function to parse the T... | codefeedback |
You are tasked with creating a program to train and evaluate a multi-class classification model using PyTorch. The dataset consists of four classes, each with a set of input data points. The input data points for each class are defined using the `torch` library. The input data points are generated by adding random nois... | codefeedback |
You are tasked with creating a Python program that simulates a simplified version of a command-line interface for running tests using Tox, a generic virtualenv management and test command line tool. Your program should take a string of Tox arguments as input and execute the Tox command using the provided arguments.
Yo... | codefeedback |
You are tasked with implementing a loss function for a computer vision model that performs object detection. The provided code snippet is part of a larger codebase and is responsible for calculating and validating the losses for class predictions and bounding box predictions.
The code snippet shows the calculation of ... | codefeedback |
You are tasked with creating a program to analyze the licensing information of a given GitHub repository. The program should parse the license information from the repository's README file and determine the type of license used. For the purpose of this problem, you can assume that the license information is always incl... | codefeedback |
You are tasked with creating a script to automate the creation of multiple databases based on a given range of port numbers. The script should utilize a provided database name, administrator username, and a template database to create individual databases with specific owners and templates.
Your task is to write a she... | codefeedback |
You are given a Python class `Point` with three attributes `x`, `y`, and `z` representing the coordinates of a point in 3D space. The class also contains two methods: `CalcAngle` and `VectNorm3`. The `CalcAngle` method calculates the angle between two points in the XY plane, while the `VectNorm3` method calculates the ... | codefeedback |
You are tasked with implementing a simplified version of a build system in Swift. The build system is responsible for compiling source files and handling their deletion. Your task is to create a class that manages the build process and handles the compilation of source files.
You are provided with a partial code snipp... | codefeedback |
You are tasked with implementing a Trie data structure in Python. A Trie, also known as a prefix tree, is a tree-like data structure used to store a dynamic set of strings. Each node in the Trie represents a single character of the string. The root node is empty, and each node contains links to its child nodes represen... | codefeedback |
You are tasked with simulating a game environment where a player can shoot at an enemy. The game has a player position, a direction for shooting, and a height constant. The provided code snippet is a part of the game logic, where certain conditions are checked and corresponding messages are written to an output file. Y... | codefeedback |
You are tasked with implementing a custom asynchronous I/O stream in Rust. The stream is represented by the `CustomStream` struct, which contains a field `recv_stream` of type `RecvStream`. The `CustomStream` struct also has a method `async_poll_read` that takes a mutable reference to a `ReadBuf` and returns a `Poll` c... | codefeedback |
You are tasked with creating a script to automate the process of copying and updating files and directories between two different project directories. Your script should perform the following operations:
1. Remove the directory `Documents/workspace/microting/eform-angular-frontend/eform-client/src/app/plugins/modules/... | codefeedback |
You are working on a React application that utilizes custom hooks for managing state and side effects. In the `src/hooks/index.ts` file, you need to implement a custom hook called `useLocalStorage` that allows components to store and retrieve data from the browser's local storage.
The `useLocalStorage` hook should hav... | codefeedback |
You are tasked with creating a program that manages a collection of items and provides the ability to convert these items to a specific string representation. To achieve this, you need to implement a class with a method that allows setting a converter function for the items in the collection.
You are given the followi... | codefeedback |
You are tasked with creating a Python function that processes a given string and returns the count of all occurrences of a specific word within that string. The function should be case-insensitive and should consider only whole word matches. Additionally, the function should ignore any punctuation or special characters... | codefeedback |
You are tasked with implementing a view function for a social media platform that handles the creation of new posts. The code snippet provided is a part of the view function and contains logic for fetching posts and checking user authentication and group membership.
Your task is to complete the implementation of the v... | codefeedback |
You are tasked with implementing a payment system that supports multiple payment methods such as WeChat, Alipay, and UnionPay. The system should allow users to make payments and query payment information using the respective payment methods.
You are provided with a partial code snippet that demonstrates the usage of t... | codefeedback |
You are tasked with implementing a custom exception handling mechanism for a file processing application. The application processes various types of files, such as text files, image files, and audio files. Your goal is to create a custom exception hierarchy to handle different types of file processing errors.
You need... | codefeedback |
You are tasked with implementing a simple module system for a document viewing application. The module system should allow for the registration and retrieval of document viewer modules. Each module will have a unique name and will provide functionality for viewing specific types of documents.
You are provided with a b... | codefeedback |
You are tasked with creating a Python class that interacts with the Todoist API to manage projects and their subprojects. Your class should have the following functionalities:
1. Initialize the class with an API key, which will be used to authenticate with the Todoist API.
2. Retrieve completed tasks from specified pr... | codefeedback |
You are working on a web application that manages users' skills and their corresponding levels. The application uses the Laravel framework for backend development. You need to implement a new feature that allows users to associate their skills with their social authentication accounts. The code snippet provided is a pa... | codefeedback |
You are tasked with implementing a password update functionality for a user management system. Your task is to create a function that will update the password of a user, given their old password and the new password they wish to set. You are provided with a code snippet from a PHP Laravel application that demonstrates ... | codefeedback |
You are tasked with creating a program to manage an employee's internet usage deductions from their salary. The program should take the initial salary as input and then iterate through the tabs the employee has open in their browser. For each tab, a specific deduction should be made from the salary based on the website... | codefeedback |
You are tasked with implementing a Python decorator that handles rate limits for API requests. The decorator should ensure that the decorated function does not exceed a specified rate limit, and if it does, it should wait until the rate limit allows for further execution.
Your task is to complete the implementation of... | codefeedback |
You are tasked with creating a Python program that reads data from an Excel file, performs some data manipulation, and then writes the modified data to a new Excel file. The input Excel file contains a sheet named "SalesData" with the following columns: "Date", "Product", "Quantity", and "Revenue". Your task is to read... | codefeedback |
You are tasked with implementing a class for an orthographic camera in a 3D graphics rendering system. The provided code snippet includes part of the implementation for the orthographic camera class. The class has two private member variables, `near_plane` and `far_plane`, and three member functions: a constructor to s... | codefeedback |
You are tasked with implementing a function that processes geographic data and generates shader buffers for rendering points on a map. The provided code snippet is a TypeScript function that processes a FeatureCollection of points or multi-points and generates shader buffers based on a given style option.
Your task is... | codefeedback |
You are tasked with implementing a command-line argument parser for a scientific computing library. The parser should handle various configuration options for a continuous normalizing flow (CNF) model. The provided code snippet shows a part of the argument parser configuration.
Your task is to create a Python function... | codefeedback |
You are tasked with creating a Discord bot command that allows users to change their nickname to a randomly selected option from a predefined list. The bot has a command called "fcb" which is only accessible to a specific member with ID 283204260781490176. The bot also has the necessary permissions to manage nicknames.... | codefeedback |
You are tasked with creating a CUDA kernel function that performs element-wise addition of two 1D arrays and stores the result in a third array. Your task is to complete the given CUDA kernel function `sum_1DArrays` to achieve this functionality.
The provided code snippet includes a CUDA kernel function `sum_1DArrays`... | codefeedback |
You are tasked with creating a utility function to parse and process attributes of a custom class in C#. The custom class, `SCLExampleAttribute`, contains two properties: `SCL` of type `int` and `Description` of type `string`. Your task is to implement the `ParseSCLAttribute` function that takes an instance of `SCLExam... | codefeedback |
You are tasked with implementing a simple XML parser using the provided abstract delegate class as a base. The abstract delegate class contains pure virtual functions that need to be overridden to handle different XML events. Your task is to create a concrete subclass of the abstract delegate and implement these functi... | codefeedback |
You are tasked with implementing a data processing algorithm to load objects into a database table. The input data consists of a list of objects, each containing several fields. Your goal is to write a function that takes this input and loads the objects into the specified database table. The function should also log t... | codefeedback |
You are tasked with implementing a custom grid layout system for a mobile application. The grid should display labels and input fields in a specific arrangement. Each label and input field should be added to the grid with specified row and column positions, and optionally, column span. The grid should also have defined... | codefeedback |
You are tasked with creating a script to automate the deployment of a microservices architecture using Docker Compose. The architecture consists of three services: event-bus, consumer, and producer. The event-bus service is responsible for handling communication between the consumer and producer services. The consumer ... | codefeedback |
You are given a list of integers representing the scores of a series of games. The task is to write a function that finds the highest score achieved in the series.
Write a function `find_highest_score(scores)` that takes in a list of integers `scores` (1 <= len(scores) <= 100) representing the scores of the games. The... | 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. The function should also handle cases where users attempt to withdraw more funds than are available in their account.
Your t... | codefeedback |
You are tasked with creating a Python program to manage log files generated by a system. The program should be able to organize log files into daily directories and move log files older than a certain threshold to an archive directory. Additionally, the program should be able to generate a report summarizing the number... | codefeedback |
You are tasked with implementing a subclass of the `SSBaseViewController` class in Swift. The subclass, `CustomViewController`, should have a method `customizeView` that sets the background color of the view to a specific color based on the time of day. The color should change dynamically according to the following rul... | codefeedback |
You are tasked with implementing a program to analyze a given text file and count the occurrences of each word in the file. The program should ignore case sensitivity and punctuation, and only consider alphanumeric characters as part of a word. Additionally, the program should output the top N most frequently occurring... | codefeedback |
You are tasked with implementing a Python module that provides functionality for automatically collecting data from various sources. The module should include a function called `auto_collection` that can collect data from different sources and return a consolidated result.
The `auto_collection` function should accept ... | codefeedback |
You are tasked with implementing a parser for a simple programming language that supports return statements, variable declarations, and expressions. The language's grammar rules are provided in the form of a code snippet:
```
28. return-statement -> return return-follow
29. return-follow -> ;
| express... | codefeedback |
You are given a list of integers representing the daily temperatures. Your task is to create a program that returns a new list that, for each day in the input list, tells you how many days you would have to wait until a warmer temperature. If there is no future day for which this is possible, put 0 instead.
For exampl... | codefeedback |
You are tasked with creating a form component for adding context packs in an Angular application. The component class `AddContextpacksComponent` is provided, which includes a property `contextPackForm` of type `FormGroup`. Your goal is to implement the form in the HTML template and handle the form submission in the com... | codefeedback |
You are tasked with implementing a custom payloader for the Opus audio codec. The payloader takes an input payload and splits it into smaller payloads based on a maximum transmission unit (MTU) size. The provided code snippet outlines the beginning of the implementation for the OpusPayloader struct, which is intended t... | codefeedback |
You are tasked with creating a Rust function that generates a Tezos encoding for a given data type. Tezos is a blockchain platform that utilizes a specific encoding scheme for data serialization. Your task is to implement a function that takes a data type and its size, and then generates the corresponding Tezos encodin... | codefeedback |
You are tasked with creating a Python class that can read data from a stored npz file and a mat file, and then perform specific operations on the data. Your task is to implement the missing methods in the given Python class to achieve this functionality.
You are provided with a partial implementation of the Python cla... | codefeedback |
You are tasked with implementing a simple system for managing entities in a game engine. The game engine uses the ECS (Entity-Component-System) architecture, where entities are composed of various components and systems operate on entities based on their components. Your goal is to create a system that processes entiti... | codefeedback |
You are tasked with creating a Python class that interacts with web content using the requests and BeautifulSoup libraries. Your class should have a method to retrieve and parse HTML content from a given URL. Additionally, you need to implement a method to extract specific information from the parsed content.
Create a... | codefeedback |
You are tasked with creating a C# class that implements a custom middleware for an ASP.NET Core application. The middleware should log the request method, path, and response status code for each incoming HTTP request. Your task is to complete the implementation of the middleware class by adding the necessary code to ac... | codefeedback |
You are tasked with implementing a function that processes a list of strings representing switch configurations. Each string in the list represents a single switch configuration, and the function needs to extract specific information from each configuration.
The function should take a list of strings `switches` as inp... | codefeedback |
You are tasked with creating a script that automates the installation process for a software package. The script should handle the installation for different user accounts and ensure that the installation is performed in the correct directory. Your task is to write a Bash script that accomplishes this.
Your script sho... | codefeedback |
You are tasked with implementing a VLAN stack parser for a network configuration management system. The system receives configuration commands in the form of strings, and it needs to extract specific information related to VLAN stacking from these commands.
The input string `cmd` contains configuration information for... | codefeedback |
You are tasked with implementing a TypeScript function that merges multiple configuration objects into a single object, resolving any conflicts by giving priority to the values from the later objects. The configuration objects represent settings for different services, and the merged object should contain the combined ... | codefeedback |
You are tasked with implementing a simplified version of a drawing manager in a graphical user interface (GUI) application. The provided code snippet is a part of this implementation and involves creating drawers and blocks on a canvas. Your task is to write a function that processes the given input data and generates ... | codefeedback |
You are tasked with implementing a command-line tool that simulates a simple game using the provided code snippet as a starting point. The game involves navigating a player through a grid-based environment, avoiding obstacles, and reaching a goal. Your task is to extend the existing code to handle the game logic and co... | codefeedback |
You are tasked with implementing a command-line program that searches for a given query string in a specified file. The program should be able to handle both case-sensitive and case-insensitive searches. Your task is to complete the implementation of the `Config` struct and its associated methods to achieve this functi... | codefeedback |
You are tasked with creating a game scoring system for an endless runner game. The game has a player controller, an enemy system, and various game objects. The provided code snippet is a part of the scoring system and contains a coroutine method `AddScore()` that is responsible for adding score, triggering boss death, ... | codefeedback |
You are tasked with implementing a stream observation mechanism in Swift. You are provided with a code snippet that includes a closure property `onStartStream` and a class `MockStream`. The `onStartStream` closure is intended to observe the creation of new streams and will be called each time the `newStreamPrototype()`... | codefeedback |
You are tasked with implementing a function to read an offset from a byte array. The function should find two sequential 32-bit unsigned integers (u32) in the byte array and return their sum as a 64-bit unsigned integer (u64). The byte array must have a length of at least 11 bytes, and the function should panic if this... | codefeedback |
You are given a class `binary_indexed_tree` that represents a binary indexed tree data structure. The class has a private member `std::vector<T> dat` to store the tree nodes and a private method `merge` to combine two nodes. The constructor initializes the tree with a given size and a neutral element `NEUTRAL`. Additio... | codefeedback |
You are tasked with implementing a reinforcement learning environment for a simple game. The game involves a player navigating a grid-based world to reach a goal while avoiding obstacles. To achieve this, you need to create a class that represents the game environment and handles the game logic. Additionally, you will ... | codefeedback |
You are tasked with implementing a function to process access logs and extract specific information from them. The access logs are represented as an associative array with three keys: "rows", "categories", and "total". The "rows" key contains an array of log entries, the "categories" key contains an array of categories... | codefeedback |
You are working on a project that involves analyzing the color temperature of different LED illuminants. The color temperature of an illuminant is typically represented by its coordinates on the CIE 1931 chromaticity diagram, which are denoted by two values (x, y). You have been given a function `led_illuminant_data` t... | codefeedback |
You are tasked with creating a Python unit test for a function that calculates the factorial of a given number. The function to be tested is called `calculate_factorial` and is defined in a module named `factorial_module`. Your goal is to write a unit test using the `unittest` framework to ensure that the `calculate_fa... | codefeedback |
You are tasked with creating a script to manage symbolic links for configuration files in a user's home directory. The script should take a list of source files from a specified directory and create symbolic links for them in the user's home directory. Additionally, the script should provide options to control the beha... | codefeedback |
You are tasked with creating a Python class that simulates a simple banking system. The class should have methods for depositing funds, withdrawing funds, and checking the account balance. Additionally, the class should implement event handling for certain actions, similar to the code snippet provided.
Your task is to... | codefeedback |
You are tasked with implementing a simple user interface for a text-based adventure game. The game consists of a series of rooms, each with its own description and possible exits to other rooms. Your goal is to create a user interface that allows the player to navigate through the game by entering commands to move betw... | codefeedback |
You are working on a mobile application for an online course platform. The code snippet provided is a part of the networking layer responsible for fetching the course catalog. The `getCourseCatalog` function makes a network request to retrieve a paginated list of courses. The `Params` enum contains various query parame... | codefeedback |
You are tasked with creating a program that simulates a delivery route optimization system. The program should take a list of delivery locations and their corresponding distances, and then output the optimized route based on the shortest distance.
You are given a Python code snippet that prints the current route. Your... | codefeedback |
You are tasked with creating a script to automate the training of a neural machine translation (NMT) model using the nmt.nmt module. The script should take in various input parameters and execute the training process. Your task is to write a Python script that can generate the necessary command to train the NMT model b... | codefeedback |
You are tasked with implementing a notification system for a messaging application. The system should allow users to subscribe to specific topics and receive notifications when a message is posted to a subscribed topic. You need to design a class that manages the subscriptions and sends notifications to the appropriate... | codefeedback |
You are tasked with creating a function to process and analyze stock data. The function should load stock data from a manager, unwrap the data, and then check if there are any records for stocks. If there are no records, it should fail the test. Your task is to implement the function `loadDataForStocks` in the `manager... | codefeedback |
You are tasked with implementing a simple note-taking application. The application should allow users to add new notes and modify existing notes. The application uses a `Notebook` class with the following methods:
1. `new_note`: This method takes a memo as input and adds it as a new note to the notebook.
2. `modify_no... | codefeedback |
You are tasked with creating a program that analyzes a given text file to determine the frequency of each word in the file. Your program should read the text file, tokenize the words, and then count the occurrences of each word. However, the program should exclude any words that appear in a list of common stop words.
... | codefeedback |
You are tasked with implementing a function to parse a file path and extract specific information from it. The file path follows a specific format, and your function should be able to extract the filename, directory path, and the number of stars associated with the file from the given input.
Write a function `parseFil... | codefeedback |
You are tasked with debugging and optimizing a PHP function that interacts with a database and a caching system. The function is responsible for handling banner data and cache management. Your goal is to identify and fix any issues in the given code snippet and optimize the cache management process.
The function recei... | codefeedback |
You are tasked with implementing a custom neural network layer for point cloud processing using PyTorch. The layer, called SetAbstraction, is a crucial component of the PointNet++ architecture for hierarchical feature learning on point sets in a metric space. The SetAbstraction layer is responsible for downsampling and... | codefeedback |
You are tasked with implementing a function to perform a specific operation on a given input array. The input array is represented as a vector of 32-bit unsigned integers. Your task is to write a function that takes this input array and performs a transformation on it. The transformation involves doubling the value of ... | codefeedback |
You are tasked with creating a Python function that analyzes a list of stock tickers to identify the most profitable trade. Each stock ticker is represented as a tuple containing the ticker symbol and a list of stock prices over a period of time. The function should return the maximum profit that can be achieved by buy... | codefeedback |
You are tasked with implementing a function that processes a two-dimensional array representing a grid of products and their prices. The function should calculate the total price of all the products in the grid and return the result. Each product's price is represented by a numerical value in the grid.
The grid is rep... | codefeedback |
You are tasked with creating a program that validates and filters email addresses based on a specific pattern. The program should take an input string representing an email address and determine if it matches the given pattern. If it does, the program should print the email address; otherwise, it should not output anyt... | codefeedback |
You are tasked with implementing a custom comparison function for a class representing electronic devices. The comparison function should adhere to the following requirements:
- `EXPECT_NE(device1, device2)` asserts that `device1` is not equal to `device2`.
- `EXPECT_NE(device1, device3)` asserts that `device1` is not ... | codefeedback |
You are tasked with implementing a custom data structure to manage the state and appearance of toggle switches in a user interface. The provided code snippet is part of a Swift codebase for a UI library, and it defines extensions and type aliases for the `VToggleModel` struct, which represents the configuration of a to... | codefeedback |
You are tasked with implementing a function to watch for changes in a MongoDB database using Swift. The provided code snippet is a part of a Swift function that sets up a change stream to monitor changes in a MongoDB collection. Your task is to complete the implementation of the `watch` function by providing the missin... | codefeedback |
You are tasked with creating a script to generate a self-signed SSL certificate using OpenSSL. Your script should take input for the certificate's common name (CN) and output the private key and certificate files.
Your script should accept the following input:
- `CN`: The common name for the SSL certificate.
The scri... | codefeedback |
You are tasked with implementing a Python class that performs linting on JavaScript files using a predefined configuration. The class should be able to validate JavaScript files based on the provided configuration and return a list of linting errors.
You are provided with a default configuration dictionary `DEFAULT_CO... | codefeedback |
You are tasked with implementing a key deletion action for a curve editor. The curve editor manages a set of keys, each with a position and value. The provided code snippet is part of the implementation for the "remove keys" action in the curve editor. Your task is to complete the implementation of the `CurveDeleteKeys... | codefeedback |
You are given a Python code snippet that simulates a game between two players, Takahashi and Aoki. Your task is to understand the code and implement the logic behind the game.
The code snippet is as follows:
```python
print("Takahashi")
else:
k = 1
cri = seki(k, row // 2)
if n < cri:
print... | codefeedback |
You are working on a project management system that involves querying and processing data related to projects, interfaces, and cases. The code snippet provided is a part of a Python class that contains methods for querying data based on project IDs. Your task is to implement a new method to query and process data based... | codefeedback |
You are given an array containing n distinct numbers taken from the range 0 to n. However, one number is missing from the array. Your task is to write a function to find the missing number.
Write a function `find_missing_number` that takes in an array of integers and returns the missing number.
Example:
Input: [3, 0,... | codefeedback |
You are tasked with implementing a simplified version of a scene management system for a 2D game. The scene is represented as a grid, and each cell in the grid can contain a "dot" object. The provided code snippet is part of the implementation and involves creating and manipulating dot objects within the scene.
The `d... | codefeedback |
You are tasked with implementing a GraphQL server using Apollo Server for a web application. Your task is to configure the Apollo Server with specific settings and extensions based on the given code snippet.
Given the code snippet, you need to set up the Apollo Server with the following configurations:
1. Set the cont... | codefeedback |
You are given a code snippet that initializes a boolean variable `flg` to `false` and an integer variable `newfrom` to `0`. Your task is to write a function that takes an array of integers and a target integer as input and returns the index of the target integer in the array. If the target integer is not found in the a... | codefeedback |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.