instruction_seed stringlengths 0 26.4k | source stringclasses 4
values |
|---|---|
You are tasked with creating a performance monitoring tool for a mobile application. The tool should measure the time it takes for the application to launch and provide insights into the launch time. To achieve this, you need to implement a function that measures the launch time of the application and returns the resul... | codefeedback |
You are tasked with simulating a simple game scenario involving a player character with three abilities. The game is turn-based, and the player can choose from four different actions: "Wait", "Attack", "Defend", and "Use Ability". The player's abilities are represented by the "Wait", "Attack", and "Defend" actions. The... | codefeedback |
You are tasked with implementing a Python class that manages job submission to a cluster using a job scheduling system. The class, named `ClusterJob`, is responsible for submitting jobs to the cluster and retrieving the remote exit code. The class has several parameters, including `workflow`, `dag`, `cores`, `submitcmd... | codefeedback |
You are tasked with implementing a logging system for a software project. The given code snippet provides a macro `SA_LOG_CHAN_DEFINE` that is used to define a new log channel. The macro is intended to be used at the top of a .cpp file. Your task is to create a C++ class `Logger` that utilizes this macro to define and ... | codefeedback |
You are tasked with creating a Python class that can generate a custom list of fields to display in a Django admin interface. The class should inherit from the `admin.ModelAdmin` class and override its `__init__` method to customize the list of fields to display.
Your task is to implement the `CustomModelAdminMixin` c... | codefeedback |
You are tasked with creating a logging system for a software application. The given code snippet shows a Python class with methods for initializing the logging configuration, writing log content, and handling errors. Your task is to extend this logging system by adding a new method that allows for setting the logging l... | codefeedback |
You are tasked with creating a program that analyzes a given HTML file to identify and extract all the CSS file paths included in the `<link>` tags. The program should then output the unique CSS file paths found in the HTML file.
For example, given the following HTML snippet:
```
<link href="{{ asset('assets/site/... | codefeedback |
You are given a list of integers representing the scores of a game. The game has a rule that a player's score is the sum of the scores of the two adjacent players. However, the first and last players are considered adjacent for scoring purposes. You need to write a function that calculates the maximum possible score th... | codefeedback |
You are tasked with implementing a program to train word vectors using either the word2vec or fasttext algorithm. The program should accept a command-line argument specifying the model to be used and then save the trained model to a specified file location.
Your task is to write a Python program that accomplishes the ... | codefeedback |
You are working on a script to automate the creation of user accounts in a Hadoop environment. The script is responsible for creating user accounts for various Hadoop ecosystem components such as HDFS, MapReduce, HBase, Hive, YARN, Oozie, Sentry, Impala, Spark, Hue, Sqoop2, Solr, Sqoop, HttpFS, LLAMA, ZooKeeper, Flume,... | codefeedback |
You are tasked with creating a program that manages programming languages and their associated frameworks. The program should allow users to add new programming languages and frameworks, retrieve the framework associated with a specific programming language, and list all the programming languages and their correspondin... | codefeedback |
You are tasked with implementing a custom data structure called `MiniVec` in Rust, which is a simplified version of the standard `Vec` type. The `MiniVec` type is designed to store a variable number of elements of a specific type. Your goal is to implement the equality comparison for the `MiniVec` type with various oth... | codefeedback |
You are working on a machine learning project and have been given a code snippet from a Python package used for building and evaluating machine learning models. Your task is to understand the purpose of each module and function being imported and to explain how they contribute to the machine learning workflow.
The cod... | codefeedback |
You are working on a software package for analyzing astronomical data, specifically for calculating the Point Spread Function (PSF) of a telescope. The PSF describes the response of an imaging system to a point source of light or radiation. In this context, you are given a code snippet that calculates the PSF using ene... | codefeedback |
You are tasked with creating a Python class that simulates the behavior of a Workload Management Agent (WMAgent) emulator. The WMAgent emulator is responsible for managing and monitoring the execution of tasks within a distributed computing environment. Your class should be able to initialize the WMAgent emulator with ... | codefeedback |
You are tasked with implementing a simplified version of a request descriptor for a Snapshot Lifecycle Management (SLM) feature in an Elasticsearch client library. The provided code snippet is a part of the internal implementation of the request descriptor.
Your task is to create a class that represents the `SlmGetLif... | codefeedback |
You are tasked with implementing a function that will validate the correctness of a given HTML snippet. The function should check if all opening tags have corresponding closing tags in the correct order. For the purpose of this problem, the HTML snippet will be represented as a string.
You need to implement a function... | codefeedback |
You are tasked with creating a program that simulates a simplified version of a cloud resource management system. The system will handle the configuration and creation of various cloud resources. Your task is to implement a class that represents a cloud resource and provide a method for configuring instances of this cl... | codefeedback |
You are tasked with implementing a class that represents a binary search tree (BST) in TypeScript. The class should support the following operations: insertion of a new node, deletion of a node, and searching for a specific node. Additionally, the class should have a method to perform an expensive validation of the BST... | codefeedback |
You are tasked with creating a program that processes a configuration file for an Apache web server. The configuration file contains a series of commands that manipulate user agents for the server. Each command is responsible for matching specific user agents and performing an action based on the match.
Your program n... | codefeedback |
You are tasked with creating a Rust program that manages a simple library system. The library system should have modules for managing books, patrons, and borrowing transactions. Your task is to implement the necessary modules and structures to support this library system.
Your program should have the following modules... | codefeedback |
You are tasked with implementing a scoring algorithm for an AutoCompleteTextBox that suggests completions based on the Damerau-Levenshtein distance between the user input and the suggestions in the dictionary.
The Damerau-Levenshtein distance is a measure of the similarity between two strings, defined as the minimum n... | codefeedback |
You are tasked with implementing a Python function that processes environment YAML files and splits them into chunks based on a given input. The function should take in a command-line argument to specify the chunk number and return the corresponding chunk of environment YAML files.
The function should be named `split_... | codefeedback |
You are tasked with creating a command-line tool to interact with Twitter data. Your program should be able to retrieve tweets made by a specific Twitter handle or search for tweets based on a query. You will need to implement the functionality to handle command-line arguments and interact with the Twitter API to fetch... | codefeedback |
You are tasked with simulating the behavior of a hemispherical cluster of atoms using the provided code snippet as a reference. The code snippet involves setting up a simulation to calculate the angular distribution of photoelectrons emitted from a cluster of copper atoms. Your task is to implement a Python function th... | codefeedback |
You are tasked with creating a Python module that handles file operations. The module should gracefully handle the scenario where the required `nupicter` library is not available or encounters an input/output error. To achieve this, you need to implement a fallback mechanism using a custom `MissingModule` class with sp... | codefeedback |
You are tasked with implementing a file path normalization function in Rust. The `RedoPath` struct represents a file path, and you need to create a function that normalizes the path by purely lexical processing. The normalization process should return the shortest equivalent path name.
You are provided with a code sni... | codefeedback |
You are tasked with creating a Python program to manage the payroll for different types of employees in a company. The program should be designed using object-oriented principles and should handle different employee types such as managers, secretaries, salespersons, and factory workers.
The program should have the fol... | codefeedback |
You are tasked with creating a Python class that simulates a simple banking system. The class should have methods to create accounts, deposit funds, withdraw funds, and check the balance. Additionally, you need to write unit tests to ensure the correctness of the class methods.
Your task is to implement the `BankAccou... | codefeedback |
You are tasked with creating a Python class to analyze and visualize quantum data from a given file. The class should be able to perform various quantum analysis operations and plot the results. Your task is to implement the `QuantumAnalysis` class with the required methods and functionality.
The `QuantumAnalysis` cla... | codefeedback |
You are tasked with creating a Rust program to process and analyze speech data. The provided code snippet is a part of a Rust struct definition for speech data. The `SpeechData` struct has two fields: `total` of type `Option<i64>` and `speeches` of type `Option<Vec<Speech>>`. The `total` field represents the total coun... | codefeedback |
You are tasked with implementing a custom dictionary class in C# that extends the functionality of the standard `Dictionary` class. Your custom class, named `ExtendedDictionary`, should have the ability to perform a specific operation on its values. The operation involves converting the values to their string represent... | codefeedback |
You are tasked with creating a program to visualize a soccer field using the matplotlib library in Python. The soccer field should be drawn with the following specifications:
- The field dimensions are defined by the following variables:
- `x_own_groundline`: the x-coordinate of the own team's ground line
- `y_pen... | codefeedback |
You are tasked with creating a program that analyzes a given GitHub repository and provides statistics on the programming languages used in the repository. You will need to utilize the GitHub API to retrieve the repository's information and then process the data to determine the distribution of programming languages us... | codefeedback |
You are tasked with implementing a custom comparison function for two different types of tokens: German (de_tokens) and Chinese (ch_tokens). The comparison function should assert that the number of German tokens is greater than the number of Chinese tokens. You are given a Python code snippet that includes an assertion... | codefeedback |
You are tasked with implementing a fiber tracking algorithm called EuDX. The algorithm relies on several parameters, with the most important one being the magnitude of the peak of a scalar anisotropic function. Your goal is to write a Python function that takes in the necessary parameters and performs fiber tracking us... | codefeedback |
You are tasked with implementing a custom neural network layer for a natural language processing (NLP) model. The provided code snippet is a part of the initialization method for this custom layer. The layer is designed to handle tokenized input and output sequences, with the input and output vocabulary sizes being dyn... | codefeedback |
You are working on a geographic data processing application that involves finding grid points based on longitude values. You are given a Python code snippet that uses NumPy to find the indices of longitude values in an array that are closest to given boundary longitudes. Your task is to implement a function that takes ... | codefeedback |
You are tasked with implementing a mutex collision detection strategy for a scheduler in a multi-threaded environment. The scheduler manages the execution of tasks and needs to handle potential collisions when multiple tasks attempt to access shared resources simultaneously. The provided code snippet outlines the confi... | codefeedback |
You are tasked with creating a simple game using Python's tkinter library. Your game will involve a bouncing ball that moves within a window. To achieve this, you need to implement a Ball class with the following functionalities:
1. `__init__` method: This method initializes the ball's attributes, including its positi... | codefeedback |
You are tasked with creating a Rust module that manages the layout and rendering of user interface elements for a graphical application. The module should provide a clean and organized interface for other parts of the application to interact with. Your task is to implement the `ui_manager` module, which will serve as t... | codefeedback |
You are tasked with implementing a random number generator using the linear congruential generator (LCG) algorithm. The LCG algorithm generates a sequence of pseudo-randomized numbers using the formula:
Xn+1 = (a * Xn + c) mod m
Where:
- Xn is the current value in the sequence
- a, c, and m are constants
- mod repres... | codefeedback |
You are given a Python code snippet that manipulates the "acc" attribute of various objects. The code snippet is part of a larger program that simulates the movement of points in a 2D space. The "acc" attribute represents the acceleration of a point in different directions (S, E, M). The code snippet updates the "acc" ... | codefeedback |
You are given a graph object `g` representing a directed graph. The graph is represented using an adjacency list where `g[i]` is a list containing the indices of the nodes that are adjacent to node `i`. Each node is represented by its index in the adjacency list.
Write a function `findStronglyConnectedComponents(g)` t... | codefeedback |
You are tasked with implementing a function that processes regular expressions in a custom programming language. The language uses the `mrb` interpreter and provides a `Guard` structure for memory management. Your goal is to create a function that takes a reference to the interpreter, a `Guard` instance, and a value, a... | codefeedback |
You are tasked with creating a function that validates user registration information for a web application. The function should take in a username, password, and password confirmation, and return a boolean value indicating whether the registration information is valid. The validation rules are as follows:
- The usernam... | codefeedback |
You are tasked with creating a program to draw a polygon using a given set of vertices and a specified fill style. The vertices of the polygon are represented by their (x, y) coordinates, and the fill style can be either filled (F) or drawn (D) without fill. The program should use the provided code snippet as a referen... | codefeedback |
You are working on a project that involves training different variations of a DenseNet model with different configurations. The code snippet provided shows the setup for logging the training process for these variations. Each configuration involves using a pre-trained DenseNet model with a multi-layer perceptron (MLP) ... | codefeedback |
You are tasked with implementing a Python class for a statistical model used in genetics research. The class, named `GeneticModel`, is responsible for calculating and storing various parameters related to genetic analysis. The class has the following attributes and methods:
Attributes:
- `covariates_variance`: A float... | codefeedback |
You are tasked with implementing a reorthogonalization method for a given set of vectors. The reorthogonalization process aims to ensure that the set of vectors remains orthogonal (perpendicular) to each other, which is crucial in various numerical algorithms and linear algebra computations.
You are given a Python cod... | codefeedback |
You are tasked with creating a form validation function for a web application. The function should validate the input from a source URL field in a form. The source URL field is represented by the HTML code snippet below:
```html
<FormControl margin="normal" fullWidth>
<InputLabel htmlFor="source-url">Source Url</Inp... | codefeedback |
You are tasked with implementing a function that processes file paths and extracts specific information from them. The function should take a directory path as input and return a list of all the ".proto" files found within that directory and its subdirectories. The ".proto" files are used in protocol buffer definitions... | codefeedback |
You are tasked with creating a program that simulates a simple command-line tool for colorizing and displaying messages. The program should take a message, a color, and an option to apply the color, and then display the colorized message.
The program should have the following features:
- Accept a message string, a col... | codefeedback |
You are tasked with implementing a function that merges two interpretations, represented as dictionaries, into a single interpretation. An interpretation is a mapping of keys to values, where the keys are of a specific enumeration type `InterpretationKey`. The function `try_merge` takes two interpretations `a` and `b` ... | codefeedback |
You are tasked with implementing a function to factorize a given integer using the Elliptic Curve Method (ECM) or a default factorization method. The function `factorization` takes three parameters: `x` (the integer to be factorized), `timeout_duration` (the maximum time allowed for factorization), and `use_ecm` (a boo... | codefeedback |
You are tasked with creating a script to automate the installation of software packages on a Linux system. The script should parse a configuration file and execute the necessary steps to download and install the specified packages. The configuration file contains a list of package names and their corresponding binary d... | codefeedback |
You are tasked with implementing a function that retrieves the location of a country based on its ISO code or ISO3 code. You are given a Python code snippet that demonstrates the logic for retrieving the location based on the country code. Your task is to write a function that encapsulates this logic and returns the lo... | codefeedback |
You are tasked with creating a function that simulates the behavior of a testable interceptor. The function should take an injected result and a closure representing the code to be intercepted. The function should then execute the closure and return a tuple containing the arguments passed to the closure and the injecte... | codefeedback |
You are tasked with creating a Rust library for a file system explorer application. The library should provide two main modules: `Explorer` and `System`. The `Explorer` module will handle file exploration functionalities, while the `System` module will manage system-related operations.
Your task is to implement the `E... | codefeedback |
You are tasked with creating a Python class that can parse and manipulate XML data. Your task is to implement a class called `XMLParser` that has the following methods:
1. `load_xml_from_file(file_path)`: This method should take a file path as input and load the XML data from the file into an internal data structure w... | codefeedback |
You are tasked with writing a Python function that organizes a list of tuples representing file paths and their corresponding categories into a hierarchical dictionary structure. Each tuple contains the file path and its category or categories. The function should create a nested dictionary where the keys represent the... | codefeedback |
You are tasked with implementing a function that saves a given stock price data to a specified column in a 2D NumPy array. The function should handle the scenario where the specified column does not exist in the array by adding the column to the array and then saving the stock price data.
You are given the following c... | codefeedback |
You are tasked with creating a system to manage student information for a school. The system should allow for the storage of student details such as their date of birth, current address, and permanent address. Additionally, the system should be able to associate students with their respective subjects.
You are provide... | codefeedback |
You are tasked with implementing a neural network layer that performs a specific transformation on the input data. The transformation involves passing the input through two layers (`layer3` and `layer4`), and then performing a matrix multiplication with a diagonal matrix constructed from the exponential values of a giv... | codefeedback |
You are tasked with implementing a unique binary search tree (BST) builder that takes an array of integers and constructs a BST with unique values. The BST should enforce uniqueness, meaning that no duplicate values are allowed in the tree.
You are given the following code snippet as a starting point:
```csharp
[Test... | codefeedback |
You are tasked with implementing a Python function that processes geotag data from different sources and generates a description based on the processed data. The function should handle different geotag sources and apply specific configurations based on the source type.
You are given a code snippet that includes a cond... | codefeedback |
You are tasked with implementing a Python class for creating tables. The class should be able to generate tables with specified numbers of rows and columns, and populate the table with given cell contents. The table should also support merging cells both horizontally and vertically.
Your task is to implement the `Tabl... | codefeedback |
You are tasked with creating a role-based access control system for a company's web application. The system should allow users to be assigned different roles and permissions within the company. Your task is to implement a function that checks whether a user has a specific permission based on their role and the company'... | codefeedback |
You are tasked with implementing a text generation function that takes various inputs and processes them to produce a final text output. The function `generate_text` is defined within a class and takes the following parameters:
- `inputs`: Can be either a string or a list of strings. If it's a string, the function uses... | codefeedback |
You are tasked with implementing a program to compare the performance of decision trees and random forests on a given dataset. The program should train both a decision tree and a random forest with different numbers of trees and evaluate their accuracy on a test dataset. The dataset contains both features and labels, a... | codefeedback |
You are given a Python class that performs various operations related to clustering and label analysis. The class contains a method `create_experiment` that takes a variable number of arguments and sets the global variable `args` to the provided arguments. The method also logs information about the count of kernels and... | codefeedback |
You are tasked with creating a Python function that processes a given string containing key-value pairs and extracts specific information based on the provided keys. Each key-value pair is represented as a JSON object, and the keys are always in uppercase. The keys to be extracted are "NUMBER", "EMOJI", "DOUBLE_QUOTED_... | codefeedback |
You are tasked with creating a location management system for a mobile application. The system should allow users to save and retrieve location data, including latitude, longitude, name, and a flag indicating whether the location is pinned. You are required to implement a class or struct to represent a location, as wel... | codefeedback |
You are tasked with implementing a function to calculate the total amount of vested coins for a user in a blockchain system. The vested coins are determined based on a vesting schedule, where a certain amount of coins becomes available to the user at specific time intervals.
You are given a Rust struct `VestingSchedul... | codefeedback |
You are tasked with implementing a class that manages chunks of data in a memory-constrained system. The class, named `ChunkManager`, is responsible for handling the allocation, deallocation, and modification of data chunks. Each chunk is represented by the `ChunkIt_t` structure, which contains information about the ch... | codefeedback |
You are tasked with implementing a memoization pattern for fetching data from the Uniswap V3 API for different Ethereum networks. The provided code snippet is a TypeScript class `UniswapV3Fetchers` that manages subgraph clients for multiple networks. The class has a private constructor and a private static instance, al... | codefeedback |
You are tasked with implementing a simplified version of a trade API for a cryptocurrency exchange. The provided code snippet is a partial implementation of the `trade_api` method within a Python class. Your task is to complete the implementation of the `trade_api` method by adding the necessary logic to handle the tra... | codefeedback |
You are tasked with creating a program that dynamically loads and executes a method from a specified assembly. Your program should prompt the user for the assembly name, class name, method name, and method parameters, and then execute the specified method with the provided parameters. The program should handle any pote... | codefeedback |
You are tasked with implementing a Python function that processes series data and calculates the derivative of the series. The function should handle reliable and unreliable data differently and support both one-dimensional and two-dimensional series.
You are given a code snippet that demonstrates the usage of the `pr... | codefeedback |
You are tasked with creating a program that validates user input for a registration form using PHP. The program should utilize the Laravel framework's validation features to ensure that the input adheres to specific rules.
Your task is to complete the `store` method within a Laravel controller. The method receives an ... | codefeedback |
You are working on a data analysis project and need to create a program to calculate the average of properties for different data points. You have a list of data points called `pints`, and for each data point, you need to calculate the average of a property indicated by `propindic`. The averages should be stored in a D... | codefeedback |
You are tasked with creating a Python function that monitors the memory usage of a process and alerts when the memory usage exceeds a certain threshold. The function should continuously monitor the memory usage and raise an alert when the memory usage surpasses the specified threshold.
You are provided with a code sni... | codefeedback |
You are tasked with implementing a function to update the configuration settings for different note types in a note-taking application. The configuration settings are stored in a dictionary named `conf`, and each note type has its own settings stored within the `conf` dictionary. The provided code snippet initializes t... | codefeedback |
You are tasked with creating a program to parse and represent a hierarchical data structure in JSON format. The program should be able to handle recursion to a specified depth and convert the data into a JSON object.
You are given a partial Java code snippet that represents a method for dumping a node in JSON format. ... | codefeedback |
You are tasked with implementing a custom smart pointer in Rust that mimics the behavior of the `Rc` (reference counting) smart pointer. The custom smart pointer, named `CustomRc`, should provide shared ownership of a resource and automatically free the resource when the last reference to it is dropped.
Your task is t... | codefeedback |
You are tasked with implementing a simplified version of a service definition and stream producer in TypeScript. The provided code snippet is a TypeScript function that takes a `streamProducer` of type `ModuleRpcClient.StreamProducer` and returns a `ModuleRpcClient.Service` with a specified `serviceDefinition` and `Res... | codefeedback |
You are tasked with creating a Python function that efficiently retrieves all image files from a specified folder and its subfolders. Additionally, the function should generate a save path for each image file based on a provided root destination path. You are required to implement the `get_input_images` function, which... | codefeedback |
You are tasked with creating a Python function that processes an input image to mask a specific color range and then applies the mask to the original image. The function should take an input image in the form of a NumPy array and return the resulting masked image.
The function should be named `color_masking` and shoul... | codefeedback |
You are tasked with implementing a statistics tracking system for a software application. The system should include a button to update the statistics and display the statistics in a graphical user interface (GUI). The statistics should be updated when the button is clicked, and the updated statistics should be visually... | codefeedback |
You are tasked with implementing a function that takes a list of URLs and returns the domain names of these URLs. The domain name is defined as the substring between the first and second occurrence of the character '/' in the URL. If the URL does not contain a second '/', the entire URL should be considered as the doma... | codefeedback |
You are tasked with creating a Python program to convert a given amount of money in Brazilian reais (BRL) to US dollars (USD) based on the current exchange rate. The program should take the amount of money in BRL as input and then calculate and display the equivalent amount in USD. The exchange rate to be used is 1 BRL... | codefeedback |
You are tasked with creating a simple CPU emulator for a custom instruction set architecture. The CPU emulator will need to support various addressing modes and opcodes. Your task is to implement the logic for decoding and executing the opcodes based on the provided opcode matrix.
The provided code snippet includes im... | codefeedback |
You are tasked with creating a Python function that retrieves the current version of a library. Your function should return a string representing the version number. The version number is expected to match the value specified in the library's setup.py file.
Write a function called `get_library_version` that takes no a... | codefeedback |
You are tasked with implementing a function to perform unpacking of high packed data using MMX technology. MMX (MultiMedia eXtension) is a set of multimedia instructions for x86 microprocessors that support SIMD (Single Instruction, Multiple Data) operations. The specific function to be implemented is `punpckhbw`, whic... | codefeedback |
You are tasked with simulating the movement of a rover on a rectangular grid. The grid is represented by a set of coordinates (x, y), where (0, 0) represents the bottom-left corner. Each cell on the grid is identified by a pair of coordinates, with the first coordinate representing the x-axis and the second coordinate ... | codefeedback |
You are tasked with creating a program that reads a Java source file and counts the occurrences of specific keywords within the file. The keywords to be counted are "package", "import", and "class".
Write a function or method that takes a file path as input and returns a dictionary or map containing the counts of each... | codefeedback |
You are tasked with implementing a password hashing function that utilizes a salt to enhance security. The salt is a random value that is combined with the password before hashing to prevent attackers from using precomputed tables to crack the passwords. Your goal is to complete the `shifr_salt` method, which takes a p... | codefeedback |
You are tasked with implementing a Python class that extends a given StackBuilder class to create and manage AWS IAM (Identity and Access Management) resources using CloudFormation. The IAMBuilder class is responsible for constructing and updating IAM-related CloudFormation stacks. Your task is to complete the implemen... | codefeedback |
You are tasked with creating a Python function that processes a dataframe to generate a correlation matrix based on boolean values. The dataframe represents items and their associated tags. Each item can have multiple tags, and the goal is to create a correlation matrix that shows the relationship between the tags.
Yo... | codefeedback |
You are working on a project that involves quantization and recovery of data using TensorFlow. In the given code snippet, a quantization process is performed to assign each element of a tensor to the nearest centroid, and then a recovery process is carried out to create a new tensor based on the quantized results.
You... | codefeedback |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.