instruction_seed stringlengths 29 40.5k | source stringclasses 6
values |
|---|---|
I am trying to find the include directory for the CUTLASS library in my C++ project. I want to define the CUTLASS_FOUND variable as true if CUTLASS has been found, and the CUTLASS_INCLUDE_DIR variable as the location where the CUTLASS.hpp can be found. I have already tried using the find_path and find_package_handle_st... | glaive |
You are tasked with creating a C++ method that creates a collection of calling cards associated with a given address. The method should be called getCallingCards and should take in a pointer to a VARIANT containing an ITCollection of ITCallingCard interface pointers. The method should return S_OK if it succeeds, E_POIN... | glaive |
How can I generate JavaScript code to search for a specific element in an array? | glaive |
I need to write a procedure AddPriv in assembly language that adds a new privilege to a given data structure. The procedure should locate the privilege data structure within the system's kernel and set a specific value to indicate the addition of the privilege.
Can someone provide a complete implementation of the AddP... | glaive |
I'm compiling this C source with OpenWatcom V2 `wcc`:
```c
/* Writes a '\0'-terminated string to the file descriptor. */
static void fdputs(int fd, const char *s);
#pragma aux fdputs = \
"push si" \
"mov cx, -1" \
"repz scasb" \
"neg cx" \
"inc cx" /* now cx is the number of bytes to write */ \
"pop dx" /* now dx po... | glaive |
You are tasked with implementing a raymarching shader in GLSL (OpenGL Shading Language) to render a 3D scene. The scene consists of a background texture and a cube object. The cube object is defined by the `cube` function, which calculates the distance from a point to the surface of the cube. You will also need to impl... | glaive |
I am working with Elasticsearch in my Scala project and I need to create a missing aggregation for a specific field. Can someone help me write a Scala code to define a missing aggregation for Elasticsearch using the elastic4s library? I need to be able to specify the name of the aggregation and the field for which I wa... | glaive |
I'm currently trying to use a PriorityQueue of pair[double,pair[int,int]] in Cython and I want to sort it based on the first element of the pair (the double). However, I'm having trouble implementing it. Can someone help me with this?
The error I'm getting is: "error C2955: 'cpp_pq': use of alias template requires tem... | glaive |
I am working on building a random forest model using R for predicting age from marker gene expression. I have a dataset with 61 markers, and I want to examine the contribution of each marker and then make progressive additional models using fewer and fewer markers. The parameters I'm considering are ntree (number of tr... | glaive |
You are tasked with implementing a Fortran subroutine to calculate empirical correlation between orbit parameters. The subroutine should take in an input matrix `Xmatrix`, and arrays `Bias_0` and `CPR_0` representing bias parameters acceleration apriori values and cycle per revolution parameters apriori values, respect... | glaive |
You are tasked with creating a WebSharper Sitelet that serves a single content value at a given location. Your task is to implement a function that takes a location, an endpoint, and a handler function to serve the content.
Your function should create a WebSharper Sitelet using the given router and handler function, a... | glaive |
How can I customize a React Component to accept and display any model object passed in as a prop? | glaive |
You are tasked with creating a React Native app that generates a math game. The game should display a random combination of numbers and mathematical operators, and the player's goal is to rearrange the operators to form a valid mathematical expression that equals the displayed number. The game should provide feedback t... | glaive |
How can I generate a SQL query to retrieve a list of all orders placed during the last two months that contain at least two items? | glaive |
You are tasked with creating a program to run the query portion of the PCORnet Data Characterization Query Package v3.04. The program will take inputs of PCORnet CDM v3.0 SAS data stores (datasets or views) and the SAS program "/infolder/data_characterization_query.sas". After running the query, the program should prod... | glaive |
I want to develop a React Native application that fetches the latest exchange rates from the European Central Bank and displays them to the user. How can I achieve this? | glaive |
I'm trying to create an interface similar to `http.Handler`. For certain endpoints of my API, I need an APNS token included in the query or I need to respond with `http.StatusBadRequest`.
I have a type called `DeviceHandlerFunc` that implements `ServeHTTP(http.ResponseWriter, *http.Request)` and automatically parses t... | glaive |
I am trying to create a virtual environment in Python using csh shell, and I want to set up an alias to activate and deactivate it. However, I am encountering some issues with the code provided. Can someone please help me write a csh script to properly set up a virtual environment and alias to activate and deactivate i... | glaive |
You are tasked with implementing a configuration setup function for a plugin. The setup function should handle both global and buffer-specific configurations. The global configuration should be applied when no buffer number is provided, while the buffer-specific configuration should be applied when a buffer number is p... | glaive |
You are working on a C++ project using CMake and need to handle implicit dependencies, preprocessor definitions, include file search paths, and linked info files for your target. You need to set up these configurations for your project to ensure smooth compilation and linking. Create the necessary CMakeLists.txt file w... | glaive |
I want to automate the installation of various software packages on Windows using PowerShell. I have a list of packages with their respective Chocolatey package IDs, installed application names, and versions. I need to check if the packages are already installed, and if not, install them from the Chocolatey package rep... | glaive |
I am trying to implement the `kill` system call in my Rust module, which allows sending a signal to a process. However, I am struggling to properly implement the `try_kill` and `send_signal` functions. These functions should send a signal to a specified process ID (`pid`) with a given signal (`sig`) and ensure proper e... | glaive |
I am trying to set up a Dockerized environment for my application using docker-compose. I have multiple services like app, broker, worker, and flower that need to be managed separately. I want to write a Makefile that includes targets for building the Docker images, running the containers, bringing up the services, and... | glaive |
I have a Golang server alongside a Postgres instance running inside Docker Compose. For some reason, Postgres is refusing the connection. I have checked for typos, made sure that the port is exposed, and disabled SSL, but I am still experiencing this issue. Here is my Docker Compose file:
```yaml
version: "3.2"
servic... | glaive |
You are tasked with creating a program that manages audio files for a game. The program should be able to store and retrieve information about each audio file, including the model name, version, name, audio group GUID, bit depth, bit rate, kind, whether it should be preloaded, sample rate, type, and volume. Additionall... | glaive |
I'm trying to design a program that can find the longest subarray of an array with the maximum sum. I want the subarray to be non-contiguous, meaning the elements should not be adjacent to each other. Can someone help me with this? | glaive |
I am working on a project that involves flashing firmware over DFU (Device Firmware Upgrade) and I need to set up the necessary environment variables for this process. Can anyone provide guidance on how to define the environment variables for DFU flashing in a CMake script for a Zephyr project without referencing the g... | glaive |
I'm attempting to generate a random floating point number between 0.1 and 1.0 in Python. However, I can't use `rand.randint` because it only returns integers. I've tried using `random.uniform(0.1,1.0)`, but it only returns a value greater than or equal to 0.1 and less than 1.0, which doesn't satisfy my requirements as ... | glaive |
You are tasked with creating a WaterfallRenderer in a web application using TypeScript. The WaterfallRenderer is responsible for rendering a visualization of waterfall data. The visualization is based on a set of parameters including the number of grams, length of each gram, width of the tile, latest data, color palett... | glaive |
You are tasked with implementing a register in Rust for enabling OUT endpoints in a USB device. The register has fields for enabling OUT endpoints 0-7 and an additional field for enabling ISO OUT endpoint 8. Each OUT endpoint can be enabled or disabled, and the default value for each endpoint is 0 (disabled). Your task... | glaive |
You are tasked with creating a CMake build system rule to remove specific files and directories from the project directory. The rule needs to remove the following items:
- "CMakeFiles/TCP.dir/main.cpp.o"
- "TCP"
- "TCP.pdb"
Additionally, you need to include per-language clean rules from dependency scanning for the C++ ... | glaive |
<p>Why is BCD encoding used in programming? It seems wasteful to use 4 bits to represent numbers greater than 9. Does this encoding have historical or architectural reasons? Additionally, does x86 architecture only support addition and subtraction directly?</p> | glaive |
You are tasked with creating a module for defining and proving inductive definitions in a programming language. This module should include the following functionalities:
- Define a type monoset, which is a list of pairs of strings and theorems
- Provide a function bool_monoset to create a monoset
- Implement functions ... | glaive |
How can I write a function that finds the maximum value in a given list of numbers using Python? | glaive |
You are tasked with creating a program that retrieves the paralogs of a specific protein using a SPARQL query. The program should take a protein ID as input and then use the SPARQL query to retrieve the paralog proteins along with their corresponding OMA links. The SPARQL query should filter the results based on the in... | glaive |
You are tasked with creating a custom Emacs command using the Helm package. The command should be a replacement for the regular `M-x` `execute-extended-command` function. The new command should be named `helm-M-x` and should be preconfigured to use the Helm interface for displaying and executing Emacs commands.
The `... | glaive |
Can someone provide a solution in Java to rotate a 2D matrix 90 degrees clockwise? | glaive |
You are tasked with creating a new protobuf message definition for a blockchain application. The message should be named "NewMessage" and should contain the following fields:
1. An integer field named "id" representing the unique identifier of the message.
2. A string field named "body" representing the content of the ... | glaive |
How can I create a Flask application that displays a connection status page which updates when a user connects to or disconnects from a website? | glaive |
You are required to implement a CUDA program that performs the matrix-matrix operation
C := alpha*op(A)*op(B) + beta*C,
where op(X) is one of
op(X) = X or op(X) = X',
alpha and beta are scalars, and A, B and C are matrices, with op( A )
an m by k matrix, op(B) a k by n matrix and C an m by n matrix.
The code should ... | glaive |
You are tasked with creating a Tcl script to generate and execute a synthesis run for Vivado. The script should be able to handle the synthesis process, including creating a project, setting parameters, updating IP catalog, and generating checkpoint/stub/simulation files for IP cache. Additionally, the script should be... | glaive |
You are tasked with creating a script to automate the rebuilding, copying, and packaging of a software application. The script should perform the following tasks:
1. Rebuild the software application using Microsoft Visual Studio (VS) tools.
2. Copy the built executable files and documentation to a designated directory.... | glaive |
You are tasked with creating a program that implements an Object-Relational Mapping (ORM) system to map data from a relational database to objects in your programming language of choice. The program should have a message class called "Entry" with two required fields: Key and Val. You need to write a function that can r... | glaive |
You are tasked with creating a Python script that logs information and handles exceptions. Your script should be able to run in two modes: GUI mode and CLI mode. In GUI mode, it should log to a file and handle unexpected errors by displaying an alert and saving the log. In CLI mode, it should parse command line argumen... | glaive |
I am working on a project in Microsoft Visual Studio and I need to automate the process of opening a specific solution file using the command line. Can someone help me write a script or program that will allow me to specify the path to the solution file and have it open in Visual Studio using the command line? | glaive |
I am trying to create a parser for CSV files using the Lean programming language. I want to define a function that takes a string representing the CSV data and parses it into an array of arrays of strings. The CSV format follows the RFC4180 standard, with fields separated by commas and records separated by CRLF (carria... | glaive |
I have a code snippet that is giving me syntax errors. Can someone help me edit it so that the errors are resolved? | glaive |
You are tasked with implementing a first-in/first-out (FIFO) memory queue generator using Verilog. The FIFO Generator is a parameterizable core that can be used to generate resource and performance optimized FIFOs with common or independent read/write clock domains. It also offers optional fixed or programmable full an... | glaive |
You are tasked with creating a database table for storing different types of purchase payments. The table should have columns for "id" and "name", and it should be set to the "public" schema. The "id" column should be a unique identifier for each payment type, and the "name" column should store the name of the payment ... | glaive |
I am trying to create a program in Clojure that calculates the sum of all the multiples of a given set of numbers up to a certain limit. The function `sum-of-multiples` should take two arguments: a vector of numbers and a limit. It should then calculate the sum of all the multiples of the numbers in the vector up to th... | glaive |
You are tasked with creating a generic function for lifting a type equipped with an instance to a bundled object. The function should take a type `α` and a type class instance for that type, and return a bundled object of type `bundled c`.
Write a function `liftTypeWithInstance` that takes a type `α` and a type class ... | glaive |
You are tasked with creating a Mix project in Elixir that utilizes the Phoenix framework. Your project should include the necessary configuration for the OTP application, as well as specify which paths to compile per environment and declare project dependencies. You should also create aliases for shortcuts or tasks spe... | glaive |
I am trying to write a program in JavaScript to read a list of files from a directory and store their names in an array. Can someone provide a function that can achieve this using Node.js? The solution should use the fs module to read the directory and retrieve the list of file names. | glaive |
I'm trying to optimize my code for future assembly implementation and reduce the number of conditional statements. Can anyone suggest a more efficient approach?
```python
if j == 18:
store = 12
elif j == 30:
store = 10
# ... and so on
else:
store = 1
``` | glaive |
You are tasked with creating a Lisp program that models a 32-bit X86 processor state. The program should define the following:
- Constants for byte, word, double, and quad sizes
- Constants for physical address and machine size
- Memory size constants in bytes, words, double words, and quad words
- Useful constants for... | glaive |
I'm reading through some assembly source code for learning purposes and came across something very strange (or I may just be a newb):
```
.ver:
mov al, [redoxfs.header + Header.version + bx]
mov ah, [.version + bx]
cmp al, ah
jne .ver_err
inc bx
jl .ver
```
In this sub-label, there are two ju... | glaive |
You are tasked with creating a function in the Luhn module that will determine whether a given string is a valid credit card number according to the Luhn algorithm. The Luhn algorithm is a simple checksum formula used to validate a variety of identification numbers, such as credit card numbers. The algorithm is as foll... | glaive |
You are tasked with creating a program to calculate the probability of a quantum state for a given set of parameters. The program should use the provided amplitude function to calculate the probability and then optimize it using the NMaximize function. Finally, the program should generate a 3D plot and a contour plot o... | glaive |
You are working on an IDF (Espressif IoT Development Framework) app and need to include a new component in the CMakeLists.txt file. The component is located in the AUDIO_BOARD_PATH environment variable, and you also need to set the IPC_DRV_PATH variable to a specific location. Additionally, you need to add multiple dir... | glaive |
I am trying to solve a delay differential equation (DDE) using the ddeint module. The DDE system is defined by the following equations:
For t < 0:
x(t) = 1 + t
y(t) = 2 - t
For t >= 0:
dx/dt = 0.5 * (1 - y(t-d))
dy/dt = -0.5 * (1 - x(t-d))
The delay "d" is a tunable parameter of the model. I want to use the ddeint m... | glaive |
You are tasked with implementing a module in Elixir to handle SQL operations for a PostgreSQL database. The module should include functions for generating SQL statements for various operations like reserving, canceling, and filtering records, as well as for checking the status of records. The module should also include... | glaive |
You are tasked with creating a Java class that will delete a firewall rule for a specified security group in Google Cloud Platform. The class should be able to handle the deletion of the firewall rule by making use of the Google Compute Engine API. The specific details for the security group, account name, and project ... | glaive |
Can you please provide an algorithm to generate a specific number of random numbers within a given range? | glaive |
I am trying to set the verbosity level for logging in a Python program using numpy. However, I am not sure how to use the `numpy.distutils.log.set_verbosity` function to achieve this. Can someone provide a clear example of how to use this function to set the verbosity level for logging in a Python program using numpy? | glaive |
You are tasked with implementing a module for testing counters in a particular programming language. The module should include various test cases for different counter scenarios, each providing a different input and expecting a specific output. The tests should cover different counter types such as system cyclic, numer... | glaive |
You are tasked with creating a Python program that utilizes the `ein`, `ein-notebook`, and `ein-subpackages` libraries to connect to a Jupyter notebook and execute a series of code cells. Your program should be able to establish a connection to the notebook, execute the code cells in the notebook, and then retrieve the... | glaive |
You are tasked with creating a custom data type "OID" in a healthcare information system using Java. The OID should be represented as a URI with the format "urn:oid:0.1.2.3.4..." and should extend the existing UriType class. Your task is to create a new class OidType that meets the following requirements:
- Define a ne... | glaive |
I am working on a project using the fancoil module for Clojure and I need to implement a method to inject a database connection and another method to perform a transaction using the posh library. Can someone provide guidance on how to implement these methods using the fancoil.base and posh.reagent namespaces? | glaive |
You are tasked with implementing a function that handles various types of commands in a server environment. The function takes in a server environment, an environment, a boolean flag 'is_stale', and a command of type 'a'. The command can be one of the following:
- STATUS: Returns the status of the server, including the... | glaive |
I am trying to create a program that can perform a generalized linear regression using a Bernoulli distribution. I have a dataset with k independent variables and n observations. The independent variables are stored in a matrix X, and the dependent variable is stored in a vector y. I need to use the Stan programming la... | glaive |
You are tasked with writing a script that takes in a file, target coordinates, and sensor coordinates as arguments. The script should draw bounding boxes on the input file using the given target and sensor coordinates, and then output the resulting image. If the output is successful, the script should also display the ... | glaive |
What is the code for generating a program that retrieves the current weather based on a given zipcode using the OpenWeatherMap API? | glaive |
What is a Python code that can be used to merge two given sorted lists into a new sorted list? | glaive |
You are tasked with creating a new Parser struct for the texttemplate package in Go. The Parser should have a method called Parse which takes in a byte slice dataBs and a string associatedName, and returns a pointer to a NodeRoot and an error. The Parse method should parse the byte slice dataBs and return a NodeRoot co... | glaive |
You are required to implement a payment service using C#. The service should include the following functionalities:
1. Get payment summary for a user.
2. Get payment list by status, where the status, offset, and limit are provided as input.
3. Get payment detail for a specific payment id.
4. Confirm payments for a list... | glaive |
You are tasked with writing a script to automate the simulation of a Quartus project. The script should compile the Quartus EDA simulation library and the Quartus-generated IP, as well as all design and testbench files. Additionally, it should elaborate the top-level design and run the simulation.
Write a top-level sc... | glaive |
You are tasked with creating a scoreboard management system for a gaming server. The system should allow for the addition, removal, and reordering of columns in the scoreboard, as well as the ability to set forced visibility for teams and sort columns based on certain criteria.
Your task is to create a function `score... | glaive |
You are tasked with creating a simulation model for a Sine Integral Signal using the given XML template. The model should include the following blocks:
- SineWaveGenerator: A block that generates a sine wave signal with parameters M, F, P, offs, and externalActivation.
- Mux: A block that combines multiple input signal... | glaive |
Can an AI generate a code in R to predict the number of fraudulent cases from a given data set? | glaive |
I am trying to create a user settings controller in an Angular module for my web application. I want to implement several functions such as checking if the user is signed in, checking for connected social accounts, removing a user social account, updating user profile, and changing user password. However, I am having t... | glaive |
I am trying to install Rails 3 on my new MacBook Pro with OS X 10.6.3, Ruby 1.8.7, and Rails 2.3.5. I have already updated the gem system and installed some necessary gems. However, when I try to install Rails using "gem install rails --pre", I receive the following error message:
ERROR: While executing gem ... (Gem::... | glaive |
I am trying to execute the given code, but it seems to be incomplete and not working as expected. Can someone please help me modify it so that it becomes an executable program? | glaive |
You are tasked with creating a makefile for a project that includes optional arguments and targets. The makefile should support the following optional arguments:
- CONGFS_DEBUG=1: Enables debug information and symbols.
- CXX=<compiler>: Specifies a c++ compiler.
- CONGFS_COMMON_PATH=<path>: Path to the common directory... | glaive |
You are tasked with writing a WebGL shader program that takes in vertex data and outputs interpolated texture coordinates for each fragment. The input vertex data is unique for each execution of the shader.
Write a shader program that accomplishes the following:
- Takes in vertex data using the attribute variable `a_v... | glaive |
You are tasked with implementing a FIFO (First-In-First-Out) queue using the BeriUGBypassFIFOF module in the following code snippet framework. The goal is to create a test module to simulate simple enqueue and dequeue operations, as well as single-cycle enqueue and dequeue operations. Your task is to write the code for... | glaive |
You are tasked with creating a function that takes in a string as input and returns the number of vowels (a, e, i, o, u) in the string. You should ignore case sensitivity, meaning both uppercase and lowercase vowels should be counted. Implement the function in JavaScript using the given code snippet. | glaive |
You are tasked with creating an Emacs-lisp function to customize the "dotspacemacs-themes" variable and setting up a list of themes for Spacemacs startup. The function should modify the variable values and store them in the user's home directory. The function must also ensure that the startup banner displays an officia... | glaive |
I am working on a CUDA program and I need to generate random numbers in parallel using the cuRAND library. However, I am encountering issues with the current implementation. I need to create a kernel function that takes in a curandStateMtgp32_t pointer and a float pointer, and then uses the curand function to generate ... | glaive |
You are tasked with implementing a C/C++ function that calculates the minimum of two input values. The function should be named "min" and should take two parameters, A and B, and return the minimum of the two values. | glaive |
I am trying to visualize the sin, cos, and tan functions on the same plot using matplotlib. The range of x values I want to use is from 0 to 2π. Can someone please help me with the code to achieve this? Additionally, I would like to include gridlines and legends in my plot to make it more informative. The legends shoul... | glaive |
You are tasked with writing a CMake script to find the GLEW library on a system. The script should define the following variables:
- GLEW_FOUND: a flag indicating whether the GLEW library is found
- GLEW_INCLUDE_DIRS: the include directories for GLEW
- GLEW_LIBRARIES: the libraries needed to use GLEW
- GLEW_DEFINITIONS... | glaive |
I am working on a project in CMake and I need to write a clean rule to remove specific files and directories. Can someone provide guidance on how to write a CMake clean rule to remove specific files and directories using the file(REMOVE_RECURSE) command? | glaive |
I am trying to import a list of subcubic 3-cop win graphs from a website, but I am encountering an issue with the import function. The website URL contains a dynamic parameter "n" which represents the number of vertices in the graph. I want to create a function that takes in the number of vertices "n" as input and retu... | glaive |
I am working on a web development project and need to create a CSS layout that involves positioning elements using z-index. I have a background element with the class "background" and a foreground element with the class "foreground". I need the foreground element to be positioned on top of the background element using ... | glaive |
You are tasked with creating a Rust program that utilizes typesafe wrappers around the /pkgfs/ctl filesystem. You need to implement a client that can perform garbage collection and syncing operations on the pkgfs. The client should be able to connect to pkgfs from the current component's namespace or from a given pkgfs... | glaive |
You are tasked with creating a batch file that runs a specific test in a Visual Studio test suite. The test to be run is named "Microsoft.Protocols.TestSuites.MS_OXCROPS.S05_TransportROPs.MSOXCROPS_S05_TC06_TestRopSpoolerLockMessage" and is located in the "MS-OXCROPS_TestSuite.dll" file in the "Debug" folder. The batch... | glaive |
You are tasked with managing a C++ project using CMake and need to incorporate an external project called "BAR" into your build process. The project "BAR" has its source code located in the current directory and needs to run a test command "echo test" as part of the build process. Additionally, you need to add step tar... | glaive |
You are tasked with creating a C++ program that requires the use of implicit dependencies for certain languages and files. The program should be able to specify the set of languages for which implicit dependencies are needed, as well as the set of files for implicit dependencies of each language. Additionally, you need... | glaive |
You are tasked with implementing the DLARRE subroutine, which is used to find the desired eigenvalues of a given real symmetric tridiagonal matrix. The subroutine sets any "small" off-diagonal elements to zero and finds base representations and eigenvalues for each unreduced block of the matrix. The accuracy of the eig... | glaive |
You are tasked with creating a program that will display a log of activities happening at a certain level of a system. The program should be able to retrieve the model name of the system and display it in the log.
Create a function or method that can retrieve and display the activities happening at the specified level... | glaive |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.