instruction_seed
stringlengths
0
26.4k
source
stringclasses
4 values
Create a function in Python that will return the maximum difference between any two numbers present in an array.
codefeedback
Write a code in Java that will get all the elements from an array that are greater than the given number.
codefeedback
Write a code in Python that will take a string as input and return it with the words in reverse order.
codefeedback
Write a regular expression to match a 4 digit zip code.
codefeedback
Write an SQL query that calculates the total order value for each delivery zone in the ‘zones’ table.
codefeedback
Create a bash script that generates a random 3 letter string with no duplicates in it.
codefeedback
Create a machine learning model in Python to predict the total surface area of a cube given its side length side_length = 3
codefeedback
Produce a regex pattern to validate a US phone number format
codefeedback
Generate a random password that complies with certain conditions.
codefeedback
Write a RegEx to match all numeric strings that start with 6 and contain 4 characters.
codefeedback
Create a regular expression to match the pattern of a 4-digit credit card number such as '1234 5678 9012 3456'.
codefeedback
Reverse the words of a given sentence but keep the order of the words intact. I am a programmer
codefeedback
Create a program to convert a bi-dimensional array into a single array. [[1, 2], [3, 4]]
codefeedback
Find the two elements in a given array that sums up to the target number. [1, 8, 10, 12], target = 18
codefeedback
Parse a string of words and output an array containing only the uppercase words. "I Love Coding"
codefeedback
Output an array with all the prime numbers between 2 and n. 6
codefeedback
Generate HTML table with a given list of dictionaries. [{'name': 'John', 'age': 20}, {'name': 'Alice', 'age': 22}]
codefeedback
Write a C++ code snippet to create an infinite loop.
codefeedback
Write a web scraper using BeautifulSoup to extract a list of tweets from a site. Target site: https://twitter.com/
codefeedback
Use CSS to create a dark mode version of the following website. Link to a website: https://example.com
codefeedback
Update the following JSON array to increment the "age" value of every user by 5 years. [ { "name": "Alice", "age": 25 }, { "name": "Bob", "age": 30 } ]
codefeedback
Write a MySQL query to find the names of all the students who took both math and science classes.
codefeedback
Construct an SQL query to delete all records from the table 'Employees' with a given salary. Salary = 1100
codefeedback
Create a function to allocate resources to parties data = [["Joe",5],["John",3],["Mary",2]]
codefeedback
Replace every character in a given string with its corresponding ASCII code string = "Hello"
codefeedback
Generate CNN-LSTM model in Keras.
codefeedback
Edit this code to add a try-except block to catch any errors. def repeat(string, repeats): for i in range(repeats): print(string) repeat("Hello World!", 5)
codefeedback
Design an API to pull company data from an external source.
codefeedback
Given a list of words, write a Python function to print the frequency of occurrence of each word in the list. ['foo', 'bar', 'foo', 'baz', 'bar']
codefeedback
Build a web application that allows users to search for recipes based on ingredients.
codefeedback
Implement a function in Python that calculates the median of a given input array. [5, 2, 6, 8, 10]
codefeedback
Use Tensorflow to classify a given input dataset of animals as cats or dogs. Input dataset contains images of cats and dogs.
codefeedback
Suppose you have a dictionary containing the records of some student marks. Write a Python program to calculate the average marks of all the students. student_mark_dict = { 'John': [50, 70, 60], 'Harry': [20, 60, 80], 'Tom': [90, 70, 80] }
codefeedback
Add the missing parentheses and brackets for the for loop. for x range(0, 5): print(x)
codefeedback
Create a function in JavaScript that takes a string and a number as arguments, and returns a string with the first number of characters (specified by the number argument) replaced with the character '@'. string = 'Hello World' number = 4
codefeedback
Create a machine learning model to predict a binary class.
codefeedback
Suppose you are given a array of 0s,1s and 2s . Write a program to sort the given input array.
codefeedback
Offer a solution for converting a bank of binary strings, represented as an array, to Decimal numbers.
codefeedback
Design a program to solve a 3x3 Sudoku puzzle.
codefeedback
Formulate an algorithm that helps you arrange a given set of numbers in ascending order. [7, 4, 8, 9, 11]
codefeedback
Design a program to generate prime numbers between 1 and 50.
codefeedback
Write a function in C that minimizes the cost of a given parameter using gradient descent. The parameter is w(t+1) = w(t) - alpha * Le(w) Here, alpha= 0.3 and Le(w) = 14w^2 + 8 * w - 7
codefeedback
Write a JavaScript code to print the pyramid pattern for a given number of rows. 7
codefeedback
Write a JavaScript expression to generate a random integer between 1 and 25.
codefeedback
Reverse the following list of numbers. [1, 2, 3, 4]
codefeedback
Implement a matrix multiplication program in Java.
codefeedback
Build a CNN model in Keras to detect cancer from a provided dataset.
codefeedback
Create an example of a deep learning neural network in Keras.
codefeedback
Create an example of data visualization using Python's matplotlib library.
codefeedback
Create a code to validate an email address using Regular Expressions.
codefeedback
Solve this regular expression problem. A string should start with a letter, contain only letters and numbers, and should be at least 8 characters in length.
codefeedback
In Java, construct a data structure for storing employee information, including name, age, phone number, and address.
codefeedback
Write a function in C++ to convert a list to a tuple.
codefeedback
Generate a list of 10 numbers in Python where each number is a multiple of 7 and greater than 40
codefeedback
Classify the given text as "positive" or "negative" using Natural Language Processing. This movie is terrible.
codefeedback
Perform an insertion sort on the given list. List: [9, 5, 4, 8, 6]
codefeedback
Create a SQL database containing three tables.
codefeedback
You are tasked with implementing a file path manipulation function in a programming language of your choice. The function should take a base path and a relative path as input and return the combined absolute path. The base path represents the starting directory, and the relative path represents the path to be appended ...
codefeedback
You are tasked with implementing a Python function that validates an authorization header token for a web API. The function should extract the token from the provided header, check its format, and return the token if it is valid. If the token is not in the expected format or the authorization type is unsupported, the f...
codefeedback
You are tasked with creating a Rust module system for a 2D game engine. The game engine consists of several modules, each serving a specific purpose. The provided code snippet includes the module declarations and re-exports for the game engine. Your task is to design and implement a new module called `input` that will...
codefeedback
You are tasked with implementing a buffer management system for a graphics application using OpenGL. The system should allow for efficient modification and flushing of ranges of data within a buffer object, while ensuring that OpenGL can still use other parts of the buffer. Your task is to create a class `BufferManag...
codefeedback
You are tasked with implementing a class that connects to an MQTT broker and subscribes to a specific topic. The provided code snippet is a part of a larger MQTT client implementation. Your task is to complete the implementation by adding the necessary code to subscribe to a given topic and handle incoming messages. Y...
codefeedback
You are tasked with implementing a function to calculate the digest of a given input string using various hashing algorithms. The function should support multiple hashing algorithms and return the digest along with the algorithm used for hashing. You are provided with a partial code snippet that imports necessary modu...
codefeedback
You are tasked with creating a web form for a placement application system. The form should include fields for the applicant's information such as the form type, branch, category, student name, father's name, residential address, and present address. Each field should be validated to ensure that the data entered is acc...
codefeedback
You are tasked with implementing a custom permission system for a user management application. The application has a method `getUsers` that retrieves a list of users based on certain criteria. The method is annotated with `@Permissions` and `@Permission` to define the required permissions for accessing this endpoint. T...
codefeedback
You are tasked with implementing a text processing class that normalizes input text based on certain language-specific rules. The class has an `__init__` method that initializes the language and sets up some language-specific tools, and a `do` method that normalizes the input text. Your task is to complete the implemen...
codefeedback
You are given a dataset containing several records, each consisting of four numerical values. The first value represents the class label (0 or 1), and the remaining three values represent features. Your task is to implement a Python function that calculates the Euclidean distance between each record and a given query p...
codefeedback
You are tasked with creating a Python function that processes a dictionary containing student names as keys and their respective marks as values. The function should return the name of the student with the highest mark. If there are multiple students with the same highest mark, the function should return a list of thei...
codefeedback
You are tasked with implementing a simple drawing application using the wxPython library. The provided code snippet is a part of a larger program that handles the drawing canvas and event handling. Your task is to complete the implementation by adding the necessary methods to handle drawing on the canvas and resizing t...
codefeedback
You are tasked with implementing a Python function that processes a given input to extract specific information and perform a series of operations. The input will consist of a multi-line string containing code snippets in Python. Your function should identify and extract all the comments from the input, then count the ...
codefeedback
You are tasked with implementing a function to count the total number of words across multiple text files in a given directory using threading. The code snippet provided demonstrates the usage of the function `count_words_threading` to count the words in all text files within a specified directory. The function takes a...
codefeedback
You are tasked with creating a TypeScript class method that fetches and processes data from a server using the provided code snippet as a reference. Your task is to implement the `jsonMutationDataFetcher` function and ensure that the `fetchData` method correctly handles the asynchronous data retrieval and processing. ...
codefeedback
You are given a code snippet that represents a function in a programming language. Your task is to complete the function by implementing the missing logic. The function takes in an array of integers and an integer target. The goal is to find two distinct elements in the array that sum up to the target. If such a pair e...
codefeedback
You are tasked with implementing a Java interface for verifying digital signatures. The interface, `SignatureVerifier`, extends another interface `SignatureVerifierSimple` and takes a generic type `S` that extends `SignatureBinary`. The interface includes a default method `verifyAfterUpdate` that takes an object of typ...
codefeedback
You are tasked with implementing a class for managing index buffers in an OpenGL-based graphics application. The provided code snippet is a part of the implementation for an OpenGLIndexBuffer class. The class is responsible for binding the index buffer and returning the count of indices in the buffer. Your task is to ...
codefeedback
You are tasked with creating a function that processes user data and generates a report containing user information and associated API authentication details. The function should take an array of user objects as input and return an array of user information with corresponding API authentication details. Each user obje...
codefeedback
You are tasked with creating a Python function that simulates a simplified version of a database migration system. In this system, each migration is represented by a class that contains a list of its dependencies. Your task is to implement a function that takes a list of migration classes and returns the order in which...
codefeedback
You are tasked with implementing a Python function that performs fine-tuning on a gesture classifier model. The function takes several parameters, including the model, a flag to indicate whether to use softmax, a flag to indicate whether to resume training from a checkpoint, and the number of layers to fine-tune. The f...
codefeedback
You are given a list of software applications installed on a user's computer. The list contains the names of the applications, but there are some errors in the names. The errors include misspellings, incorrect capitalization, and missing characters. Your task is to create a Python function that takes the list of applic...
codefeedback
You are tasked with implementing a program to perform corner detection on a grayscale image using the Harris corner detection algorithm. The Harris corner detection algorithm is a popular method for identifying corners in images by analyzing variations in intensity. Your task is to write a function that takes a graysca...
codefeedback
You are tasked with implementing a Python class that extends a base class and handles the creation of heap objects. The base class, `HeapObjectFactory`, provides a framework for creating heap objects, and your task is to create a subclass called `KvpHeapObjectFactory` that specifically handles key-value pair objects. ...
codefeedback
You are tasked with implementing a Python function that processes a given text file to create a GloVe word embedding model. GloVe (Global Vectors for Word Representation) is an unsupervised learning algorithm for obtaining vector representations for words. The provided code snippet serves as a starting point for creati...
codefeedback
You are tasked with implementing a message queue system that can handle timed messages. Each timed message consists of a set of bytes and a delay in milliseconds before the message should be processed. Your goal is to design a class that manages the timed messages and processes them after the specified delay has elapse...
codefeedback
You are tasked with implementing a simple web server in Python. Your goal is to extend the provided code snippet to create a web server that can handle HTTP requests and respond with encoded content. The server should support different encodings and response caching. Your task is to complete the implementation of the ...
codefeedback
You are given a graph representing a network of rooms in a building. Each room is labeled with a unique integer identifier. The graph is represented as an adjacency list, where each key-value pair in the dictionary `rooms` represents a room and the rooms it is connected to. For example, `rooms[roomIdx]` returns a list ...
codefeedback
You are tasked with implementing a callback mechanism in C++ to handle events in a multi-threaded environment. The callback mechanism should allow registering callback functions and invoking them when specific events occur. Additionally, you need to ensure thread safety and proper synchronization when invoking the call...
codefeedback
You are tasked with implementing a Python class that simulates a simple light switch. The class should have methods to turn the light on, turn the light off, and check the current state of the light. Additionally, the class should keep track of the number of times the light has been turned on and off. The class should ...
codefeedback
You are given a class `Graph` representing a directed graph with nodes and edges. The class has a method `findShortestPath` that takes two node names as input and returns the shortest path between the two nodes. The graph is represented using an adjacency list. The `Graph` class has the following structure: ```java im...
codefeedback
You are tasked with creating a function that computes the unpacked data type for a NetCDF variable. NetCDF (Network Common Data Form) is a file format for storing multidimensional scientific data. The unpacked data type refers to the native data type of the variable, which may differ from the packed data type used for ...
codefeedback
You are tasked with implementing a custom configuration manager in Java. The configuration manager should allow users to store and retrieve key-value pairs, and it should support serialization and deserialization of the configuration data. Your task is to implement the `ConfigManager` class, which should have the foll...
codefeedback
You are tasked with implementing a generic graph traversal algorithm using Rust. The algorithm should be able to traverse a graph and yield the nodes it visits in a specific order. You are provided with a code snippet that defines a trait `VisitMap` and a method `walk_next` that needs to be implemented. Your task is to...
codefeedback
You are tasked with implementing a Python decorator that logs the input and output of a function, and also sends a request to a change quota method. The decorator should be able to handle both admin and non-admin requests. Your task is to create a Python decorator `admin_cm_log` that logs the input and output of a fun...
codefeedback
You are tasked with creating a Python class that can retrieve and manipulate variables from a given JSON file. Your class should provide methods to load the JSON file, retrieve specific variables, update variable values, and save the modified JSON back to the file. Create a class named `JsonVariableManager` with the f...
codefeedback
You are tasked with creating a program that processes a given HTML template and extracts specific information from it. The HTML template contains a list structure with multiple list items, each having a nested div structure. Your task is to extract the heights of the div elements within each list item and calculate the...
codefeedback
You are tasked with creating a Python function that simulates the process of applying database migrations in a Django project. In Django, migrations are used to propagate changes you make to your models (adding a field, deleting a model, etc.) into your database schema. Each migration file contains a series of operatio...
codefeedback
You are tasked with implementing a class for representing time in a civilian format. The provided code snippet is a part of the implementation of the `CivilianTimeImp` class, which is a subclass of the `TimeImp` class. The `CivilianTimeImp` class is responsible for representing time in a 12-hour format with an addition...
codefeedback
You are tasked with implementing a simplified version of a 3D graphics rendering engine in Rust. The code snippet provided is part of the implementation and involves creating a vertex array, binding a model, and initializing an index buffer. Your task is to complete the implementation by defining the `TriangleSurface` ...
codefeedback
You are tasked with creating a logging system for a software application. The code snippet provided initializes a logging file and sets the logging mode. The `touch` command is used to create the logging file, and the `LOG_MODE` variable is used to specify the mode as either "stdout" or "discret". Your task is to writ...
codefeedback
You are tasked with implementing a Python class method that patches a configuration file. The method should read the contents of the file, make necessary modifications, and then write the updated content back to the file. Your task is to complete the implementation of the `patch` method in the given Python class. ```p...
codefeedback
You are tasked with implementing a class method for finding specific elements in a 2D mesh. The given code snippet provides the beginning of a Python class `_2dCSCG_Mesh_DO_FIND` that is a wrapper for find methods for mesh.do. Your task is to complete the implementation of a method `find_elements` within this class. Th...
codefeedback