instruction_seed
stringlengths
29
40.5k
source
stringclasses
6 values
I need to calculate the area of a triangle given its three sides. Can anyone provide a solution in Python?
glaive
How can I create a Python program that extracts the sender's email address from an email message?
glaive
I want to add a new feature to my Java program. How can I update it to include a user input feature that asks for a string and prints it out?
glaive
You are tasked with creating a program that sets up a Kubernetes client and initializes various controllers and informers for a system. The program should be able to handle signals for graceful shutdown and dynamically update logging levels and metrics exporter based on the configuration map. Additionally, the program ...
glaive
I want to create a module in Node.js to handle SMTP configurations, verification code settings, and JWT token configurations. The module should have the following structure: - SMTP configuration should include service, user, password, and mailer settings. - Verification code settings should include the number of digits...
glaive
You are tasked with creating a function in Kotlin that takes in two optional parameters - credentials and region, and returns a DatabaseConnectionInterceptor.ProtoConnection object. The function should mimic the behavior of the buildConnection function in the given code snippet, which creates a mock DatabaseConnectionI...
glaive
You are tasked with creating a program that generates a sprite sheet for use in a game development project. The sprite sheet should consist of multiple frames, each containing one or more images arranged in layers. The program should be able to define the dimensions of the sprite sheet, the number of frames, and the pr...
glaive
I am trying to implement a function that evaluates a given value within a scope and returns a Result containing either the resulting value and a list of side effects, or an EvalError. The function needs to handle different types of values and expressions, and should be able to call native functions as well as user-defi...
glaive
Given a text sequence, I want to extract the last three words from the sequence using a fixed pattern, specifically a regular expression. How can I achieve this in Python? ```python text = "我的名字是比爾·蓋茨" # Code to extract the last three words from the text ```
glaive
You are tasked with creating a command file for Sphinx documentation. The command file should be able to take in different targets and execute the corresponding actions for each target. The targets include making standalone HTML files, making HTML files named index.html in directories, making a single large HTML file, ...
glaive
You are tasked with creating a function that takes in a function and a list, and returns a string. The function should apply the given function to each element in the list and concatenate the results into a single string. Implement the function `stringOfList` to achieve this functionality.
glaive
I need to create a progress bar in a batch script that updates as different tasks are completed. The progress bar should display the percentage of completion and a custom text message. The progress bar should be able to handle different values and texts for each task, and should be able to update dynamically.
glaive
I need to write a CMake script to clean up specific files and directories in my project. The script should be able to remove a specific file or a directory and all its contents. I want to be able to run this script as part of the project build process to ensure that unnecessary files and directories are removed.
glaive
You are tasked with creating a function in Emacs Lisp that takes in a list of colors and their corresponding hexadecimal codes, and sets these colors as the custom faces in the Emacs theme. The function should be able to handle multiple color-face pairs and update the custom-set-faces variable accordingly. Write a fun...
glaive
You are tasked with creating a function in R that draws a polygon using the given data points on the x and y axes. The function should accept the following arguments: - x: Data points on the x-axis - y: Data points on the y-axis - sector.index: Index for the sector - track.index: Index for the track - ...: Additional p...
glaive
I am trying to create a website with different sections, each with a unique background image and specific styling. I want to ensure that the website is responsive and looks good on different screen sizes and orientations. Can someone help me write the CSS code to achieve this?
glaive
I am trying to create a webpage that displays top news articles and their sources. I want to style the page using CSS to make it visually appealing. Can someone help me write the CSS code to achieve the following: - Set the background color of the body to grey - Style the h2 elements inside the body to have a font size...
glaive
How can I create a URL pattern and view in Django that allows optional parameters? I've been able to do this but it seems to break the URL template tag. Here is what I have currently: Pattern: ```python (r'^so/(?P<required>\d+)/?(?P<optional>(.*))?/$', 'myapp.so') ``` View: ```python def so(request, required, optio...
glaive
I am trying to call a public function located inside a Rust struct's impl block from a C program using the FFI. I have been able to call regular pub fns without any issues, but I'm struggling to call a pub fn from within a struct's impl block. Can someone please help me understand how to expose and call this function c...
glaive
You are tasked with creating a Mathematica notebook that includes various sections such as History, Categorization, Keywords, Syntax Templates, Object Name, Usage, Notes, Tech Notes, Related Demonstrations, Related Links, See Also, Related Guides, Examples, and More Examples. Each section should have specific content a...
glaive
You are tasked with creating a mapping system for modules in a programming language. Modules are represented by their names and package keys. The mapping system should allow for easy lookup, insertion, deletion, and manipulation of modules and their corresponding file paths. Create a module that includes the following...
glaive
You are tasked with creating a Clojure program that takes in a text file called "input.txt" and processes it to solve the following problem: You are given a list of numbers in the "input.txt" file. Each number represents a node in a tree structure. The first number is the number of child nodes, the second number is th...
glaive
Is there a way to generate cmov instructions in my code using Microsoft's 32-bit C/C++ compiler? I have written a code that takes a string as input, applies some shift operations to generate a random seed, and then passes that seed to srand to generate pseudorandom numbers. The pseudorandom numbers are then evaluated u...
glaive
I am trying to implement a low-level system call in my project using the Zig programming language. I need to write a function that makes a system call with zero arguments, but I am not sure how to properly implement it. Can someone provide me with a function definition and implementation that correctly makes a system c...
glaive
You are tasked with implementing a scoreboard class in a SystemVerilog environment. The scoreboard should be able to handle communication between TLM agents and local queues to hold incoming packets pending comparison. The scoreboard should also have the capability to process different types of responses and perform va...
glaive
How can I write a Java program that takes a list of strings and returns a single string containing all the strings joined together with a space in between?
glaive
You are tasked with implementing a function to load images asynchronously. The function should read a list of image files and return the images as a cell array in MATLAB. The function should also have the ability to resize the images as per the specified dimensions. The function will be used as a part of a larger image...
glaive
You are tasked with implementing a module for the Xilinx CORDIC LogiCORE, which is used for the generation of the generalized coordinate rotational digital computer (CORDIC) algorithm. The core iteratively solves trigonometric, hyperbolic, and square root equations and has AXI4 Stream compliant interfaces. Your task is...
glaive
You are tasked with creating a Java program that demonstrates operator priority and automatic casting in string concatenation. Your program should include the following requirements: - Demonstrate the automatic cast from int to string by concatenating an integer with a string. - Show the difference in output between ad...
glaive
I am trying to implement a feature in my React application where I need to create a page for displaying endpoint documentation. The page should display information about the endpoint such as its purpose, method, full path, description, path parameters, query parameters, request body, and response body. Additionally, th...
glaive
You are tasked with creating a function in C++ that fills an array with random values. The function should take in the array pointer, the width and height of the array, as well as the minimum and maximum values for the random range. Additionally, the function should have an optional seed parameter for generating the ra...
glaive
You are tasked with implementing a class called TAdvItemList which represents a collection of items. This class should have the following functionalities: 1. Ability to compare items in the list using a custom comparison function. 2. Allow or prevent duplicates in the list. 3. Option to sort the items in ascending or d...
glaive
You are tasked with implementing a one-dimensional Fast Fourier Transform (FFT) using the FBFFT library in CUDA. The goal is to efficiently compute the FFT of a batch of input signals. The input consists of two DeviceTensor objects: real and complex, with dimensions specified by the template parameter BatchDims. The re...
glaive
You have been tasked with creating a Dockerfile to set up an environment for a Go application. The Docker image should be based on the balenalib/i386-ubuntu:xenial-build image and should include Go version 1.17.11. Additionally, you need to fetch a test script from a GitHub repository and run it to ensure the environme...
glaive
How can I develop a Python program to process a PDF document?
glaive
I am trying to create a module that combines two servers, a DiadicFloatServer and a DiadicPairedSingleServer, to handle requests for floating-point numbers and paired single floating-point numbers. The module should take in a request, process it using the appropriate server, and then enqueue the response into the corre...
glaive
You are tasked with creating a shader for a 3D surface using the EasyRoads3D framework. The shader should have a main color property and use the Lambert lighting model. Additionally, it should have a main texture and an alpha channel. Write a shader program that meets these requirements.
glaive
I am working on a legacy routing service using Clojure and Trapperkeeper and need to build a ring handler to handle requests. The handler needs to include middleware for authorization and request metrics, as well as route metadata. Additionally, the service should be able to handle requests for a certificate authority ...
glaive
You are tasked with creating a program that utilizes the GEHtmlStringBalloon class to display a customizable HTML string balloon in a web page. The program should allow users to set the content of the balloon and customize its appearance by changing the background color, foreground color, and enabling/disabling the clo...
glaive
You are working on a social science research project and need to access specific information from Wikipedia using the MediaWiki Action API. You want to obtain information about a specific Wikipedia page, such as the URL or metadata, and use the data for your analysis. Write a Python program that makes a simple API call...
glaive
You are tasked with creating an SVG animation of a dotted line using Elm programming language. The animation should have a stroke color of #8a4baf, a stroke width of 3, a stroke line cap of round, and a stroke dash array of 0.5 10. The animation should be set to run infinitely with a duration of 400ms. You need to impl...
glaive
You are tasked with creating a form using Java Server Pages (JSP) for editing order information. The form should have fields for the order ID and the ID of the corresponding document. Additionally, the form should have buttons for saving and canceling the editing action. Write the JSP code for the form, including the ...
glaive
You are tasked with creating a Python script that sets up common configurations for a package. The script should define global variables for different directories and set an environment variable. Specifically, the script should define the following variables: - SRC_DIR: absolute path of the directory containing the scr...
glaive
You are tasked with creating a program that handles different types of column data in a database. The program should be able to define and handle various core column types such as Boolean, Guid, String, Integer, Float, Decimal, Binary, DateTime, DateTimeOffset, and others. Additionally, the program should be able to ha...
glaive
I am working on a project and need to write a program to remove specific files and directories in my C++ project. I want to clean up certain files and directories as part of my build process. Can someone provide a solution using CMake to remove specific files and directories recursively?
glaive
You have been tasked with creating a program to manage access bindings for different resources within a cloud environment. Your program needs to be able to list access bindings for a specific resource, set access bindings for a resource, and update access bindings for a resource. Access bindings consist of a role ID an...
glaive
You are tasked with implementing a debug module (DM) in SystemVerilog. The module should be an AXI-Slave and should be able to communicate with physically available harts for systems that don't use hart numbers in a contiguous fashion. The module should also be compatible with the SiFives debug protocol to leverage sof...
glaive
I am working on a healthcare application using Ruby on Rails and I need to add a new column to the patients table in my database. I want to create a column called severe_symptom_onset to track the date when a patient experiences severe symptoms. How can I create a migration to add this new column to the patients table ...
glaive
You are tasked with creating a Ruby class for managing different character classes in a role-playing game. The class should have the following attributes: name, hit_die, proficiencies, subclasses, saving_throws, skills, and klass. Additionally, the class should have a class variable @@all to keep track of all the insta...
glaive
I am working on a project that involves managing lists of users in different spaces. I need to create a module in Elm called SpaceUserLists that will allow me to initialize a new SpaceUserLists, set a list of user ids for a specific space, and resolve the list of users for a given space. The module should use Dict for ...
glaive
How can I create a Node.js program that connects to a PostgreSQL database?
glaive
You are tasked with creating a PHP script to handle the addition of teacher salary information into a database. The script should take input data from a form and process it to insert the salary details into the database. The input fields include index number, teacher ID, type, amount, page, invoice number, and other re...
glaive
You are required to create a program to manage firewall groups and rules on a server. The program should be able to perform the following operations: 1. Create a new firewall group with a description. 2. Delete an existing firewall group by its ID. 3. Update the description of an existing firewall group. 4. Retrieve a...
glaive
You are tasked with creating a React component that displays a grid of food items, with the ability to filter and paginate the results. The component should make use of Bootstrap and Material UI for styling and layout. The component should fetch data from an API and display the food items with their respective images, ...
glaive
You are tasked with defining an interface and implementation for the 'P2 Core' for the DARPA SSITH project. The P2 core contains a Flute CPU, including Near_Mem (ICache and DCache), Near_Mem_IO (Timer, Software-interrupt, and other mem-mapped-locations), External interrupt request lines, and 2 x AXI4 Master interfaces ...
glaive
How can an AI generate code for a sorting algorithm?
glaive
You need to create a set of functions for accessing and updating records in a generic manner. The basic functions should be (mget a r) and (mset a v r) where a is an address/key, v is a value, r is a record, and (mget a r) returns the value set to address a in record r, and (mset a v r) returns a new record with addres...
glaive
You are tasked with implementing a SystemVerilog module that includes various input and output wires, as well as instantiating three different blackbox modules. The module must handle the passing of signals and data between the various input and output ports, as well as correctly interfacing with the instantiated black...
glaive
You are tasked with writing a program in the Source7 programming language that takes two integer inputs, adds them together, and then outputs the result.
glaive
You are tasked with defining a function `s` in the programming language with the following characteristics: - The function takes two arguments, a and b, both of type num. - The function should only accept positive numbers as input. - The function should return the value of a raised to the power of b plus the value of b...
glaive
You are tasked with implementing a program that generates a sequence of numbers based on the following formula: a(n) = (8*2^n-5*(-1)^n)/3. Your program should take an input n and return the nth number in the sequence. For example, when n=1, the output should be 1. When n=2, the output should be 7. When n=3, the outpu...
glaive
You are tasked with creating a React component that displays a list of files with a certain point value. The component should listen for changes in the files and update the list accordingly. Additionally, the component should respond to keyboard events and adjust the point value based on the key pressed (up arrow key s...
glaive
You are tasked with implementing a wavelet tree test using the nvbio library. The goal is to build a wavelet tree from a given input text, extract the text from the wavelet tree, and perform ranking tests against known results. The test involves the following steps: 1. Generate a random input text of a specified lengt...
glaive
You are tasked with creating a program that manages a collection of templates. Each template is represented as a string and needs to be stored in an ordered collection. If the collection of templates is not already initialized, it should be created with a capacity of 20. You need to implement a method that allows for a...
glaive
You are tasked with creating a microservice in R using the `devtools` library and the `fdrtd` package. The microservice should have an API endpoint that accepts a `compute` request, which performs a secure sum operation on a given input. The input to the `compute` request should include the microprotocol "SecureSum", t...
glaive
How can an AI design a command-line interface in Python to accept user input?
glaive
You are working on a project that requires you to set up environment variables for different architectures and platforms. You need to write a script to export the necessary environment variables based on the target architecture and platform. Write a bash script that takes the target architecture and platform as input...
glaive
Can someone help me optimize this code to reduce its runtime complexity?
glaive
I am working on a project that involves creating different types of data sinks for a distributed computing system. I need to implement a new type of data sink called TKuduTableSink, which encapsulates specific options passed down to the KuduTableSink. The TKuduTableSink should have the following features: - It should h...
glaive
How can I check if a linked list contains a cycle using C programming?
glaive
You are tasked with creating a database schema and table to store various datatypes for a date/time conversion application. The table, datatype_source, should include columns for various datatypes such as boolean, integer, decimal, numeric, double, float, real, char, varchar, varbinary, time, date, and timestamp. Addit...
glaive
I am trying to implement type checking for a simply-typed λ calculus in a functional programming language. I have defined the type system using some custom data types, including `ty`, `ty_opt`, `env`, and `expr`. The type system includes natural numbers, arrows, and constants, and the environment includes a list of typ...
glaive
You are tasked with creating a Verilog module that interfaces with a Si570 wrapper and implements the following interfaces: - Si570wrapI2c - Si570wrapIfreq - Si570wrapIstart - Si570wrapOcontroller - Si570wrapOread - Si570wrapOsi570 Your module should include the necessary clock and reset interfaces and should adhere t...
glaive
You are tasked with implementing a program in Stan that models a harmonic oscillator using the Ordinary Differential Equations (ODE) solver. The program should include the ODE function, data, parameters, transformed parameters, and model sections following the given structure. Your task is to write the Stan program to ...
glaive
I am currently implementing the Mergesort algorithm and I noticed that there are multiple calls to the `len()` method to get the length of arrays/slices. I am wondering if these multiple calls to `len()` can impact the performance of the algorithm negatively. Should I create temporary variables to store the length of t...
glaive
You are tasked with creating a Common Lisp package that provides functionality for managing a queue system. The package should include functions for creating a queue, adding items to the queue, removing items from the queue, and checking the size of the queue. Your task is to create a package named "queue-manager" and...
glaive
I am working with Terraform to manage my infrastructure, and I need to create a script to automate the process of initializing and validating my Terraform configuration. Can someone provide a PowerShell script that navigates to a specific directory, removes a certain folder, initializes Terraform, and then validates th...
glaive
You are tasked with creating a program called "ComiCal" that tracks the publish dates of your favorite comics. The program should be written in LaTeX using the Noweb package. The program should allow users to input the details of their favorite comics and display a calendar with the publish dates. Write a program tha...
glaive
How can I design and implement a Least Recently Used (LRU) cache mechanism in Java? I want to use Java's built-in data structures and ensure that the cache follows LRU policy. Can you provide an example solution that showcases core principles, best industry practices, and appropriate data structures and algorithms?
glaive
You are tasked with creating a class that represents a serializable response with the following properties: - IsSuccessful: a boolean indicating whether the response was successful - Detail: a string providing additional details about the response - Instance: a URI indicating the specific instance of the response - St...
glaive
I am trying to create a lexer for Groovy source code using Common Lisp. I need to define the rules for parsing the source code and highlighting different elements such as keywords, comments, strings, and numbers. Can someone provide an implementation for the lexer using the Common Lisp regex-lexer library?
glaive
You are tasked with creating an XSLT stylesheet to transform an XML input into a specific SOAP response format. Your input XML will have a structure and your XSLT stylesheet should transform it into a SOAP response with a specific envelope, header, and body structure. The XSLT should use namespaces and output the trans...
glaive
Can you provide an Objective-C program that generates all possible combinations of a given list of strings?
glaive
You are working on a project that involves handling images in Lisp using the `movitz` package. Your task is to create a new class `custom-image` that inherits from the `procfs-image` class. The `custom-image` class should have an additional slot `custom-data` to store custom image data. You need to write a macro `with-...
glaive
You are tasked with creating a program that defines a custom type for different query conditions in a search engine. The conditions include "queryShould", "queryMust", and "queryMustNot". You need to implement a function that converts a given condition type to its corresponding string representation. The function shoul...
glaive
You are tasked with creating a program that converts an UnblindedOutput object into a grpc::UnblindedOutput object and vice versa. The UnblindedOutput struct has several fields, including value, spending_key, features, script, input_data, script_private_key, sender_offset_public_key, metadata_signature, script_lock_hei...
glaive
You are tasked with writing a CMake script that will remove specific files and directories from a project. The files and directories to be removed are as follows: - "CMakeFiles/pch_Generate_opencv_dpm" - "precomp.hpp.gch/opencv_dpm_RELEASE.gch" - "precomp.hpp" Write a CMake script that will remove these files and dire...
glaive
How can I create a JavaScript program that checks if two strings have the same characters in the same frequency?
glaive
You are tasked with creating 10 benchmark problem data sets using SAS programming language. Each data set should be created from a specific CSV file, with the data being read in and stored appropriately. The data sets should be named as follows: Banana, BreastCancer, Diabetes, German, Image, Ringnorm, Splice, Thyroid, ...
glaive
You are tasked with implementing a CUDA-based lighting system for a 3D rendering application. The system should support different types of light sources, including point lights, directional lights, triangle lights, and environment lights. Each type of light source has specific characteristics and functions to calculate...
glaive
I have a dataset and I need to generate an appropriate XML schema for it. Can someone help me with this?
glaive
You are tasked with creating a menu system for a restaurant application. The menu system should allow the restaurant to display different categories of food items (e.g., appetizers, main courses, desserts) and their respective prices. The system should also allow for the addition, removal, and updating of menu items. ...
glaive
You are tasked with creating a Docker container for a SQL Server 2019 installation. Your container should be able to run SQL Server 2019 and provide a bash shell for users to interact with the SQL Server instance. Create a Dockerfile with the necessary instructions to set up the SQL Server 2019 installation within a D...
glaive
Can you provide a function that can analyze a given text and identify any palindromic words present in it?
glaive
You are tasked with creating a program that parses through a given document and counts the number of times each word appears. The program should ignore any punctuation and consider words with different capitalizations as the same word. Write a function or method that takes in a string as input and returns a dictionar...
glaive
You are tasked with implementing a protocol for registering, retrieving, and shutting down services in a distributed system. The protocol involves defining message structures for service registration, service retrieval, and service shutdown. Your task is to define the message structures using the given framework and ...
glaive
You are tasked with creating a smart contract function that checks the conditions for liquidation with the oracle. The function should determine whether a loan position meets the conditions for liquidation and return a boolean value indicating whether liquidation should occur. The function should take the following pa...
glaive
You are tasked with implementing a function in Go that can add a string to a list and another function that can remove a string from a list. The list is represented as a custom data structure `List`, and the strings are represented as a custom data structure `String`. The `AddStringToList` function should take a pointe...
glaive
You are tasked with creating a program that evaluates the validity of certain logical formulas in a class of models. The program should be able to determine if a given formula is true in every model in a specified class, i.e., true at every world in every model in the class. You need to implement the logic for determin...
glaive
I am working on a project that involves extracting information about the number of pages from a bibliographic ontology (bibo). I need to write a SPARQL query to construct a new triple that includes the number of pages for a given resource URI. Can someone provide a SPARQL query that constructs a new triple with the num...
glaive