row_id
int64
0
48.4k
init_message
stringlengths
1
342k
conversation_hash
stringlengths
32
32
scores
dict
20,999
Trend Report Result: AC_SK_ID EXPOSURE_AMT(in CAD) for 2013-12-31 EXPOSURE_AMT(in CAD) for 2013-11-30 Changed 1 2100 24 87.5 2 2110 1200 1.7583 3 3000
d2e6acaa32705cd68cbd9c3bc9e1ef4f
{ "intermediate": 0.34258973598480225, "beginner": 0.4139464497566223, "expert": 0.24346379935741425 }
21,000
import cryptography def hash_image(image_path): with open(image_path, "rb") as image: img_bytes = str(image.read()).split("\\") img_bytes = ''.join(img_bytes) # use sevral methods to hash the img_bytes, at least 2 print(hash_) hash_image("4.png")
8576f44937d3e1bb0237f83c978de2ba
{ "intermediate": 0.3868807554244995, "beginner": 0.2796538770198822, "expert": 0.3334653079509735 }
21,001
what are some ways I could shorten the result I get from this hashing algorithm?
79984d37459d4f2e19f75e05d5fa9b69
{ "intermediate": 0.1242377907037735, "beginner": 0.08649984002113342, "expert": 0.7892624139785767 }
21,002
in python please make a redis db to store diffrent types of captchas each having their own set of captchas that are known by hash.
2497270ddf9dcd51ae80d253b7b4f786
{ "intermediate": 0.5421544909477234, "beginner": 0.12392701208591461, "expert": 0.3339185118675232 }
21,003
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace Olimp2 { class Program { static void Main(string[] args) { int N = int.Parse(Console.ReadLine()); string[] visota = Console.ReadLine().Split(' '); int Q = int.Parse(Console.ReadLine()); List<int> h = new List<int>(); for (int i = 0; i < N; i++) { h.Add(int.Parse(visota[i])); } List<double> result = new List<double>(); for (int i = 0; i <= Q; i++) { string[] photo = Console.ReadLine().Split(' '); int lt = int.Parse(photo[0]); int rt = int.Parse(photo[1]); double max = 0; double G = 0; for (int j = lt; j == rt; j++) { G += h[j]; } double M = 1 / rt - lt + 1 * G; double K = 0; for (int j = lt; j == rt; j++) { K += ((h[j] - 1) / (rt - lt + 1) * G) * ((h[j] - 1) / (rt - lt + 1) * G); } double D = 1 / rt - lt * K; double o = Math.Sqrt(D); double L = 0f; for (int j = lt; j == rt; j++) { L += ((h[j] - M) / o) * ((h[j] - M) / o) * ((h[j] - M) / o); } double a = 1 / (rt - lt) * L; if (a > max) { result.Add(max); } } for (int i = 0; i < Q; i++) { Console.WriteLine(result[i]); } Console.ReadLine(); } } }
965e13468e5809bab99363d40d7ddd96
{ "intermediate": 0.35454240441322327, "beginner": 0.4163781404495239, "expert": 0.22907941043376923 }
21,004
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace Olimp2 { class Program { static void Main(string[] args) { int N = int.Parse(Console.ReadLine()); string[] visota = Console.ReadLine().Split(' '); int Q = int.Parse(Console.ReadLine()); List<int> h = new List<int>(); for (int i = 0; i < N; i++) { h.Add(int.Parse(visota[i])); } List<double> result = new List<double>(); for (int i = 0; i <= Q; i++) { string[] photo = Console.ReadLine().Split(' '); int lt = int.Parse(photo[0]); int rt = int.Parse(photo[1]); double max = 0; double G = 0; for (int j = lt; j == rt; j++) { G += h[j]; } double M = 1 / rt - lt + 1 * G; double K = 0; for (int j = lt; j == rt; j++) { K += ((h[j] - 1) / (rt - lt + 1) * G) * ((h[j] - 1) / (rt - lt + 1) * G); } double D = 1 / rt - lt * K; double o = Math.Sqrt(D); double L = 0f; for (int j = lt; j == rt; j++) { L += ((h[j] - M) / o) * ((h[j] - M) / o) * ((h[j] - M) / o); } double a = 1 / (rt - lt) * L; if (a > max) { result.Add(max); } } for (int i = 0; i < Q; i++) { Console.WriteLine(result[i]); } Console.ReadLine(); } } } в чем ошибка?
d5fc42b38edd312bc2c6f4553aee99b8
{ "intermediate": 0.35454240441322327, "beginner": 0.4163781404495239, "expert": 0.22907941043376923 }
21,005
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace Olimp2 { class Program { static void Main(string[] args) { int N = int.Parse(Console.ReadLine()); string[] visota = Console.ReadLine().Split(' '); int Q = int.Parse(Console.ReadLine()); List<int> h = new List<int>(); for (int i = 0; i < N; i++) { h.Add(int.Parse(visota[i])); } List<double> result = new List<double>(); for (int i = 0; i <= Q; i++) { string[] photo = Console.ReadLine().Split(' '); int lt = int.Parse(photo[0]); int rt = int.Parse(photo[1]); double G = 0f; for (int j = lt; j < rt; j++) { G += h[j]; } double M = 1f / (rt - lt + 1) * G; double K = 0f; for (int j = lt; j < rt; j++) { K += ((h[j] - 1) / (rt - lt + 1) * G) * ((h[j] - 1) / (rt - lt + 1) * G); } double D = 1f / (rt - lt) * K; double o = Math.Sqrt(D); double L = 0f; for (int j = lt; j < rt; j++) { L += ((h[j] - M) / o) * ((h[j] - M) / o) * ((h[j] - M) / o); } double a = 1 / (rt - lt) * L; if (a > 0) { result.Add(a); } } for (int i = 0; i < Q; i++) { Console.WriteLine(result[i]); } Console.ReadLine(); } } } в чем ошибка?
ddb9d29f5520877ac47e307197d62caa
{ "intermediate": 0.3359866738319397, "beginner": 0.4772206246852875, "expert": 0.18679268658161163 }
21,006
yo my explorer.exe crashes whenever I switch folders, I did just delete around 3gb worth of images, which were aroung 500k in total, may that be why? I skipped the recycle bin so I thought it wouldnt affect it
e228d0c7287ea468d7ce9ede3ad92d70
{ "intermediate": 0.4038793444633484, "beginner": 0.2964804768562317, "expert": 0.29964014887809753 }
21,007
Is it possible for Excel to do this. If I enter the value 'Calculated' in a cell in column O the cell address is determined and the formula '=SUM(JX:J206)' is written to Offset(1, 1) where X is the numeric value of the cell address that was determined.
7e6808f685ebe43683f05fdcea1aa613
{ "intermediate": 0.515783965587616, "beginner": 0.21451877057552338, "expert": 0.26969724893569946 }
21,008
Eveybody doing . Ryan in college once a week in Kingston then does appreciatship at warren work as a mill wright for the rest of the week. Weekend he rebuild his second truck. He truly is warren son.
b2a845a123d34c40a97f7e95287fa549
{ "intermediate": 0.29241102933883667, "beginner": 0.2913435995578766, "expert": 0.41624534130096436 }
21,009
User: public class User { [Key] public int UserID { get; set; } [Index(IsUnique = true)] public string Username { get; set; } [Index(IsUnique = true)] public string Email { get; set; } public byte[] PasswordHash { get; set; } public byte[] PasswordSalt { get; set; } public string Role { get; set; } public ICollection<Enrollment> Enrollments { get; set; } public ICollection<Course> Courses { get; set; } } Course: public class Course { [Key] public int CourseID { get; set; } [Index(IsUnique = true)] public string Title { get; set; } public string Description { get; set; } [ForeignKey("User")] public int InstructorID { get; set; } public string Category { get; set; } public int EnrollmentCount { get; set; } public string ImageURL { get; set; } public User User { get; set; } public ICollection<Assignment> Assignments { get; set; } public ICollection<Enrollment> Enrollments { get; set; } } Assignment: public class Assignment { [Key] public int AssignmentID { get; set; } [ForeignKey("Course")] public int CourseID { get; set; } public string Title { get; set; } public string Description { get; set; } public DateTime DueDate { get; set; } public Course Course { get; set; } } Enrollment: public class Enrollment { [Key] public int EnrollmentID { get; set; } [ForeignKey("User")] public int UserID { get; set; } [ForeignKey("Course")] public int CourseID { get; set; } public DateTime EnrollmentDate { get; set; } public ICollection<User> Users { get; set; } public Course Course { get; set; } } I am doing an online Learning Management System with User registration, login, and profile management, Dynamic course catalog, enrollment, and progress tracking, Assignment submission, grading, and feedback. Can you tell me how everything works after creating models? I will use mssql. I don't want code. Just tell me how everything is connected.
c3d2af7f024f3962d2bef1b87e891f02
{ "intermediate": 0.6342292428016663, "beginner": 0.1347375214099884, "expert": 0.23103322088718414 }
21,010
Coding planet name generator
bd4e5e60dc5c721c020cb7cca51fe142
{ "intermediate": 0.21445226669311523, "beginner": 0.2991682291030884, "expert": 0.4863795042037964 }
21,011
this was what you gave me as coursecontroller: public class CourseController : Controller { private readonly YourDbContext _db; // Inject the DbContext through constructor public CourseController(YourDbContext db) { _db = db; } public async Task<IActionResult> Index() { // Retrieve all courses from the database asynchronously var courses = await _db.Courses.ToListAsync(); return View(courses); } public async Task<IActionResult> Details(int id) { // Retrieve the course with the specified ID from the database asynchronously var course = await _db.Courses.FindAsync(id); if (course == null) { return NotFound(); } return View(course); } public IActionResult Create() { return View(); } [HttpPost] public async Task<IActionResult> Create(Course course) { if (ModelState.IsValid) { // Save the new course to the database asynchronously _db.Courses.Add(course); await _db.SaveChangesAsync(); return RedirectToAction(nameof(Index)); } return View(course); } public async Task<IActionResult> Edit(int id) { // Retrieve the course with the specified ID from the database asynchronously var course = await _db.Courses.FindAsync(id); if (course == null) { return NotFound(); } return View(course); } [HttpPost] public async Task<IActionResult> Edit(int id, Course course) { if (id != course.CourseID) { return NotFound(); } if (ModelState.IsValid) { try { // Update the course in the database asynchronously _db.Courses.Update(course); await _db.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!CourseExists(id)) { return NotFound(); } else { throw; } } return RedirectToAction(nameof(Index)); } return View(course); } public async Task<IActionResult> Delete(int id) { // Retrieve the course with the specified ID from the database asynchronously var course = await _db.Courses.FindAsync(id); if (course == null) { return NotFound(); } return View(course); } [HttpPost, ActionName(“Delete”)] public async Task<IActionResult> DeleteConfirmed(int id) { // Delete the course with the specified ID from the database asynchronously var course = await _db.Courses.FindAsync(id); _db.Courses.Remove(course); await _db.SaveChangesAsync(); return RedirectToAction(nameof(Index)); } private bool CourseExists(int id) { // Check if a course with the specified ID exists in the database return _db.Courses.Any(c => c.CourseID == id); } } but in my coursecontroller it is public async Task<IActionResult> Index( ) { IEnumerable<Course> courses = await _courseRepository.GetAll( ); return View(courses); } why is that?
7572d40963bac1ce54be1d4eea9de45c
{ "intermediate": 0.2921609580516815, "beginner": 0.5550535321235657, "expert": 0.1527855098247528 }
21,012
in asp.net core i have a course coursecontroller and index.cshtml in the views foldeer associated with course model. so when i browse /course i want to display all the course where i will route this
9fe93f10d2e61259fd43794fe5225747
{ "intermediate": 0.2700977027416229, "beginner": 0.37827908992767334, "expert": 0.3516232371330261 }
21,013
“can you tell how to pass params in javascript JSON for through an inference api for some text to image (t2i) ai model, specifically some: “https://huggingface.co/hogiahien/counterfeit-v30-edited/tree/main”. which values in parameters I may apply in my http request? “I hope this helps you get started”. no, need advanced in params values that I can throw at that inference api backkend for t2i model to process. avatar-user I don’t want to train anything, jusr to pass params in javascript JSON for through an inference api for some text to image (t2i) ai model to be able to control its outputs somehow. because they are uncontrollable at all by any means. your json is incorrect, need specifically designed struct for huggingface inference api. then generally wtf? I need to control t2i outputs. what about actual sampler algorithms used as Euler, Euler a, etc? how you will throw that param at huggingface inference api for t2i? currently using this json structure in my code, not sure if rightful for Hugging Face Inference API: const inputText = document.getElementById(‘inputTextArea’).value; const inputText2 = document.getElementById(‘inputTextArea2’).value; const requestBody = { nerdcodes:genRanNum(), sampling_options:{ algorithm: “EULER_A”, step_size: 0.1, accoeff: 0.5, max_iterations: 100 }, inputs:inputText, parameters: { negative_prompt:inputText2, } }; const requestPayload = JSON.stringify(Object.assign({}, requestBody)); . is that legit method for an huggingface inference api??? are you bloody sure? it looks it understands “width: 512, height: 512,” at the backend of that text2image in parameters json query, not sure about the rest. it throws an error on temperature and many other specific inparameters. do you have any clue on wtf is happening?”. no, I 100% sure that their api don’t support temperature as for text to image models inparams. strangengly enough, their inparam for t2i models support width and height but they didn’t stated anything at all.what about CLIP? can you utilize actual CLIP that this text to image model using to send a parameters through javascript JSON as parameter for through their inference api for text to image model?
eabc8080e100a340427e9ef54fda0466
{ "intermediate": 0.587904155254364, "beginner": 0.1776832640171051, "expert": 0.2344125509262085 }
21,014
Добавь в эту программу подпрограмму для вычисления разности двух списков: #include <iostream> #include <string> using namespace std; class Node //элемент списка { public: int data; Node* prev, * next; public: Node(int data) { this->data = data; this->prev = this->next = NULL; } }; class LinkedList //список { public: Node* head, * tail; public: LinkedList() //конструктор (создаёт пустой список) { head = tail = NULL; } void freeMemory() //освобождает память { if (head == NULL) return; Node* current = head; Node* nextNode; do { nextNode = current->next; delete current; current = nextNode; } while (current != head); head = tail = NULL; } void addSorted(int data) { Node* newNode = new Node(data); if (head == NULL) // если список пустой { head = tail = newNode; newNode->next = newNode->prev = newNode; } else if (data < head->data) // если новый элемент меньше головы списка { newNode->next = head; newNode->prev = tail; tail->next = newNode; head->prev = newNode; head = newNode; } else if (data > tail->data) // если новый элемент больше хвоста списка { newNode->next = head; newNode->prev = tail; tail->next = newNode; head->prev = newNode; tail = newNode; } else // если новый элемент располагается где-то в середине списка { Node* current = head->next; while (current != head && current->data < data) { current = current->next; } newNode->next = current; newNode->prev = current->prev; current->prev->next = newNode; current->prev = newNode; } } void removeBefore(int data) { if (head == NULL) return; Node* current = head->next; while (current != head) { if (current->data == data) { Node* nodeToRemove = current->prev; nodeToRemove->prev->next = current; current->prev = nodeToRemove->prev; delete nodeToRemove; } current = current->next; } if (head->data == data) { Node* nodeToRemove = tail; nodeToRemove->prev->next = head; head->prev = nodeToRemove->prev; tail = nodeToRemove->prev; delete nodeToRemove; } } Node* search(int data) { if (head == NULL) return NULL; Node* current = head; do { if (current->data == data) return current; current = current->next; } while (current != head); return NULL; } void print() { if (head == NULL) return; Node* current = head; do { cout << current->data << " "; current = current->next; } while (current != head); cout << endl; } }; int main() { }
abb7c851c549113f540e16835f0673d3
{ "intermediate": 0.29529792070388794, "beginner": 0.5309047698974609, "expert": 0.17379732429981232 }
21,015
Программа выдаёт на строке LinkedList result = difference(list1, list2); такую ошибку: "идентификатор "difference" не определен". Как исправить? Вот сама программа: #include <iostream> #include <string> using namespace std; class Node //элемент списка { public: int data; Node* prev, * next; public: Node(int data) { this->data = data; this->prev = this->next = NULL; } }; class LinkedList //список { public: Node* head, * tail; public: LinkedList() //конструктор (создаёт пустой список) { head = tail = NULL; } void freeMemory() //освобождает память { if (head == NULL) return; Node* current = head; Node* nextNode; do { nextNode = current->next; delete current; current = nextNode; } while (current != head); head = tail = NULL; } void addSorted(int data) { Node* newNode = new Node(data); if (head == NULL) // если список пустой { head = tail = newNode; newNode->next = newNode->prev = newNode; } else if (data < head->data) // если новый элемент меньше головы списка { newNode->next = head; newNode->prev = tail; tail->next = newNode; head->prev = newNode; head = newNode; } else if (data > tail->data) // если новый элемент больше хвоста списка { newNode->next = head; newNode->prev = tail; tail->next = newNode; head->prev = newNode; tail = newNode; } else // если новый элемент располагается где-то в середине списка { Node* current = head->next; while (current != head && current->data < data) { current = current->next; } newNode->next = current; newNode->prev = current->prev; current->prev->next = newNode; current->prev = newNode; } } void removeBefore(int data) { if (head == NULL) return; Node* current = head->next; while (current != head) { if (current->data == data) { Node* nodeToRemove = current->prev; nodeToRemove->prev->next = current; current->prev = nodeToRemove->prev; delete nodeToRemove; } current = current->next; } if (head->data == data) { Node* nodeToRemove = tail; nodeToRemove->prev->next = head; head->prev = nodeToRemove->prev; tail = nodeToRemove->prev; delete nodeToRemove; } } Node* search(int data) { if (head == NULL) return NULL; Node* current = head; do { if (current->data == data) return current; current = current->next; } while (current != head); return NULL; } void print() { if (head == NULL) return; Node* current = head; do { cout << current->data << " "; current = current->next; } while (current != head); cout << endl; } LinkedList difference(LinkedList& list1, LinkedList& list2) //вычитание из первого списка второго { LinkedList result; Node* current = list1.head; do { if (list2.search(current->data) != NULL) {result.addSorted(current->data); } current = current->next; } while (current != list1.head); return result; } }; int main() { LinkedList list1, list2; list1.addSorted(10); list1.addSorted(21); list1.addSorted(5); list2.addSorted(90); list2.addSorted(5); LinkedList result = difference(list1, list2); result.print(); }
0100f399cc3fc3cf9349f7d8d0a0f8f4
{ "intermediate": 0.34258195757865906, "beginner": 0.4418101906776428, "expert": 0.21560786664485931 }
21,016
(about text to image ai models generations). let's assume that there's a variety of aspect-rations. can you output the most appropriate used overally through a photo-professionals photographs, and considering cameras and lenses as well.
6b29dd8a33f3e234a18ce56194c955e4
{ "intermediate": 0.3511788845062256, "beginner": 0.31390172243118286, "expert": 0.33491942286491394 }
21,017
#include <iostream> #include <algorithm> using namespace std; int main(){ int a,b,c,d; cin >> a >> b >> c >> d; int h=max(max(a,b) , max(c,d)); int e=min(min(a,b) , min(c,d)); int f=max(min(a,b) , min(c,d)); int g=min(max(a,b) , max(c,d)); cout << e << ' ' << f << ' ' << g << ' ' << h << endl; return 0; } 哪里错了
204511071c5f2c4e04925dfad3fd717b
{ "intermediate": 0.2988700568675995, "beginner": 0.3159249424934387, "expert": 0.3852050304412842 }
21,018
how do I make jupyter notebook show the output for all equations, not just the last one.
8b191f883e8de081b5e6855e57054d78
{ "intermediate": 0.684918224811554, "beginner": 0.07319377362728119, "expert": 0.24188801646232605 }
21,019
I want to create a dataset downloader in python, it needs to have a base data downloader class with the shared functionality to be extended from for use with any website, the goal is to download images based on a set criteria(tags, keywords etc for a filter, with a blacklist), it should also be able to obtain a "caption" from the website or api to create a .txt file along side the image file, using the same base name as the image file, which describes the contents of the image. To start with, we need the base class DataDownloader, and we need to extend this into another class for booru style websites, which sets up the core framework for working with booru style websites with a class BooruDownloader, then we extend it further to support ATFBooru with ATFBooruDownloader. And for now we will just put it in the one python script file.
1dd74ed88851e5e09ff2fb456d6a7adf
{ "intermediate": 0.7359157800674438, "beginner": 0.16761985421180725, "expert": 0.09646432846784592 }
21,020
Keep the same order and structure, but remove any redundant text: “In this video, we will discuss the HTTP protocol using the Requests Library a popular method for dealing with the HTTP protocol in Python In this video, we will review Python library requests for Working with the HTTP protocols. We will provide an overview of Get Requests and Post Requests Let’s review the Request Module in Python. This is one of several libraries including: httplib, urllib, that can work with the HTTP protocol. Requests is a python Library that allows you to send HTTP/1.1 requests easily. We can import the library as follows: You can make a GET request via the method get to www.ibm.com: We have the response object ’r’ , this has information about the request, like the status of the request. We can view the status code using the attribute status_code, which is 200 for OK. You can view the request headers: You can view the request body in the following line. As there is no body for a GET request, we get a None. You can view the HTTP response header using the attribute headers. This returns a python dictionary of HTTP response headers. We can look at the dictionary values. We can obtain the date the request was sent by using the key Date. The key Content-Type indicates the type of data. Using the response object ‘r’ , we can also check the encoding: As the Content-Type is text/html, we can use the attribute text to display the HTML in the body. We can review the first 100 characters. You can also download other content, see the lab for more. You can use the GET method to modify the results of your query. For example, retrieving data from an API. In the lab we will use httpbin.org A simple HTTP Request & Response Service. We send a GET request to the server. Like before, we have the Base URL in the Route; we append /get. This indicates we would like to preform a GET request. This is demonstrated in the following table: After GET is requested we have the query string. This is a part of a uniform resource locator (URL) and this sends other information to the web server. The start of the query is a ?, followed by a series of parameter and value pairs, as shown in the table below. The first parameter name is ”name” and the value is ”Joseph.” The second parameter name is ”ID” and the Value is ”123.” Each pair, parameter, and value is separated by an equal sign, ”=.” The series of pairs is separated by the ampersand, ”&.” Let’s complete an example in python. We have the Base URL with GET appended to the end. To create a Query string, we use the dictionary payload. The keys are the parameter names, and the values are the value of the Query string. Then, we pass the dictionary payload to the params parameter of the get() function. We can print out the URL and see the name and values. We can see the request body. As the info is sent in the URL, the body has a value of None. We can print out the status code. We can view the response as text: We can look at the key 'Content-Type’ to look at the content type. As the content ‘Content-Type’ is in the JSON, we format it using the method json() . It returns a Python dict: The key ‘args’ has the name and values for the  query string. Like a GET request a POST request is used to send data to a server, but the POST request sends the data in a request body, not the url. In order to send the Post Request in the URL, we change the route to POST: This endpoint will expect data and it is a convenient way to configure an HTTP request to send data to a server. We have The Payload dictionary. To make a POST request, we use the post() function. The variable payload is passed to the parameter data : Comparing the URL using the attribute url from the response object of the GET and POST request, we see the POST request has no name or value pairs in it’s url. We can compare the POST and GET request body. We see only the POST request has a body: We can view the key form to get the payload.”
fee5bd287b7b11da13d6bd5289744d04
{ "intermediate": 0.6111235618591309, "beginner": 0.2667791545391083, "expert": 0.12209732085466385 }
21,021
Power BI: need to create a measure Progress Status = if(CALCULATE(SUM(Initiatives[Variance%]))<0 then "Behind" else "On Schedule"
a638d576cabaa1493f5b2cb28794ec39
{ "intermediate": 0.21787719428539276, "beginner": 0.4163127839565277, "expert": 0.36581000685691833 }
21,022
What does it mean when there is an "E" in the sum of transaction amount in SAS Enterprise Guide
742a7dd8a1cb9db85d8ccef63e07b01d
{ "intermediate": 0.32645100355148315, "beginner": 0.3513588011264801, "expert": 0.32219019532203674 }
21,023
proxy_thread_status *proxy_request = malloc(sizeof(proxy_thread_status)); proxy_thread_status *proxy_response = malloc(sizeof(proxy_thread_status)); pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER; pthread_cond_t cond = PTHREAD_COND_INITIALIZER; proxy_request->src_fd = fd; proxy_request->dst_fd = target_fd; proxy_request->cond = &cond; proxy_request->alive = 1; proxy_response->src_fd = target_fd; proxy_response->dst_fd = fd; proxy_response->cond = &cond; proxy_response->alive = 1; pthread_t proxy_threads[2]; pthread_create(proxy_threads, NULL, serve_proxy_thread, proxy_request); pthread_create(proxy_threads + 1, NULL, serve_proxy_thread, proxy_response); while (proxy_request->alive && proxy_response->alive) { pthread_cond_wait(&cond, &mutex); } pthread_cancel(proxy_threads[0]); pthread_cancel(proxy_threads[1]); pthread_mutex_destroy(&mutex); pthread_cond_destroy(&cond); free(proxy_request); free(proxy_response); close(target_fd); close(fd);
2e72b12c55b8d5d63f098421e1b459bc
{ "intermediate": 0.43241146206855774, "beginner": 0.38504913449287415, "expert": 0.18253935873508453 }
21,025
generate a CRUD in my userService in angular
b545d192ff017ae9f3e517dbcbf1833c
{ "intermediate": 0.6296746134757996, "beginner": 0.14811615645885468, "expert": 0.2222091406583786 }
21,026
explain the below code: function appendFile(path: PathLike | FileHandle, data: string | Uint8Array, options?: (ObjectEncodingOptions & FlagAndOpenMode) | BufferEncoding | null): Promise<void>;
833946d43fc0baa3f8051fafbaf09eb8
{ "intermediate": 0.5650588870048523, "beginner": 0.2897565960884094, "expert": 0.14518453180789948 }
21,027
function hcyl(bottom, height, radius, id) { let radsq = radius * radius let innerRadsq = (radius - 1.2) * (radius - 1.2) height += bottom for (let x = -radius; x <= radius; x++) { for (let y = bottom; y < height; y++) { for (let z = -radius; z <= radius; z++) { let d = x * x + z * z if (d < radsq && d >= innerRadsq) { world.setBlock(p2.x + x, p2.y + y, p2.z + z, id) } } } } } function cyl(bottom, height, radius, id) { let radsq = radius * radius height += bottom for (let x = -radius; x <= radius; x++) { for (let y = bottom; y < height; y++) { for (let z = -radius; z <= radius; z++) { let d = x * x + z * z if (d < radsq) { world.setBlock(p2.x + x, p2.y + y, p2.z + z, id) } } } } } function cube(bottom, height, radius, id) { let radsq = radius * radius height += bottom for (let x = -radius; x <= radius; x++) { for (let y = bottom; y < height; y++) { for (let z = -radius; z <= radius; z++) { let d = x + z if (d < radsq) { world.setBlock(p2.x + x, p2.y + y, p2.z + z, id) } } } } } function sphereoid(w, h, d, id) { let w2 = w * w let h2 = h * h let d2 = d * d let w3 = (w - 1.5) * (w - 1.5) let h3 = (h - 1.5) * (h - 1.5) let d3 = (d - 1.5) * (d - 1.5) for (let y = -h; y < h; y++) { for (let x = -w; x <= w; x++) { for (let z = -d; z <= d; z++) { let n = x * x / w2 + y * y / h2 + z * z / d2 let n2 = x * x / w3 + y * y / h3 + z * z / d3 if (n < 1 && n2 >= 1) { world.setBlock(p2.x + x, p2.y + y, p2.z + z, id) } } } } } function sleep(ms) { return new Promise(resolve => setTimeout(() => resolve(), ms)) } async function asphereoid(w, h, d, id) { let px = p2.x let py = p2.y let pz = p2.z let w2 = w * w let h2 = h * h let d2 = d * d let w3 = (w - 1.5) * (w - 1.5) let h3 = (h - 1.5) * (h - 1.5) let d3 = (d - 1.5) * (d - 1.5) for (let y = -h; y < h; y++) { for (let x = -w; x <= w; x++) { for (let z = -d; z <= d; z++) { let n = x * x / w2 + y * y / h2 + z * z / d2 let n2 = x * x / w3 + y * y / h3 + z * z / d3 if (n < 1 && n2 >= 1) { world.setBlock(px + x, py + y, pz + z, id) await sleep(10) } } } } } function line(x1, y1, z1, x2, y2, z2, id) { let dx = Math.abs(x2 - x1); let dy = Math.abs(y2 - y1); let dz = Math.abs(z2 - z1); let sx = (x1 < x2) ? 1 : -1; let sy = (y1 < y2) ? 1 : -1; let sz = (z1 < z2) ? 1 : -1; let err1 = dx - dy; let err2 = dx - dz; let err3 = dy - dz; while (true) { world.setBlock(x1, y1, z1, id); if (x1 === x2 && y1 === y2 && z1 === z2) break; let e2 = 2 * err1; let e3 = 2 * err2; let e4 = 2 * err3; if (e2 > -dy) { err1 -= dy; err2 -= dz; x1 += sx; } if (e2 < dx) { err1 += dx; err3 -= dz; y1 += sy; } if (e3 > -dz) { err2 += dy; err3 += dx; z1 += sz; } } } function cloneBlock(sx, sy, sz, dx, dy, dz, w, h, l) { for (let x = 0; x < w; x++) { for (let y = 0; y < h; y++) { for (let z = 0; z < l; z++) { let block = world.getBlock(sx + x, sy + y, sz + z); world.setBlock(dx + x, dy + y, dz + z, block); } } } } function duplicateBlock(sx, sy, sz, dx, dy, dz, w, h, l, offsetX, offsetY, offsetZ, num) { for (let i = 0; i < num; i++) { cloneBlock(sx, sy, sz, dx + offsetX * i, dy + offsetY * i, dz + offsetZ * i, w, h, l); } } function rotateBlock(sx, sy, sz, dx, dy, dz, w, h, l, angle) { let rad = angle * (Math.PI / 180); let sin = Math.sin(rad); let cos = Math.cos(rad); for (let x = 0; x < w; x++) { for (let y = 0; y < h; y++) { for (let z = 0; z < l; z++) { let nx = Math.round(x * cos - z * sin); let nz = Math.round(x * sin + z * cos); let block = world.getBlock(sx + x, sy + y, sz + z); world.setBlock(dx + nx, dy + y, dz + nz, block); } } } } function fillBlock(sx, sy, sz, dx, dy, dz, id) { let w = Math.abs(dx - sx) + 1; let h = Math.abs(dy - sy) + 1; let l = Math.abs(dz - sz) + 1; let startX = Math.min(sx, dx); let startY = Math.min(sy, dy); let startZ = Math.min(sz, dz); for (let x = 0; x < w; x++) { for (let y = 0; y < h; y++) { for (let z = 0; z < l; z++) { world.setBlock(startX + x, startY + y, startZ + z, id); } } } } function moveBlock(sx, sy, sz, dx, dy, dz, w, h, l) { cloneBlock(sx, sy, sz, dx, dy, dz, w, h, l); fillBlock(sx, sy, sz, sx + w - 1, sy + h - 1, sz + l - 1, 0); } function paintBlock(sx, sy, sz, dx, dy, dz, w, h, l, colorId) { cloneBlock(sx, sy, sz, dx, dy, dz, w, h, l); for (let x = 0; x < w; x++) { for (let y = 0; y < h; y++) { for (let z = 0; z < l; z++) { world.setBlock(dx + x, dy + y, dz + z, colorId); } } } } function replaceBlock(sx, sy, sz, dx, dy, dz, id, newId) { let w = Math.abs(dx - sx) + 1; let h = Math.abs(dy - sy) + 1; let l = Math.abs(dz - sz) + 1; let startX = Math.min(sx, dx); let startY = Math.min(sy, dy); let startZ = Math.min(sz, dz); for (let x = 0; x < w; x++) { for (let y = 0; y < h; y++) { for (let z = 0; z < l; z++) { if (world.getBlock(startX + x, startY + y, startZ + z) === id) { world.setBlock(startX + x, startY + y, startZ + z, newId); } } } } } function mirrorBlock(sx, sy, sz, dx, dy, dz, w, h, l, axis) { if (axis === "x") { for (let x = 0; x < w; x++) { for (let y = 0; y < h; y++) { for (let z = 0; z < l; z++) { let block = world.getBlock(sx + x, sy + y, sz + z); world.setBlock(dx + w - x - 1, dy + y, dz + z, block); } } } } else if (axis === "y") { for (let x = 0; x < w; x++) { for (let y = 0; y < h; y++) { for (let z = 0; z < l; z++) { let block = world.getBlock(sx + x, sy + y, sz + z); world.setBlock(dx + x, dy + h - y - 1, dz + z, block); } } } } else if (axis === "z") { for (let x = 0; x < w; x++) { for (let y = 0; y < h; y++) { for (let z = 0; z < l; z++) { let block = world.getBlock(sx + x, sy + y, sz + z); world.setBlock(dx + x, dy + y, dz + l - z - 1, block); } } } } } function removeBlock(sx, sy, sz, dx, dy, dz, w, h, l, id) { copyBlock(sx, sy, sz, dx, dy, dz, w, h, l); for (let x = 0; x < w; x++) { for (let y = 0; y < h; y++) { for (let z = 0; z < l; z++) { if (world.getBlock(dx + x, dy + y, dz + z) === id) { world.setBlock(dx + x, dy + y, dz + z, 0); } } } } } function removeBlock2(id) { world.setBlock
69c9ca9b1811bb1d5715904ca525ecf9
{ "intermediate": 0.2089826762676239, "beginner": 0.5734841227531433, "expert": 0.2175331860780716 }
21,028
int send_data(int fd,char* data, size_t size) { ssize_t bytes_size; while(size>0) { bytes_size=write(fd,data,size); if(bytes_size>=0) { size-=bytes_size; data+=bytes_size; } else return -1; } return 0; } int send_file(int fd, int file) { const int buf_size = 4096; char buf[buf_size]; ssize_t bytes_read=read(file, buf, buf_size); int status=0; while (bytes_read>0) { status=send_data(fd, buf, bytes_read); if (status<0) return status; bytes_read=read(file, buf, buf_size); } return status; } int send_string(int fd, char* data) { return send_data(fd,data,strlen(data)); } char* join_string(char *str1, char *str2, size_t *size) { size_t len1 = strlen(str1); size_t len2 = strlen(str2); char *buffer = (char *) malloc(len1 + len2 + 1); memcpy(buffer,str1,len1); memcpy(buffer+len1,str2,len2+1); if (size != NULL) *size=(len1+len2)*sizeof(char); return buffer; } int get_file_size(int fd) { struct stat st; if (fstat(fd,&st)==-1) { return -1; } return st.st_size; } void serve_file(int fd, char* path) { /* TODO: PART 2 */ /* PART 2 BEGIN */ int file=open(path,O_RDONLY); char* content_length=(char*) malloc(sizeof(char)*100); snprintf(content_length, 100,"%d",get_file_size(file)); http_start_response(fd, 200); http_send_header(fd, "Content-Type", http_get_mime_type(path)); http_send_header(fd, "Content-Length", content_length); // TODO: change this line too http_end_headers(fd); send_file(fd,file); close(file); /* PART 2 END */ /* PART 2 END */ } void serve_directory(int fd, char* path) { http_start_response(fd, 200); http_send_header(fd, "Content-Type", http_get_mime_type(".html")); http_end_headers(fd); /* TODO: PART 3 */ /* PART 3 BEGIN */ // TODO: Open the directory (Hint: opendir() may be useful here) char* index_path = join_string(path, "/index.html", NULL); struct stat index_info; int result = stat(index_path, &index_info); if (result == 0) { // index.html exists, serve the file serve_file(fd, index_path); } else { DIR *directory=opendir(path); struct dirent* entry; while ((entry = readdir(directory)) != NULL) { char * file_name_buffer; if(strcmp(entry->d_name,"..")!=0) { int length = strlen("<a href=\"//\"></a><br/>") + strlen(path) + strlen(entry->d_name)*2 + 1; file_name_buffer = (char* ) malloc(length * sizeof(char)); http_format_href(file_name_buffer, path, entry->d_name); } else { int length = strlen("<a href=\"//\"></a><br/>") + strlen("..") + strlen("")*2 + 1; file_name_buffer = (char* ) malloc(length * sizeof(char)); http_format_href(file_name_buffer, "..", entry->d_name); } char* buffer1=(char*) malloc(1); buffer1[0]='\0'; buffer1=join_string(buffer1,file_name_buffer,NULL); size_t content_length; buffer1=join_string(buffer1,"</center></body></html>",&content_length); free(file_name_buffer); send_string(fd,buffer1); closedir(directory); return; } } /** * TODO: For each entry in the directory (Hint: look at the usage of readdir() ), * send a string containing a properly formatted HTML. (Hint: the http_format_href() * function in libhttp.c may be useful here) */ /* PART 3 END */ } /* * Reads an HTTP request from client socket (fd), and writes an HTTP response * containing: * * 1) If user requested an existing file, respond with the file * 2) If user requested a directory and index.html exists in the directory, * send the index.html file. * 3) If user requested a directory and index.html doesn't exist, send a list * of files in the directory with links to each. * 4) Send a 404 Not Found response. * * Closes the client socket (fd) when finished. */ void handle_files_request(int fd) { struct http_request* request = http_request_parse(fd); if (request == NULL || request->path[0] != '/') { http_start_response(fd, 400); http_send_header(fd, "Content-Type", "text/html"); http_end_headers(fd); close(fd); return; } if (strstr(request->path, "..") != NULL) { http_start_response(fd, 403); http_send_header(fd, "Content-Type", "text/html"); http_end_headers(fd); close(fd); return; } /* Remove beginning `./` */ char* path = malloc(2 + strlen(request->path) + 1); path[0] = '.'; path[1] = '/'; memcpy(path + 2, request->path, strlen(request->path) + 1); /* * TODO: PART 2 is to serve files. If the file given by `path` exists, * call serve_file() on it. Else, serve a 404 Not Found error below. * The `stat()` syscall will be useful here. * * TODO: PART 3 is to serve both files and directories. You will need to * determine when to call serve_file() or serve_directory() depending * on `path`. Make your edits below here in this function. */ /* PART 2 & 3 BEGIN */ struct stat info; int result=stat(path,&info); if(result!=0) { if (strcmp(request->path, "/") == 0) { char* index_path = malloc(strlen(path) + strlen("index.html") + 1); strcpy(index_path, path); strcat(index_path, "index.html"); result = stat(index_path, &info); if (result == 0) { serve_file(fd, index_path); } else { http_start_response(fd, 404); http_send_header(fd,"Content-Type", "text/html"); http_end_headers(fd); } free(index_path); } else { http_start_response(fd, 404); http_send_header(fd, "Content-Type", "text/html"); http_end_headers(fd); } } else { if(S_ISDIR(info.st_mode)) { serve_directory(fd,path); } if(S_ISREG(info.st_mode)) { serve_file(fd,path); } close(fd); return; } /* PART 2 & 3 END */ close(fd); return; } 修改代码使得可以通过样例点FAIL [Basic Server] Get the website home page (1.5 pt) Inconsistent response content with index.html How to reproduce: I put an index.html file inside a directory, and I started ./httpserver with the --files option. I sent a HTTP request for / to the web server, in order to see the index.html I created.请将修改部分标红
df1006a73277d86417e63e51f8c182c6
{ "intermediate": 0.3314846456050873, "beginner": 0.3267117142677307, "expert": 0.3418036103248596 }
21,029
Привет. Напиши программу на питоне, используя Kivy, которая будет скомпилирована в .apk файл. Программа сначала спрашивает порт, затем отображает чекбокс и две кнопки большие квадратные кнопки снизу друг за другом - одна с левой стороны, а другая - с правой.
03693bb7f9a8554610da7cc60e109a0f
{ "intermediate": 0.37185898423194885, "beginner": 0.28932058811187744, "expert": 0.3388203978538513 }
21,030
num <-trt$value[which(trt$No_TRT)] how to fix this code in R
58fe1328e7e167ff320e9154dcaee8b2
{ "intermediate": 0.3497142493724823, "beginner": 0.3774208128452301, "expert": 0.27286496758461 }
21,031
Как мне исправить эту ошибку ? Build file '\\wsl$\Ubuntu\home\adduser\demo\build.gradle' line: 42 A problem occurred evaluating root project 'demo'. > Could not find method run() for arguments [build_34dtutaatzjpx776qh2u5t5w5$_run_closure5@403e5346] on root project 'demo' of type org.gradle.api.Project. * Try: > Run with --stacktrace option to get the stack trace. > Run with --info or --debug option to get more log output. > Run with --scan to get full insights. мой файл : plugins { id 'org.springframework.boot' version '2.5.5' id 'io.spring.dependency-management' version '1.0.11.RELEASE' id 'java' id 'org.openjfx.javafxplugin' version '0.0.10' } group = 'com.marketplace' version = '1.0-SNAPSHOT' sourceCompatibility = '1.9' targetCompatibility = '1.9' repositories { mavenCentral() } dependencies { implementation 'org.springframework.boot:spring-boot-starter-data-jdbc' implementation 'org.springframework.boot:spring-boot-starter-data-jpa' implementation 'org.springframework.boot:spring-boot-starter-web' implementation 'org.postgresql:postgresql' implementation 'org.projectlombok:lombok' implementation 'com.google.code.gson:gson' implementation 'org.flywaydb:flyway-core' runtimeOnly 'org.postgresql:postgresql' testImplementation 'org.springframework.boot:spring-boot-starter-test' implementation 'org.openjfx:javafx-controls:11.0.2' implementation 'org.openjfx:javafx-fxml:11.0.2' } configurations { compileOnly { extendsFrom annotationProcessor } } test { useJUnitPlatform() } run{ doFirst { jvmArgs = [ '--module-path', classpath.asPath, '--add-modules', 'javafx.controls,javafx.fxml' ] } } (переделай этот файл без ошибок)
11adb1aeb466b2a6946453cd891a7b72
{ "intermediate": 0.6116523742675781, "beginner": 0.26784470677375793, "expert": 0.12050297111272812 }
21,032
Исправь эту ошибку : plugins { id 'org.springframework.boot' version '2.5.5' id 'io.spring.dependency-management' version '1.0.11.RELEASE' id 'java' id 'org.openjfx.javafxplugin' version '0.0.10' } group = 'com.marketplace' version = '1.0-SNAPSHOT' sourceCompatibility = '1.9' targetCompatibility = '1.9' repositories { mavenCentral() } dependencies { implementation 'org.springframework.boot:spring-boot-starter-data-jdbc' implementation 'org.springframework.boot:spring-boot-starter-data-jpa' implementation 'org.springframework.boot:spring-boot-starter-web' implementation 'org.postgresql:postgresql' implementation 'org.projectlombok:lombok' implementation 'com.google.code.gson:gson' implementation 'org.flywaydb:flyway-core' runtimeOnly 'org.postgresql:postgresql' testImplementation 'org.springframework.boot:spring-boot-starter-test' implementation 'org.openjfx:javafx-controls:11.0.2' implementation 'org.openjfx:javafx-fxml:11.0.2' } configurations { compileOnly { extendsFrom annotationProcessor } } test { useJUnitPlatform() } run{ doFirst { jvmArgs = [ '--module-path', classpath.asPath, '--add-modules', 'javafx.controls,javafx.fxml' ] } } мой файл : plugins { id 'org.springframework.boot' version '2.5.5' id 'io.spring.dependency-management' version '1.0.11.RELEASE' id 'java' id 'org.openjfx.javafxplugin' version '0.0.10' } group = 'com.marketplace' version = '1.0-SNAPSHOT' sourceCompatibility = '1.9' targetCompatibility = '1.9' repositories { mavenCentral() } dependencies { implementation 'org.springframework.boot:spring-boot-starter-data-jdbc' implementation 'org.springframework.boot:spring-boot-starter-data-jpa' implementation 'org.springframework.boot:spring-boot-starter-web' implementation 'org.postgresql:postgresql' implementation 'org.projectlombok:lombok' implementation 'com.google.code.gson:gson' implementation 'org.flywaydb:flyway-core' runtimeOnly 'org.postgresql:postgresql' testImplementation 'org.springframework.boot:spring-boot-starter-test' implementation 'org.openjfx:javafx-controls:11.0.2' implementation 'org.openjfx:javafx-fxml:11.0.2' } configurations { compileOnly { extendsFrom annotationProcessor } } test { useJUnitPlatform() } run{ doFirst { jvmArgs = [ '--module-path', classpath.asPath, '--add-modules', 'javafx.controls,javafx.fxml' ] } }
370a30d57cd7f5820acbec7711d8cf64
{ "intermediate": 0.37708592414855957, "beginner": 0.4945806562900543, "expert": 0.1283334493637085 }
21,033
IF SUBJECT_ID <- C('1001',1001',1001,'1002',1002','1002') and dose <- c(50,50,100,50,50,100) how to get the unique dose value for each subject in R
d90b901779b935efea2dbcddb37bf154
{ "intermediate": 0.37601324915885925, "beginner": 0.2252364605665207, "expert": 0.3987502455711365 }
21,034
how to achieve for each subject, the first record is n=1 ,else n+1 in R
d89041b1dca7190704915dad99ef8386
{ "intermediate": 0.34883785247802734, "beginner": 0.27880239486694336, "expert": 0.3723597526550293 }
21,035
Привет. Компилирую свой проект на Android в Buildozer с помощью "buildozer android debug", и тут ошибка:
4e5864d00a3880624a19dd8b764fe91e
{ "intermediate": 0.5729755163192749, "beginner": 0.22580690681934357, "expert": 0.20121756196022034 }
21,036
Who r u
c15d329720ecf8a86408ad0513eeeaf7
{ "intermediate": 0.39686915278434753, "beginner": 0.2802157402038574, "expert": 0.32291507720947266 }
21,037
void serve_forever(int* socket_number, void (*request_handler)(int)) { struct sockaddr_in server_address, client_address; size_t client_address_length = sizeof(client_address); int client_socket_number; // Creates a socket for IPv4 and TCP. *socket_number = socket(PF_INET, SOCK_STREAM, 0); if (*socket_number == -1) { perror("Failed to create a new socket"); exit(errno); } int socket_option = 1; if (setsockopt(*socket_number, SOL_SOCKET, SO_REUSEADDR, &socket_option, sizeof(socket_option)) == -1) { perror("Failed to set socket options"); exit(errno); } // Setup arguments for bind() memset(&server_address, 0, sizeof(server_address)); server_address.sin_family = AF_INET; server_address.sin_addr.s_addr = INADDR_ANY; server_address.sin_port = htons(server_port); /* * TODO: PART 1 * * Given the socket created above, call bind() to give it * an address and a port. Then, call listen() with the socket. * An appropriate size of the backlog is 1024, though you may * play around with this value during performance testing. */ /* PART 1 BEGIN */ /* PART 1 END */ printf("Listening on port %d...\n", server_port); #ifdef POOLSERVER /* * The thread pool is initialized *before* the server * begins accepting client connections. */ init_thread_pool(num_threads, request_handler); #endif while (1) { client_socket_number = accept(*socket_number, (struct sockaddr*)&client_address, (socklen_t*)&client_address_length); if (client_socket_number < 0) { perror("Error accepting socket"); continue; } printf("Accepted connection from %s on port %d\n", inet_ntoa(client_address.sin_addr), client_address.sin_port);解释代码
3bdd19bcc23281f635c610d1bd711242
{ "intermediate": 0.36042383313179016, "beginner": 0.3314911127090454, "expert": 0.30808505415916443 }
21,038
if a <-c( "a","a","a","a","b","b","b") how to create a new variable , for the first value of a, the new variable equal 1when the value of a changed, the new variable equal to 2 in R
a6bd6f5521d83f92bd5ec055f3a3bb67
{ "intermediate": 0.25726190209388733, "beginner": 0.5239123702049255, "expert": 0.21882568299770355 }
21,039
Как мне это исправить ? Execution failed for task ':compileJava'. > Could not resolve all files for configuration ':compileClasspath'. > Could not find org.projectlombok:lombok:. Required by: project : > Could not find org.springframework.boot:spring-boot-starter-data-jpa:. Required by: project : > Could not find org.springframework.boot:spring-boot-starter-web:. Required by: project : > Could not find com.google.code.gson:gson:. Required by: project : > Could not find org.flywaydb:flyway-core:. Required by: project : > Could not find org.postgresql:postgresql:. Required by: project : Possible solution: - Declare repository providing the artifact, see the documentation at https://docs.gradle.org/current/userguide/declaring_repositories.html
0e75028ba5f15cab9d2d72cf8f49b321
{ "intermediate": 0.543276846408844, "beginner": 0.24830159544944763, "expert": 0.208421528339386 }
21,040
open and close financial year using sql server
43c760b4cf33a7ba31c6679fe4511aa1
{ "intermediate": 0.30860909819602966, "beginner": 0.36603739857673645, "expert": 0.3253535330295563 }
21,041
void serve_forever(int* socket_number, void (*request_handler)(int)) { struct sockaddr_in server_address, client_address; size_t client_address_length = sizeof(client_address); int client_socket_number; // Creates a socket for IPv4 and TCP. *socket_number = socket(PF_INET, SOCK_STREAM, 0); if (*socket_number == -1) { perror("Failed to create a new socket"); exit(errno); } int socket_option = 1; if (setsockopt(*socket_number, SOL_SOCKET, SO_REUSEADDR, &socket_option, sizeof(socket_option)) == -1) { perror("Failed to set socket options"); exit(errno); } // Setup arguments for bind() memset(&server_address, 0, sizeof(server_address)); server_address.sin_family = AF_INET; server_address.sin_addr.s_addr = INADDR_ANY; server_address.sin_port = htons(server_port); /* * TODO: PART 1 * * Given the socket created above, call bind() to give it * an address and a port. Then, call listen() with the socket. * An appropriate size of the backlog is 1024, though you may * play around with this value during performance testing. */ /* PART 1 BEGIN */ if(bind(*socket_number,(struct sockaddr*)&server_address,sizeof(server_address))==-1) { perror("Failed to bind the socket"); exit(errno); } if(listen(*socket_number,1024)==-1) { perror("Failed to listen to the socket"); exit(errno); } /* PART 1 END */ printf("Listening on port %d...\n", server_port); #ifdef POOLSERVER /* * The thread pool is initialized *before* the server * begins accepting client connections. */ init_thread_pool(num_threads, request_handler); #endif while (1) { client_socket_number = accept(*socket_number, (struct sockaddr*)&client_address, (socklen_t*)&client_address_length); if (client_socket_number < 0) { perror("Error accepting socket"); continue; } printf("Accepted connection from %s on port %d\n", inet_ntoa(client_address.sin_addr), client_address.sin_port); #ifdef BASICSERVER /* * This is a single-process, single-threaded HTTP server. * When a client connection has been accepted, the main * process sends a response to the client. During this * time, the server does not listen and accept connections. * Only after a response has been sent to the client can * the server accept a new connection. */ request_handler(client_socket_number); #elif FORKSERVER /* * TODO: PART 5 * * When a client connection has been accepted, a new * process is spawned. This child process will send * a response to the client. Afterwards, the child * process should exit. During this time, the parent * process should continue listening and accepting * connections. */ /* PART 5 BEGIN */ /* PART 5 END */ #elif THREADSERVER /* * TODO: PART 6 * * When a client connection has been accepted, a new * thread is created. This thread will send a response * to the client. The main thread should continue * listening and accepting connections. The main * thread will NOT be joining with the new thread. */ /* PART 6 BEGIN */ /* PART 6 END */ #elif POOLSERVER /* * TODO: PART 7 * * When a client connection has been accepted, add the * client's socket number to the work queue. A thread * in the thread pool will send a response to the client. */ /* PART 7 BEGIN */ /* PART 7 END */ #endif } shutdown(*socket_number, SHUT_RDWR); close(*socket_number); } 填写part5实现基于Fork的服务器子进程应使用客户端套接字 fd 调用 request_handler。提供响应后,子进程将终止。 父进程将继续监听并接受传入连接。它不会等待子进程。 请记住,父进程和子进程都要适当关闭套接字。
161345c5144ff5922ccf4cf95239a9c4
{ "intermediate": 0.29118338227272034, "beginner": 0.4026552438735962, "expert": 0.30616143345832825 }
21,042
pourquoi ai je cette erreur ( devrait permettre au joueur 1 de déposer et définir l'état waitingPlayer: le montant du pari du player1 n'est pas mis à jour correctement + expected - actual -[object Object] +1000000000000000000( sur cette ligne " expect(player1Balance.toString()).to.equal(web3.utils.toWei("1", "ether"), "le montant du pari du player1 n'est pas mis à jour correctement"); " le test " it("devrait permettre au joueur 1 de déposer et définir l'état waitingPlayer", async () => { const betAmount = web3.utils.toWei("1", "ether"); const gameId = 1; const initialBalance = 0; await penduelInstance.createGame({ from: player1 }); const receipt = await penduelInstance.deposit({ from: player1, value: betAmount }); const game = await penduelInstance.games.call(gameId); const player1Balance = await penduelInstance.playerBalances(gameId, player1, {from: player1}); const gameTotalBet = await penduelInstance.gameTotalBets(gameId); const state = game.state; expect(game.player1Bet.bet.toString()).to.equal(betAmount, "le montant du pari du player1 n'est pas mis à jour correctement"); expect(player1Balance.toString()).to.equal(web3.utils.toWei("1", "ether"), "le montant du pari du player1 n'est pas mis à jour correctement"); expect(gameTotalBet.bet.toString()).to.equal(betAmount, "le montant du pari du player1 n'est pas mis à jour correctement"); expect(state.toNumber()).to.equal(1); // GameStatus.waitingForPlayers expect(game.player1).to.equal(player1, "Le joueur 1 n'est pas correctement enregistré"); expectEvent(receipt, "BetDeposited", { player: player1, bet: betAmount, state: "1" }); const finalBalance = await web3.eth.getBalance(player1); expect(finalBalance).to.be.bignumber.greatherThan(initialBalance); });" la fonction : function deposit() public payable { gameId = getGameId(); Game storage game = games[gameId]; require(msg.sender == game.player1 || msg.sender == game.player2, "invalid address"); require(state == State.createdGame, "game not created"); if (msg.sender == game.player1) { require(game.player1Bet.bet == 0, "already bet player1"); require(msg.value > 0, "bet more than 0"); game.player1Bet.bet = msg.value; state = State.waitingPlayer; } else if (msg.sender == game.player2) { require(!player2HasBet, "player2 has already bet"); require(game.player1Bet.bet > 0, "bets after the player1"); require(msg.value == game.player1Bet.bet, "bets the same amount as Player1"); player2HasBet = true; } playerBalances[gameId][msg.sender].balance += msg.value; gameTotalBets[gameId].bet += msg.value; if (player2HasBet && game.player1Bet.bet > 0) { state = State.waitingWord; } emit BetDeposited(msg.sender, msg.value, uint8(state)); }"
0fe54afc2ce065eab1ac0534618f262f
{ "intermediate": 0.34084203839302063, "beginner": 0.47470879554748535, "expert": 0.1844492107629776 }
21,043
var addElementBar = function(id) { var radioBarContainer = document.getElementById("radio-bar-menu") var div = document.createElement('div') div.innerHTML = `<input type="radio" id="${id}" name="radio-group" /> <label for="${id}">${id}</label> <br><br>` radioBarContainer.appendChild(div) var el = document.getElementById(id) el.addEventListener('click', function() { console.log(id) filterNode("id", id) }); } document.addEventListener('DOMContentLoaded', function() { s.graph.nodes().forEach(function(node) { addElementBar(node.id) }) });
6a320c9b88da7cadc0fba6a92401f94d
{ "intermediate": 0.35943469405174255, "beginner": 0.4223710596561432, "expert": 0.21819427609443665 }
21,044
please write code and instructions to executing a nodejs script (with libraries) from c++ with params
364e92bbb5729c42e7551407f1a7ee37
{ "intermediate": 0.599105954170227, "beginner": 0.2549716830253601, "expert": 0.14592233300209045 }
21,045
C++ worldtoscreen function
6f00938f1d41d8f5eda01c109b4f2b7e
{ "intermediate": 0.26229116320610046, "beginner": 0.3678201138973236, "expert": 0.36988869309425354 }
21,046
using playwright make a nodejs program to access a page, wait and check if a specific element appears, if it does, wait untill the program gets closed by force. run this concurently on 4 browsers
2f2acf579dbd73567e96cb3114229254
{ "intermediate": 0.465827077627182, "beginner": 0.24764153361320496, "expert": 0.2865314483642578 }
21,047
how to make text overlay for a window
0f0a3cb3abfce83a2d6b7153231bff36
{ "intermediate": 0.3692612051963806, "beginner": 0.38862061500549316, "expert": 0.2421182245016098 }
21,048
why is my browser not closing? const puppeteer = require("puppeteer"); const sendBrowser = async (page) => { const browser = await puppeteer.launch({ headless: false }); const tab = await browser.newPage(); await tab.setViewport({ width: 1080, height: 1920 }); await tab.goto(page); await browser.close(); };
19538c4f71d802c2e98d6f205f54ffeb
{ "intermediate": 0.6139194369316101, "beginner": 0.18869461119174957, "expert": 0.19738605618476868 }
21,049
What do I need to enter in argv for the conditions if ( v8 && strstr(argv[1], "flag") ) and if ( !strcmp(*argv, "./magic8ball") ) in code int __cdecl main(int argc, const char **argv, const char **envp) { unsigned int v3; // eax char *s[41]; // [rsp+10h] [rbp-160h] BYREF int v6; // [rsp+15Ch] [rbp-14h] __int64 v7; // [rsp+160h] [rbp-10h] int v8; // [rsp+16Ch] [rbp-4h] setvbuf(stdout, 0LL, 2, 0LL); v3 = time(0LL); srand(v3); if ( argc != 2 ) { puts("Every question has answer... if you know how to ask"); printf("Go ahead, ask me anything.\n"); exit(0); } v8 = 0; if ( !strcmp(*argv, "./magic8ball") ) { puts("Why, I guess you're right... I am magic :D"); v8 = 1; } qmemcpy(s, off_4024A0, 0x140uLL); puts("You asked:"); msleep(0LL, 500LL); printf("\"%s\"\n", argv[1]); msleep(1LL, 0LL); printf("Hmmm"); msleep(1LL, 0LL); putchar(46); msleep(1LL, 0LL); putchar(46); msleep(1LL, 0LL); putchar(46); msleep(1LL, 0LL); puts("."); msleep(2LL, 0LL); if ( v8 && strstr(argv[1], "flag") ) { puts("Why yes, here is your flag!"); print_flag(); } else { v7 = 40LL; v6 = rand() % 0x28uLL; puts(s[v6]); } return 0; }
ef65f2fa503d86664257594372c93243
{ "intermediate": 0.26783356070518494, "beginner": 0.5505120158195496, "expert": 0.1816544532775879 }
21,050
pthread_detach
d95720a9bf6dc74e0c4b43e72c0caac6
{ "intermediate": 0.29053279757499695, "beginner": 0.32431760430336, "expert": 0.38514962792396545 }
21,051
C++ DLL draw text on window
50bfce98c7c77326529eccc23b4c6d3d
{ "intermediate": 0.3452979624271393, "beginner": 0.39822980761528015, "expert": 0.2564721703529358 }
21,052
when using a cache for memoized operations, how to check if already present in cache without paying cost of conditional too much?
52213de96c0808b42c9012c53bcf3371
{ "intermediate": 0.2634502351284027, "beginner": 0.1292712688446045, "expert": 0.6072785258293152 }
21,053
C# draw text on screen over a window and follow window when it moves
e9c3987450bf96f2a3776079e9e055dc
{ "intermediate": 0.504906177520752, "beginner": 0.23197489976882935, "expert": 0.2631189227104187 }
21,054
Hi
76da21e7cd07ff7ebbe6ef72d6c1d6dd
{ "intermediate": 0.33010533452033997, "beginner": 0.26984941959381104, "expert": 0.400045245885849 }
21,055
C# draw text on screen over a window and follow window when it moves
583c2d0d19e34e66a434126147772ca6
{ "intermediate": 0.504906177520752, "beginner": 0.23197489976882935, "expert": 0.2631189227104187 }
21,056
C++ draw text on screen over a window and follow window when it moves
92c73377a2da012eafa5d20309b7ad29
{ "intermediate": 0.3504936695098877, "beginner": 0.2779073119163513, "expert": 0.3715989887714386 }
21,057
C++ DLL draw text on screen over a window and follow window when it moves
f213628665741b70d9b1a61df98638c5
{ "intermediate": 0.42912858724594116, "beginner": 0.2605469822883606, "expert": 0.31032446026802063 }
21,058
C++ injected DLL draw text on screen over a window and follow window when it moves
2dd49c209de18e250ab34fa8826c3590
{ "intermediate": 0.4452296793460846, "beginner": 0.22092510759830475, "expert": 0.33384522795677185 }
21,059
rewrite this turbo c code: a
c7d5813b6b2e41896ab0bbd2c26eb33d
{ "intermediate": 0.3062137961387634, "beginner": 0.34755098819732666, "expert": 0.3462352156639099 }
21,060
hello
06f0762acc98b01ea36f9dcec10900b8
{ "intermediate": 0.32064199447631836, "beginner": 0.28176039457321167, "expert": 0.39759764075279236 }
21,061
using this script: import requests from bs4 import BeautifulSoup import re import multiprocessing session_guid: str search_secret: str ## login via username and password to ubox mobile, retrives sessionGUID which will be used to access POS for secret def login(username, password): uboxMobile = "https://uboxmobile.uhaul.net/Launcher/" loginData = {"Smid": username, "Password": password, "EntityCode": ""} r = requests.post(url=uboxMobile, data=loginData, allow_redirects=True) ## fetch sessionGUID for urls in r.history: urls.headers = str(urls.headers) pattern = r"sessionGuid=([^&]+)" match = re.search(pattern, urls.headers) if match: session_guid = match.group(1) return session_guid else: return str(r.status_code) + f"\n{r.text}\n{str(r.status_code)}" ## catch anything else and display what it is try: soup = BeautifulSoup(r.content, "html.parser") results = soup.find('div', class_ = "validation-summary-errors") if results.text.strip() == "Invalid login.": return 'invalid login' except Exception: ## dogshit skiddery idc pass """ pool = multiprocessing.Pool(processes=procNum) posGuid = pool.starmap(login, [(c["username"], c["password"]) for c in credentials]) # df010517:Dartmouth123 pool.close() pool.join() """ ### pos login def returnData(guid, term): params = {'app': 'CSFRewrite', 'guid': f'{guid}', 'entity': '10517', 'isDealer': 'True'} posUrl = "https://poslogin.uhaul.net/secure/LaunchToSite/Launch.aspx" r = requests.Session() ## start POS session p = r.post(url=posUrl, params=params, allow_redirects=True) lookupUrl = p.url.strip('/Index') + f"/Customer/SearchForCustomer" ## skiddery cleanup for url s = r.post(lookupUrl, data={'searchItem': term }) ## json format will be id: phoneNumber / Email ### catch if invalid request try: invalidUrl = "https://pos.uhaul.net/secure/CSFRewriteConsole3/Account/Timeout" ### login failure if r.url == invalidUrl: print("error reached the following URL: " + r.url) else: pass except Exception: pass return s.text print(returnData(login("aaditya4u","Aadi@1985"), "test@uhaul.com")) incorporate the functions into the following: import json import requests from bs4 import BeautifulSoup import random class uHaul: def __init__(self, username, password, entity='', debugMode=False, proxy=""): self.username = username self.password = password self.debugMode = debugMode self.authenticated = False self.proxies=dict(http=proxy,https=proxy) self.entity = entity self.sessionSecret = '' self.session = self.createSession() self.authenticate() def dprint(self, msg): if(self.debugMode): print("[debug] ---> " + str(msg)) def createSession(self): session = requests.Session() self.dprint("Init requests session...") session.headers.update({ 'User-Agent': 'Mozilla/5.0 (X11; Linux x86_64; rv:109.0) Gecko/20100101 Firefox/117.0' }) session.proxies.update(self.proxies) return session def authenticate(self): postData = {'Username':self.username, 'Password':self.password, 'Entity':self.entity } req = self.session.post("https://pos.uhaul.net/secure/CSFRewriteConsole2/Account/Login",data=postData) ## need to change success key if ('<title>Reservation Details</title>' in req.text): self.authenticated = True self.sessionSecret = req.history[1].headers['Location'].split("/")[3] # secret0 = req.history[0].url self.dprint("Authenticated! ") self.dprint("Sessuib secret = " + str(self.sessionSecret)) else: self.dprint("Failed to authenticate") def searchForCustomer(self,customer): secretsessionid = self.sessionSecret url = f"https://pos.uhaul.net/secure/CSFRewriteConsole2/{secretsessionid}/Customer/SearchForCustomer" postData = { 'searchItem': customer } req = self.session.post(url,data=postData) self.dprint(req.text) result = json.loads(req.text) self.dprint("[" + str(result['success']) + f"] ---- customer lookup status for [{customer}]") uhaul_username = "aaditya4u" uhaul_password = "Aadi@1985" mainaccount = uHaul(uhaul_username, uhaul_password, debugMode=True) mainaccount.searchForCustomer("test@uhaul.com")
cd01b702e76d9c85565f22525a603cc8
{ "intermediate": 0.3028401732444763, "beginner": 0.4506831169128418, "expert": 0.24647678434848785 }
21,062
incorporate the following in this script: (ALL REQUESTS WILL USE PROXIES): accounts.json file which has all the accounts we will use separate login function that is parallelized (multiprocess) which returns the session token or what ever in order to search now for searching: we will have 1 file with the data and we want each account to search parts of the data on uhaul api in chunks. if response 200 we store the raw data the apii returns in .json file - if any other error besides it not being existent we sleep 5-10 seconds and try again (max retires 3) here is the script: import json import requests from bs4 import BeautifulSoup import random class uHaul: def __init__(self, username, password, entity='', debugMode=False, proxy=""): self.username = username self.password = password self.debugMode = debugMode self.authenticated = False self.proxies=dict(http=proxy,https=proxy) self.entity = entity self.sessionSecret = '' self.session = self.createSession() self.authenticate() def dprint(self, msg): if(self.debugMode): print("[debug] ---> " + str(msg)) def createSession(self): session = requests.Session() self.dprint("Init requests session...") session.headers.update({ 'User-Agent': 'Mozilla/5.0 (X11; Linux x86_64; rv:109.0) Gecko/20100101 Firefox/117.0' }) session.proxies.update(self.proxies) return session def authenticate(self): postData = {'Username':self.username, 'Password':self.password, 'Entity':self.entity } req = self.session.post("https://pos.uhaul.net/secure/CSFRewriteConsole3/Account/Login",data=postData) ## need to change success key if ('<title>Reservation Details</title>' in req.text): self.authenticated = True self.sessionSecret = req.history[1].headers['Location'].split("/")[3] # secret0 = req.history[0].url self.dprint("Authenticated! ") self.dprint("Sessuib secret = " + str(self.sessionSecret)) else: self.dprint("Failed to authenticate") def searchForCustomer(self,customer): secretsessionid = self.sessionSecret url = f"https://pos.uhaul.net/secure/CSFRewriteConsole3/{secretsessionid}/Customer/SearchForCustomer" postData = { 'searchItem': customer } req = self.session.post(url,data=postData) self.dprint(req.text) result = json.loads(req.text) self.dprint("[" + str(result['success']) + f"] ---- customer lookup status for [{customer}]") uhaul_username = "aaditya4u" uhaul_password = "Aadi@1985" mainaccount = uHaul(uhaul_username, uhaul_password, debugMode=True) mainaccount.searchForCustomer("test@uhaul.com")
6499d196f606da411d63d4daec362f6c
{ "intermediate": 0.27204930782318115, "beginner": 0.5930719375610352, "expert": 0.13487879931926727 }
21,063
using this script, can you paralize the following function? searchForCustomer import json import requests from bs4 import BeautifulSoup import random from multiprocessing import Pool from proxy_pool import ProxyPool class uHaul: def init(self, username, password, entity=‘’, debugMode=False, proxy=‘’): self.username = username self.password = password self.debugMode = debugMode self.authenticated = False self.proxy = proxy self.entity = entity self.sessionSecret = ‘’ self.session = self.createSession() self.authenticate() def dprint(self, msg): if self.debugMode: print(‘[debug] —> ’ + str(msg)) def createSession(self): session = requests.Session() self.dprint(‘Init requests session…’) session.headers.update({ ‘User-Agent’: ‘Mozilla/5.0 (X11; Linux x86_64; rv:109.0) Gecko/20100101 Firefox/117.0’ }) session.proxies.update(self.proxy.get_proxy()) return session def authenticate(self): postData = { ‘Username’: self.username, ‘Password’: self.password, ‘Entity’: self.entity } req = self.session.post(‘https://pos.uhaul.net/secure/CSFRewriteConsole3/Account/Login’, data=postData) if ‘<title>Reservation Details</title>’ in req.text: self.authenticated = True self.sessionSecret = req.history[1].headers[‘Location’].split(’/‘)[3] self.dprint(‘Authenticated!’) self.dprint(‘Session secret = ’ + str(self.sessionSecret)) else: self.dprint(‘Failed to authenticate’) def searchForCustomer(self, customer): secretsessionid = self.sessionSecret url = f’https://pos.uhaul.net/secure/CSFRewriteConsole3/{secretsessionid}/Customer/SearchForCustomer’ postData = {‘searchItem’: customer} req = self.session.post(url, data=postData) result = json.loads(req.text) self.dprint(’[’ + str(result[‘success’]) + f’] ---- customer lookup status for [{customer}]') def login(account, proxy_pool): # Function to login with each account using proxies username = account[‘username’] password = account[‘password’] proxy = proxy_pool.get_proxy() account_session = uHaul(username, password, proxy=proxy) return account_session # Initialize Proxy Pool proxy_pool = ProxyPool() # Load the accounts from accounts.json with open(‘accounts.json’) as f: accounts = json.load(f) # Parallelize the login function using multiprocessing with Pool() as p: sessions = p.starmap(login, [(account, proxy_pool) for account in accounts]) # Perform searching using each account’s session for session in sessions: session.searchForCustomer(‘test@uhaul.com’)
5b5d521cf1ca6575833420acbd627c30
{ "intermediate": 0.35635507106781006, "beginner": 0.4852379560470581, "expert": 0.1584070473909378 }
21,064
will parraelization overwrite the file results? import json import requests from bs4 import BeautifulSoup import random import time from multiprocessing import Pool, cpu_count saved = open("saved.txt", "a+") class uHaul: def init(self, username, password, entity='', debugMode=False, proxy=''): self.username = username self.password = password self.debugMode = debugMode self.authenticated = False self.proxy = proxy self.entity = entity self.sessionSecret = '' self.session = self.createSession() self.authenticate() def dprint(self, msg): if self.debugMode: print('[debug] --> ' + str(msg)) def createSession(self): session = requests.Session() self.dprint('Init requests session…') session.headers.update({ 'User-Agent': 'Mozilla/5.0 (X11; Linux x86_64; rv:109.0) Gecko/20100101 Firefox/117.0' }) session.proxies.update(self.proxy) return session def authenticate(self): postData = { 'Username': self.username, 'Password': self.password, 'Entity': self.entity } req = self.session.post('https://pos.uhaul.net/secure/CSFRewriteConsole3/Account/Login', data=postData) if '<title>Reservation Details</title>' in req.text: self.authenticated = True self.sessionSecret = req.history[1].headers['Location'].split('/')[3] self.dprint('Authenticated!') self.dprint('Session secret = ' + str(self.sessionSecret)) else: self.dprint('Failed to authenticate') def searchForCustomer(self, customer): secretsessionid = self.sessionSecret url = f'https://pos.uhaul.net/secure/CSFRewriteConsole3/{secretsessionid}/Customer/SearchForCustomer' postData = {'searchItem': customer} req = self.session.post(url, data=postData) ## check for invalid resp if req.text == '{"success":false,"data":null,"hasQuotes":false,"reservationLinks":null}': self.dprint(f'invalid lookup: {customer}') elif req.status_code != 200: self.dprint(f'invalid lookup: error:{req.text}\nstatus code:{str(req.status_code)}') else: result = json.loads(req.text) self.dprint('[' + str(result['success']) + f'] ---- customer lookup status for [{customer}]') saved.write(str(result)+'\n') saved.flush() def process_customer_chunk(account, customers_chunk): username = account['username'] password = account['password'] proxy = account['proxy'] account_session = uHaul(username, password, proxy=proxy) for customer in customers_chunk: account_session.searchForCustomer(customer) time.sleep(3) ##max retries is gay cuz two only 2 possible errors and we already check for those xd # Load the accounts from accounts.json with open('accounts.json') as f: accounts = json.load(f) # Load customer data from customer_data.txt with open('customer_data.txt') as f: customers = f.read().splitlines() # Load proxies from a file with open('proxies.txt') as f: lines = f.read().splitlines() proxies = [{'http': line, 'https': line} for line in lines] # Perform searching in parallel using multiprocessing and proxies # Determine the number of available CPU cores num_cores = cpu_count() # Split the customers into chunks based on the number of CPU cores customer_chunks = [customers[i::num_cores] for i in range(num_cores)] # Perform searching in parallel using multiprocessing and proxies with Pool(processes=num_cores) as p: p.starmap(process_customer_chunk, [(account, customers_chunk) for account in accounts for customers_chunk in customer_chunks]) if so, please fix it
1325ded51fe40309eeccb7829957a818
{ "intermediate": 0.3148733675479889, "beginner": 0.5706126689910889, "expert": 0.11451394855976105 }
21,065
suivant "state = State.waitingPlayer;" comment faire un test unitaire avec "expect" ? " enum State { createdGame, waitingPlayer, waitingWord, wordGenerated, firstLetter, inProgress, finished } " " la variable d'état : State public state;
a326d44bd0021c7186497b70d735e0f5
{ "intermediate": 0.22579436004161835, "beginner": 0.593164324760437, "expert": 0.18104133009910583 }
21,066
Hi please solve this. For your assignment, you are going to do Programming Project #6 at the end of Chapter 2 in the textbook - do not do the harder version. An employee is paid at a rate of $16.78 per hour for the first 40 hours worked in a week. Any hours over that are paid at the overtime rate of one-and-one-half times that. From the worker’s gross pay, 6% is withheld for Social Security tax, 14% is withheld for federal income tax, 5% is withheld for state income tax, and $10 per week is withheld for union dues. If the worker has three or more dependents, then an additional $35 is withheld to cover the extra cost of health insurance beyond what the employer pays. Write a program that will read in the number of hours worked in a week and the number of dependents as input and will then output the worker’s gross pay, each withholding amount, and the net take-home pay for the week. Submit the code and a screenshot of the output.
69b821e6acddf8393776660581934552
{ "intermediate": 0.3205825984477997, "beginner": 0.3608036935329437, "expert": 0.318613737821579 }
21,067
Coding planet name generator
15ea3f9e79916a9a2f1f3d13fcbbde00
{ "intermediate": 0.21445226669311523, "beginner": 0.2991682291030884, "expert": 0.4863795042037964 }
21,068
I am making a wxwidgets c++ project, I want that when I select an element in a combobox it doesn't change the one it has but add a new one if not in the Text value, that way I can select multiple elements. How can I do that?
0e6230771dd264310d1ee992a923e2c6
{ "intermediate": 0.6825015544891357, "beginner": 0.11230353266000748, "expert": 0.20519493520259857 }
21,069
Coding planet name generator
315c6603166433af46c10532a8a378fa
{ "intermediate": 0.21445226669311523, "beginner": 0.2991682291030884, "expert": 0.4863795042037964 }
21,070
Coding planet name generator
dcc172df91f718ee6cdbaf7f43c46ce6
{ "intermediate": 0.21445226669311523, "beginner": 0.2991682291030884, "expert": 0.4863795042037964 }
21,071
I'm doing markup in android studio, what's the difference between match_parent and wrap_content? Are there other similar options?
81d90b0d5348e6dbff3ef28f3a778db5
{ "intermediate": 0.3949566185474396, "beginner": 0.29928818345069885, "expert": 0.30575525760650635 }
21,072
I am making a wxwidgets c++ project, I want that when I select an element in a combobox it doesn’t change the one it has but add a new one if not in the Text value, likewise clicking an element already exist should remove it from the text value, that way I can select multiple elements. How can I do that?
f20a7b3eef22214f2463870438445dda
{ "intermediate": 0.7652462124824524, "beginner": 0.08446607738733292, "expert": 0.15028773248195648 }
21,073
(2.4 + 64/3.5 +8.3 *(12.5^3))/(76.4^0.5 -28 /15) in matlab
088105fe22d4f929b6d99cf41b936492
{ "intermediate": 0.24988670647144318, "beginner": 0.3429248631000519, "expert": 0.40718841552734375 }
21,074
I have some button movenext and lastrecord and firstrecord So On Error Resume Next If Hrs.EOF Then Exit Sub Else With Me .ID = Hrs.Fields(0) .Crname = Hrs.Fields(1) .CrUint = Hrs.Fields(2) .CrCreat = Hrs.Fields(3) .CrCreatbyU = Hrs.Fields(4) .Requery End With End If i definition code show when load forms i call show to show date and movenext give me message error after go to last record
0bbdad09098adf32f5e5be48db65e167
{ "intermediate": 0.5121007561683655, "beginner": 0.28561311960220337, "expert": 0.20228609442710876 }
21,075
read all csv files in the current folder
a88651713aa678aab1e70e815a3b88ad
{ "intermediate": 0.29714056849479675, "beginner": 0.1925099790096283, "expert": 0.510349452495575 }
21,076
I have this xml: <w:r w:rsidR="5BF19456"> <w:rPr/> <w:t>fourPLUSthree</w:t> </w:r> how using only sax parcer and java 8 get "fourPLUSthree"?
9042a9055ebe4eb4f2aecbcdfa569777
{ "intermediate": 0.4257279336452484, "beginner": 0.3115483522415161, "expert": 0.2627236545085907 }
21,077
in unity, I want to add an upward force to an object in which it initially goes slowly but gradually speed up to a certain heigh
bf532401e6496c1fa08544b4986910c5
{ "intermediate": 0.4066748023033142, "beginner": 0.20368161797523499, "expert": 0.3896436095237732 }
21,078
In unity, when an object enter a trigger, I would like the trigger to gradually add force to the object until the object travelled for a certain distance. The force should start with 0, and exponentially increase to 10. Can you write the code for me
9a4b06f6f386a9179ec00bf5844844f1
{ "intermediate": 0.37119123339653015, "beginner": 0.1483924686908722, "expert": 0.48041632771492004 }
21,079
rewrite the code but should have the same#include <stdio.h> #include <stdlib.h> struct Tuple { int x; int y; }; struct Node { struct Tuple data; struct Node* next; }; typedef struct Tuple Tuple; typedef struct Node Node; Node* createNode(Tuple data) { Node* newNode = (Node*)malloc(sizeof(Node)); newNode->data = data; newNode->next = NULL; return newNode; } void printList(Node* head) { Node* current = head; printf("[ "); while (current != NULL) { printf("(%d,%d) ", current->data.x, current->data.y); current = current->next; } printf("]\n"); } void deleteNode(Node** head, Tuple data) { Node* current = *head; Node* prev = NULL; while (current != NULL) { if (current->data.x == data.x && current->data.y == data.y) { if (prev == NULL) { *head = current->next; } else { prev->next = current->next; } free(current); return; } prev = current; current = current->next; } } int main() { Node* originalList = NULL; originalList = createNode((Tuple){3, 6}); originalList->next = createNode((Tuple){5, 4}); originalList->next->next = createNode((Tuple){4, 11}); originalList->next->next->next = createNode((Tuple){13, 30}); originalList->next->next->next->next = createNode((Tuple){12, 2}); originalList->next->next->next->next->next = createNode((Tuple){10, 1}); printf("Original List: "); printList(originalList); Node* current = originalList; while (current != NULL) { printf("Deleted value: (%d,%d)\n", current->data.x, current->data.y); Node* next = current->next; free(current); current = next; } originalList = NULL; printf("List after deleting all items: "); printList(originalList); originalList = createNode((Tuple){3, 6}); originalList->next = createNode((Tuple){5, 4}); originalList->next->next = createNode((Tuple){4, 11}); originalList->next->next->next = createNode((Tuple){13, 30}); originalList->next->next->next->next = createNode((Tuple){12, 2}); originalList->next->next->next->next->next = createNode((Tuple){10, 1}); printf("Restored List: "); printList(originalList); Tuple searchTuple = {5, 4}; current = originalList; Node* prev = NULL; while (current != NULL) { if (current->data.x == searchTuple.x && current->data.y == searchTuple.y) { printf("Element found: (%d,%d)\n", current->data.x, current->data.y); deleteNode(&originalList, searchTuple); printf("List after deleting an item: "); printList(originalList); } prev = current; current = current->next; } if (current == NULL) { printf("Element not found.\n"); } int swapped; Node* lastNode = NULL; do { swapped = 0; current = originalList; while (current->next != lastNode) { if (current->data.x > current->next->data.x) { Tuple temp = current->data; current->data = current->next->data; current->next->data = temp; swapped = 1; } current = current->next; } lastNode = current; } while (swapped); printf("List after sorting the data: "); printList(originalList); Node* prevNode = NULL; Node* nextNode = NULL; current = originalList; while (current != NULL) { nextNode = current->next; current->next = prevNode; prevNode = current; current = nextNode; } originalList = prevNode; printf("List after reversing the data: "); printList(originalList); while (originalList != NULL) { Node* next = originalList->next; free(originalList); originalList = next; } return 0; }
ddd268ff38f9688f6d274a0a7e246e37
{ "intermediate": 0.31267014145851135, "beginner": 0.5230937004089355, "expert": 0.16423611342906952 }
21,080
use C++ You are given the following main function that creates a generic pair object with integer type, sets the first and second to the given values, swaps the items and prints the items. Pair class is not provided. You are asked to provide implementation for Pair class so that the main method works successfully. #include <iostream> using namespace std; //your code goes here int main() { Pair<int> pair; int x=2, y=3; pair.setFirst(x); pair.setSecond(y); pair.print(); //prints-> 2 : 3 pair.swap(); pair.print(); //prints-> 3 : 2 return 0; }
aa83ea1d1de2046937502e3470d53d22
{ "intermediate": 0.3299631178379059, "beginner": 0.5144404768943787, "expert": 0.15559640526771545 }
21,081
I have this course controller for a aspnet core project i want to understand what is this for? using Microsoft.AspNetCore.Mvc; using Microsoft.EntityFrameworkCore; using Project.Data; using Project.Interfaces; using Project.ViewModels; using Project.Models; using Project.Data.Enum; namespace Project.Controllers { public class CourseController : Controller { private readonly ICourseRepository _courseRepository; public CourseController(ICourseRepository courseRepository) /* ApplicationDbContext is our Database */ { _courseRepository = courseRepository; } public async Task<IActionResult> Index( ) { IEnumerable<Course> courses = await _courseRepository.GetAll( ); /* Bringing all the table from database and drop into your table */ return View(courses); } public async Task<IActionResult> Detail(int id) { Course course = await _courseRepository.GetByIdAsync(id); return View(course); } public IActionResult Create() { return View( ); } [HttpPost] public async Task<IActionResult> Create(Course course) { if (!ModelState.IsValid) { return View(course); } course.ImageURL = "https://s.udemycdn.com/home/top-categories/lohp-category-development-v2.jpg"; _courseRepository.Add(course); return RedirectToAction("Index"); } public async Task<IActionResult> Edit(int id) { var course = await _courseRepository.GetByIdAsync(id); if(course == null) return View("Error"); var courseVM = new EditCourseViewModel { Title = course.Title, Description = course.Description, Image = course.ImageURL, CourseCategory = course.Category }; return View(courseVM); } [HttpPost] public async Task<IActionResult> Edit(int id, EditCourseViewModel courseVM) { if(!ModelState.IsValid) { ModelState.AddModelError("","Failed to edit course"); return View("Edit", courseVM); } var userCourse = await _courseRepository.GetByIdAsyncNoTracking(id); if(userCourse != null) { var course = new Course { CourseID = id, Title = courseVM.Title, Description = courseVM.Description, ImageURL = "Default", }; _courseRepository.Update(course); return RedirectToAction("Index"); } else { return View(courseVM); } } public async Task<IActionResult> Delete(int id) { var courseDetails = await _courseRepository.GetByIdAsync(id); if(courseDetails == null) return View("Error"); return View(courseDetails); } [HttpPost, ActionName("Delete")] public async Task<IActionResult> DeleteCourse(int id) { var courseDetails = await _courseRepository.GetByIdAsync(id); if(courseDetails == null) return View("Error"); _courseRepository.Delete(courseDetails); return RedirectToAction("Index"); } } }
f8206ba504514919fb833e6c32f79a20
{ "intermediate": 0.46429944038391113, "beginner": 0.37128570675849915, "expert": 0.1644148975610733 }
21,082
Using the following MatLab code, dress up your initials. Use different size symbols, different shapes and fills for 𝑍o. % Transform Initials % What this MATLAB script does: % 1) Plots my initials using scatter() in the complex plane. % 2) Transforms initials using addition/multiplication of complex numbers % 3) get creative? %% initialize initials clear all % never not do this! % ----------------------------------------- % x= 012345678901234567890 % y=6 *** *** % 5 * * * % 4 * * * % 3 * *** % 28 pts total (by counting!) % 2 * * * % 1 * * * % 0 *** *** % x= 012345678901234567890 % ----------------------------------------- manually enter the coordinates npts = 6; Zo = zeros(1,npts); % preallocate the Zo array % ------------------------- Zo( 1) = 3 + 1i*0; Zo( 2) = 4 + 1i*0; Zo( 3) = 5 + 1i*0; Zo( 4) = 11 + 1i*0; Zo( 5) = 12 + 1i*0; Zo( 6) = 13 + 1i*0; % ------------------------- Zo( 7) = 2 + 1i*1; Zo( 8) = 11 + 1i*1; Zo( 9) = 14 + 1i*1; % ------------------------- Zo(10) = 0 + 1i*2; Zo(11) = 11 + 1i*2; Zo(12) = 14 + 1i*2; % ------------------------- Zo(13) = 0 + 1i*3; Zo(14) = 11 + 1i*3; Zo(15) = 12 + 1i*3; Zo(16) = 13 + 1i*3; % ------------------------- Zo(17) = 0 + 1i*4; Zo(18) = 11 + 1i*4; Zo(19) = 14 + 1i*4; % ------------------------- Zo(20) = 1 + 1i*5; Zo(21) = 11 + 1i*5; Zo(22) = 14 + 1i*5; % ------------------------- Zo(23) = 2 + 1i*6; Zo(24) = 3 + 1i*6; Zo(25) = 4 + 1i*6; Zo(26) = 11 + 1i*6; Zo(27) = 12 + 1i*6; Zo(28) = 13 + 1i*6; % ---------------------------------------------- check my inputed initials figure(1); clf; scatter(real(Zo),imag(Zo),75,'blue','filled'); figure(1); %error('stop here for now'); %% calculate center of mass and translate initials % ---------------------------- method 1 %xCM = mean(real(Zo)); %yCM = mean(imag(Zo)); %Zo = Zo - (xCM + 1i*yCM); % ---------------------------- method 2 zCM = mean(Zo); % <= real & imaginary components act as a 2D vector Zo = Zo - zCM; % --------------------------------------------- check my centered initials figure(1); clf; axis equal % optional scatter(real(Zo),imag(Zo),75,'blue','filled'); figure(1); % --------------------------------------------- setting limits is optional %{ xMIN = min(real(Zo)); xMAX = max(real(Zo)); yMIN = min(imag(Zo)); yMAX = max(imag(Zo)); xMIN = xMIN - 0.5; xMAX = xMAX + 0.5; yMIN = yMIN - 0.5; yMAX = yMAX + 0.5; xlim( [xMIN,xMAX]); ylim( [yMIN,yMAX]); %} %error('stop here for now'); %% do translations % for i=1:5 dZ = input('enter dZ for translation: '); Znew = Zo + dZ; figure(1); clf; scatter(real(Zo),imag(Zo),100,[0.85,0.85,0.85],'filled'); hold on; scatter(real(Znew),imag(Znew),100,'blue','filled'); figure(1); end %} %% do rotations %{ for i=1:5 phi = input('enter phi for rotations (in degrees): '); phi = pi*phi/180; Zrot = exp(1i*phi); Znew = Zrot*Zo; figure(1); clf; scatter(real(Zo),imag(Zo),100,[0.85,0.85,0.85],'filled'); hold on; scatter(real(Znew),imag(Znew),100,'blue','filled'); figure(1); end %} %% do general Z-multiplication %{ for i=1:5 disp('Enter Z as R*exp(iphi)'); R = input('enter R for magnitude of Z: '); phi = input('enter phi for rotations (in degrees): '); phi = pi*phi/180; Zmult = R*exp(1i*phi); Znew = Zmult*Zo; figure(1); clf; scatter(real(Zo),imag(Zo),100,[0.85,0.85,0.85],'filled'); hold on; scatter(real(Znew),imag(Znew),100,'blue','filled'); figure(1); end %}
6083419164a074deb5fa311d6ec441a9
{ "intermediate": 0.3246302008628845, "beginner": 0.363605797290802, "expert": 0.3117640018463135 }
21,083
write a glut and nuklear ui pure C simple integration in windows
84f2cba9933a07aaf3ac4e510577643b
{ "intermediate": 0.2511141896247864, "beginner": 0.501432478427887, "expert": 0.24745334684848785 }
21,084
I am trying to program a hair color simulator with inheritance, how can I code the two types of melanin: eumelanin and pheomelanin? And how would be its inheritance?
4be5eae690918f7a9681aac3681295e1
{ "intermediate": 0.2880966067314148, "beginner": 0.1528659611940384, "expert": 0.5590373873710632 }
21,085
it is great fun 和it is great funny区别
95a16e41c28acbfcf607c72f123e14aa
{ "intermediate": 0.34805941581726074, "beginner": 0.3454814851284027, "expert": 0.3064590394496918 }
21,086
Consider the simple stiff Ordinary Differential Equation: u' = -1000u; u(0) = 1. Use Euler’s method to solve this, for a general stepsize h, and obtain an explicit expression for U(1) in terms of h. And then compute the error in this estimate for h = 0.1, h = 0.0025, and h = 0.0016.
dac8610752f285c3d9fcddce1859bc8b
{ "intermediate": 0.33082884550094604, "beginner": 0.2590959072113037, "expert": 0.41007527709007263 }
21,087
Consider the simple stiff Ordinary Differential Equation: u’ = -1000u; u(0) = 1. Use Euler’s method to solve this, for a general stepsize h, and obtain an explicit expression for U(1) in terms of h. And then compute the error in this estimate for h = 0.1, h = 0.0025, and h = 0.0016.
099d4e6bdb5508280d166fb857e088ef
{ "intermediate": 0.33054274320602417, "beginner": 0.24836841225624084, "expert": 0.421088844537735 }
21,088
функция на julia принимающая на вход 2 матрицы и количество повторений. пример выполения. вход: основная матрица [1 2; 3 4]; число повторений 2; дополнительная матрица нулевая 3*4. выход - [1 2 0; 1 2 0; 3 4 0; 3 4 0]. пример 2: основная матрица [1 2; 3 4], число повторов 2, дополнительная матрица нулевая 2*2. результат: [1 2; 1 2]
0926a4f31ef8d1f9bd01281ffe3744b1
{ "intermediate": 0.36636000871658325, "beginner": 0.2959725260734558, "expert": 0.33766743540763855 }
21,089
Please, write me an automation framework using Typescript Cucumber Playwright, put page initialization into hooks file, use page object pattern: Prerequisite: Go to https://enotes.pointschool.ru/login The user is authorized in the system (username 'test', password 'test') Shopping cart is empty Steps: Click on the shopping cart icon - The shopping cart window pops up.
ca7bc740e50d6e68cd195b733375e63c
{ "intermediate": 0.7238233089447021, "beginner": 0.1613169014453888, "expert": 0.11485980451107025 }
21,090
what are you?
b9c4ffacdcf9737e67470d2709eee5ec
{ "intermediate": 0.399404913187027, "beginner": 0.2930639088153839, "expert": 0.3075311779975891 }
21,091
Tor Browser open URL from command line windows
123ae63f75f3aae25e9df362a4e85a98
{ "intermediate": 0.40243178606033325, "beginner": 0.2483464926481247, "expert": 0.34922173619270325 }
21,092
in this code how controller knows what endpoint it will trigger this function? [HttpPost] public IActionResult Login([FromBody]UserLoginDto loginDto) { var user=_authService.Login(loginDto); if(user != null) { var token=_authService.CreateAccessToken(user); AddToCookie("X-Access-Token", token.Token, token.Expiration); AddToCookie("X-Refresh-Token", token.RefreshToken,DateTime.Now.AddDays(7)); return Ok(token); } return BadRequest(); }
60a1edfa5e6bb274963bb26cba2d9699
{ "intermediate": 0.5428815484046936, "beginner": 0.32965314388275146, "expert": 0.12746533751487732 }
21,093
hi
69ee893da922327e8f08eb208189b7f5
{ "intermediate": 0.3246487081050873, "beginner": 0.27135494351387024, "expert": 0.40399640798568726 }
21,094
tor node should only use us, ca
4daec6afe0ed038b56b7676a53a9ff90
{ "intermediate": 0.348685085773468, "beginner": 0.30883216857910156, "expert": 0.3424827754497528 }
21,095
Write torrc file code in tor browser with ExitNodes us, ca of all sites.
faac47f05232f6575cce43afd5b38852
{ "intermediate": 0.3795455992221832, "beginner": 0.27783480286598206, "expert": 0.34261956810951233 }
21,096
in my aspnet core project there is business folder what is it?
a2b1eb236a159605664b25413b310968
{ "intermediate": 0.3372182250022888, "beginner": 0.3048400580883026, "expert": 0.3579416275024414 }
21,097
how to pervent popup automatically opening inside another popup
613332a9d28053f6e98f0d1befc0a1c0
{ "intermediate": 0.2692745327949524, "beginner": 0.16975969076156616, "expert": 0.5609657764434814 }
21,098
Users Table: • UserID (Primary Key) • Username • Email • Password (Hashed and Salted) • Role (Admin, Instructor, Student) Courses Table: • CourseID (Primary Key) • Title • Description • InstructorID (Foreign Key referencing Users) • Category • EnrollmentCount • ImageURL Assignments Table: • AssignmentID (Primary Key) • CourseID (Foreign Key referencing Courses) • Title • Description • DueDate Enrollments Table: • EnrollmentID (Primary Key) • UserID (Foreign Key referencing Users) • CourseID (Foreign Key referencing Courses) • EnrollmentDate Enrollment Oversight: Admins can manually enroll or remove users from courses. This function helps in managing course participation and access. Students can browse and enroll in available courses. In that regard what will be my enrollmentscontroller and enrollmentsservice?
2ae9ee245e71cf4cb24994e9480e9959
{ "intermediate": 0.36534589529037476, "beginner": 0.3101789951324463, "expert": 0.32447513937950134 }
21,099
what means .dirty in angular input form validation
cd16ea4a179694928d1e3cc791bf610a
{ "intermediate": 0.4558373987674713, "beginner": 0.2559988498687744, "expert": 0.2881637215614319 }