instruction_seed
stringlengths
29
40.5k
source
stringclasses
6 values
You are tasked with writing a CUDA program that calculates the Euclidean norm of a given vector using the Thrust library. The Euclidean norm is defined as the square root of the sum of the squares of the individual elements in the vector. The program must take in a vector of numbers and output the computed norm.
glaive
You are tasked with implementing a framework for a general circle operad. This framework involves checking the validity of various operations and ensuring that certain axioms hold true. The operations include checking the arguments for semi-circle, nested, and disjoint axioms, and validating the outputs based on certai...
glaive
You are tasked with creating a program to manage bank accounts. The program should allow users to create an account with a starting balance and password, withdraw and deposit money, and make joint accounts with another password. The program should also handle incorrect password attempts.
glaive
You are tasked with creating a CMake target import file for a library called "boost_python-mt-shared". The file should import this target for different configurations (Debug, Release, MinSizeRel, RelWithDebInfo) and set the imported location and soname for each configuration. Your task is to write a CMake script that ...
glaive
You are tasked with creating a shader in Unity using the CGPROGRAM framework. The shader should include properties for different material parameters, subnormal blend, UV repeat, incidence roughness, incidence color, base texture, normal map texture, specular map texture, material parameter map texture, subnormal map te...
glaive
You are tasked with creating a 2D game using the Love2D framework. The game involves navigating a character through a dungeon, with the ability to move in all four directions, and shoot bullets in both horizontal and vertical directions. The dungeon consists of multiple rooms, each with doors on its four sides. The pla...
glaive
You are tasked with creating a program that generates a composite drawing with multiple elements such as planets, craters, atmosphere, stars, and rings. The program should use the OpenRNDR library for drawing and should be written in Kotlin. The main requirements for the program are as follows: - The program should ge...
glaive
I need to create a program that manages a library database. The program should be able to store information about books and articles, including their title, author, year, and additional details like journal, volume, and pages for articles. The program needs to be able to handle reprints and be able to link a reprint to...
glaive
I have a CSV file containing vaccination data by zip code for the state of Maryland. I need to process this data to filter out rows that do not have data for fully vaccinated people and remove any rows where the zip code is less than five digits. Then, I need to create a dataframe of all Maryland zip codes and join it ...
glaive
You want to analyze police incidents around the West Virginia University campus over time. To do this, you need to retrieve the crime log data from a CSV file and perform various transformations to prepare the data for analysis. Specifically, you need to rename the column names to be more readable, convert the datetime...
glaive
You are tasked with implementing a system that handles both authentication and authorization for a web application. The system should be able to establish the identity of the user (authentication) and determine whether the user is allowed access to specific resources (authorization). The authentication process may invo...
glaive
You are tasked with creating a program that can generate and emit custom attributes in a Visual Basic project. The program should be able to handle user-defined attributes as well as synthesized attributes. The program should also be able to filter out duplicate assembly attributes. The program must check if a symbol i...
glaive
You are tasked with implementing a function to determine whether a given set `S` is a subfield of a field `F`. The function should take a set `S` as input and return true if `S` is a subfield of `F`, and false otherwise. A subfield is a subset of a field that is itself a field, so the function should check that `S` sat...
glaive
I am trying to create a Python package using setup.py, and I want to specify the packages and package directories to include. Can someone help me understand how to properly set the variables for the packages and package directories in the setup.py file?
glaive
I am trying to run a job on a computing cluster using SLURM and encountering some issues. I have created a bash script with the necessary SLURM directives and module loads, but the job is not running as expected. I need to ensure that the job runs with the specified parameters and activates the required conda environme...
glaive
You are tasked with writing a shader program in GLSL (OpenGL Shading Language) version 440 core. The shader program should take in a 2D texture array and output a color based on the texture coordinates provided. You need to implement the main function that samples the texture array using the provided texture coordinate...
glaive
We have python services running in pods in a kubernetes cluster. The services are setup to receive their log-level from an environment variable. Those env vars are set during the deployment of the service in a gitlab pipeline. For debugging purposes I want to be able to just change the env var on a single pod and resta...
glaive
I am trying to verify a container image using Rust and the sigstore library. I want to create a command-line tool that takes in a verification key, optional annotations, and the name of the image to verify. The tool should then use the sigstore library to verify the image and display the verified signatures. Can someo...
glaive
You are tasked with creating a wallet service in Java that allows users to transfer money between their accounts. The service should include a method called moveMoney that takes in a transactionId, buyerId, sellerId, and amount as parameters. It should check if the buyer has enough balance to make the transfer, and if ...
glaive
You are tasked with creating a program that will allow the user to manipulate files and directories using the `std.fs` module in the Zig programming language. Your program needs to perform various file and directory operations, such as creating, reading, writing, renaming, and deleting files and directories. Additional...
glaive
You are tasked with creating a CMake file for a new project in the `/home/user/new_project` directory. The project consists of the main source code in the root directory and a `lib` subdirectory containing additional library code. The project must be able to build and run tests using CMake. Create a CMakeLists.txt fil...
glaive
You are tasked with creating a repository class in Kotlin for an Android application using the MVVM architecture. The repository should be responsible for fetching and storing data related to album pages from both a local database and an API. The repository should be able to retrieve album pages from the database, fetc...
glaive
How can I create a Java program that multiplies two matrices of different sizes?
glaive
I am working on a Groovy script and I need to iterate over a list of items. Can someone help me with the code for that?
glaive
I am working on a project and need to securely encode and decode sensitive data using a cryptographic algorithm. I want to use Base64 encoding and decoding in my Python program, but I am not sure how to implement it. Can someone provide a clear example of how to encode and decode a string using Base64 in Python?
glaive
You are tasked with creating a Tcl script that simulates a VHDL file using the following guidelines: - The script should take in two arguments: the name of the .vhd file and the name of the project unit. - There should be a procedure called "forsuj" which generates stimuli for a signal vector. - The "forsuj" procedure ...
glaive
You are working on a project that involves cleaning up various files and directories using CMake. You need to write a CMake script that removes specific files and directories from the project directory. The files and directories to be removed are as follows: - "CMakeFiles/goose_autogen.dir/AutogenUsed.txt" - "CMakeFile...
glaive
You are tasked with defining a set of data structures and services using the Thrift language. You need to create the following elements: 1. Enumerations: enum1, enum2, enum3 2. Unions: union1, union2, union3, unionA 3. Structs: structA, structB, structC, struct1, struct2, struct3, struct4, struct5, struct_binary, dep_...
glaive
I want to create a Python class to store information about patients. Each patient should have a name and a condition associated with them. How can I achieve this?
glaive
I'm trying to compare a value with 350 using the instruction `cmp r0, #350`, but I'm getting an error saying that 350 cannot be represented in Operand2 format. I believe this is because 350 is greater than 8 bits. How can I perform the comparison with 350?
glaive
I need to create a function in R that performs various operations related to a statistical modeling software (SMS) run. The function should be able to handle single species SMS runs, multi-species mode 1 SMS runs, multi-species mode 2 SMS runs, Hessian matrix creation, Markov Chain Monte Carlo simulations, likelihood p...
glaive
I need to create an XSLT stylesheet that imports and includes other XSL files from specific folders. The imported files are located in different directories and need to be referenced with absolute paths. How can I achieve this using XSLT 2.0?
glaive
I am trying to alter a field in my database table to drop the "NOT NULL" constraint using a programming language that supports object-oriented programming and database manipulation. However, I also want to handle any potential errors that may occur during the alteration process. Can you provide a solution to achieve th...
glaive
You are tasked with creating a function that populates a configuration table for a game map. The function should fill in the configuration for different resources and enemy entities based on specific parameters. The function should populate the "config" table with the following information for each resource and enemy ...
glaive
You are tasked with creating a CUDA kernel function that takes in an array of floats as input and produces an array of floats as output. The kernel function should also take in an increment size and the number of items in the input array. Your task is to implement the CUDA kernel function `NewModuleWithSourceDepsKernel...
glaive
I am working on a responsive web design project and I am having trouble with the media queries. Specifically, I need to create a media query for a maximum width of 550px, and I want to ensure that a certain button is displayed differently on smaller screens. I need to adjust the styling and layout of the button to make...
glaive
I am trying to create a web server using Clojure with the Compojure library, and I want to serve a static HTML file as the main page. Additionally, I want to include a conditional logic to inject some development mode HTML when the server is in development mode. How can I achieve this using the given code snippet as a ...
glaive
I need to create an interface in my programming code that includes a method to perform an action with a specified value. The method should take in an 8-bit value and perform the action accordingly. Can someone provide a solution to implement this interface in my code?
glaive
You are tasked with creating a Python script that can establish a WebSocket connection to a server at wss://localhost:9000/control. The script should be able to send and receive messages over the WebSocket connection. Your task is to implement a Python script that can accomplish this functionality.
glaive
You are tasked with implementing a set of interface routines for a high-level graphics library (\HIGZ{}) that interfaces with the X Windows System (\XW{}) using C and \FORTRAN{} programming. The interface routines provide low-level access to \X11{} and allow for the creation and manipulation of windows, drawing primiti...
glaive
In the code below, the person points a register at an address, I get that. Why is it that later on he didn't just load R3 into R1, why did it have to be offset by 0x14? How did R1 move in a few lines of code and what made it do it? It's really confusing me and hours of searching has shown no clear answer. The code is s...
glaive
How can I transform the provided HTML code into a responsive web page with a flexbox layout? I also want to include a center-aligned "Restart" button that changes its color upon hover and shows an animated loading spinner inside the button upon click. The spinner should disappear and the original text should reappear w...
glaive
You are tasked with creating a JSP page that retrieves and displays the number of achievements for a student and a teacher from a MySQL database. You are provided with a database connection and the following queries: 1. Retrieve the number of achievements for a specific student using their student_id. 2. Retrieve the ...
glaive
You are tasked with implementing a linear scalar advection equation in three space dimensions with constant velocity `a`. The equation to be implemented is given by: ```math \partial_t u + a_1 \partial_1 u + a_2 \partial_2 u + a_3 \partial_3 u = 0 ``` You need to create a custom struct called `LinearScalarAdvectionEqua...
glaive
I need to create a StateMachine in Haskell that can handle transitions and perform checks on those transitions. The StateMachine should have a data type for Transition, a function to apply a transition to the current state, and the ability to check the validity of transitions based on certain conditions. The StateMachi...
glaive
You are tasked with creating a React component for a personal "About Me" page on a website. The component should display a title, an image, a brief bio, and contact information. The bio and contact information should be displayed using internationalization (i18n) to support multiple languages. The contact information s...
glaive
I have come across a C++ code that is supposed to check if an array of numbers contains even or odd numbers. However, it seems to have some issues and is not working correctly. Can someone help me identify the bugs and provide a solution to fix the code? Also, I would like to optimize the implementation for better perf...
glaive
Can you provide an example of a Python code that implements a timer app to alert the user after a specific duration has passed?
glaive
You are tasked with creating a program that uses imperative tables for "type adornments". The program should implement a structure called Aidtab which will utilize UidtabImpFn and Uid to store and manage type adornments. Create a function that will allow for the addition of new type adornments to the Aidtab structure....
glaive
You are tasked with customizing the Emacs GUD (Grand Unified Debugger) library using elisp code. You need to create a function to clear the GUD screen after a specified window number and another function to kill the GUD and confirm with a "y" input. Additionally, you are required to enable tooltips for bubbles with hel...
glaive
You are tasked with implementing a CUDA kernel for a pooling operation in a deep learning framework. The CUDA kernel should perform forward and backward pooling operations on input and output tensors using the specified pooling configuration. The forward pooling operation should take alpha, xDesc, xMem, beta, and yDesc...
glaive
You are tasked with implementing a DDR2 memory controller in Verilog for a FPGA project. The memory controller needs to support the following parameters: - IO standard: SSTL-18 - IO interface type: HPAD - IO standard differential: 1.8-V SSTL - Number of DQS groups: 8 - DQS group size: 8 - Number of CK pins: 2 - Number ...
glaive
I am trying to develop an algorithm in Python that can identify the indices of three distinct elements within an array such that their cumulative sum matches a preset number. Can someone please provide a step-by-step solution using Python code? As an example, let's consider the array arr = [1, 5, 7, 10, 13, 16] and the...
glaive
Can you provide an AI solution to design a neural network that can classify text into different categories?
glaive
You are tasked with creating a Scala function that takes in a list of integers and returns the sum of all the even numbers in the list. Additionally, you need to handle the case where the input list is empty and return 0 in that scenario. Write a Scala function called "sumEvenNumbers" that takes a list of integers as ...
glaive
You are tasked with creating a program that lists all the services in a specified namespace. You are given access to a Kubernetes cluster and need to write a program that can retrieve and display a list of services within a specified namespace. Your program should be able to handle different namespaces and display the ...
glaive
You are tasked with creating a plugin in Vim that will split a given string and find the root of the plugin. Additionally, you need to implement functions for setting up and cleaning up before and after each test, as well as creating assertions for testing the length of a table and checking for the existence of a speci...
glaive
You are working on a project that requires you to create a module for geometry processing. Your task is to write a function that calculates the area of a triangle given the lengths of its three sides. The function should take three parameters, representing the lengths of the sides, and return the area of the triangle. ...
glaive
In the context of solving fluid dynamics problems on a GPU using the Corner-Transport-Upwind (CTU) scheme, you are tasked with implementing the function CUFLU_TGradient_Correction, which corrects face-centered variables by transverse flux gradients. The function is asynchronous and takes in multiple global memory array...
glaive
I am trying to work with a structure called `Foo` and a class called `Bar` in my code. I have a variable `x` of type `Foo (Foo α)` and I need to perform some operations on it. However, when I try to reduce the expression using `#reduce`, I am not getting the expected output. Can someone help me understand how to correc...
glaive
I'm working on a project involving sentiment analysis on unlabeled microblogging posts. I've tried using the Stanford library and Alchemy API web service, but they haven't produced satisfactory results. I'm not currently interested in training my own classifier. I am looking for recommendations for other libraries or w...
glaive
You are tasked with implementing a try-catch-finally block in a Java program. The try block should contain a piece of code that may potentially throw an exception, the catch block should handle the exception, and the finally block should execute regardless of whether an exception is thrown or not. Your task is to write...
glaive
I'm having trouble deploying our Rails app on AWS Elastic Beanstalk. I followed the example on the AWS blog (http://ruby.awsblog.com/post/Tx2AK2MFX0QHRIO/Deploying-Ruby-Applications-to-AWS-Elastic-Beanstalk-with-Git) and created a hook in the .ebextensions folder like this: ``` packages: yum: git: [] ``` I also...
glaive
I am working on developing a simple snake game in C++ using the g++ compiler. I have created separate source files for the various components of the game such as the coordinate system, utilities, core game logic, snake movement, and the game board. However, when I try to compile all the source files using the g++ comma...
glaive
I am trying to create a popover component in my application using JavaScript and the DevExpress framework. I want to customize the behavior and appearance of the popover, including its position, animation, and event handling. However, I'm struggling to understand how to implement these customizations. Could someone pr...
glaive
I am developing a Xamarin Android app and I need to pass a Unicode string from the app to a C++ native library. However, I am experiencing strange behavior when trying to do so. In my native shared library, I have defined the following functions using C++: ```cpp extern "C" void logANSI(const char* data) { __android...
glaive
You are tasked with creating a PowerShell script that exports PowerShell code to a notebook file. The script should have the following functionalities: 1. Throw an error if the output notebook is not specified. 2. Create a notebook from strings of PowerShell code. 3. Test for no text piped to the function. Create a Po...
glaive
You are tasked with implementing the `THNN_(IndexLinear_updateOutput)` function in CUDA. The function takes several input parameters, including `THCudaLongTensor *keys`, `THCTensor *values`, `THCTensor *output`, `THCTensor *weight`, `THCTensor *bias`, `THCTensor *normalizedValues`, and `int train`. The function should ...
glaive
I'm working on a Rails 3.0.6 project and I'm wondering if it's safe to delete the Gemfile.lock file. I want to test something, but I don't want to risk messing up my development environment. Can someone please advise?
glaive
I have a module saved in /lib as test_functions.rb that looks like this: ```ruby module TestFunctions def abc puts 123 end end ``` Going into ruby script/runner, I can see that the module is loading automatically (good ol' convention over configuration and all that...): ```ruby >> TestFunctions.instance_meth...
glaive
You are tasked with creating a PowerShell script to interact with a Shufflrr site. The script should be able to configure saved site and login information, login to the site, get the contents of a folder on the site, download a file from the site, upload a file to the site, and delete a file from the site. Each functio...
glaive
You are tasked with creating a makefile that will build a static library and a test executable for a component. The makefile should take in the necessary parameters and be able to handle specific source files, directories of source files, unit test code, mock objects, includes, flags for the C++ and C compiler, linker ...
glaive
You are tasked with writing a shader program that takes in a 3D position and a brightness value and outputs a brightness map. The input attributes are as follows: - in vec3 position: The 3D position of the vertex. - in vec3 brightness: The brightness value of the vertex. The main function that needs to be implemented ...
glaive
You are tasked with creating a program that handles file input and output in a specific programming language. Your program should be able to create, read, write, and manipulate files using the FileStream specific class. Write a function or method that returns the FileStream specific class, allowing for easy access and ...
glaive
I am working on a Java project where I need to define a data structure for storing system user information and the result of querying that information. I need to create a struct for the SystemUserRow and SystemUserRowResult, with specific fields and data types. Can someone help me with creating these structs and their ...
glaive
You are tasked with creating a module in a programming language that provides functionality for integer operations. The module should include the following: - Addition - Subtraction - Multiplication - Division - Comparison operators (<, <=, >, >=) - Conversion of numbers from and to integers Your module should also in...
glaive
How can I plot points using Matplotlib such that points belonging to class 1 are plotted in red, points in class 2 are plotted in blue, and points in class 3 are plotted in green, given that I have two vectors - one with values and one with class labels like 1, 2, 3 etc?
glaive
**** I want to create a function that takes an integer value between 0 and 255 as input and returns the corresponding color from the MapViridis array. The MapViridis array contains 256 color3 values, where each color3 value represents an RGB color. The function should return the RGB color associated with the input int...
glaive
How can I create a sentence using all the words in an array using Python?
glaive
How can I write a C# program to find the Fibonacci number at a given position in the Fibonacci sequence?
glaive
You are tasked with creating a Kafka consumer that reads messages from a specific topic. The goal is to implement a method that sets up a Kafka consumer with specific configurations and reads a specified number of key-value records from the given topic within a maximum wait time. The method should return the key-value ...
glaive
You are tasked with creating a Verilog module for a 2x4 decoder. The decoder should have two input bits and four output bits, with each output bit corresponding to one of the possible input combinations. Your task is to write the Verilog code for the 2x4 decoder module, as well as a testbench to verify its functionalit...
glaive
You are tasked with creating a function in Emacs Lisp that asynchronously copies files in dired to a specified destination using rsync. The function should be able to handle both source and destination on ssh/scp tramp connections. The function should take the destination as a parameter, which can be a relative filenam...
glaive
You are tasked with implementing a random number generator for a uniform distribution in a programming language that supports object-oriented programming. Your task is to create a module or class that contains a subroutine or method for generating random numbers from a uniform distribution. The subroutine or method sho...
glaive
You are tasked with creating a system in Common Lisp using the ASDF framework. Your system should be called "cl-drawille" and should allow for drawing in the terminal using Unicode Braille characters. The system should have a version number of "1.0.0" and be authored by "Goheeca <goheeca@gmail.com>". It should be licen...
glaive
You are tasked with creating a migration in Ruby on Rails to set up two new tables in the database: "vouchers" and "organization_vouchers". The "vouchers" table should have columns for name, description, code, duration, discount_percent, expires_at, and timestamps. The "organization_vouchers" table should have columns ...
glaive
You are tasked with creating an SQL script to initialize a database named "food_info" after importing a new database called "rrfx". The script should perform the following actions: 1. Set foreign key checks to 0. 2. Clean all tables by truncating the "food_info_adv", "food_info_article", "food_info_article_category", a...
glaive
You are tasked with implementing a class that performs cross correlation in the frequency domain using CUDA. The class, cuFreqCorrelator, requires a constructor that takes in the height and width of each image, the number of images in the batch, and a CUDA stream. Additionally, the class needs a method, execute, that t...
glaive
You are tasked with creating a web application that allows users to upload MARC files and perform various operations such as analyzing and importing MARC records, viewing import history, and viewing configuration settings. The web application should have a user interface with tabs for different functionalities: "Upload...
glaive
You are tasked with creating a Dockerfile that sets up an Ubuntu Bionic image with specific configurations and installs necessary packages. The Dockerfile should create a user named 'docker' with a user id of 9999 and a group id of 9999. Additionally, it should install essential packages such as apt-transport-https, ca...
glaive
You are tasked with creating a Unity3D MonoBehaviour that represents a window in the Unity Editor. The window should have specific properties such as its position, size, title, and child elements. Additionally, the window should be enabled and have editor hide flags set. Your task is to write the C# code for this MonoB...
glaive
I am trying to predict the size of the search tree for a problem with real-valued heuristics using active stratified sampling with clustering-based type systems. I want to implement a method to accurately estimate the search tree size for a given problem using this approach. Can someone provide a solution to implement ...
glaive
You are tasked with creating a shell script that activates a virtual environment and sets the necessary environment variables. The script should be able to handle both interactive and non-interactive environments, and should set the prompt to display the name of the virtual environment. Additionally, the script should ...
glaive
You are tasked with implementing a function that will manipulate the data structure of a given package in a specific version. The function should be able to perform the following operations: - Preload the package for supplying answers - Postload the package for supplying answers - Supplying answers for specific data ty...
glaive
You are tasked with implementing a program to parse and process orders for a bar or restaurant using the new Python 3.10 feature of Structural Pattern Matching. The orders can include items such as beer, food, and water, and each order is represented as a dictionary with different keys and values. The program should be...
glaive
How can I create a Java program that generates the fibonacci sequence for a given number?
glaive
You are tasked with creating a function in Emacs Lisp that adds a given list of elements to another list. The function should take in the list to which elements need to be added, as well as the elements to be added. The function should then iterate through the elements and add each one to the specified list. Lastly, th...
glaive
I am trying to use ctypes to share a C++ object with Python. I have a C++ class called "object" and I want to create an instance of it in C++ and pass the pointer out to Python via a C wrapper. Later, I want to be able to use the functions of this object in Python, such as "do_something()". However, when I try to run t...
glaive
You are tasked with creating a program that allows the user to open an HTML file, parse its content, and display the text in a memo. Your program should include the following features: - A form with a panel, an edit box, a browse button, an open button, and a memo. - When the browse button is clicked, the user should ...
glaive
How can I check if a given binary tree is balanced?
glaive