instruction_seed stringlengths 0 26.4k | source stringclasses 4
values |
|---|---|
You are tasked with implementing a function that appends a new log file path to a registry key in C++. The function should handle the following requirements:
Function Signature:
```cpp
bool AppendLogFilePath(const base::FilePath& log_file);
```
Input:
- `log_file`: A `base::FilePath` object representing the path of t... | codefeedback |
You are tasked with implementing a method to test the functionality of a tokenization specification in the Google Pay configuration. The tokenization specification is responsible for defining how payment credentials are tokenized for secure transactions. Your task is to create a test case that validates the correctness... | codefeedback |
You are tasked with implementing a PredictableRandomNumberGenerator class in Swift. This class should generate a sequence of pseudo-random numbers based on a predictable algorithm. The algorithm should produce the same sequence of numbers given the same initial seed. Your task is to implement the PredictableRandomNumbe... | codefeedback |
You are tasked with creating a program that analyzes a given text and identifies the frequency of each word in the text. The program should ignore punctuation, capitalization, and consider words with the same letters but different cases as the same word. Additionally, the program should exclude common English stop word... | codefeedback |
You are tasked with implementing a function that simulates a ticketing system for a popular event. The function should manage the availability of tickets and handle the process of reserving and releasing tickets for customers.
You are given a Swift code snippet that demonstrates the use of a semaphore to control acces... | codefeedback |
You are tasked with implementing a custom solver for a neural network training framework. The solver will be based on the Adam optimization algorithm, which is a popular method for stochastic gradient descent. The code snippet provided initializes the context for the Adam solver and imports necessary modules.
Your tas... | codefeedback |
You are tasked with implementing a shell script function that checks whether an image tag exists in a given Docker registry. The function `image_tag_exists` takes two arguments: the Docker image name and the tag to be checked. The function should return a boolean value indicating whether the specified tag exists for th... | codefeedback |
You are tasked with implementing a simple caching mechanism for frequently accessed data. Your goal is to create a class that efficiently stores and retrieves answers to a set of questions. The class should allow for quick access to the answers based on the question index. Additionally, the class should support the abi... | codefeedback |
You are tasked with creating a Python function that interacts with the Travis CI API to trigger a build for a specific repository. The function should take in the organization name, repository name, and an authentication token as input parameters. It should then construct the appropriate API request URL and send a POST... | codefeedback |
You are tasked with implementing a generic tree data structure and its associated operations. The tree structure consists of nodes that can hold different types of data. Each node can have zero or more child nodes, forming a hierarchical structure. Additionally, the tree supports the concept of a "return" expression, w... | codefeedback |
You are tasked with implementing a data structure to store and retrieve financial market data related to yield curves. A yield curve represents the relationship between the yield on a bond and its time to maturity. The provided code snippet is a comment describing the result format for affected curves and currencies, b... | codefeedback |
You are tasked with creating a Swift function that interacts with a backend API to create a list of user objects. The function takes in an array of user objects, a dispatch queue for handling API responses, and a completion handler to receive the result. Your goal is to implement the `createUsersWithListInput` function... | codefeedback |
You are given a function `grayCodeGenerator()` that generates a sequence of Gray codes. Gray codes are a binary numeral system where two successive values differ in only one bit. Your task is to implement the function `grayCodeGenerator()` and write a program to demonstrate its usage.
The `grayCodeGenerator()` functio... | codefeedback |
You are tasked with implementing a function that processes a configuration object for handling the "Enter" key press event in a chat application. The configuration object contains various parameters and settings related to this event handling. Your goal is to extract specific information from the configuration and use ... | codefeedback |
You are tasked with implementing a class to manage the position of a point in a 2D space. The class should support operations to update the position of the point based on the difference between two given points.
Create a class `PointManager` with the following methods:
1. `setInitialPosition(x, y)`: A method to set th... | codefeedback |
You are tasked with implementing a family tree data structure in JavaScript. The `FamilyTree` class should allow for the creation of a family tree and provide methods to add new family members, retrieve family members, and determine relationships between family members.
Your task is to implement the `FamilyTree` class... | codefeedback |
You are tasked with implementing a middleware component for a web application that will handle authentication and authorization. The middleware should be designed to allow or deny access to resources based on the presence of a specific HTTP header in the incoming request.
Your task is to create a middleware component ... | codefeedback |
You are tasked with creating a TypeScript function that processes an array of Angular component references and returns a formatted string containing the names of the imported modules for these components. The function should extract the module names from the import statements and generate a comma-separated list of thes... | codefeedback |
You are tasked with creating a Python script that replaces specific lines in a file with new content. Your script should take two command-line arguments: the file path and the line number to replace. After replacing the specified line, the script should start a FastAPI backend server using Uvicorn with live reloading e... | codefeedback |
You are working on a music application that displays various attributes of songs in a list view. Each attribute is associated with an icon represented by an image. The code snippet provided is a part of a function that returns the corresponding image for a given attribute. The function takes a string parameter represen... | codefeedback |
You are tasked with analyzing a log file from a system monitoring tool. The log file contains entries related to various hosts and their status, such as PASS, FAIL, WARN, INFO, and fatal errors. Your goal is to parse the log file and extract specific information about the hosts and their corresponding status.
You are ... | codefeedback |
You are working on a weather monitoring application that tracks various environmental parameters. One of the features of the application is to set and retrieve humidity alerts for different locations identified by unique UUIDs. The application uses a custom `AlertPersistenceUserDefaults` class to handle the persistence... | codefeedback |
You are tasked with creating a RESTful API endpoint for a question-and-answer platform. The API should handle both retrieving a list of questions and submitting answers to those questions. The code snippet provided is a partial implementation of the API endpoint using Django REST framework.
Your task is to complete th... | codefeedback |
You are given a Python code snippet that seems to be attempting to manipulate a dictionary and call a function. However, the code contains some errors and inconsistencies. Your task is to analyze the code, identify the issues, and correct them to achieve the intended functionality.
The code snippet is as follows:
```... | codefeedback |
You are tasked with implementing a graph data structure in Rust to represent energy rates and temperatures for a smart home system. The graph data structure will be used to store and visualize the data over time. The energy rates and temperatures are represented as `GraphData` structs, and the graph data structure is d... | codefeedback |
You are tasked with implementing a custom error handling system for a software application. The system should be able to generate specific error messages based on different scenarios. Your task is to create a class that can generate error messages with predefined codes and descriptions.
You are provided with a code sn... | codefeedback |
You are tasked with implementing a class that manages a dynamic character array to store the name of a person. The class should include a destructor to release the memory allocated for the name and a copy constructor to create a deep copy of another Person object.
Your task is to complete the implementation of the Per... | codefeedback |
You are tasked with implementing a Python function that processes genetic variant data. The function will take in a dictionary representing a genetic variant and return a formatted string representing the genotype calls.
The genetic variant data is represented as a dictionary with the following structure:
```python
{
... | codefeedback |
You are tasked with implementing a class that simulates a STUN (Session Traversal Utilities for NAT) UDP client. The class should have the ability to set the hostname and port for the STUN server. The default port should be 3478 if not specified during object instantiation.
Your task is to complete the implementation ... | codefeedback |
You are given a grid representing a maze with cells. The code snippet provided is a part of an algorithm to generate a maze by removing walls between cells. The `non_walls` set contains the cells that are not walls, and the `open_set` contains the neighboring cells of the current cell being processed. The algorithm ite... | codefeedback |
You are tasked with creating a Java interface for managing animals in a zoo. The interface, named `ManterAnimal`, should include methods for adding, removing, and feeding animals. Additionally, you need to implement a class `Zoo` that implements the `ManterAnimal` interface and provides functionality for managing anima... | codefeedback |
You are tasked with implementing a method to compute the average hash of an image. The average hash is a technique used in image processing to generate a hash value representing the visual content of an image. The hash is computed based on the average brightness of the pixels in the image.
You are provided with a code... | codefeedback |
You are tasked with creating a function that takes in a person's birthday year, month, and day as input and returns the age of the person in years. The function should account for leap years and handle invalid input gracefully.
Write a function `calculateAge` that takes in three parameters:
- `int $birthdayYear`: repr... | codefeedback |
You are tasked with implementing a responsive web application feature that dynamically switches between a mobile and desktop view based on the window size. You are provided with a code snippet from a React component that handles the responsive behavior. Your task is to complete the implementation by writing the necessa... | codefeedback |
You are tasked with creating a program that parses a given source code file and extracts the copyright information from it. The copyright information is typically found within comments at the beginning of the file and follows a specific format. The program should be able to identify the copyright holder's name and the ... | codefeedback |
You are tasked with implementing a logging system for a Python application. The `LoggerSystem` class is responsible for managing application-level logs. Your task is to extend the `LoggerSystem` class to include methods for configuring the logging system and for logging messages at different levels.
Your implementatio... | codefeedback |
You are tasked with creating a web application that allows users to change their profile picture and password. The application uses the Laravel framework and Blade templating engine. The given code snippet is a part of the user profile page, where the user's profile picture, real name, and a button to change the passwo... | codefeedback |
You are tasked with implementing a Kalman filter for a satellite navigation system. The provided code snippet is a part of the Kalman filter implementation and contains two methods: `init_state` and `predict_and_observe`. Your task is to complete the implementation of the `predict_and_observe` method to handle differen... | codefeedback |
You are given a list of celestial objects, each represented by their right ascension (ra) and declination (dec) coordinates. Your task is to write a function that calculates the distance between two celestial objects in the sky. The distance should be calculated using the spherical law of cosines formula, which takes i... | codefeedback |
You are tasked with implementing a simple linked list data structure in C#. The `Aspect` class represents a node in the linked list, and it contains a generic data element of type `T` and a reference to the next node in the list. Your goal is to implement the `LinkedList` class, which will manage these `Aspect` nodes a... | codefeedback |
You are tasked with creating a Bash script that processes a directory and its subdirectories to find all files with a specific file extension. Your script should take two arguments: the directory to search in and the file extension to look for. The script should then output the names of all files with the specified ext... | codefeedback |
You are tasked with implementing a class for a geometric shape animation in a Python program. The class should be able to create and manipulate shapes on a 2D canvas. The code snippet provided gives a glimpse of the functionality required. Your task is to complete the implementation of the `Circle` and `Rectangle` clas... | codefeedback |
You are tasked with implementing the Towers of Hanoi problem. The Towers of Hanoi is a classic problem that consists of three rods and a number of disks of different sizes which can slide onto any rod. The puzzle starts with the disks in a neat stack in ascending order of size on one rod, the smallest at the top, makin... | codefeedback |
You are tasked with implementing a custom iterable data structure in Python. The data structure represents a collection of children, and the iterator should return the children in the order they were present at the time of calling the iterator, even if the children list is modified later. Your task is to implement the ... | codefeedback |
You are tasked with implementing a class for a multi-objective optimization algorithm. The algorithm uses a population-based approach to evolve a set of solutions towards the Pareto front. The given code snippet is a part of the implementation for handling the results of the optimization process.
The `fit` and `con` a... | codefeedback |
You are tasked with implementing a Python function that processes a dictionary of input data and performs specific operations based on the mode of an agent. The agent can operate in two modes: A2C and PPO. If the agent is in training mode and operating in A2C mode, the `train` method of the agent is called with the pro... | codefeedback |
You are tasked with creating a Python script that organizes files in a directory based on their file extensions. Your script should traverse a specified directory, identify files, and move them to respective subdirectories based on their file extensions. For example, all .txt files should be moved to a "txt" subdirecto... | codefeedback |
You are given a string containing a sequence of characters. Your task is to implement a program that sorts the characters in the string in a specific manner. The sorting algorithm should compare each character with the next one in the string. If the ASCII value of the current character is higher than the ASCII value of... | codefeedback |
You are tasked with creating a unit test for a `PatientDetailsUpdateService` class in a healthcare application. The `PatientDetailsUpdateService` class is responsible for updating patient details and relies on various dependencies such as database access, connection settings, mapping, location service, and urgency sett... | codefeedback |
You are tasked with implementing a system to update the quality of various items in a store. The system has an interface with a method `UpdateQuality` that takes an `ExtendedItem` as a parameter. The `ExtendedItem` class represents an item in the store and has properties such as `Name`, `SellIn`, and `Quality`. The `Up... | codefeedback |
You are tasked with creating a Python script that generates a migration file for a Django application. In Django, migrations are used to propagate changes you make to your models (adding a field, deleting a model, etc.) into your database schema. The code snippet provided is a partial implementation of a migration file... | codefeedback |
You are tasked with implementing a GeoFirestore class that stores and retrieves geo location data at a Firestore document. The GeoFirestore class should provide methods for adding, updating, and retrieving geo location data, as well as querying for nearby locations.
Your task is to implement the following methods in t... | codefeedback |
You are tasked with implementing a file recoding function in Python. The function should take a raw file, recode it, and save the recoded file to a specified directory. You are given a class with a method `recode_raw_file` that needs to be completed. The method should handle the recoding process and ensure that the rec... | codefeedback |
You are tasked with creating a Python function that simulates a simplified version of a MongoDB replica set status check. The function will take in a list of dictionaries representing the replica set members and their statuses. Each dictionary will contain the keys "name" and "status", where "name" is the name of the m... | codefeedback |
You are tasked with implementing a Python function that generates a supercell for a given crystal structure. The function takes in a `Code` instance configured for the `quantumespresso.pw` plugin, a `StructureData` instance, a distance parameter, and an element to remove from the model. The function should create a sup... | codefeedback |
You are tasked with creating a class that handles image resizing and storage using the provided code snippet as a reference. Your task is to implement the `ImageProcessor` class, which will be responsible for resizing and storing images.
The `ImageProcessor` class should have the following functionalities:
1. Accept a... | codefeedback |
You are working on a computer vision project and need to implement a transfer learning approach using a pre-trained VGG16 model. Your task is to write a Python function that takes in an image dataset and fine-tunes the VGG16 model for a specific classification task. The function should load the pre-trained VGG16 model,... | codefeedback |
You are working for a marine research organization and have been tasked with analyzing data from a coral reef study. The organization has provided you with two datasets: `raw_coral` containing information about coral reefs and `raw_param` containing environmental parameters. The `raw_coral` dataset has spatial informat... | codefeedback |
You are working on a web application using the Flask framework in Python. The application has a main blueprint named "inter" and several submodules imported from within the main blueprint. Your task is to create a function that will generate a list of all the imported submodules within the main blueprint.
Write a Pyth... | codefeedback |
You are tasked with creating a Python program that interacts with a MongoDB database to retrieve and display information about GitHub repositories. The program should connect to the database using credentials stored in a JSON file, fetch repository data, and then display the repositories with a number of stars within a... | codefeedback |
You are tasked with implementing a custom forward list data structure in C++. The provided code snippet is a part of the implementation and defines a forward list with an iterator.
Your task is to complete the implementation of the forward list by adding necessary member functions and ensuring the correct behavior of ... | codefeedback |
You are tasked with implementing a function that will parse and extract the HTML structure from a given code snippet. The HTML structure consists of nested elements, each represented by an opening tag, a content block, and a closing tag. Your function should return the hierarchical representation of the HTML structure.... | codefeedback |
You are tasked with implementing a class that manages deployment configurations and ports for a server application. The class should provide methods to set the deployment configuration and port, with the ability to handle different types of input for the port.
You need to implement a `ServerManager` class with the fol... | codefeedback |
You are tasked with creating a Django REST framework API endpoint for retrieving player information by their unique ID. The provided code snippet is a partial implementation of the API view class for this functionality. Your task is to complete the implementation of the `PlayersByIdAPI` class by adding the necessary me... | codefeedback |
You are tasked with creating a web application that displays a list of companies and their associated programs. The provided code snippet is a part of the PHP code for this application. The `$larvPrograms` variable is populated with data retrieved from a database using the Model class. The retrieved data is then format... | codefeedback |
You are working on a 3D simulation project that involves finding neighboring particles around a unit cube. To achieve this, you need to implement a function that generates points within the cube and identifies neighboring particles based on a given distance threshold.
Write a Python function `find_neighboring_particle... | codefeedback |
You are tasked with creating a custom environment for a reinforcement learning agent using the Tensorforce library in Python. Your environment will simulate a simple game where the agent must navigate through a grid and collect rewards while avoiding obstacles. The grid is represented as a 2D array, where each cell can... | codefeedback |
You are tasked with creating a Python function that parses a given set of URL patterns and extracts the view names and corresponding URLs. The URL patterns are provided in the format of Django URL patterns, where each pattern is defined using the `url` function. The function should return a dictionary where the keys ar... | codefeedback |
You are tasked with creating a PHP class that manages a collection of exercises for a fitness application. The class should handle the CRUD (Create, Read, Update, Delete) operations for exercise data. You need to implement the methods for adding, retrieving, updating, and deleting exercises.
Your task is to complete t... | codefeedback |
You are tasked with implementing a Prolog predicate to generate workshop registrations for a conference. The predicate `gen_workshops/4` takes four arguments: `S`, `NP`, `NW`, and `Count`. Here, `S` is an output stream, `NP` is the number of participants, `NW` is the number of workshops, and `Count` is the current coun... | codefeedback |
You are tasked with implementing a simplified version of a pipeline execution system using Java. The pipeline consists of a series of data processing operations that need to be executed in a specific order. Your goal is to create a class that can traverse the pipeline topologically and execute the processing operations... | codefeedback |
You are tasked with implementing a type property testing framework in Rust. The framework should allow users to define and run property-based tests for custom data types. A property-based test is a test that checks a certain property or invariant of a program by generating a large number of random inputs and verifying ... | codefeedback |
You are tasked with implementing a search functionality for a user management system using Java and the MidPoint framework. The system allows administrators to search for users based on various criteria such as assignments, search box scope, and user interface features.
Your task is to create a Java class that utilize... | codefeedback |
You are tasked with implementing a function that processes a state dictionary and returns a modified version of the dictionary based on specific criteria. The state dictionary contains information about different states and their attributes. Your task is to create a function that takes this dictionary as input and retu... | codefeedback |
You are tasked with implementing a memory management system for a virtual memory environment. The system involves mapping and unmapping virtual memory addresses to physical memory addresses. Your goal is to create a function that safely unmaps a virtual memory address and returns the corresponding physical memory addre... | codefeedback |
You are tasked with creating a program to analyze a list of security-related strings and categorize them based on their structure. Each string represents a security policy or behavior and follows a specific format. The goal is to parse the strings and organize them into different categories based on their structure.
T... | codefeedback |
You are tasked with implementing a program that simulates a simple multi-threaded system. The given code snippet is a part of a Java program that creates and starts a new thread using an anonymous inner class. Your task is to complete the program by implementing the `run` method of the thread to perform a specific task... | codefeedback |
You are tasked with implementing a Python function that calculates the cosine similarity between two given vectors using PyTorch. Cosine similarity is a measure of similarity between two non-zero vectors of an inner product space. It is defined as the cosine of the angle between the two vectors. The formula for cosine ... | codefeedback |
You are tasked with creating a Python function that parses a Django settings file and extracts specific configuration settings. The settings file contains various configurations for a Django web application, including the `SECRET_KEY`, `CSRF_COOKIE_SECURE`, `SESSION_COOKIE_SECURE`, and `TEMPLATE_LOADERS`.
Your task is... | codefeedback |
You are tasked with implementing a TV show episode tracker using Python. The goal is to create a program that processes a list of episode information and organizes it by season. The program should extract the season number and episode number from each entry and store the episode numbers in a dictionary, with the season... | codefeedback |
You are tasked with implementing a class that represents user settings for a system. The class should have attributes for the user's name, password, project name, email, and an enabled flag. Additionally, you need to write a method to validate the user settings.
Create a Python class `UserSettings` with the following ... | codefeedback |
You are tasked with implementing a dynamic table rendering system for a web application. The system should be able to generate HTML tables based on the provided configuration. The configuration consists of two arrays: `$headerColumns` and `$bodyColumns`. Each array contains a list of column configurations for the table... | codefeedback |
You are working on a data analysis project and need to create a program to perform kernel density estimation (KDE) and median calculation. The KDE is used to estimate the probability density function of a random variable, and the median calculation is used to find the middle value of a dataset. You have been given a co... | codefeedback |
You are tasked with designing a memory allocation system for a Linux device driver. The driver is responsible for managing memory allocation for a specific device and needs to implement a custom memory allocator. Your task is to create a class that provides a memory allocation interface for the driver.
You are provide... | codefeedback |
You are working on a project that involves integrating a scheduler service into your Python application. The scheduler service is provided by the `fedlearner` library, and you need to create a client to interact with the scheduler service. The `scheduler_service_pb2_grpc` module from the `fedlearner.common` package con... | codefeedback |
You are tasked with creating a Python class that represents a gravitational lensing system. Gravitational lensing is a phenomenon in which light from a distant source is bent by the gravitational field of an intervening mass, such as a galaxy or a cluster of galaxies. This bending of light can create multiple images of... | codefeedback |
You are tasked with creating a Python program that processes command-line arguments for training a Hierarchical Recurrent Encoder-Decoder (HRED) model. The provided code snippet includes an argument parser setup and a device assignment based on GPU availability. Your task is to extend this code to handle the training l... | codefeedback |
You are tasked with implementing a simple command-line program that simulates a race between three runners. The program should randomly determine the finishing order of the runners and display the results. Each runner is represented by a class with a `Run` method that simulates the running process. The `Run` method tak... | codefeedback |
You are tasked with creating a program that uses a pre-trained Keras model to classify images of handwritten digits. The program should load a pre-trained model, process input images, and output the predicted digit for each image.
Your task is to implement a function `classify_digits(image_paths, model_path)` that tak... | codefeedback |
You are tasked with implementing a version comparison algorithm that compares two software version numbers represented as strings. The version numbers are in the format "major.minor.patch.build", where each component is an integer. The comparison should follow the standard rules for version comparison, where a higher m... | codefeedback |
You are given a code snippet for the merge sort algorithm. Your task is to complete the implementation of the merge sort function and then write a function to count the number of inversions in an array using the merge sort algorithm.
An inversion in an array occurs when there are two indices i and j such that i < j an... | codefeedback |
You are tasked with implementing a function that takes a list of QSize objects and returns a formatted string representation of their dimensions. The QSize class represents a size in a 2D space, with a width and a height. The given code snippet provides a starting point for the implementation, using a foreach loop to i... | codefeedback |
You are given a sequence of integers, and your task is to find the length of the longest increasing subsequence (LIS) within the sequence. A subsequence is a sequence that can be derived from another sequence by deleting some or no elements without changing the order of the remaining elements. An increasing subsequence... | codefeedback |
You are tasked with creating a script to automate the cross-compilation of a Go application for different operating systems. Your script should be able to build the application for both Windows (32-bit) and macOS platforms. The provided code snippet demonstrates a part of the script that accomplishes this task.
Your t... | codefeedback |
You are given a Python code snippet that calls a function `run` with different file names as arguments. Your task is to implement the `run` function, which reads the content of the given file and returns the number of unique words present in the file. A word is defined as a sequence of alphanumeric characters separated... | codefeedback |
You are tasked with implementing a Python class that generates random lists of unsigned 8-bit integers and writing test cases to verify its functionality. The provided code snippet contains a portion of a Python test case for the class `my_item_c`, which is intended to generate random lists of unsigned 8-bit integers. ... | codefeedback |
You are tasked with implementing a generic function to calculate the product of elements in a vector. The vector is represented as a struct `Vector<T, N>` where `T` is a generic type that implements the `One` and `Mul` traits, and `N` is a compile-time constant representing the size of the vector.
Your task is to impl... | codefeedback |
You are tasked with implementing a topological sort algorithm to order the vertices of a directed acyclic graph (DAG) in a specific sequence. The topological sort algorithm arranges the vertices in such a way that for every directed edge from vertex u to vertex v, u comes before v in the ordering. This ordering is not ... | codefeedback |
You are tasked with implementing a simplified version of an asynchronous file loader for a project. The `load` method is responsible for loading project files based on certain criteria. The method takes a current working directory (`cwd`) as a parameter and returns a `Promise` that resolves to a `Project` object. The `... | codefeedback |
You are tasked with creating a Python function to populate a Hierarchical Data Format 5 (HDF5) file with annotations and traces, and then implementing a CacheFile class to handle the populated file. The code snippet provided demonstrates the usage of the function `populate` and the CacheFile class. Your task is to crea... | codefeedback |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.