instruction_seed stringlengths 29 40.5k | source stringclasses 6
values |
|---|---|
Write a Python script to detect if two numbers have the same frequency of digits. You are not allowed to convert the numbers to strings or use any built-in functions for counting the frequency of digits.
#Erroneous Code Reference#
```python
def same_frequency(num1, num2):
return sorted(str(num1)) == sorted(str(num... | codefeedback |
Estimate the value of a motorcycle using polynomial regression. This time, integrate mileage, year, and condition into your features in addition to brand and series. Consider brands such as 'Yamaha', 'Honda', 'Harley-Davidson' and series such as 'YZF-R3', 'CBR500R', 'Sportster Iron 883'. | codefeedback |
You are tasked with implementing a function to orthogonalize two matrices, representing a feature matrix X and a property matrix Y, with respect to a selected set of samples. The function should take the indices of the selected samples, the feature matrix X, the property matrix Y, and an optional tolerance value. The o... | codefeedback |
Develop a responsive HTML/CSS webpage that includes an advanced multimedia form for signing up new members, embedding secure methods to obtain user fingerprints, and a secure two-factor authentication procedure. | codefeedback |
Create a Java program to implement a doubly linked list with the following operations: insert, delete, display, reverse, and find. The find operation should search for a specific element in the linked list and return its index. The program should also include a function to check if the linked list is circular.
Modify... | codefeedback |
Take the following string and read it into a list in Python. Each element in the list should be a tuple consisting of the word itself, its length, and the number of vowels in the word. The tuple should be sorted based on the number of vowels in the word in descending order. In case of a tie, sort based on the length of... | codefeedback |
Make a Python program to delete elements from a given list at particular indices. However, the program should also handle the case where the given indices are out of range for the list. If an index is out of range, the program should print an error message and continue deleting the elements from the remaining valid ind... | codefeedback |
Create a function that returns the longest substring of the string given, where the substring must contain at least three uppercase letters and exactly two digits, with one digit preceding the first uppercase letter and one digit following the second uppercase letter. Additionally, the function should also handle cases... | codefeedback |
Compose the Burrows-Wheeler Transform encompassing the specified alphanumeric text - 'abcdabcd'. | codefeedback |
Can you help me resize this SVG to fit a 500x500 canvas?
<svg width="32" height="32" viewBox="0 0 32 32" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M24.7264 14.6206C25.1706 15.087 25.3854 15.3124 25.4499 15.85C25.4771 16.1039 25.4497 16.3607 25.3694 16.6032C25.2892 16.8456 25.158 17.0681 24.9846 17.2557C2... | codefeedback |
Construct an HTTP request that retrieves information from an API that requires authentication with a unique API key and a specific user agent. The API endpoint is https://example.com/api/v1 and it returns data in JSON format. The retrieved information should include data on all available products, their descriptions, p... | codefeedback |
Create a function that takes in a list of strings and a number n. The function should return a new list of only the strings longer than n characters and the index of each of these strings from the original list. Given the following erroneous code as a reference, correct and enhance it to meet the new requirements.
```... | codefeedback |
Write a function that takes an array of numbers and prints out all the pairs of numbers whose sum is equal to a given number. The function should also handle duplicate pairs, where the order of the numbers in the pair does not matter. The output should be sorted in ascending order of the first number in each pair. The ... | codefeedback |
Create an array of integers in Swift with length 10, where each integer must be between 1 and 100 (inclusive).
Additionally, implement a function that takes in this array as a parameter and returns the sum of all the even numbers in the array. The function should also check if the sum of the even numbers is divisible... | codefeedback |
You are tasked with creating a web application for a university's professor-student management system. As part of this system, you need to implement a feature that allows professors to upload their profile pictures. The provided code snippet is a segment of the PHP script responsible for handling the file upload and da... | codefeedback |
Develop an object oriented program that archives rare coin details, such as country of origin, year of minting, material, etc. | codefeedback |
Create a Java program to list out all prime numbers between m and n, where m and n are positive integers less than or equal to 100. Additionally, the program should display the product of all prime numbers found. Implement the program using a multi-threaded approach, where each thread is responsible for finding prime n... | codefeedback |
I'm working on a website, and there's a problem with the menu item links.
When you click on the menu items sometimes it's redirect you to random URL that.
I don't know what to do about it.
The website: [https://klavim.org/](https://klavim.org/)
The URL it sending to: [https://wqzyxxrrep.com/1947431/?var=klavim.org](htt... | codefeedback |
Manipulate a given list in Python where every element in the list has to be doubled. The resulting list should be sorted in ascending order. Additionally, the original list should not be modified, and the manipulation should be done using list comprehension.
my_list = [1, 2, 3, 4] | codefeedback |
You are tasked with implementing a function to decompose a data URI into its constituent parts. A data URI is a scheme that provides a way to include data in-line in web pages as if they were external resources. The general format of a data URI is `data:[<media type>][;charset=<character set>][;base64],<data>`, where `... | codefeedback |
You are tasked with implementing a Python function that calculates the probability and prediction from a given output tensor. The output tensor is assumed to be the result of a neural network's forward pass and contains the raw output values for each class. The function should perform the following steps:
1. Find the i... | codefeedback |
Create an array of 10 Boolean values and set it to "False". Additionally, create a function that takes in the array as a parameter and randomly sets one of the Boolean values to "True" each time it is called. | codefeedback |
Write Python code using Scikit-learn to load the digit dataset, perform a bifurcation to create a training set and a testing set. Implement Naive Bayes training on the training set, followed by using it to predict the test set. Also, write a mechanism to handle any missing or inconsistent data in the dataset before tra... | codefeedback |
You are tasked with implementing a program that generates a specific pattern of numbers based on the given input. The pattern consists of a series of rows and columns, with each cell containing a unique number. Your task is to write a function or method that takes an integer `n` as input and prints a pattern based on t... | codefeedback |
In the context of the C++ programming language, not only explain the significance and implications of designifying a function as 'static', but also implement an example program demonstrating these static functions. Additionally, discuss the differences between 'static', 'extern', and 'const' keywords when applied to fu... | codefeedback |
You are working on a neuroimaging data analysis pipeline using the AFNI software suite. As part of the pipeline, you need to write a script to apply cluster results to each output file and then perform the same operation on NIfTI files with a liberal threshold.
You have a code snippet that uses various AFNI commands a... | codefeedback |
Create a JavaScript object that stores three pieces of digital contact data, an email address, a phone number, and a website URL. Additionally, add a fourth property to the object called "socialMediaHandles" which should be an array of objects representing different social media platforms. Each object should have a "pl... | codefeedback |
Write a Python code snippet to get the first 1000 prime numbers, but with a time complexity of O(n log n) or better. | codefeedback |
You are tasked with creating a Python class that generates input files for VASP (Vienna Ab initio Simulation Package) calculations. VASP requires several input files to execute, such as INCAR and KPOINTS. Your task is to create a class called `VASPInputGenerator` that provides methods to generate these input files from... | codefeedback |
Using the Pandas library, parse the given multiple nested json objects within a list. The JSON data contains the personal data of people including name, age and address. The address itself is a complex object which includes street, city, state, country and postal code data. In addition, the personal data also includes ... | codefeedback |
Construct a Python function that computes the position of the smallest triangular number that encompasses a specific digit count, symbolized as n, utilizing the mathematical principle of triangular numbers. For a more profound understanding, consult this link: https://www.geeksforgeeks.org/index-of-smallest-triangular-... | codefeedback |
Create a program that finds the second largest element in a list of integers.
arr = [1, 10, 4, 5, 6, 7, 9] | codefeedback |
Write a SQL query to select all the vehicles from a table that are owned by John and were manufactured in the year 20 | codefeedback |
Write a script that not only takes a sentence as input and returns each unique word with its frequency of occurrence, but also finds synonyms of these words from an English thesaurus and counts the combined frequency of each word and its synonyms. Additionally, assume the input can be multiple sentences or a short para... | codefeedback |
Write HTML code to create a dynamic table that allows users to add and remove rows. The table should contain the following information: Name, Age, Gender, and a button to delete the row. Additionally, implement a feature that allows users to sort the table by any column in ascending or descending order by clicking on t... | codefeedback |
Convert a given XML document to a JSON document while maintaining the original hierarchical structure of the XML elements and adding a new constraint that the JSON output should only include specific XML elements that meet certain criteria. | codefeedback |
You are tasked with implementing a simplified version of a shell interface for a graphical user interface (GUI) toolkit. The shell interface is responsible for managing the creation and manipulation of surfaces within the GUI. Your goal is to create a class that represents the global interface for a specific version of... | codefeedback |
Create an HTML document that meets the following requirements:
1. It should have a doctype declaration and specify the HTML5 standard.
2. It should have a "head" section with a "title" element containing the text "My Challenging Webpage".
3. It should have a "body" section that includes a navigation bar with three link... | codefeedback |
Make a function in Python which calculates the covariance between two given lists.
However, the lists may contain missing values (represented by None) and the length of the two lists may not be the same. Additionally, the function should handle cases where both lists are empty or contain only missing values, and retur... | codefeedback |
Use the following code, and write a script to efficiently print out all the numbers from 1-100 that are divisible by either 7 or 9, but not both. The script should ensure that each number is only checked once for divisibility and should not use the modulo operator (%). | codefeedback |
I need a python script, written to automate some processes. Part of this process is going to include taking a data set within some sort of shared repository, like google sheets, or an Excel file, that has a question bank in it. It will then take that question bank and run the data set in ChatGPT to modify the question ... | codefeedback |
Create a text-based adventure game in Python | codefeedback |
Propose a potential application of quantum computing in medical diagnostics. | codefeedback |
Develop a Python code snippet for isolating the individual words within a specific sentence and retaining those word components in a priority queue structure sorted by the word length. The code should ignore any punctuation and be case insensitive. For words that have the same length, maintain them in the order they ap... | codefeedback |
Write a program that takes a string input representing an HTML document and outputs the name of all font styles available within the document.
The program should consider the following font style tags: <b>, <i>, <u>, <s>, <strong>, <em>, <ins>, <del>.
The program should correctly handle nested font style tags, meani... | codefeedback |
Given a list of integers, replace the even numbers with their square and the odd numbers with their cube. Additionally, each number should be rounded to the nearest whole number. The list can contain up to 10^7 elements.
However, there is a constraint that the solution should have a time complexity of O(n), where n is... | codefeedback |
You are tasked with implementing a command-line tool for posting messages to Twitter. The tool should accept command-line arguments for the message to be posted, as well as the Twitter consumer key and consumer secret. Your task is to write a Python script that parses the command-line arguments and posts the message to... | codefeedback |
Find the missing prime number in the following array: [16, 3, 2, 11, 15, 5, 4, 14]. Additionally, provide a piece of erroneous code that falsely identifies a non-prime number as the missing prime.
Time complexity requirement: O(nlogn)
Space complexity requirement: O(1) | codefeedback |
You are given a snippet of code that is part of a suffix array construction algorithm. The code snippet is responsible for updating the values of an array `va[]` based on the values of arrays `sa[]` and `pos[]`. Your task is to implement a function that takes the input arrays `sa[]` and `pos[]` and returns the updated ... | codefeedback |
You are tasked with implementing a function that constructs a schema table based on a given set of field mappings. The function takes in an array of field mappings, where each mapping consists of a field name and its corresponding data type. The function should handle nullable data types and enums, and it should also a... | codefeedback |
Given a sentence, classify each word in the sentence as a noun, verb, adjective, or adverb. The sentence is: "The cat quickly climbed up the tree." | codefeedback |
You are tasked with implementing a form component rendering system that supports input field addons such as prepend and append elements. The system should be able to render input fields with these addons based on the configuration settings and input parameters. Your goal is to write a method that can render the input c... | codefeedback |
Let's say we have a bunch of matrices that we know are non-anomalous. We now receive a new matrix and want to know if it belongs into the group or is way off. Is there a way to do that?
I'm thinking of something similar to MAD (median absolute deviation) but for matrices. | codefeedback |
Implement a function that takes a binary string as input and returns its decimal equivalent. The function should handle binary strings of up to 1000 characters. The input binary string will only contain 0s and 1s. You are not allowed to use built-in functions or libraries to convert the binary string to decimal. | codefeedback |
You are tasked with implementing a Python class that manages a menu system for a restaurant. The class should handle customer requests, maintain a log of orders, and track the presence of staff members.
You need to create a class called `Menu` with the following attributes and methods:
Attributes:
- `Requests`: A lis... | codefeedback |
Construct an Android RecyclerView that adeptly presents a diverse assortment of products, with each unique item meticulously implemented taking into account factors such as efficient memory management and optimal user interface experience. | codefeedback |
Develop a JSON structured program that not only records the frequency of visits of a specific user to various web domains but also categorises these domains based on the type of content they provide (like news, social media, educational etc.). Additionally, incorporate functionality to track the timestamp of each visit... | codefeedback |
You are tasked with creating a Python function that processes the output of the `ip address` command on a Linux system to build a dictionary mapping IP addresses to interface names. The function should then take an IP address as input and return the corresponding interface name from the dictionary.
The `ip address` co... | codefeedback |
Given the below erroneous piece of code, debug it and modify it to replace all words with 4 letters or more with "*****" in any given text.
```python
def replace_words(text):
words = text.split()
for i in range(len(words)):
if len(words[i]) > 4:
words[i] = '*****'
return ' '.join(words)... | codefeedback |
You are tasked with creating a Python function that retrieves files from a Telegram chat and calculates the total size of all the files combined. You are given a code snippet that iterates through the files in a chat and makes a request to the Telegram API to retrieve each file's information. Your task is to complete t... | codefeedback |
Write an SQL query to select the name, salary, and department of employees in a table named 'employees' who have a salary between 2000 and 3000, are in departments with more than 10 employees, and have been with the company for at least 5 years. | codefeedback |
Write a Visual Basic Script to find the sum of the first N prime numbers, where N is the input provided by the user. However, you are not allowed to use any looping constructs (such as for, while, or do-while loops) in your solution. | codefeedback |
Create a code to find all prime numbers between 2 and a given integer. | codefeedback |
Implement a class in Java with three private fields of different data types. Create public functions to access these fields. Also, include logic within these functions such as type checking or computations before setting or returning the values of these fields. Implement these computations using data structures and alg... | codefeedback |
Construct a legitimate CSS class that enables the vertical alignment of a particular element within the confines of its overarching parent container, whilst ensuring due validity and compatibility with major web browsers. | codefeedback |
I have this problem : Push Dominoes with Obstacles and Wind
Description are as below: There are `N` dominoes in a line, and we place each domino vertically upright. Some of these dominoes are immovable and are considered as obstacles. Additionally, there is a wind force that can affect the direction of the falling domi... | codefeedback |
Write a program that takes as input the dimensions of multiple trapezoids, and calculates the area of each based on the formula: [(base1 + base2) / 2] * height. Your program should also include condition testing to ensure that entered base lengths and heights are all positive numbers. Extend the code to include a funct... | codefeedback |
We are trying to delete the data from tables which have not been used since many years.
If we are doing CRUD operations on tables SQL Server log file size is going to be increased,
and our goal is that not to increase size the log file, or any system resources,
Is there any other solutions? | codefeedback |
Explain how to implement the bubble sort algorithm manually to sort a given list of numbers in descending order, without using any built-in sorting functions. Provide a step-by-step explanation of each iteration and swap operation.
Given the list [4, 9, 0, 3, 5, 7], the bubble sort algorithm can be implemented as foll... | codefeedback |
You are tasked with creating a Python unit test for a web application. The application uses Django and makes a POST request to a specific URL. Your task is to complete the unit test by filling in the missing parts of the code snippet provided.
You are given the following code snippet:
```python
"csrfmiddlewaretoken":... | codefeedback |
You are given a series of code snippets that represent a data retrieval process. The code snippets contain a mix of commands and data, and your task is to interpret the commands and extract the relevant information from the data.
The data is structured as a list of `typeguid` values, each represented as a 32-character... | codefeedback |
You are tasked with implementing a function to calculate the true negative (TN) values for a multilabel classification problem. In multilabel classification, each instance can be assigned multiple labels. The true negative value represents the number of instances where all the predicted labels are not present in the tr... | codefeedback |
Write a JavaScript function that extracts the domain name from an email address. The function should handle all possible scenarios, including email addresses with different top-level domains (e.g. .com, .org, .net) and email addresses with multiple subdomains. The function should also account for any special characters... | codefeedback |
Construct an algorithmic function utilizing Python programming language, purposed for the determination of prime numbers nested within the Fibonacci series, with the constraint of a pre-determined value 'p'. The magnitude of 'p' for this specific implementation ought to be confined to 20. | codefeedback |
You are tasked with creating a PHP class that manages a library of books. The class should have methods to add a new book, retrieve book details by ID, and display all books in the library. You are provided with a partial implementation of the `BookController` class in Laravel framework. Your task is to complete the cl... | codefeedback |
Design a Python program to migrate data from Google Cloud Firestore to Azure Cosmos DB using the relevant Python SDKs. The program must also optimize this process by implementing parallel processing and incorporating error-handling mechanisms. | codefeedback |
I have this problem : Minimum Cost to Cut a Stick with Constraints
Description are as below: Given a wooden stick of length `n` units. The stick is labelled from `0` to `n`. For example, a stick of length 6 is labelled as follows:
Given an integer array `cuts` where `cuts[i]` denotes a position you should perform a cut... | codefeedback |
Given the following Python code with a list named "list1", create a deep copy of this list named "copied_list". Identify any potential issues with the provided code and correct them as necessary.
```python
list1 = [1, [2, 3], 4]
copied_list = #Complete this line of code
``` | codefeedback |
Create a SQL query to find the average length of time for all purchases made by customers who have made at least 3 purchases. The result should only include purchases made within the last 6 months. Additionally, exclude any customers who have made a purchase longer than 2 hours in duration. The table structure remains ... | codefeedback |
Construct a regex pattern to match a valid IP address and validate each component of the IP address separately. Additionally, implement a function that checks if a given IP address is within a certain range. The range is defined by two IP addresses: a start IP and an end IP. The function should return true if the given... | codefeedback |
Implement a k-nearest neighbors algorithm to predict point labels. Additionally, handle the case where there are ties in the voting process by implementing a tie-breaking mechanism. | codefeedback |
建立一個多層次字典來儲存每個城市的多種氣象數據。
Example = {"New York": {"Temperature": 32, "Humidity": "High"}, "London": {"Temperature": 18, "Humidity": "Low"}, "Tokyo": {"Temperature": 24, "Humidity": "Medium"}} | codefeedback |
You are tasked with implementing a custom function that mimics the behavior of the `print` function in Python, with support for both positional and keyword arguments. The function should accept a variable number of positional arguments, followed by a variable number of keyword arguments. The positional arguments should... | codefeedback |
Compare the performance of quicksort, mergesort and heapsort on an unsorted array of size 1000, considering that the input array can contain duplicate elements. | codefeedback |
I have a control that is modelled on a . I want to render the control so that the control looks like that of a standard . Specifically, I have followed the MSDN documentation and all the rendering of the control is correct except for rendering when the control is disabled.
Just to be clear, this is for a system with ... | codefeedback |
Construct a bash command to list all network connections in the system, filtering out any connections with a specific port number greater than 5000 and belonging to a specific user with a UID greater than 1000. | codefeedback |
Design a function that scrupulously scrutinizes a string of text to confirm the presence of the numeric character '7', excluding its appearance at the beginning and end of the number sequence. This function should further probe if the '7' character is surrounded by prime numbers on both sides. If the '7' character is i... | codefeedback |
Propose an elaborate approach encompassing the procedural steps and logical considerations needed to effectively eliminate a specified entity from a predetermined list. | codefeedback |
Connect to a RESTful API end-point using OAuth2.0 authentication with JWT (JSON Web Tokens) to retrieve a paginated list of user information in JSON format. Implement error handling to gracefully handle network timeouts, invalid API responses, and expired JWT tokens. Additionally, implement rate limiting to prevent abu... | codefeedback |
You are tasked with implementing a function to validate a given string against a pattern. The pattern is represented as a sequence of characters, where each character can be a digit or a special character. The validation function should return true if the input string matches the pattern, and false otherwise.
The patt... | codefeedback |
Generate a list of integers between a given start and end value.
Start = 3
End = 10 | codefeedback |
Calculate the area of a triangle with base b=4 and height h = 5 using a recursive approach. | codefeedback |
Use regular expression to match all valid URLs in a string. However, the URLs should not contain any subdomains and must be followed by a specific query parameter called "key". Additionally, the URLs must only contain alphanumeric characters and cannot exceed a length of 100 characters. | codefeedback |
Develop a program that takes a positive integer greater than 1 and prints "true" if it is a prime number, and "false" otherwise. The program should also validate the input and handle invalid inputs by displaying an appropriate error message. Additionally, the program should implement the Miller-Rabin primality test alg... | codefeedback |
What attribute in HTML is used to completely hide an element from the page? Provide a code snippet demonstrating how to use the attribute to hide an element, and then explain any potential issues or limitations that may arise from using this method.
Furthermore, explain an alternative method to hide an element that no... | codefeedback |
Design a multi-threaded class in Python with three methods which handle data concurrently. Additionally, incorporate a mechanism that guarantees thread safety. | codefeedback |
Compose a JavaScript object that fulfills the task of executing a precise operation via a function. The operation in question is contingent on a specific condition supplied, compelling the utilization of conditional statements within the function embedded in the object. | codefeedback |
Develop a function that accepts a list of numeric values and returns a dictionary depicting the occurrence frequency of each distinct element. Additionally, add two features to the function. First, it should ignore the frequency of elements appearing only once and should not include them in the final dictionary. Second... | codefeedback |
Develop a function using recursive methodology that receives an array as an input and iteratively calculates the cumulative product of each element within the array. As an illustration, should the array be [2, 5, 8, 3]. | codefeedback |
Create a class in Python to represent a book with the title, author, year of publication, and genre as attributes. Additionally, implement a method that calculates the average rating of the book based on user ratings. The average rating should be rounded to two decimal places. Your implementation should also include a ... | codefeedback |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.