instruction_seed stringlengths 0 26.4k | source stringclasses 4
values |
|---|---|
You are tasked with implementing a custom attribute system in C#. The goal is to create a system that allows developers to mark their classes and methods with custom attributes and then retrieve and use this metadata at runtime.
Your task is to create a `CustomAttribute` class that can be used to mark classes and met... | codefeedback |
You are tasked with creating a custom JUnit Runner for a Java project. The custom runner should be able to handle the execution of test classes that reference GWT (Google Web Toolkit) components, either directly or indirectly. The custom runner should be annotated with `@RunWith(GwtRunner.class)` to enable its usage in... | codefeedback |
You are tasked with creating a Python function that parses a given text file to extract the copyright information. The copyright information is typically found within comments at the beginning of the file and follows a specific format. The function should return the name of the copyright holder and the license under wh... | codefeedback |
You are working on a project that involves modeling count data using a probabilistic programming framework. The code snippet provided is a part of a Python class that defines a probabilistic model using TensorFlow Probability (TFP) library. The model is a Poisson distribution with a time-varying rate parameter. Your ta... | codefeedback |
You are tasked with creating a program that monitors a set of URLs for changes and stores the updated content in a Redis database. Your program should periodically make HTTP requests to the specified URLs, compare the retrieved content with the previously stored content in Redis, and update the Redis database if any ch... | codefeedback |
You are tasked with implementing a custom modal component in a React application. The modal should provide a confirmation dialog with customizable buttons and behavior. Your task is to create a TypeScript interface for the props of the modal component and then implement the modal component itself.
You are given the fo... | codefeedback |
You are tasked with implementing a DAG (Directed Acyclic Graph) traversal algorithm to process a series of passes on a simulation top object. Each pass represents a specific operation that needs to be executed in a particular order. Your goal is to design a program that can efficiently execute these passes in the corre... | codefeedback |
You are tasked with creating a Python function that processes a given dataset to perform graph analysis. The function should take a dataset as input, perform necessary preprocessing, and then apply graph analysis techniques to extract relevant information.
Your task is to implement the `graph_analysis` function, whic... | codefeedback |
You are tasked with creating a Bash script that validates versioning information for a software release. The script should check if the environment variables `VERSION` and `SNAPSHOT` are set, and if the `SNAPSHOT` version follows a specific format.
The script should perform the following checks:
1. If the `VERSION` en... | codefeedback |
You are tasked with creating a Django REST framework API endpoint for managing contacts. Your task is to implement a view that allows users to create a new contact, retrieve a list of all contacts, and retrieve a specific contact by its ID. You will need to define the necessary serializer and view to achieve this funct... | codefeedback |
You are tasked with implementing a function that checks the validity of a given package graph. A package graph is a collection of interconnected packages, where each package has dependencies on other packages. The function should take the package graph as input and return whether the graph is valid or not. A valid pack... | codefeedback |
You are tasked with creating a program that simulates a simple banking system. The system should be able to create accounts, deposit and withdraw funds, and provide the account balance. Additionally, the program should be able to transfer funds between accounts.
Your task is to implement a class `Bank` that provides t... | codefeedback |
You are working on a system that integrates with various APIs to retrieve information about land titles. The system needs to make authenticated requests to a search API and retrieve geographic and historical data about specific land titles. The environment variables for the API endpoints and URLs are provided as follow... | codefeedback |
You are tasked with creating a program to parse and analyze a series of job experiences stored in a list of dictionaries. Each dictionary represents a job experience and contains the following keys: 'name' (job title), 'company' (company name), 'location' (job location), 'working_period' (period of employment), and 'jo... | codefeedback |
You are given a list of strings, where each string is a word. Your task is to find the length of the longest string chain that can be formed by deleting a single character from any of the words. A string chain is a sequence of words [w1, w2, ..., wn] where each word is formed by deleting a single character from the pre... | codefeedback |
You are tasked with implementing a Java class that represents a basic geometric shape. The class should have methods to set and retrieve the color of the shape. Additionally, the class should have a constructor that initializes the color of the shape to a default value if no color is provided. Your task is to complete ... | codefeedback |
You are tasked with creating a Python class that manages a music library. The class should be able to handle albums, students, modules, and tracks, and provide serialization functionality for each of these entities. Your task is to implement the `MusicLibrary` class with the following requirements:
1. The class should... | codefeedback |
You are tasked with implementing a binomial tree option pricing model to calculate the price of a European put option. The binomial tree model is a discrete-time, discrete-state model used for valuing options. The option has the following parameters:
- Option type: Put
- Current stock price: $50
- Strike price: $52
- R... | codefeedback |
You are tasked with creating a Python program that involves defining a data model for a REST API using the Flask-RESTPlus library. The code snippet provided is a part of this process and demonstrates the usage of the `api.model` method to define a data model for a specific resource.
Your task is to complete the progra... | codefeedback |
You are tasked with creating a Python class that represents a simple bank account. The class should have methods to deposit funds, withdraw funds, and check the current balance. Additionally, the class should handle currency conversion for deposits and withdrawals in different currencies.
Your task is to implement the... | codefeedback |
You are tasked with implementing a class that manages system configurations and snapshots. The class should provide methods for retrieving configurations, snapshots, and setting the current configuration. The class should also establish connections to the Snapper and Systemd services.
You are given a code snippet that... | codefeedback |
You are tasked with implementing a feature in an Android application that allows the user to exit the app by pressing the back button twice within a short time frame. You need to create a class that manages this behavior and integrate it into the existing codebase.
You are provided with a partial code snippet from an ... | codefeedback |
You are tasked with creating a script to automate the process of checking for Go import errors in a given set of files and fixing them if necessary. The script should utilize the `goimports` tool to identify any import errors and provide instructions for resolving them.
Your script should perform the following steps:
... | codefeedback |
You are tasked with implementing a ControllerLoader class that dynamically loads and instantiates controller classes from a specified directory in a Python web application. The ControllerLoader class should provide a method to load a controller by its name and execute a method on the loaded controller.
The ControllerL... | codefeedback |
You are tasked with creating a script to automate the testing of different compiler optimization options for C and C++ source files. The script should iterate through a directory containing C and C++ source files, compile each file with different optimization options, and then run a test script to evaluate the compiled... | codefeedback |
You are tasked with creating a Python function that processes a list of paths and generates a JSON file containing Docker build instructions for each path. The function should take in the following parameters:
- `paths`: A list of strings representing paths to different services.
- `registry`: A string representing the... | codefeedback |
You are tasked with implementing a cancellation and commit mechanism for a series of events in a JavaScript application. The application uses the `esp-js` library for managing event streams and the `ImmutableModel` class for maintaining the application state.
The `TestEvent` interface defines the structure of events t... | codefeedback |
You are tasked with creating a program that generates ASCII art of animals using the `cowpy` library and saves the output to a JSON file. The program should prompt the user to enter the name of an animal and the text to be displayed in the ASCII art. The program should then use the `cowpy` library to generate the ASCII... | codefeedback |
You are tasked with implementing a function that extracts and formats data from a given array of objects. The objects represent products, and each object contains information about the product's name, category, and price. Your function should filter the products based on a specified category and format the price of eac... | codefeedback |
You are tasked with implementing a generic class for handling interpolation of values. The class should support different types of interpolation methods and provide the flexibility to specify the interpolation method when creating an instance of the class.
You are provided with a TypeScript code snippet that defines a... | codefeedback |
You are tasked with creating a program to visualize the intersection and union of two sets using a Venn diagram. The Venn diagram should display the sets A and B, along with their intersection and union. The program should allow for customization of the subset sizes and set labels.
Write a Python function `create_venn... | codefeedback |
You are tasked with creating a program that simulates a simple address book. The address book should allow users to add, delete, and search for contacts. Each contact will have a name, phone number, and email address. The program should provide a menu-based interface for users to interact with the address book.
Your t... | codefeedback |
You are tasked with creating a Python function that interacts with a virtualization library to manage virtual machines. The function should connect to the virtualization platform, retrieve a list of running virtual machines, and return the names of these virtual machines as a list. You are provided with a code snippet ... | codefeedback |
You are tasked with implementing a class that handles the serialization and deserialization of data using the Apache Arrow library. The class should support loading data and potentially offsetting the buffer based on the provided metadata.
You are given a partial code snippet for the class:
```java
public class Arrow... | codefeedback |
You are tasked with implementing a function to convert data from a Lua configuration table into a custom data structure. The provided code snippet is a part of a C++ program that defines a method `convert` within the `GodDB` class. The `convert` method takes a Lua `ConfigTable` object named `data` and a `std::string` n... | codefeedback |
You are tasked with implementing a message broker system that handles message payloads and subscriptions. The system should allow subscribers to register callback methods for specific topics and receive messages when those topics are published.
You are given a partial code snippet from the message broker system, which... | codefeedback |
You are tasked with creating a function that searches for images based on a user-provided query and returns a random image result. You are given a code snippet that partially implements this functionality using an `images` object and various utility functions. Your task is to complete the implementation of the `searchI... | codefeedback |
You are tasked with implementing a simplified version of a virtual machine for a custom programming language. The virtual machine operates on a set of instructions and data types, and your goal is to create a function that executes these instructions.
You are given the following code snippet as a reference for the typ... | 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 then write the word counts to a new file in the format "word: count". Additionally, the program should be able to handle different file encodings and should ignore punctuation and case ... | codefeedback |
You are tasked with implementing a Rust trait and its associated functions for managing the versioning of a pallet in a blockchain runtime. The trait `GetPalletVersion` has two associated functions: `current_version` and `storage_version`. The `current_version` function returns the current version of the pallet, while ... | codefeedback |
You are tasked with implementing a Python module that provides a custom hexdump function for displaying the hexadecimal content of a file. The module should also include a helper function for abbreviated usage and a constant for enabling colored output.
Your task is to create a Python module that fulfills the followin... | codefeedback |
You are tasked with creating a program that analyzes a given text file to count the occurrences of specific license-related terms. The program should read the text file and identify the number of times the following terms appear: "license", "License", "LICENSE", "Apache", "apache", "APACHE". The program should be case-... | codefeedback |
You are tasked with implementing a logging system for a software application. The application has a `Logger` interface with a method `getLogInfo()` that should be implemented by various logging classes. The `getLogInfo()` method should return a string containing the log information specific to the logging class. Your t... | codefeedback |
You are given a Python class `A` with an attribute `a`, a subclass `C` of `A` with an attribute `c`, and a test case `TestKeys` that checks the keys of an object using a function `R.keys(obj)`. Your task is to implement the `R.keys(obj)` function that returns an array of the given object's own keys.
Write a function `... | codefeedback |
You are tasked with creating a web application that manages products. The application uses the Laravel framework, and the code snippet provided is from a Blade template file used to display product information in a table. The `{{$producto->activo}}` and `{{$producto->sliderprincipal}}` are variables representing the "a... | codefeedback |
You are tasked with implementing a Python program that performs feature selection and evaluation for a machine learning model. The program takes command-line arguments for training and test data files, as well as an optional argument for the feature size. The feature size must be at least 2, and if not provided, it def... | codefeedback |
You are tasked with creating a program that simulates a simplified version of a message passing interface (MPI) communication pattern. In this problem, you will be focusing on the "uniband" communication benchmark, which measures the bandwidth of point-to-point communication between MPI processes.
The benchmark is typ... | codefeedback |
You are given a Python code snippet that defines a dictionary of locations on a map. Each location is represented by a key and a corresponding `map_funcs.Point` object, which contains the x and y coordinates of the location. However, some of the locations are commented out, and it's unclear why. Your task is to write a... | codefeedback |
You are tasked with implementing a file management system that involves deleting files and directories. Your goal is to write a function that takes in an array of file system objects and deletes them according to the following rules:
1. If the object is a file, it should be deleted directly.
2. If the object is a direc... | codefeedback |
You are tasked with implementing a custom deep copy function in Python. The deep copy function should create a new object and recursively copy all nested objects within the original object, ensuring that the copied object is completely independent of the original. You should not use the built-in `copy.deepcopy()` funct... | codefeedback |
You are tasked with creating a script to automate the process of updating a package in an Arch Linux repository. The script should clone the upstream repository, copy modified files to it, grant write permission to the nobody user, and then run a command to check if the package works.
Your task is to write a Bash scri... | codefeedback |
You are tasked with creating a Python script to automate the deletion of Google Cloud Platform (GCP) service accounts using the `google-cloud-sdk` library. Your script should take a service account name as input and delete the specified service account from the GCP project. You should handle any potential errors that m... | codefeedback |
You are tasked with implementing a Python function that processes a list of tasks in parallel using a specified number of workers. Each task is represented by a string and needs to be processed by a worker function. The function should distribute the tasks among the workers and return the results in the same order as t... | codefeedback |
You are working on a software project that heavily utilizes design by contract (DbC) principles to ensure the correctness of the code. The project uses a library called "contracts" to implement these contracts. The library provides two functions: `disable_all` and `enable_all`, which respectively disable and enable all... | codefeedback |
You are tasked with implementing a function to update the means of clusters in a K-means clustering algorithm. The function `CalcMeans` takes three parameters: `X`, `oldmeans`, and `clusters`.
- `X` is a 2D array representing the data points, where each row corresponds to a data point and each column corresponds to a... | codefeedback |
You are tasked with implementing a doubly linked list in Python. The provided code snippet is a part of a `Node` class that represents a node in the doubly linked list. The `Next` property returns the data of the next node in the list, and the `Prev` property returns the data of the previous node. If the current node i... | codefeedback |
You are tasked with implementing a Python class that interacts with the Electrum blockchain API to retrieve unspent transaction outputs (UTXOs) for a given Bitcoin address. Your task is to complete the implementation of the `ElectrumAPI` class by adding a method to parse the response from the API and return the list of... | codefeedback |
You are tasked with implementing a function to check for the installation of a specific software patch. The function will take in a version number as an argument and should return 1 if a newer 100 series patch is already installed, and 0 otherwise. The function will be part of a larger script that iterates through inst... | codefeedback |
You are given a string containing a series of hexadecimal escape sequences. Each escape sequence represents a character in the string. Your task is to decode the string and convert it into its corresponding ASCII representation.
Write a function `decode_hex_string` that takes a string `hex_string` as input and returns... | codefeedback |
You are tasked with creating a Python program to classify handwritten digits using a pre-trained neural network model. The model has three hidden layers (l1, l2, and l3) and uses the softmax function to output the probabilities for each digit (0-9). Your program should load the pre-trained model from a file, process an... | codefeedback |
You are tasked with implementing a simple pressure field simulation in a 2D grid. The pressure field is represented by a 2D array of floating-point numbers. You need to create a `PressureField` struct and implement methods to manipulate and visualize the pressure field.
You are provided with a partial code snippet for... | codefeedback |
You are tasked with implementing a function that simulates a text-to-speech system. The function should take a string of text and a host as input, and return the time it takes to "say" the text using the specified host. Additionally, the function should print the text and the time it took to say the text, followed by a... | codefeedback |
You are tasked with implementing a function to plot scatter pie plots. A scatter pie plot is a type of scatter plot where the markers are replaced by pie charts. Each pie chart represents the distribution of a categorical variable at a specific point in the scatter plot.
You need to implement a Python function `plot_s... | codefeedback |
You are tasked with creating a program that simulates a simple banking system. The system should be able to create and manage bank accounts, allowing users to deposit, withdraw, and check their balance. Each bank account should have a unique account number and be associated with the account holder's name. The program s... | codefeedback |
You are tasked with implementing a parallelized random search algorithm using Python's `multiprocessing` module. The goal is to parallelize the random search process to efficiently explore a large search space for finding optimal solutions.
Your task is to complete the implementation of the `parallel_random_search` fu... | codefeedback |
You are tasked with implementing a generic function that calculates the total distance of a route in a transportation network. The transportation network is represented by a graph, where nodes are locations and edges are roads connecting the locations. Each edge has a weight representing the distance between the connec... | codefeedback |
You are tasked with implementing a Python module for iterative linear solvers used in numerical methods for solving linear systems of equations. The given code snippet is a part of the module, which contains various iterative solvers such as GMRES, FGMRES, CG, CR, CGNR, CGNE, BiCGSTAB, steepest descent, and minimal res... | codefeedback |
You are tasked with creating a Python class to process and analyze Twitter data. The class should have methods to perform various operations on tweets, such as calculating the average score, finding the most frequent Twitter handle, and updating the tweet counter. The class should also maintain a list of tweets and the... | codefeedback |
You are tasked with creating a program that simulates a mood mirror. The mood mirror program should take input from the user and reflect it back in a modified form based on certain rules. The rules for modifying the input are as follows:
1. If the input is a single word, the program should reverse the word and display ... | codefeedback |
You are tasked with implementing a program to manage a warehouse inventory system. The inventory consists of various items, each with a unique name. Your program should support adding new items to the inventory, removing items, and displaying the current inventory list in alphabetical order.
You are given a list of it... | codefeedback |
You are tasked with creating a Python program that efficiently calculates the memory size of a given object. The program should prompt the user to enter a value for the object and then display the memory size of the object in bytes. You should implement a function that takes the object as input and returns its memory s... | codefeedback |
You are tasked with creating a Python class that manages schema migrations for different databases. Your task is to implement the `MigrationController` class, which should handle listing and tracking the status of migrations for various database groups.
The `MigrationController` class should have the following methods... | codefeedback |
You are tasked with implementing a Python class that interacts with an API using a user token for authentication. Your task is to complete the implementation of the `Client` class, which inherits from `AbstractClient` and is responsible for making requests to the specified API host using the provided user token.
Your ... | codefeedback |
You are working on a geographic information system (GIS) project and need to implement a function to calculate the bathymetric gradient within a given workspace. The function `bathymetricGradient` takes several input parameters: `workspace`, `snapGrid`, `hucPoly`, `hydrographyArea`, `hydrographyFlowline`, `hydrographyW... | codefeedback |
You are tasked with creating a function that processes a given script and extracts the variables used within it. The script is written in JavaScript and may contain variable assignments, function calls, and other JavaScript statements. Your task is to write a function that identifies and returns all the unique variable... | codefeedback |
You are tasked with creating a Swift application that manages multiple view controllers using storyboards. Your goal is to implement a function that instantiates a view controller from a specified storyboard. You are provided with a code snippet that includes an extension to the UIViewController class, which contains a... | codefeedback |
You are tasked with implementing a simple observer pattern in Swift. You need to create a class that allows other objects to observe changes to a specific property and be notified when the property's value changes.
Your task is to create a `PropertyObserver` class that allows observers to register themselves and recei... | codefeedback |
You are tasked with creating a program that simulates a space mission to the moon. The program will calculate the number of trips required to transport a given number of people from Earth to the moon, based on the capacity of a spacecraft and the average distance from Earth to the moon.
You are given the following inf... | codefeedback |
You are tasked with implementing a simple text-based user interface (TUI) library in C#. The library should support the creation of various widgets such as paragraphs, headers, buttons, panels, and checkboxes. Your goal is to create a class hierarchy for these widgets and implement the necessary functionality to add th... | codefeedback |
You are tasked with creating a program that simulates a simple banking system. The program should allow users to create accounts, deposit and withdraw funds, and check their balance. The program should also be able to handle multiple accounts and perform basic error checking.
Your task is to implement the `BankAccount... | codefeedback |
You are tasked with creating a script to automate the build and deployment process for a web application. The script should handle building the application using Bazel and then copying the output to a specified destination. Additionally, the script should include a function to build a WebAssembly module using npm and h... | codefeedback |
You are tasked with implementing a simple module system for a programming language. The module system should allow users to define and import modules, and resolve dependencies between modules. Each module can have dependencies on other modules, and the module system should ensure that all dependencies are resolved befo... | codefeedback |
You are tasked with creating a Python function that processes a list of tasks in parallel using the `multiprocessing` module. Each task is a dictionary containing arguments to be passed to a specified function. The function should execute the specified function for each task and return a list of success flags indicatin... | codefeedback |
You are tasked with creating a Python program to analyze and visualize shot lengths in a movie. Shot length refers to the duration of a single continuous shot in a film. The program should read a list of shot lengths from a file, calculate the frequency of each shot length, and then create a histogram to visualize the ... | codefeedback |
You are tasked with implementing a C++ template meta-programming problem related to operator lifting. The goal is to create a meta-function that determines the result type and value type of a lifted operator.
You are provided with a partial code snippet that defines a `lift_traits` meta-function within the `operators:... | codefeedback |
You are working on a project that involves parsing and analyzing PHP code. As part of this task, you need to write a function that extracts the names of all the constants defined in a given PHP file. A constant in PHP is defined using the `const` keyword and is case-sensitive.
Write a function `extractConstants` that ... | codefeedback |
You are tasked with implementing a function to decompress data using the ZLIB compression algorithm. ZLIB is a widely used data compression library that uses the DEFLATE algorithm, which combines the LZ77 algorithm and Huffman coding. Your goal is to write a function that takes compressed data as input and returns the ... | codefeedback |
You are given a list of flights, where each flight is represented as a tuple (source, destination, price). You are also given three integers, src, dst, and k, representing the source city, destination city, and the maximum number of stops allowed in a flight path. You need to find the cheapest price from src to dst wit... | codefeedback |
You are tasked with creating a Python package that provides a simplified interface for working with JSON data. Your package, named "lazyjson", should offer lazy loading of JSON files and provide a method for accessing specific keys within the JSON data.
Your task is to implement the `LazyJSON` class within the "lazyjs... | codefeedback |
You are tasked with creating a Python function that processes financial data to calculate the polynomial regression of stock prices over time. The function should take in a list of polynomial coefficients and a list of dates, and return the polynomial regression function and the first date in the list.
The function si... | codefeedback |
You are tasked with implementing a Python function that calculates the total number of ways to reach the top of a staircase. You can climb the staircase by either taking one step or two steps at a time. The function should take the number of steps in the staircase as input and return the total number of distinct ways t... | codefeedback |
You are tasked with implementing a SQL query parser for a custom SQL dialect. The parser is responsible for handling various SQL operations and expressions. One of the functionalities of the parser is to modify the structure of a SQL expression based on certain conditions. Your task is to implement a method that modifi... | codefeedback |
You are given a directed graph with weighted edges. Your task is to implement a bidirectional Dijkstra algorithm to find the shortest path between two given nodes. The bidirectional Dijkstra algorithm simultaneously runs Dijkstra's algorithm from the source node and the target node, meeting in the middle when their sea... | codefeedback |
You are tasked with analyzing CPU utilization data from a set of servers. The data is represented in a Pandas DataFrame with the following structure:
| server_name | cpu_utilization |
|-------------|-----------------|
| server1 | 80 |
| server2 | 60 |
| server3 | 90 |... | codefeedback |
You are tasked with creating a unit test for a Python class method. The class, `Store`, is responsible for managing settings from a file. The method to be tested is `get` which is expected to read settings from a file and store them in the `settings` attribute of the `Store` instance. The code snippet provided is a par... | codefeedback |
You are working on a project that involves defining and using generic types and extensions in Swift. As part of this project, you need to create a custom type and extension to measure the size of internal nodes in a tree structure. The provided code snippet is a starting point for this task.
Your task is to define a g... | codefeedback |
You are tasked with implementing a Python function that performs eigenvalue decomposition on a given matrix using the appropriate solver based on certain conditions. The function should take into account the number of eigenpairs to compute, the symmetry of the matrix, and specific solver settings.
You are provided wit... | codefeedback |
You are tasked with implementing a custom error type for a Rust networking library. The library needs to handle errors related to socket addresses and provide a way to log these errors. Your task is to define the custom error type and implement the necessary functionality to log socket address errors.
Your custom erro... | codefeedback |
You are tasked with implementing a protein sequence modification algorithm. Given a protein sequence and a set of fixed modifications, the algorithm should apply the fixed modifications to the N-terminus of the protein sequence. Each fixed modification is represented by a description enclosed in square brackets, and th... | codefeedback |
You are tasked with implementing a non-recursive version of Huffman coding algorithm. Huffman coding is a widely used algorithm for lossless data compression. In this problem, you are required to write a Python function to generate Huffman codes for characters in a given text using a non-recursive approach.
You are gi... | codefeedback |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.