instruction_seed
stringlengths
29
40.5k
source
stringclasses
6 values
You are tasked with creating a class in Kotlin that represents a simple electrical component with two nodes, also known as a "Port". The Port class should uphold the Port Condition, where the current into one node is equal to the current out of the other node. The class should have the following requirements: - The cla...
glaive
You are tasked with creating a Clojure function that takes in a project and a platform and returns a set of file paths representing the resources associated with the native extensions of the project for the given platform. The project is represented as a map with various keys and values, and the platform is a string in...
glaive
You are tasked with creating a function in F# that takes in a list of integers and returns the sum of all the even numbers in the list. The function should be named "sumEvenNumbers" and should take a single parameter of type list<int>. The function should iterate through the list and add up all the even numbers, then r...
glaive
You are tasked with creating a program to model and analyze learning behaviors in a hypothetical scenario. The program will be used to estimate individual learning parameters and make predictions based on a set of input data. The program should take into account the following data: - N: The number of subjects (N > 0) ...
glaive
You are tasked with creating a simple web application using the mvc_application package as the framework. The application should include a homepage that displays a welcome message and a button to navigate to a secondary page. The secondary page should have a form with fields for a user to input their name, email, and m...
glaive
I am working on a project that involves connecting different power nets in a circuit. I need to write a program that can efficiently handle the global net connections and the I/O power nets. I also need to ensure that the Dragonphy power nets are connected with specific instances and have the ability to override certai...
glaive
I am trying to make an HTTP request to a specific endpoint called "nothing" using Elm programming language. The response from this endpoint should be empty, and I need to validate if the response body is empty. If the response body is empty, I should return a successful response with a status of NoContent. If the respo...
glaive
You are tasked with creating a formula for a new program called "fatsort" in a homebrew environment. The program can be found at 'http://fatsort.sourceforge.net/' and the source code can be downloaded from 'http://downloads.sourceforge.net/project/fatsort/fatsort-1.2.355.tar.gz'. The program has a dependency on 'help2m...
glaive
I am working on a PostgreSQL database and I need to create a view that combines data from multiple tables. The view should include specific columns from the tables "audit_case", "cmte_valid_fec_yr", and "ref_filed_cmte_tp". The data should be filtered based on certain conditions and ordered by "cmte_nm" and "fec_electi...
glaive
You are tasked with creating a protocol buffer message that represents a person's information. The message should include fields for the person's name, age, and email address. Additionally, the message should have a nested message for the person's address, which includes fields for street, city, and zip code. Your task...
glaive
You are tasked with implementing a function to sample a light source using reservoir importance sampling in a CUDA environment. The function signature should be as follows: ```c++ __device__ int sampleLightWithReservoirRIP( idaten::Reservoir& reservoir, const aten::MaterialParameter& mtrl, idaten::Context*...
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, containing various properties such as "id", "modelName", "mvc", "name", "children", "filterType", "folderName", "isDefaultView", and "localisedFol...
glaive
What are some strategies to improve the performance of the following C++ algorithm for managing arrays? ```cpp int arr[5]; for(int i=0; i<5; i++){ arr[i] = i; } ```
glaive
You are tasked with implementing a sorting function for a collection of objects based on their names. The function should take two objects as input and return the comparison result based on their names. The comparison result should be a three-way comparison, indicating whether the first object's name is less than, equa...
glaive
You are tasked with creating a dynamic notification system for a web application using jQuery and Ruby on Rails. The system should update the notifications section on the dashboard without requiring a full page reload. When a user receives a new notification, it should be displayed without interrupting the user's curre...
glaive
How can I generate a random string with a specific length in Python?
glaive
You are tasked with creating a CMake script to find the native cairo includes and library in a given system. The script should use pkg-config to get the directories and then use these values in the FIND_PATH() and FIND_LIBRARY() calls to locate the necessary files. The script should also be able to handle cases where a...
glaive
I am hosting a Flask application on Kubernetes using a Docker container, with Gunicorn managing the workers responding to API requests. I am experiencing a recurring issue where I receive a warning message stating, "[2021-03-31 16:30:31 +0200] [1] [WARNING] Worker with pid 26 was terminated due to signal 9". Despite th...
glaive
You are tasked with creating a custom Hilo series segment for a charting library. The Hilo segment is responsible for generating points and customizing the calculation of Hilo segment points. The segment should be able to handle the low and high values, calculate rendering bounds, and draw the segment within the series...
glaive
I am trying to create a CMake macro that will add a new target which is a SFML example. The macro should be able to handle different scenarios such as adding resources to the target, specifying dependencies, and setting up the target for different platforms. Can someone provide a complete implementation of this macro?
glaive
I need to delete a specific triple from a named graph in a RDF database using SPARQL. The triple I want to delete is: Subject: <http://data.lblod.info/DecisionType/d68c36802386c988df798ed577b96d8e0f010441f74628f4d2dbd3196c1c6ac3> Predicate: <http://mu.semte.ch/vocabularies/ext/decidableBy> Object: <http://data.vlaander...
glaive
You are tasked with writing a fragment shader program that takes in several uniforms and varying variables to manipulate the output fragment color. The program should include the handling of the following conditions: 1. If the CLIP_PLANE is defined, discard the fragment if v_clipDistance is less than 0.0. 2. If TEXTURE...
glaive
You are tasked with creating a SPARQL query to update the labels of certain concepts in a RDF graph. You need to DELETE the current skos:prefLabel of several concepts and INSERT new ones in their place. The concepts are identified by their URIs, and the new labels are provided in the INSERT section. Write a SPARQL quer...
glaive
I am trying to implement a function in CUDA that calculates the cross product of two tensors. I want to use the ATen library and specifically the cross_kernel_impl function. However, I'm having trouble understanding how to properly use this function and pass in the necessary arguments. Can someone provide a clear and d...
glaive
You are tasked with creating a C++ template class that defines type traits for numeric types. The traits should include information about the representation of the type (e.g., signed integer, unsigned integer, floating point, or not a number). Your class should remove any volatile/const qualifiers and should handle var...
glaive
I am trying to retrieve a specific URL for a software using a SPARQL query. The software ontology (SWO) is stored in the European Bioinformatics Institute (EBI) database. I need to find the URL of the software that is a subclass of swo:SWO_0000001 and has a property swo:SWO_0004006 with a specific value. How can I writ...
glaive
You are tasked with implementing a feature that allows users to copy, cut, and paste content within a web-based editor. However, due to browser security settings, the default copy and cut operations are not allowed to be executed automatically by the editor. Therefore, you need to implement the functionality using keyb...
glaive
I've created a Rails application with a nested routing structure, where the "Domains" controller is nested below the "Customers" controller. However, I'm encountering routing errors when running tests for the Domains controller. All the tests in the DomainsControllerTest class are failing. The error message I'm getting...
glaive
You are tasked with creating a program that converts a given number into a Roman numeral representation. The program should take an integer as input and return the corresponding Roman numeral. Your task is to implement a function or class that takes an integer as input and returns a string representing the Roman numer...
glaive
I am currently working on a project where I need to create a series of migrations. Some of these migrations involve creating or modifying tables, while others involve modifying data. I am using my ActiveRecord models to modify the data by iterating through each instance of a model and updating certain attributes. Howev...
glaive
Can you help me create a Python script that can perform sentiment analysis on a given sentence?
glaive
I am working on a ROS package and need to define the dependencies and other details in the CMakeLists.txt file. Can someone provide a complete example of how to define build, execution, and test dependencies, as well as other package details like version, maintainer, and website URL?
glaive
I am trying to build a chat application using Elm and HTML. I have already set up ports to communicate with JavaScript, and I have defined the model and update functions. However, I am struggling to implement the view function to display messages and the input field for users to send messages. Can someone help me write...
glaive
You have been tasked with creating an Erlang module for a benchmarking suite called `basho_bench_app`. The module should have the following API functions: - `start/0` to start the application - `stop/0` to stop the application - `is_running/0` to check if the application is running - `halt_or_kill/0` to either halt and...
glaive
I need to create a Bash script that will read in a file and count the number of occurrences of a specific word in the file. The script should take the word to search for as a command-line argument and then output the total count of occurrences of that word in the file.
glaive
I am trying to implement a custom logging system in my C# application using the Yaaf.AsyncTrace namespace. I want to create a new trace source with a specific name and then create a default tracer for it. However, I am not sure how to go about doing this. Can someone provide me with a step-by-step guide on how to achie...
glaive
You are tasked with implementing a module for double-extensible arrays in OCaml. The module should provide the following functionalities: - Creation of an empty array - Resizing the array to minimize memory occupancy - Adding an element at the beginning and end of the array - Retrieving the length of the array - Access...
glaive
I am trying to find a way to automatically detect and display outdated packages in a dependencies file. The goal is to create a method that can identify any outdated packages and then print out a list of the outdated packages along with their old and new versions. Can anyone provide a solution for this using the Paket...
glaive
You are tasked with creating a CMake script to find if Pythran, a Pythonic library, is installed and set variables indicating its location and version. Your script should involve calling the Python interpreter to check for the presence of Pythran and obtain its version and include directories. If Pythran is not found, ...
glaive
You are tasked with creating an XSLT stylesheet to generate C code for testing DVBPSI descriptors. The generated C code will be used to run tests on various descriptor types. Your task is to write the XSLT stylesheet that will take input from an XML description file and output the corresponding C code for testing the d...
glaive
You are tasked with creating a SPARQL query to calculate the accuracy of a machine learning model's predictions based on different types of occlusion in images. The query should identify the number of correct classifications for each occlusion type, as well as the total number of classifications, and then calculate the...
glaive
You are required to implement a function to perform the sum of multiple Compressed Sparse Row (CSR) matrices in C++ using the DGL library. The function should take in a vector of CSR matrices and a corresponding vector of weight arrays, and return the sum of the matrices and the weights. The function signature should ...
glaive
You are tasked with creating a program that calculates the area of a rectangle. Your program should take input for the length and width of the rectangle, and then output the calculated area. The program should use the `input` module to handle user input.
glaive
You are tasked with creating a class `Apage` with a `render()` function that generates an HTML page based on the provided specifications. The `render()` function should be able to handle the following requirements: - When called with no arguments, it should create a new instance of the `Main` class. - The function shou...
glaive
You are required to implement a Conjugate Gradients function in Julia, following Algorithm 2 from Scales, 1987. The function should take in an array of linear operators, along with other parameters such as the number of iterations, mu, and tolerance. The linear operators should pass the dot product. The function shoul...
glaive
Can you provide a Python program that sorts a list of students based on their grades in reverse order?
glaive
You are tasked with creating a function that performs k-medoids clustering on pooled data using a wrapper function. The function should take in the following parameters: - list_ss: a list of subjects - paths: a vector of paths for the data - sessions: the number of sessions - max_trials: the maximum number of trials T...
glaive
I am trying to create a GoogleInstrumentedSpec class using Scala and the Google API client library. I want to test the functionality of the class by creating unit tests for different scenarios, such as successful requests, requests that return an exception, and requests that result in an IOException. I need to implemen...
glaive
You are working on an Emacs package called "seethru" that allows users to set the transparency of the currently selected Emacs frame. You need to implement the following functionalities: 1. Implement a function called "seethru" that takes a value between 0 and 100 as input and sets the transparency of the currently se...
glaive
I have a problem with my Rust code. I have a reference to a struct inside another struct, both declared in the same block. Later, I want to use the outer struct in a closure that runs repeatedly and never returns. However, I'm getting an error saying that the reference inside the struct does not live long enough. I tho...
glaive
I need to create a function that takes in two values and returns true if they are equal, and false otherwise. The function should be able to handle boolean values, integers, floating point numbers, characters, and strings as input. Can someone provide a solution for this in the programming language where the snippet ...
glaive
I have a page that displays a list of projects with sortable headers and pagination. The URL for this page looks like this: `/projects?order=asc&page=3&sort=code`. Now, when I choose to edit a specific project, the URL changes to something like this: `projects/436/edit`. Once I make the necessary changes and click sav...
glaive
I am trying to test a ViewSet in Django Rest Framework and encountering an issue. While testing the view set, I am using the following code: ```python class ViewSetTest(TestCase): def test_view_set(self): factory = APIRequestFactory() view = CatViewSet.as_view() cat = Cat(name="bob") ...
glaive
I need to create a module in Common Lisp that defines four macros: object-group, notification-group, module-compliance, and agent-capabilities. These macros need to be defined within the package ASN.1/SNMPv2-CONF and should import certain symbols from another package ASN.1/SNMPv2-SMI (specifically, ObjectName, Notifica...
glaive
You are tasked with creating a Scene Manager object using the provided framework and technology. The Scene Manager should have the following functionality: - A global app object called exampleApp with a setting alias - A sceneManager object with the following properties: - stage: undefined - scenes: an array to sto...
glaive
You are tasked with creating a custom action in a Windows Installer package using Delphi programming language. The custom action needs to retrieve the file path for FileMaker 8 installation. Write a function `FM8Path` that takes `hInstall: MSIHANDLE` as input and returns `UINT`. This function should log the entry and ...
glaive
I am trying to set up a Haskell development environment and I want to install the necessary packages for my project. I want to use Dante for backend interactivity and LSP for language server protocol. I also want to include the attrap package. How can I configure the packages.el file to install these packages based on ...
glaive
I am new to Assembly programming and I'm trying to calculate the SHA-1 hash of input files. I have most of the program worked out, but I'm having trouble understanding how to represent big-endian numbers in Assembly. The SHA-1 pseudocode mentions appending the length of the message as a 64-bit big-endian integer. Can s...
glaive
How can I create a function in Python to print all the prime numbers between 0 and a given number 'n'?
glaive
You are tasked with creating a Python program that simulates a simple calculator. The program should be able to perform basic arithmetic operations such as addition, subtraction, multiplication, and division. It should also be able to handle input validation to ensure that the user inputs only valid numbers and operati...
glaive
You are tasked with creating a web page that displays user profile information in a structured format. The user profile should include the user's name, username, gender, date of birth, place of birth, address, email, and membership since date. Additionally, the user's profile picture should be displayed alongside the i...
glaive
I need to create a TSR (Terminate and Stay Resident) program in assembly language that can be installed, uninstalled, and change the screen font without installing the TSR component. The program should be able to: 1. Install the TSR by running the program with the argument "i". 2. Uninstall the TSR by running the prog...
glaive
You are tasked with implementing an Erlang module to create a TLS server. The server should be able to handle incoming connections, perform a TLS handshake, and handle data transmission. Additionally, the server should support Server Name Indication (SNI) for handling multiple TLS certificates. Your task is to write th...
glaive
I am trying to create a ZIO test suite to test the functionality of the clock in my application. I want to write a test that checks whether the current time is non-zero. I need to use the ZIO testing framework and assert that the result of `Live.live(nanoTime)` is greater than 0L.
glaive
I am trying to specify rules and node data in my programming project using the R6RS programming language. I need to create a function that takes a specification as input and defines certain rules for node data. The function should include rules for family names, referring nodes, all references list, getting references ...
glaive
You are working on a project in Microsoft Access and need to customize the line width of the text displayed in a TabControl. You want to use the FontWeight property to specify the line width, but you are unsure how to do so. You need to write a VBA code that sets the FontWeight property to a specific value for a TabCon...
glaive
You are tasked with implementing a CUDA kernel to calculate the Mandelbrot and Julia sets. The kernel should take in various parameters including the mode (Mandelbrot or Julia), tile dimensions, iteration limits, and other necessary parameters. It should then compute the values for each pixel within the tile based on t...
glaive
As a beginner in neural networks and perceptrons, I am trying to understand why the weight vector is perpendicular to the decision boundary or hyperplane. I have referred to many books, but none have explained why this is the case. Can anyone provide a detailed explanation or a reference to a book that explains this?
glaive
You are tasked with creating a CMake build system to compile and link a C++ project. Your project consists of multiple source files and you need to write a clean script to remove all the generated object files, executables, and any other build artifacts. Write a CMake clean script that removes the object files, debug i...
glaive
How can I create a JavaScript program that retrieves the value of a specific query string parameter from a given URL?
glaive
You are tasked with implementing a module in Elm that checks for unnecessary parentheses in the given code. The module should be named `UnnecessaryParens` and should expose a function called `checker`. The purpose of this function is to scan a file for unnecessary parentheses in the code and return a list of message da...
glaive
I am trying to define a function in a programming language using a specific framework or technology. I want to create a function that takes in a type A and returns a value of type A within a custom class C. The function should also have the ability to use a magic constant and work with propositions and product types. C...
glaive
I am trying to implement a top-level driver that orchestrates build system integration, frontends, backend, and reporting in OCaml. However, I am running into an issue with setting up the results directory. I need to ensure that the results directory exists and is set up correctly before executing any commands. Can som...
glaive
You are tasked with creating a program to manage a badminton court booking system. The program should allow users to view the availability of the court, book a time slot, and cancel a booking if necessary. The system should also be able to display the schedule for the day and ensure that double bookings are not allowed...
glaive
You are tasked with creating a program to handle sprite images in a game development environment. The program should be able to define and manipulate properties of the sprite, such as the grid size, collision settings, and playback speed. Additionally, it should be able to handle layers for the sprite images, including...
glaive
You are tasked with implementing the bilinear interpolation function in CUDA for a given feature map in a deep learning framework. Bilinear interpolation is a method of using four nearest known data points to estimate unknown data points. Your task is to write a CUDA kernel to perform bilinear interpolation on the feat...
glaive
You are tasked with creating a Rust program that manages log pool configurations using the `LogPoolConfiguration` struct. The struct represents the configuration for a log pool, including permissions and pool size. You need to implement the `open_or_create` method for the `LogPoolConfiguration` struct, which opens an e...
glaive
You are tasked with implementing a router module in a system using Verilog. The router module needs to handle input and output commands, including assigning channels based on the address or destination ID. The module should also handle write and read transactions, setting the appropriate channel based on the transactio...
glaive
You are tasked with creating a ray tracing program using the Optix framework. The program should trace rays through a scene and render the resulting image. The ray tracing program should be able to handle both perspective and orthographic cameras. The program should also be able to calculate intersection with geometry ...
glaive
You are tasked with implementing a functor called DtdManager that depends on various structures such as Dtd, Hooks, and ParserOptions. This functor should include Entities and Dtd, and should raise exceptions such as AttValue, NoSuchSymbol, and NoSuchIndex. The functor should provide functions for creating attribute va...
glaive
You are tasked with creating a script to run the SITECMP_DAILYO3_v5.3.1 program for air quality observation data analysis. The script needs to set up the runtime environment, configure options for SITECMP_DAILYO3, and define input and output files. The script should also handle the execution of the SITECMP_DAILYO3 prog...
glaive
You are tasked with setting up a Puma server configuration for a Ruby on Rails application in a production environment. The server should be daemonized, store the PID and state in specified files, redirect STDOUT and STDERR to log files, bind to a specific Unix socket, and set up a Puma control rack application. Writ...
glaive
I need to write a csh script that will run a Python program with two different methods and redirect the output of each method to separate log files. The Python program is called main.py and takes in a method argument (0 or 1) to determine which method to execute. I want to run the program with method 0 and method 1 and...
glaive
You are tasked with creating a program that calculates the total cost of a customer's purchase at a grocery store. The program should prompt the user to input the quantity and price of each item purchased, and then calculate the total cost, including tax. The tax rate is 8%.
glaive
You are tasked with creating a Tcl script to generate assignments for a Quartus Prime project. The script needs to check if a specific project is open, and if not, open or create it. Then, it should set various global assignments for the project, including family, device, top-level entity, project output directory, and...
glaive
I am looking to create an Angular component that displays a wallet address and allows users to add funds to the wallet by sending VTC. The component should have a heading "Add funds" and a paragraph that displays the wallet address and instructions on adding funds. The wallet address should be dynamically fetched from ...
glaive
I am working on a project where I need to set the sources for OTA PAL test and include directories in CMake. Can someone guide me on how to accomplish this task using CMake?
glaive
I need to create a function in Python that takes a list of file names as input and returns a formatted string with each file name enclosed in double quotes and separated by a space. For example, if the input is ["file1.txt", "file2.txt", "file3.txt"], the output should be "\"file1.txt\" \"file2.txt\" \"file3.txt\"". C...
glaive
You are tasked with creating a C# class that will be used to make a request to the Aliyun IoT platform to create a new rule. The class should have the following properties: - Select: a string property that represents the select query for the rule - RuleDesc: a string property that represents the description of the rule...
glaive
You are tasked with implementing a Java program using the Thrift framework to define and use various data types and structures. Your program should include the following components: 1. Define a struct named BasicInt with a single field of type i32 (signed 32-bit integer). 2. Define a struct named BasicString with a sin...
glaive
I need to create a Rust implementation of a decimal floating point type, as specified by IEEE 754-2008. The implementation should include functionalities like parsing a string to a decimal, checking if a number is NaN, positive infinity, or negative infinity, determining the floating point category of a number, and per...
glaive
You are tasked with implementing a program that utilizes an enum class to return a specific output based on the enum value. You need to create a function that takes an enum value as input and returns a corresponding string based on the enum value. The enum class has two values: A and B. If the input enum value is A, th...
glaive
I want to build a function in Emacs Lisp that will take a list of constructor names and return a list of (abbrev . name) pairs. The function should query the Axiom process and return the abbreviation for each constructor name. The abbreviation can be found using the `axiom-get-abbreviation` function, which takes a cons...
glaive
You are tasked with implementing a server-client communication system using the Haven framework. You need to create a server that listens for client connections and processes commands, as well as a client that can connect to the server and send commands. The server should be able to handle commands such as setting key-...
glaive
How can I create a function to check whether a given input is an even number or not?
glaive
You are tasked with creating a program that generates multiple tracks for a layout. The tracks must be created with specific offsets, pitches, and multipliers. The program should be able to handle the creation of various tracks, each with different specifications. Write a program that takes in the track name, x_offset...
glaive
I'm currently working with SQLAlchemy and have the following query: ```python profiles = session.query(profile.name).filter(and_(profile.email == email, profile.password == password_hash)) ``` I'm looking for a way to check if there is a row and how to return just the first row if there is a match. How do I accompli...
glaive
How can I create an AI that can play tic-tac-toe?
glaive
You are tasked with implementing a CUDA temporal convolution in C++ using the THCUNN library. The goal is to create a function that takes input, weight, bias, and other parameters as input and computes the output using temporal convolution. The input may be 2D or 3D tensors, and the function should handle both cases. T...
glaive
You are tasked with creating a module for a Rust program that converts a large number into its Chinese representation. The module should be able to handle numbers up to 10^16 and should be compatible with the existing Chinese digit module. Write a function called "convert_to_chinese" that takes in a u64 integer as inp...
glaive