instruction_seed stringlengths 29 40.5k | source stringclasses 6
values |
|---|---|
You are tasked with creating a RESTful API for a book auction system. The API should have endpoints for user authentication, adding books, updating books, adding bids to books, and retrieving book information. Each endpoint requires proper authentication using a token.
Your task is to write the code for the API endpoi... | glaive |
I am working on a web application using the Laravel framework and I have a model with multiple pages. I want to add a button to each page that will allow users to go back to the index page of the model. How can I implement a button with a link to the index page of the model in Laravel? | glaive |
You have been tasked with creating a Dockerfile for a new application. The application needs to be built on an Ubuntu 18.04 base image and requires the installation of build-essential and libutf8proc-dev packages. The Dockerfile should set the working directory to /app and copy all the files from the current directory ... | glaive |
Can you provide a Python program that calculates the dot product of two given lists? | glaive |
<p>If I execute a MOVSD that is not aligned on a natural boundary, such as an even-numbered address, a 4-byte divisible address, or an 8-byte divisible address, what happens? Will it impact performance or potentially cause a segmentation fault?</p> | glaive |
You are tasked with creating a program that calculates the average of a list of numbers. The program should take in a list of integers as input and output the average of the numbers in the list. The program should handle both positive and negative numbers, and the input list can have varying lengths.
Write a function ... | glaive |
You are required to create a custom MBartTokenizer class that inherits from the XLMRobertaTokenizer. The tokenizer should have the ability to prepare sequence-to-sequence batches, with the ability to handle source and target texts in different languages. Additionally, the tokenizer should be able to add special tokens ... | glaive |
Can an AI assess the degree of similarity between two textual arrangements using a regular expression algorithm? The regular expression pattern should consist of lowercase alphabets only, and the strings under investigation are referred to as "string1" and "string2". Additionally, I would like the evaluation to conside... | glaive |
I am working on a tool in Python that connects to a number of UNIX sockets, sends a command, and saves the output in the local file-system. This tool runs this process every few seconds. To perform some cleanup when the tool receives termination signals, I have registered a function (shutdown) to signal.SIGHUP and sign... | glaive |
I am working on a music visualization project and I need to create a program that can parse and process beat and note data from a file. The beat data consists of timestamps and beat types, while the note data consists of start and end timestamps and note values. I need to write a program that can read this data from a ... | glaive |
I need to create a CUDA kernel for processing a set of options in blocks, with the goal of optimizing memory access and coalescing. The kernel will need to handle a set of values for each option, including an array of real numbers, an array of integers, and two arrays of integers for indexing. The kernel will also need... | glaive |
You are tasked with implementing a function in Zig that will write the contents of an abstract syntax tree (AST) to a specified output stream. The AST is represented by the `Air` and `Liveness` structs, which contain instructions and liveness data for a particular program. The function `dump` takes in an allocator, the... | glaive |
You are tasked with writing a program that calculates the value of a specific sequence. The sequence is defined by the formula a(n) = n^(n-1) * (n+1)^n. You need to create a function or program that takes an input n and returns the corresponding value of a(n). | glaive |
You are tasked with creating a class for a check box in Racket. The check box should be able to be labeled with either a string or a bitmap, and it should have a callback procedure that is invoked whenever the check box is clicked. The constructor for the check box should take in the label, the parent container, the ca... | glaive |
You are tasked with creating an XSLT stylesheet to transform XML data into an RSS feed. Your stylesheet must include the necessary variables to modify the feed, such as the number of items, the feed title, site URL, and feed description. Additionally, you need to retrieve data from an XML source and order it by updateD... | glaive |
You are tasked with implementing a program that manipulates preterms and prepatterns in a given context. A preterm can be one of the following:
- PreType of loc
- PreId of loc * ident
- PreQId of loc * name
- PreApp of preterm * preterm * preterm list
- PreLam of loc * ident * preterm option * preterm
- PrePi of loc * ... | glaive |
I am trying to implement a stereo block matcher kernel using normalized cross correlation. I need to write a CUDA kernel that takes in two input images, a window radius, minimum disparity, and maximum disparity, and returns the disparity values over the two input images. The kernel should be very similar in design to t... | glaive |
I'm encountering an issue while trying to run an Alembic migration with SQLAlchemy. When I run the command `alembic revision --autogenerate -m "Added initial tables"`, it fails, producing the error `sqlalchemy.exc.ArgumentError: Can't load plugin: sqlalchemy.dialects:driver`. My database URL is `postgresql+psycopg2://d... | glaive |
I am trying to compile my C++ program using CMake, and I want to include some additional compiler flags to enable more warnings. How can I set the C++ compiler flags in my CMakeLists.txt file to include the -Wall and -Wextra flags? | glaive |
You need to create a PowerShell function to add a SharePoint Online (SPO) site to an Access Package Catalog and Access Package. The function should take the Access Package Catalog Id, Access Package Id, SPO Site URI, and Site Role Name as parameters. It should then add the SPO site to the Catalog and Access Package, ha... | glaive |
I need to implement CUDA kernels for bitwise AND, OR, and XOR operations for tensors of integral types and boolean values. The CUDA kernels should support element-wise operations on two input tensors and store the result in an output tensor. The kernels need to handle different data types and perform the bitwise operat... | glaive |
You are tasked with creating a Node.js module that provides utility functions for working with streams. Specifically, you need to implement the following functions:
1. `streamToBuffer`: A function that takes a Readable stream as input and returns a Promise that resolves to a Buffer containing the data from the stream.... | glaive |
How can I write a program to remove any digit in a given numerical array that can be mathematically determined as a product of 11? | glaive |
You are required to create a Perl module for parsing comma-delimited PrettyBase output, as defined by the SeattleSNPs (http://pga.gs.washington.edu/). The module will be used to extract individual allele data from PrettyBase format. The module should be expected to handle tab-delimited input, with the following format:... | glaive |
You are tasked with implementing a Ridge Regression model using the MLJLinearModels library in Julia. The goal is to create a Ridge Regression model with certain specifications and then test its performance using different methods.
Create a single-group Ridge Regression model and test its implementation for a single p... | glaive |
You are tasked with creating a simple GUI library in Rust using the Piston window library. The library should include a trait called Widget, which has two methods: draw and handle_event. The draw method should take in coordinates, a context, a graphics object, and a glyph cache, and it should draw the widget on the scr... | glaive |
I am trying to define a mixin in my Oraculum application that should always be invoked after any other mixins in the dependency chain have initialized. The mixin should have an option to automatically render the view after it has been initialized. However, I'm having trouble implementing this functionality. Can someone... | glaive |
You are tasked with creating a new schema and table in a database using SQL. The schema should be named "atomic" and the table should be named "com_snowplowanalytics_snowplow_duplicate_1". The table should have the following columns:
- schema_vendor: VARCHAR(128) with ENCODE RUNLENGTH
- schema_name: VARCHAR(128) with E... | glaive |
You are tasked with creating a React component for Chips, which are compact elements used to represent input, attributes, or actions. The component should be able to handle user input, selection, content filtering, and triggering actions. The component should include the ability to display avatar images, SVG icons, or ... | glaive |
You are tasked with writing a program to find the sum of numbers that can be expressed in the form t*n + u*(n+1) for non-negative integers t and u in exactly three ways. Your program should be able to handle large numbers and efficiently compute the sum of these numbers.
Write a program that takes in a positive intege... | glaive |
I am trying to create a program that uses a buzzer to generate an ascending sound. I need to write a function that will achieve this using Z80 assembly language. The function should take no input parameters and return no output. The buzzer should produce an ascending sound when the function is called.
Can someone prov... | glaive |
You are tasked with creating a program to simulate the movement and interactions of a six-wheeled robot called MiR100, used in industrial environments. The robot can carry a payload of up to 100kg and has various components such as lidar sensors, ultrasonic sensors, cameras, and wheels. Your task is to create a simulat... | glaive |
I created a struct in my code and set its alignment using `alignas(alignof(int))`. However, when I generate the comparison assembly, it doesn't seem to consider the overaligned struct as an integer. I'm wondering if GCC should be able to optimize this and treat it as an integer. Is this due to ABI issues or is it simpl... | glaive |
You are tasked with implementing a multi-node cluster in Akka using C#. The cluster will consist of 4 members, and you need to ensure that the cluster reaches initial convergence, marks a node as UNREACHABLE when the network is pulled, and then marks the node as DOWN. Additionally, you need to allow a fresh node with t... | glaive |
You are tasked with creating a Python script that sets up a virtual environment and activates it. Your script should set the VIRTUAL_ENV variable to the specified directory and update the PATH variable to include the virtual environment's bin directory. Additionally, the script should update the prompt to display the n... | glaive |
You are tasked with creating a program that can parse a JSON file and extract specific information from it. The JSON file will contain data about folders and their attributes, such as id, modelName, mvc, name, children, filterType, folderName, isDefaultView, and localisedFolderName. Your program should be able to read ... | glaive |
You are tasked with creating a script in CoffeeScript that configures a REPL with a basic environment for exploring an app. The script should load the mongoose library and all models, making them available in the context via their model name. It should also provide some convenient helper methods. Additionally, the scri... | glaive |
I need a JavaScript code that can determine if a number is even or odd. Can you also provide a function that checks if the number is prime? Please note that the program should be able to handle numbers up to 1,000,000. | glaive |
You are tasked with creating a shader program that will render a rectangle with a border and a checkerboard pattern. The rectangle should have a solid border color and, if a scissor value is set, the interior should display a checkerboard pattern.
Your program should take in the following input parameters:
- vec4 Inne... | glaive |
I want to create a simple calculator using JavaScript. It should be able to take two numbers and an operator as input, and then output the result. How can I accomplish this? | glaive |
You are tasked with creating a program that sets environment variables and then executes a test suite using the Tasty testing framework in Haskell. The program should set the environment variables "TASTY_NUM_THREADS" to "6", "TASTY_HIDE_SUCCESSES" to "TRUE", "TASTY_KREBCHECK_MAX_SIZE" to "300", and "TASTY_KREBCHECK_TES... | glaive |
You are tasked with implementing a program to perform a structural analysis of a tubular beam. The relevant properties of the beam, such as the Young's (elastic) modulus E, shear modulus G, and torsional moment of inertia J, must be specified to define the stiffness matrix for its discretization with n elements. Once t... | glaive |
You are tasked with creating a web page that displays information about a team of developers and their projects. The web page should include a header with a logo, the names of the developers, and a brief description of their work. Additionally, the page should include images of the developers, their names, and a link t... | glaive |
You are tasked with creating a JavaScript class using the Backbone framework to represent a collection of books in a library. Each book should have attributes such as title, author, genre, and ISBN. Additionally, the class should have a method to add a new book to the collection and another method to remove a book from... | glaive |
You are working on an Emacs configuration and want to create a custom keybinding for a specific action. You want to define a keybinding to execute a specific function when a certain key combination is pressed in normal mode. The function should be triggered when the user presses "SPC a" in normal mode. Write the code t... | glaive |
I am trying to use smex to handle M-x in my Emacs configuration, but I am encountering an issue. I have installed the smex package and added the necessary configuration to my init file, but when I try to use M-x, it does not work as expected. I have checked my configuration and everything seems to be in place, but I am... | glaive |
You are tasked with designing a program to store and manage device attributes using the protocol buffer syntax "proto3" in the tensorflow package. The program should include a message for DeviceAttributes, which contains the following fields:
1. Name (string)
2. Device type (string)
3. Memory limit (int64)
4. Bus adjac... | glaive |
I added goroutines to my Go program that parses 3D models in OBJ format and outputs a json object. However, the program now takes longer to run compared to when I didn't use goroutines. The order of the output seems correct, but I'm not sure why it's slower. Can anyone help me understand what could be causing this issu... | glaive |
You are tasked with creating a smart contract to prevent flash loan attacks on a reward pool. The contract should include functions to receive flash loans, deposit and withdraw tokens from the reward pool, and exploit the flash loan to transfer reward tokens to the caller's address. Your smart contract should also be a... | glaive |
You are tasked with creating an HTTP server using Actix-web that listens for both HTTP and HTTPS requests. The server should redirect any incoming HTTP requests to HTTPS.
Write the code to create an Actix-web server that listens for HTTP requests on port 80 and HTTPS requests on port 443. Any incoming HTTP request sho... | glaive |
How can I retrieve the 5th element from an array in a programming language? | glaive |
I am working on a project where I need to install a publishing service and configure Sitecore using PowerShell. I have defined some variables and created some hashtables for the installation and configuration process. However, I am having trouble with the implementation and need help writing the PowerShell script to in... | glaive |
You are tasked with writing a function to implement a file globbing functionality in a file system. Your function should take in a file system and a pattern as input, and return the names of all files matching the pattern or nil if there is no matching file. The pattern should be able to describe hierarchical names suc... | glaive |
You are tasked with creating a Python function that takes in a list of numbers and returns the sum of all the even numbers in the list.
Write a Python function called `sum_even_numbers` that takes in a list of integers and returns the sum of all the even numbers in the list.
For example:
Input: [1, 2, 3, 4, 5, 6]
Out... | glaive |
You are tasked with creating a program that retrieves data from a database using SQL queries and a Datasnap server connection. The program should be able to query for specific information related to document item view generators, stored files, and document item patterns. The SQL queries will involve retrieving data fro... | glaive |
You have been tasked with implementing a program in Scheme that can derive the derivative of a given mathematical expression with respect to a specified variable. The expression can be a sum, product, or exponentiation. Your program should be able to handle all these cases and return the derivative of the expression wi... | glaive |
You are tasked with creating a batch script that will loop through all files with the .pg extension in a directory and convert them to Spiglet format using a Java program called piglet2spiglet.jar. The batch script should then pause to allow the user to view any error messages or other output.
Write a batch script tha... | glaive |
I have the following code in a file (kernel.asm):
```
bits 32
section .text
;multiboot spec
align 4
dd 0x1BADB002 ;magic
dd 0x00 ;flags
dd - (0x1BADB002 + 0x00) ;checksum. m+f+c should be zero
global start
extern k_main ... | glaive |
You are required to create a function that will take in a reader object and convert the result into a dictionary. The function needs to handle cases where the reader has no rows, in which case it should return an empty dictionary. The function should also have the capability to handle duplicate keys, with the option to... | glaive |
You are tasked with creating a program that calculates the probability of a quantum state and then visualizes the results in a 3D plot and a contour plot. The program should use the given amplitude and probability functions, and it should use the NMaximize function to find the maximum probability within specified const... | glaive |
You are tasked with creating a Rust program that checks for the occurrence of the word "hi" within a given string. The program should emit an error if it finds the word "hi" within the string.
Create a function or macro that takes in a string as input and checks for the presence of the word "hi". If the word "hi" is f... | glaive |
I am working on a web project and I want to create a consistent and visually appealing design for my website. I have defined some CSS styles but I am encountering some issues with the color scheme and font family. I want to ensure that the headers have a bold font weight, the employee cards have no border, the backgrou... | glaive |
You are tasked with implementing a function that takes in two strings, `s` and `pattern`, and finds all occurrences of the `pattern` within `s`. Your task is to create a function `find_pattern` that returns a vector of indices where the `pattern` is found within `s`. The function should be implemented using the same fr... | glaive |
I need to write a function in a programming language that takes in a file and determines its type based on certain patterns in the file name. If the file name matches certain patterns, I want to set the type of the file to "system". Can someone help me write this function in [insert programming language]? | glaive |
I have an array in Ruby and I want to check if a specific element is present in it. The array is as follows:
```ruby
array = ['one', 'two', 'three']
```
Is there any method in Ruby that can help me find whether the element 'two' is present in the array? Thank you. | glaive |
I am working on a project and need to create a class in Cil that extends the manager class and implements the visitor interface for a given fundec. Can someone help me write the code to achieve this? I want to ensure that the class can effectively manage and count the various elements while also being able to visit and... | glaive |
You are tasked with creating a program that will find the maximum value of a given mathematical function within specific constraints. The function is defined as follows:
function[x_, y_] := $Conjugate[Exp[-15 I y] (1 (I Sin[x])^7 Cos[x]^8 + 1 (I Sin[x])^8 Cos[x]^7) + Exp[-11 I y] (33 (I Sin[x])^6 Cos[x]^9 + 33 (I Sin[x... | glaive |
You are tasked with creating a program that lists package names based on user input. The program should take a list of package names as input and then use a Runner object to scan for the names of the packages. Once the names are scanned, the program should output the count of packages found and the names of the package... | glaive |
You are working with a programming language that allows for meta-programming and theorem proving. You need to create a function that generates a congruence theorem for a given function. A congruence theorem expresses the equality of the result of a function applied to equal arguments. The theorem should be used for the... | glaive |
You are working on a project where you need to organize and manage various source files and headers in different directories. You want to create a CMake macro and functions to help with this task. Specifically, you need to:
1. Create a macro `source_group_by_folder` that groups the source files and headers by their res... | glaive |
You are tasked with creating a class in Kotlin to represent the desired capabilities for a mobile device. The class should have the following properties:
- udid: a nullable string representing the unique device identifier
- model: a nullable string representing the device model
- os: a nullable string representing the ... | glaive |
You are tasked with implementing a 3D vector class in Lua, with the following functionalities:
- Constructor overloads to create new vectors with no arguments, one argument, three arguments, a v2f and a z value, a v3f, and a v4f
- Functions to create a zero vector, a unit vector, and unit vectors along the x, y, and z... | glaive |
I have the following code:
```go
package main
import "fmt"
type Struct1 struct {
id int
name string
}
type Struct2 struct {
id int
lastname string
}
type Struct3 struct {
id int
real bool
}
func main() {
var (
s1 []Struct1
s2 []Struct2
s3 []Struct3
... | glaive |
You are tasked with creating an XSLT stylesheet that transforms an XML file into an HTML file. The HTML output should be formatted according to specific styles, including a banner, summary, and file list. Each file in the XML should have its own section in the HTML, displaying any errors found in the file. The HTML sho... | glaive |
You are tasked with creating a CUDA program to handle virtual texturing and generate mip map levels. The program is expected to have two kernels: one for rendering and another for generating the mip map levels at startup.
The rendering kernel should read from a 2D atlas texture that stores pointers to the actual textu... | glaive |
You are tasked with creating a function that takes a file path as an argument and returns the timestamp for the specified path. If the path does not exist, the function should return nothing. You should write a function that qualifies the path, checks if it exists, retrieves the timestamp, and returns the result. | glaive |
How can I establish a web socket connection using JavaScript? | glaive |
You have been tasked with implementing a kernel function for a CUDA program that will perform max similarity matrix computation. The program is designed to compute the maximum similarity between two matrices A and B and store the results in matrix C. The dimensions of matrices A, B, and C are MxK, KxN, and MxN respecti... | glaive |
I am working on a project that requires me to work with file systems in my programming language. I need to implement a set of file system operations including opening a directory, reading its contents, rewinding the directory stream, closing the directory, changing the current working directory, creating a new director... | glaive |
You are tasked with creating a styled component using the styled-components library in React. The component should be a wrapper for displaying token data, with specific styling rules. The component should contain the following:
- A div with the class "TokenDataWrapper" that has the following CSS rules:
- Display shou... | glaive |
You are tasked with creating a subroutine for reading input data in different formats for a plasma simulation program. The subroutine should be able to handle input data in raw, HDF5, and netCDF4 formats and call the appropriate input functions based on the format specified. The input function should also be able to ha... | glaive |
You are tasked with creating a class in the `org.chaosmesh.runner.config` package that fetches attack configuration from a file and returns an `SSMAttack.Companion.AttackConfiguration` object. The class should be named `AttackConfigurationFromFile` and should implement the `AttackConfigurationProvider` interface.
The ... | glaive |
How can I create an AWS Lambda function that makes an API call to a third-party service and returns the response? | glaive |
You are tasked with creating a program to read data from a file using SAS. The data in the file is structured with specific lengths, labels, and formats for each variable. Your program should be able to accurately read the data and store it according to the specified lengths and formats.
Create a SAS program that can ... | glaive |
You are tasked with implementing a functionality that allows users to edit and save blog articles using JavaScript and jQuery. You need to create three functions:
1. `addJQueryHandler`: This function should take two parameters - the ID of a button and the ID of a target element. When the button is clicked, it should t... | glaive |
You are tasked with creating a Python class that represents the options for a specific operation in a machine learning model. The class should have methods to initialize the options, retrieve the block size, and pack the options into a flatbuffer for serialization. The options should be represented as a SpaceToDepthOpt... | glaive |
You are tasked with creating a function in Zig that takes in several parameters and performs specific calculations based on these inputs. The function should calculate the total memory bytes required for various data structures, and then print out a formatted summary of this information.
The input parameters to the fu... | glaive |
I need to program a FPGA device using Quartus Prime Lite Edition version 16.1.0. I have a .sof file located at "C:/Users/barber.timothy20/Documents/Github/Quartus/Lab4/P2/" that I want to use for the programming. Can someone provide me with the necessary code to achieve this using Quartus Prime Lite Edition version 16.... | glaive |
You are tasked with creating a program that checks for multiple if statements that could be converted to a switch statement. The program should be written in Groovy and should include a class that extends `AbstractAstVisitorRule` and another class that extends `AbstractAstVisitor`. The program should check if the curre... | glaive |
You are tasked with creating a program that implements the Copy trait for a custom enum and a custom struct in Rust. The enum, called Kind, and the struct, called Color, need to have the Copy trait implemented for them. Your task is to write the code that accomplishes this. | glaive |
You are tasked with creating a verilog module for a counter with an up_counter rule that increments the counter until it reaches a value of 5 and then finishes. Additionally, the module should include two registers x and y, and two rules x2y and y2x. The x2y rule should read the value of x and write into y, while the y... | glaive |
I am trying to create, populate, and activate a python virtual environment for my project using bash scripting with pyenv. I want to automate this process by writing a bash script that can be reused for different projects. The script needs to take the virtual environment name and python version as input, create the vir... | glaive |
You are tasked with creating a web page that displays information about an Apache ActiveMQ broker. You need to create a page that includes the following details about the broker:
- Name
- Version
- ID
- Uptime
- Store percent used
- Memory percent used
- Temp percent used
Your task is to create an HTML page using Jav... | glaive |
You are tasked with implementing a CUDA C++ program that involves creating, filling, and verifying an associative data structure. The program should use the provided CUDA API wrappers and associated classes to execute various tasks. The main function of the program initializes the necessary variables and arrays, copies... | glaive |
You are tasked with implementing a function in |RedPRL| that calculates the factorial of a given number.
The function should have the following signature:
```
theorem Factorial :
(-> int int)
```
You will need to write the tactic script that constructs the program and demonstrates that it inhabits the specified ty... | glaive |
You are tasked with implementing a function that inserts records into a time series database using the Thrift protocol. The function should take in the session ID, prefix path, measurements, values, timestamp, and an optional flag indicating whether the data is aligned.
You are to create a function `insertRecordsOfOne... | glaive |
You are tasked with creating an XSLT transformation to process XML data for displaying machine information. The XML data includes elements such as Name, Comment, major and minor attributes, and various FlagsList elements. Your task is to create an XSLT template that will extract and format the machine information accor... | glaive |
You are tasked with creating an XSLT transformation that maps specific elements from a source XML to a target XML. The source XML contains elements with the namespace "leg" and the target XML contains elements with the namespace "primlawhist". Your task is to create the XSLT templates that will transform the source ele... | glaive |
You are tasked with creating a Go program that handles server responses for different HTTP status codes. Your program should include a reader for the PostIPAMIpnat structure, which reads the server response and returns the appropriate result based on the HTTP status code. The program should handle cases for status code... | glaive |
I am working on a music database project and I need to create tables to store information about artists, labels, releases, tracks, and masters. The tables should include fields for various attributes such as id, name, realname, urls, genres, styles, and more. I need to ensure that the tables are properly set up and tha... | glaive |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.