instruction_seed
stringlengths
29
40.5k
source
stringclasses
6 values
You are required to implement a Ruby module to create and manage credentials for a blockchain-based identity platform. The module will have classes and methods to handle the creation, verification, and status management of credentials. The module will include the following classes: - CreateCredentialRequest: This class...
glaive
You are tasked with implementing a CUDA kernel that performs a broadcast operation on a mask array and a data array. The mask array has a shape of (N, 1) and the data array has a shape of (N, M). The goal is to apply the mask to each row of the data array, broadcasting the mask to match the shape of the data array, and...
glaive
You are tasked with creating a Ruby module that generates a report using the Rspec testing framework. The module should have a version number attribute that is set to '0.2.3'. Your task is to create a module with the appropriate version attribute and ensure that it is frozen to prevent any modifications.
glaive
You are tasked with creating an OTP application in Erlang that follows the OTP design principles. Your application should have a supervision tree, with a top supervisor that starts the processes of the application. You need to implement the `start/2` and `stop/1` callback functions as per the OTP design principles. The...
glaive
I need to create a shell script that prepares initial conditions and submits a filter run. The script should accomplish the following tasks: 1. Set up aliases for removing, copying, moving, and linking files. 2. Remove any pre-existing temporary files and directories. 3. Source a control file named "Control_File.csh"....
glaive
You are tasked with creating a CMake script to remove specific files and directories from a given file system path. Your goal is to remove the following files and directories: - "CMakeFiles/kinova_msgs_generate_messages_eus" - "/home/kinova/MillenCapstone/catkin_ws/devel/share/roseus/ros/kinova_msgs/msg/KinovaPose.l" ...
glaive
As a programmer, I'm curious about how instructions like "branch" (function call) can handle a 32-bit memory address when each assembly instruction is also 4 bytes big. For example, let's say I have a function address or symbol given by the linker, which is a 32-bit memory address. How is it possible to encode this add...
glaive
I am trying to find the OCI (Oracle Call Interface) includes and library in my CMake project. I want to define the following variables once this is done: - OCI_INCLUDE_DIRS: the location of oci.h, etc. - OCI_LIBRARIES: a list of libraries to use OCI - OCI_FOUND: a boolean indicating if OCI is found Can someone please ...
glaive
How can I select a row from my MySQL table that has two specific keyword IDs? In my table, there are two columns: 'articleId' and 'keywordId'. I want to find an article that has both keywordId = 1 and keywordId = 12. Each keyword has its own record in the table. Is there a way to perform a single select query to dete...
glaive
I am working with a category theory library in a programming language. I need to create a function that determines if a given functor is an equivalence. An equivalence is a pair of functors, along with a unit and counit which are natural isomorphisms and satisfy certain properties. I need to implement a function that c...
glaive
You are tasked with implementing a Translation Lookaside Buffer (TLB) for use by RISC-V system MMUs for VM schemes Sv32 (for RV32) and Sv39 (for RV64). The TLB is a cache mapping {ASID,VPN}->PPN and is used for translating virtual addresses to physical addresses. The TLB interface includes methods for flushing all entr...
glaive
You are tasked with implementing a GraphQL object resolver in Rust. The resolver needs to execute each of the fields concurrently and output the result as a JSON value. Your task is to write the code for the `resolve_object` function that takes a context selection set and a reference to the GraphQL object, and returns ...
glaive
I am learning the concept of Dynamic Programming through the course on MIT OCW and I am trying to implement the concept into code. Currently, I am struggling to understand and implement points 3 to 5 from the lecture notes. I have written some part of the solution but I am unsure how to continue the function. I am also...
glaive
You are tasked with creating a database schema in Clojure using the datascript and re-posh libraries. The database schema should include a timerange entity with a timerange attribute set to "24h". Additionally, you need to establish a connection to the database using datascript and re-posh.
glaive
How can I design a Flask API to create, retrieve, and edit user data?
glaive
You are tasked with creating a responsive navigation menu with a fixed sidebar and a main content area. The navigation menu should be hidden by default and slide in from the left when a button is clicked. The main content area should adjust its width when the sidebar is shown to accommodate the navigation menu. Create...
glaive
You are working on a project that requires you to remove a specific file or directory in your CMake build system. You need to write a CMake function that will remove a specified file or directory, including all its contents. Write a CMake function called `remove_file_or_directory` that takes a single argument `file_or...
glaive
You are tasked with creating a function that takes an array of array of arrays of floats as input. This array represents a geometry of type `Polygon` and follows the convention used in GeoJSON to describe polygons. The innermost arrays are coordinate pairs or *vertices*, and the polygons are described using a list of e...
glaive
Is there a way to write a Python program that will replace all the blank spaces in a given sentence with hyphens?
glaive
You are tasked with creating a program that models a particle emitter object in a game engine. The particle emitter should have the ability to trigger events based on certain conditions. The program should also include properties for physics simulation, such as density, friction, and restitution. Additionally, the prog...
glaive
You are tasked with creating a new configuration source for an xDS API in a proto3 syntax. The source should be able to identify the API type and cluster that Envoy will use to fetch an xDS API. The configuration source should support both REST and gRPC APIs, with the ability to cycle through multiple clusters or servi...
glaive
You are tasked with writing a SPARQL query to retrieve films that star both Al Pacino and Robert De Niro from a given RDF dataset. The dataset contains information about films and their respective cast members. Your query should return all films that feature both Al Pacino and Robert De Niro as actors.
glaive
You are tasked with creating a SQL query to retrieve the first letter of the `first_name` column from the `wizzard_deposits` table in the `gringotts` database. The query should only return distinct values and should be ordered by the first letter. Additionally, you need to filter the results to only include records whe...
glaive
You are tasked with implementing a CUDA-based simple unary function for a tensor library. The function should be able to perform various mathematical operations on the elements of a given tensor, such as absolute, ceiling, exponential, floor, checking if a number is non-zero or zero, logarithm, negation, rounding, sign...
glaive
How do I write a SQL query to select all the rows in the 'Employees' table where the salary is greater than 25000?
glaive
You are tasked with creating a web layout using CSS variables and clip-path to overlay different elements on a webpage. The layout should include two game screens, two host screens, social elements, info boxes, alerts and chat boxes. Each element must be positioned and sized according to the given variables. The layout...
glaive
I want to write a Python function that can replace every occurrence of strings found in one array with their corresponding strings from another array. How can I achieve this?
glaive
You are working on a Leave Management System for a multi-tenant application. You need to create a service class to calculate the leave summary for each tenant. The leave summary should include the total number of leaves taken, remaining leaves, and any other relevant information. Write a PHP class called LeaveSummaryS...
glaive
Is there a way to compare two input strings and determine if they contain similar sequences of distinct numeric values, including decimal points and negative integers, while disregarding non-digit characters? Additionally, can the comparison also check if these numbers appear in the same order in both strings?
glaive
You are tasked with implementing a Go package that wraps a ServiceDescriptorProto with a GraphqlService option. The package should include the following features: - A NewService function that initializes a new Service with a ServiceDescriptorProto, a File, and optional paths. - A Comment method that returns the commen...
glaive
You are tasked with creating a custom 404 error page for a website. The page should display a heading with the text "404", a subheading with the text "Page Not Found", and a message below it saying "잘못된 경로로 접근하셨습니다." (which translates to "You have accessed the wrong path."). Your task is to write the JSX code for the c...
glaive
You are tasked with implementing a CUDA parallel matrix library. The library provides functions for adding, subtracting, multiplying, multiplying by a scalar, performing a Hadamard product, computing the sum of all elements, and transposing a matrix using CUDA threads. Your task is to implement the following functions ...
glaive
You are tasked with implementing a function that generates a unique hash based on a given version string. The hash should be a combination of various operations on the input string, and the final output should be a concatenation of the resulting hash values. Additionally, the function should pad the hash values to a sp...
glaive
You are tasked with creating a module for dealing with TUN/TAP devices in OCaml. This module should include functions for creating TUN and TAP interfaces, closing these interfaces, getting information about the interfaces (such as MAC address and MTU), assigning IP addresses to the interfaces, and getting a list of int...
glaive
You are tasked with designing a low pass FIR filter using the `signal` library in R. The filter should have a pass band edge of 0.008 and a stop band edge of 0.016. You need to determine the filter order and Kaiser window parameter using the `kaiserord` function, and then design the filter using the `fir2` function. Fi...
glaive
You are tasked with creating a Dockerfile to build a container image for a service called "fleet" using the Go programming language. The service should be built from the GitHub repository "github.com/kolide/fleet" using the version specified in the "FLEET_VERSION" environment variable. The Dockerfile should include the...
glaive
You are tasked with creating a function that retrieves product information and sets up the template for a product detail screen. You will need to handle virtual products, meta information, and template path prefix, and ensure that the correct product details are displayed based on the given input.
glaive
You are tasked with implementing a packet streaming service using the PacketStreamer interface defined below. You need to create a program that can handle synchronous and asynchronous methods to publish and retrieve packets, as well as terminate a session. Your program should include the following: - A data structure ...
glaive
Is there a way to generate an Excel spreadsheet with 10 random numbers in each column, except for the first column which should contain labels?
glaive
You are tasked with creating a CMake script to remove specific files and directories as part of the clean-up process for your project. The script should be able to remove a specified list of files and directories from the project directory. Write a CMake script that accomplishes this task and can be easily integrated i...
glaive
You are tasked with implementing a function for basis conversion of polynomials in a given order. The function should take in a basis, an initial order (order_1), and a target order (order_2), and return the converted basis under the new order. The basis conversion should be performed using the provided algorithm and t...
glaive
I am trying to implement a functionality in my Zig program that requires adding frames to a group and then waiting for all the calls and promises of the group to complete. I want to use the `std.event.Group` API provided by Zig to achieve this. However, I am not sure how to properly use the `std.event.Group` API to add...
glaive
I am trying to implement a checker in OCaml for a specific code analysis tool, and I need help creating a class that will check for common base invariants. The class should have methods to check for safety, violation, and delegation based on the given query and expressions. I am not sure how to structure the class and ...
glaive
You are tasked with creating a CMake configuration file for a project called "TOMOPY". The configuration file should include various options and features that can be enabled or disabled based on different conditions. Some of these options include enabling or disabling the use of OpenMP, OpenCV, CUDA, MKL, architecture-...
glaive
You are tasked with creating a class in C# that represents a value map, where each value is associated with a unique key. The class should have methods to perform the following tasks: 1. Get the values of the map as continuous ranges, returning the ranges in a list. 2. Get the highest value contained in the value map. ...
glaive
Is there a library in .NET that allows me to convert binary data into x86 assembly code?
glaive
You are given a directory containing various files, including object files, executables, manifests, and library files. Your task is to write a program to remove all these files and clean up the directory. You need to create a script that can handle files of different languages such as C++, C, etc.
glaive
You are tasked with implementing a statistical model for cure rate analysis in a programming language that supports Bayesian modeling, such as Stan. The goal is to create a model that estimates the cure rate for a given set of data. The model will use the Weibull distribution to model the survival function and will inc...
glaive
You are working on a networking application and need to define various primitive integer types for bit manipulations. These types are aliased to the next largest of `u8`, `u16`, `u32`, `u64`, and serve as hints for the bit manipulations to extract values from a packet. You need to create these type aliases for various ...
glaive
You are working on a project that involves setting up a virtual environment for a Python application. You need to write a script that will handle the activation and deactivation of the virtual environment, as well as updating the command prompt to indicate the active virtual environment. Write a batch script that does...
glaive
I am working on a project where I need to track the history of assets in a database. I want to create a table called asset_history that will store the historical data for assets. The table should have columns for asset_id, asset_name, date, and status. I need to write a SQL query to create this table with the specified...
glaive
How can I develop a program that returns the first n prime numbers?
glaive
You are tasked with creating a function that registers an image in an AWS EC2 service using OCaml. The function should take in the necessary input parameters and generate the corresponding HTTP request to be sent to the AWS API. The input parameters include the region, image ID, and any additional optional parameters. ...
glaive
You are tasked with creating a Kotlin class that acts as a navigator for a main activity in an Android app. The class should have a function that takes an integer postId as a parameter and opens a new activity, DetailsActivity, passing the postId as an extra to the intent. Implement the showPostDetails function in the ...
glaive
How can I read from stdin in Python? I am attempting some code golf challenges that require using stdin for input.
glaive
How can I create a HTML web page with a table to display the information about the members of a shopping list?
glaive
You are tasked with creating a base system for a ZedBoard using the provided TCL script. The script should prepare the block design structure, add a processing system, BRAM, and GPIO, make the wrapper, and update the compile order. Your task is to implement the necessary TCL commands to achieve this base system for the...
glaive
I am trying to create a function that can detect the user's browser and then export it for further use. I want to be able to import the function and then use it to determine the user's browser. Can someone provide a solution for creating this functionality?
glaive
You are tasked with creating a web page to display a loan repayment history. The page should include a table with columns for the repayment number, repayment date, repayment amount, early repayment fee, and remaining balance. You need to use JSP and JSTL to iterate through a list of repayment history items and display ...
glaive
How can I create a program that determines whether a given number is even or not?
glaive
I am trying to initialize a repository search init object using the Spring framework and JSTL in a JSP file. The object needs to have specific properties and values assigned to it. I have tried to define the object and its properties, but I am encountering issues with the initialization and assignment of the values. Ca...
glaive
I have this cocos 2dx game for IOS and I want to port it to Android. I understand I have to write all my classes in the android.mk and I did. but still I have this problem ``` Classes/scenes/itemshop/ItemShop.cpp:144: error: undefined reference to 'cocos2d::UserDefault::GetValueForKeyPlist ``` this is just horrible ...
glaive
You are tasked with creating a class that implements a storage singleton to guarantee constant buffers' persistence in a given programming language and framework. The class should have methods to purge the protector, persist data buffers, retrieve data buffers, and check for the existence of data buffers based on certa...
glaive
You are tasked with creating a program that defines a new glyph for the Latin letter small capital X, which currently has no unicode. The glyph should be named 'xsmall' and should be based on the 'X_cap' glyph. The advance width of the new glyph should be the same as the base glyph. The new glyph should also have speci...
glaive
I am trying to create a Character class in Unity that can rotate when a player enters its zone. The character should have a set of meshes to randomly choose from and should rotate at a certain speed when the player is inside its zone. I want to implement the rotation logic based on a timer and the player's position. Ca...
glaive
You are tasked with creating a PHP class that handles file resources in the context of the Drupal framework. The class should be able to normalize entities to a HAL+JSON format and handle anonymous user access to these entities. You need to implement methods to handle the expected normalized entity, the normalized post...
glaive
How can I create a Python decorator with optional arguments? I have a decorator currently setup but it behaves differently when I pass a method name and when I don't. The decorator `foo_register` decorates `my_function` but does not make it to `decorator` function. However, when I pass a method name 'say_hi', it works ...
glaive
I need to create a class in C# that represents a payment with the following requirements: - The class should have a property to store the payment status, which can be one of the following: Pending, Completed, or Failed. - The class should have a method to update the payment status. I want to ensure that the class is w...
glaive
You are tasked with implementing a class that provides assertion methods for objects in a Java application. The class should be named ObjectAssert and should extend AbstractObjectAssert. The ObjectAssert class should have a constructor that takes a parameter of type A (the type of the "actual" value) and should be prot...
glaive
You are tasked with implementing a class that manages the update of export descriptors in a composition environment. The class, ExportDescriptorRegistryUpdate, has the following responsibilities: - It maintains a collection of part definitions, which are mappings of composition contracts to export descriptors. - It man...
glaive
You are tasked with creating a shader program in GLSL that takes in a color attribute and a vertex attribute and outputs a modified color and position on the screen. The color attribute is a vec4 representing the color of the vertex, and the vertex attribute is a vec4 representing the position of the vertex. Your task ...
glaive
I am building a web application and I need to create a responsive layout using CSS grid. I want to display a greeting message and the current time in a visually appealing way. Can someone help me write the code to achieve this using CSS and HTML?
glaive
You are tasked with implementing a module in Erlang that will be used for handling transactions. The module should include the following functionalities: 1. Export a function called `exported` that calls an unexported function `unexported`. 2. Define a function called `get_lambda` that returns a lambda function which ...
glaive
You are tasked with implementing a module that handles relational expressions for query plans. The module should include functions for aliasing, arithmetic operations (addition, subtraction, multiplication, division), averaging, column selection, comparison, counting, literal values, maximum, minimum, and summation. Yo...
glaive
You are tasked with implementing a Verilog module that acts as a parameter resolution wrapper for a specific interface. The module has a number of external parameters, and your task is to validate the input parameters against known values or RBC values, and then use the validated parameters to instantiate another modul...
glaive
I'm a bit confused as it seems like the `application.css` is including itself twice, once when it lists the resources from the manifest and then a cache of that. So when I delete an individual file it still seems to stay alive inside the `application.css` file. `application.css (source)` ```css /* *= require twitter/...
glaive
You are tasked with implementing a set of functions to manipulate directories and files using the io.fs module in the Lean programming language. Your task is to create three separate functions: one to create, check, and delete a directory, one to create, check, and delete directories recursively, and another to create,...
glaive
I am trying to create a custom action button in my Rust application using the iced library. The button should have an icon and a name, and its appearance should change based on whether it is selected or not. I want to define an enum for different action types and have a method to update the button's state when it is cl...
glaive
You are tasked with implementing a platform-independent file/directory dialog similar to the @racket[get-file], @racket[put-file], @racket[get-directory], and @racket[get-file-list] procedures, but with additional functionality through the @racket[path-dialog%] class. Your task is to create a new class called @racket[p...
glaive
You are tasked with creating a stored procedure in SQL Server, which will calculate the utilization percentage of fleet types based on the number of trips in transit. The procedure should take into account the company GUID, parent entity GUID, invoking user, version, culture, and enable debug info as input parameters. ...
glaive
You are tasked with creating a new project using a specific set of commands and parameters. The project should be named "CU_Main" and located in the directory "C:\Users\rozen\Dropbox\EE_BSC_2017\G8\vhdl\CU_Droptest\designer\impl1\CU_Main_fp". The mode of the project should be set to "single". After creating the project...
glaive
How can I add common flags, C flags, and CXX flags to a CMake project in a way that ensures all necessary flags are included for compiling both C and C++ files?
glaive
I am working on a project that involves implementing a CUDA kernel to compute centroids for a given set of data points and their corresponding labels. The goal is to parallelize this computation using CUDA to improve performance. The code snippet provided here is a starting point, but I need to complete the implementat...
glaive
I've just started looking at WebAssembly MVP, and notice that there is no access to the stack and stack pointer, or indeed any structured exception handling support (throw/catch) etc. Given it is supposed to be a C compilation target, it surely must be possible to implement setjmp and longjmp, but I can't fathom how th...
glaive
You are tasked with creating a JSP page for setting up a database connection for an application. The page should allow users to enter JDBC driver, server URL, username, password, minimum and maximum connections, and connection timeout. Users should also be able to select from preset database options for MySQL, Oracle, ...
glaive
You are tasked with creating a Makefile for a C++ project. The Makefile must include rules to compile source files, generate object files, and link them to create a final executable or library. The Makefile should also handle different build configurations such as Debug and Release, with different compiler flags, inclu...
glaive
I need to create a program that can preopen device nodes and store the ihandles under /chosen. The program should be able to open devices and encode their properties. Write a function called preopen that takes two arguments: chosen-str (a string) and node-path (a string). This function should make the chosen device op...
glaive
I have a Kubernetes cluster deployed with Rancher's K3s. Sometimes, I encounter the "NodeDiskPressure" issue, which leads to the eviction of existing pods. Upon investigating, I found that the containerd runtime storage usage increases significantly during high cluster loads, reaching over 90%. Typically, the usage is ...
glaive
I am working on a project that requires optimizing a Verilog design for a Xilinx FPGA using the Vivado tool. I need to use the vopt command to specify various options such as the target architecture, logging options, and library locations. However, I am not sure how to properly structure the vopt command and what each ...
glaive
You are tasked with implementing a function to spawn a new process in a Lisp environment. The function should take in the path to the executable, a list of arguments, environment variables, file actions, and attributes as input parameters. You need to create a Lisp function that can handle the creation of a new process...
glaive
You are tasked with creating a class in Common Lisp that represents the relationship between a controller and a controlled device. The class should have the following properties: - AccessState: a UINT16 property indicating whether the Controller is actively commanding or accessing the Device (value=1) or not (value=2)....
glaive
You are tasked with creating a CocoaPod named "NicooTableListViewController" that will serve as a base view controller for a table list. The view controller needs to have the capability to delegate for edit, header refresh, footer refresh, and display a no data view. The pod needs to be compatible with iOS deployment t...
glaive
You are tasked with creating an EchoService using the Thrift framework. The EchoService should have a single method called "echo" that takes a string input as a parameter and returns the same string as output. Your task is to implement the EchoService interface in Thrift and create a server and client to test the funct...
glaive
I am working with Scheme and want to manage my packages with Geiser. However, I am encountering some issues with the package management system. Can someone help me write a code snippet to correctly manage the packages using Geiser in Scheme?
glaive
You are working on a Haskell project and want to integrate the `dante` package to provide real-time feedback and error checking for your code. You have already installed the `dante` package and configured it in your project, but you want to customize the default load flags for the `dante` package. Your specific require...
glaive
Can you provide an example of a Python class with a constructor and a `to_string` method that formats and returns a string with two integers?
glaive
You are tasked with creating a Flutter app that includes a time picker. The app should display a bottom sheet with a time picker widget that allows the user to select a specific time within a given range. The app should also display the minimum, maximum, and initial date times, and allow the user to customize the time ...
glaive
You are tasked with optimizing a complex mathematical function in a 2D space. The function is defined as follows: f(x, y) = Exp[-16 I y] (1 (I Sin[x])^6 Cos[x]^10 + 1 (I Sin[x])^10 Cos[x]^6) + Exp[-12 I y] (21 (I Sin[x])^5 Cos[x]^11 + 21 (I Sin[x])^11 Cos[x]^5 + 38 (I Sin[x])^7 Cos[x]^9 + 38 (I Sin[x])^9 Cos[x]^7 + 12 ...
glaive
You are tasked with implementing a function in the FastUtils unit that converts a buffer from YV12 format to RGBA format. The function should have the following signature: procedure YV12ToRGBA(const AYPtr, AUPtr, AVPtr, ARGBAPtr: Pointer; const AYStride, AUVStride, ARGBAStride, AWidth, AHeight: Integer); The parame...
glaive
How can I write a Python program to print out a pattern using loops?
glaive