source stringclasses 6
values | conversations listlengths 2 2 |
|---|---|
magicoder | [
{
"from": "human",
"value": "You are tasked with creating a Python program that monitors the CPU and memory usage of a given process over a specific time period. You will need to implement a function that takes the process ID, monitoring duration, and monitoring interval as input and returns a list of CPU a... |
codefeedback | [
{
"from": "human",
"value": "Write a function to find all elements that appear more than once in a given array. The function should return the elements in ascending order and should also remove any duplicate elements from the result. Additionally, you should not use any built-in functions or libraries to so... |
evolcodegolf | [
{
"from": "human",
"value": "**Introduction** \nLila has a penchant for navigating a maze of moving walls and traps in a game she loves. Unfortunately, she's a bit too trusting; she will only move upward when the walls have shifted. You need to determine whether Lila can successfully ascend to safety or if... |
glaive | [
{
"from": "human",
"value": "You are tasked with creating a Gradle build file for a new Android project. The project consists of three modules: \"app\", \"library-android\", and \"utils\". The build file should include the necessary configuration for plugin management, repositories, and the root project nam... |
codefeedback | [
{
"from": "human",
"value": "Design a cognitive AI assistant utilizing Apache OpenNLP to recognize and analyze a user's intent."
},
{
"from": "gpt",
"value": "<think>\nOkay, I need to design a cognitive AI assistant using Apache OpenNLP for intent recognition and analysis. Let me start by breaki... |
codefeedback | [
{
"from": "human",
"value": "Embark on a comprehensive and scrupulous exploration through the convoluted realm of quantum cryptography, emphasizing its pivotal function in the sphere of fortified quantum communication. Could you intricately construct a narrative that sequentially outlines the genesis, evolu... |
magicoder | [
{
"from": "human",
"value": "You are tasked with implementing a Python class that represents a 2D game character. The class should have the following attributes:\n- `pos_x`: an integer representing the character's x-coordinate position on the game grid.\n- `pos_y`: an integer representing the character's y-... |
evolcodegolf | [
{
"from": "human",
"value": "Construct the mathematical function f(n) for any positive integer n according to the following rules:\n\n- If n is even, compute n / 2\n- If n is odd, compute 3 * n + 1\n\nThe iterative application of this function to any n greater than 0 intriguingly appears to always lead to t... |
dolphin | [
{
"from": "human",
"value": "translate this code to Haskell:\n```scheme\n(define (alphabet-position-sum s k)\n (let loop ((sum 0) (k k))\n (cond ((= k 0) sum)\n (else (let loop2 ((new-sum 0) (sum sum))\n (cond ((= sum 0) (loop sum (- k 1)))\n (else (loop2... |
dolphin | [
{
"from": "human",
"value": "Please write the following solution using Fortran:\nYou are given a string `s` consisting **only** of letters `'a'` and `'b'`. In a single step you can remove one **palindromic subsequence** from `s`.\n\nReturn _the **minimum** number of steps to make the given string empty_.\n\... |
codefeedback | [
{
"from": "human",
"value": "Write a function to find the closest pair of points in a given array of points."
},
{
"from": "gpt",
"value": "<think>\nOkay, I need to write a function to find the closest pair of points in an array. Hmm, how do I approach this? I remember that the brute-force metho... |
evolcodegolf | [
{
"from": "human",
"value": "Your task in this golfing challenge is to develop a program that will process a sequence of moves from a game of reversi (othello) and present the final outcome to the user. \n\nInput \nA string of numbers originating from the range [0-7]. Each pair of numbers represents first ... |
dolphin | [
{
"from": "human",
"value": "Please write the following solution using Erlang:\nYou are given two **0-indexed** arrays of strings `startWords` and `targetWords`. Each string consists of **lowercase English letters** only.\n\nFor each string in `targetWords`, check if it is possible to choose a string from `... |
codefeedback | [
{
"from": "human",
"value": "Create a function to convert a given distance in miles to kilometers. The function should also take into account the time it takes to travel that distance and calculate the speed in kilometers per hour. Additionally, handle any potential errors or edge cases that may occur durin... |
evolcodegolf | [
{
"from": "human",
"value": "A Flow Snake, commonly referred to as a Gosper curve, represents a fractal path that exhibits exponential growth with each progressive order or iteration arising from a straightforward procedural transformation. Below are detailed specifications regarding the construction method... |
evolcodegolf | [
{
"from": "human",
"value": "Devise an intricate program or function that, upon receiving a string, systematically filters out as many distinct byte values as feasible and subsequently returns the purified string. Notably, your program must inherently reject the presence of these byte values within its own ... |
glaive | [
{
"from": "human",
"value": "How can I write a JavaScript program that rearranges the elements of an array so that even and odd elements are separated?"
},
{
"from": "gpt",
"value": "<think>\nOkay, I need to write a JavaScript program that rearranges an array so that even and odd numbers are sep... |
evolcodegolf | [
{
"from": "human",
"value": "Given two positive integers, create a new integer by interleaving the digits of their decimal representations in a manner where digits from both numbers alternate, starting from the leftmost digit of the first number. If one number is shorter, fill in the gaps with zeros until b... |
dolphin | [
{
"from": "human",
"value": "translate this code to Objective-C:\n```lisp\n(defun minimum-effort (tasks)\n (setq tasks (sort tasks (lambda (x y) (> (- (second x) (first x)) (- (second y) (first y)))))) \n (let ((ans 0) (sum-energy 0))\n (dolist (task tasks ans)\n (setq ans (max ans (+ sum-energy (... |
evolcodegolf | [
{
"from": "human",
"value": "Please construct a comprehensive leaderboard for the specified question (id=111735) that thoroughly integrates multiple steps of reasoning. Your solution must initiate a singular HTTP or HTTPS request to the StackExchange API, skillfully parse the returned data, and subsequently... |
glaive | [
{
"from": "human",
"value": "You are tasked with creating a function in Clojure that takes in a list of numbers and returns the sum of all the numbers in the list. The function should be named \"sum-numbers\" and should adhere to the following specifications:\n- The function should be defined within the \"j... |
sharegpt | [
{
"from": "human",
"value": "How can I create a C# program to sort a string array in ascending order using insertion sort?"
},
{
"from": "gpt",
"value": "<think>\nOkay, I need to create a C# program that sorts a string array in ascending order using insertion sort. Let me think about how to appr... |
magicoder | [
{
"from": "human",
"value": "You are tasked with writing a Python unit test for a network extension driver called `NuageSubnetExtensionDriver`. The test should ensure that the `initialize` method of the driver is called with the correct configuration settings. The code snippet provided is a partial test cas... |
magicoder | [
{
"from": "human",
"value": "You are tasked with creating a Python class that represents a basic configuration for carriers in a transportation management system. The class should allow for the configuration of carrier-specific settings and provide methods for accessing and modifying these settings.\n\nYour... |
glaive | [
{
"from": "human",
"value": "You are tasked with creating a module in the Clocks package that utilizes a clock signal and a register. The module should have a rule that assigns the value of an input register to another register. However, the code provided contains an error in the module instantiation, where... |
evolcodegolf | [
{
"from": "human",
"value": "Given an integer M ranging from 1 to 5, you must construct an MxM matrix of MxM cells, where each cell alternates between the number M and the product of its row and column indices, with unique variations of M. The output should include a visual representation of the structure. ... |
codefeedback | [
{
"from": "human",
"value": "Create a function which takes in an array and returns a list of all the elements which appear only once in the array."
},
{
"from": "gpt",
"value": "<think>\nOkay, I need to create a function that takes an array and returns a list of elements that appear only once. H... |
sharegpt | [
{
"from": "human",
"value": "How can I plot three different functions namely `sin`, `cos` and their addition on the same figure using Matplotlib? I have defined the domain `t` and the three functions as follows:\n\n```python\nfrom numpy import *\nimport math\nimport matplotlib.pyplot as plt\n\nt = linspace(... |
magicoder | [
{
"from": "human",
"value": "You are tasked with creating a Python Django migration for a new model called `Customers`. The `Customers` model should have the following fields:\n\n1. `id` (AutoField, primary key)\n2. `name` (CharField with a maximum length of 100 characters)\n3. `email` (EmailField)\n4. `cre... |
glaive | [
{
"from": "human",
"value": "You are tasked with creating a web application form that collects user information and displays a confirmation message with the submitted information. The form should have fields for the user's first name, last name, username, email, and a selection of newsletters to subscribe t... |
sharegpt | [
{
"from": "human",
"value": "Can you provide a SQL query that calculates the average sales price for each store?"
},
{
"from": "gpt",
"value": "<think>\nOkay, the user is asking for a SQL query that calculates the average sales price for each store. Let me break this down.\n\nFirst, I need to fi... |
dolphin | [
{
"from": "human",
"value": "convert this code from PHP to javascript:\n```php\nfunction combinationSum3($k, $n) {\n $result = array();\n \n function helper($k, $n, $current, $current_comb, &$result) {\n if ($k == 0 && $n == 0) {\n array_push($result, $current_comb);\n } el... |
magicoder | [
{
"from": "human",
"value": "You are tasked with creating a Python function that simulates a simple virtual machine (VM) management system. The function should be able to power on a VM and retrieve its status. You are provided with a partial code snippet from the existing VM management system for reference.... |
evolcodegolf | [
{
"from": "human",
"value": "You are presented with an ASCII-art depiction of characters on a plane, which can be inputted through any acceptable method. The representation will solely include:\n\n- [a-z] indicating moveable characters, with each letter appearing only once on the board\n- # signifying immov... |
codefeedback | [
{
"from": "human",
"value": "You need to classify an email as spam or not spam. Output \"spam\" or \"not spam\".\n\nThe email contains multiple paragraphs of text and may include HTML tags. Some spam emails may contain intentionally obfuscated or misspelled words to bypass traditional spam filters. Addition... |
glaive | [
{
"from": "human",
"value": "I am trying to create a model using the Modbat framework in Scala, but I am struggling with implementing the transition logic. I want to define a state machine with the following transitions:\n- From \"reset\" to \"state1\" if the current state is \"reset\"\n- From \"state1\" to... |
codefeedback | [
{
"from": "human",
"value": "Develop a JavaScript algorithm that can evaluate and classify the validity of a given cellular phone number and email address. In addition to determining the validity based on predefined acceptable formats, the algorithm should also detect and flag potentially fraudulent or spoo... |
glaive | [
{
"from": "human",
"value": "I am working on developing a versioning UI for a project, and I need to create a HistorySettings class to manage various settings related to versioning history. The HistorySettings class should allow me to set options such as clean up labeled, keep forever, load all, increments,... |
evolcodegolf | [
{
"from": "human",
"value": "What tips do you have for golfing in Applescript? I'm looking for ideas that can be applied to code golf problems in general that are at least somewhat specific to Applescript (e.g. \"remove comments\" is not an answer). Additionally, please include examples of how these tips ca... |
glaive | [
{
"from": "human",
"value": "I am trying to write a simple program in Go using the `golang.org/x/oauth2` package to exchange a code for an access token. However, I keep getting an error saying that the authorization code has been used, even though I see a new code every time I invoke the login dialog. I'm n... |
magicoder | [
{
"from": "human",
"value": "You are tasked with implementing a function that determines whether a given string is a palindrome. A palindrome is a word, phrase, number, or other sequence of characters that reads the same forward and backward, ignoring spaces, punctuation, and capitalization.\n\nYou need to ... |
glaive | [
{
"from": "human",
"value": "I need to write a SQL query to alter a table by renaming a column. I want to change the name of the column \"substract\" to \"subtract\" in the table \"order_line_item_adjustments\". How can I achieve this using SQL?"
},
{
"from": "gpt",
"value": "<think>\nOkay, I ne... |
codefeedback | [
{
"from": "human",
"value": "Create a segment of Python code that will accurately determine the forthcoming smallest numerical entity in a set of numerical data structured as an array, ensuring to account for potential outliers and array length variability."
},
{
"from": "gpt",
"value": "<think>... |
codefeedback | [
{
"from": "human",
"value": "You are tasked with implementing a Python context manager for tracking the context of web requests in a web framework. The context manager should be able to handle requests from both Django and Flask frameworks. The context manager should utilize the provided classes `RequestCon... |
sharegpt | [
{
"from": "human",
"value": "Can you provide a C++ program that calculates the maximum value of a given array of integers?"
},
{
"from": "gpt",
"value": "<think>\nOkay, I need to write a C++ program that calculates the maximum value of a given array of integers. Let's think about how to approach... |
codefeedback | [
{
"from": "human",
"value": "Determine the frequency of the specific substring \"ab\" within the provided string.\ntext = \"abraacadabrabracabracabracabra\""
},
{
"from": "gpt",
"value": "<think>\nOkay, so I need to find out how many times the substring \"ab\" appears in the given string. The st... |
codefeedback | [
{
"from": "human",
"value": "How can you verify the functionality of a custom-made \"matrix multiplication\" function in Ruby, considering edge cases and improper inputs?"
},
{
"from": "gpt",
"value": "<think>\nOkay, I need to figure out how to verify the functionality of a custom matrix multipl... |
dolphin | [
{
"from": "human",
"value": "port this code from TypeScript to Object Pascal:\n```typescript\nfunction maxLikeTimeCoefficient(satisfaction: number[]): number {\n satisfaction.sort((a, b) => a - b);\n const n = satisfaction.length;\n const prefixSum = new Array(n + 1).fill(0);\n for (let i = 1; i... |
magicoder | [
{
"from": "human",
"value": "You are working on a recommendation system for an e-commerce platform. The system uses a probabilistic programming framework to model user preferences for different products. The framework uses Pyro, a probabilistic programming language built on top of PyTorch.\n\nIn the code sn... |
magicoder | [
{
"from": "human",
"value": "You are tasked with implementing a class for a binary tree node that represents an array. The node should support adding filters to manipulate the array data and visualizing the tree structure with error information.\n\nYour task is to implement the `Array` class with the follow... |
magicoder | [
{
"from": "human",
"value": "You are tasked with implementing a function that extracts a specific substring from a given string based on a provided start and end marker. The function should return the substring that falls between the start and end markers, excluding the markers themselves. If the start mark... |
codefeedback | [
{
"from": "human",
"value": "Make the following Python function for generating powerset without using recursion."
},
{
"from": "gpt",
"value": "<think>\nOkay, I need to write a Python function to generate the power set of a given set without using recursion. Hmm, let's think about how to do this... |
sharegpt | [
{
"from": "human",
"value": "How can I check if all the elements in an array are odd numbers using JavaScript?"
},
{
"from": "gpt",
"value": "<think>\nOkay, the user wants to check if all elements in an array are odd numbers using JavaScript. Let's think about how to approach this.\n\nFirst, I n... |
sharegpt | [
{
"from": "human",
"value": "How can I create a JavaScript object with three properties \"name\", \"age\", and \"location\" that hold string values?"
},
{
"from": "gpt",
"value": "<think>\nOkay, the user wants to create a JavaScript object with three properties: name, age, and location. All of t... |
magicoder | [
{
"from": "human",
"value": "You are tasked with implementing a simple encryption and decryption algorithm using a symmetric key. The algorithm should take a plaintext message and encrypt it using a secret key, and then be able to decrypt the encrypted message back to the original plaintext using the same s... |
codefeedback | [
{
"from": "human",
"value": "Use a Tensorflow model to predict a numerical output from an input.\nInput: [1, 2, 3]\nOutput: 8.5"
},
{
"from": "gpt",
"value": "<think>\nOkay, I need to create a TensorFlow model that can predict a numerical output from an input. The example given is Input: [1, 2, ... |
codefeedback | [
{
"from": "human",
"value": "Please implement a function in Python that performs 3-way partitioning of a given array. The array should be sorted in ascending order, with all the odd numbers on the left side, even numbers in the middle, and prime numbers on the right side.\n\nYou are not allowed to use any b... |
codefeedback | [
{
"from": "human",
"value": "Write a code that takes a list of numbers, and outputs the 10th largest value.\nmylist = [2, 4, 54, 31, 34, 77, 29, 11, 44, 78, 65, 23]"
},
{
"from": "gpt",
"value": "<think>\nOkay, I need to write a Python code that takes a list of numbers and outputs the 10th large... |
sharegpt | [
{
"from": "human",
"value": "Kindly formulate a \"Car\" class incorporating a pair of data attributes which should be specified as \"top speed\" and \"model year\"."
},
{
"from": "gpt",
"value": "<think>\nOkay, let's see. The user wants me to create a Car class with two data attributes: top spee... |
sharegpt | [
{
"from": "human",
"value": "Why does the lw instruction in MIPS have two arguments - an offset and a register source? Wouldn't it be enough to just have the register source as the argument?"
},
{
"from": "gpt",
"value": "<think>\nOkay, so I'm trying to understand why the MIPS lw (load word) ins... |
magicoder | [
{
"from": "human",
"value": "You are tasked with implementing a version control system that tracks changes made to files in a directory. The system should be able to handle adding new files, modifying existing files, and displaying a summary of the changes made.\n\nYou are given a code snippet that represen... |
sharegpt | [
{
"from": "human",
"value": "Why am I achieving a higher accuracy rate on the MNIST dataset for multiclass classification in Keras using `binary_crossentropy` as opposed to `categorical_crossentropy`? I am currently learning how to create convolutional neural networks using Keras, and although `categorical_... |
magicoder | [
{
"from": "human",
"value": "You are tasked with creating a Python function that processes a given Dockerfile and returns a list of all the exposed ports. The Dockerfile is a text file that contains a series of instructions used to build a Docker image. Each instruction in the Dockerfile is written on a new... |
sharegpt | [
{
"from": "human",
"value": "I have a one-line string containing key-value pairs in the format of \"key=value\". Here is an example: `start=(\"a\", \"b\") and between=(\"range(2019, max, to=\\\"le\\\")\") and end=(\"a\", \"b\")`. I want to use regex in Golang to extract these key-value pairs individually. T... |
glaive | [
{
"from": "human",
"value": "I am working on a web application using the FutibasWeb framework in Elixir and need to create a new module for handling user authentication. I want to implement a function that takes in a username and password, compares it with the user database, and returns a boolean indicating... |
dolphin | [
{
"from": "human",
"value": "Please focus on the efficiency of this problem and provide code in Go:\nA kingdom consists of a king, his children, his grandchildren, and so on. Every once in a while, someone in the family dies or a child is born.\n\nThe kingdom has a well-defined order of inheritance that con... |
evolcodegolf | [
{
"from": "human",
"value": "You are at the helm of a spacecraft, equipped with a sophisticated propulsion system capable of accelerating at a rate of 1km/s^2 in the direction of the ship's orientation, aided by exceptional inertial dampers. In addition to this, your vessel possesses thrusters that allow fo... |
glaive | [
{
"from": "human",
"value": "You are tasked with creating a navigation bar for a web application using HTML and JSP. The navigation bar should have the following features:\n- A brand link that directs users to the home page of the application.\n- A toggle button for better mobile display.\n- Navigation link... |
codefeedback | [
{
"from": "human",
"value": "You are tasked with implementing a class that manages the reconnection attempts for a network service. The class should have an initializer that allows setting a multiplier for the reconnection time. Additionally, it should provide a method to calculate the time interval to wait... |
sharegpt | [
{
"from": "human",
"value": "How can I create a web application that implements the BMI Calculator?"
},
{
"from": "gpt",
"value": "<think>\nOkay, the user wants to create a web app for a BMI calculator. Let me think about how to approach this. First, I need to outline the basic structure. A BMI ... |
glaive | [
{
"from": "human",
"value": "You are tasked with creating a protocol buffer message in Go that includes an enum field with a specific prefix. The message should have a field named \"TheField\" of type test.TheTestEnum from the imported thetest.proto file. The enum field should be marked as non-nullable usin... |
magicoder | [
{
"from": "human",
"value": "You are tasked with implementing a program that processes user input to perform a specific task. The program should read a series of strings from the standard input, remove any trailing newline or carriage return characters, and then print the modified strings to the standard ou... |
glaive | [
{
"from": "human",
"value": "You are tasked with creating a gen_server module in Erlang that handles a specific functionality. Your gen_server module should have the following characteristics:\n\n1. The module should be named `die_please`.\n2. The `die_please` module should implement the `gen_server` behavi... |
sharegpt | [
{
"from": "human",
"value": "How can I create a Java library with a set of utilities for working with strings?"
},
{
"from": "gpt",
"value": "<think>\nOkay, I need to create a Java library with utilities for working with strings. Let me think about how to approach this. First, I should start by ... |
sharegpt | [
{
"from": "human",
"value": "I'm implementing some recursive code, where function instances deeper down in the call stack may need to refer to data from prior frames. However, I only have non-mut access to those data, so I receive those data as references. As such, I would need to keep references to those d... |
glaive | [
{
"from": "human",
"value": "You are tasked with creating a module that collects metrics for an application using the Telemetry framework in Elixir. The module should allow for the transmission of these metrics and should include the following functionalities:\n- Define a start_link function that starts the... |
evolcodegolf | [
{
"from": "human",
"value": "Create a whimsical rendition of the phrase \"hocus pocus\" by applying various transformations to it:\n\n1. Randomly capitalize any subset of letters: HoCuS PoCuS\n2. Add a question mark at the end: hocus pocus?\n3. Replace every 'o' with a different vowel: hacus pacus\n4. Chang... |
evolcodegolf | [
{
"from": "human",
"value": "At the time of writing this puzzle, there are soon to be 269 puzzles related to primes. To celebrate/mourn this event (269 is prime), this challenge will be about exploding primes. In preparation for this task, I've obtained a permit (legal, I assure you) for dynamite charges of... |
dolphin | [
{
"from": "human",
"value": "Please write the following solution using R:\nGiven the root of a binary tree and two integers `p` and `q`, return _the **distance** between the nodes of value_ `p` _and value_ `q` _in the tree_.\n\nThe **distance** between two nodes is the number of edges on the path from one t... |
evolcodegolf | [
{
"from": "human",
"value": "CleverBot functions as a conversational AI, primarily by emulating the responses it has learned from authentic human interactions it has encountered over time. Initially, its capabilities may seem rudimentary, but as its database expands significantly, it gradually acquires the ... |
magicoder | [
{
"from": "human",
"value": "You are tasked with creating a command-line interface (CLI) application for managing a virtual inventory of items. The application should allow users to add, remove, and list items in the inventory, as well as display the current version of the application.\n\nYour task is to im... |
codefeedback | [
{
"from": "human",
"value": "Construct an SQL query to delete the records whose age is greater than 30, whose first name starts with the letter 'A', and whose last name starts with the letter 'B'. The query should also ensure that the deletion only applies to records where the age is greater than 30 and bot... |
sharegpt | [
{
"from": "human",
"value": "I'm new to Go and I'm used to test driving my code. I find the assert syntax in Go to be quite verbose and would like to simplify it. Currently, it looks like this:\n\n```go\nfunc TestSomething(t *testing.T) {\n something := false\n if something {\n t.Log(\"Oh noes - someth... |
glaive | [
{
"from": "human",
"value": "Is there a way to obtain the address of a member of a template class in g++ inline assembly, specifically as a compile-time constant value? I believe I need the mangled name of `T<U>::x` to achieve this. How can I express this in my code?\n\n```cpp\ntemplate <typename U>\nstruct... |
sharegpt | [
{
"from": "human",
"value": "Given a singly linked list, reverse its order of nodes. Your solution should have a time complexity of O(n) and should use constant extra space. Additionally, you are not allowed to use any of the following operations:\n\n- Creating a new linked list\n- Using recursion\n- Modify... |
evolcodegolf | [
{
"from": "human",
"value": "This task revolves around the intricate process of deconstructing a string that symbolizes a product identifier into three distinct and meaningful components.\n\nThe initial segment is comprised of a combination of uppercase and lowercase letters of any length, serving as an ide... |
glaive | [
{
"from": "human",
"value": "You are tasked with creating a Ruby on Rails application to manage product stock levels. The application should include a background job that increases the stock of a product by a specified amount. The job should be enqueued to run on the default queue.\n\nWrite a Ruby on Rails ... |
dolphin | [
{
"from": "human",
"value": "Please focus on the algorithm of this problem and provide code in Dart:\nYou are given an `m x n` integer array `grid` where `grid[i][j]` could be:\n\n* `1` representing the starting square. There is exactly one starting square.\n* `2` representing the ending square. There i... |
dolphin | [
{
"from": "human",
"value": "convert this code from TypeScript to Go:\n```typescript\nfunction numSquarefulPerms(nums: number[]): number {\n const isSquare = (n: number): boolean => Number.isInteger(Math.sqrt(n));\n const dfs = (idx: number): number => {\n if (idx === nums.length) {\n ... |
glaive | [
{
"from": "human",
"value": "I am fairly new to Rails and I am facing errors while trying to push to Heroku. When I run a Bundle Install, I get the following error message:\n\n\"An error occurred while installing pg (1.1.3), and Bundler cannot continue. Make sure that 'gem install pg -v '1.1.3'' succeeds be... |
glaive | [
{
"from": "human",
"value": "You are tasked with creating a database trigger function in PostgreSQL to infer the file type from the file name's extension and update the file type in the database accordingly. The trigger function should be fired at the ROW level, BEFORE an INSERT or UPDATE operation.\n\nThe ... |
sharegpt | [
{
"from": "human",
"value": "How can I use Node.js to retrieve data from an API and convert it to JSON format?"
},
{
"from": "gpt",
"value": "<think>\nOkay, the user wants to know how to use Node.js to retrieve data from an API and convert it to JSON format. Let me break this down.\n\nFirst, I n... |
sharegpt | [
{
"from": "human",
"value": "How can I design an algorithm that checks if a given binary tree is a binary search tree?"
},
{
"from": "gpt",
"value": "<think>\nOkay, so I need to figure out how to design an algorithm that checks if a binary tree is a binary search tree (BST). Hmm, let's start by ... |
magicoder | [
{
"from": "human",
"value": "You are tasked with implementing a TypeScript function that calculates the sum of an array of numbers. The function should take an array of numbers as input and return the sum of all the numbers in the array. You are also required to write a simple React component that utilizes ... |
glaive | [
{
"from": "human",
"value": "I am trying to desugar a list comprehension in Haskell, using a combination of monads and parallel comprehensions. The specific code snippet I am working with involves desugaring list comprehensions, monad comprehensions, and array comprehensions. I need to implement a function ... |
glaive | [
{
"from": "human",
"value": "You are tasked with implementing a feature in a web application that allows users to make deposits into their accounts. The feature should handle both valid and invalid inputs. When all parameters are valid, a deposit should be made successfully and the account balance should be... |
magicoder | [
{
"from": "human",
"value": "You are tasked with implementing a timed hosted service in C# using the .NET Core framework. Your goal is to create a service that runs a specific task at regular intervals. You will need to utilize the Timer class and asynchronous programming to achieve this.\n\nYour task is to... |
glaive | [
{
"from": "human",
"value": "I am trying to create a bash script that installs the necessary dependencies, builds a wheel package, and moves a specific file to a different directory. However, I want to ensure that the script is only run on python3. Can someone help me write a bash script that checks for the... |
sharegpt | [
{
"from": "human",
"value": "Given the following string, convert the string into a list of words and then reverse the order of the words. Additionally, perform string reversal on each word in the list. You are not allowed to use any built-in string or array reversal methods; instead, you will need to implem... |
glaive | [
{
"from": "human",
"value": "I need to write a SPARQL query to retrieve information about a person from a given RDF dataset. The query should select all properties (alternateName, hasOccupation, birthDate, givenName, alumniOf, knowsLanguage, nationality) for individuals who are instances of the schema:Perso... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.