instruction_seed stringlengths 0 26.4k | source stringclasses 4
values |
|---|---|
Can someone provide a SQL query to obtain the top 10 most frequently occurring words from a specific table? | sharegpt |
How can I create a C++ application that calculates the maximum value among three input numbers? | sharegpt |
I am having trouble accessing the process command line from my Linux 64-bit Assembly program. To simplify the issue, I created a 32-bit program that prints the first 5 characters of the program name. Here is the code:
```assembly
.section .text
.globl _start
_start:
movl %esp, %ebp
movl $4, %eax # write
m... | sharegpt |
I want to create a registration form for my website that validates the user input before submitting. How can I achieve this using HTML and PHP? | sharegpt |
How can I construct a HTML table with three columns and two rows, using the CSS class "flightTable"? | sharegpt |
I have a table with a datetime column that contains multiple dates. I need to extract and display the month and year for each unique date. For example, I want the output to be like "April 2017, April 2018, May 2018, June 2018".
I have tried the following code, but it only displays the month names without considering t... | sharegpt |
I wrote some code to test the `fsqrt` function and the result doesn't make complete sense to me. Here's the code (in Delphi):
```delphi
uses
mmsystem;
var
rand:longint=123456789;
function rng:longint;
asm
imul eax,[rand],$08088405
inc eax
mov [rand],eax
end;
function int_sqrt(adata:longint):longint;
asm
fnstc... | sharegpt |
I'm experiencing SQL Timeout errors in multiple applications on my network. These errors occur sporadically throughout the day and I'm having trouble pinpointing the cause. I've checked with the DBA and IT, but they say everything is fine on their end. I've already tried running a SQL trace and monitoring connection po... | sharegpt |
I have a printing function that is supposed to output a 3-digit result. The result is stored in RES, which is a dw. I have added push and pop instructions to fix previous printing issues. However, something seems to be going wrong. Can someone help me identify the problem?
```assembly
XOR AX, AX
XOR BX, BX
; This... | sharegpt |
Can you provide a database schema design for storing information about a social network? | sharegpt |
"I am new to MIPS programming and I am trying to write code in MARS without using any co-processors. I noticed that I cannot use the 'li.s' instruction in MARS. Can someone explain why this instruction is not allowed in MARS? It would be really helpful if someone could suggest an alternative approach or guide me in a n... | sharegpt |
Can you provide a CSS code snippet that will make text scroll horizontally on the screen? | sharegpt |
Can you provide a SQL database schema to store user data and their corresponding roles in a system? | sharegpt |
I need to generate code for a linked list in Python. Can someone help me with that? | sharegpt |
I have a table with a datetime column named TranDate. I need to query the table to retrieve data based on the year only. However, my current SQL query is giving me an error. Here is my query:
```
select * from Angkasa_UnpostedRecords
where year(convert(datetime,TranDate,103) = year(convert(datetime,@FromDate,103)
```... | sharegpt |
<p>I have a set of controller methods that I want to share in my Ruby on Rails application. What is the recommended approach for doing this? Should I create an abstract class that my controllers extend, or should I create a module and include it in each controller? Here are the controller methods I want to share:</p>
... | sharegpt |
I need to design an HTML login page with a username and password input field, along with a login button. Can you provide me with an example code snippet that accomplishes this? | sharegpt |
I want to create a neural network that can predict the output of an AND gate based on two inputs. How can I achieve this using Python? | sharegpt |
<p>I'm following Jack Crenshaw's compiler tutorial (If you look at my profile, that's what all my questions are about lol) and it just got to the point where variables are introduced. He comments that the 68k requires everything to be "position-independent" which means it's "PC-relative". I get that PC is the program c... | sharegpt |
How can I program an AI bot to play tic-tac-toe and try to win against a human opponent? | sharegpt |
Can you provide a code that finds the minimum number of coins required to make a given amount of money? | sharegpt |
How can I create a Flutter application that displays data from a REST API? | sharegpt |
Can you provide a solution to calculate the minimum edit distance between two given strings? | sharegpt |
I am working on a Python Regular Expressions assignment where I need to extract IP addresses. I am using the same regular expression `"(\d{1,3}\.){3}\d{1,3}"` in both `re.search()` and `re.findall()` functions on the same string `"blah blah 192.168.0.185 blah blah"`. However, I am getting different results. The `re.sea... | sharegpt |
How can I create a Swift program that generates prime numbers until a given number? | sharegpt |
How can I construct a Python script to conduct hyperparameter tuning for a TensorFlow deep learning model using both Hyperband and Bayesian Optimization methods? Additionally, I would like to compare the performance of both tuning methods. | sharegpt |
Is there a way to develop a program that can generate a wordcloud from an input text using Python? | sharegpt |
Can someone provide a function in R that calculates the standard deviation of a given sample? | sharegpt |
I am using nose 1.2.1 with Python 3.3.0 and I sometimes get an error message similar to the one below when running a test. The error message suggests setting `self.maxDiff` to None to see the full output of the diff, but I'm unsure about how to do this. Could you provide guidance on how to set `self.maxDiff` so I can s... | sharegpt |
I've been developing on Rails for 5 years, and recently I've noticed that Rails 3.0 is extremely slow to startup. Even on my top-notch MacBook with SSD, tests take forever to bootstrap, making my iteration cycles suffer. This is affecting my productivity and it's not ideal for an agile development process. I've tried u... | sharegpt |
I have a table in my database called `twMCUserDB` with the following structure:
```sql
CREATE TABLE `twMCUserDB` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`mc_userName` text NOT NULL,
`mc_userPass` text NOT NULL,
`tw_userName` text NOT NULL,
`tw_userPass` text NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM AUT... | sharegpt |
I have some native methods written in C++ in my Android project, and I would like to know if these methods are counted in the Dex file method count limit. Can someone explain how the Dex method count is calculated and if native methods are included in this count?
Additionally, I would like to know how many methods are... | sharegpt |
I am trying to install gems in my Ruby 1.9.3 app, but I am getting an error. Here is a snippet from my Gemfile:
```ruby
gem "pony"
gem "bcrypt-ruby", :require => "bcrypt"
gem "nokogiri"
```
When I run the `bundle` command, I am prompted to enter my password, but then I get the following error:
```
Installing bcrypt-... | sharegpt |
Is there a way to keep an unbuffered channel value for multiple reads without the value being removed from the channel? I have a goroutine that generates a single data for multiple downstream goroutines to use. I don't want to create multiple channels or use a buffered channel, as I don't know how many copies I will ne... | sharegpt |
I have some code that goes to a directory called "Folder 1" and calls a function called "function" in the file "python_function.py". The code works perfectly when I only call the function in Folder 1. However, when I try to call another function in a different directory called "Folder 2", I get a "Segmentation Fault (c... | sharegpt |
How can I create a function in Python to calculate the area of a circle based on a given radius? | sharegpt |
How can I create an AI script in R that calculates the mean value of a given numeric vector? | sharegpt |
I have a SQL statement that is supposed to calculate the sum of the "Price" column in the "Order" table. However, I am encountering a runtime error or unexpected result. Can you help me identify the error in my code and provide a corrected SQL statement?
```SQL
SELECT SUM(Price) FROM Order;
``` | sharegpt |
How can I create a function in PHP that doubles the value of each element in an array? | sharegpt |
I am working on a project where I have written some assembly code for performance optimization. However, I am not experienced in writing assembly code and I am facing issues with the code in my critical path. I have tried using the VS profiler, but it only gives me a rough idea of which instructions are taking the most... | sharegpt |
How can I write a function in Python to find the number of elements in a two-dimensional array? I have an array like this: [[1, 2], [3, 4], [5, 6]]. I want to know the total count of elements in this array. | sharegpt |
How can I write a Javascript code that determines whether the number 13 appears in an array or not? | sharegpt |
What is an example of a search algorithm in Python that can be used to search an array of strings for a specific target string? | sharegpt |
I need help developing a computational function in Python. The function should take an input parameter "y" and perform a mathematical multiplication with that value and 2. Can someone provide me with a solution? | sharegpt |
How can I create an HTML page with a table that displays shopping item names, their costs, and quantities? | sharegpt |
Why does the first query return a numeric value of 0.75, but the second query returns a string value of '.75'?
I attempted to fix the issue by modifying the second query as follows, but I can't modify the value in my actual code:
```sql
select decode(1, 0, null, to_char(0.75, '0.99')) from dual
```
How can I fix the... | sharegpt |
What is the Python code to fetch data from a web API and store it in a database? | sharegpt |
I have a struct definition in GO like this:
```go
package models
//StoryStatus indicates the current state of the story
type StoryStatus string
const (
//Progress indicates a story is currently being written
Progress StoryStatus = "progress"
//Completed indicates a story was completed
Completed Story... | sharegpt |
How can I retrieve the 10th highest salary from the 'Employee' table using an SQL query? | sharegpt |
I encountered a strange issue while writing x64 assembly code. I have a function call that works fine when executed on the main thread, but it causes a segmentation fault when executed as a pthread. I initially thought that I might be invalidating the stack because it only segfaults on the second call, but this doesn't... | sharegpt |
How can I determine if a row exists in a database table using JDBC and perform a specific task based on its existence?
For example, I have a select query like this:
```
select name from person where id=2;
```
I want to know if this row exists, and depending on its existence, I need to perform a certain task. How can ... | sharegpt |
How do I correctly set the values for steps_per_epoch and validation_steps in Keras? I have 39,592 samples in my training set and 9,899 in my validation set, and I use a batch size of 2. In my code, I calculated my steps_per_epoch and validation_steps as follows:
```python
steps_per_epoch = int(number_of_train_samples... | sharegpt |
How can I design and implement a web API that finds the closest restaurant to a user's current location? | sharegpt |
How can I handle exceptions in JavaScript? | sharegpt |
In Python, I have a class called Foo that keeps track of its instances in a class variable like so:
```python
class Foo:
by_id = {}
def __init__(self, id):
self.id = id
self.by_id[id] = self
```
I want to iterate over the existing instances of this class. I can achieve this by using the follo... | sharegpt |
How can I design an algorithm that calculates the sum of an integer and all numbers in an array using Python? | sharegpt |
Can you provide a Python implementation of a Breadth-First Search algorithm? | sharegpt |
I need help designing a bot for a chat application that can search for available flights. The bot should take user input for two cities, the departure date, and the return date. Can someone help me with the code to fetch flight information from a flight booking API and display the available flight options? | sharegpt |
How can I specify an individual test case in Django when my tests are spread across multiple files in a tests directory? I have a suite() function in my `tests/__init__.py` file which loads the test cases from my different test files. When I try to specify an individual test case, such as with the command `$ ./manage.p... | sharegpt |
I am trying to create a bar plot in seaborn using the value_counts() of a DataFrame. I have created the DataFrame using the values from a dictionary. Here is the data and the code I've used:
```python
people = ['Hannah', 'Bethany', 'Kris', 'Alex', 'Earl', 'Lori']
reputation = ['awesome', 'cool', 'brilliant', 'meh', 'a... | sharegpt |
I want to find the distinct drinkers who like either BEER or RED WINE using a set algebra operation in SQL. I have tried the following query, but it doesn't use a set algebra operation:
```
SELECT DRINKER
FROM LIKES
WHERE DRINK = 'BEER' OR 'RED WINE';
```
I'm new to SQL, so I would appreciate any help with this.
... | sharegpt |
What steps should I follow to encrypt a text string with a length of 5 characters using the sha256 encryption algorithm in Python? | sharegpt |
How can I convert .mp3 files into arrays of frequencies, amplitudes, and other parameters necessary to define music using Python? I'm aiming to design a neural network that can rate the quality of music on a scale of 1-10 based on these parameters. | sharegpt |
Is there a way to write a SQL query that can provide the total number of students in each grade level? | sharegpt |
I'm experimenting with the `sys_open` syscall and I'm trying to get a file descriptor for reading. Here is my program:
```assembly
SYS_exit equ 0x3C
SYS_open equ 0x02
O_RDONLY equ 0x00
O_WRONLY equ 0x01
O_RDWR equ 0x02
section .text
global _start
_start:
mov eax, SYS_open
mov rdi, file_name
mov rsi,... | sharegpt |
I am using pandas to analyze some election results. I have a DataFrame, Results, which has a row for each constituency and columns representing the votes for the various parties. Currently, I am able to find the winning party (i.e., the party which polled the highest number of votes) and the number of votes it polled w... | sharegpt |
I am trying to filter a Pyspark DataFrame with a SQL-like `IN` clause, but I'm encountering an error. Here is the code I'm using:
```python
sc = SparkContext()
sqlc = SQLContext(sc)
df = sqlc.sql('SELECT * from my_df WHERE field1 IN a')
```
The error message I'm getting is: `java.lang.RuntimeException: [1.67] failure... | sharegpt |
How can I modify the given Python program to create a new list that contains tuples with the corresponding values from two input lists? | sharegpt |
How do I encrypt a given string using AES-256 in Python? | sharegpt |
I finally understood the basics of Assembly and bare-metal programming. Or at least this is what I thought. I wrote this simple bootloader program myself for the first time:
```
org 7c00h
bits 16
main:
xor ax, ax
mov ds, ax
mov es, ax
mov ss, ax
mov sp, 7c00h
cld
xor bx, bx
mov s... | sharegpt |
I have a project with multiple assemblies, including Contract.Common, Contract.Sync, Contract.Task, and several others. The Contract.Common assembly contains commonly used DataContracts and follows best practices for WCF architecture and evolution. I am now developing a new Contract called Contract.NewStuff, which is i... | sharegpt |
I am interested in developing a PowerPC emulator for my own learning purposes. I have been searching for a while but haven't been able to find an instruction/opcode mapping table for PowerPC assembly. Can anyone suggest where I can find one? | sharegpt |
I want to find the median height of all athletes in four specific sports teams using SQL. Can I also analyze the correlation between their height and performance based on their scores in the last 10 games? What should I do if there is missing height data for some athletes? | sharegpt |
I am trying to add a Go application to an existing Python codebase, but I'm having trouble with encryption between the two languages. The Python code is using PyCrypto 2.7a1 and the Go code is using go 1.2.1. I have provided code samples for both languages.
Here is the Python code:
```python
import Crypto.Cipher
imp... | sharegpt |
I am working on a project that requires client/server communication with UDP sockets in the Go language. I have found examples online that show how to send data to the server, but I am having trouble figuring out how to send a response back to the client. Here is what my client program does:
```go
con, err := net.Dia... | sharegpt |
I am using Flask in Python and I am trying to create two buttons on a page, with each button executing a different Python script on the server. Currently, I have managed to get one button using the following code. However, I am unsure about how to modify this code to differentiate between the buttons when pressed. Can ... | sharegpt |
I'm trying to make a request to a Shoutcast server, which responds to GET requests with "ICY 200 OK" instead of the standard "HTTP/1.1 200 OK". However, Go throws an error saying "malformed HTTP version 'ICY'". I've come up with a few possible solutions, but I'm not sure which approach is the best. Here are my ideas so... | sharegpt |
Why does the following code produce a runtime error?
Code:
```
print(x)
``` | sharegpt |
Can you provide a solution to generate random numbers between 1 and 10, store them in an array, and then sort the array in ascending order? | sharegpt |
Is there a tool or command in Django that can display the URL patterns, their names (if any), and the associated view functions, similar to how the `rake routes` command works in Rails? | sharegpt |
I have a list of animals and I want to print each element in the list. How can I accomplish this using a loop in Python? | sharegpt |
How can I write a program to output all the prime numbers between 1 and 100? | sharegpt |
I have a method in a rails helper file that looks like this:
```
def table_for(collection, *args)
options = args.extract_options!
...
end
```
I want to be able to call this method with a dynamic set of arguments based on a form commit. Is there a way to achieve this without rewriting the method, as it is used in ... | sharegpt |
How can I create a Java program that calculates the difference between two dates and displays the number of days between them? | sharegpt |
I have been struggling for several hours now to query a subset of the available columns of a table in my database, while also including a calculation in the query. I know that it may not be the best practice to execute calculations in the select query, but for now, I am just working on a prototype and it should be feas... | sharegpt |
How can I save a list of strings using pickle in Python so that it can be accessed later? Can you provide an illustrative example? | sharegpt |
I'm writing an operating system and I'm using the `asm!` macro in Rust to change the code segment. However, I'm encountering an issue where the `push 1f` instruction is not pushing the address of label `1:` but instead is loading from memory. Here's the code:
```rust
pub unsafe fn set_code_segment(offset_of_cs: u16) {... | sharegpt |
How can I use the `endswith()` function in Python with a list of multiple extensions? I want to detect files with a list of extensions and perform different commands based on the extension type, including detection of a folder and other file types.
Here is the code I have so far:
```python
ext = [".3g2", ".3gp", ".as... | sharegpt |
How can I write a JavaScript program that converts a given number to a string of Roman numerals? | sharegpt |
The Intel 64 and IA-32 Architectures Software Developer's Manual states that reads may be reordered with older writes to different locations but not with older writes to the same location. However, it also mentions "store-buffer forwarding" when a read passes a write to the same memory location. I'm confused about what... | sharegpt |
I am attempting to create a simple test in Python, but I am having difficulty figuring out how to properly implement the mocking process. I have a class and function code where the "execute" method tries to establish a connection. I need to mock this connection because I don't want to make a real one, but I'm unsure of... | sharegpt |
How can I create a JavaScript object constructor function for an Employee with fields for name, age, and salary? | sharegpt |
How can I find the maximum value in an array using an executable C program? | sharegpt |
How can I create a program that sorts an array of integers using the Quick Sort algorithm? | sharegpt |
How can I create a C++ function that calculates the factorial of a given integer? | sharegpt |
Last night, while working with an ATTiny2313 using AVR assembly, my friend and I encountered a strange issue. He was setting a LED using `PINB,6` and I suggested using `PORTB,6` instead. However, when we tried it, the LED didn't work as expected. We then recreated the same code in Arduino C++ using the ATMega328P, and ... | sharegpt |
Is there a way to create a Go program that calculates and prints the area of a triangle using its base and height? | sharegpt |
I have a list of numbers, and I need to calculate the average of the numbers. Can anyone help me write a function to achieve this? | sharegpt |
How can I delete all records from a table using SQL? | sharegpt |
In CUDA, is local memory slower than shared memory? I've found that local memory is slower than register memory, but I'm not sure how it compares to shared memory. I'm working on a project that requires me to sort chunks of a list and then pick a suitable one, which is similar to a median filter but with a specified pe... | sharegpt |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.