row_id
int64
0
48.4k
init_message
stringlengths
1
342k
conversation_hash
stringlengths
32
32
scores
dict
33,228
How do I make my own outputstream that catches all errors from System.err
e38d3dc599e0e54846ffa495215a6f2d
{ "intermediate": 0.48599645495414734, "beginner": 0.11313695460557938, "expert": 0.4008665978908539 }
33,229
Convert this to kotlin : Intent emailIntent = new Intent(Intent.ACTION_SENDTO); emailIntent.setData(Uri.parse(mailto));
809ab529df386ac360ce1b74f2b9ae1c
{ "intermediate": 0.45229020714759827, "beginner": 0.23858891427516937, "expert": 0.30912086367607117 }
33,230
i have 5 to 10 black object on white wallpaper. cut out every one of them and save as a different image using python
c986d72327d6d9c95a3d885fac3b7c6b
{ "intermediate": 0.3266310393810272, "beginner": 0.2684968113899231, "expert": 0.40487220883369446 }
33,231
How can I make my own PrintStream that will be the System.setErr() argument
1ab454a8df2089045dc30043390553dc
{ "intermediate": 0.5186548829078674, "beginner": 0.23535561561584473, "expert": 0.24598947167396545 }
33,232
here's my code image_path = r"C:\Users\Plathera\Desktop\4242\New folder (3)\AQOHFVLO.png" folder_to_save = r"C:\Users\Plathera\Desktop\4242\New folder//" import cv2 import numpy as np def extract_objects(image): # Convert image to grayscale gray = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY) # Threshold the grayscale image to get the black objects _, thresh = cv2.threshold(gray, 127, 255, cv2.THRESH_BINARY_INV) # Find contours of the black objects contours, _ = cv2.findContours(thresh, cv2.RETR_EXTERNAL, cv2.CHAIN_APPROX_SIMPLE) # Extract and save each black object larger than 100 pixels as a separate image object_images = [] for i, contour in enumerate(contours): x, y, w, h = cv2.boundingRect(contour) if w * h > 1: # Check if object is larger than 100 pixels object_image = image[y:y+h, x:x+w] cv2.imwrite(folder_to_save + f"object{i+1}.png", object_image) object_images.append(object_image) return object_images # Load the white wallpaper image image = cv2.imread(image_path) # Extract the black objects larger than 100 pixels from the image object_images = extract_objects(image) make that if one object above another then combine them together
389a7883d1f1ad2d8aae517c259d567e
{ "intermediate": 0.4428195059299469, "beginner": 0.2828061878681183, "expert": 0.2743743360042572 }
33,233
How do I configure log4j?
7f37a75651b48caebe2cd992b7feed74
{ "intermediate": 0.5117016434669495, "beginner": 0.15590594708919525, "expert": 0.3323923647403717 }
33,234
i got 5 to 8 black object on white background. write a python script that extracts them and saves as different objects. but if object os location above another them this should be saved as 1 object
efdb34e0d461aec4e1138c77d518e614
{ "intermediate": 0.380975604057312, "beginner": 0.28375473618507385, "expert": 0.3352697193622589 }
33,235
How do I configure Log4j in such a way where all out and err will be routed to an output file, AND I can programmacly access errors and send them externally through my Discord bot?
eda29ee333ea8dc15b6f6ed980598261
{ "intermediate": 0.7438282370567322, "beginner": 0.10669250041246414, "expert": 0.14947931468486786 }
33,236
Why this code only prints out "192" in the terminal?
f0f7859de5d8dd849d1b4844921b4fb8
{ "intermediate": 0.32180464267730713, "beginner": 0.44419607520103455, "expert": 0.23399922251701355 }
33,237
Can you write me a C program using the following stack structure: struct int_node { int value; struct int_node *next; }; and create a simple calculator that can add two arbitrary size integers entered from the command line.
6231741bd0efdec703f185358324cc5c
{ "intermediate": 0.44481003284454346, "beginner": 0.35683560371398926, "expert": 0.19835436344146729 }
33,238
write an essay about penguins
8e62daff93a9c04459284b9b34fc6015
{ "intermediate": 0.3553641140460968, "beginner": 0.3793390989303589, "expert": 0.2652967572212219 }
33,239
I want to create an app that web scrapes the new "machine learning remote full time" roles on the website and send a report to my email every morning at 8am
3729af6812486023757e383eaf5f1bdd
{ "intermediate": 0.14756475389003754, "beginner": 0.1110701784491539, "expert": 0.7413650751113892 }
33,240
write me code for a web pac man game
d98f06cf4d04db4af5233d5180a1677a
{ "intermediate": 0.30446580052375793, "beginner": 0.4662586748600006, "expert": 0.22927545011043549 }
33,241
I need to programmatically catch all errors of a Java program and write to a logs file. Can I use logback to help with this?
04252e2e9b659ff13d7171ddef9ea9a5
{ "intermediate": 0.6619928479194641, "beginner": 0.12398800998926163, "expert": 0.21401923894882202 }
33,242
I need to programmatically catch all errors of a Java program and write to a logs file. Can I use logback to help with this? I need the ability to catch ALL errors in the program, basically everything that gets printed to the error stream
f5fc3c024efe4f343f4457b29847a8d1
{ "intermediate": 0.3623808026313782, "beginner": 0.4570991098880768, "expert": 0.18052011728286743 }
33,243
def permutation(binary, permutation_order): permuted = [binary[i - 1] for i in permutation_order] return ''.join(permuted) def ascii_to_binary(string): binary_string = "" for char in string: ascii_value = ord(char) binary_value = bin(ascii_value)[2:].zfill(8) # تحويل إلى ثنائي وملء الصفرات الأمامية binary_string += binary_value return binary_string def shift_left(bits, num_shifts): shifted = bits[num_shifts:] + bits[:num_shifts] return shifted # جدول التبديل PC1 pc1_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] # جدول التبديل PC2 pc2_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] key_ascii = input("Enter the key: ") # استخلاص المفتاح من المستخدم key_binary = ascii_to_binary(key_ascii) # تحويل المفتاح إلى تمثيل ثنائي # تنفيذ جدول التبديل PC1 key_pc1 = permutation(key_binary, pc1_table) # قسم المفتاح إلى نصفين c = key_pc1[:28] d = key_pc1[28:] # قم بتطبيق الشيفتات المحددة shifts = [1, 1, 2, 2, 2, 2, 2, 2, 1, 2, 2, 2, 2, 2, 2, 1] for shift in shifts: c = shift_left(c, shift) d = shift_left(d, shift) # جمع C و D cd = c + d # تنفيذ جدول التبديل PC2 key_pc2 = permutation(cd, pc2_table) print("Key PC2:", key_pc2)عدل على هذا الكود بحيث يعمل ال Encryption صح ويتضمن جدوال ال intial permutation وال final permutation
fa2366b64198044ac20f06fbba8d0196
{ "intermediate": 0.34985828399658203, "beginner": 0.38460713624954224, "expert": 0.26553452014923096 }
33,244
string baseDirectory = AppDomain.CurrentDomain.BaseDirectory; string scriptPath = Path.Combine(baseDirectory, @"Scripts\imports.py"); scriptPath = @"Scripts\imports.py"; var psi = new ProcessStartInfo { FileName = "python", Arguments = scriptPath, // Убедитесь, что путь в кавычках, если есть пробелы WorkingDirectory = baseDirectory, UseShellExecute = false, CreateNoWindow = true, RedirectStandardOutput = true, RedirectStandardError = true }; try { using (var process = Process.Start(psi)) { var errorOutput = process.StandardError.ReadToEnd(); process.WaitForExit(); var exitCode = process.ExitCode; this.Invoke(new Action(() => { if (!string.IsNullOrWhiteSpace(errorOutput)) { MessageBox.Show(errorOutput); } else if (exitCode == 1) { MessageBox.Show("Установка библиотек завершена успешно."); } else { MessageBox.Show($"Error: {exitCode}"); } })); } } catch (Exception ex) { // Вывод сообщения об ошибке, если что-то пойдет не так MessageBox.Show("Произошла ошибка при запуске скрипта: " + ex.Message); } Мне нужно чтобы в Message.Box выводились комментарии которые выводятся в окне python
d19308ebca107ccac28ea2f5d4d8dcb0
{ "intermediate": 0.33375924825668335, "beginner": 0.4587947130203247, "expert": 0.20744602382183075 }
33,245
Добавь к этому коду, чтобы в Message.Box выводились сообщения из python private void button2_Click(object sender, EventArgs e) { string baseDirectory = AppDomain.CurrentDomain.BaseDirectory; string scriptPath = @"Scripts\imports.py"; var psi = new ProcessStartInfo { FileName = "python", Arguments = scriptPath, // Убедитесь, что путь в кавычках, если есть пробелы WorkingDirectory = baseDirectory, UseShellExecute = false, CreateNoWindow = true, RedirectStandardOutput = true, RedirectStandardError = true };
e8e6416d10414054c83eb8dd7f9cca57
{ "intermediate": 0.4109925329685211, "beginner": 0.35393306612968445, "expert": 0.23507437109947205 }
33,246
Напиши полный код нейросети для генерации картинок на C#
dc0e9ce71e221ccf3afc02a80c0a00bd
{ "intermediate": 0.3911442458629608, "beginner": 0.35072386264801025, "expert": 0.25813189148902893 }
33,247
corelation among variables
12e402a45c58fd75fcfd24733659b56c
{ "intermediate": 0.336316853761673, "beginner": 0.508644700050354, "expert": 0.15503846108913422 }
33,248
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) # تحويل المفتاح إلى قيمة عددية permuted_key = int(permuted_key, 2) subkeys = [] # توليد المفاتيح الفرعية لكل جولة for round in range(1, 17): # الدورانات اليسرى للنصف الأيسر والنصف الأيمن للمفتاح left_shifts = 1 if round in [1, 2, 9, 16] else 2 permuted_key = ((permuted_key << left_shifts) & 0xFFFFFFFFFFFF) | (permuted_key >> (28 - left_shifts)) # استخدام جدول PC-2 لتحويل المفتاح إلى مفتاح فرعي بطول 48 بتًا subkey = apply_key_permutation(bin(permuted_key)[2:].zfill(56), pc_2_table) subkeys.append(subkey) return subkeys def initial_permutation(block): # Perform initial permutation on the block initial_permutation_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,
132120c64d42ba21ea992f168125f48e
{ "intermediate": 0.32967230677604675, "beginner": 0.470430463552475, "expert": 0.1998971551656723 }
33,249
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) # تحويل المفتاح إلى قيمة عددية permuted_key = int(permuted_key, 2) subkeys = [] # توليد المفاتيح الفرعية لكل جولة for round in range(1, 17): # الدورانات اليسرى للنصف الأيسر والنصف الأيمن للمفتاح left_shifts = 1 if round in [1, 2, 9, 16] else 2 permuted_key = ((permuted_key << left_shifts) & 0xFFFFFFFFFFFF) | (permuted_key >> (28 - left_shifts)) # استخدام جدول PC-2 لتحويل المفتاح إلى مفتاح فرعي بطول 48 بتًا subkey = apply_key_permutation(bin(permuted_key)[2:].zfill(56), pc_2_table) subkeys.append(subkey) return subkeys def initial_permutation(block): # Perform initial permutation on the block initial_permutation_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,
2f2f16f8fd102509f698ff4bb3a27000
{ "intermediate": 0.32967230677604675, "beginner": 0.470430463552475, "expert": 0.1998971551656723 }
33,250
Напиши код для генерации картинок по тексту на C# используй TensorFlow
74d22613713a2f93f614dad660e847b8
{ "intermediate": 0.46752414107322693, "beginner": 0.16923201084136963, "expert": 0.36324381828308105 }
33,251
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) # تحويل المفتاح إلى قيمة عددية permuted_key = int(permuted_key, 2) subkeys = [] # توليد المفاتيح الفرعية لكل جولة for round in range(1, 17): # الدورانات اليسرى للنصف الأيسر والنصف الأيمن للمفتاح left_shifts = 1 if round in [1, 2, 9, 16] else 2 permuted_key = ((permuted_key << left_shifts) & 0xFFFFFFFFFFFF) | (permuted_key >> (28 - left_shifts)) # استخدام جدول PC-2 لتحويل المفتاح إلى مفتاح فرعي بطول 48 بتًا subkey = apply_key_permutation(bin(permuted_key)[2:].zfill(56), pc_2_table) subkeys.append(subkey) return subkeys def initial_permutation(block): # Perform initial permutation on the block initial_permutation_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,
a9dbf4b3f389e29ff4e6a10b70772311
{ "intermediate": 0.32967230677604675, "beginner": 0.470430463552475, "expert": 0.1998971551656723 }
33,252
x
f0c512f89c63b52c3a68053dfd7af77f
{ "intermediate": 0.3188217282295227, "beginner": 0.2993789613246918, "expert": 0.3817993104457855 }
33,253
Input Handling:- Your code must handle that plaintext size is of any size not only 8 characters. If the plain text size is less than 8 characters your code should handle that by adding special characters and if the plain text size is more than 8 characters your code should also handle that by dividing plain text to blocks of size 8. Your code must handle that key size must be 8 characters by displaying error message and request another key from user. handling: - 3 marks Plain text size < 8 ( 0.5 mark Plain text size >8 ( 2 mark Key handling( 0.5 mark Key Generation 4 marks divided as follows:- 1- Permutated choice1---> 1mark 2- Left shift --> 1mark 3- Permutated choice-2 ---> 1mark 4- Repeat step 2 and 3 to generate the 16 keys---> 1 mark Encryption 8 marks divided as follows:- Initial permutation ---> 0.5 mark 2- 16 rounds-----------> 2 marks Each round (4.5 marks) divided as follows: - Expansion ---> 0.5 mark Xor (key, result of expansion) ---> 0.5 mark SBoxes ----> 2 marks Permutation -----> 0.5 mark Xor (result of permutation and left) -----> 0.5 mark Left and Right swap ---> 0.5 mark 32 bit swap------> 0.5 mark Inverse initial permutation-----> 0.5 mark
18784bbfba1f8e20ac7a2f8663e68741
{ "intermediate": 0.4971179664134979, "beginner": 0.14835681021213531, "expert": 0.35452526807785034 }
33,254
# Core Q-learning Class import numpy as np print("About to instantiate QLearningAgent") agent = QLearningAgent(state_size, action_size, learning_rate, discount_factor, epsilon) class QLearningAgent: def __init__(self, state_size, action_size, learning_rate, discount_factor, epsilon): # Existing attributes self.state_size = state_size self.action_size = action_size self.learning_rate = learning_rate self.discount_factor = discount_factor self.epsilon = epsilon self.q_table = np.zeros((state_size, action_size)) # Initialize neurotransmitter systems self.dopamine_system = DopamineSystem(learning_rate=0.01, prediction_error_sensitivity=0.1) self.norepinephrine_system = NorepinephrineSystem(base_firing_rate=1.0) self.acetylcholine_system = AcetylcholineSystem(attention_weights=np.ones(action_size)) self.serotonin_system = SerotoninSystem(mood_state_vector_space=VectorSpace(3), motivation_vector_space=VectorSpace(3)) self.glutamate_system = GlutamateSystem(connectivity_matrix=np.zeros((state_size, action_size))) self.gaba_system = GABA_System(inhibition_matrix=np.zeros((state_size, action_size))) # Initialize additional neuromodulator systems self.endorphins_system = EndorphinsSystem(familiar_environment_factor=1.2) # Example factor self.substance_p_system = SubstancePSystem(error_factor=0.8) # Example factor self.anandamide_system = AnandamideSystem(mood_stabilization_factor=1.1) # Example factor def select_action(self, state): if np.random.rand() < self.epsilon: # Explore: choose a random action return np.random.randint(self.action_size) else: # Exploit: choose the best action based on modulated Q-values q_values_modulated = self.modulate_q_values(state) return np.argmax(q_values_modulated) def modulate_q_values(self, state): # Assume state is an integer index for simplicity q_values = self.q_table[state] # Apply modulators q_values = self.dopamine_system.modulate(q_values) q_values = self.norepinephrine_system.modulate(q_values) q_values = self.acetylcholine_system.modulate(q_values) q_values = self.serotonin_system.modulate(q_values) q_values = self.glutamate_system.modulate(q_values) q_values = self.gaba_system.modulate(q_values) return q_values def update(self, state, action, reward, next_state, is_novel): # Modulate reward using the Endorphins system modulated_reward = self.endorphins_system.modulate_reward(reward, is_novel) # Apply learning modulation using Substance P system learning_modulation = self.substance_p_system.modulate_learning(reward) # Q-learning update with modulated reward and learning rate old_value = self.q_table[state, action] next_max = np.max(self.q_table[next_state]) new_value = old_value + self.learning_rate * learning_modulation * (modulated_reward + self.discount_factor * next_max - old_value) self.q_table[state, action] = new_value # Update neurotransmitter systems self.dopamine_system.update(state, action, reward) self.endorphins_system.update(state, action, modulated_reward) self.substance_P_system.update(state, action, reward) self.oxytocin_system.update(state, action) self.anandamide_system.update(state, action) self.norepinephrine_system.update(state, action) self.acetylcholine_system.update(state, action) self.serotonin_system.update(state, action) self.glutamate_system.update(state, action) self.gaba_system.update(state, action) # … other updates for neurotransmitter systems class ChatEnvironment: def __init__(self, max_input_length, max_response_length): self.max_input_length = max_input_length self.max_response_length = max_response_length self.current_input = np.zeros(max_input_length, dtype=int) def reset(self): self.current_input = np.zeros(self.max_input_length, dtype=int) return self.get_state() def step(self, action): response = self.generate_response(action) next_state = self.get_state() reward = self.get_user_feedback(response) done = self.is_conversation_over(response) return next_state, reward, done, {} def get_state(self): # State representation based on current input return self.current_input def generate_response(self, action): # Convert action (ASCII values) to a response string response = ''.join([chr(a) for a in action]) return response def process_input(self, user_input): # Convert user input to ASCII values and update the current input ascii_values = [ord(c) for c in user_input[:self.max_input_length]] self.current_input[:len(ascii_values)] = ascii_values def get_user_feedback(self, response): print(f"AI: {response}") user_feedback = input("Was this response expected? (yes/no): ") return 1 if user_feedback.lower() == 'yes' else -1 def is_conversation_over(self, response): return response.strip() == "Goodbye!" # Neurotransmitter System Classes: class DopamineSystem: def __init__(self, learning_rate, prediction_error_sensitivity): self.learning_rate = learning_rate # Learning rate of the dopamine system self.prediction_error_sensitivity = prediction_error_sensitivity self.prediction_error = 0 # Initial prediction error def calculate_prediction_error(self, expected_outcome, actual_outcome): # Calculate the prediction error self.prediction_error = actual_outcome - expected_outcome def update_learning_rate(self): # Adjust the learning rate based on the prediction error self.learning_rate += self.prediction_error_sensitivity * self.prediction_error def modulate(self, q_values): # Modulate Q-values based on the prediction error # Placeholder logic: adjust q_values based on prediction error modulated_q_values = q_values * (1 + self.learning_rate * self.prediction_error) return modulated_q_values def update(self, state, action, reward): # Update internal state based on the outcome # Example: Calculate prediction error and update learning rate expected_reward = self.q_table[state, action] self.calculate_prediction_error(expected_reward, reward) self.update_learning_rate() #NorepinephrineSystem: class NorepinephrineSystem: def init(self, base_firing_rate): self.firing_rate = base_firing_rate def adjust_firing_rate(self, attention_level): self.firing_rate *= attention_level #AcetylcholineSystem: class AcetylcholineSystem: def init(self, attention_weights): self.attention_weights = attention_weights def modulate_attention(self, expected_rewards): # Modulate attention based on the expected rewards pass # Implementation code here #SerotoninSystem: class SerotoninSystem: def init(self, mood_state_vector_space, motivation_vector_space): self.mood_state_vector_space = mood_state_vector_space self.motivation_vector_space = motivation_vector_space def update_mood(self, mood_vector): self.mood_state_vector_space.adjust(mood_vector) def update_motivation(self, motivation_vector): self.motivation_vector_space.adjust(motivation_vector) #Glutamate_System: class GlutamateSystem: def __init__(self, connectivity_matrix): self.connectivity_matrix = connectivity_matrix # A matrix representing neural connections def update_connectivity(self, firing_pattern): # Update the connectivity matrix based on the neuron's firing pattern # Placeholder: implement logic to adjust the connectivity matrix pass def modulate(self, q_values, state): # Modulate Q-values based on the current connectivity state # Placeholder: implement modulation logic based on connectivity_matrix modulated_q_values = q_values # Modify this according to your logic return modulated_q_values #GABASystem: class GABA_System: def init(self, inhibition_matrix): self.inhibition_matrix = inhibition_matrix def apply_inhibition(self, neuron_group): # Apply inhibitory effects to the given neuron group pass # Implementation code here #EndorphinesSystem: class EndorphinsSystem: def __init__(self, familiar_environment_factor): self.familiar_environment_factor = familiar_environment_factor self.is_familiar_environment = False def update(self, state, action, reward): # Logic to determine if the current environment is familiar # Placeholder: set self.is_familiar_environment based on state def modulate_reward(self, reward, is_novel): if self.is_familiar_environment and is_novel: return reward * self.familiar_environment_factor return reward #Subsance P system: class SubstancePSystem: def __init__(self, error_factor): self.error_factor = error_factor def modulate_learning(self, reward): if reward < 0: # Assuming negative reward indicates error return self.error_factor return 1.0 #Anadamide System class AnandamideSystem: def __init__(self, mood_stabilization_factor): self.mood_stabilization_factor = mood_stabilization_factor def modulate_q_values(self, q_values): # Apply mood stabilization to Q-values stabilized_q_values = q_values * self.mood_stabilization_factor return stabilized_q_values #2. Vector Spaces for Emotional States: Representations of different emotional states that can adjust over time or in response to stimuli. class VectorSpace: def init(self, dimensions): self.vectors = np.zeros(dimensions) def adjust(self, vector_update): self.vectors += vector_update # Instantiate ChatEnvironment chat_env = ChatEnvironment(max_input_length=50, max_response_length=30) #3. Q-learning Parameters: These are part of the Q-learning algorithm for decision-making. class QLearningParameters: def init(self, alpha, gamma): self.alpha = alpha # Learning rate self.gamma = gamma # Discount factor #4. Q-learning Algorithm: This core decision-making module would use various parameters and the neurotransmitter-like mechanisms to learn and make decisions. class QLearningAgent: def init(self, q_table, parameters): self.q_table = q_table self.parameters = parameters # Example parameters - adjust these based on your environment state_size = 100 # The number of states in the environment action_size = (30^2)*(20^2) # The number of possible actions the agent can take learning_rate = 0.01 # The rate at which the agent should learn discount_factor = 0.95 # The discount factor for future rewards epsilon = 0.01 # The probability of choosing a random action over the best action # Instantiate the QLearningAgent with the specified parameters agent = QLearningAgent(state_size, action_size, learning_rate, discount_factor, epsilon) # Training loop num_episodes = 1000 # Number of episodes for training for episode in range(num_episodes): state = chat_env.reset() # Reset the environment at the start of each episode done = False while not done: action = agent.select_action(state) # Agent selects an action next_state, reward, done, _ = chat_env.step(action) # Perform the action on the environment # Update the agent with the results of the action agent.update(state, action, reward, next_state, is_novel=False) # 'is_novel' flag needs to be determined state = next_state # Update state can you design a q learning ml to fit this model? it can be simple and sent over multiple prompts
1a86a360a79750c1173cefb1ecd86dd7
{ "intermediate": 0.23296749591827393, "beginner": 0.4992992579936981, "expert": 0.26773324608802795 }
33,255
# -*- coding: utf-8 -*- """ Created on Fri Dec 1 03:26:35 2023 @author: ML """ 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 def initial_permutation(block): # Perform initial permutation on the block initial_permutation_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] permuted_block = “” for index in initial_permutation_table: permuted_block += block[index - 1] return permuted_block def expand_permutation(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] 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, 8, 14, 6, 11, 3, 4, 9, 7, 2, 13, 12, 0, 5, 10], [3, 13, 4, 7, 15, 2, 8, 14, 12, 0, 1, 10, 6, 9, 11, 5], [0, 14, 7, 11, 10, 4, 13, 1, 5, 8, 12, 6, 9, 3, 2, 15], [13, 8, 10, 1, 3, 15, 4, 2, 11, 6, 7, 12, 0, 5, 14, 9] ], # S3 [ [10, 0, 9, 14, 6, 3, 15, 5, 1, 13, 12, 7, 11, 4, 2, 8], [13, 7, 0, 9, 3, 4, 6, 10, 2, 8, 5, 14, 12, 11, 15, 1], [error runfile('C:/Users/ML/Desktop/untitled0.py', wdir='C:/Users/ML/Desktop') File "C:\Users\ML\Desktop\untitled0.py", line 10 plaintext += “@” ^ SyntaxError: invalid character in identifier
fe08d85c64e0b983f80946821dfcf7d0
{ "intermediate": 0.36364880204200745, "beginner": 0.4288807809352875, "expert": 0.2074703872203827 }
33,256
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 98​% ​confidence; n = 148​, s = 1.99 ​(1000 ​cells/ μ​L). Question content area bottom Part 1 df = enter your response here ​(Type a whole​ number.)
9e8478e03e0f37b3498848f969489f04
{ "intermediate": 0.3576982319355011, "beginner": 0.3232567608356476, "expert": 0.31904494762420654 }
33,257
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 def initial_permutation(block): # Perform initial permutation on the block initial_permutation_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] permuted_block = "" for index in initial_permutation_table: permuted_block += block[index - 1] return permuted_block def expand_permutation(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] 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] ] ] 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)اريد انا ادخل ال plaintext وال key على هذا الكود وفي النهايه يطبع ال Encryption
5fea89e4f81c453d254344500982b74f
{ "intermediate": 0.343763142824173, "beginner": 0.41792595386505127, "expert": 0.23831090331077576 }
33,258
基于docker compose v3构建datasophon
213ef0b18502aadaf872c8804643947a
{ "intermediate": 0.38459861278533936, "beginner": 0.2079230099916458, "expert": 0.407478392124176 }
33,259
χ2L = ​(Round to two decimal places as​ needed.)
a5e9b0c9e25aa09b1768d2c7e6eb64fb
{ "intermediate": 0.33752524852752686, "beginner": 0.31563419103622437, "expert": 0.34684062004089355 }
33,260
The probabilities of events​ A, B, and A∩B are given. Find​ (a) ​P(A U ​B), ​(b) the odds in favor of and the odds against​ A, © the odds in favor of and the odds against​ B, and​ (d) the odds in favor of and against A∩B. ​P(A) = 4/11 P(B) = 7/11 ​P(A​B) = 0
1e084ce5b2815a642e9e5707e8420a1c
{ "intermediate": 0.3186441659927368, "beginner": 0.27213120460510254, "expert": 0.40922462940216064 }
33,261
Create a program that will simulate a calculator. Your program will ask the user for up to 4 numbers, however the user does not have to use all 4 numbers, but must use at least 2 numbers. Create a function that checks the user input for this condition. Your program must then have 4 more functions. Multiply(num1,num2,num3,num4), Add(num1,num2,num3,num4), Subtract(num1,num2,num3,num4), and Divide(num1,num2,num3,num4). In the divide function, you must make sure that the divisor (bottom number) is not zero. So, your program will ask for the inputs, then ask what operation the user wants to perform. Finally, your program will show the calculation, as well as the answer as the final output.
6bd9d70cd36bec479f7a9221b72c3307
{ "intermediate": 0.2774199843406677, "beginner": 0.31736040115356445, "expert": 0.40521955490112305 }
33,262
напиши код для curl на C# -d '{"inputs": "Astronaut riding a horse"}' \ -H 'Content-Type: application/json' \ -H "Authorization: Bearer xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
eedd5c6dac68f3bcdd30bf52a8ae6e44
{ "intermediate": 0.31617066264152527, "beginner": 0.47647011280059814, "expert": 0.2073592096567154 }
33,263
Let x be a continuous random variable with a standard normal distribution. Using the accompanying standard normal distribution​ table, find ​P(-1.22 <= x <= ​0).
9da6b44f4c1a1f0850e3f123e8f723f5
{ "intermediate": 0.369752436876297, "beginner": 0.27348530292510986, "expert": 0.3567623198032379 }
33,264
how to write print log every new line with comma in dart
a4abe2a961dff068f197f22a7eabeac7
{ "intermediate": 0.45326608419418335, "beginner": 0.16943834722042084, "expert": 0.377295583486557 }
33,265
how to write print log every new line with comma in dart
274573ed878f833bb4dbde3ab3925a6c
{ "intermediate": 0.45326608419418335, "beginner": 0.16943834722042084, "expert": 0.377295583486557 }
33,266
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 def initial_permutation(block): # Perform initial permutation on the block initial_permutation_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] permuted_block = "" for index in initial_permutation_table: permuted_block += block[index - 1] return permuted_block def expand_permutation(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] 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] ] ] 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) no output i want input from user plaintext then print encription update these code
801caea981cde76d0979aaf54fa4ad71
{ "intermediate": 0.343763142824173, "beginner": 0.41792595386505127, "expert": 0.23831090331077576 }
33,267
Fix the code year = 0 balance = 10000.0 TARGET = 20000.0 RATE = 0.05 while balance < TARGET: year = year + 1 interest = balance * RATE/100 balance = balance + interest print(year)
9fd9a6c8fdc96411709c70cc3e946959
{ "intermediate": 0.21463671326637268, "beginner": 0.5633221864700317, "expert": 0.22204110026359558 }
33,269
import json from collections import Counter import numpy as np import tensorflow as tf from tensorflow.keras.models import load_model import matplotlib.pyplot as plt input_file_name = '1.jsonl' saved_model_name = 'neural_network_model.h5' sequence_length = 100 # Как определено при обучении n_features = 3 # Как определено при обучении n_classes = 2 # Как определено при обучении top_user_limit = 20 # Топ 20 пользователей # Загрузка обученной модели model = load_model(saved_model_name) # Вычисление частот пользователей user_counts = Counter() with open(input_file_name, 'r') as file: for line in file: record = json.loads(line.strip()) user = record['SourceHostname_User'] user_counts[user] += 1 # Получение Топ-20 частых пользователей top_users = [user for user, count in user_counts.most_common(top_user_limit)] top_user_data = {user: [] for user in top_users} # Выделяем данные только для Топ-20 частых пользователей with open(input_file_name, 'r') as file: for line in file: record = json.loads(line.strip()) user = record['SourceHostname_User'] if user in top_user_data: top_user_data[user].append(record) # Прогнозы и визуализация для Топ-20 частых пользователей for user in top_users: user_events = top_user_data[user] user_events = [data for data in sorted(user_events, key=lambda x: x['UtcTime'])] # Сортируем по времени user_events = [[event['EventId'], event['ThreadId'], event['Image']] for event in user_events][-sequence_length:] # Берем последние события x = np.zeros((1, sequence_length, n_features)) padded_sequence = np.array(user_events) x[:, :padded_sequence.shape[0], :] = padded_sequence predicted_class_proba = model.predict(x)[0] predicted_class = np.argmax(predicted_class_proba) # Визуализация plt.figure(figsize=(10, 5)) plt.bar(range(n_classes), predicted_class_proba, color='blue', alpha=0.7) plt.title(f'User: {user}\nPredicted class: {predicted_class} (Prob: {predicted_class_proba[predicted_class]:.2f})') plt.xlabel('Class') plt.ylabel('Probability') plt.xticks(ticks=range(n_classes), labels=[f'Class {i}' for i in range(n_classes)]) plt.show() Модернизируй код, переделай вывод для юзеров, чтоб были в виде кривых линий
832049ca92d80ad66acbff6ff6049768
{ "intermediate": 0.2757129669189453, "beginner": 0.525080680847168, "expert": 0.19920630753040314 }
33,270
hello
83067171c32d75143c6e827573af3f44
{ "intermediate": 0.32064199447631836, "beginner": 0.28176039457321167, "expert": 0.39759764075279236 }
33,271
dijkstra's algorithm python code using priority queue
20dcb5b8ef69dc62f45d495adfa8e0e8
{ "intermediate": 0.1202748492360115, "beginner": 0.09502352029085159, "expert": 0.7847016453742981 }
33,272
import pgzrun WIDTH = 310 HEIGHT = 450 scroe = 0 button = Actor("button1_on") button.pos = WIDTH / 2, HEIGHT / 2 + 60 def draw(): screen.fill("lightblue") button.draw() screen.draw.text("Scroe: " + str(scroe), color='white', center=(WIDTH / 2, 90), fontsize=50) pgzrun.go()
5307c7ef060563cac88509c1b9b513d9
{ "intermediate": 0.39627283811569214, "beginner": 0.2979452610015869, "expert": 0.30578190088272095 }
33,273
> install.packages("float") Warning in install.packages : unable to access index for repository https://cran.ma.imperial.ac.uk/bin/macosx/el-capitan/contrib/3.6: cannot open URL 'https://cran.ma.imperial.ac.uk/bin/macosx/el-capitan/contrib/3.6/PACKAGES' Package which is only available in source form, and may need compilation of C/C++/Fortran: ‘float’ Do you want to attempt to install these from sources? (Yes/no/cancel) install.packages("recosystem") Error in install.packages : Unrecognized response “install.packages("recosystem")” > install.packages("recommenderlab") Warning in install.packages : dependencies ‘arules’, ‘irlba’ are not available also installing the dependencies ‘float’, ‘recosystem’ Warning in install.packages : unable to access index for repository https://cran.ma.imperial.ac.uk/bin/macosx/el-capitan/contrib/3.6: cannot open URL 'https://cran.ma.imperial.ac.uk/bin/macosx/el-capitan/contrib/3.6/PACKAGES' Packages which are only available in source form, and may need compilation of C/C++/Fortran: ‘float’ ‘recosystem’ Do you want to attempt to install these from sources? (Yes/no/cancel) library(recommenderlab) Error in install.packages : Unrecognized response “library(recommenderlab)”
2450f79ea40a685cf878f4a9edf324b1
{ "intermediate": 0.48903217911720276, "beginner": 0.26153847575187683, "expert": 0.2494293451309204 }
33,274
please build script for download video tiktok by url using python code
d7c767f5716a5cb99d40fd6b9e0a1de7
{ "intermediate": 0.36818498373031616, "beginner": 0.20408235490322113, "expert": 0.4277326166629791 }
33,275
Merhaba, "client.on(‘messageCreate’, async (msg) => { if (msg.channel.id === config.channelId) { if ([String(owoId), String(config.authorId)].includes(msg.author.id)) { const regex = /human|captcha|dm|banned|https://owobot.com/captcha|Beep|human?/gi; if (msg.content.includes(&lt;@${client.user.id}&gt;)) { msg.user.send(&lt;@${msg.author.id}&gt; CAPTCHA!).then((captchaMsg) => { setTimeout(() => { captchaMsg.delete(); msg.delete(); }, 10000); }); } else if (!captchaSent && (msg.content.toLowerCase().match(regex) || msg.channel.type === ‘dm’)) { console.log((${client.user.username}) Owo need captcha); msg.channel.send(‘Owo need captcha.’); captchaSent = true; statusBot = false; } } } });" düzeltir misin?
bbec412a05d78e51b332154306ab86bb
{ "intermediate": 0.43968871235847473, "beginner": 0.32100456953048706, "expert": 0.2393067181110382 }
33,276
please check this code :import requests from bs4 import BeautifulSoup url = "https://startup.jobs/?remote=true&c=Full-Time&q=machine+learning" # Make a GET request to fetch the raw HTML content response = requests.get(url) 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 # Find the search input element search_input = soup.find('input', {'type': 'search', 'name': 'query'}) # Find the remote checkbox remote_checkbox = soup.find('input', {'type': 'checkbox', 'name': 'remote'}) # Find the full-time checkbox full_time_checkbox = soup.find('input', {'type': 'checkbox', 'name': 'commitments[]', 'value': 'Full-Time'}) # Check if all elements are found before proceeding if search_input and remote_checkbox and full_time_checkbox: # Set the search query search_query = search_input.get('value') print("Search Query:", search_query) # Check if the remote checkbox is checked if 'checked' in remote_checkbox.attrs and remote_checkbox['checked'] == 'checked': print("Remote Checkbox is checked") # Check if the full-time checkbox is checked if 'checked' in full_time_checkbox.attrs and full_time_checkbox['checked'] == 'checked': print("Full-Time Checkbox is checked") # Find all job listings job_listings = soup.find_all('div', class_='job_listing') # Counter to keep track of printed jobs count = 0 # Iterate through job listings for job in job_listings: # Check if the job is machine learning, full time, and remote if 'machine learning' in job.text.lower() and 'full-time' in job.text.lower() and 'remote' in job.text.lower(): # Print job details print("\nJob Title:", job.find('h3', class_='job_listing-title').text.strip()) print("Company:", job.find('a', class_='company').text.strip()) print("Location:", job.find('span', class_='location').text.strip()) print("Link:", job.find('a', class_='job_listing-clickbox')['href']) print("-" * 30) # Increment the counter count += 1 # Break the loop after printing 10 jobs if count == 10: break # Inform if no matching jobs were found if count == 0: print("No jobs found matching the criteria.") else: print("One or more elements not found.") else: print("Failed to retrieve the page. Status code:", response.status_code)
0fb2814d1b0cd37d30502da5ec778489
{ "intermediate": 0.23007863759994507, "beginner": 0.6466384530067444, "expert": 0.12328296154737473 }
33,277
is phpmyadmin similar to mysql?
d274b70110986d122a28247d3abfce8e
{ "intermediate": 0.47106650471687317, "beginner": 0.3370046019554138, "expert": 0.19192884862422943 }
33,278
对于多项式岭回归,使用某种方法探索以下超参数空间(p=[1,2,3], alpha = [0.001,0.01,0.1,1,10,100,1000],并报告最佳超参数 best_p 和 best_alpha,从而最小化验证数据的 MAE
3a22e1a012d89427e634526a4ea8067f
{ "intermediate": 0.29913973808288574, "beginner": 0.32553616166114807, "expert": 0.3753241002559662 }
33,279
from sklearn.preprocessing import StandardScaler ss = StandardScaler() train_sub_std_X = ss.fit_transform(train_sub_X) valid_std_X = ss.transform(valid_X) import torch batch_size = 32 train_X_torch = torch.tensor(train_sub_std_X, dtype=torch.float) valid_X_torch = torch.tensor(valid_std_X, dtype=torch.float) # convert a vector to a matrix by reshape train_Y_torch = torch.tensor(train_sub_y.reshape(-1, 1), dtype=torch.float) valid_Y_torch = torch.tensor(valid_y.reshape(-1,1), dtype=torch.float) train_dataset = torch.utils.data.TensorDataset(train_X_torch, train_Y_torch) valid_dataset = torch.utils.data.TensorDataset(valid_X_torch, valid_Y_torch) train_loader = torch.utils.data.DataLoader(train_dataset, batch_size=batch_size, shuffle=True) valid_loader = torch.utils.data.DataLoader(valid_dataset, batch_size=batch_size, shuffle=True) |def calculate(model, loss_fn, loader, opt=None): if opt is None: model.eval() whole_loss = 0 count = len(loader.dataset) for X, y in loader: # X, y = X.cuda(), y.cuda() # Transfer data to the GPU y_pred = model(X) # Predict y from X loss = loss_fn(y_pred, y) # Calculate the average of the losses in a mini-batch whole_loss += loss.item()*len(y) # Calculate the total loss for the entire epoch # Update weights if opt is not None: opt.zero_grad() loss.backward() opt.step() mean_loss = whole_loss / count if opt is None: model.train() return mean_loss from livelossplot import PlotLosses def train(model, loss_fn, opt, train_loader, valid_loader, epoch=50): liveloss = PlotLosses() # Initialize the drawing for i in range(epoch): train_loss = calculate(model, loss_fn, train_loader, opt) valid_loss = calculate(model, loss_fn, valid_loader) # Visualize the loss and accuracy values. liveloss.update({ ‘loss’: train_loss, ‘val_loss’: valid_loss, }) liveloss.draw() return model # Return the trained model torch.manual_seed(0) # Ensure reproducibility of training results mlp = torch.nn.Sequential( torch.nn.Linear(12, 24), torch.nn.ReLU(), torch.nn.Linear(24, 1) ) # mlp.cuda() # Transfer the model to the GPU # Prepare loss functions and optimization methods loss_fn = torch.nn.L1Loss() optimizer = torch.optim.SGD(mlp.parameters(), lr=0.01) 根据上述代码计算train 和 valid数据的mae, 生成新的test数据并计算其mae
07c5718f553cc9c1d8e6186fe79e536f
{ "intermediate": 0.4639964997768402, "beginner": 0.34687596559524536, "expert": 0.18912751972675323 }
33,280
This code produces an error :!pip install selenium from selenium import webdriver from selenium.webdriver.common.by import By from selenium.webdriver.chrome.service import Service from selenium.webdriver.chrome.options import Options from bs4 import BeautifulSoup import time webdriver_path = r"C:\Users\14802\Desktop\chrome-win32\chrome.exe" # Replace with your ChromeDriver path url = "https://startup.jobs/?remote=true&c=Full-Time&q=machine+learning" # Setup Chrome options chrome_options = Options() # Use headless mode if you do not need a browser UI # chrome_options.add_argument("--headless") # Set path to chromedriver as per your configuration webdriver_service = Service(webdriver_path) # Choose Chrome Browser driver = webdriver.Chrome(service=webdriver_service, options=chrome_options) # Get URL driver.get(url) # Wait for JavaScript to load time.sleep(5) # Adjust the sleep time if necessary, depending on load times # Get page source and close the browser page_source = driver.page_source driver.quit() # Parse the HTML content soup = BeautifulSoup(page_source, 'html.parser') # Find all job listings job_listings = soup.find_all('div', class_='job_listing') # Counter to keep track of printed jobs count = 0 # Iterate through job listings for job in job_listings: # Check if the job is machine learning, full time, and remote if 'machine learning' in job.text.lower(): # Print job details title_element = job.find('h3', class_='job_listing-title') company_element = job.find('a', class_='company') location_element = job.find('span', class_='location') link_element = job.find('a', class_='job_listing-clickbox') # Ensure all elements were found before trying to access their contents if title_element and company_element and location_element and link_element: print("\nJob Title:", title_element.text.strip()) print("Company:", company_element.text.strip()) print("Location:", location_element.text.strip()) print("Link:", link_element['href']) print("-" * 30) # Increment the counter count += 1 # Break the loop after printing 10 jobs
684c0a9544e10aaf896c72e6371798bb
{ "intermediate": 0.09330467879772186, "beginner": 0.8396633863449097, "expert": 0.06703194975852966 }
33,281
from sklearn.ensemble import RandomForestRegressor from sklearn.model_selection import GridSearchCV rfr = RandomForestRegressor(random_state=0) parameter_tree = { 'n_estimators':[10,20,50,100,200,500], 'max_depth':[2,4,6,8,10,12,14,16,18,20] } grid_rfr = GridSearchCV(rfr, parameter_tree, scoring = 'neg_mean_absolute_error', cv=5) grid_rfr.fit(train_X, train_y) rf_best_parameters = grid_rfr.best_params_ print(rf_best_parameters) from sklearn.ensemble import RandomForestRegressor from sklearn.metrics import mean_absolute_error best_n_estimators = 500 best_max_depth = 12 rfr = RandomForestRegressor(n_estimators=500, max_depth=12, random_state=0) rfr.fit(train_X, train_y) predicted = rfr.predict(test_X) test_mae_random_forest = mae(test_y, predicted) print(test_mae_random_forest) 讨论除了交叉验证之外是否还有最佳的模型选择方法。 将预测精度与上述代码获得的测试数据进行比较(本练习允许添加代码单元)。
50b40f08529260db4cec4905a12b0935
{ "intermediate": 0.2587928771972656, "beginner": 0.41783004999160767, "expert": 0.3233770430088043 }
33,282
is there a "sort by" in sql
38d437999c8b4a1f5ab85d4ecbfe13e1
{ "intermediate": 0.2936173379421234, "beginner": 0.19958271086215973, "expert": 0.5067999958992004 }
33,283
hi
a9d67027db78aa80a84d7dcf134af77e
{ "intermediate": 0.3246487081050873, "beginner": 0.27135494351387024, "expert": 0.40399640798568726 }
33,284
HOW ALL YOUR WORK. REMEMBER THAT PROGRAM SEGMENTS ARE TO BE WRITTEN IN JAVA. Assume that the classes listed in the Java Quick Reference have been imported where appropriate. Unless otherwise noted in the question, assume that parameters in method calls are not null and that methods are called only when their preconditions are satisfied. In writing solutions for each question, you may use any of the accessible methods that are listed in classes defined in that question. Writing significant amounts of code that can be replaced by a call to one of these methods will not receive full credit. For this question, assume that the variables wordA, wordB, and letter have been correctly declared and initialized. Write a segment of code that prints the value of wordA or wordB depending on which letter appears earlier. If letter does not appear in wordA or wordB or letter appears at the same location in each word, it should print "neither". wordA wordB letter output nomads labors o nomads nomads labors a labors nomads labors s neither nomads labors m nomads nomads labors b labors nomads labors x neither
b50854e88c44a09a190bb715f153ff32
{ "intermediate": 0.09966831654310226, "beginner": 0.7936404943466187, "expert": 0.10669118911027908 }
33,285
#include <stdio.h> #include <stdlib.h> #include <string.h> #include <unistd.h> #include <sys/types.h> #include <sys/wait.h> #include <fcntl.h> #include <glob.h> #define MAX_INPUT_SIZE 1024 #define MAX_ARG_NUM 16 #define MAX_PATH_SIZE 256 int execute_command(char *args[]); void handle_redirection(char *args[], int *input_fd, int *output_fd); void handle_pipes(char *args1[], char *args2[]); char **tokenize_input(char *input); char **expand_wildcards(char *arg); void execute_builtin_command(char *args[]); int is_builtin_command(char *command); void print_error(const char *message); int main(int argc, char *argv[]) { if (argc == 1) { // Interactive mode printf("Welcome to my shell!\n"); char input[MAX_INPUT_SIZE]; while (1) { printf("mysh> "); fflush(stdout); if (fgets(input, MAX_INPUT_SIZE, stdin) == NULL) { break; // End of input } // Remove newline character from input input[strcspn(input, "\n")] = 0; // Tokenize input char **tokens = tokenize_input(input); // Check for exit command if (tokens[0] != NULL && strcmp(tokens[0], "exit") == 0) { printf("mysh: exiting\n"); break; } // Execute command if (tokens[0] != NULL) { if (!is_builtin_command(tokens[0])) { // If not a built-in command, expand wildcards and execute char **expanded_args = expand_wildcards(tokens[0]); free(tokens[0]); tokens = expanded_args; execute_command(tokens); } else { // If a built-in command, execute directly execute_builtin_command(tokens); } } // Free memory for (int i = 0; tokens[i] != NULL; i++) { free(tokens[i]); } free(tokens); } } else if (argc == 2) { // Batch mode FILE *script_file = fopen(argv[1], "r"); if (script_file == NULL) { print_error("script file not found"); } char input[MAX_INPUT_SIZE]; while (fgets(input, MAX_INPUT_SIZE, script_file) != NULL) { // Remove newline character from input input[strcspn(input, "\n")] = '\0'; // Tokenize input char **tokens = tokenize_input(input); // Check for exit command if (tokens[0] != NULL && strcmp(tokens[0], "exit") == 0) { printf("mysh: exiting\n"); break; } // Execute command if (tokens[0] != NULL) { if (!is_builtin_command(tokens[0])) { // If not a built-in command, expand wildcards and execute char **expanded_args = expand_wildcards(tokens[0]); free(tokens[0]); tokens = expanded_args; execute_command(tokens); } else { // If a built-in command, execute directly execute_builtin_command(tokens); } } // Free memory for (int i = 0; tokens[i] != NULL; i++) { free(tokens[i]); } free(tokens); } fclose(script_file); } else { fprintf(stderr, "Usage: %s [script-file]\n", argv[0]); return EXIT_FAILURE; } return 0; } int execute_command(char *args[]) { if (is_builtin_command(args[0])) { execute_builtin_command(args); return 0; // Indicate success for built-in commands } pid_t pid; int status; pid = fork(); if (pid == 0) { // Child process int input_fd = 0; // Default to stdin int output_fd = 1; // Default to stdout handle_redirection(args, &input_fd, &output_fd); if (input_fd != 0) { dup2(input_fd, 0); close(input_fd); } if (output_fd != 1) { dup2(output_fd, 1); close(output_fd); } execvp(args[0], args); // If execvp fails print_error("command not found"); } else if (pid < 0) { // Forking error print_error("forking error"); } else { // Parent process waitpid(pid, &status, 0); return WEXITSTATUS(status); } // Add a return statement here return -1; } void handle_redirection(char *args[], int *input_fd, int *output_fd) { int i = 0; while (args[i] != NULL) { if (strcmp(args[i], "<") == 0) { *input_fd = open(args[i + 1], O_RDONLY); if (*input_fd == -1) { print_error("input redirection error"); } args[i] = NULL; } else if (strcmp(args[i], ">") == 0) { *output_fd = open(args[i + 1], O_WRONLY | O_CREAT | O_TRUNC, 0640); if (*output_fd == -1) { print_error("output redirection error"); } args[i] = NULL; } i++; } } void handle_pipes(char *args1[], char *args2[]) { int pipe_fd[2]; int status; if (pipe(pipe_fd) == -1) { print_error("pipe creation error"); } pid_t pid1, pid2; pid1 = fork(); if (pid1 == 0) { // Child process 1 close(pipe_fd[0]); // Close unused read end // Redirect stdout to the write end of the pipe dup2(pipe_fd[1], 1); close(pipe_fd[1]); execvp(args1[0], args1); // If execvp fails print_error("command not found"); } else if (pid1 < 0) { // Forking error print_error("forking error"); } pid2 = fork(); if (pid2 == 0) { // Child process 2 close(pipe_fd[1]); // Close unused write end // Redirect stdin to the read end of the pipe dup2(pipe_fd[0], 0); close(pipe_fd[0]); execvp(args2[0], args2); // If execvp fails print_error("command not found"); } else if (pid2 < 0) { // Forking error print_error("forking error"); } // Close both ends of the pipe in the parent process close(pipe_fd[0]); close(pipe_fd[1]); // Wait for both child processes to finish waitpid(pid1, &status, 0); waitpid(pid2, &status, 0); } char **tokenize_input(char *input) { char **tokens = malloc(MAX_ARG_NUM * sizeof(char *)); if (tokens == NULL) { print_error("memory allocation error"); } int token_count = 0; char *token = strtok(input, " "); while (token != NULL) { tokens[token_count++] = strdup(token); if (tokens[token_count - 1] == NULL) { print_error("memory allocation error"); } token = strtok(NULL, " "); } tokens[token_count] = NULL; return tokens; } char **expand_wildcards(char *arg) { glob_t glob_result; if (glob(arg, GLOB_NOCHECK, NULL, &glob_result) != 0) { print_error("wildcard expansion error"); } char **expanded_args = malloc((glob_result.gl_pathc + 1) * sizeof(char *)); if (expanded_args == NULL) { print_error("memory allocation error"); } for (size_t i = 0; i < glob_result.gl_pathc; i++) { expanded_args[i] = strdup(glob_result.gl_pathv[i]); if (expanded_args[i] == NULL) { print_error("memory allocation error"); } } expanded_args[glob_result.gl_pathc] = NULL; globfree(&glob_result); return expanded_args; } void execute_builtin_command(char *args[]) { if (strcmp(args[0], "cd") == 0) { if (args[1] != NULL) { if (chdir(args[1]) == -1) { print_error("cd error"); } } else { fprintf(stderr, "cd: missing argument\n"); } } else if (strcmp(args[0], "pwd") == 0) { char cwd[MAX_PATH_SIZE]; if (getcwd(cwd, sizeof(cwd)) != NULL) { printf("%s\n", cwd); } else { print_error("pwd error"); } } else if (strcmp(args[0], "which") == 0) { if (args[1] != NULL) { char *path = NULL; // Check if the command is a built-in command if (is_builtin_command(args[1])) { printf("%s: shell built-in command\n", args[1]); } else { // Search for the program in the specified directories char *directories[] = {"/usr/local/bin", "/usr/bin", "/bin"}; for (int i = 0; i < (int)(sizeof(directories) / sizeof(directories[0])); i++) { char command_path[MAX_PATH_SIZE]; snprintf(command_path, MAX_PATH_SIZE, "%s/%s", directories[i], args[1]); if (access(command_path, X_OK) == 0) { path = strdup(command_path); break; } } if (path != NULL) { printf("%s\n", path); free(path); } else { fprintf(stderr, "%s: command not found\n", args[1]); } } } else { fprintf(stderr, "which: missing argument\n"); } } else if (strcmp(args[0], "echo") == 0) { // Handle echo command for (int i = 1; args[i] != NULL; i++) { printf("%s", args[i]); if (args[i + 1] != NULL) { printf(" "); } } printf("\n"); } } int is_builtin_command(char *command) { return (strcmp(command, "cd") == 0 || strcmp(command, "pwd") == 0 || strcmp(command, "which") == 0); } void print_error(const char *message) { fprintf(stderr, "mysh: %s\n", message); exit(EXIT_FAILURE); } the code above cannot currently handle echo commands. for example, if i run the program with a sh file that has three lines of echo commands, it will instead output three blank lines instead of three strings. other commands such as pwd, which, ls, and cd work fine so what is the issue
67e52e02cdf2c244e7e7eb732a697ea9
{ "intermediate": 0.4495420455932617, "beginner": 0.4141734838485718, "expert": 0.13628441095352173 }
33,286
in SQL, select a substring from "<Pin name="EmergencyLightBar" type="din">0</Pin>" that shows just the zero between the > and <
69f5c6ec8525bfd3a15e984694320d11
{ "intermediate": 0.35190895199775696, "beginner": 0.23241661489009857, "expert": 0.41567444801330566 }
33,287
I have to fine-tune a llm to generate Indian legal affidavits How should I start Give steps with some code please
c1e4b0f6d40a3ea2c45009b6d15dc180
{ "intermediate": 0.37993481755256653, "beginner": 0.20852357149124146, "expert": 0.41154158115386963 }
33,288
import openai # Пересохраните ваш API-ключ от OpenAI openai.api_key = "YOUR_API_KEY" # Задайте различные параметры prompt = "Здравствуйте! Как я могу помочь вам сегодня?" voice = "en-US-Wavenet-J" temperature = 0.8 max_tokens = 100 # Создайте функцию для генерации озвученного текста def generate_voiced_text(prompt, voice, temperature, max_tokens): response = openai.Completion.create( engine="text-davinci-003", prompt=prompt, temperature=temperature, max_tokens=max_tokens, n=1, stop=None, ) voiced_text = response.choices[0].text return voiced_text # Озвучьте текст с помощью функции voiced_text = generate_voiced_text(prompt, voice, temperature, max_tokens) # Выведите озвученный текст print(voiced_text)
13695f9c79e05c6292c9b0174ad870bc
{ "intermediate": 0.29516851902008057, "beginner": 0.447720468044281, "expert": 0.2571110129356384 }
33,289
hi there, a coding challenge. assume the language is purescript. make a datatype of kind `forall k. k -> k`, call it Proxy, and give it a Bind typeclass instance
09931dbe16383a91d3b08738abf8e814
{ "intermediate": 0.23965765535831451, "beginner": 0.661445140838623, "expert": 0.09889727830886841 }
33,290
in JS, how do I have regex matching either a character or the end of string?
7a7c99a3fb4fbab38168a7d33de68711
{ "intermediate": 0.5082759857177734, "beginner": 0.1984531581401825, "expert": 0.29327091574668884 }
33,291
in JS, how do I have regex matching either a character or the end of string?
2dd159464b0a5e22fb7f1453d1eb1884
{ "intermediate": 0.5082759857177734, "beginner": 0.1984531581401825, "expert": 0.29327091574668884 }
33,292
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 def initial_permutation(block): # Perform initial permutation on the block initial_permutation_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] permuted_block = "" for index in initial_permutation_table: permuted_block += block[index - 1] return permuted_block def expand_permutation(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] 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] ] ] 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)error in line 96 permuted _block +=block [index-1]
9fb0769f72ef896947a2fd9051bec197
{ "intermediate": 0.343763142824173, "beginner": 0.41792595386505127, "expert": 0.23831090331077576 }
33,293
hi i need you to create a JSON file for me
26476030f1b1f7bafd9fd9a14a23f5a5
{ "intermediate": 0.3315412104129791, "beginner": 0.20640309154987335, "expert": 0.4620557427406311 }
33,294
please build script for download tiktok by url using python
7489922829fac8ebcee00fd68451db95
{ "intermediate": 0.40691426396369934, "beginner": 0.1716650277376175, "expert": 0.421420693397522 }
33,295
python charm program a random guessing number until 1000
408d2dd0ae7667cdbdc172172afddc81
{ "intermediate": 0.3804894685745239, "beginner": 0.31313037872314453, "expert": 0.30638012290000916 }
33,296
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 def initial_permutation(block): # Perform initial permutation on the block initial_permutation_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] permuted_block = "" for index in initial_permutation_table: permuted_block += block[index - 1] return permuted_block def expand_permutation(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] 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] ] ] 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)لا استطيع حل مشكله straing index out of range in permuted _block +)=block [index-1]
d7e1f47bba11a01eb8ba1484e7d3de7b
{ "intermediate": 0.343763142824173, "beginner": 0.41792595386505127, "expert": 0.23831090331077576 }
33,297
https://stablediffusion.fr/chatgpt4
5c846331e29ce3cb857c5ed13942281c
{ "intermediate": 0.4328889846801758, "beginner": 0.22920450568199158, "expert": 0.33790653944015503 }
33,298
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 def initial_permutation(block): # Perform initial permutation on the block initial_permutation_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] permuted_block = “” for index in initial_permutation_table: permuted_block += block[index - 1] return permuted_block def expand_permutation(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] 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] ] ] 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) 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, initial_permutation_table) encrypted_blocks.append(encrypted_block)error string out of range بعد اضافه if len(block) <32 block =block. Zfill (32)
2a5d76f42719b534a7f5af4918a0e625
{ "intermediate": 0.2808162569999695, "beginner": 0.5485007166862488, "expert": 0.1706831306219101 }
33,299
current_month = driver.find_element(By.CLASS_NAME,'monthselect').text current_year = driver.find_element(By.CLASS_NAME,'yearselect').text This code produces the lists of all available months and years in calendar. But I need to have only the selected month and year in that variables
d7af720d1c40fd8f7d588ffade661d7f
{ "intermediate": 0.2984754741191864, "beginner": 0.4230296313762665, "expert": 0.2784949243068695 }
33,300
import json import numpy as np from tensorflow.keras.models import load_model from collections import Counter, defaultdict import plotly.graph_objs as go # Функция для чтения данных и подсчета встречаемости пользователей def load_data(filename): user_counter = Counter() data_by_user = defaultdict(list) with open(filename, 'r', encoding='utf-8') as file: for line in file: event = json.loads(line) user = event['SourceHostname_User'] user_counter[user] += 1 data_by_user[user].append([event['EventId'], event['ThreadId'], event['Image']]) return user_counter, data_by_user model = load_model('neural_network_model.h5') filename = '1.jsonl' sequence_length = 100 user_counter, data_by_user = load_data(filename) top_users = [user for user, _ in user_counter.most_common(20)] predictions = defaultdict(list) for user in top_users: events = data_by_user[user] for i in range(len(events) - sequence_length + 1): sequence = np.array(events[i:i + sequence_length]) sequence = sequence.reshape((1, sequence_length, -1)) pred = model.predict(sequence) predictions[user].extend(pred) def plot_top_predictions(predictions, top_users): fig = go.Figure() for user in top_users: preds = np.array(predictions[user]) if len(preds) == 0: continue y = np.argmax(preds, axis=1) x = np.arange(len(y)) fig.add_trace(go.Scatter(x=x, y=y, mode='lines', name=user)) fig.update_layout( title='Top 20 User Predictions', xaxis_title='Prediction Number', yaxis_title='Predicted Class', hovermode='x unified' ) fig.update_xaxes(rangeslider_visible=True, rangeselector=dict( buttons=list([ dict(count=1, label='1m', step='minute', stepmode='backward'), dict(count=6, label='6h', step='hour', stepmode='todate'), dict(step='all') ]) )) fig.update_yaxes(fixedrange=False) fig.show() plot_top_predictions(predictions, top_users) переделай только под Director , director\\TestoedovNA ,ISS-RESHETNEV\\PjetrovPA n743879.iss-reshetnev.ru n764371.iss-reshetnev.ru
bc7d6859aed37427f32689c7ce9cd2f3
{ "intermediate": 0.4225699305534363, "beginner": 0.36925268173217773, "expert": 0.2081773728132248 }
33,301
How can I under "virt-manager" from a VM access the serial port of another vm ?
8ca815ec5b10a6e21357748bbf67ff0b
{ "intermediate": 0.42807525396347046, "beginner": 0.2844283878803253, "expert": 0.2874963879585266 }
33,302
;PROGRAM TITLE GOES HERE -- HANOI ;Solves tower of hanoi puzzle.Printout sequence of moves ;of N discs from initial spindle X to final spindle Z. ;using spindle Y for temporery storage ; datarea segment ;define data segment message1 db 'N=?',0ah,0dh,'$' message2 db 'What is the name of spindle X ?' db 0ah,0dh,'$' message3 db 'What is the name of spindle Y ?' db 0ah,0dh,'$' message4 db 'What is the name of spindle Z ?' db 0ah,0dh,'$' flag dw 0 constant dw 10000,1000,100,10,1 datarea ends ;***************************************************** prognam segment ;define code segment ;----------------------------------------------------- main proc far assume cs:prognam, ds:datarea start: ;set up stack for return push ds sub ax,ax push ax ;set DS register to current data segment mov ax,datarea mov ds,ax ;main part of program goes here lea dx,message1 ;N=7? mov ah,09h int 21h call decibin ;read N into BX call crlf cmp bx,0 ;if N=0 jz exit ;exit lea dx,message2 ;X=? mov ah,09h int 21h mov ah,01h ;read X's name into CX int 21h mov ah,0 mov cx,ax call crlf lea dx,message3 ;Y=? mov ah,09h int 21h mov ah,01h ;read Y'name into SI int 21h mov ah,0 mov si,ax call crlf lea dx,message4 ;Z=? mov ah,09h int 21h mov ah,01h ;read Z's name into DI int 21h mov ah,0 mov di,ax call crlf call hanoi ;call HANOI(N,X,Y,Z) exit: ret ;return to DOS main endp ;--------------------------------------------------- hanoi proc near ;define subprocedure ;SOlves tower of hanoi puzzle ;Argement :(BX)=N,(CX)=X,(SI)=Y,(DI)=Z. cmp bx,1 ;if N=1,execute basis je basis call save ;save N,X,Y,Z dec bx xchg si,di call hanoi ;call HANOI(N-1,X,Z,Y) call restor ;restore N,X,Y,Z call print ;print XNZ dec bx xchg cx,si call hanoi ;call HANOI(N-1,Y,X,Z) jmp return basis: call print ;print X1Z return: ret ;return hanoi endp ;end subprocedure ;------------------------------------------------------- print proc near mov dx,cx ;print X mov ah,02h int 21h call binidec ;print N mov dx,di ;print Z mov ah,02h int 21h call crlf ;skip to next line ret print endp ;----------------------------------------------------------- save proc near pop bp push bx push cx push si push di push bp ret save endp ;----------------------------------------------------------- restor proc near pop bp pop di pop si pop cx pop bx push bp ret restor endp ;------------------------------------------------------------ decibin proc near ;prodecure to convert decimal on keyboard to binary. ;result is left in BX register mov bx,0 ;get digit from keyboard ,convert to binary newchar: mov ah,1 ;keyboard input int 21h ;call DOS sub al,30h ;ASCII to binary jl exit1 ;jump if<0 cmp al,9d ;is it >9d? jg exit1 ;yes,not dec digit cbw ;BYTE in AL to WORD in AX ;(digit is now in AX) ;multiply number in BX by 10 decimal xchg ax,bx ;trade digit&number mov cx,10d ;put 10 dec in CX mul cx ;number times 10 xchg ax,bx ;trade number &digit ;add digit in AX to number in BX add bx,ax ;add digit to number jmp newchar ;get next digit exit1: ret ;return from decibin decibin endp ;end of decibin proc ;------------------------------------------------------------ binidec proc near ;procedure to convert binary number in BX to decimal ;on console screen push bx push cx push si push di mov flag,0 mov cx,5 lea si,constant dec_div: mov ax,bx ;number high half mov dx,0 ;zero out low half div word ptr[si] ;divide by contant mov bx,dx ;reminder into BX mov dl,al ;quotient into DL cmp flag,0 ;have not leading zero jnz print1 cmp dl,0 je skip mov flag,1 ;print the contents of DL on screen print1: add dl,30h ;convert to ASCII mov ah,02h ;display fuction int 21h ;call DOS skip: add si,2 loop dec_div pop di pop si pop cx pop bx ret ;return from dec_div binidec endp ;------------------------------------------------------------- crlf proc near mov dl,0ah ;linefeed mov ah,02h ;display function int 21h ; mov dl,0dh ;carriage return mov ah,02h ;display function int 21h ; ret crlf endp ;----------------------------------------------------------- prognam ends ;end of code segment ;************************************************************* end start ;end assembly
7399602df0fd0525e780778ab9d1a31a
{ "intermediate": 0.358176589012146, "beginner": 0.393733412027359, "expert": 0.2480899691581726 }
33,303
как сделать, чтобы мой запрос getOperationStatus попал на проверку checkSign private Boolean checkSign(CachedBodyHttpServletRequest request, ServletResponse servletResponse) throws IOException { String requestContent = new String(ByteStreams.toByteArray(request.getInputStream()), StandardCharsets.UTF_8); return checkSignForContent(requestContent, request, servletResponse); } @RestController @RequestMapping(value = {"/orders"}) @Slf4j public class OrderController { private static final String PROCESSING_UUID = "Processing-UUID"; private final C2BSBPService c2BSBPService; public OrderController(C2BSBPService c2BSBPService) { this.c2BSBPService = c2BSBPService; } @PostMapping(value = "") @ResponseBody public ResultToPartner addOrder(@RequestBody OrderRqDto orderRqDto, @RequestHeader(name = "X-Partner-Id") String partnerId, HttpServletRequest request) { return c2BSBPService.addOrder(orderRqDto, Long.parseLong(partnerId), (String) request.getAttribute(PROCESSING_UUID)); } @GetMapping (value = "/{id}") @ResponseBody public ResultToPartner getOperationStatus(@PathVariable("id") Long id, @RequestHeader(name = "X-Partner-Id") String partnerId, HttpServletRequest request, @RequestHeader(name = "X-Signature") String signature) { return c2BSBPService.getOperationState(id); } }
c2819a96404470c3d2121c6e9790ee11
{ "intermediate": 0.38333913683891296, "beginner": 0.4566159248352051, "expert": 0.16004487872123718 }
33,304
;PROGRAM TITLE GOES HERE -- HANOI ;Solves tower of hanoi puzzle.Printout sequence of moves ;of N discs from initial spindle X to final spindle Z. ;using spindle Y for temporery storage ; datarea segment ;define data segment message1 db 'N=?',0ah,0dh,'$' message2 db 'What is the name of spindle X ?' db 0ah,0dh,'$' message3 db 'What is the name of spindle Y ?' db 0ah,0dh,'$' message4 db 'What is the name of spindle Z ?' db 0ah,0dh,'$' flag dw 0 constant dw 10000,1000,100,10,1 datarea ends ;***************************************************** prognam segment ;define code segment ;----------------------------------------------------- main proc far assume cs:prognam, ds:datarea start: ;set up stack for return push ds sub ax,ax push ax ;set DS register to current data segment mov ax,datarea mov ds,ax ;main part of program goes here lea dx,message1 ;N=7? mov ah,09h int 21h call decibin ;read N into BX call crlf cmp bx,0 ;if N=0 jz exit ;exit lea dx,message2 ;X=? mov ah,09h int 21h mov ah,01h ;read X's name into CX int 21h mov ah,0 mov cx,ax call crlf lea dx,message3 ;Y=? mov ah,09h int 21h mov ah,01h ;read Y'name into SI int 21h mov ah,0 mov si,ax call crlf lea dx,message4 ;Z=? mov ah,09h int 21h mov ah,01h ;read Z's name into DI int 21h mov ah,0 mov di,ax call crlf call hanoi ;call HANOI(N,X,Y,Z) exit: ret ;return to DOS main endp ;--------------------------------------------------- hanoi proc near ;define subprocedure ;SOlves tower of hanoi puzzle ;Argement :(BX)=N,(CX)=X,(SI)=Y,(DI)=Z. cmp bx,1 ;if N=1,execute basis je basis call save ;save N,X,Y,Z dec bx xchg si,di call hanoi ;call HANOI(N-1,X,Z,Y) call restor ;restore N,X,Y,Z call print ;print XNZ dec bx xchg cx,si call hanoi ;call HANOI(N-1,Y,X,Z) jmp return basis: call print ;print X1Z return: ret ;return hanoi endp ;end subprocedure ;------------------------------------------------------- print proc near mov dx,cx ;print X mov ah,02h int 21h call binidec ;print N mov dx,di ;print Z mov ah,02h int 21h call crlf ;skip to next line ret print endp ;----------------------------------------------------------- save proc near pop bp push bx push cx push si push di push bp ret save endp ;----------------------------------------------------------- restor proc near pop bp pop di pop si pop cx pop bx push bp ret restor endp ;------------------------------------------------------------ decibin proc near ;prodecure to convert decimal on keyboard to binary. ;result is left in BX register mov bx,0 ;get digit from keyboard ,convert to binary newchar: mov ah,1 ;keyboard input int 21h ;call DOS sub al,30h ;ASCII to binary jl exit1 ;jump if<0 cmp al,9d ;is it >9d? jg exit1 ;yes,not dec digit cbw ;BYTE in AL to WORD in AX ;(digit is now in AX) ;multiply number in BX by 10 decimal xchg ax,bx ;trade digit&number mov cx,10d ;put 10 dec in CX mul cx ;number times 10 xchg ax,bx ;trade number &digit ;add digit in AX to number in BX add bx,ax ;add digit to number jmp newchar ;get next digit exit1: ret ;return from decibin decibin endp ;end of decibin proc ;------------------------------------------------------------ binidec proc near ;procedure to convert binary number in BX to decimal ;on console screen push bx push cx push si push di mov flag,0 mov cx,5 lea si,constant dec_div: mov ax,bx ;number high half mov dx,0 ;zero out low half div word ptr[si] ;divide by contant mov bx,dx ;reminder into BX mov dl,al ;quotient into DL cmp flag,0 ;have not leading zero jnz print1 cmp dl,0 je skip mov flag,1 ;print the contents of DL on screen print1: add dl,30h ;convert to ASCII mov ah,02h ;display fuction int 21h ;call DOS skip: add si,2 loop dec_div pop di pop si pop cx pop bx ret ;return from dec_div binidec endp ;------------------------------------------------------------- crlf proc near mov dl,0ah ;linefeed mov ah,02h ;display function int 21h ; mov dl,0dh ;carriage return mov ah,02h ;display function int 21h ; ret crlf endp ;----------------------------------------------------------- prognam ends ;end of code segment ;************************************************************* end start ;end assembly 请对上述代码进行修改,使其能从INPUT.TXT中读取输入数据(盘子数 起始轴 中间轴 最终轴),并将所有输出结果重定向到OUTPUT.TXT。提示:使用子程序负责输入和输出,如果命令行上有输入文件名和输出文件名参数,则输入输出都针对文件进行。
e06726a13efa71e058fedbd91e348dbb
{ "intermediate": 0.358176589012146, "beginner": 0.393733412027359, "expert": 0.2480899691581726 }
33,305
(String.IsNullOrEmpty(imagePath) как сделать чтобы вместо imagePath была ссылка на картинку этот файл находится в debug/scripts/getprice.cs а картинка в debug/imagecontainer/price.jpg
637493ced1d3b1acdaec7ad39ea85e42
{ "intermediate": 0.515320897102356, "beginner": 0.2904878258705139, "expert": 0.19419130682945251 }
33,306
C# show window over fullscreen games
9737adc4bd38df79054ab83b1698795c
{ "intermediate": 0.4071568548679352, "beginner": 0.37341707944869995, "expert": 0.21942603588104248 }
33,307
in ggplot(Tc_Carotte_mlf, aes(x = Test_Jour_Croissance, y = CFU_g,fill = Bacterie)) + geom_boxplot() + # stat_compare_means(aes(group = Bacterie), label = "p")+ labs(title ="Comparaison CFU/g pour Carotte", x = "Test", y = "CFU_g") + scale_fill_manual(values = couleurs_bacterie, guide = guide_legend(title = "Bacterie")) + theme_minimal() + scale_y_log10(limits = c(10^0, 10^7), breaks = 10^(0:7)) how add NA values
e72df52366e53f947a73d8ba454caf6d
{ "intermediate": 0.29639342427253723, "beginner": 0.2647167444229126, "expert": 0.43888983130455017 }
33,308
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] ] ] 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 list index out of range
be9e6df8c804e4ebc5b4a788c2e46f12
{ "intermediate": 0.3371845483779907, "beginner": 0.4498818516731262, "expert": 0.21293359994888306 }
33,309
in a gdb rsp connection ,how openocd let gdb quit
c1e82cf6f679f9329d5c62400b68d33c
{ "intermediate": 0.6032066345214844, "beginner": 0.15165798366069794, "expert": 0.2451353371143341 }
33,310
i have an ATmega16, a simple 4x4 keypad and a 16x2 LCD character. my keypad is like this one: { '7', '8', '9', '/', '4', '5', '6', '*', '1', '2', '3', '-', 'reset', '0', '=', '+', } i want to use alcd.h library and write the program inside codevision avr enviorment using c language. i initialized my LCD and connected to A ports of atmega16. and also connected keypad to D ports of atmega16. i want to write the program when user hits every button on keypad, that character prints on LCD character. with the eddition of one thing: when user just press '0', '0' should be displayed on LCD but if he keeps the button down and doesnt release it for more than 2000ms,'.' should be displayed on LCD.
6201af03f11ecdeb2d19fe853f8bbef3
{ "intermediate": 0.5089640617370605, "beginner": 0.21236677467823029, "expert": 0.278669148683548 }
33,311
pairs(pca_scores$x, xlim=c(-3, 3), ylim=c(-3, 3), col=rainbow(6), pch=9) Error in pca_scores$x : $ operator is invalid for atomic vectors
a51f93eb73824ab28dea59a410b80543
{ "intermediate": 0.38630756735801697, "beginner": 0.307656466960907, "expert": 0.30603599548339844 }
33,312
home assistant template card making
65d4e96cc4180e2ea3418ed4d85ed366
{ "intermediate": 0.3361682891845703, "beginner": 0.41090402007102966, "expert": 0.2529277205467224 }
33,313
python get camelcase from snakecase
ae63d0bee99d95c50a8111c402d22593
{ "intermediate": 0.34362444281578064, "beginner": 0.33903300762176514, "expert": 0.3173425793647766 }
33,315
free bytecode noo-coding editor
3167370764fa7aab60be41d766072cdd
{ "intermediate": 0.23314028978347778, "beginner": 0.33218586444854736, "expert": 0.43467384576797485 }
33,316
pairs(pca_scores, xlim=c(-3, 3), ylim=c(-3, 3), col=rainbow(6), pch=9) 为什么画出来是空的,pca_scores是个 num [1:56, 1:3]
4c447c3c28f5be98b3997415dd704b56
{ "intermediate": 0.3126660883426666, "beginner": 0.29716727137565613, "expert": 0.39016664028167725 }
33,317
The data.txt file is a 12625 x 56 matrix; each column (row) of the matrix corresponds to the individual case (gene). Among the 56 cases, Columns 1~20: pulmonary carcinoid samples (Carcinoid); Columns 21~33: colon cancer metastasis samples (Colon); Columns 34~50: normal lung samples (Normal); Columns 51~56: small cell carcinoma samples (SmallCell). We applied PCA to the transposed matrix to extract the first three principal components. Perform K-means and hierarchical clustering analyses using the first three principal components.怎么理解Perform K-means and hierarchical clustering analyses using the first three principal components,请展示k-means的代码
6721fe8cdb628d83af2037432dbb8e34
{ "intermediate": 0.32485702633857727, "beginner": 0.2391621470451355, "expert": 0.43598082661628723 }
33,318
help me also make so it works on slight rotation on the picture: import cv2 as cv import numpy as np from matplotlib import pyplot as plt img = cv.imread("photo (3).jpg", cv.IMREAD_GRAYSCALE) assert img is not None, "file could not be read, check with os.path.exists()" img2 = img.copy() template = cv.imread("namn1.png", cv.IMREAD_GRAYSCALE) assert template is not None, "file could not be read, check with os.path.exists()" w, h = template.shape[::-1] # All the 6 methods for comparison in a list methods = [ "cv.TM_CCOEFF", "cv.TM_CCOEFF_NORMED", "cv.TM_CCORR", "cv.TM_CCORR_NORMED", "cv.TM_SQDIFF", "cv.TM_SQDIFF_NORMED", ] for meth in methods: img = img2.copy() method = eval(meth) # Apply template Matching res = cv.matchTemplate(img, template, method) min_val, max_val, min_loc, max_loc = cv.minMaxLoc(res) # If the method is TM_SQDIFF or TM_SQDIFF_NORMED, take minimum if method in [cv.TM_SQDIFF, cv.TM_SQDIFF_NORMED]: top_left = min_loc else: top_left = max_loc bottom_right = (top_left[0] + w, top_left[1] + h) cv.rectangle(img, top_left, bottom_right, 255, 2) plt.subplot(121), plt.imshow(res, cmap="gray") plt.title("Matching Result"), plt.xticks([]), plt.yticks([]) plt.subplot(122), plt.imshow(img, cmap="gray") plt.title("Detected Point"), plt.xticks([]), plt.yticks([]) plt.suptitle(meth) plt.show()
2dad023372fd870e82c66b8a98c049db
{ "intermediate": 0.4851396679878235, "beginner": 0.2847941517829895, "expert": 0.23006610572338104 }
33,319
Как перевести десятичное отрицательное число в шестнадцатеричную систему счисления?с++ #include <iostream> #include <vector> #include <array> using namespace std; void code_sh(int n){ vector<string> str={"A","B","C","D","E","F"}; vector<string> ch={"10","11","12","13","14","15"}; vector<string> numbers; int s,o,d; s=n<0 ? -n : n; d=s; while(d>1){ o=d%16; d=d/16; string strNum=to_string(o); numbers.push_back(strNum); } string strNum1=to_string(d); numbers.push_back(strNum1); if(n<0){ cout<<"-"; for (int j=0;j<numbers.size();j++){ for (int g=0;g<6;g++){ numbers[j]= numbers[j]== ch[g]? str[g] : numbers[j]; } } } else{ for (int j=0;j<numbers.size();j++){ for (int g=0;g<6;g++){ numbers[j]= numbers[j]== ch[g]? str[g] : numbers[j]; } } } for(int i=numbers.size()-1 ;i>=0;i--){ numbers[i]=numbers[i]=="0" ? "" : numbers[i]; cout<<numbers[i]; } } int main(){ int n; cin>>n; code_sh(n); } вот мой код. только сейчас поняв, что нужно было не просто подставить - в начале... в общем, не совсем понимаю как правильно можно преобразовать. возможно обойтись без инвертации и присваивании единицы?
7158d68c6a33b10f3284fe45bad263b7
{ "intermediate": 0.44452494382858276, "beginner": 0.4227984547615051, "expert": 0.13267658650875092 }
33,320
Проверь что не так в моём шейдере, почему _MainTex отрисовывется чёрно-белой? И почему свет падает не правильно. Исправь все недочеты Shader "Custom/SimpleTangentSpaceLighting" { Properties { _MainTex("Albedo", 2D) = "white" {} _NormalTex("Normal Map", 2D) = "bump" {} } SubShader { Pass { Tags{ "LightMode" = "ForwardBase" } CGPROGRAM #pragma vertex vert #pragma fragment frag #include "UnityCG.cginc" #include "Lighting.cginc" #pragma multi_compile_fwdbase nolightmap nodirlightmap nodynlightmap novertexlight #include "AutoLight.cginc" struct appdata { float4 vertex : POSITION; float3 normal : NORMAL; float4 tangent : TANGENT; float2 uv : TEXCOORD0; float2 uv2 : TEXCOORD1; }; struct v2f { float4 vertex : SV_POSITION; float2 uv : TEXCOORD0; float2 uv2 : TEXCOORD1; float3 tangentSpaceLight : TEXCOORDn1; }; sampler2D _MainTex; float4 _MainTex_ST; sampler2D _NormalTex; v2f vert(appdata v) { v2f o; o.vertex = UnityObjectToClipPos(v.vertex); o.uv = TRANSFORM_TEX(v.uv, _MainTex); float3 normal = UnityObjectToWorldNormal(v.normal); float3 tangent = UnityObjectToWorldNormal(v.tangent); float3 bitangent = cross(tangent, normal); o.tangentSpaceLight = float3(dot(tangent, _WorldSpaceLightPos0), dot(bitangent, _WorldSpaceLightPos0), dot(normal, _WorldSpaceLightPos0)); return o; } fixed4 frag(v2f i) : SV_Target { float3 col = tex2D(_MainTex, i.uv); float3 tangentNormal = tex2D(_NormalTex, i.uv) * 2 - 1; return dot(tangentNormal, i.tangentSpaceLight * col); } ENDCG } } }
dc3d2c317b98bde3603ce6d2260d5699
{ "intermediate": 0.32938656210899353, "beginner": 0.4383136034011841, "expert": 0.23229987919330597 }
33,321
how to setup ngnix rtmp server that runs forever and can change video source from api
83816783650f4c1a7c8840e2f18098b4
{ "intermediate": 0.5556225776672363, "beginner": 0.18247850239276886, "expert": 0.2618989646434784 }
33,322
Assume the following co-training (multiview learning) self-training scenario: the positive class contains x 1 = [1 0] T and the negative class contains x 2 = [0 1] T . Assume that we first train a maximum margin classifier only based on the first feature of training vectors, then label the unlabeled vector x 3 = [2/3 1/3] T , and then train a maximum margin classifier based on the second feature of x 1 , x 2 , x 3 . Explain why the class asasociated with the point x 4 = [2 2] T is indeterminate if it is classified using a majority poll between the maximum margin classifier that uses the first feature and the maximum margin classifier that used the second feature for classification.
35abdb50a60132c2815d6cb97b665243
{ "intermediate": 0.22470177710056305, "beginner": 0.1712343692779541, "expert": 0.604063868522644 }
33,323
Need Pine code for RSI fast (value )and slow RSI (value) cross with color change fill. Take smoothening and Threshold factor as 1
b4c75a10162f069ffb6c9333a6711c25
{ "intermediate": 0.3383547067642212, "beginner": 0.13788077235221863, "expert": 0.5237645506858826 }
33,324
Required C++ classes to implement the Izhikevich model. Neurons created would be used to build a randomly connected network, so it must be possible to dynamiclly connect and disconnect a neuron from a neighbor, either as input or output. The implementation must include synaptic plasticity, with different types of synapses, axonal and dendritic delays, STDP, LTD, showing memory behavior. Use the model that you want, but must address stability issues under plasticity. Try to optimize the code as much as possible, and do not use the C++ STL, only code written from scratch. The goal is to simulate the nervous system of a primitive animale.
2c33be99108221f9f1605f08251d40ab
{ "intermediate": 0.09936594218015671, "beginner": 0.17434285581111908, "expert": 0.7262911796569824 }
33,325
Required C++ classes to implement the Izhikevich model. Neurons created would be used to build a randomly connected network, so it must be possible to dynamiclly connect and disconnect a neuron from a neighbor, either as input or output. The implementation must include synaptic plasticity, with different types of synapses, axonal and dendritic delays, STDP, LTD, showing memory behavior. Use the model that you want, but must address stability issues under plasticity. Try to optimize the code as much as possible. The goal is to simulate the nervous system of a primitive animale.
0ef958230e318dceebdd4aa7f94d283a
{ "intermediate": 0.1402813345193863, "beginner": 0.13764744997024536, "expert": 0.7220712304115295 }
33,326
Required C++ classes to implement the Izhikevich model. Neurons created would be used to build a randomly connected network, so it must be possible to dynamiclly connect and disconnect a neuron from a neighbor, either as input or output. The implementation must include synaptic plasticity, with different types of synapses, axonal and dendritic delays, STDP, LTD, showing memory behavior. Use the model that you want, but must address stability issues under plasticity. Try to optimize the code as much as possible. Write usable code, not only skeleton. It doesn’t need to be 100% completed, but as much as you can. The goal is to simulate the nervous system of a primitive animale.
d185695ee88c675f3520a7ec74f6dc54
{ "intermediate": 0.08806933462619781, "beginner": 0.13949228823184967, "expert": 0.7724383473396301 }
33,327
Required C++ classes to implement the Izhikevich model. Neurons created would be used to build a randomly connected network, so it must be possible to dynamiclly connect and disconnect a neuron from a neighbor, either as input or output. The implementation must include synaptic plasticity, with different types of synapses, axonal and dendritic delays, STDP, LTD, showing memory behavior. Use the model that you want, but must address stability issues under plasticity. Try to optimize the code as much as possible. Write usable code, not only skeleton and no « holes » in the code. The goal is to simulate the nervous system of a primitive animale.
696e4950fc470964435b25d3ff808fc5
{ "intermediate": 0.09867190569639206, "beginner": 0.12995336949825287, "expert": 0.7713747620582581 }
33,328
Required C++ classes to implement the Izhikevich model. Neurons created would be used to build a randomly connected network, so it must be possible to dynamiclly connect and disconnect a neuron from a neighbor, either as input or output. The implementation must include synaptic plasticity, with different types of synapses, axonal and dendritic delays, STDP, LTD. Use the model that you want, but must address stability issues under plasticity. Try to optimize the code as much as possible. Write usable code, not only skeleton. The goal is to simulate the nervous system of a primitive animale.
55016d293313a90ca3279706d38b31d7
{ "intermediate": 0.11792676150798798, "beginner": 0.16150616109371185, "expert": 0.7205671072006226 }
33,329
C++ code to connect to a Tor's Hidden Service v3. The code must not use the official Tor client, but download the consensus, parse it, download hidden service descriptor, parse it and connect to the hidden service, re-implementing a simple version of the Tor's protocol. OpenSSL must be used for cryptography. The goal is to download files from my private server from an embedded platform which can't afford the full Tor client. Security is not an issue, neither than anonymity.
80178ed86fcf6c28b0c4695510791cfd
{ "intermediate": 0.5010915398597717, "beginner": 0.2849331796169281, "expert": 0.213975191116333 }