instruction_seed
stringlengths
0
26.4k
source
stringclasses
4 values
You are tasked with implementing a memory monitoring system for a network device. The system uses SNMP (Simple Network Management Protocol) to collect data about memory pools on the device. The given code snippet is part of a Java program that processes the SNMP data to retrieve memory pool information. The code snipp...
codefeedback
You are tasked with creating a script to manage Amazon Elastic Container Registry (ECR) using the AWS Command Line Interface (CLI). Your script should respect the environment variables `AWS_DEFAULT_REGION` and `AWS_DEFAULT_OUTPUT` if they are specified, and set them to default values if they are not already set. Additi...
codefeedback
You are tasked with creating a migration script for a blogging platform. The platform currently has a `Post` model and a `Tag` model. Each post can have multiple tags associated with it. However, due to a change in the platform's architecture, it has been decided to remove the direct relationship between posts and tags...
codefeedback
You are tasked with implementing a message layout system for a chat application. The code snippet provided sets the origin point for a message container based on the position of the message within the chat interface. The message container includes an avatar, message content, attachments, and duration information. Your ...
codefeedback
You are tasked with implementing a generic constraint system for a UI framework. The framework provides two types, `ConstraintItem` and `ConstraintView`, both of which conform to the `ConstraintRelatableTarget` protocol. Your goal is to create a generic function that can compare and relate two instances of types confor...
codefeedback
You are tasked with creating a Python function that processes submission information packages (SIPs) and performs various operations on them. The SIPs are stored in a directory structure, and the function needs to handle the loading, manipulation, and removal of these packages. You are given a code snippet that demons...
codefeedback
You are tasked with implementing a codename generator that creates unique codenames for agents in a spy organization. The codenames should consist of a combination of an adjective and a noun, both randomly selected from predefined lists. The codename generator should ensure that each generated codename is unique and no...
codefeedback
You are tasked with implementing a Swift enum that represents different error codes for a networking library. The enum should have associated values for specific error cases. Additionally, you need to write a function that takes an error code and returns a human-readable error message based on the enum cases. Your enu...
codefeedback
You are tasked with creating a Python class for managing API keys and handling connection errors for a fictional API service. Your task is to implement the `ApiManager` class, which should handle the following functionalities: 1. Storing and retrieving API keys for the Meraki API service. 2. Making API requests using ...
codefeedback
You are tasked with implementing a function that takes in an array of objects representing articles and returns an array of tags that occur most frequently across all the articles. Each article object has a `length` property representing the article length in words and a `tags` property representing an array of strings...
codefeedback
You are tasked with implementing a function to calculate the average color of a triangle mesh in a 3D graphics application. The mesh is represented by a `TriangleMesh` object, which contains vertex colors. The vertex colors are stored in a `ColorList` object, which is a list of RGB color values. You need to create a f...
codefeedback
You are tasked with implementing a C++ function that calculates the squared distance between two vectors using the Eigen library. The squared distance between two vectors is defined as the sum of the squared differences between their corresponding elements. You are given the following function signature: ```cpp double...
codefeedback
You are given a C++ code snippet that includes conditional compilation directives and shell commands. Your task is to understand the purpose of the code and identify the potential issue in the given code snippet. Identify the issue and explain the potential problem with the conditional compilation directives and shell...
codefeedback
You are tasked with implementing a function that processes data from a fictional event management system. The system uses RxSwift and RxDataSources to handle table view data. Your goal is to create a function that processes the data source for a table view displaying event details. You are provided with a code snippet...
codefeedback
You are tasked with implementing a function to process an incoming swap message received from TOR in a cryptocurrency wallet application. The provided code snippet is part of the implementation and includes a function `receive_swap_message` with the following signature: ```rust pub fn receive_swap_message<'a, L, C, K>...
codefeedback
You are tasked with creating a Python script that automates the installation of required packages for a given project. The script should take a list of package names as input and install each package using the `pip` package manager. Additionally, the script should handle any potential errors that may occur during the i...
codefeedback
You are tasked with implementing a simple parser for a custom language using the Rust programming language. The given code snippet provides a partial implementation of the parser using traits and methods. Your task is to complete the implementation by defining the missing methods and traits. You are provided with the ...
codefeedback
You are working on a deployment script for a distributed system. The script is responsible for updating the configuration files on all nodes and then running a benchmarking tool to measure the system's performance. The script takes three arguments: a list of all nodes in the system, the name of the configuration file t...
codefeedback
You are tasked with creating a custom error handling system for a banking application. The application needs to handle specific error cases related to insufficient funds and invalid zero amounts. You are required to implement a custom error type and define the necessary error variants to represent these specific error ...
codefeedback
You are working on a game development project and need to implement a new type of ammunition for the game. The code snippet provided is a part of the item definition for the new ammunition in the game's codebase. Your task is to write a function that takes the properties of the ammunition item and generates the corresp...
codefeedback
You are tasked with implementing a function that calculates the total number of lines of code in a TypeScript project by parsing the project's GitHub repository URL. The function should retrieve the TypeScript files from the repository and count the total number of lines in those files, excluding comments and empty lin...
codefeedback
You are tasked with creating a program that reads a text file and counts the occurrences of each word in the file. Your program should ignore punctuation and consider words with different capitalizations as the same word. The program should then output the word count for each unique word in alphabetical order. For exa...
codefeedback
You are tasked with implementing a data structure to represent a 3-dimensional box and its associated operations. The `Box3` struct has two fields, `min` and `max`, each representing a 3-dimensional point. The struct also has methods to create a new box, retrieve the volume of the box, and perform a union operation wit...
codefeedback
You are given a C++ code snippet that contains an incomplete namespace block. Your task is to complete the namespace block with the necessary code to define a class and a function within that namespace. Complete the namespace "example" by defining a class "MyClass" with a private integer member variable "value" and a ...
codefeedback
You are tasked with implementing a simple stack data structure using a linked list in C++. The stack should support the following operations: 1. `push`: Add an element to the top of the stack. 2. `pop`: Remove the element from the top of the stack and return its value. 3. `top`: Return the value of the element at the t...
codefeedback
You are tasked with creating a program that categorizes a person's body weight based on their BMI (Body Mass Index). The BMI is calculated using the formula: BMI = weight (kg) / (height (m) * height (m)). The categorization is as follows: - If the BMI is less than 18, the person is categorized as "Underweight". - If th...
codefeedback
You are tasked with creating a script to automate the setup and execution of a data processing pipeline using Docker. Your script should handle the creation of a directory, setting the current working directory, and running a Docker container with specific configurations. Write a Bash script that accomplishes the foll...
codefeedback
You are tasked with creating a script to automate the compilation of MonoGame Effect files. The script takes a filename as an argument, extracts the name without the extension, and then compiles the effect file to a specified output file using the MonoGame Effect compiler (`mgfxc`). The script uses Wine to run the Mono...
codefeedback
You are tasked with implementing a custom type binder in C#. The type binder is responsible for resolving type names to actual Type objects. Your goal is to create a class that inherits from a base class and implements the abstract method `BindToType`. The method should take in an assembly name and a type name, and ret...
codefeedback
You are tasked with implementing a Python class that can parse XML data and extract specific elements. Your task is to complete the implementation of the `CreateFromDocument` class, which should be able to parse the given XML string and create an instance with attributes corresponding to the XML elements. The XML stri...
codefeedback
You are tasked with implementing a Python class that represents a user and a function to remove user data from a database. The user class should have attributes for user ID and username, and the function should remove the user data from the database. Your task is to complete the implementation of the User class and the...
codefeedback
You are working on a Python package for managing a collection of items. The package consists of several modules, including `add.py`, `remove.py`, and `fetch.py`, each containing functions for adding, removing, and fetching items from the collection, respectively. Your task is to implement a function in the main module...
codefeedback
You are working on a Python package that contains various finite element analysis functions for structural engineering. The package includes a module named `finite_element` which contains a list of functions that perform different types of finite element analysis. The list of functions is stored in the `__all__` variab...
codefeedback
You are working on a testing framework for a scientific computing library. The framework allows running specifications defined in YAML files and verifying the output of the computations. The `run_spec_no_output` function is used to execute a specification without expecting any specific output. The function returns a re...
codefeedback
You are tasked with implementing a Python 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. The function should take two integer parameters, `start` and `end`, representing the inclusive ra...
codefeedback
You are working on a data visualization project and need to create a function to generate line plots with specific configurations. The code snippet provided is a part of the function that you are developing. The function `lineplot` is used to create line plots, and it takes several parameters including `ubudget_sector`...
codefeedback
You are tasked with implementing a custom operator in RxJS to handle distinct value changes based on shallow equality comparison. Additionally, you need to set default props for a controlled input component in TypeScript. Implement a custom RxJS operator `distinctUntilChanged` that uses the `shallowEqual` function for...
codefeedback
You are tasked with creating a function that animates the transition of an image in a UIImageView. The function should take in the necessary parameters to configure the animation and execute the transition. Your goal is to implement the function that performs the animation using the given code snippet as a reference. ...
codefeedback
You are tasked with implementing a Python function that calculates the total number of unique words in a given text file. The function should ignore punctuation and consider words with different capitalizations as the same word. Additionally, the function should exclude any common English stop words (e.g., "the", "and"...
codefeedback
You are tasked with creating a JavaScript function that dynamically generates a list of checkboxes and labels based on the data retrieved from a Firestore database. The function should take an array of objects as input, where each object represents a document from the database and contains a `title` attribute. The func...
codefeedback
You are tasked with creating a Python function that generates a unique temporary file path for a ZIP file. You will need to utilize the `pytest` library to create fixtures for this task. Write a function called `generate_zip_path` that takes no arguments and returns a unique temporary file path for a ZIP file. The fun...
codefeedback
You are given a list of candy names as strings. Your task is to write a function to sort the candy names in lexicographical order, ignoring the case of the letters. Additionally, the function should remove any duplicate candy names and return the sorted list of unique candy names. Function Signature: `def sort_unique_...
codefeedback
You are tasked with implementing a function that processes 3D mesh data to calculate and set smooth normals for each vertex. The input to the function is a mesh object `newMesh` containing loops and polygons. The function should perform the following steps: 1. Create an array `clnors` of type 'f' (float) with initial v...
codefeedback
You are tasked with implementing an access control system for a bot application. The given code snippet defines the access controls for various bot commands. Each command is associated with a set of allowed users or groups. The `ACCESS_CONTROLS` dictionary maps each command to its corresponding access control settings....
codefeedback
You are tasked with creating a Django migration for a travel application. The application has a model called `AccommodationPrice`, and you need to alter a field within this model. The field alteration involves changing the data type or constraints of a specific attribute in the `AccommodationPrice` model. Your task is...
codefeedback
You are tasked with implementing a function that can parse a given file path and extract specific information from it. The file path follows a specific format, and your function should be able to handle various cases and extract the required details. Write a function `parseFilePath` that takes a file path as a string ...
codefeedback
You are tasked with implementing a class for registering auxiliary data types in a data processing system. The system should prevent registering two auxiliary data types with the same name but incompatible types. Your task is to design and implement the registration mechanism and ensure that attempting to register a du...
codefeedback
You are tasked with designing a Rust program to manage and interact with systemd units using the provided modules. The `manager` module contains functionality for managing systemd units, the `service` module contains service-related functionality, the `systemd1_api` module provides an interface to interact with systemd...
codefeedback
You are tasked with creating a program that simulates a comment and reply system. The program should allow users to post comments and reply to existing comments. Each comment has a user ID associated with it, and users can only delete their own comments. Replies to comments are stored in an array within the comment obj...
codefeedback
You are tasked with implementing a custom exception class for handling errors in a GraphQL server. The exception class should be designed to provide detailed information about the error, including the GraphQL query, the specific field causing the error, and the error message. Your task is to create a custom exception ...
codefeedback
You are tasked with implementing a function to build a hierarchical structure from a collection of Markdown blocks. Each block has a specified level, and the function should construct the structure based on the levels of the blocks. The function should take into account the nesting of blocks and update the current leve...
codefeedback
You are tasked with implementing a custom data structure called `CustomStack` that simulates the behavior of a stack with additional functionality. The `CustomStack` should support the following operations: 1. `push(x)`: Add an element `x` to the top of the stack. 2. `pop()`: Remove the element at the top of the stack ...
codefeedback
You are tasked with implementing a Python function that processes a binary data buffer to extract and manipulate specific sets of double-precision floating-point values. The buffer contains serialized data representing various sets of double values, and your function needs to unpack and store these values in a specific...
codefeedback
You are tasked with implementing a JIT (Just-In-Time) compiler for a simple programming language. The JIT compiler will take an Abstract Syntax Tree (AST) generated from the source code and produce machine code that can be executed directly by the CPU. Your task is to write a function that takes the AST as input and ge...
codefeedback
You are tasked with implementing a Python function that processes a given C++ class definition using the Clang library. The function should extract relevant information from the class definition and return a dictionary containing specific details about the class. The function signature is as follows: ```python def pro...
codefeedback
You are tasked with creating a Python function that processes a given list of file paths and returns a dictionary containing the count of files grouped by their file extensions. The function should handle both absolute and relative file paths and should consider only the last part of the file name as the extension (e.g...
codefeedback
You are tasked with designing a Java class that represents a notification data structure for a media streaming application. The class should encapsulate various attributes related to a notification, including the action, flags, URI, MIME type, and additional key-value pairs as extras. Additionally, the class should con...
codefeedback
You are tasked with creating a Python script that generates a heatmap based on a given set of data points. The heatmap should visually represent the density of the data points in a 2D space. To accomplish this, you will need to implement a function that takes in the data points and produces a heatmap image. Your task ...
codefeedback
You are tasked with implementing a storage system for a web application. The system should support multiple storage backends, such as in-memory hash maps and Redis databases. The provided code snippet is a part of a Rust module that defines the storage interfaces and their implementations. Your task is to create a tra...
codefeedback
You are tasked with implementing a data structure to manage a network of interconnected ports. Each port can have multiple downstream ports, and when a port is updated, all its downstream ports should be updated as well. Your task is to create a Rust implementation for this data structure. You are given a code snippet...
codefeedback
You are tasked with implementing a Python class that represents a 2D rectangular grid world as a Gym environment. The grid world consists of cells, each of which can be in one of three states: empty, occupied by an obstacle, or containing a goal. The environment should support the following functionalities: 1. Initiali...
codefeedback
You are tasked with creating a program to manage a library's collection of books and their respective authors. The program should allow users to add new books, add new authors, associate authors with books, and retrieve information about books and their authors. You are given the following code snippet as a starting p...
codefeedback
You are tasked with creating a Python class that manages settings loaded from a YAML file. Your goal is to implement the `SettingsModel` class, which should have the ability to load settings from a YAML file and provide functionality to retrieve the next URL from the loaded settings. The `SettingsModel` class should h...
codefeedback
You are tasked with creating a script to automate the deployment process for a web application. The script should perform several tasks in a specific order and handle potential errors gracefully. Your task is to write a shell script that accomplishes the following: 1. Run the command `app/console assetic:dump`. 2. Pri...
codefeedback
You are tasked with implementing a dependency resolution algorithm for a software package manager. The package manager maintains a list of dependencies for each package, where each dependency is represented as a tuple containing the name of the dependency and the version. The goal is to resolve the dependencies in a wa...
codefeedback
You are tasked with implementing a memory management system for a video game console emulator. The system involves managing program (PRG) and character (CHR) memory pages. The provided code snippet is a part of the memory management module and contains a method for selecting a CHR memory page. The `select_chr_page` me...
codefeedback
You are tasked with implementing a generic type conversion system in C#. The system should allow for setting default type converters and adding conditional type converters based on certain criteria. Your task is to implement the `TypeConverterManager` class, which should provide the following functionality: 1. `SetDe...
codefeedback
You are tasked with creating a program to interact with a smart device management system using the Google Smart Device Management API. Your program needs to implement a function to retrieve and display a list of devices associated with a specific user. You are provided with a code snippet that includes a function `dum...
codefeedback
You are tasked with creating a script to update configuration settings in a file based on a given associative array of key-value pairs. The script should read the existing configuration file, search for each key, and update its corresponding value if the key exists. If the key does not exist, the script should add a ne...
codefeedback
You are tasked with implementing a custom memory management system for a programming language. The system should support memory allocation, deallocation, and garbage collection. To achieve this, you need to create a MemoryManager class with the following functionalities: 1. `allocate(size: Int) -> Int`: This method sh...
codefeedback
You are given a task to implement a data structure that supports two types of operations: 1. Update: Change the value at a specific position. 2. Query: Retrieve the sum of values within a given range. You need to implement a class `CustomArray` that supports the following operations: 1. `void change(int pos, int val)...
codefeedback
You are tasked with creating a Python function that dynamically patches a given function to replace specific bytecode operations with new ones. You will need to implement a function that takes in the original function, the index of the bytecode operation to be replaced, and the new bytecode operation, and then returns ...
codefeedback
You are tasked with implementing a dependency injection container in TypeScript. Dependency injection is a design pattern in which a class receives its dependencies from external sources rather than creating them itself. In this problem, you will create a simple dependency injection container using TypeScript. Your ta...
codefeedback
You are tasked with implementing a custom dependency injection provider in a TypeScript application. The application uses Angular's dependency injection system, and you need to create a factory function that asynchronously provides an instance of the `AgendaService` class. Your task is to complete the implementation o...
codefeedback
You are tasked with creating a PHP class that manages the configuration of form fields for a web application. The class should allow for the addition of various types of form fields and their corresponding attributes. Your task is to implement the `FormConfigurator` class with the following requirements: 1. The class ...
codefeedback
You are tasked with creating a program to encrypt and decrypt files using a custom encryption algorithm. The program should take three command-line arguments: the source file to be encrypted/decrypted, the destination file for the result, and a key for the encryption/decryption process. The key must be between 7 and 11...
codefeedback
You are tasked with creating a program that extracts and counts the unique keywords from the `content` attribute of the `<meta>` tag in an HTML document. The `content` attribute contains a comma-separated list of keywords related to educational institutions in the state of New Mexico. Your program should parse the `con...
codefeedback
You are tasked with implementing a function that calculates the total number of unique paths to reach the bottom-right corner of a grid from the top-left corner. You can only move either down or to the right at any point in time. The grid is represented by a 2D array where 1 indicates an obstacle and 0 indicates an emp...
codefeedback
You are tasked with creating a program that reads a text file and counts the occurrences of each word in the file. Your program should ignore punctuation and consider words in a case-insensitive manner. The program should then output the unique words along with their respective counts in alphabetical order. For exampl...
codefeedback
You are tasked with implementing a function that will display a grid of images using the matplotlib library in Python. The function should take a list of images and the number of images to display per row as input, and then generate a grid of subplots with the images displayed in each subplot. The function signature s...
codefeedback
You are given a string containing a series of parentheses. Each opening parenthesis "(" should be matched with a corresponding closing parenthesis ")" in the correct order. Your task is to write a function that determines whether the parentheses in the string are balanced. Write a function `isBalancedParentheses` that...
codefeedback
You are working on a natural language processing (NLP) project and need to train a model to classify sentences. The training process involves using the Vowpal Wabbit (VW) machine learning tool and Python scripts for performance evaluation. The code snippet provided is a part of the training and testing pipeline for the...
codefeedback
You are tasked with creating a Python program to scrape and analyze data from a web page using the Selenium library. The web page in question is the "https://movie.douban.com/typerank?type_name=剧情&type=11&interval_id=100:90&action=" which contains a list of top-rated drama movies on Douban. Your program should perform ...
codefeedback
You are tasked with implementing a filtering mechanism for a list of `WorldCountry` objects based on certain criteria. Each `WorldCountry` object has properties for `Population` and `Area`, and a `Region` property indicating the region it belongs to. The filtering mechanism should allow filtering based on population an...
codefeedback
You are tasked with creating a Python function that interacts with a SQLite database to manage image and face data. The database contains two tables: `images` and `faces`. The `images` table stores information about images, while the `faces` table stores information about faces detected in those images. The provided co...
codefeedback
You are tasked with designing a system to process and categorize incoming orders from different regions using Apache Kafka. The system should consist of producers for sending orders to specific topics, and consumers for processing and categorizing the orders based on their origin. Additionally, error handling should be...
codefeedback
You are tasked with implementing a simplified version of a log replication system based on the Raft consensus algorithm. In Raft, a leader node is responsible for coordinating the replication of log entries across a cluster of nodes. The provided code snippet is a function that handles the processing of a "Ready" messa...
codefeedback
You are tasked with implementing a function that converts a given number into its English word representation. The function should support both integers and floating-point numbers. The conversion should handle numbers up to 999,999,999,999 (inclusive) and should correctly handle negative numbers. The output should not ...
codefeedback
You are tasked with implementing a function that calculates the squared distance between a moving segment and a moving triangle in 3D space. The provided code snippet is part of a larger program and shows the calculation of the squared distance between a segment and a triangle after both have been moved by certain tran...
codefeedback
You are tasked with implementing a custom error handling system for a new programming language. The language supports defining custom error types with associated data. The provided code snippet shows a part of the error handling system, where custom error types are defined using the `#[error]` attribute. Your task is ...
codefeedback
You are tasked with implementing a class hierarchy for different types of elements in a document editor. The elements include `ListElement`, `BulletedElement`, `NumberedElement`, and `CheckboxElement`. Each element has specific properties and behaviors that need to be implemented. Your task is to create a class hierar...
codefeedback
You are given a code snippet that involves two arrays, `X_arai` and `Y_arai`, and two other arrays, `X_IZZI_MD` and `Y_IZZI_MD`. The code snippet assigns the values of `X_arai[i]` and `Y_arai[i]` to the last elements of `X_IZZI_MD` and `Y_IZZI_MD` respectively. Your task is to write a function that performs the same op...
codefeedback
You are tasked with creating a script to automate the installation of a specific version of Go programming language on a Linux system. The script should download the Go distribution, extract it to the appropriate directory, and create a symbolic link to the Go executable in the system's binary directory. Your script s...
codefeedback
You are tasked with simulating a simplified version of a secure firmware update process for a trusted platform module (TPM). The process involves updating the firmware of a TPM chip with a new manifest and fragment files, and then reading out the metadata of the updated TPM. You are given a code snippet that demonstra...
codefeedback
You are tasked with creating a Python function that processes data from a pandas DataFrame and generates a color map for visualization. The function will take in a file path to a results file, a scoring method, and a color map name as input parameters. The function should read the data from the results file, extract un...
codefeedback
You are tasked with implementing a shopping cart feature for an e-commerce website. The provided code snippet includes the definition of the `ShopCartProps` interface and the `ShopCart` component. The `ShopCart` component is responsible for rendering the shopping cart items and providing functionality to remove items, ...
codefeedback
You are tasked with creating a Python function that processes a list of input file paths and extracts specific information from each path. The input file paths are in the format "LFN:/lhcb/MC/\<year\>/ALLSTREAMS.DST/\<file_id\>/\<file_id\>_\<part_id\>_2.AllStreams.dst", where \<year\> is the year of the data, \<file_id...
codefeedback
You are tasked with implementing a simplified version of a command pattern in Java. The command pattern is a behavioral design pattern that turns a request into a stand-alone object that contains all information about the request. This allows for parameterizing clients with queues, requests, and operations. Your task i...
codefeedback
You are tasked with creating a program that checks the availability of a list of subdomains for a given domain. The program should take the domain name as a command-line argument and then iterate through a list of subdomains to check if they are accessible. If a subdomain is accessible, the program should print a messa...
codefeedback
You are tasked with implementing a mesh generation algorithm that utilizes geo-references to create a mesh for a geographical area. The geo-references are represented as a set of latitude and longitude coordinates. The goal is to create a mesh that accurately represents the geographical features of the specified area. ...
codefeedback