instruction_seed stringlengths 0 26.4k | source stringclasses 4
values |
|---|---|
You are tasked with creating a Java method to count the number of tasks in a sprint using the given code snippet as a reference. The code snippet is part of a Camel route in an Apache Camel application, which processes messages and interacts with a database. Your task is to implement the `countSprintTasks` method in th... | codefeedback |
You are tasked with creating a PHP function that processes and outputs data in a specific format. The function should take an array of table headers and a multi-dimensional array of data as input. It should then generate a CSV (Comma-Separated Values) file with the provided table headers as the first row and the data a... | codefeedback |
You are tasked with implementing a function that calculates the maximum sum of a subarray within a given array of integers. A subarray is defined as a contiguous segment of the array. Your function should return the maximum sum of any subarray within the given array.
You are to implement the following function:
```py... | codefeedback |
You are tasked with creating a program that processes XML data using the pugixml library. The pugixml library is a lightweight C++ XML processing library that provides a simple and powerful API for parsing and manipulating XML documents.
Your task is to write a function that takes an XML document as input, parses it u... | codefeedback |
You are working on a project to develop a multimodal deep learning model that takes both images and sentences as input and produces corresponding outputs. The model consists of an encoder-decoder architecture, where the encoder processes the input data and the decoder generates the output. The code snippet provided is ... | codefeedback |
You are tasked with optimizing the fuel use for a sub-surface flight constraint. The goal is to minimize the landing mass while adhering to specific constraints. The problem involves maximizing the landing point, subject to various constraints, including those from a previous problem (p1).
Your task is to implement a ... | codefeedback |
You are tasked with implementing a simplified version of a caching system similar to Memcached. Your goal is to create a Python class that can store key-value pairs in memory and provide methods for retrieving, adding, and removing items from the cache.
Your task is to implement the `Memcached` class with the followin... | codefeedback |
You are given a vector of arrays, where each array contains three integers. Your task is to write a function to find the index of the array with the largest sum of its elements. If there are multiple arrays with the same largest sum, return the index of the first occurrence.
Write a C++ function with the following sig... | codefeedback |
You are tasked with implementing a custom Angular pipe called `ShortenPipe`. This pipe should take a string as input and return a shortened version of the string containing only the specified number of rightmost characters.
The pipe should have the following characteristics:
- It should be named 'shorten'.
- It should... | codefeedback |
You are tasked with creating a script to compare the contents of two files, `person.json` and `person.yaml`, and determine if they contain identical data. The script should use the `jq` command-line tool to parse and compare the JSON data from `person.json` with the YAML data from `person.yaml`. Additionally, the scrip... | codefeedback |
You are tasked with implementing a `lazyproperty` decorator in Python. The `lazyproperty` decorator should allow a method to be called lazily, meaning the method is only called once and its result is cached for subsequent calls. Your task is to create the `lazyproperty` decorator that achieves this behavior.
Your impl... | codefeedback |
You are given an array of integers, and you are required to implement the counting sort algorithm without using any associated array to keep track of the sorted elements. Your task is to modify the given code snippet to achieve this.
You need to complete the `countingSort` function to sort the input array `a` in non-d... | codefeedback |
You are tasked with implementing a hierarchy dictionary data structure in C#. The hierarchy dictionary should allow the storage of key-value pairs where the keys are hierarchical paths and the values are associated data. A hierarchical path is a sequence of elements separated by a delimiter, such as a forward slash (/)... | codefeedback |
You are tasked with creating a Python function that interacts with the Google Maps API to retrieve the distance and duration of a given route. The function should take in the origin and destination coordinates as input and return the distance in kilometers and the duration in minutes for traveling between the two point... | codefeedback |
You are working on a Django web application that provides weather information for different cities. The code snippet provided defines URL patterns for the application using Django's URL dispatcher. The URL patterns map specific URLs to corresponding views in the application.
Your task is to implement a Django view fun... | codefeedback |
You are tasked with creating a memory usage monitoring tool for a system. The tool should measure the memory usage of a given process and provide insights into its memory consumption. To achieve this, you need to implement a function that takes a process ID as input and returns the memory usage of the corresponding pro... | codefeedback |
You are tasked with implementing a Django model for a content management system. The model should support a generic foreign key relationship and have specific ordering defined. Your task is to complete the implementation of the Django model based on the given code snippet.
The code snippet provided includes the follow... | codefeedback |
You are tasked with creating a Python function that simulates a simple database management system. The function should be able to drop all existing tables and create new tables for a fresh database session. The provided code snippet demonstrates the initial steps of resetting the database for consistent testing conditi... | codefeedback |
You are tasked with creating a TypeScript function that converts a given string to camel case. Camel case is a naming convention in which the first letter of each word except the first is capitalized and spaces are removed. For example, "hello world" becomes "helloWorld".
Write a function called `toCamelCase` that tak... | codefeedback |
You are given a Python function that takes in an image matrix `im` and an orientation value `orientation` (0 for lines, 1 for columns). The function then processes the image matrix based on the given orientation and returns a list `x` containing the sum of pixel values along the specified orientation.
The function is ... | codefeedback |
You are tasked with implementing a class that combines trigger inputs to produce axis and vector inputs in a game development framework. The framework provides classes for scalar and vector inputs, as well as trigger inputs. Your goal is to create a class that combines trigger inputs to produce axis and vector inputs.
... | codefeedback |
You are tasked with creating a program that simulates a simple dice game. The game involves rolling two dice and calculating the sum of the two dice values. The player wins if the sum is 7 or 11, and loses if the sum is 2, 3, or 12. For any other sum, the player continues to roll the dice until they either match the in... | codefeedback |
You are tasked with implementing a login system for a web application. The login functionality is to be implemented using Python and the Django web framework. The provided code snippet defines the URL endpoint for the login page.
Your task is to create a Django view function that handles the login process. The view fu... | codefeedback |
You are tasked with implementing a Python class that can serialize and deserialize messages. The class should handle exceptions and provide a method for deserializing a message from a byte array. Your task is to complete the implementation of the `serialize` and `deserialize` methods of the given Python class.
```pyth... | codefeedback |
You are tasked with creating a Python function that determines the highest official version number from a list of version tags. The version tags follow the format "x.y.z" where x, y, and z are integers representing the major, minor, and patch versions respectively. The function should return the highest official versio... | codefeedback |
You are tasked with creating a program to parse and analyze a dataset containing information about public holidays in different locales. Each entry in the dataset is represented as a dictionary with the following keys: 'date', 'description', 'locale', 'notes', 'region', and 'type'. The 'date' key holds the date of the ... | codefeedback |
You are working on a codebase that uses TypeScript and the `tsquery` library to analyze and manipulate abstract syntax trees (ASTs). Your task is to implement a function that wraps a specific test call within an arrow function. The function should take a Node representing the AST as input and return the modified AST wi... | codefeedback |
You are tasked with creating a Python program that extends the functionality of a command-line interface (CLI) by adding new subcommands, argument groups, or arguments. To achieve this, you will need to implement a method that extends the parser object using the `argparse` module.
Your task is to complete the `extend_... | codefeedback |
You are tasked with implementing a Bernoulli layer in a neural network using TensorFlow. The Bernoulli layer takes logits as input and produces binary outputs based on a Bernoulli distribution. Your goal is to create a class `BernoulliLayer` that contains the necessary logic to perform this transformation.
The `Bernou... | codefeedback |
You are tasked with implementing a Python function that simulates a simplified version of the `mask_cuda` function used in GPU programming. The `mask_cuda` function takes in a batch of data, represented as a 2D array, and applies a mask to specific elements of the array. The mask is also a 2D array of the same dimensio... | codefeedback |
You are tasked with implementing a simplified version of an event-driven order processing system. The system consists of an `Instance` class, which represents a specific instance of order processing, and various event classes that can be processed by the `Instance` to update its data.
The `Instance` class has the foll... | codefeedback |
You are tasked with implementing a Python function to decode a given byte string using a specific algorithm. The algorithm involves replacing each byte in the input string with the byte that is the bitwise XOR of that byte and the next byte in the input string. If the input string has an odd length, the last byte is le... | codefeedback |
You are tasked with creating a program that processes a list of GitHub repository URLs and extracts the username and repository name from each URL. The program should then construct the corresponding GitHub clone URLs for each repository.
Your program should take a list of GitHub repository URLs as input and output th... | codefeedback |
You are tasked with creating a Rust function that generates a cryptographically secure random password of a specified length. The function should utilize the provided `secure_rng` function, which returns a cryptographically secure pseudo-random number generator (PRNG) based on the `ThreadRng` from the `rand` crate. The... | codefeedback |
You are working on a web application that manages products, brands, and categories. The application uses a database with the following relevant tables: `products`, `brands`, and `categories`. The code snippet provided is a part of a query builder in a PHP framework (e.g., Laravel) used to retrieve data from the databas... | codefeedback |
You are tasked with creating a Python function that simulates a simple online/offline status system for users. The function should allow users to update their online status and retrieve the current online status of a specific user.
Your task is to implement the `OnlineStatus` class with the following methods:
- `__ini... | codefeedback |
You are tasked with implementing a data validation function for a ticketing system. The function should validate various fields of a ticket, including location, comment, and status. The validation rules are as follows:
1. Location: The location field should only contain alphanumeric characters, commas, and spaces.
2. C... | codefeedback |
You are tasked with creating a program that analyzes a given CSS file and extracts specific information about the CSS classes defined within it. Your program should be able to identify the classes and their associated properties, allowing for further analysis or manipulation of the CSS data.
Write a function or method... | codefeedback |
You are tasked with creating a Python script that simulates a simplified version of a file system navigation tool. Your script should take a string representing a series of commands and output the final directory location after executing the commands.
The commands are as follows:
- `cd <directory>`: Change the current... | codefeedback |
You are tasked with creating a Python program that processes a file containing book information and then saves the processed data to another file. The program should take input and output file paths as command-line arguments and log the progress using the `logging` module. Additionally, the program should handle potent... | codefeedback |
You are given a binary tree and two integers, `target` and `k`. Your task is to write a function `nodesAtDistanceK` to find and return all the nodes that are at a distance `k` from the node with value `target`. The binary tree is represented using a standard node structure with left and right pointers.
The function si... | codefeedback |
You are tasked with implementing a function that calculates the positions and momenta of particles in a physical system. The function takes in several parameters, including the value of `time_like` and a boolean flag `return_cartesian`. The `time_like` parameter represents a specific time value, and the `return_cartesi... | codefeedback |
You are tasked with simulating a drone's initialization process using the Robot Operating System (ROS) and Python. The given code snippet is a part of a Python script that initializes a drone by sending initial setpoints, setting the flight mode to "OFFBOARD," and arming the drone. Your task is to complete the script b... | codefeedback |
You are tasked with creating a Python function that handles the rendering and writing of template files, as well as copying the resulting file to a mirror location and outputting the file to a database. Your function should handle potential errors and log them appropriately.
You are given the following code snippet as... | codefeedback |
You are tasked with implementing a custom LSTM (Long Short-Term Memory) module in Python. The LSTM module should be designed to handle bidirectional processing and support variable input sizes. Your task is to create a class that encapsulates this custom LSTM module.
Your custom LSTM module should have the following s... | codefeedback |
You are working on a file management system for a workspace application. The system interacts with a database to store file information and manages local files within a working directory. You need to implement a class that provides methods for interacting with the database and managing local files. The class should hav... | codefeedback |
You are tasked with creating a Python function that processes a list of file paths and returns a dictionary containing the parent directory of each file path along with the number of characters in the parent directory's name. Additionally, you need to write a unit test using the `pytest` framework to verify the functio... | codefeedback |
You are tasked with simulating a simplified version of a container management system. The system is responsible for creating, running, and executing commands within Docker containers. Your goal is to implement a function that manages the lifecycle of Docker containers and executes specific commands within them.
You ar... | codefeedback |
You are tasked with implementing a program that simulates an Intcode computer, which is a simple computer that processes a series of integers and performs various operations based on the opcode provided. The program uses a set of memory addresses to store the instructions and data. The provided code snippet is a part o... | codefeedback |
You are tasked with creating a Java method that processes transaction events related to a blockchain network. The method should handle two types of events: `BlockEvent.TransactionEvent` and `ResultDTO<BlockEvent.TransactionEvent>`. The goal is to extract transaction IDs from these events and log them using the `log.inf... | codefeedback |
You are tasked with implementing a generic relationship mapping system in C#. The system should allow for defining relationships between different entity types and provide a mechanism for accessing related entities.
Your task is to create a class `RelationshipMap` that can store relationships between entity types. Eac... | codefeedback |
You are tasked with creating a Flask web application that allows users to register and log in. The application should include functionality for user registration, password hashing, and authentication. Your task is to implement the registration and login functionality using Flask and Werkzeug.
Your task is to complete ... | codefeedback |
You are tasked with implementing a custom data structure that behaves like a list but has sensitive data protection features. The sensitive_list should allow adding, removing, and accessing elements like a regular list, but it should also provide a way to mask sensitive elements when the list is printed or iterated ove... | codefeedback |
You are tasked with creating a web form validation function for a modal dialog box. The modal dialog box contains a form with two buttons: a "Close" button and a "Simpan" (Save) button. Your task is to write a JavaScript function that validates the form before it is submitted. The validation rules are as follows:
- The... | codefeedback |
You are given a list of integers `candidates` and an integer `target`. Write a function `combinationSum` to find all unique combinations of integers in the `candidates` list that sum up to the `target`.
Each number in `candidates` may only be used once in the combination. The solution set must not contain duplicate co... | codefeedback |
You are tasked with implementing a function to parse a set of expression arguments and extract specific values from it. The input is a structure `ParsedExpArgs` containing various fields representing different types of arguments. Your goal is to write a function that extracts and returns specific values from this struc... | codefeedback |
You are tasked with creating a Python script to train a bi-directional recurrent neural network (RNN) with the CTC (Connectionist Temporal Classification) cost function for speech recognition. The script should utilize the TensorFlow library and accept command-line arguments for customization.
Your script should inclu... | codefeedback |
You are tasked with implementing a parallel map function in Rust. The function `process_maybe_parallel_map_collect` is a simplified version of a parallel map operation that takes an iterator of items, applies a given action to each item, and collects the results into a vector. The function can be run in parallel if the... | codefeedback |
You are tasked with implementing a composite connection listener in C++. A composite connection listener is responsible for managing multiple delegates that handle connection events. The provided code snippet includes the initialization and setting of delegates for the composite connection listener.
Your task is to co... | codefeedback |
You are tasked with creating a database schema for a simple content management system. The schema should include tables for storing information about users and their created content. The tables should capture details such as user ID, creator name, content title, description, and creation timestamp.
Your task is to wri... | codefeedback |
You are tasked with implementing a validation rule for file attachments in a task management system. The system uses a PHP framework with an ActiveRecord model for task attachments. Your goal is to create a validation rule that ensures the correctness of the attached file paths.
You are provided with a partial code sn... | codefeedback |
You are tasked with implementing a Python class that simulates a dictionary with additional functionality. The class, `CadenceDictionary`, should support the following operations: adding a key-value pair, retrieving a value by key, deleting a key-value pair, and checking if a key exists in the dictionary. Additionally,... | codefeedback |
You are tasked with creating a simple Java application to manage a list of employees using the MyBatis framework for database interaction. Your application should include the necessary entity class, mapper interface, and XML configuration for MyBatis.
Your entity class should represent an employee with the following a... | codefeedback |
You are tasked with implementing a function that interacts with a blockchain to retrieve information about a specific NFT (non-fungible token) voucher. The function will take in the provided parameters and use them to fetch and process data from the blockchain.
You are given the following TypeScript interface represen... | codefeedback |
You are tasked with creating a Python class that simulates a drone. The drone should be able to take off, land, move in different directions, and report its current position. The drone should also have a version attribute that stores the current version of the drone software.
Create a Python class called `Drone` with ... | codefeedback |
You are working on a data visualization project and need to create a program that generates a bar plot with error bars using Python's matplotlib library. The data for the plot is stored in a pandas DataFrame. Your task is to write a function that takes the DataFrame, along with other parameters, and produces the desire... | codefeedback |
You are tasked with creating a custom serializer and view for a currency model in a Django REST framework application. The provided code snippet includes a base serializer and an abstract list view that sets various attributes for the view.
Your task is to implement the custom serializer and view for the currency mode... | codefeedback |
You are tasked with implementing a Markdown to HTML converter in Swift. Markdown is a lightweight markup language with plain-text formatting syntax. Your task is to create a class `MarkdownConverter` with a method `convertToHTML` that takes a Markdown string as input and returns the corresponding HTML string.
The Mark... | codefeedback |
You are tasked with implementing a custom `Iota` class that represents a sequence of consecutive integers and a `Model` class that provides various operations on the sequence. The `Iota` class should support the following functionalities:
1. Constructing an `Iota` object with a starting value and a count of elements.
2... | codefeedback |
You are tasked with creating a Python function that processes a configuration dictionary and sets up the environment for running machine learning experiments using PyTorch. The configuration dictionary, `cfg`, contains various settings related to the experiment setup. Your function should read these settings and perfor... | codefeedback |
You are tasked with implementing a Python class that simulates a simple bank account. The class should have methods to deposit funds, withdraw funds, and check the current balance. Additionally, the class should keep track of the total number of transactions (deposits and withdrawals) made on the account.
Your task is... | codefeedback |
You are tasked with creating a Python decorator that logs the details of a Flask route function, including the HTTP method, route path, and function name. The decorator should also measure the execution time of the route function and log it. Your task is to implement the `pfms_delete` decorator, which will be used in c... | codefeedback |
You are tasked with designing a secure API endpoint for a shopping cart system. The system should allow customers to update their cart after checkout. The provided code snippet is a part of the API controller for this functionality.
Your task is to implement the `UpdateAfterCheckout` method in the `CartController` cla... | codefeedback |
You are tasked with implementing a graph data structure and its associated methods. The graph should support the addition of nodes and the printing of the graph's nodes.
You are given the following code snippet as a starting point:
```
print(transfer)
transfer.add_nodes()
```
Your task is to complete the implementa... | codefeedback |
You are tasked with creating a Python function that processes a given string to generate a formatted list. The function should take a string as input and return a formatted list based on the input string. The input string will contain items separated by newlines and tabs, with each tab representing a level of indentati... | codefeedback |
You are given a Python function `nparray_and_transpose(data_a_b_c)` that takes a nested, nested list `data_a_b_c` as input. The list `data_a_b_c` has a length `a`, with each element being a sublist of length `b`, and each of these sublists containing `c` elements. Your task is to implement the function to convert the i... | codefeedback |
You are given a code snippet that involves generating and filtering n-grams from a corpus. Your task is to implement a function to generate n-grams from a given corpus and then filter these n-grams based on certain criteria.
Write a function `filter_ngrams(corpus, past_n_target, past_n_min, forward_n, min_ngrams_neede... | codefeedback |
You are given a text file containing a software license agreement. The file contains lines of text, and the license agreement is embedded within the text. The license agreement is delineated by a specific pattern, which consists of a series of consecutive lines starting with the "#" character. Your task is to extract t... | codefeedback |
You are tasked with implementing a social network simulation program. The program will model the process of individuals making friends based on certain criteria. The individuals are represented as nodes in a graph, and the friendships between them are represented as edges. Each individual has a "friendship initiate pro... | codefeedback |
You are tasked with implementing a tokenizer for a custom programming language. The language has specific token types, and the tokenizer should correctly identify and categorize tokens in the input code.
The token types are defined as follows:
- `InplaceRightShift`: Represents the `>>=` operator.
- `BinOr`: Represents... | codefeedback |
You are tasked with implementing a password hashing and comparison functionality using TypeScript. You are provided with a class containing two methods: `make` and `compare`. The `make` method is used to hash a given input data with an optional salt or number of rounds, while the `compare` method is used to compare a p... | codefeedback |
You are tasked with creating a URL routing system for a web application using Python's Django framework. The given code snippet represents a list of URL patterns and their corresponding views. Each URL pattern is associated with a specific action, such as displaying a list of users, showing user details, creating a new... | codefeedback |
You are tasked with creating a process monitoring tool that identifies and reports offending processes based on certain criteria. The tool should accept command-line arguments, continuously monitor processes, and report offending processes when found. Your task is to implement the `parse_args`, `filter_processes`, and ... | codefeedback |
You are tasked with automating the upgrade process for a set of software packages on a Linux system. The packages to be upgraded are related to the OAR (Resource and Job Manager) software. The version to be upgraded to is 2.5.4-2+deb8u1. Your task is to write a Python script that can generate the necessary `apt-get` co... | codefeedback |
You are tasked with creating a Python program that simulates a simple logging system for a fictional online store. The program should be able to log different types of events, such as errors, warnings, and information messages, and store them in a log file. Additionally, the program should be able to configure the logg... | codefeedback |
You are tasked with creating a program to analyze a given HTML file and extract the titles and descriptions of different services offered by a company. The HTML file contains multiple service sections, each with a title and a description enclosed within specific HTML tags. Your program should be able to parse the HTML ... | codefeedback |
You are tasked with implementing a C++ unit test for a convolution operation using the Google Test framework. The provided code snippet is a part of a larger test suite for testing the manipulation, moving, copying, and cache behavior of the convolution operation.
Your task is to write a unit test that ensures the cor... | codefeedback |
You are tasked with implementing a custom module loader for a JavaScript application. The module loader should be able to handle the export statement and resolve the module path correctly. The export statement is used to export functions, objects, or primitive values from a module, making them available for use in othe... | codefeedback |
You are tasked with implementing a macro-based input parser for Rust. The provided code snippet showcases a set of macro rules for parsing different types of input data. Your goal is to extend this input parser to support parsing a custom data structure.
You need to create a macro rule that can parse a custom data str... | codefeedback |
You are tasked with creating a Discord bot command that interacts with the PyPi package repository. The bot should be able to search for a package on PyPi and display information about it. You are given a partial implementation of the PyPi cog for the Discord bot, which includes a method for searching and displaying pa... | codefeedback |
You are tasked with developing a package management system for a software development company. The system should be able to parse and process package dependencies specified in a Swift Package Manager manifest file.
The manifest file contains a list of package dependencies in the following format:
```
.package(url: "ht... | codefeedback |
You are tasked with implementing a Python class that handles the downloading and caching of machine learning model files from a remote server. Your class should provide methods for downloading the model file, checking if the file exists in the cache, and retrieving the local file path. Additionally, the class should su... | codefeedback |
You are tasked with creating a Swift data structure to represent different types of items in an inventory management system. The data structure should include properties for the item's ID, name, description, and type. Additionally, you need to implement a method to encode the data structure into JSON format using Swift... | codefeedback |
You are tasked with creating a script that automates the process of finding and moving executable files to a specific directory. Your script should search for all executable files within a given directory and its subdirectories, and then move these executables to a designated release directory. The script should also p... | codefeedback |
You are tasked with implementing a custom error handling mechanism for a web application. The application uses a Python framework with an error handler that catches and processes exceptions. Your goal is to create a custom exception class and integrate it into the error handling system.
You need to define a custom exc... | codefeedback |
You are tasked with implementing a function to convert MIDI note numbers to their corresponding frequencies. The MIDI standard assigns a number to each musical note, with middle C being MIDI note number 60 and each semitone above or below it incrementing or decrementing the number by 1. The formula to convert a MIDI no... | codefeedback |
You are tasked with creating a form validation system for a web application. The form consists of two fields: an email field and a password field. The email field must be non-empty and the password field must be at least 5 characters long and non-empty. Additionally, the email field should be pre-populated with a value... | codefeedback |
You are given a list of integers `nums`, which may contain duplicates. Your task is to find the next greater element for each element in the list. The next greater element of an element `nums[i]` is the first greater element to its right, considering the circular nature of the list. If no greater element exists to the ... | codefeedback |
You are tasked with implementing a temperature simulation program using the finite element method. The given code snippet is part of a larger program and contains some variable declarations and initializations. Your task is to complete the implementation by writing the code to solve the transient heat conduction equati... | codefeedback |
You are tasked with implementing a Python function that calculates the Jacobian matrix of a given multivariate function. The Jacobian matrix represents the first-order derivatives of the function with respect to its input variables. Your task is to create a function that takes a multivariate function as input and retur... | codefeedback |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.