instruction_seed stringlengths 29 40.5k | source stringclasses 6
values |
|---|---|
Create a procedure in Scheme that takes two parameters, a and b, and returns the sum of a and the absolute value of b if b is positive, or their difference if b is not. In other words, you need to implement a procedure that computes a + |b|. | glaive |
You are tasked with creating a program that can process different types of data for training or prediction. The program should be able to handle images, text snippets, documents, and relational table rows as input data for training or prediction.
Your task is to create a data structure that represents the input data f... | glaive |
You are tasked with creating a program to calculate the probability amplitudes for a quantum system with a given number of qubits and states. The program should use the provided amplitude function to calculate the probability amplitude for a given set of input parameters. Additionally, the program should use the NMaxim... | glaive |
You are tasked with implementing a shader program in GLSL for image processing. The program needs to apply a screen-space subsurface scattering (SSS) effect to a given image. The SSS effect should be applied based on the strength of the subsurface scattering at each pixel, which is obtained from a texture called source... | glaive |
You are tasked with implementing an n-bit up/down binary counter in VHDL using the following entity declaration and architecture body:
Entity declaration:
```vhdl
entity cnt_up_down is
generic(
g_CNT_WIDTH : natural := 4 -- Number of bits for counter
);
port(
clk : in std_logic; -- M... | glaive |
Is there an intermediate step in the Java compiler similar to the assembly step in C compilers? I know that Java bytecode is not machine code, but is it stored as binary or plain text? I'm curious if there is an assembler involved in the Java compilation process. | glaive |
How can I create a C++ program that compares two numbers and determines which one is greater? | glaive |
You are tasked with implementing a program in Common Lisp that includes the following books and their respective libraries:
- rtl
- rtlarr
- basic
- bits
- log
- float
- reps
- round
- add
- mult
- arith
- util
- bvecp-raw-helpers
- simple-loop-helpers
Your program should make use of the functions and operations prov... | glaive |
You are tasked with designing a SpiRegister module in Verilog, which will act as a serial-to-parallel and parallel-to-serial shift register. The module should have the following inputs:
- clock: the clock signal
- shift_clock: the shift clock signal
- reset: the reset signal
- enable: the enable signal
- serial_in: the... | glaive |
You are tasked with creating a Parameter class in VB.NET that supports string and integer parameters. The class should have the following features:
1. A constructor that takes the parameter name, default value, and type (string or integer) as input and sets the default value and type accordingly.
2. Properties for Name... | glaive |
You are required to create a tibble from a CSV file and then manipulate the data using dplyr to filter, mutate, select, group by, and summarize certain fields. After the data manipulation, the tibble needs to be saved as an Excel file. The final step involves connecting to a SQLite database, querying the database, and ... | glaive |
What is the code to create an augmented reality Python script that can detect and classify objects in a given scene? | glaive |
:
You are tasked with implementing the physical layer of an SDRAM-Controller for an Altera DE0 Board. The entity should include the instantiation of input and output buffer components and the adjustment of timing for the board. The entity should have input ports for the base clock (clk), output clock (clkout), and rese... | glaive |
You are tasked with creating a BAT script that automates the process of building the binaries for Carla (carla.org). The script should be able to handle various arguments such as "--build", "--launch", "--clean", "--carsim", and "--chrono" to control the build process. The script should also be able to detect the Unrea... | glaive |
I am working on a Ruby on Rails application and I need to create a form for selecting references. The form should allow the user to select a specific number of references from a list of available references. The number of references that need to be selected is defined by a constant `ApplicationForm::REQUIRED_REFERENCE_... | glaive |
You are tasked with creating an XSLT stylesheet to transform XML into XHTML. The goal is to include various parameters and attributes in the stylesheet to customize the transformation process. These parameters will control aspects such as the display of admonitions, annotations, callouts, bibliographies, chunking, tabl... | glaive |
You are tasked with implementing a function that prepares buffers and performs a faulty load operation. The function should include the following steps:
1. Prepare buffers by copying data from addresses_D_ht to addresses_A_ht using a rep movsw operation.
2. Store data from addresses_WT_ht to addresses_normal_ht using r... | glaive |
You are tasked with creating a data structure to store coordinates in a multi-dimensional space. The structure should have a field for the type of coordinates being stored and a field for the actual coordinates. The coordinates should be stored as a list of lists of lists of lists of double values. Write a program to d... | glaive |
I want to create a higher-order function in my favorite language that can memoize a pure function. The function should take a pure function f as an argument and return a new function that behaves almost exactly like f, except that it only calls the original function once for every argument, stores the result internally... | glaive |
You are tasked with creating a CMake build system rule to remove specific files and directories in a project. The rule should be able to remove files and directories recursively, and it should be language-agnostic. Your task is to create a CMake function or macro that can be used to achieve this. | glaive |
You are tasked with implementing a memoization function in Python using the V1alpha1Memoize framework. The memoization function should take in a key (string) and a value and store the value in the cache. If the same key is used again, the function should return the cached value instead of recalculating it.
Write a Pyt... | glaive |
You are tasked with creating an XSLT stylesheet to transform XML data into HTML. The XML data represents documentation for a software API, and you need to create the appropriate HTML output to display the documentation on a web page. The HTML output should include headers, meta tags, links to external resources, and a ... | glaive |
You are tasked with creating a test for a Ruby on Rails application using the ActiveSupport testing framework. The goal is to write a test that checks the functionality of a category feature in the application. The specific test to be implemented is to validate the truthiness of a certain aspect of the category feature... | glaive |
You are tasked with creating a Ruby program that utilizes the Todoist API to manage projects. Your program should be able to perform the following operations:
1. Retrieve a list of projects
2. Archive and unarchive projects
3. Update the details of a project, such as its name and indentation level
4. Update the order a... | glaive |
You are tasked with creating a PHP script to fetch and display the total quantity of assets from different categories in a dashboard. The categories include kantor (office), kelas (classroom), aula (hall), and lab (laboratory). Additionally, the script needs to retrieve the latest 4 entries from the "latest_aset" table... | glaive |
How can I combine multiple filter fields into one in Active Admin using the meta_search gem? I want to be able to search for Promos that contain a specific search string in either the name or the full address. My Promo model already has a named scope called "by_name_or_full_address" that allows me to search for records... | glaive |
You are tasked with implementing a flash controller scoreboard in a hardware verification environment using SystemVerilog and UVM. The scoreboard needs to handle incoming transactions from TL agents and perform various checks on the data integrity.
Specifically, you need to:
- Create local variables and TLM agent fifo... | glaive |
Is there a way to generate a query that will delete all the records from the 'users' table in MySQL where the 'name' field contains the string 'John'? | glaive |
You are tasked with creating a Kotlin DAO (Data Access Object) for a database table called "nrcsspp" and a virtual table called "nrcsspp_fts". The DAO should include methods to insert rows into the "nrcsspp" table, retrieve all rows from the "nrcsspp" table, rebuild the "nrcsspp_fts" virtual table, and search for speci... | glaive |
You are tasked with writing a program that calculates the remainder when the product of two numbers is divided by another number. Your program should take three inputs, representing the two numbers to be multiplied and the number by which the product should be divided. The program should then output the remainder of th... | glaive |
Can an AI generate an algorithm in Java to print a pyramid of stars? | glaive |
Is there a way to implement a random number generator in C++ that generates a random number within a specific range? | glaive |
I am currently working on building a `foo.h` and `foo.c` file using the following command:
```
$ clang -I . -dynamiclib \
-undefined dynamic_lookup \
-o foo.dylib foo.c
```
I am able to use this library in other C libraries by compiling them like this:
```
clang -I . -dynamiclib \
-undefined dynamic_lookup \
... | glaive |
How can I determine if a string contains any letters from the alphabet using pure Python? For instance, given the strings "(555).555-5555" and "(555) 555 - 5555 ext. 5555", the function should return False for the first string as it contains no alphabetic characters and True for the second string as it does contain alp... | glaive |
I am trying to implement a logging feature for connections in Erlang using the common test module. The logging should capture open, close, send, receive, and termination actions for each connection. The conn_mod() module must log by calling error_logger:info_report(ConnLogInfo, Data), where ConnLogInfo can be #conn_log... | glaive |
You are tasked with creating a Styled Layer Descriptor (SLD) for a specific point feature in a geospatial application. The SLD should define the styling properties for the point, including its shape, color, and size. The SLD should be written in XML and must adhere to the specified schema and namespaces. Your task is t... | glaive |
You are tasked with creating a HTTPClient class in Java for making GET and POST requests to a server. The class should have two static methods: get and post. The get method should take in a server URL and a credentials string, and should return a Response object containing the HTTP status code and the response body. Th... | glaive |
I'm trying to compile a project from GitHub that includes some assembly files written for the ARMv8 AArch64 architecture. However, when I attempt to compile these files, I encounter errors on almost every line. The error message starts with "authenc_ac_gcm_low.S: Assembler messages:". Here is a snippet of the error mes... | glaive |
How can I implement a decision tree classifier in Java to classify the sentiment of a given tweet? | glaive |
You are tasked with creating a program that manipulates and organizes data in a specific format. The program should be able to handle a data structure representing a folder, which contains various properties such as id, modelName, mvc, name, children, filterType, folderName, isDefaultView, and localisedFolderName. The ... | glaive |
You are required to implement a C++ template function that generates a boolean trace. The function should take in a struct TracePropSTR as input, along with a boolean parameter 'overlapping', a boolean parameter 'random', and a vector of pairs of double values. The function should generate a boolean trace based on the ... | glaive |
I am working on a project where I need to delete a file in my C++ program. Can someone help me understand how to remove a file using the file system library in C++? | glaive |
I'm trying to create an assembly function called `power(a, b)` that is based on the following C code:
```c
int power(int x, int y)
{
int z;
z = 1;
while (y > 0) {
if ((y % 2) == 1) {
y = y - 1;
z = z * x;
} else {
y = y / 2;
x = x * x;
... | glaive |
You are tasked with creating a program that accesses a specific model name and returns a corresponding tag. The model name is stored as a string value, and the tag associated with it should be retrieved and displayed as the output.
Write a function or method that takes the model name as input and returns the correspon... | glaive |
I have a multi-module project with a parent POM. The parent POM looks like this:
```xml
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_... | glaive |
You are tasked with creating a program that takes a CSV file as input and converts it to an HTML file. The program should be designed to automatically redo the conversion whenever the CSV file is modified.
Create a script or program that monitors the CSV file for changes and automatically updates the HTML file with th... | glaive |
You are tasked with designing an architecture for a system that includes a MuxSSD component. The MuxSSD component has certain input and output ports, and you need to define the ENTITY and ARCHITECTURE for this system using VHDL. The system should have specific attributes and components, as well as signal assignments an... | glaive |
You are tasked with creating a CMake script to install the cppzmq library from GitHub using vcpkg. The script should fetch the library from the specified repository and reference, configure the build options, and install the library with the necessary cmake fixes. Additionally, the script should handle copyright inform... | glaive |
I need to create a SPARQL query to insert data into a RDF graph. I have a set of triples that I want to add to the graph, where each triple consists of a subject, predicate, and object. Can someone provide a sample SPARQL query to achieve this? | glaive |
You are tasked with implementing a GPU kernel for computing autocorrelation in C++ using the Thrust library. The goal is to create a function that can extract the x, y, and z coordinates from a given array, and then compute the autocorrelation of the data. The function should take in a set of float or integer data for ... | glaive |
How can I write a C# program to print the prime numbers between 1 and 100? | glaive |
I need to create a PowerShell function called Get-Uptime that returns the system uptime in two different formats. The first format should return a TimeSpan object representing the uptime, and the second format should return a DateTime object representing the time since the system was last booted. Additionally, the func... | glaive |
Rail Fence Cipher is a transposition cipher that encrypts and decrypts a message by rearranging the characters in a zigzag pattern.
You need to implement a function encrypt-message that takes a message and a key as input and applies the Rail Fence Cipher encryption. The message consists of only word characters and bl... | glaive |
Can you provide an example of a PHP program that accesses a database to list the products in alphabetical order? | glaive |
I am trying to implement an editor using the SOLOv2 and Reconstructor models for image editing. I am facing difficulties in training the model and evaluating its performance. I need to create a script that can train the model using the given dataset and evaluate its performance. Additionally, I need to visualize the ou... | glaive |
I am working on a project using the cl-quil library and I need to create a new system for Quil language extensions for pulse level quantum control. I want to define a new system called "cl-quil/quilt" that will include the following components: package, ast, parser, waveform, analysis, and cl-quilt. The system should a... | glaive |
I am working on a robotics project and need to create a service to stop the robot's movement and return a result value. I want to define a message type and service type to achieve this. Can someone help me create a custom message and service in ROS (Robot Operating System) using the Kinova_msgs package in Common Lisp? | glaive |
You are tasked with creating a program that utilizes NVIDIA Management Library (NVML) to modify and report application clocks on an NVIDIA GPU. The program should be able to determine the NVML Device Id of the currently active CUDA device and set application clocks for matrix multiplication.
Your task is to write a pr... | glaive |
I was exploring Kubernetes in Minikube and successfully deployed a Spring Boot application into Kubernetes. I am now experimenting with Kubernetes configMap and have managed to run a Spring Boot application with a Spring Cloud Starter that retrieves property keys from the configMap. However, I am currently facing an is... | glaive |
You are tasked with setting up `evil` bindings for `sh-script`. This involves defining a function to set `evil-shift-width` according to `sh-basic-offset`, as well as setting up key bindings for `sh-script` in `evil-collection`. Your task is to write a function that accomplishes this and ensures that the `evil` binding... | glaive |
You are tasked with implementing a function in a file system class that can retrieve the parent directory of a given file handler. The function should take a file handler as input and return the parent directory of the file. Assume that the file system class has a method containingDirectory that can be used to retrieve... | glaive |
I am trying to refactor my PHP code to use union types where possible. I have a class method, function, closure, or arrow function, and I want to change the docs types to union types where possible. For example, I want to change the code from:
```
class SomeClass
{
/**
* @param array|int $number
* @retur... | glaive |
I have this SQL query that I'm trying to convert into LINQ. Can someone help me with the conversion?
```sql
SELECT D.ID
FROM Documents AS D
INNER JOIN DocClasses AS DC WITH (NOLOCK)
ON D.DocClass = DC.ID
INNER JOIN DocSubClasses AS DSC WITH (NOLOCK)
ON D.DocSubClass = DSC.ID AND DSC.DocClassID = DC.ID
INNER JOIN Do... | glaive |
I am trying to create a program that allows users to enter a submodule by pressing a specific shortcut key and then selecting the desired submodule. The program should provide a help string for guidance and output the selected submodule to the designated location. Additionally, the program should be able to handle mult... | glaive |
You are tasked with writing a shell script that sets platform variables and performs various configurations based on hardware and platform type. The script needs to set the appropriate LCD density based on the width of the display, create symbolic links to specific keyboard configuration files, and handle permissions f... | glaive |
:
You are tasked with writing a Python script to read in a set of input files, optimize them, map macros, pack, place, route, and then generate a report on the area of the resulting design. The input files include a device file named "eagle_s20.db" with the package "BG256", a Verilog file named "full.v" with the top mo... | glaive |
You are tasked with implementing a function that uses asynchronous programming to perform a DNS lookup and return the IP addresses associated with a given host name or address. The function should use the TcpClient type with the AsyncConnent member to establish a connection with the specified endpoint. Once the connect... | glaive |
I'm optimizing some slow transactions in our Rails application and a I see significant time spent rendering JSON views. Assuming that the API call is returning exactly the data it needs to return, what is the fastest way to render JSON in Rails? We are using Rabl because of the ability to share code easily, but we aren... | glaive |
I am working on a C++ project where I need to integrate the Qt5Core and Qt5Widgets libraries and also include the Google Test Framework for unit testing. However, I am facing issues in setting up the Google Test Framework and linking it with my code. I have tried adding the necessary find_package and add_definitions in... | glaive |
I am working on a graph representation in Java and I need to convert an existing node to a switch node in the graph. Can someone help me create a SwitchConverter class that will allow me to achieve this? The SwitchConverter class should have the following functionalities:
- A method to create a new switch node based on... | glaive |
You are tasked with implementing a function that performs Ordinary Least Squares (OLS) regression using the given input parameters. The function should take a numeric matrix `x`, a numeric vector `y`, a boolean `fit_intercept`, a boolean `normalize_input`, and an integer `algo`. The function should then fit the OLS mod... | glaive |
How can I use the mobile pattern design to improve the appearance of this webpage? | glaive |
Create a function that takes in a file containing Ethereum block data and parses it to extract the transactions. The function should be able to parse both RLP and JSON block data, and then perform specific tests on the parsed transactions to ensure their correctness. The tests should include checking the number of pars... | glaive |
You are tasked with implementing a function to perform multiplication of floating-point numbers, specifically targeting the IEEE-754 standard. The function should handle different floating-point precisions (32-bit, 64-bit, and 128-bit) and abide by the standard's rules for handling special cases such as zero, denormal,... | glaive |
How can I refine the JavaScript code provided below to generate an accumulated total from all numeric entities in the digit range of 0 to 10, including extreme values?
```javascript
function sum_(start, end) {
// TODO: Complete this section
return 0;
}
``` | glaive |
You are working on a project that requires generating release notes for your GitHub repository. You need to create a script that will use the GitHubReleaseNotes tool to generate release notes in a Markdown file. The script should skip empty releases and exclude certain labels (question, invalid, doc, help-wanted) from ... | glaive |
You are tasked with creating a form validation using jQuery validation plugin. The form contains the following fields:
- 'detail-lesson': A required field, with custom validation 'VldHtml' and a remote validation to check for duplicate lesson detail name.
- 'name': A required field, with custom validation 'VldHtml'.
- ... | glaive |
I need to create a function that constructs a linear interpolation matrix A, such that A(x)*I(:) = linearInter(I,domain,x). The input parameters for the function are:
- domain: description of the computational domain
- m: discretization size of the image
- x: interpolation points
The function should output the linear ... | glaive |
You are tasked with creating a Python class that interacts with a NetlinkManagerService using Thrift. The class should be able to establish a connection with the service, send and receive data, and close the connection when done. The class should have the following features:
- Initialize with the host and an optional p... | glaive |
I am working on a project where I need to securely store and transfer sensitive data using encryption. I have a requirement to encode the data using Base64 and then encrypt it using AES encryption with a given key. I need a program that takes a plaintext string, encodes it in Base64, encrypts it using AES with a given ... | glaive |
You are tasked with writing a program to process and analyze a set of data. The data consists of five columns: X, Y, TStamp, Pres., and EndPts. The data size is given as 230. Your program needs to read this data and perform the following tasks:
1. Calculate the average value of the "X" column.
2. Find the maximum valu... | glaive |
You are tasked with creating a program that handles the deletion of a specified interface within a given realm. The program should accept input for the realm name, interface name, and interface major version. Additionally, it should provide an option to perform the deletion as an asynchronous operation. Your task is to... | glaive |
You are tasked with implementing a function that takes in a GameRequest object and returns a SmallRequest object. The input GameRequest contains information about the game, such as the turn number, board dimensions, food locations, hazards, and the details of the player's own battlesnake and other snakes on the board. ... | glaive |
You are tasked with writing a program to configure settings and parameters for a machine learning model using a specific programming language or tool. The program should set filenames for input and output, define the data source and partition file, specify penalties for missing values, and configure various settings re... | glaive |
You are tasked with creating a shader program that takes in two input vectors: fragColor and selected. If the x component of the selected vector is equal to 1, the output color should be (1.0, 0.55, 0.0, 1.0). Otherwise, the output color should be (1, 1, 1, 1). | glaive |
I am trying to implement a memory management system in my programming project, but I am having trouble with the memory operations. I need to be able to clear memory, load data from memory, and store data into memory in a specific way. Can someone provide a solution to implement these memory operations in a programming ... | glaive |
I've been reading up on how to use MySQL insert on duplicate key to see if it will allow me to avoid Selecting a row, checking if it exists, and then either inserting or updating. As I've read the documentation however, there is one area that confuses me. This is what the documentation says:
"If you specify ON DUPLICA... | glaive |
You are tasked with creating a C++ program that involves defining and using several different data structures. Your program should include the following structs:
1. OldSchool: This struct should have three fields - im_int (of type i16), im_str (of type string), and im_big (of type list of maps with keys of type i32 an... | glaive |
You are tasked with creating a CMake file for a project that involves compiling assembly language code. Your project requires implicit dependencies for the ASM language, and you need to define the set of files for implicit dependencies, the preprocessor definitions, include file search paths, and the targets to which t... | glaive |
I'm currently working on a Rails project and I have a custom validation that I want to apply only when creating a new record, not when updating an existing one. However, whenever I perform a find followed by a save, Rails treats it as a create action and runs the custom validation. Is there a way to make the validation... | glaive |
You are tasked with creating a program to simulate a series of coin tosses and record the outcome of each toss. Additionally, the program should also record the outcome of a second coin toss, as well as the income earned at each toss. The income follows a Bernoulli distribution. Your task is to write a program that tak... | glaive |
I'm new to assembly language and I'm struggling to understand what is happening with this program I am writing. The goal of the program is to prompt the user to enter a number between 0 and 9. It then checks if this number is a multiple of 3. If an incorrect character (e.g., 'Z') is entered, it should display '**' next... | glaive |
You are tasked with implementing a program to build the Burrows-Wheeler Transform (BWT) of a given input sequence. The BWT is a reversible transformation of a string that rearranges the symbols so that it becomes easier to compress. Your task is to write a program that takes an input sequence, counts the base pairs, an... | glaive |
How can I create a program that allows a user to search the content of a specific website? | glaive |
You are working on a software development project and need to follow a specific Git workflow when interacting with the GitHub repository. Your task is to create a feature branch for active development, add new development on the feature branch, update your feature branch with the main repository, and create a pull requ... | glaive |
You are required to create a program that calculates the probability of a quantum state for a given set of variables. The program should be able to find the maximum value of the probability and display it along with the name of the quantum state. Additionally, the program should generate a 3D plot and a contour plot fo... | glaive |
You are tasked with creating a strongly-typed resource class in Visual Basic for looking up localized strings. The class should be able to return the cached ResourceManager instance used by the class, and override the current thread's CurrentUICulture property for all resource lookups using this strongly typed resource... | glaive |
You are tasked with creating a script to start a mining process using the Geth client in a local blockchain network. The script should be able to connect to the Geth client running on localhost at port 11001 and initiate the mining process with a specified number of threads. | glaive |
I have a three-dimensional array in R, and I need to find the position and value of the maximum value in the array. The array is defined as follows:
```R
%let ary=%str(array(c(1:3,9,5:8), dim=c(2,2,2)));
```
I want to find the maximum value in the array and its position in the form of (dim1, dim2, dim3). | glaive |
You are working on a project that involves generating code from a template using a specific language and version. You need to create a generator alias with the given namespace and UUID, and define the model root content path and source root location. Additionally, you need to specify the language versions and dependenc... | glaive |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.