instruction_seed
stringlengths
29
40.5k
source
stringclasses
6 values
You are tasked with creating a CMake macro to find the Intel Math Kernel Library (MKL) libraries and include them in a project. The macro should be able to locate required and optional MKL components, handle standard paths, and create an imported target for the MKL libraries. Create a CMake macro called heffte_find_mk...
glaive
You are tasked with implementing a ring-communication algorithm without deadlock using MPI in Fortran. The goal is to ensure that data is passed around in a ring, with each process sending data to its neighbor and receiving data from its other neighbor. The program should be able to handle a specified number of MPI pro...
glaive
How can I design a RESTful API endpoint for managing user information in a system of a large distributed web application? The API should be able to handle high concurrent connections gracefully and have good fault tolerance, load balancing, and exponential backoff capabilities. Considering security, how can I ensure th...
glaive
I want to create a program to manage a school's student information. The program should allow users to add new students, delete existing students, and update student information. It should also be able to display a list of all students currently enrolled in the school. Can someone provide me with a complete code soluti...
glaive
You are working with a Rust project that involves managing build steps. You need to create a structure to hold details about each build step, including the duration in milliseconds, a unique identifier for the step, and the start time in UTC. Create a Rust struct called StepInfo with the following fields: - duration_m...
glaive
You are tasked with creating a room in a game development environment using GameMaker Studio. The room should have specific settings, including width, height, and whether it is persistent. Additionally, the room should have view settings, such as enabling views and clearing the display buffer. Your task is to write the...
glaive
You are tasked with creating an iterator over words in a byte string. This iterator should only return elements that contain a "word" character, defined by UTS #18 (Annex C) to be the combination of the `Alphabetic` and `Join_Control` properties, along with the `Decimal_Number`, `Mark`, and `Connector_Punctuation` gene...
glaive
You are working on an Erlang project named cowboy_metrics and need to include the ability to compile MIB files before anything else. The MIB files are located in the mibs directory and need to be compiled into binary files in the priv/mibs directory. Additionally, the compiled MIB files need to have header files genera...
glaive
You are tasked with creating a golang program that implements a WebSocket server using the `fasthttp` library. The program should have two main sections: user documentation and reference documentation, each with their own set of sub-sections. The user documentation should include the following sub-sections: "getting_st...
glaive
You are tasked with writing a CMake script to remove a specific file or directory from the file system using the FILE command. The file or directory to be removed is located at the path "../../lib/x86/libopencv_core_pch_dephelp.a". Your task is to write the necessary CMake commands to remove this file from the file sys...
glaive
You are tasked with creating a function in Clojure that works with the given Thrift service `TelephoneBook` to store and retrieve person information. The function `storePerson` should take a map with a `name` key and store the person in the telephone book, throwing a `StorageError` if the last name is "Two". The `findB...
glaive
You are tasked with creating a browser-based prototyping and project management tool for visual novel and graphic novel creators. The tool should satisfy the following use cases: 1. Allow creators to focus on creating content and handle the burden of asset management automatically and faultlessly. 2. Enable fast proto...
glaive
I am trying to create a tray icon in a Windows application using Common Lisp. I want to define a class `tray-icon` with the following properties: - `id` (unsigned 32-bit integer) for identifying the icon - `tooltip` (string) for displaying a tooltip when the icon is hovered over - `icon` (any type) for the actual icon ...
glaive
Can you provide a code snippet that modifies existing code to print the area and circumference of a circle with two decimal places?
glaive
You are working on a Django web application and you need to implement a custom middleware that logs the time it takes for each request to be processed. This middleware should log the request path, request method, and the time taken to process the request in milliseconds. Write a custom middleware class in Django that ...
glaive
You are tasked with implementing a function in Julia that takes in two arguments and two keyword arguments, and returns the sum of the products of the arguments and keyword arguments. The function should handle both integer and string inputs, converting strings to integers if necessary. If a keyword argument is not pro...
glaive
I'm trying to implement a solution for the graph coloring problem using constraint propagation in Python. However, I'm encountering a RuntimeError: "Set changed size during iteration". The error occurs when I iterate over a set of possible values for each vertex and update this set within the loop. Is there a way to mo...
glaive
You need to implement a Leap-Frog integrator using CUDA for a molecular simulation package. The code is responsible for initializing classes, managing data structures, and implementing a GPU kernel. The main kernel for the Leap-Frog integrator is provided, which works with a single particle per GPU thread. You are tas...
glaive
I am working on a Perl module where I need to join multiple split files based on a specific file type. The split files have a naming convention of "file_name-seq_region_id_start_end.file_type". I need to join these split files into a single file based on the seq_region_id. The data for the split files is obtained from ...
glaive
I have a form_for written in the following manner: ```ruby <div class="field"> <%= location.label :city %> <%= location.text_field :city, :disabled=>true%> </div> <div class="field"> <%= location.label :country %> <%= location.text_field :country, :disabled=>true%> </div> ``` As you can see the 2 text...
glaive
You are tasked with creating a Gradle task to notarize a macOS app zip file for distribution on the App Store. The task should check for the presence of the necessary parameters such as appstore username, password, and asc-provider, and throw an error if any of these are missing. Additionally, the task should use the `...
glaive
I am working on a database project and need to add a foreign key constraint to a table. Specifically, I need to add a constraint named AFW_01_CONFG_EVENM_NOTFB_FK4 to the table AFW_01_CONFG_EVENM_NOTFB, with the foreign key referencing the column REF_COMPT_TWILI in the table AFW_17_COMPT_TWILI. The foreign key constrai...
glaive
I am trying to render to a texture in iOS with multisampling enabled and then use that texture in my final output. Is this possible? So far, I have only been getting black textures or aliased images. Here's the code I am using: ```cpp glGenTextures(1, &texture); glBindTexture(GL_TEXTURE_2D, texture); glTexImage2D(GL_...
glaive
You are tasked with creating a program that simulates a spinlock mechanism. A spinlock is a lock that causes a thread trying to acquire it to simply wait in a loop ("spin") while repeatedly checking if the lock is available. This can be used in situations where the time the lock is held is expected to be very short and...
glaive
I am trying to create a table to store page hits for my API, but I am having trouble with the SQL code. I want to create a table called pagehits with columns for URL and hits, where URL is the primary key and hits has a default value of 0. Additionally, I want to grant privileges on this table to specific users. Can so...
glaive
You are tasked with creating a program that simulates the process of rebalancing replicas and leaders for a Kafka topic using a user interface. The program should perform the following steps: - Create a new topic with specific properties such as name, number of partitions, and replication factor. - Assign replicas to d...
glaive
I am trying to implement a circular mean of phase difference in my programming project, but I am struggling to create the necessary functions for this calculation. I need to be able to calculate the circular mean of the phase difference for a given input matrix. The circular mean of phase difference is a statistical me...
glaive
You are tasked with creating a synthesis run script using Vivado for a digital design project. The script should include the necessary commands to create an in-memory project, set project parameters, add source files, run synthesis, and generate synthesis reports. The script should also handle error checking and report...
glaive
I need to create a macro in SAS that will loop over one or more arrays of macro variables and substitute their values into a given phrase or macro. The macro should have the following parameters: - ARRAYPOS or ARRAY: Identifier(s) for the macro array(s) to iterate over. Up to 9 array names are allowed. If multiple macr...
glaive
You are tasked with creating a function in Lua which takes in a character's role and class and returns a gear set for that character. The gear set should include items for the head, shoulders, back, chest, wrist, hands, waist, legs, feet, neck, rings, trinkets, 2-handed weapon, and ranged weapon. Additionally, the func...
glaive
What is a solution to generate a multiplication table using JavaScript?
glaive
You are tasked with implementing a register file in VHDL using the given entity and architecture framework. The register file has 16 registers, each storing a 32-bit vector. The entity Regfile has input ports for Data_In, Addrs_In, Addrs1_Out, Addrs2_Out, Wr_En, and Clk. It also has output ports for Data1_Out and Data2...
glaive
As a beginner in CUDA programming, I'm curious about how the performance of pyCUDA compares to programs implemented in plain C. Can I expect similar performance levels? Are there certain potential bottlenecks I need to be mindful of? Also, I've tried searching for this information online but couldn't find much on this ...
glaive
You are tasked with creating a Kotlin class for a new item in a game. The item is called "Handguards of the Templar" and has the following specifications: - Item level: 128 - Quality: 4 (epic) - Icon: "inv_gauntlets_67.jpg" - Inventory slot: 10 (hands) - Item class: Armor - Item subclass: Plate - Allowable classes: War...
glaive
I have a Python code that needs modification and optimization. The current code is causing errors and I want to make it error-free and functional. Additionally, I would like to modify the code to accept multiple data entries. Can you help me with this? Here is the code I have: ```python import json data = [ { "...
glaive
You are tasked with creating a CUDA program to measure the maximum read bandwidth of L1 cache for 64-bit read. The code will be tested on the Volta V100 architecture. You will need to define the necessary variables, allocate memory, and write a CUDA kernel to measure the shared memory bandwidth.
glaive
You are tasked with creating a program that models a game object in GameMaker. The object should have the following properties: - Name: obj_icon_chop - Parent Object: b3955680-9357-4815-8c93-ce9734a607b9 - Not persistent - Physics properties: - Angular Damping: 0.1 - Density: 0.5 - Friction: 0.2 - Linear Dampin...
glaive
You are tasked with creating a program to handle the eventList for a GMObject in a gaming system. The GMObject has a modelName, mvc version, name, eventList, maskSpriteId, parentObjectId, persistent, and various physics properties. The eventList contains multiple GMEvents, each with an id, modelName, mvc version, IsDnD...
glaive
I am trying to overlay text on an image using the OpenCV2 library in Python. The code I am using is: ```python cv2.putText(image,"Hello World!!!", (x,y), cv2.CV_FONT_HERSHEY_SIMPLEX, 2, 255) ``` However, I am getting an error that says 'module' object has no attribute 'CV_FONT_HERSHEY_SIMPLEX'. I'm not sure if I can ...
glaive
You are tasked with creating a TypeScript module that exports various serialization and deserialization functions for a custom data format. The module should include types, serializers, and deserializers for the given data format, as well as for a separate standard library and the Binary Canonical Serialization (BCS) f...
glaive
You are tasked with creating a script in bash that will iterate through all directories and subdirectories to find any files ending in `_test.go`. For each directory containing such files, the script should run a test coverage analysis using `go test` and produce a coverage profile. If the test does not fail, the scrip...
glaive
You are tasked with building a makefile system for a project. The makefile system needs to handle dependency tracking, build output directories, and compiler flags. The makefile needs to support building C, C++, and Objective-C source files. Additionally, it needs to handle the regeneration of makefiles when certain fi...
glaive
I am trying to find and configure the Google Protocol Buffers library in my CMake project. I need to define the following variables: - PROTOBUF_FOUND - Found the Google Protocol Buffers library - PROTOBUF_INCLUDE_DIRS - Include directories for Google Protocol Buffers - PROTOBUF_LIBRARIES - The protobuf library I also ...
glaive
You are tasked with implementing a set of methods for the String class that returns specific subsets of characters from the string. You should define the following methods: 1. `at(position)`: Returns the character at the specified position in the string. 2. `from(position)`: Returns the remaining substring from the sp...
glaive
You are tasked with creating a program that manages a library of books. The program should allow users to add new books to the library, remove books, search for books by title, author, or genre, and display a list of all the books in the library. Each book should have attributes such as title, author, genre, and public...
glaive
<p>I've noticed that as my app gets more complex, migrations can become slow and cumbersome. However, I've also discovered that I can use the <code>rake db:schema:load</code> command instead, which seems cleaner and faster. So, why do migrations exist at all?</p> <p>Additionally, if migrations are primarily used for ve...
glaive
You are tasked with writing a batch script to download a zip file from a specific URL and unzip it using the Windows cmd. The script should also delete the temporary zip file after extracting its contents. Your batch script should include the following steps: 1. Set the variables for the path to the unzip executable a...
glaive
I am trying to work with external libraries in my C++ project, and I need to include the libraries QUICKCPPLIB and OPTIONAL in my code. I have the references and SHA512 hashes for both libraries, but I am not sure how to properly include them in my project. Can someone provide me with a step-by-step guide on how to inc...
glaive
You are tasked with creating a CMake module for a minimal crypto library called Mine. Your goal is to define the ${MINE_CRYPTO_INCLUDE_DIR} variable and search for static or shared libraries based on the value of ${MINE_CRYPTO_USE_STATIC_LIBS}. If ${MINE_CRYPTO_USE_STATIC_LIBS} is ON, you should search for static libra...
glaive
You are tasked with creating a program in Kotlin that provides a schema file for a given ALIYUN API action. The program should take a host and action name as input and return the corresponding JSON schema file. If the schema file does not exist, the program should generate it and store it for future use.
glaive
You are tasked with creating a set of rules for a RuleEngine in the Kotlin programming language. The rules will be used to handle key presses and requests in a game. The rules will perform various actions such as maintaining key presses, deleting requests, inserting new requests, and reacting to specific requests. You...
glaive
I've been searching for a solution to my problem for hours, but I can't seem to find one. I need a function that can insert a row into one table, retrieve the auto-increment value from that row, and then use that value to insert another row into a different table. Here's an example of what I'm trying to achieve in PHP:...
glaive
How can I create an editable table in HTML with three columns - Name, Email, and Phone?
glaive
I am using Pandas' pd.cut() function to categorize the 'days' column of my DataFrame into ranges. My data is as follows: ```python test = pd.DataFrame({'days': [0,31,45]}) test['range'] = pd.cut(test.days, [0,30,60]) ``` However, the output I am getting is not as expected: ```python days range 0 0 NaN...
glaive
You are tasked with solving the Allen-Cahn equation using a fractional step method. The equation is a scalar reaction-diffusion equation, and the initial data is given by a step function. The goal is to implement a numerical method to approximate the solution to the Allen-Cahn equation. The method should involve taking...
glaive
You are tasked with creating an informer for a custom resource type called SsmPatchBaseline in a Kubernetes cluster using Go. The informer should provide access to a shared informer and lister for SsmPatchBaselines. The informer should be constructed in a way that reduces memory footprint and the number of connections ...
glaive
I am working on a Python project and I need to create a virtual environment to manage my dependencies. However, I am not sure how to set up the virtual environment and activate it. Can someone provide a Python script that sets up a virtual environment and activates it?
glaive
I am analyzing the following code snippet and I would like to optimize it. The code is a function called `print_n_stars` that takes an integer `n` as input. It then uses a loop to print `n` lines, where each line consists of `n` asterisks. Can you provide an optimized solution for this problem?
glaive
I need to create a SPARQL query to retrieve all the triples in a given RDF graph that have a specific predicate. The graph is represented using the Turtle serialization format. Can someone provide me with a SPARQL query that accomplishes this?
glaive
Can you provide an example of an API design in Java that can return the top N most frequently used words in a given text?
glaive
You have been tasked with creating a class that will help in generating control results for different types of scans performed on a remote server. The class should be able to categorize the scans as either related to subscriptions or services and determine the kind of scan being performed based on the parameters provid...
glaive
You are tasked with creating a program to handle log entries for a service control system. The program should be able to create individual log entries with specific attributes such as name, timestamp, severity, insert ID, labels, and payload. The payload can be of different types including a protocol buffer, a Unicode ...
glaive
You are tasked with implementing a function to calculate the value of $-\sin^2(\Arccot x)$ for a given input $x$. The function should take in a single parameter $x$, and return the calculated value. You must ensure that the function follows the algebraic steps outlined in the solution to express $-\sin^2(\Arccot x)$ as...
glaive
You are tasked with creating a program that handles the mounting and unmounting of SMB volumes on different operating systems. The program should be able to check if the volume is already mounted, mount it if it is not, and unmount it when necessary. Additionally, the program should be able to check the health of the s...
glaive
You are tasked with creating a custom web component called "lrnsys-layout" that should pass accessibility tests, support custom properties, and be responsive for both mobile and desktop views. The component should be tested using the @open-wc/testing library to ensure its functionality and behavior. Create the "lrnsys...
glaive
You are tasked with creating a program that calculates the maximum probability of a quantum state in a specific quantum system and then visualizing the probability distribution in a 3D plot and a contour plot. The quantum system is defined by a number of qubits (nqubits), the name of the system (name), and the number o...
glaive
I want to implement a multi-threaded program in Python that can handle the maximum number of threads that can concurrently execute within the confines of a singular process. Can you provide a detailed analysis of how I can achieve this? Please consider the limitations of Python's Global Interpreter Lock (GIL), the oper...
glaive
You are tasked with implementing a Led Controller system using the FIFO, GetPut, and Leds modules in a hardware description language. The Led Controller system should be able to receive commands to set the value and duration of the LEDs, and update the LEDs accordingly. The system should also be able to display the cur...
glaive
What is the code to create a MongoDB database for storing blog posts, with specific fields like title, author, content, and tags?
glaive
: I am trying to create a React component that displays a video label icon, but I am having trouble implementing it. I need to create a component that renders a video label icon using the provided SVG path data. Can someone help me write the code for this React component?
glaive
You are tasked with writing a shell script to extract the major, minor, and patch version numbers from a given version string in the format "X.Y.Z". Once you have extracted these numbers, you need to calculate a numerical representation of the version in the format "XXYYZZ" (where XX is the major version, YY is the min...
glaive
Can someone help me with a Python code to check if two words are anagrams of each other?
glaive
You are tasked with embedding the Racket run-time system into a larger program. Specifically, you need to embed Racket CGC into a program and follow a series of steps to achieve this. Your task is to write a C/C++ program that uses Racket library functions, includes the file "scheme.h", starts the main program through...
glaive
You need to implement a program to perform the Needleman-Wunsch algorithm for sequence alignment using CUDA. The program should take the maximum rows and columns, as well as a penalty value, as input. The lengths of the two sequences should be divisible by 16. The program should allocate memory for input_itemsets, outp...
glaive
How can I create a C# program that asks the user for two dates and a city, and then calculates the total number of days between the two dates?
glaive
You are tasked with implementing a generic 1D data transfer on an AXI BUS. The task involves creating a module that handles the transfer of data between source and destination addresses through an AXI4+ATOP master request. The module should be designed to handle various parameters such as DataWidth, AddrWidth, IdWidth,...
glaive
You are tasked with creating a program that utilizes the nalgebra library to work with 2D and 3D points. Your program should define the following types: - Point2i: a 2D point with integer coordinates - Point2f: a 2D point with floating-point coordinates - Point3i: a 3D point with integer coordinates - Point3f: a 3D poi...
glaive
I need to organize my project files and keep the file list clean. I have header files in a directory named "include" and source files in a directory named "src". I also have a directory named "tests" within the source directory. I want to set variables for the directories and files to keep everything organized. How can...
glaive
You are tasked with implementing a Random class in C++ using CUDA for generating random numbers on the GPU. The class should have a constructor that takes in the number of random states to generate and an unsigned integer seed. It should also have a setSeed method that takes in a new seed and updates the random states ...
glaive
You are tasked with creating a command-line interface (CLI) tool called "gitlab-group-actions" that can perform various actions on a GitLab group. The tool should be able to start a pipeline or create a tag within the specified group. It should also support options for specifying the API URL, group ID, access token, br...
glaive
I am trying to generate a list in Python, named 'my_randoms', consisting of 10 random numbers between 0 and 100. I have the following code: ```python import random my_randoms=[] for i in range (10): my_randoms.append(random.randrange(1, 101, 1)) print (my_randoms) ``` But the output is as follows: ```python [...
glaive
You are tasked with creating a Node.js project structure for a web application. The project should have separate directories for source code, distribution files, tests, and documentation. Each directory should have specific subdirectories for different file types, such as TypeScript, JavaScript, and configuration files...
glaive
How can I develop a machine learning model in Python that can identify a student's profession based on certain parameters?
glaive
You are tasked with creating an XSLT stylesheet to transform XML documents. Your task is to write a template that matches the "doc" element and outputs the value of a variable called "input". However, the variable "input" has not been defined in the stylesheet. Your job is to write the necessary XSLT code to handle thi...
glaive
You are asked to create a Solidity contract for a Manual Price Feed. The contract should have the following functionalities: 1. A constructor that takes in two parameters: a uint `rate_` and a bool `feedValid_`. The `rate_` must be greater than 0, and it should set the `rate` variable to a bytes32 representation of th...
glaive
I am working on a project where I need to import a shared library and include its path in my CMake project. Depending on the target type (MSVC, ubuntu, beagle, dart), I need to set the include path and import path for the shared library. I also need to link the target with the imported shared library. Can someone prov...
glaive
You are tasked with implementing a Minimum Spanning Tree (MST) problem structure to store device-side vectors for doing Minimum Spanning Tree on the GPU. The structure should be able to handle a graph with a specified number of nodes and edges and should be able to work with multiple GPUs if needed. The problem structu...
glaive
I am trying to find the Fusepp library in my CMake project, but I am having trouble locating it. I need to define the variables Fusepp_FOUND and Fusepp_INCLUDE_DIRS, as well as the imported target Fusepp::Fusepp. Can someone help me write a CMake script to find the Fusepp library and define these variables and targets?
glaive
You are tasked with creating an R script for the STILT (Stochastic Time-Inverted Lagrangian Transport) model. Your task is to set up the script to execute parallel simulations for atmospheric transport and dispersion modeling. The script should take user inputs, including project directory, output directory, and parall...
glaive
I'm looking for advice on how to set up my PHP (LAMP) development environment with development, staging, and production servers. I want to be able to deploy with just one click and also have the ability to rollback to any previous revision. The rollback should also revert the database schema and data to how it was when...
glaive
You are working on a project using the Entity Framework Core in C#. You need to create a generic repository class that can perform various database operations such as querying, updating, inserting, and listing entities of any type. Your task is to implement the following methods in the Repository class: 1. Queryable: ...
glaive
You are working on a game development project using the GMObject model with the MVC version 1.0. You need to create a new event for the object "obj_trap_parent_ph" which has the following properties: - IsDnD: Set to false - collisionObjectId: Set to "00000000-0000-0000-0000-000000000000" - enumb: Set to 0 - eventtype: ...
glaive
When should I use `uuid.uuid1()` versus `uuid.uuid4()` in Python? I understand from the Python documentation that `uuid1()` generates a UUID from a host ID, sequence number, and the current time, while `uuid4()` generates a random UUID. I'm aware that `uuid1()` could potentially have privacy concerns since it's based o...
glaive
You are tasked with implementing a function to generate the sequence defined by the following rules: - a(1) = a(2) = 1 - a(2n + 1) = 2 * a(2n) - a(2n) = 2 * a(2n - 1) + (-1)^n The function should take an integer n as input and return the nth term of the sequence. For example, given n = 5, the function should return ...
glaive
You are tasked with creating a Python script that activates a virtual environment and sets the necessary environment variables. The virtual environment should be located at "/home/wecode/Desktop/pitches/virtual" and the script should ensure that the necessary PATH and prompt variables are set accordingly. Additionally,...
glaive
What is the assembly code for 68HC11 to calculate the value of sine using either Taylor series or a lookup table? I want the display value to be only in integer. How does a lookup table work in this case? Can you explain how it can be implemented using Taylor series?
glaive
How can I create a web page that calculates the Fibonacci sequence of a given number using HTML and JavaScript?
glaive
I am trying to retrieve data from a linked data source using a SPARQL query. However, I am struggling to retrieve the necessary information related to a review for a specific product type. Can someone provide me with a SPARQL query that retrieves the product type, its label, comment, parent type, and its related inform...
glaive
I am trying to create a PowerShell module for Azure Resource Manager (ARM) Automation, but I am not sure how to structure the manifest file properly. Can someone help me create a manifest file for this module that includes all the necessary information such as the module version, supported PSEditions, author, descripti...
glaive
You are tasked with creating an XSLT stylesheet to transform a CSV file into an XML format. The CSV file contains the following columns: Type, SubType, and an indefinite number of columns for SubSubType. Additionally, there is a Comments column for each row. Your task is to write an XSLT stylesheet that can process thi...
glaive