row_id
int64
0
48.4k
init_message
stringlengths
1
342k
conversation_hash
stringlengths
32
32
scores
dict
20,696
i have an order service for which i have to Get a list of active orders of type IOrder (List<IOrder>) then make a class of ExportOpenOrders that will use this information to form 1-Create PDF file from List<IOrder> containing all the relevant information 2-Display print dialog using Append.Blazor.Printing that is my order service code using DocumentFormat.OpenXml.Spreadsheet; using DocumentFormat.OpenXml.Wordprocessing; using Microsoft.Extensions.Logging; using Storz.SupplyManager.Domain.Interfaces.Repositories; using Storz.SupplyManager.Domain.Interfaces.Services; using Storz.SupplyManager.Domain.OrderAggregate; namespace Storz.SupplyManager.Application.OrderServices { public class OrderService : IOrderService { private readonly IOrderRepository orderRepository; private readonly ILoggerFactory logFactory; private readonly ILogger logger; public OrderService(IOrderRepository orderRepository, ILoggerFactory logFactory) { this.logFactory = logFactory; logger = logFactory.CreateLogger<OrderService>(); this.orderRepository = orderRepository; } /// <inheritdoc /> public async Task CreateOrderAsync(string userId, string partId, string room, string productionIslandNumber) { logger.LogDebug("Creating new Order with userid: {userId}, partId: {partId}, room: {room}, and productionIslandNumber: {productionIslandNumber}", userId, partId, room, productionIslandNumber); var location = new ProductionIslandLocation(room, productionIslandNumber); var orderId = Guid.NewGuid().ToString(); var newOrder = Order.CreateNewOrder(orderId, location, partId, userId, DateTime.Now, OrderStatus.Open); if (await IsOrderUniqueAsync(newOrder).ConfigureAwait(false)) { await orderRepository.AddAsync(newOrder).ConfigureAwait(false); } else { throw new InvalidOperationException("Order already exists"); } } private async Task<bool> IsOrderUniqueAsync(IOrder order) { var openOrders = await GetAllOpenOrdersAsync().ConfigureAwait(false); return openOrders .Count(openOrder => openOrder.PartId == order.PartId && openOrder.Location.Equals(order.Location)) == 0; } /// <inheritdoc /> public async Task<List<IOrder>> GetAllFinishedOrdersAsync() { var allOrders = await orderRepository.GetAllAsync().ConfigureAwait(false); return allOrders.Where(order => order.Status == OrderStatus.Finished).ToList(); } /// <inheritdoc /> public async Task<List<IOrder>> GetAllOpenOrdersAsync() { var allOrders = await orderRepository.GetAllAsync().ConfigureAwait(false); return allOrders.Where(order => order.Status == OrderStatus.Open).ToList(); } /// <inheritdoc /> public async Task MarkOrderAsFinishedAsync(string orderId) { var order = await orderRepository.GetAsync(orderId).ConfigureAwait(false); order.MarkAsFinished(); await orderRepository.UpdateAsync(order).ConfigureAwait(false); } /// <inheritdoc /> public async Task DeleteOrderAsync(string orderId) { await orderRepository.DeleteAsync(orderId); } } }
f2473336054714f4fc38653cb430f5de
{ "intermediate": 0.4152081608772278, "beginner": 0.4593030512332916, "expert": 0.12548883259296417 }
20,697
C# Visual studio, only 4th week of classes assignment so please don’t do nothing overly complicated so teacher doesn’t know I used chatgpt Assignment 1 (Console App) Several numbers are entered until number 0 is stated. Calculate and print the average of the positive numbers.
c18536867469bdac0f8dbadbb71cd859
{ "intermediate": 0.41519176959991455, "beginner": 0.3688414394855499, "expert": 0.21596677601337433 }
20,698
как решить ошибку docker login "request canceled while waiting for connection (Client.Timeout exceeded while awaiting headers)"
0340791142fd2837e9e2910875db129c
{ "intermediate": 0.3637698292732239, "beginner": 0.29889583587646484, "expert": 0.3373343050479889 }
20,699
Change port function so if: Name starts from "GRBS" TnPort should be "TN_IDL_C", if Name starts from "ERBS" and contains "_1_" TnPort should be "TN_B", if Name starts from "ERBS" and contains "_2_" TnPort should be "TN_A", if SubNetwork = "Shymkent" and Name starts from "ERBS" and contains "_1_" TnPort should be "TN_IDL_C", if SubNetwork = "Shymkent" and Name starts from "ERBS" and contains "_2_" TnPort should be "TN_IDL_D" Json example: {"Id":"541025","Name":"ERBS_41025_SHYGTC_1_KKT","FilterOwners":null,"FilterNRCells":null,"FilterEUtranCells":null,"FilterSectors":null,"FilterBands":null,"IsOnSharedRadio":false,"Region":"41","Nodes":["GRBS_41025_SHYGTC_1_KKT","ERBS_41025_SHYGTC_2_KKT"],"Latitude":"42.319917","Longitude":"69.594928","Altitude":"0","Lati":"","Longi":"","SubNetwork":"Shymkent","cellsGroupsLabels":null,"isLte":false,"Controller":"","ManagementHost":"","Dls":null,"Logicalname":"ERBS-41025-SHYGTC-1-KKT"} type EranConnection struct { Vlan ENodeB `json:"parent"` Connection string Connections []string TnPort string TnPorts []string } // connection initiates EranConnection default BBU connection type func (elasticran *EranConnection) port() { elasticran.TnPort = "TN_B" }
6d6356e4565fd5e2a77d42f69d97c78f
{ "intermediate": 0.34856659173965454, "beginner": 0.3366197347640991, "expert": 0.31481367349624634 }
20,700
no iconv implementation, cannot convert from UTF-8 to GBK
0f8a82258db312bb10e52abfcc200617
{ "intermediate": 0.3332952857017517, "beginner": 0.3714599907398224, "expert": 0.2952446937561035 }
20,701
PLYLoader.js:69 TypeError: Cannot read properties of undefined(正在读取“properties”)
fb3080b43db62fd431adce63b2df3365
{ "intermediate": 0.5507055521011353, "beginner": 0.20797333121299744, "expert": 0.24132110178470612 }
20,702
But how to add logic to filter contacts records by accountId also if rAccount record is selected by default
a631035475129add7e632d9bf407f675
{ "intermediate": 0.42443543672561646, "beginner": 0.10139443725347519, "expert": 0.47417011857032776 }
20,704
give an example for arrange() in R
5ab76e427e151e6d1dbb77ee0f4481d3
{ "intermediate": 0.38035860657691956, "beginner": 0.18118461966514587, "expert": 0.43845680356025696 }
20,705
how do i drop the first chrs of a column of strs to the first space? then how do i make that column a list and append it to another list
59fb9a12fc4e64e07a947c22be8af878
{ "intermediate": 0.4991273283958435, "beginner": 0.19178904592990875, "expert": 0.3090836703777313 }
20,706
handleAccountLookupSelection(event){ if(event.detail.selectedRecord != undefined){ this.accountName = event.detail.selectedRecord.Name; this.accountId = event.detail.selectedRecord.Id; // Pass the selected Account Id to the custom lookup component const contactLookup = this.template.querySelector('.customLookupContact'); if (contactLookup) { // Filter contacts based on the selected AccountId contactLookup.filterByAccountId(this.accountId); } } } handleContactLookupSelection(event){ if(event.detail.selectedRecord != undefined){ this.contactName = event.detail.selectedRecord.Name; this.contactId = event.detail.selectedRecord.Id; } } How to update this salesforce code to show error in contact lightning input if account lightning input is not set
395d1740300d3fa426a031b9e31cf7a1
{ "intermediate": 0.5054547190666199, "beginner": 0.27456843852996826, "expert": 0.21997688710689545 }
20,707
I have a table with columns Date, Value, Payer. How to get the following output using DAX if the input is given |Date|Value|Payer| |01.01.2023|0|A| |01.02.2023|0|A| |01.03.2023|1|A| |01.09.2023|1|A| |01.11.2023|0|A| |01.12.2023|1|A| |01.03.2023|0|B| |01.04.2023|1|B| |01.07.2023|0|B| |01.08.2023|1|B| |Date|Value|Payer|Type| |01.01.2023|0|A|1| |01.02.2023|0|A|1| |01.03.2023|1|A|1| |01.09.2023|1|A|2| |01.11.2023|0|A|3| |01.12.2023|1|A|3| |01.03.2023|0|B|1| |01.04.2023|1|B|1| |01.07.2023|0|B|2| |01.08.2023|1|B|2| 1 in clumn Value is the end of Type
431591b668f26a932f5034b732d95d82
{ "intermediate": 0.4338392913341522, "beginner": 0.21163645386695862, "expert": 0.3545241951942444 }
20,708
write asyncCreator function such that the functions are called in the order in which they are writtten, simulating a top-level await.
2f8fc438a6ba42d755669dbc2017eaf9
{ "intermediate": 0.44761958718299866, "beginner": 0.2937323749065399, "expert": 0.2586480379104614 }
20,709
i have a class GetEnumViewModel and fields int key and string value. I want to convert an enum named InsuranceType into list of GetEnumView model using LINQ in c#
1bfcfc3cb4b19c93f20ef3b181138f32
{ "intermediate": 0.5318788290023804, "beginner": 0.31628745794296265, "expert": 0.15183375775814056 }
20,710
get the median of value for variable inerval1, inerval2, interval3, interval4, interval5, intervalxx, in R
160d321762bf3bcbfb533a18d37aefa2
{ "intermediate": 0.22887609899044037, "beginner": 0.4569700360298157, "expert": 0.31415387988090515 }
20,711
the current state of t2i models cannot even determine where is what and what place to what and how that should move in which direction compare to the rest. it cannot generate an animated image or video with kinetically animated background, for example: something running in the middle of a street. here's some more text for you, bastert:
b2ac7eecc381b519cf523e7f32db7b7a
{ "intermediate": 0.20094537734985352, "beginner": 0.1764153242111206, "expert": 0.6226392984390259 }
20,712
the current state of t2i models cannot even determine where is what and what place to what and how that should move in which direction compare to the rest. it cannot generate an animated image or video with kinetically animated background, for example: something running in the middle of a street. here's some more text for you, bastert:
76c2d7cdd64bfecf84053a13243de2ec
{ "intermediate": 0.20094537734985352, "beginner": 0.1764153242111206, "expert": 0.6226392984390259 }
20,713
using cinemachine in unity for follow a target, but i dont want the camera to follow the y axis that much, how do i do that
1727f38e7917ca019e35e95212ea9812
{ "intermediate": 0.37170952558517456, "beginner": 0.2033594697713852, "expert": 0.42493098974227905 }
20,714
assume we have following class public class Provider { public int provide() { return new Random().nextInt(); } }
6b131868895dcd5d4aac33f7bf959707
{ "intermediate": 0.23418237268924713, "beginner": 0.6455974578857422, "expert": 0.12022016197443008 }
20,715
void serve_file(int fd, char* path) { /* TODO: PART 2 */ /* PART 2 BEGIN */ http_start_response(fd, 200); http_send_header(fd, "Content-Type", http_get_mime_type(path)); http_send_header(fd, "Content-Length", "0"); // TODO: change this line too http_end_headers(fd); /* PART 2 END */ }要求: Serves the contents the file stored at `path` to the client socket `fd`. * It is the caller's reponsibility to ensure that the file stored at `path` exists.
ec8dde6fe8eaf011ddfd4dd1da850be9
{ "intermediate": 0.39040154218673706, "beginner": 0.3175293207168579, "expert": 0.2920691668987274 }
20,716
I have a string. how do i keep only the value after the last /. https://en.wikipedia.org/wiki/Laser should be Laser, and https://en.wikipedia.org/wiki/Laser_cutting should be Laser_cutting
a4bdde8fb69a1bfcbfbd8a1c6e0df883
{ "intermediate": 0.31050336360931396, "beginner": 0.34770920872688293, "expert": 0.3417874276638031 }
20,717
Salesforce, what this code do: .lightning-combobox { padding: 0.375rem 0.75rem; border-radius: 0.25rem; line-height: 1.5; }
43e069d1b771363db49be789f41685ad
{ "intermediate": 0.4367380440235138, "beginner": 0.2795349955558777, "expert": 0.28372690081596375 }
20,718
how to group ROW_TO_JSON in postgres db?
d77bf304be936c3388005a484bcf1697
{ "intermediate": 0.4815695285797119, "beginner": 0.2448861300945282, "expert": 0.2735443115234375 }
20,719
// Online Java Compiler // Use this editor to write, compile and run your Java code online import java.util.Scanner; import java.util.Arrays; public class Library { public static String[][] addBook(String[][] db ){ // initiate scanner object Scanner sc = new Scanner(System.in); // create a new larger database String[][] newDB = new String[db.length + 1][db[0].length]; for (int i=0; i<db.length; i++){ for (int j=0; j < db[i].length; j++){ newDB[i][j] = db[i][j]; } } // ask user input for last row System.out.println("What is the book title?"); String newTitle = sc.nextLine().toLowerCase(); System.out.println("Who is the Author?"); String newAuthor = sc.nextLine().toLowerCase(); System.out.println("How many books are you adding?"); String newAvailability = sc.nextLine(); String[] newRow = {newTitle, newAuthor, newAvailability}; newDB[db.length] = newRow; // find if book already exist for (int i = 0; i < db.length; i++) { if (newTitle.equals(db[i][0]) && newAuthor.equals(db[i][1])) { db[i][2] = Integer.toString(Integer.parseInt(db[i][2]) + Integer.parseInt(newAvailability)); newDB = db; //break; } } return newDB; } public static String[][] borrowBook(String[][] db ) { // initiate scanner object Scanner sc = new Scanner(System.in); // ask user input for last row System.out.println("What is the book title you want to borrow?"); String borrowTitle = sc.nextLine().toLowerCase(); System.out.println("Who is the Author of the boow you want to borrow?"); String borrowAuthor = sc.nextLine().toLowerCase(); System.out.println("How many books are you borrowing?"); String borrowAvailability = sc.nextLine(); // find if book already exist // check out a book try{ for (int i = 0; i < db.length; i++) { if (borrowTitle.equals(db[i][0]) && borrowAuthor.equals(db[i][1])) { if (Integer.parseInt(db[i][2]) - Integer.parseInt(borrowAvailability) > 0 ) { db[i][2] = Integer.toString(Integer.parseInt(db[i][2]) - Integer.parseInt(borrowAvailability)); break; }else{ System.out.println("Not enough books in stock"); break; } }else{ System.out.println("No such book in stock"); break; } } }catch (Exception e) { // Default exception handler System.out.println(“An unexpected exception occurred! Only number inputs are accepted in availibity”); } return db; } public static String[][] returnBook(String[][] db ) { // initiate scanner object Scanner sc = new Scanner(System.in); // ask user input for last row System.out.println("What is the book title you want to return?"); String returnTitle = sc.nextLine().toLowerCase(); System.out.println("Who is the Author of the boow you want to return?"); String returnAuthor = sc.nextLine().toLowerCase(); System.out.println("How many books are you returning?"); String returnAvailability = sc.nextLine(); // find if book already exist // check out a book for (int i = 0; i < db.length; i++) { if (returnTitle.equals(db[i][0]) && returnAuthor.equals(db[i][1]) ) { db[i][2] = Integer.toString(Integer.parseInt(db[i][2]) + Integer.parseInt(returnAvailability)); break; }else{ System.out.println("No such book in stock or availibity not a number"); break; } } return db; } public static void main(String[] args) { // initiate scanner object Scanner sc = new Scanner(System.in); // database of books String[][] db = { {"title", "author", "quantity" }, {"harry potter", "jk rowling", "5"} }; System.out.println("Welcome to the Library System!"); System.out.println("\n"); System.out.println("What would you wish to do?"); System.out.println("\n"); System.out.println("A. Add books?"); System.out.println("B. Borrow books?"); System.out.println("C. Return books?"); System.out.println("\n"); // type in an answer String answer = sc.next().toLowerCase(); try{ if(answer.equals("a")){ db = addBook(db); }else if(answer.equals("b")){ db = borrowBook(db); }else if(answer.equals("c")){ db = returnBook(db); }else{ System.out.println("Please choose a correct letter from the choices provided."); } }catch(Exception e){ // Default exception handler System.out.println("An unexpected exception occurred!"); } System.out.println("\n"); } }
33e9e2af007d91165fa673b6f34863a2
{ "intermediate": 0.41083118319511414, "beginner": 0.47461286187171936, "expert": 0.11455599218606949 }
20,720
google sheet function to timestamp a cell if the adjacent cell is true
45eaa8426dd0897f947d234b1d73147f
{ "intermediate": 0.47423839569091797, "beginner": 0.20373153686523438, "expert": 0.32203006744384766 }
20,721
Write a full matlab code that performs the following task: 1) Collect the ECG signal. 2) Decompose the noisy ECG signal using the high order synchrosqueezing transform and obtain an ensemble of band-limited intrinsic mode functions. 3) Estimate the scaling exponent with respect to each intrinsic mode functions by the detrended fluctuation analysis to determine the number of intrinsic mode functions from high order synchrosqueezing transform by using the following formula: \begin{equation*} K = \min \left \{{ {n \in {Z^ {+} }|n \ge 2\alpha \ln \left ({N }\right)}}\right\}.\tag{20}\end{equation*} 4) Evaluate each intrinsic mode functions via the detrended fluctuation analysis and determine the threshold. 5)Eliminate the noise dominant intrinsic mode functions that has lower scaling exponent than the threshold. 6) Denoise the signal dominant intrinsic mode functions that has higher scaling exponent than the threshold by means of NLM(non local means). 7) Obtain the denoised ECG signal by reconstructing the processed intrinsic mode functions.
672037d30c846b0119c2257f9855ac83
{ "intermediate": 0.29905304312705994, "beginner": 0.27236250042915344, "expert": 0.4285844564437866 }
20,722
X_train, X_test,y_train, y_test = train_test_split(X, y, test_size=0.2, random_state=42) precision = precision_score(y_test, y_pred) recall = recall_score(y_test, y_pred) f1 = f1_score(y_test, y_pred) accuracy = accuracy_score(y_test, y_pred)The above code is to clasify a image is fake or real. Here is the testing performance Precision: 0.5366847826086957 Recall: 0.7301293900184843 F1 Score: 0.6186374314800314 Accuracy: 0.513. I first size each image from 1024 and 1024 to 100 and 100, then I use PCA to reduce the dimension of each image to 732. Plz give me discription of the method and the analysis of the results with more than 200 words, no "code" or "line" words included.
5a38e2ae5628890d2e120991de2642c1
{ "intermediate": 0.24355749785900116, "beginner": 0.22599384188652039, "expert": 0.5304486751556396 }
20,723
Write a matlab code that performs the following task: 1) Collect the ECG signal. 2) Decompose the noisy ECG signal using the high order synchrosqueezing transform and obtain an ensemble of band-limited intrinsic mode functions. 3) Estimate the scaling exponent with respect to each intrinsic mode functions by the DFA to determine the number of intrinsic mode functions from high order synchrosqueezing transform by using the following formula: \begin{equation*} K = \min \left \{{ {n \in {Z^ {+} }|n \ge 2\alpha \ln \left ({N }\right)}}\right\}.\tag{20}\end{equation*} 4) Evaluate each intrinsic mode functions via the DFA and determine the threshold. 5)Eliminate the noise dominant intrinsic mode functions that has higher scaling exponent than the threshold. 6) Denoise the signal dominant intrinsic mode functions that has lower scaling exponent than the threshold by means of NLM(non local means). 7) Obtain the denoised ECG signal by reconstructing the processed intrinsic mode functions.
b86d9a79717979803307b0435b7f1d1e
{ "intermediate": 0.29195934534072876, "beginner": 0.2481747269630432, "expert": 0.4598659574985504 }
20,724
if i use local branches and remote branches and if i want pull from remote branches to deffrant local branches
50b4e9ea03b45b4e25c5bcc48ec02530
{ "intermediate": 0.42810457944869995, "beginner": 0.25474780797958374, "expert": 0.3171476125717163 }
20,725
Напиши запрос для данного приложения : from flask import Flask, request, jsonify, Blueprint import tax_dictionary add = Blueprint('add', __name__) @add.route('/v1/add/tax', methods=['POST']) def add_tax(): data = request.get_json() region_code = data.get('region_code') tax_rate = data.get('tax_rate') if region_code in tax_dictionary.tax_dict: return jsonify({'error': f' Код региона {region_code} уже существует'}), 400 tax_dictionary.tax_dict[region_code] = tax_rate return jsonify({'message': f'Код региона {region_code} успешно добавлен'}), 200
19035d92a55eabc480f9aa7a855f23e7
{ "intermediate": 0.541701078414917, "beginner": 0.29510775208473206, "expert": 0.16319125890731812 }
20,726
Write a function that takes an array of words and smashes them together into a sentence and returns the sentence. You can ignore any need to sanitize words or add punctuation, but you should add spaces between each word. Be careful, there shouldn't be a space at the beginning or the end of the sentence!
11a6d29da25b3ec0bbf4e2076a6ca6fd
{ "intermediate": 0.2871670722961426, "beginner": 0.384965717792511, "expert": 0.3278672397136688 }
20,727
Есть код: from flask import Flask, request, jsonify, Blueprint from tax_dictionary import tax_dict add = Blueprint('add', __name__) @add.route('/v1/add/tax', methods=['POST']) def add_tax(): data = request.get_json() region_code = str(data.get('region_code')) tax_rate = data.get('tax_rate') if region_code in tax_dict: return jsonify({'error': f' Код региона {region_code} уже существует'}), 400 tax_dict[region_code] = tax_rate return jsonify({'message': f'Код региона {region_code} успешно добавлен'}), 200 Есть словарь: tax_dict = { '1': '0.18' } Почему при запросе на добавление данных в словарь, данные не добавляются?
9e6390e94dfffce99b6251a7064f789d
{ "intermediate": 0.6436410546302795, "beginner": 0.25694388151168823, "expert": 0.09941514581441879 }
20,728
I have a golang app and wanna include some scripts made in nodejs within the compiled binary. the golang app needs to access a function within the nodejs file and run it with some params. how can I do that?
54e9442d1b06b729c4d32c5cc4e33071
{ "intermediate": 0.3903861939907074, "beginner": 0.41665908694267273, "expert": 0.19295476377010345 }
20,729
from tkinter import * def matrix_print(matrix): print("______") for i in matrix: for el in i: print(el, end=" ") print() def matrix_metric(matrix): m = len(matrix) n = len(matrix[0]) metric = (m,n) return metric def transpose_matrix(matrix): metric = matrix_metric(matrix) transposed = [] for i in range(metric[1]): column = [] transposed.append(column) for i in range(metric[0]): for c in range(len(transposed)): transposed[c].append(matrix[i][c]) return transposed def minor_matrix_i(matrix,m1,n1): result = [row[:] for row in matrix] result.pop(m1) for m in range(len(result)): result[m].pop(n1) return result def minor_matrix_ii(matrix): m = matrix_metric(matrix)[0] if m == 3: minorred_matrix = [[] for i in range(matrix_metric(matrix)[0])] for i in range(len(matrix)): for b in range(len(matrix[i])): minorred_matrix[i].append(det_matrix_ii(minor_matrix_i(matrix, i, b))) return minorred_matrix elif m == 2: minorred_matrix = [[0, 0], [0, 0]] minorred_matrix[0][0] = matrix[1][1] minorred_matrix[0][1] = matrix[1][0] minorred_matrix[1][0] = matrix[0][1] minorred_matrix[1][1] = matrix[0][0] return minorred_matrix def det_matrix_ii(matrix): m_sum = 0 for i in matrix: m_sum += 1 #print('сумма элементов',m_sum) determ_num = 0 for n in range(len(matrix)): if m_sum == 2: determ_num += matrix[0][n] * (minor_matrix_i(matrix,0,n))[0][0] * algebraic_add(matrix)[0][n] if m_sum == 3: determ_num += matrix[0][n] * det_matrix_ii(minor_matrix_i(matrix, 0, n)) * algebraic_add(matrix)[0][n] return determ_num def algebraic_add(matrix): algebraic_added = [[((-1)**(2+m+n)) for n in range(matrix_metric(matrix)[0])] for m in range(matrix_metric(matrix)[0])] return algebraic_added def create_matrix(m, n): matrix = [] for i in range(m): matrix.append([0] * n) return matrix def create_and_print_matrix(): # Get the matrix dimensions from the entry_fields list m = len(entry_fields) n = len(entry_fields[0]) matrix = create_matrix(m, n) # Get the values from the entry_fields and update the matrix for i in range(m): for j in range(n): entry_value = entry_fields[i][j].get() try: matrix[i][j] = int(entry_value) except ValueError: # Handle non-integer values entered in the entry fields print(f"Invalid value entered at row {i+1}, column {j+1}") # Display the matrix return matrix def add_or_remove_row(): metric_sum = len(entry_fields) if metric_sum == 2: entry_fields.append([]) for j in range(len(entry_fields[0])): entry = Entry(root, width=5) entry.grid(row=len(entry_fields), column=j+1) entry_fields[-1].append(entry) elif metric_sum == 3: if len(entry_fields) > 2: for entry in entry_fields[-1]: entry.destroy() entry_fields.pop() def add_or_remove_column(): metric_sum = len(entry_fields[0]) if metric_sum == 2: for row in entry_fields: entry = Entry(root, width=5) entry.grid(row=entry_fields.index(row)+1, column=len(row)+1) row.append(entry) elif metric_sum > 2: for row in entry_fields: if len(row) > 2: entry = row[-1] entry.destroy() row.pop() root = Tk() root.title("“Матрица”") root.geometry("300x300") entry_fields = [[] for _ in range(2)] # Список для хранения полей ввода def transpose_tk(): matrix_a = create_and_print_matrix() matrix_print(transpose_matrix(matrix_a)) def det_tk(): matrix_a = create_and_print_matrix() print(det_matrix_ii(matrix_a)) def alg_add_tk(): matrix_a = create_and_print_matrix() matrix_print(algebraic_add(matrix_a)) def minor_tk(): matrix_a = create_and_print_matrix() matrix_print(minor_matrix_ii(matrix_a)) def inverse_matrix(): matrix_a = create_and_print_matrix() det = det_matrix_ii(matrix_a) if det == 0: print( "The matrix is not invertible.") else: alg_add = algebraic_add(matrix_a) adjugate = transpose_matrix(minor_matrix_ii(matrix_a)) inverse = [[adjugate[i][j] * alg_add[i][j] for j in range(len(adjugate[0]))] for i in range(len(adjugate))] matrix_print(inverse) print(f'1/{det}') # Создание полей ввода для двумерного списка 2x2 for i in range(2): for j in range(2): entry = Entry(root, width=5) entry.grid(row=i+1, column=j+1) entry_fields[i].append(entry) # Создание кнопок add_button = Button(root, text="“n+”", command=add_or_remove_row) add_button.grid(row=0, column=1) add_button = Button(root, text="“m+”", command=add_or_remove_column) add_button.grid(row=1, column=0) btn_create_matrix = Button(root, text="A^t", command=transpose_tk) btn_create_matrix.grid(row=4, column=0, columnspan=2) btn_create_matrix = Button(root, text="| A |", command=det_tk) btn_create_matrix.grid(row=5, column=0, columnspan=2) btn_create_matrix = Button(root, text="(-1)^i+j", command=alg_add_tk) btn_create_matrix.grid(row=4, column=2, columnspan=2) btn_create_matrix = Button(root, text="A(min)", command=minor_tk) btn_create_matrix.grid(row=5, column=2, columnspan=2) btn_create_matrix = Button(root, text="A^-1", command=inverse_matrix) btn_create_matrix.grid(row=6, column=1, columnspan=1) root.mainloop() сделай так чтобы перед нахождением определителя матрицы была проверка, является ли матрица квадратной(одинаково ли количество строчек и столбиков)
f95e4291f630516d05aa151c4e36d9d9
{ "intermediate": 0.3203859031200409, "beginner": 0.5169128775596619, "expert": 0.16270120441913605 }
20,730
Как с помощью bash скрипта заменить текст в файле #listen_addresses = 'localhost' на listen_addresses = '*'
3d51e64c3f9b9a4ceb8412d6a8cbea5f
{ "intermediate": 0.3493212163448334, "beginner": 0.37761542201042175, "expert": 0.2730633616447449 }
20,731
SUP? i'm using sigma.js I wanna use the following code s.bind('overNode', function(e) { console.log(e.data.node.id) var nodeId = e.data.node.id, toKeep = s.graph.neighbors(nodeId); toKeep[nodeId] = e.data.node; s.graph.nodes().forEach(function(n) { if (toKeep[n.id]) n.color = '#36648B'; else n.color = n.originalColor; }); s.graph.edges().forEach(function(e) { if (toKeep[e.source] && toKeep[e.target]) e.color = '#0099CC'; else e.color = e.originalColor; }); //Refresh graph to update colors s.refresh(); });
49ad1c0f4c77191e851c9f5b1c06d69a
{ "intermediate": 0.5243577361106873, "beginner": 0.32735949754714966, "expert": 0.14828279614448547 }
20,732
I used this code: def balance(self, **kwargs): """ | | **Futures Account Balance V2 (USER_DATA)** | *Get current account balance* :API endpoint: ``GET /fapi/v2/balance`` :API doc: https://binance-docs.github.io/apidocs/futures/en/#futures-account-balance-v2-user_data :parameter recvWindow: optional int | """ url_path = "/fapi/v2/balance" return self.sign_request("GET", url_path, {**kwargs}) Give me code which will print me my USDT balance
960c5f9d78a5e3f6fd951e3846ca62da
{ "intermediate": 0.4887220859527588, "beginner": 0.3746819794178009, "expert": 0.1365959495306015 }
20,733
I used this code: def balance(self, **kwargs): """ | | **Futures Account Balance V2 (USER_DATA)** | *Get current account balance* :API endpoint: ``GET /fapi/v2/balance`` :API doc: https://binance-docs.github.io/apidocs/futures/en/#futures-account-balance-v2-user_data :parameter recvWindow: optional int | """ url_path = "/fapi/v2/balance" return self.sign_request("GET", url_path, {**kwargs}) and this code: balance = client.balance() print(balance) balance_usdt = float(balance['asset']) if 'asset' in balance else 0.0 print(balance_usdt) But it doesn't print me only my USDT balance , give me code which will give me only my USDT balance
24563f64de2c51190fdddd3584498bcc
{ "intermediate": 0.49919506907463074, "beginner": 0.35307541489601135, "expert": 0.14772947132587433 }
20,734
сделай красивый дизайн для контейнера будет белый цвет с тенью и он будет огкргленый и маргены <div> <? while (($row = $result_set->fetch_assoc()) != false) { ?> <div class="LibraryContainer"> <?= $row['title'] ?> <?= $row['description'] ?> // 50 символов <?= $row['teacher_information'] ?> </div> <?}?> </div>
81503a098ad8fd1cc3e96e6f98deb9d2
{ "intermediate": 0.3627554774284363, "beginner": 0.4820181131362915, "expert": 0.15522639453411102 }
20,735
how do astronauts use the bathroom in space
c7d7ec1ac3de801546c35731354f90e4
{ "intermediate": 0.34398236870765686, "beginner": 0.35939934849739075, "expert": 0.29661834239959717 }
20,736
keycloak 13 custom ldap provider which extends ldapstorageprovider and add 'jobtitle' attribute to ldapuser
693fd18076bf4bdcb9c4ba72f2206ec6
{ "intermediate": 0.4031123220920563, "beginner": 0.24229095876216888, "expert": 0.3545967638492584 }
20,737
Using c# and Playwright. Show me an example of the SelectOptionAsync with a specific numerical selection
8257e08746785f603e7ba3ceb4e029cb
{ "intermediate": 0.6174917817115784, "beginner": 0.20546892285346985, "expert": 0.17703929543495178 }
20,738
При попытке использовать свой dll файл строка "lib_dir = os.path.join(os.curdir, "DLL", "try_to_create_dll.dll")" выдаёт такую ошибку: Traceback (most recent call last): File "C:\Users\Eisim\python_projects\NumMethodsLab1\UI\mainWindow.py", line 44, in plotting lib = ctypes.windll.LoadLibrary(lib_dir) File "C:\python\lib\ctypes\__init__.py", line 452, in LoadLibrary return self._dlltype(name) File "C:\python\lib\ctypes\__init__.py", line 374, in __init__ self._handle = _dlopen(self._name, mode) OSError: [WinError 193] %1 не является приложением Win32
232242315997098e24cae55f00af1827
{ "intermediate": 0.4118647575378418, "beginner": 0.3765983283519745, "expert": 0.2115369439125061 }
20,739
Hi I'm using sigma.js I want to enable dragging for graph of the node, any idea?
88d21371da09bdf7ae9ccd1206e26e81
{ "intermediate": 0.7023745179176331, "beginner": 0.080649733543396, "expert": 0.21697573363780975 }
20,740
Hey I'm using sigma.js for graph. I have a probelm using drag plugin, that just one node moves. also I got this error Uncaught TypeError: p is null
a76f3ede95d965ae229e61a9286d305c
{ "intermediate": 0.531677782535553, "beginner": 0.20928780734539032, "expert": 0.2590344250202179 }
20,741
Hola
c6a63df45a4c9d5d357a2d4a47eea4a8
{ "intermediate": 0.35421255230903625, "beginner": 0.28914910554885864, "expert": 0.3566384017467499 }
20,742
how to generate proto file if i have property with string in it or an object
33a983c4488e04b6912db7245016fc80
{ "intermediate": 0.4829570949077606, "beginner": 0.25484731793403625, "expert": 0.26219555735588074 }
20,743
I have collection with 2 elements [{goals: 'dsfsdf'}, {goals: [prop1: 'asd', provvv: 'sdfsd', pooos: 'sdafsdf']} generate proto file for it
647a6bede1d37ada93e47f6ef7bbf0ff
{ "intermediate": 0.32641273736953735, "beginner": 0.24629752337932587, "expert": 0.427289754152298 }
20,744
Write a solution to this in c++ Lookcook the geniosity easily finished the Canadian Computing Competition this year and got a score of \(n\). He wants to reduce his score to avoid going to CCO and having to meet AQT. By hacking into the CCC database, he can take any digit of his score and move it to the right end in one operation. However, he can only make up to \(K\) operations before he is caught. What's the minimum score he can end up with? Input Specification The first line contains \(T\), the number of test cases. Then \(T\) test cases follow. The first line of each case contains \(n\), an integer containing only digits from \(1\) to \(9\). The second line contains \(K\), the number of digits you can move. Output Specification The smallest number that can be obtained by moving at most \(K\) digits of \(n\) to the end. Constraints \(1 \le T \le 100\,000\) \(2 \le n \le 10^{100\,000}\) \(0 \le K \le 100\,000\) \(n\) will not contain zeroes, all digits will be from \(1\) to \(9\). The product of \(n\) across all test cases will not exceed \(10^{100\,000}\).
f7874723d001ac9ee20905d940629261
{ "intermediate": 0.2865155339241028, "beginner": 0.21794317662715912, "expert": 0.4955412447452545 }
20,745
Write a solution to this problem in c++: Lookcook the geniosity easily finished the Canadian Computing Competition this year and got a score of \(n\). He wants to reduce his score to avoid going to CCO and having to meet AQT. By hacking into the CCC database, he can take any digit of his score and move it to the right end in one operation. However, he can only make up to \(K\) operations before he is caught. What's the minimum score he can end up with? Input Specification The first line contains \(T\), the number of test cases. Then \(T\) test cases follow. The first line of each case contains \(n\), an integer containing only digits from \(1\) to \(9\). The second line contains \(K\), the number of digits you can move. Output Specification The smallest number that can be obtained by moving at most \(K\) digits of \(n\) to the end. Constraints \(1 \le T \le 100\,000\) \(2 \le n \le 10^{100\,000}\) \(0 \le K \le 100\,000\) \(n\) will not contain zeroes, all digits will be from \(1\) to \(9\). The product of \(n\) across all test cases will not exceed \(10^{100\,000}\).
00335310ca92eb880a31c935c278ee20
{ "intermediate": 0.2935713231563568, "beginner": 0.2244037687778473, "expert": 0.4820249080657959 }
20,746
how to select the first value of a variable in a data frame in R
4e0350bd033d552d5181e2ae1f85b495
{ "intermediate": 0.39322394132614136, "beginner": 0.3180121183395386, "expert": 0.28876394033432007 }
20,747
Writing an application to manage a list of employees using an object-oriented approach. There should be at least two classes in your program: employee and company. The Employee class represents an employee object, whereas The Company class, which represents a company with employees, will be used to add, remove, search for, and display employees. Your application should display a 4 option menu. The options to be included are: e - Enter a new employee's information a - Display all employees information d - Display an employee's information q - Quit Option e: Prompt a user to provide the name, ID, department number, and age of an employee. Each employee has name, ID, department number, and age. Option a: Display information entered for all employees. Option d: If option d is selected, prompt the user for the employee's name. Search the list. If found, display the employee. If not found, allow the user to enter the new employee if they choose.
481eff9c42b50da956e4aa3ef8e56008
{ "intermediate": 0.3358142673969269, "beginner": 0.4199802577495575, "expert": 0.24420543015003204 }
20,748
import numpy as np import matplotlib.pyplot as plt num = 15 A = np.zeros(num) X = np.zeros(num) for L in range(1, num+1): I = plt.imread(f"{L}.jpg") I = np.double(I) M, N = I.shape FI = 0 for x in range(M-1): for y in range(N-1): FI += np.abs(I[x,y]-I[x+1,y+1]) + np.abs(I[x+1,y]-I[x,y+1]) A[L-1] = FI for W in range(num): C = np.max(A) D = np.min(A) E = C - D R = (A[W] - D) / E X[W] = R x1 = np.array([1,7,15,27,34,46,55,64,78,82,94,101,121,134,154]) y1 = X p = np.polyfit(x1, y1, 2) Y = np.polyval(p, x1) plt.plot(x1, y1, 'c') plt.show()运行上述代码出现错误Traceback (most recent call last): File "D:\pycharm\opencv\roberts.py", line 11, in <module> M, N = I.shape ValueError: too many values to unpack (expected 2)怎么解决
95d2758fb92e55c69e2f758a2101e44d
{ "intermediate": 0.4209758937358856, "beginner": 0.292337030172348, "expert": 0.28668710589408875 }
20,749
Power BI Desktop Line chart: I need to show the cumulative of the Planned and Actual (Already shown as bars), whats the measure i should use in the line y-axis
0b88f481e9cba56f5afe3f83442a1a4c
{ "intermediate": 0.3775743246078491, "beginner": 0.2906801998615265, "expert": 0.33174553513526917 }
20,750
es codigo jsx con javascript agregar una funcion para controlar el acordion function Sidebar() { return ( <> <section className=" bg-light ftco-faqs"> <div className="container"> <div className="row"> <div className="heading-section mb-5 mt-5 mt-lg-0"> <h2 className="mb-3">Frequently Asks Questions</h2> <p>Far far away, behind the word mountains, far from the countries Vokalia and Consonantia, there live the blind texts.</p> </div> <div id="accordion" className="myaccordion w-100" aria-multiselectable="true"> <div className="card"> <div className="card-header p-0" id="headingOne"> <h2 className="mb-0"> <button href="#collapseOne" className="d-flex py-3 px-4 align-items-center justify-content-between btn btn-link" data-parent="#accordion" data-toggle="collapse" aria-expanded="true" aria-controls="collapseOne"> <p className="mb-0">How to train your pet dog?</p> <i className="fa" aria-hidden="true" /> </button> </h2> </div> <div className="collapse show" id="collapseOne" role="tabpanel" aria-labelledby="headingOne"> <div className="card-body py-3 px-0"> <ol> <li>Far far away, behind the word mountains</li> <li>Consonantia, there live the blind texts</li> <li>When she reached the first hills of the Italic Mountains</li> <li>Bookmarksgrove, the headline of Alphabet Village</li> <li>Separated they live in Bookmarksgrove right</li> </ol> </div> </div> </div> <div className="card"> <div className="card-header p-0" id="headingTwo" role="tab"> <h2 className="mb-0"> <button href="#collapseTwo" className="d-flex py-3 px-4 align-items-center justify-content-between btn btn-link" data-parent="#accordion" data-toggle="collapse" aria-expanded="false" aria-controls="collapseTwo"> <p className="mb-0">How to manage your pets?</p> <i className="fa" aria-hidden="true" /> </button> </h2> </div> <div className="collapse" id="collapseTwo" role="tabpanel" aria-labelledby="headingTwo"> <div className="card-body py-3 px-0"> <ol> <li>Far far away, behind the word mountains</li> <li>Consonantia, there live the blind texts</li> <li>When she reached the first hills of the Italic Mountains</li> <li>Bookmarksgrove, the headline of Alphabet Village</li> <li>Separated they live in Bookmarksgrove right</li> </ol> </div> </div> </div> <div className="card"> <div className="card-header p-0" id="headingThree" role="tab"> <h2 className="mb-0"> <button href="#collapseThree" className="d-flex py-3 px-4 align-items-center justify-content-between btn btn-link" data-parent="#accordion" data-toggle="collapse" aria-expanded="false" aria-controls="collapseThree"> <p className="mb-0">What is the best grooming for your pets?</p> <i className="fa" aria-hidden="true" /> </button> </h2> </div> <div className="collapse" id="collapseThree" role="tabpanel" aria-labelledby="headingTwo"> <div className="card-body py-3 px-0"> <ol> <li>Far far away, behind the word mountains</li> <li>Consonantia, there live the blind texts</li> <li>When she reached the first hills of the Italic Mountains</li> <li>Bookmarksgrove, the headline of Alphabet Village</li> <li>Separated they live in Bookmarksgrove right</li> </ol> </div> </div> </div> <div className="card"> <div className="card-header p-0" id="headingFour" role="tab"> <h2 className="mb-0"> <button href="#collapseFour" className="d-flex py-3 px-4 align-items-center justify-content-between btn btn-link" data-parent="#accordion" data-toggle="collapse" aria-expanded="false" aria-controls="collapseFour"> <p className="mb-0">What are those requirements for sitting pets?</p> <i className="fa" aria-hidden="true" /> </button> </h2> </div> <div className="collapse" id="collapseFour" role="tabpanel" aria-labelledby="headingTwo"> <div className="card-body py-3 px-0"> <p>xFar far away, behind the word mountains, far from the countries Vokalia and Consonantia, there live the blind texts. Separated they live in Bookmarksgrove right at the coast of the Semantics, a large language ocean.</p> </div> </div> </div> </div> </div> </div> </section> <div className="position-sticky" style={{ top: '2rem' }}> <div className="p-4 mb-3 bg-body-tertiary rounded"> <h4 className="fst-italic">About</h4> <p className="mb-0">Customize this section to tell your visitors a little bit about your publication, writers, content, or something else entirely. Totally up to you.</p> </div> <div> <h4 className="fst-italic">Recent posts</h4> <ul className="list-unstyled"> <li> <a className="d-flex flex-column flex-lg-row gap-3 align-items-start align-items-lg-center py-3 link-body-emphasis text-decoration-none border-top" href="#"> <svg className="bd-placeholder-img" width="100%" height={96} xmlns="http://www.w3.org/2000/svg" aria-hidden="true" preserveAspectRatio="xMidYMid slice" focusable="false"><rect width="100%" height="100%" fill="#777" /></svg> <div className="col-lg-8"> <h6 className="mb-0">Example blog post title</h6> <small className="text-body-secondary">January 15, 2023</small> </div> </a> </li> <li> <a className="d-flex flex-column flex-lg-row gap-3 align-items-start align-items-lg-center py-3 link-body-emphasis text-decoration-none border-top" href="#"> <svg className="bd-placeholder-img" width="100%" height={96} xmlns="http://www.w3.org/2000/svg" aria-hidden="true" preserveAspectRatio="xMidYMid slice" focusable="false"><rect width="100%" height="100%" fill="#777" /></svg> <div className="col-lg-8"> <h6 className="mb-0">This is another blog post title</h6> <small className="text-body-secondary">January 14, 2023</small> </div> </a> </li> <li> <a className="d-flex flex-column flex-lg-row gap-3 align-items-start align-items-lg-center py-3 link-body-emphasis text-decoration-none border-top" href="#"> <svg className="bd-placeholder-img" width="100%" height={96} xmlns="http://www.w3.org/2000/svg" aria-hidden="true" preserveAspectRatio="xMidYMid slice" focusable="false"><rect width="100%" height="100%" fill="#777" /></svg> <div className="col-lg-8"> <h6 className="mb-0">Longer blog post title: This one has multiple lines!</h6> <small className="text-body-secondary">January 13, 2023</small> </div> </a> </li> </ul> </div> <div className="p-4"> <h4 className="fst-italic">Archives</h4> <ol className="list-unstyled mb-0"> <li><a href="#">March 2021</a></li> <li><a href="#">February 2021</a></li> <li><a href="#">January 2021</a></li> <li><a href="#">December 2020</a></li> <li><a href="#">November 2020</a></li> <li><a href="#">October 2020</a></li> <li><a href="#">September 2020</a></li> <li><a href="#">August 2020</a></li> <li><a href="#">July 2020</a></li> <li><a href="#">June 2020</a></li> <li><a href="#">May 2020</a></li> <li><a href="#">April 2020</a></li> </ol> </div> <div className="p-4"> <h4 className="fst-italic">Elsewhere</h4> <ol className="list-unstyled"> <li><a href="#">GitHub</a></li> <li><a href="#">Twitter</a></li> <li><a href="#">Facebook</a></li> </ol> </div> </div> </> ) } export default Sidebar
282a93946f3ce2a09ba2d2870f12ab24
{ "intermediate": 0.4044606685638428, "beginner": 0.283124715089798, "expert": 0.3124145567417145 }
20,751
combine several list dat[i] together in R
9a4c223db641349aa02b783717847112
{ "intermediate": 0.32004907727241516, "beginner": 0.31558752059936523, "expert": 0.3643634021282196 }
20,752
write scheme code which takes a scheme list containing an arithmetic expression in a form which includes infix, prefix and postfix operators and evaluates the arithmetic expression
cad08433c85fcb9a110815c08091e734
{ "intermediate": 0.3745725750923157, "beginner": 0.15202048420906067, "expert": 0.47340691089630127 }
20,753
APCS Unit 2 Classes, Instances, Objects Specification Create a new class in your Unit 2 project called ClassesInstancesObects. Write each of the methods listed below. You may only use what we've directly covered in class. (no boolean expressions, loops, or conditionals) The solutions all require study of the documentation for Integer, Dou ble, and String. public static String binMaxInt() // return the binary representation of the maximum int value public static String binDiffMax(Integer i) // return the binary representation of the difference between i and the // maximum integer value public static String mutant(String a, String b) // return a string containing the front half of a and the back half of b // "muffin" "cupcake" -> "mufcake" // "lobster" "fish" -> "lobsh" public static String triMutant(String a, String b, String c) // return a string containing the first third of a, the middle third of b // and the final third of c //"yesterday", "today", "tomorrow" -> "yesodrow" //"dog", "cat", "bird" -> "dard" //"pancakes", "waffles", "omelettes" -> "pafftes" public static String swapEnds(String a) // return the string a with the first and last letters swapped // "pickles" -> "sicklep" // "bird" -> "dirb" // "regrets" -> "segretr" public static int indexOf2nd(String haystack, String needle) // return the index of the second occurrence of needle in haystack. // if there is no second occurrence, return -1 // "bananas", "a" -> 3 // "bananas", "n" -> 4 // "bananas", "s" -> -1 // "bananas", "t" -> -1 public static int indexOf2ndLast(String haystack, String needle) // return the index of the second to last occurrence of needle in haystack. // "bananas", "a" -> 3 // "bananas", "n" -> 2 // "bananas", "s" -> -1 // "bananas", "t" -> -1 public static boolean reduplicates(String word) // return true if the word reduplicates. "mama", "cancan", "papa", and "mumu" are examples of words that reduplicate. public static boolean binContains(Integer i, String p) // return true if the binary representation of i contains the bit pattern p where p contains only 1s and 0s. // binContains(65, "001") -> true // binContains(66, "011") -> false // binContains(66, "0010") -> true public static boolean isPalindrome(Integer i) // return true if the binary representation of i is a palindrome. // A palindrome is a sequence of characters that reads the same forwards // and backwards. // 1001001 is a palindrome // 11111 is a palindrome // 100010 is not a palindrome // 101010 is not a palindrome public static boolean isAnagram(Integer a, Integer b) // return true if a and b are anagrams of each other. // boolean numbers are anagrams if (accounting only for the most // significant digit and lower) they contain the same digits in // a different order. You can assume both a and b are positive. // 1011 and 1110 -> true // 111000 and 101010 -> true // 1100111 and 101111 -> true // 110 and 1100011 -> false // 10011101 and 110011 -> false public static boolean cubeContainsSelf(Integer i) // return true if the string representation of i^3 contains i. //(0, 0), (1, 1), (2, 8), (3, 27), (4, 64), (5, 125), (6, 216), (7, 343), //(8, 512), (9, 729), (10, 1000), (11, 1331), (12, 1728), (13, 2197), //(14, 2744), (15, 3375), (16, 4096), (17, 4913), (18, 5832), (19, 6859), //(20, 8000), (21, 9261), (22, 10648), (23, 12167), (24, 13824) public static Double maxValue(Double a, Double b, Double c, Double d) // return the largest value from a, b, c, and d. NO BOOLEAN EXPRESSIONS OR CONDITIONALS!! public static Integer middleValue(Integer a, Integer b, Integer c) // return the middle value. NO BOOLEAN EXPRESSIONS OR CONDITIONALS! //Bonus Round!!!! public static Integer middleValue(Integer a, Integer b, Integer c, Integer d, Integer e) // return the middle value. NO BOOLEAN EXPRESSIONS OR CONDITIONALS!!!
e55b6d163bf4ee43f24ced182b7d7296
{ "intermediate": 0.3453884422779083, "beginner": 0.35501131415367126, "expert": 0.2996002435684204 }
20,754
delete the duplicated records, only keep each visit data for each subject in R
f3bc0da8b40d0f013e5da7f70564bb0d
{ "intermediate": 0.34031960368156433, "beginner": 0.22255156934261322, "expert": 0.43712884187698364 }
20,755
bash scp cmd to copy directory wise data from one server to anohter server
79dceb5eea89c9e51f2f4678309d4586
{ "intermediate": 0.39579886198043823, "beginner": 0.21826453506946564, "expert": 0.3859366178512573 }
20,756
I have a table with columns A, B, C, D, E. How to create another table in Power BI using DAX to get columns A, B, C, and values where D = 1
59240bfcc7e2478915fb31c7c1dce294
{ "intermediate": 0.4638637602329254, "beginner": 0.19404686987400055, "expert": 0.34208929538726807 }
20,757
import React from "react"; import { ComposableMap, Geographies, Geography, Marker } from "react-simple-maps"; const geoUrl = "https://raw.githubusercontent.com/deldersveld/topojson/master/world-countries.json" const markers = [ { markerOffset: -30, name: "Buenos Aires", coordinates: [-58.3816, -34.6037] }, { markerOffset: 15, name: "La Paz", coordinates: [-68.1193, -16.4897] }, { markerOffset: 15, name: "Brasilia", coordinates: [-47.8825, -15.7942] }, { markerOffset: 15, name: "Santiago", coordinates: [-70.6693, -33.4489] }, { markerOffset: 15, name: "Bogota", coordinates: [-74.0721, 4.711] }, { markerOffset: 15, name: "Quito", coordinates: [-78.4678, -0.1807] }, { markerOffset: -30, name: "Georgetown", coordinates: [-58.1551, 6.8013] }, { markerOffset: -30, name: "Asuncion", coordinates: [-57.5759, -25.2637] }, { markerOffset: 15, name: "Paramaribo", coordinates: [-55.2038, 5.852] }, { markerOffset: 15, name: "Montevideo", coordinates: [-56.1645, -34.9011] }, { markerOffset: 15, name: "Caracas", coordinates: [-66.9036, 10.4806] }, { markerOffset: 15, name: "Lima", coordinates: [-77.0428, -12.0464] } ]; const MapChart = () => { return ( <ComposableMap projection="geoNaturalEarth1" projectionConfig={{ rotate: [0, 0, 0], scale: 0 }} > <Geographies geography={geoUrl}> {({ geographies }) => geographies.map((geo) => ( <Geography key={geo.rsmKey} geography={geo} fill="#EAEAEC" stroke="#D6D6DA" /> )) } </Geographies> {markers.map(({ name, coordinates, markerOffset }) => ( <Marker key={name} coordinates={coordinates}> <g fill="none" stroke="#FF5533" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round" transform="translate(-12, -24)" > <circle cx="12" cy="10" r="3" /> <path d="M12 21.7C17.3 17 20 13 20 10a8 8 0 1 0-16 0c0 3 2.7 6.9 8 11.7z" /> </g> <text textAnchor="middle" y={markerOffset} style={{ fontFamily: "system-ui", fill: "#5D5A6D" }} > {name} </text> </Marker> ))} </ComposableMap> ); }; export default MapChart; нужно сделать, чтобы когда я наводил мышкой на страну, она подсвечивалась. нужно убрать антарктиду с карты
2c19fb56b37f87490841fb4c0bd98eb8
{ "intermediate": 0.43781983852386475, "beginner": 0.45138782262802124, "expert": 0.11079228669404984 }
20,758
import cv2 import time import numpy as np import matplotlib.pyplot as plt N1 = 15 # 要处理的图片张数 A = np.zeros(N1) X = np.zeros(N1) start_time = time.time() for L in range(1, N1+1): I = cv2.imread(str(L) + '.jpg') I = np.double(I) M, N,_ = I.shape GX = 0 # 图像水平方向梯度值 GY = 0 # 图像垂直方向梯度值 FI = 0 # 变量,暂时存储图像清晰度值 T = 0 # 设置的阈值 for x in range(1, M-1): for y in range(1, N-1): GX = I[x-1, y+1] + 2*I[x, y+1] + I[x+1, y+1] - I[x-1, y-1] - 2*I[x, y-1] - I[x+1, y-1] GY = I[x+1, y-1] + 2*I[x+1, y] + I[x+1, y+1] - I[x-1, y-1] - 2*I[x-1, y] - I[x-1, y+1] SXY = np.sqrt(GX**2 + GY**2) # 某一点的梯度值 if SXY > T: FI = FI + SXY**2 A[L-1] = FI end_time = time.time() time_elapsed = end_time - start_time print('Time elapsed:', time_elapsed) C = np.max(A) D = np.min(A) E = C - D X = (A - D) / E x1 = np.array([1,7,15,27,34,46,55,64,78,82,94,101,121,134,154]) y1 = np.array([X[0], X[1], X[2], X[3], X[4],X[5], X[6], X[7], X[8], X[9],X[10], X[11], X[12], X[13], X[14]]) p = np.polyfit(x1, y1, 2) Y = np.polyval(p, x1) plt.plot(x1, y1, 'g') plt.show()运行时出现Traceback (most recent call last): File "D:\pycharm\opencv\tenengrad.py", line 25, in <module> if SXY > T: ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()怎么解决
0dd6fabd1ee817ad61ba1993ff872da9
{ "intermediate": 0.39289167523384094, "beginner": 0.3300112783908844, "expert": 0.27709707617759705 }
20,759
How do I fix this error: ---------------------------------- File "<string>", line 21 tweet = tweet.replace(""", '"') # left/right quotes ERROR! ^ SyntaxError: unterminated triple-quoted string literal (detected at line 144) > ---------------------------------- For this code: ----------------------------------- import json import pandas as pd import nltk from collections import Counter from numpy.random import choice START = "____START____" END = "____END____" def sample_from_choices(choices): words, unnormalized_probs = tuple(zip(*choices.items())) denom = sum(unnormalized_probs) probs = [d / denom for d in unnormalized_probs] return choice(words, p=probs) def clean_up_tt(tweet): tweet = tweet.replace("’", "'") # backtick tweet = tweet.replace("“", '"') # left/right quotes tweet = tweet.replace("”", '"') # left/right quotes tweet = tweet.replace("U.S.A.", "USA") tweet = tweet.replace("U.S.", "US") tweet = tweet.replace("…", "") return tweet def append_token(tweet, token): if token == END: return tweet elif tweet == "": return token elif token in "!%,.\'\":)?": tweet += token elif tweet[-1] in "$(": tweet = tweet + token else: tweet += (" " + token) return tweet def tweet_from_token_list(token_list): tweet = "" for token in token_list: if token not in (START, END): tweet = append_token(tweet, token) return tweet class MCTweet(list): def __init__(self, start=START): self.append(start) def current_ngram(self, n): if n == 1: return self[-1] return tuple(self[-n:]) def __len__(self): return len(self.formatted) @property def formatted(self): return tweet_from_token_list(self) class MCCorpus: def __init__(self, n=3): self.n = n self.backoff_cutoff = n self.tokenizer = nltk.tokenize.TweetTokenizer() self.onegrams = dict() self.twograms = dict() self.threegrams = dict() self.exclusion = "\"()" self.filter_out_url = True def filter_words(self, words): words = [w for w in words if w not in self.exclusion] if self.filter_out_url: words = [w for w in words if "https" not in w] # replacements. This is ugly and hacky, fix in a later version. for j, word in enumerate(words): if word == 'USA': words[j] = 'U.S.A.' if word == 'US': words[j] = 'U.S.' return words def fit(self, text_list): for tweet in text_list: text = clean_up_tt(tweet) words = [START] + self.tokenizer.tokenize(text) + [END] words = self.filter_words(words) for word, nextword in zip(words, words[1:]): if word not in self.onegrams: self.onegrams[word] = Counter() self.onegrams[word][nextword] += 1 for word0, word1, nextword in zip(words, words[1:], words[2:]): if (word0, word1) not in self.twograms: self.twograms[(word0, word1)] = Counter() self.twograms[(word0, word1)][nextword] += 1 for word0, word1, word2, nextword in zip(words, words[1:], words[2:], words[3:]): if (word0, word1, word2) not in self.threegrams: self.threegrams[(word0, word1, word2)] = Counter() self.threegrams[(word0, word1, word2)][nextword] += 1 def predict(self, seed=START, limit_length=280): tweet = MCTweet(seed) while tweet.current_ngram(1) != END: if (tweet.current_ngram(3) in self.threegrams) and ( len(self.threegrams[tweet.current_ngram(3)]) >= self.backoff_cutoff): tweet.append(sample_from_choices(self.threegrams[tweet.current_ngram(3)])) elif (tweet.current_ngram(2) in self.twograms) and (len(self.twograms[tweet.current_ngram(2)]) >= self.backoff_cutoff): tweet.append(sample_from_choices(self.twograms[tweet.current_ngram(2)])) else: tweet.append(sample_from_choices(self.onegrams[tweet.current_ngram(1)])) if len(tweet) > limit_length: tweet = MCTweet(seed) return tweet if __name__ == '__main__': with open("tweets.json", encoding="utf8") as f: td = json.load(f) tweettext = [t['text'] for t in td[-250:]] corpus = MCCorpus(2) corpus.fit(tweettext) for i in range(20): tweet = corpus.predict() while tweet[1] in ["...", ".", "$", "\", "'"]: tweet = corpus.predict() print("TWEET: (len=%i)" % len(tweet)) print(tweet.formatted) ------------------------------------
51133a8e36f62f5b5bb8da7d0fd3a72f
{ "intermediate": 0.40763628482818604, "beginner": 0.3234691321849823, "expert": 0.2688945233821869 }
20,760
import numpy as np import matplotlib.pyplot as plt from skimage import io, color N1 = 15 A = np.zeros(N1) X = np.zeros(N1) for L in range(1, N1+1): I = io.imread(f"{L}.jpg") I = color.rgb2gray(I) I = np.double(I) + 10 * np.random.randn(*I.shape) M, N = I.shape dctI = np.fft.dct2(I) magnitude = np.abs(dctI) FI = 0 for u in range(M): for v in range(N): FI += (u + v) * magnitude[u,v] A[L-1] = np.sum(FI) / (M * N) for W in range(N1): C = np.max(A) D = np.min(A) E = C - D R = (A[W] - D) / E X[W] = R x1 = np.array([1,7,15,27,34,46,55,64,78,82,94,101,121,134,154]) y1 = X p = np.polyfit(x1, y1, 2) Y = np.polyval(p, x1) plt.plot(x1, y1, 'r') plt.title('频域评价函数') plt.xlabel('成像面位置') plt.ylabel('归一化后的图像清晰度评价值') plt.show() 代码运行出现Traceback (most recent call last): File "D:\pycharm\opencv\DCT.py", line 13, in <module> dctI = np.fft.dct2(I) AttributeError: module 'numpy.fft' has no attribute 'dct2'怎么解决
192353d2d9709ec9312aab4fc8ed30a0
{ "intermediate": 0.46673041582107544, "beginner": 0.2609522044658661, "expert": 0.27231737971305847 }
20,761
cross_join how to apply to R
788144bf73888c320a099c783ae93804
{ "intermediate": 0.35276058316230774, "beginner": 0.19898982346057892, "expert": 0.44824957847595215 }
20,762
est-il possible de réduire les bytes dans les fonctions suivantes "function createGame() public { address currentPlayer = msg.sender; require(player2 == address(1), "game is complete"); require(player1 == address(0) || status == GameStatus.finished, "Game is already in progress"); gameId++; if (player1 == address(0)) { player1 = currentPlayer; gamePlayers[gameId][0] = Player(currentPlayer, 0); } else { player2 = currentPlayer; gamePlayers[gameId][1] = Player(currentPlayer, 1); player2Joined = true; emit PlayerJoined(gameId, currentPlayer); } gameBalances[gameId][currentPlayer].balance = 0; status = GameStatus.createdGame; emit GameCreated(gameId, currentPlayer); } /** * @notice effectue un dépôt pour participer à une partie */ function depositRequire() public payable { require(msg.sender == player1 || msg.sender == player2, "Invalid player address"); require(status == GameStatus.createdGame, "The game is not created"); require(player1Bet == 0 || player2 == address(0), "Players have already bet"); require(msg.value > 0 && player1Bet > 0, "msg.value must be greater than 0"); deposit(); } function deposit() public payable { gameId = getCurrentGameId(); uint256 amount = msg.value; require(!isBalanceUpdated, "Balance has already been updated"); if (msg.sender == player1) { require(player1Bet == 0, "Player1 has already bet"); player1Bet = amount; } else if (msg.sender == player2) { require(player1Bet > 0, "Player2 must bet after Player1"); require(msg.value == player1Bet, "Player2 must bet the same amount as Player1"); } playerDeposits[gameId][msg.sender] += amount; updateBalance(amount); isBalanceUpdated = true; updateBet(amount); emit BetDeposited(msg.sender, amount); updateStatusDeposit(); } function updateBalance(uint256 amount) public { require(msg.sender == player1 || msg.sender == player2, "Invalid player address"); gameBalances[gameId][msg.sender].balance += amount; } function updateBet(uint256 amount) public { gameBets[gameId].bet += amount; } function updateStatusDeposit() private { if (msg.sender == player1) { status = GameStatus.waitingForPlayers; emit GameStatusUpdated(gameId, uint8(GameStatus.waitingForPlayers)); } else { requireStatusWaitingForPlayers(); player2HasBet = true; } } /** * @notice démarre une partie avec l'identifiant de jeu spécifié * @dev vérifie les adresses des players et la mise de chacun */ function startGame() public { gameId = getCurrentGameId(); requireStatusWaitingForRandomWord(); require(player1 != address(0) && player2 != address(0), "Both players must be defined"); require(gameBalances[gameId][player1].balance == gameBalances[gameId][player2].balance, "Each player must bet the same amount"); emit GameStarted(gameId, player1, player2); initWordList(); } "mapping(uint8 => mapping(uint8 => Player)) public gamePlayers; //gameId(index => adresse) mapping(uint8 => mapping(address => uint256)) public playerDeposits; mapping(uint8 => Bet) public gameBets; mapping(uint8 => mapping(address => Bet)) public gameBalances;"
3aa04feef112b5dda37b39ea96f55722
{ "intermediate": 0.474370539188385, "beginner": 0.36018994450569153, "expert": 0.16543948650360107 }
20,763
create a random variable sample(6700000000:6709999999,size=10,replace=TRUE) # generate SPECID
9389dd8f444ffb6f97e32ab2c049eabf
{ "intermediate": 0.3090404272079468, "beginner": 0.3643248975276947, "expert": 0.3266347050666809 }
20,764
can we talk
e267741f0af4cb479e90e73ccbc825e5
{ "intermediate": 0.4082702398300171, "beginner": 0.21424847841262817, "expert": 0.37748128175735474 }
20,765
scriptrunner confluence disable thumbnail
761fb26bae93aff929933a66c4c7aab2
{ "intermediate": 0.4201521873474121, "beginner": 0.2990829646587372, "expert": 0.2807648479938507 }
20,766
Assume that a singly linked list is implemented with a header node , but no tail node , and that it maintains only a pointer to the header node . Write a class that includes methods to a . return the size of the linked list b . print the linked list c . test if a value x is contained in the linked list d . add a value x if it is not already contained in the linked list e . remove a value x if it is contained in the linked list
09ef5fc8da2d111c94e6f46c11565793
{ "intermediate": 0.35652193427085876, "beginner": 0.4668373763561249, "expert": 0.17664068937301636 }
20,767
Swap two adjacent elements by adjusting only the links ( and not the data ) using a . singly linked lists b . doubly linked lists
43382e79469a36889b195094841dd3b7
{ "intermediate": 0.3931066393852234, "beginner": 0.18080206215381622, "expert": 0.4260912537574768 }
20,768
For what salesforce components writes unit tests
15f75447c7fe332f8f5c226c98d6e0d0
{ "intermediate": 0.2643677592277527, "beginner": 0.43122291564941406, "expert": 0.3044092655181885 }
20,769
hi there
71a03c7f510326159120713d157f4f4c
{ "intermediate": 0.32885003089904785, "beginner": 0.24785484373569489, "expert": 0.42329514026641846 }
20,770
hello
bf03aa49c399be3f593fd4f63e8071dc
{ "intermediate": 0.32064199447631836, "beginner": 0.28176039457321167, "expert": 0.39759764075279236 }
20,771
a . Propose a data structure that supports the stack push and pop operations and a third operation findMin , which returns the smallest element in the data structure , all in O (1) worst - case time .
13749706523e2e37a23792c2ed83dfa6
{ "intermediate": 0.4365635812282562, "beginner": 0.1577075570821762, "expert": 0.40572890639305115 }
20,772
can you help ?
4d273de8e8ba67111fca0f59b3258dd2
{ "intermediate": 0.3820558786392212, "beginner": 0.2497091144323349, "expert": 0.3682350218296051 }
20,773
function addUser() { const newUserNameInput = document.querySelector('.newUserName'); const newUserIdInput = document.querySelector('.newUserId'); const newUserName = newUserNameInput.value.trim(); const newUserId = newUserIdInput.value.trim(); const level = document.getElementById('levelSelect').value; const level2 = document.getElementById('levelSelect2').value; const level3 = document.getElementById('levelSelect3').value; const level4 = document.getElementById('levelSelect4').value; if (newUserName !== '' && newUserId !== '') { if (userIDs.hasOwnProperty(newUserId)) { return; } else { // Rest of the code for adding the user and counting // Increment the user count userCount++; handleUserCountChange(userCount); // Add the user ID to the list userIDs[newUserId] = true; // Update the count display const countDisplay = document.getElementById('userCount'); countDisplay.textContent = userCount; } const personContainer = document.createElement('div'); personContainer.classList.add('personContainer'); const newProfilePhoto = document.createElement('img'); newProfilePhoto.src = newUserId; newProfilePhoto.alt = newUserName; newProfilePhoto.classList.add('profilePhoto'); const newInputField = document.createElement('input'); newInputField.type = 'text'; newInputField.classList.add('inputField'); newInputField.placeholder = newUserName; const newSendButton = document.createElement('button'); newSendButton.classList.add('sendButton'); newSendButton.textContent = 'Send'; const deleteButton = document.createElement('span'); deleteButton.classList.add('deleteButton'); deleteButton.textContent = 'X'; // Create checkbox element const checkbox = document.createElement('input'); checkbox.type = 'checkbox'; checkbox.classList.add('giftCheckbox'); personContainer.appendChild(checkbox); personContainer.appendChild(newProfilePhoto); personContainer.appendChild(newInputField); personContainer.appendChild(newSendButton); personContainer.appendChild(deleteButton); // Append level images if the value is not empty if (level !== '') { const levelPhoto = document.createElement('img'); levelPhoto.src = `levels/${level}.png`; levelPhoto.classList.add('levelPhoto'); personContainer.appendChild(levelPhoto); } if (level2 !== '') { const levelPhoto2 = document.createElement('img'); levelPhoto2.src = `levels/${level2}.png`; levelPhoto2.classList.add('levelPhoto2'); personContainer.appendChild(levelPhoto2); } if (level3 !== '') { const levelPhoto3 = document.createElement('img'); levelPhoto3.src = `levels/${level3}.png`; levelPhoto3.classList.add('levelPhoto3'); personContainer.appendChild(levelPhoto3); } if (level4 !== '') { const levelPhoto4 = document.createElement('img'); levelPhoto4.src = `levels/${level4}.png`; levelPhoto4.classList.add('levelPhoto4'); personContainer.appendChild(levelPhoto4); } // Add the 'data-sender' and 'name' attributes personContainer.setAttribute('data-sender', newUserName); const nameSelect = document.createElement('select'); nameSelect.classList.add('nameSelect'); // Add options to the select element const names = ['Rose', 'Jane', 'Mike', 'Hand Hearts', 'Hand Heart']; names.forEach((name) => { const option = document.createElement('option'); option.value = name; option.textContent = name; nameSelect.appendChild(option); }); const userSelect = document.createElement('select'); userSelect.classList.add('userSelect'); // Add options to the select element const users = ['user1', 'user2']; users.forEach((user) => { const option = document.createElement('option'); option.value = user; option.textContent = user; userSelect.appendChild(option); }); personContainer.appendChild(nameSelect); personContainer.appendChild(userSelect); // Update the 'name' attribute when the selection changes nameSelect.addEventListener('change', () => { personContainer.setAttribute('name', nameSelect.value); }); userSelect.addEventListener('change', () => { personContainer.setAttribute('user', userSelect.value); }); checkbox.addEventListener('change', () => { if (checkbox.checked) { const selectedName = '3points'; const selectedUser = userSelect.value; const giftNumber = "3"; const giftImage = ''; const giftAnimation = null; const duration = null; const abela = ''; const usernamenew = personContainer.getAttribute('data-sender'); const profilephoto2 = newUserId; checkbox.setAttribute('data-sender', usernamenew); // Pass the gift image URL and animation URL to the `gift` function gift(selectedUser, giftNumber, checkbox.getAttribute('data-sender'), selectedName, profilephoto2, giftImage, giftAnimation, duration, abela);adjustLines(); checkbox.disabled = true; } }); const sendGiftButton = document.createElement('button'); sendGiftButton.classList.add('sendGiftButton'); sendGiftButton.textContent = 'Send Gift'; sendGiftButton.addEventListener('click', () => { const selectedName = nameSelect.value; const selectedUser = userSelect.value; const giftDetails = getGiftNumber(selectedName); const giftNumber = giftDetails.giftNumber; // Retrieve the gift number const giftImage = giftDetails.image; // Retrieve the gift image URL const giftAnimation = giftDetails.animation; // Retrieve the gift animation URL const duration = giftDetails.duration; // Retrieve the gift animation URL const usernamenew = personContainer.getAttribute('data-sender'); const profilephoto2 = newUserId; sendGiftButton.setAttribute('data-sender', usernamenew); // Pass the gift image URL and animation URL to the `gift` function gift(selectedUser, giftNumber, sendGiftButton.getAttribute('data-sender'), selectedName, profilephoto2, giftImage, giftAnimation, duration); adjustLines(); }); personContainer.appendChild(sendGiftButton); inputContainer.appendChild(personContainer); newInputField.addEventListener('keydown', (event) => { if (event.key === 'Enter') { sendMessage(personContainer); } }); newSendButton.addEventListener('click', () => { sendMessage(personContainer); }); deleteButton.addEventListener('click', () => { personContainer.remove(); // Decrement the user count userCount--; handleUserCountChange(userCount); // Remove the user ID from the list delete userIDs[newUserId]; // Update the count display const countDisplay = document.getElementById('userCount'); countDisplay.textContent = userCount; }); newUserNameInput.value = ''; newUserIdInput.value = ''; const chatContainerBottom = document.getElementById('chatContainerBottom'); const highLevelJoined = document.querySelector('.highLevelJoined'); function replaceExistingMessage(container, newMessage) { const existingMessage = container.querySelector('.messageContainerBottomMessage'); if (existingMessage) { existingMessage.remove(); } const messageContainer = document.createElement('div'); messageContainer.classList.add('messageContainerBottomMessage'); messageContainer.appendChild(newMessage); container.appendChild(messageContainer); } function replaceExistingHighMessage(container, newMessage) { const existingMessage = container.querySelector('.HighMessageContainer'); if (existingMessage) { existingMessage.remove(); } const messageContainer = document.createElement('div'); messageContainer.classList.add('HighMessageContainer'); messageContainer.appendChild(newMessage); container.appendChild(messageContainer); const highLevelJoined = document.querySelector('.highLevelJoined'); highLevelJoined.style.left = '-200px'; // Start position highLevelJoined.style.display = 'block'; // Reset display setTimeout(() => { highLevelJoined.style.left = '10px'; // End position }, 10); // Adjust the timing as needed setTimeout(() => { highLevelJoined.style.display = 'none'; // Hide the highLevelJoined element after 3 seconds highLevelJoined.style.left = '-200px'; // Reset the position }, 3000); // Adjust the timing as needed } // Create and append the new message containers const messageContainer = document.createElement('div'); messageContainer.classList.add('messageContainerBottomMessage'); // Append profile photo to the message only if level is below 25 if (parseInt(level) < 25 || level === '') { const profilePhoto = document.createElement('img'); profilePhoto.src = './images/joined.png'; profilePhoto.alt = 'tiktok'; profilePhoto.classList.add('profilePhoto'); messageContainer.appendChild(profilePhoto); } // Append level photo to the message if (level >= 25) { const levelPhoto = document.createElement('img'); levelPhoto.src = `levels/${level}.png`; levelPhoto.classList.add('levelPhotoHigh'); messageContainer.appendChild(levelPhoto); } if (!isArabic(newUserName)){ if (level !== '') { if (level < 25) { const levelPhoto = document.createElement('img'); levelPhoto.src = `levels/${level}.png`; levelPhoto.classList.add('levelPhoto'); levelPhoto.style.paddingBottom = "0"; messageContainer.appendChild(levelPhoto); }}} const spaceElement = document.createElement('span'); messageContainer.appendChild(spaceElement); const messageText = document.createElement('span'); messageText.classList.add(parseInt(level) >= 25 ? 'newUserNameHigh' : 'newUserName'); const userNameText = document.createElement('span'); userNameText.textContent = newUserName; const joinedText = document.createElement('span'); joinedText.classList.add('joinedText'); joinedText.textContent = ' joined'; if (isArabic(newUserName) && parseInt(level) < 25) { userNameText.style.paddingLeft = '5px'; messageText.appendChild(joinedText); messageText.appendChild(userNameText); }else if (!isArabic(newUserName) && parseInt(level) < 25) { messageText.appendChild(userNameText); messageText.appendChild(joinedText); }else if (!isArabic(newUserName) && parseInt(level) >= 25) { messageText.appendChild(userNameText); messageText.appendChild(joinedText); }else if (isArabic(newUserName) && parseInt(level) >= 25) { userNameText.style.paddingLeft = '5px'; messageText.appendChild(userNameText); messageText.appendChild(joinedText); }else if (isArabic(newUserName) && level === '') { userNameText.style.paddingLeft = '5px'; messageText.appendChild(joinedText); messageText.appendChild(userNameText); }else if (!isArabic(newUserName) && level === '') { messageText.appendChild(userNameText); messageText.appendChild(joinedText); } messageContainer.appendChild(messageText); if (isArabic(newUserName)){ if (level !== '') { if (level < 25) { const levelPhoto = document.createElement('img'); levelPhoto.src = `levels/${level}.png`; levelPhoto.classList.add('levelPhoto'); levelPhoto.style.paddingLeft = '5px'; messageContainer.appendChild(levelPhoto); }}} if (parseInt(level) >= 25) { replaceExistingHighMessage(highLevelJoined, messageContainer); } else { replaceExistingMessage(chatContainerBottom, messageContainer); } } } when adding a user for the first time save all the added info to a txt file user_info.txt , when trying to add a user again check if the user exists in the txt file if yes get all the info from that file if not proceed with the add user function, my file is html , u can use javascript and php without removing any parts of the code
937e6b286bf91879df3aa45b2ec37e11
{ "intermediate": 0.28484490513801575, "beginner": 0.5640657544136047, "expert": 0.15108931064605713 }
20,774
hii
83832e89c241811922509ec35dfc7e78
{ "intermediate": 0.3416314125061035, "beginner": 0.27302300930023193, "expert": 0.38534557819366455 }
20,775
j'ai une erreur "TypeError: Operator == not compatible with types struct Penduel.Bet storage ref and int_const 0. --> contracts/Penduel.sol:131:17: | 131 | require(games[gameId].player1Bet == 0 || games[gameId].player2 == address(0), "Players have already bet"); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ " comment corriger cette erreur ? voici la structure du contrat: "struct Player { address playerAddress; uint8 index; // 0 ou 1 } struct Game { address player1; address player2; Bet player1Bet; Bet player2Bet; bool player1hasWithdrawn; bool player2hasWithdrawn; } struct Bet { uint256 bet; uint256 totalBet; uint256 balance; uint256 playerDeposit; }" " mapping(uint8 => Game) public games; mapping(uint8 => mapping(uint8 => Player)) public gamePlayers; //gameId(index => adresse) mapping(uint8 => Bet) public gameTotalBet; mapping(uint8 => mapping(address => Bet)) public playerBalances; mapping(uint8 => mapping(address => Bet)) public playerDeposits;"
5f3954329be25574a418c211078f63f1
{ "intermediate": 0.3402521014213562, "beginner": 0.41853639483451843, "expert": 0.2412114143371582 }
20,776
help me please
ca17b3e16697b8fbed0321d0f90157e1
{ "intermediate": 0.37114542722702026, "beginner": 0.3045443594455719, "expert": 0.32431018352508545 }
20,777
how to convert from 20-Jun-2023 to be 2023-06-20 in java
da004f151487d11f8d2451d4eef6879c
{ "intermediate": 0.40019282698631287, "beginner": 0.27672895789146423, "expert": 0.3230782449245453 }
20,778
function addUser() { const newUserNameInput = document.querySelector('.newUserName'); const newUserIdInput = document.querySelector('.newUserId'); const newUserName = newUserNameInput.value.trim(); const newUserId = newUserIdInput.value.trim(); const level = document.getElementById('levelSelect').value; const level2 = document.getElementById('levelSelect2').value; const level3 = document.getElementById('levelSelect3').value; const level4 = document.getElementById('levelSelect4').value; if (newUserName !== '' && newUserId !== '') { if (userIDs.hasOwnProperty(newUserId)) { return; } else { // Rest of the code for adding the user and counting // Increment the user count userCount++; handleUserCountChange(userCount); // Add the user ID to the list userIDs[newUserId] = true; // Update the count display const countDisplay = document.getElementById('userCount'); countDisplay.textContent = userCount; } const personContainer = document.createElement('div'); personContainer.classList.add('personContainer'); const newProfilePhoto = document.createElement('img'); newProfilePhoto.src = newUserId; newProfilePhoto.alt = newUserName; newProfilePhoto.classList.add('profilePhoto'); const newInputField = document.createElement('input'); newInputField.type = 'text'; newInputField.classList.add('inputField'); newInputField.placeholder = newUserName; const newSendButton = document.createElement('button'); newSendButton.classList.add('sendButton'); newSendButton.textContent = 'Send'; const deleteButton = document.createElement('span'); deleteButton.classList.add('deleteButton'); deleteButton.textContent = 'X'; // Create checkbox element const checkbox = document.createElement('input'); checkbox.type = 'checkbox'; checkbox.classList.add('giftCheckbox'); personContainer.appendChild(checkbox); personContainer.appendChild(newProfilePhoto); personContainer.appendChild(newInputField); personContainer.appendChild(newSendButton); personContainer.appendChild(deleteButton); // Append level images if the value is not empty if (level !== '') { const levelPhoto = document.createElement('img'); levelPhoto.src = `levels/${level}.png`; levelPhoto.classList.add('levelPhoto'); personContainer.appendChild(levelPhoto); } if (level2 !== '') { const levelPhoto2 = document.createElement('img'); levelPhoto2.src = `levels/${level2}.png`; levelPhoto2.classList.add('levelPhoto2'); personContainer.appendChild(levelPhoto2); } if (level3 !== '') { const levelPhoto3 = document.createElement('img'); levelPhoto3.src = `levels/${level3}.png`; levelPhoto3.classList.add('levelPhoto3'); personContainer.appendChild(levelPhoto3); } if (level4 !== '') { const levelPhoto4 = document.createElement('img'); levelPhoto4.src = `levels/${level4}.png`; levelPhoto4.classList.add('levelPhoto4'); personContainer.appendChild(levelPhoto4); } // Add the 'data-sender' and 'name' attributes personContainer.setAttribute('data-sender', newUserName); const nameSelect = document.createElement('select'); nameSelect.classList.add('nameSelect'); // Add options to the select element const names = ['Rose', 'Jane', 'Mike', 'Hand Hearts', 'Hand Heart']; names.forEach((name) => { const option = document.createElement('option'); option.value = name; option.textContent = name; nameSelect.appendChild(option); }); const userSelect = document.createElement('select'); userSelect.classList.add('userSelect'); // Add options to the select element const users = ['user1', 'user2']; users.forEach((user) => { const option = document.createElement('option'); option.value = user; option.textContent = user; userSelect.appendChild(option); }); personContainer.appendChild(nameSelect); personContainer.appendChild(userSelect); // Update the 'name' attribute when the selection changes nameSelect.addEventListener('change', () => { personContainer.setAttribute('name', nameSelect.value); }); userSelect.addEventListener('change', () => { personContainer.setAttribute('user', userSelect.value); }); checkbox.addEventListener('change', () => { if (checkbox.checked) { const selectedName = '3points'; const selectedUser = userSelect.value; const giftNumber = "3"; const giftImage = ''; const giftAnimation = null; const duration = null; const abela = ''; const usernamenew = personContainer.getAttribute('data-sender'); const profilephoto2 = newUserId; checkbox.setAttribute('data-sender', usernamenew); // Pass the gift image URL and animation URL to the `gift` function gift(selectedUser, giftNumber, checkbox.getAttribute('data-sender'), selectedName, profilephoto2, giftImage, giftAnimation, duration, abela);adjustLines(); checkbox.disabled = true; } }); const sendGiftButton = document.createElement('button'); sendGiftButton.classList.add('sendGiftButton'); sendGiftButton.textContent = 'Send Gift'; sendGiftButton.addEventListener('click', () => { const selectedName = nameSelect.value; const selectedUser = userSelect.value; const giftDetails = getGiftNumber(selectedName); const giftNumber = giftDetails.giftNumber; // Retrieve the gift number const giftImage = giftDetails.image; // Retrieve the gift image URL const giftAnimation = giftDetails.animation; // Retrieve the gift animation URL const duration = giftDetails.duration; // Retrieve the gift animation URL const usernamenew = personContainer.getAttribute('data-sender'); const profilephoto2 = newUserId; sendGiftButton.setAttribute('data-sender', usernamenew); // Pass the gift image URL and animation URL to the `gift` function gift(selectedUser, giftNumber, sendGiftButton.getAttribute('data-sender'), selectedName, profilephoto2, giftImage, giftAnimation, duration); adjustLines(); }); personContainer.appendChild(sendGiftButton); inputContainer.appendChild(personContainer); newInputField.addEventListener('keydown', (event) => { if (event.key === 'Enter') { sendMessage(personContainer); } }); newSendButton.addEventListener('click', () => { sendMessage(personContainer); }); deleteButton.addEventListener('click', () => { personContainer.remove(); // Decrement the user count userCount--; handleUserCountChange(userCount); // Remove the user ID from the list delete userIDs[newUserId]; // Update the count display const countDisplay = document.getElementById('userCount'); countDisplay.textContent = userCount; }); newUserNameInput.value = ''; newUserIdInput.value = ''; const chatContainerBottom = document.getElementById('chatContainerBottom'); const highLevelJoined = document.querySelector('.highLevelJoined'); function replaceExistingMessage(container, newMessage) { const existingMessage = container.querySelector('.messageContainerBottomMessage'); if (existingMessage) { existingMessage.remove(); } const messageContainer = document.createElement('div'); messageContainer.classList.add('messageContainerBottomMessage'); messageContainer.appendChild(newMessage); container.appendChild(messageContainer); } function replaceExistingHighMessage(container, newMessage) { const existingMessage = container.querySelector('.HighMessageContainer'); if (existingMessage) { existingMessage.remove(); } const messageContainer = document.createElement('div'); messageContainer.classList.add('HighMessageContainer'); messageContainer.appendChild(newMessage); container.appendChild(messageContainer); const highLevelJoined = document.querySelector('.highLevelJoined'); highLevelJoined.style.left = '-200px'; // Start position highLevelJoined.style.display = 'block'; // Reset display setTimeout(() => { highLevelJoined.style.left = '10px'; // End position }, 10); // Adjust the timing as needed setTimeout(() => { highLevelJoined.style.display = 'none'; // Hide the highLevelJoined element after 3 seconds highLevelJoined.style.left = '-200px'; // Reset the position }, 3000); // Adjust the timing as needed } // Create and append the new message containers const messageContainer = document.createElement('div'); messageContainer.classList.add('messageContainerBottomMessage'); // Append profile photo to the message only if level is below 25 if (parseInt(level) < 25 || level === '') { const profilePhoto = document.createElement('img'); profilePhoto.src = './images/joined.png'; profilePhoto.alt = 'tiktok'; profilePhoto.classList.add('profilePhoto'); messageContainer.appendChild(profilePhoto); } // Append level photo to the message if (level >= 25) { const levelPhoto = document.createElement('img'); levelPhoto.src = `levels/${level}.png`; levelPhoto.classList.add('levelPhotoHigh'); messageContainer.appendChild(levelPhoto); } if (!isArabic(newUserName)){ if (level !== '') { if (level < 25) { const levelPhoto = document.createElement('img'); levelPhoto.src = `levels/${level}.png`; levelPhoto.classList.add('levelPhoto'); levelPhoto.style.paddingBottom = "0"; messageContainer.appendChild(levelPhoto); }}} const spaceElement = document.createElement('span'); messageContainer.appendChild(spaceElement); const messageText = document.createElement('span'); messageText.classList.add(parseInt(level) >= 25 ? 'newUserNameHigh' : 'newUserName'); const userNameText = document.createElement('span'); userNameText.textContent = newUserName; const joinedText = document.createElement('span'); joinedText.classList.add('joinedText'); joinedText.textContent = ' joined'; if (isArabic(newUserName) && parseInt(level) < 25) { userNameText.style.paddingLeft = '5px'; messageText.appendChild(joinedText); messageText.appendChild(userNameText); }else if (!isArabic(newUserName) && parseInt(level) < 25) { messageText.appendChild(userNameText); messageText.appendChild(joinedText); }else if (!isArabic(newUserName) && parseInt(level) >= 25) { messageText.appendChild(userNameText); messageText.appendChild(joinedText); }else if (isArabic(newUserName) && parseInt(level) >= 25) { userNameText.style.paddingLeft = '5px'; messageText.appendChild(userNameText); messageText.appendChild(joinedText); }else if (isArabic(newUserName) && level === '') { userNameText.style.paddingLeft = '5px'; messageText.appendChild(joinedText); messageText.appendChild(userNameText); }else if (!isArabic(newUserName) && level === '') { messageText.appendChild(userNameText); messageText.appendChild(joinedText); } messageContainer.appendChild(messageText); if (isArabic(newUserName)){ if (level !== '') { if (level < 25) { const levelPhoto = document.createElement('img'); levelPhoto.src = `levels/${level}.png`; levelPhoto.classList.add('levelPhoto'); levelPhoto.style.paddingLeft = '5px'; messageContainer.appendChild(levelPhoto); }}} if (parseInt(level) >= 25) { replaceExistingHighMessage(highLevelJoined, messageContainer); } else { replaceExistingMessage(chatContainerBottom, messageContainer); } } } when adding a user for the first time save all the added info to a txt file user_info.txt , when trying to add a user again check if the user exists in the txt file if yes get all the info from that file if not proceed with the add user function, my file is html , u can use javascript and php without removing any parts of the code
b3ac177cede0adc276d8073713176836
{ "intermediate": 0.28484490513801575, "beginner": 0.5640657544136047, "expert": 0.15108931064605713 }
20,779
do you have any way to when make update in file access to make update to all file on another Computers links with database
393347c92d00af56cd92b73dbc50e855
{ "intermediate": 0.5079629421234131, "beginner": 0.18142065405845642, "expert": 0.3106164336204529 }
20,780
How to pick the latest row only from result rows in an SQL
833115936646194fffb7f78263dcddc0
{ "intermediate": 0.39673542976379395, "beginner": 0.34220919013023376, "expert": 0.2610553503036499 }
20,781
Sure, here is another C++ program on class Point using C++ class basics:
9aeb544ce56c895c59491a7c48bd51ad
{ "intermediate": 0.2536305785179138, "beginner": 0.5448688268661499, "expert": 0.20150060951709747 }
20,782
I think your out-of-data makes you believe that Ethereum is still proof of work, but it's proof of stake now. Does that mean that a smart contract on the Ethereum network can be used to stake Ether? Would that in turn mean that a smart contract I make could use that smart contract to stake with Ether that is used as collateral for something that someone else does on my smart contract? Be concise.
5589040513953a2464bd95f9ab1803e7
{ "intermediate": 0.38193196058273315, "beginner": 0.24329297244548798, "expert": 0.3747750222682953 }
20,783
I have a table with three columns Date, Customer, Product in power query. Using M language provide code to get the column Group in which consecutive dates for unique combination of Customer and Product are placed to one group. For example, for Customer X and Product A1 dates 06.01.2023 to 06.02.2023 are placed to Group 1 and dates 06.05.2023 to 06.06.2023 are placed to Group 2. See the detailed example. Input is |Date|Customer|Product| |06.01.2023|X|A1| |06.02.2023|X|A1| |06.05.2023|X|A1| |06.06.2023|X|A1| |06.01.2023|X|A2| |06.02.2023|X|A2| |06.03.2023|X|A2| |06.08.2023|X|A2| |06.01.2023|Y|A1| |06.05.2023|Y|A1| |06.09.2023|Y|A1| The desired output is |Date|Customer|Product|Group| |06.01.2023|X|A1|1| |06.02.2023|X|A1|1| |06.05.2023|X|A1|2| |06.06.2023|X|A1|2| |06.01.2023|X|A2|1| |06.02.2023|X|A2|1| |06.03.2023|X|A2|1| |06.08.2023|X|A2|2| |06.01.2023|Y|A1|1| |06.05.2023|Y|A1|2| |06.09.2023|Y|A1|3|
d34cca7e70c37f7a4a1353774bdf861d
{ "intermediate": 0.3600597083568573, "beginner": 0.40437307953834534, "expert": 0.23556722700595856 }
20,784
SELECT reports.id AS id, reports.date AS date, reports.trafficchannelid AS trafficchannelid, reports.final AS final, reports.compressedreport AS compressedreport, reports.created_at AS created_at, reports.updated_at AS updated_at, JSON_AGG( JSON_BUILD_OBJECT( 'campaignid', campaignid, 'funneltemplateid', funneltemplateid, 'campaignidrt', campaignidrt, 'adGroups', ( SELECT JSON_AGG( JSON_BUILD_OBJECT( 'adgroupid', report_adgroups.adgroupid, 'ad', ( SELECT JSON_BUILD_OBJECT( 'adid', report_ads.adid, 'adname', report_ads.adname, 'adgroupname', report_ads.adgroupname, 'campaignname', report_ads.campaignname, 'date', report_ads.date, 'total_spent', report_ads.total_spent, 'total_click', report_ads.total_click, 'total_impressions', report_ads.total_impressions, 'revenue', report_ads.revenue, 'estimate', report_ads.estimate, 'feedsource', report_ads.feedsource, 'clickdetail', ( SELECT JSON_Build_OBJECT( 'track_id', report_ads_clickdetail.track_id, 'domain_id', report_ads_clickdetail.domain_id ) FROM report_ads_clickdetail WHERE report_ads_clickdetail.report_ads_id = report_ads.id LIMIT 1 ) ) FROM report_ads WHERE report_ads.report_adgroups_id = report_adgroups.id LIMIT 1 ) ) ) FROM report_adgroups WHERE report_adgroups.report_details_id = report_details.id LIMIT 1 ) ) ) AS details, JSON_AGG( JSON_BUILD_OBJECT( 'campaigns', report_domains.campaigns, 'domainid', report_domains.domainid, 'name', report_domains.name, 'weight', report_domains.weight, 'feedsource', report_domains.feedsource ) ) AS domains FROM reports LEFT JOIN report_details on report_details.report_id = reports.id LEFT JOIN report_adgroups on report_adgroups.report_details_id = report_details.id LEFT JOIN report_ads on report_ads.report_adgroups_id = report_adgroups.id LEFT JOIN report_ads_clickdetail on report_ads_clickdetail.report_ads_id = report_ads.id LEFT JOIN report_conversion on report_conversion.report_ads_clickdetail_id = report_ads_clickdetail.id LEFT JOIN report_domains on report_domains.reportid = reports.id WHERE reports.date = CAST('2023-09-21' AS DATE) AND trafficchannelid='1985930498438577' AND reports.final = true AND reports.created_at = ( SELECT MAX(reports.created_at) FROM reports WHERE reports.date = reports.date ) GROUP BY reports.id, reports.date, reports.trafficchannelid; This query is supposed to return from reports. It returns the result but it only returns reports with the latest reports.created_at. The issue is before the subqery after AND, the result returned 4 rows. But now it returns 0. How do I fix the issue?
b1d1412392d74a16a0ca6c8d0bc398a7
{ "intermediate": 0.3372623920440674, "beginner": 0.5393540859222412, "expert": 0.12338357418775558 }
20,785
Transferring the vacation balance to a new year for the employee using SQL Server
d806ca0e33b670fea914eb7565f409eb
{ "intermediate": 0.3344939649105072, "beginner": 0.3212355673313141, "expert": 0.3442704677581787 }
20,786
SELECT id, date, trafficchannelid, final, compressedreport, created_at, updated_at, details, domains FROM ( SELECT reports.id AS id, reports.date AS date, reports.trafficchannelid AS trafficchannelid, reports.final AS final, reports.compressedreport AS compressedreport, reports.created_at AS created_at, reports.updated_at AS updated_at, JSON_AGG( JSON_BUILD_OBJECT( ‘campaignid’, campaignid, ‘funneltemplateid’, funneltemplateid, ‘campaignidrt’, campaignidrt, ‘adGroups’, ( SELECT JSON_AGG( JSON_BUILD_OBJECT( ‘adgroupid’, report_adgroups.adgroupid, ‘ads’, ( SELECT JSON_BUILD_OBJECT( ‘adid’, report_ads.adid, ‘adname’, report_ads.adname, ‘adgroupname’, report_ads.adgroupname, ‘campaignname’, report_ads.campaignname, ‘date’, report_ads.date, ‘total_spent’, report_ads.total_spent, ‘total_click’, report_ads.total_click, ‘total_impressions’, report_ads.total_impressions, ‘revenue’, report_ads.revenue, ‘estimate’, report_ads.estimate, ‘feedsource’, report_ads.feedsource, ‘clickdetail’, ( SELECT JSON_Build_OBJECT( ‘track_id’, report_ads_clickdetail.track_id, ‘domain_id’, report_ads_clickdetail.domain_id ) FROM report_ads_clickdetail WHERE report_ads_clickdetail.report_ads_id = report_ads.id LIMIT 1 ) ) FROM report_ads WHERE report_ads.report_adgroups_id = report_adgroups.id LIMIT 1 ) ) ) FROM report_adgroups WHERE report_adgroups.report_details_id = report_details.id LIMIT 1 ) ) ) AS details, JSON_AGG( JSON_BUILD_OBJECT( ‘campaigns’, report_domains.campaigns, ‘domainid’, report_domains.domainid, ‘name’, report_domains.name, ‘weight’, report_domains.weight, ‘feedsource’, report_domains.feedsource ) ) AS domains, ROW_NUMBER() OVER (PARTITION BY reports.date ORDER BY reports.created_at DESC) AS rn FROM reports LEFT JOIN report_details on report_details.report_id = reports.id LEFT JOIN report_adgroups on report_adgroups.report_details_id = report_details.id LEFT JOIN report_ads on report_ads.report_adgroups_id = report_adgroups.id LEFT JOIN report_ads_clickdetail on report_ads_clickdetail.report_ads_id = report_ads.id LEFT JOIN report_conversion on report_conversion.report_ads_clickdetail_id = report_ads_clickdetail.id LEFT JOIN report_domains on report_domains.reportid = reports.id WHERE reports.date >= CAST(‘2023-09-21’ AS DATE) AND reports.trafficchannelid = ‘1985930498438577’ GROUP BY reports.id, reports.date, reports.trafficchannelid ) subquery WHERE rn = 1; on this query I want the field ads to be a json_agg. How may I do that?
f4d6a411a6cf3be686d121f8957d46d8
{ "intermediate": 0.37000802159309387, "beginner": 0.4052562117576599, "expert": 0.22473569214344025 }
20,787
how do I find the length of the longest substring that contains only "G" and "C" in a txt file using "grep" and regular expression
2386a2a9b5ab876e8586a153ee806941
{ "intermediate": 0.44414010643959045, "beginner": 0.24455618858337402, "expert": 0.3113037049770355 }
20,788
I have a table with three columns Date, Customer, Product, Index in power query. Index is index for unique combination of Customer and Product. Using M language provide code to get the column Group in which consecutive dates for unique combination of Customer and Product are placed to one group. For example, for Customer X and Product A1 dates 06.01.2023 to 06.02.2023 are placed to Group 1 and dates 06.05.2023 to 06.06.2023 are placed to Group 2. See the detailed example. Input is |Date|Customer|Product|Index| |06.01.2023|X|A1|0| |06.02.2023|X|A1|1| |06.05.2023|X|A1|2| |06.06.2023|X|A1|3| |06.01.2023|X|A2|0| |06.02.2023|X|A2|1| |06.03.2023|X|A2|2| |06.08.2023|X|A2|3| |06.01.2023|Y|A1|0| |06.05.2023|Y|A1|1| |06.09.2023|Y|A1|2| The desired output is |Date|Customer|Product|Index|Group| |06.01.2023|X|A1|0|1| |06.02.2023|X|A1|1|1| |06.05.2023|X|A1|2|2| |06.06.2023|X|A1|3|2| |06.01.2023|X|A2|0|1| |06.02.2023|X|A2|1|1| |06.03.2023|X|A2|2|1| |06.08.2023|X|A2|3|2| |06.01.2023|Y|A1|0|1| |06.05.2023|Y|A1|1|2| |06.09.2023|Y|A1|2|3| My code is let Source = Excel.Workbook(File.Contents("C:\Users\snoale\Downloads\Пример\Данные.xlsx"), null, true), #"Исходные данные_Sheet" = Source{[Item="Исходные данные",Kind="Sheet"]}[Data], #"Promoted Headers" = Table.PromoteHeaders(#"Исходные данные_Sheet", [PromoteAllScalars=true]), #"Changed Type" = Table.TransformColumnTypes(#"Promoted Headers",{{"Date", type date}, {"Client", type text}, {"Product", type text}, {"Share", type text}, {"Q", Int64.Type}, {"P", type number}, {"StartDate", type date}, {"EndDate", type date}}), #"Removed Columns" = Table.RemoveColumns(#"Changed Type",{"Date", "Share", "Q", "P"}), #"Added Custom" = Table.AddColumn(#"Removed Columns", "Custom", each {Number.From([StartDate])..Number.From([EndDate])}), #"Expanded Custom" = Table.ExpandListColumn(#"Added Custom", "Custom"), #"Renamed Columns" = Table.RenameColumns(#"Expanded Custom",{{"Custom", "Date"}}), #"Removed Columns1" = Table.RemoveColumns(#"Renamed Columns",{"StartDate", "EndDate"}), #"Changed Type1" = Table.TransformColumnTypes(#"Removed Columns1",{{"Date", type date}}), #"Removed Duplicates" = Table.Distinct(#"Changed Type1"), #"Grouped Rows" = Table.Group(#"Removed Duplicates", {"Client", "Product"}, {{"AllData", each _, type table [Client=nullable text, Product=nullable text, Date=nullable date]}}), #"Added Custom1" = Table.AddColumn(#"Grouped Rows", "Custom", each Table.AddIndexColumn([AllData],"Index",0)), #"Removed Columns2" = Table.RemoveColumns(#"Added Custom1",{"Client", "Product", "AllData"}), #"Expanded Custom1" = Table.ExpandTableColumn(#"Removed Columns2", "Custom", {"Client", "Product", "Date", "Index"}, {"Client", "Product", "Date", "Index"}) in #"Expanded Custom1"
651a2986e73d278ef8f9ca1c8ace415d
{ "intermediate": 0.32865622639656067, "beginner": 0.41813281178474426, "expert": 0.2532109022140503 }
20,789
I have a table with three columns Date, Customer, Product, Index in power query. Index is index for unique combination of Customer and Product. Using M language provide code to get the column Group in which consecutive dates for unique combination of Customer and Product are placed to one group. For example, for Customer X and Product A1 dates 06.01.2023 to 06.02.2023 are placed to Group 1 and dates 06.05.2023 to 06.06.2023 are placed to Group 2. How to write the M expression to compare current row with next row and assigning 0 if the difference is 1 day and assigning 1 if the difference is more than 1 day?
89b1a06944247827faa621616a138e12
{ "intermediate": 0.4258852005004883, "beginner": 0.22122822701931, "expert": 0.3528865873813629 }
20,790
I have sequence_id and a str. How can I use Bio library to save .fa file?
26227861059f1f865d7150cea6661892
{ "intermediate": 0.6767800450325012, "beginner": 0.13886193931102753, "expert": 0.18435800075531006 }
20,791
List<Opportunity> opportunitiesToUpdate = new List<Opportunity>(); for (Id opportunityId : opportunityIds) { DateTime opportunityLastContactDate = opportunityLastContactMap.get(opportunityId); if (opportunityLastContactDate != null) { opportunitiesToUpdate.add(new Opportunity( Id = opportunityId, Last_Contact__c = opportunityLastContactDate )); } } for (OpportunityContactRole oppContactRole : [ SELECT OpportunityId, CreatedDate FROM OpportunityContactRole WHERE ContactId IN :contactIds ]) { DateTime contactLastContactDate = oppContactRole.CreatedDate; Opportunity opportunity = new Opportunity(Id = oppContactRole.OpportunityId); if (opportunity.Last_Contact__c == null || contactLastContactDate > opportunity.Last_Contact__c) { opportunity.Last_Contact__c = contactLastContactDate; opportunitiesToUpdate.add(opportunity); } } if (!opportunitiesToUpdate.isEmpty()) { update opportunitiesToUpdate; } Fix this code for this purpose: Opportunity field Last Contact should be updated to value - Created Date of the latest Task on a Contact, related to this Opportunity or the latest Task on this Opportunity (which is later).
d0f66c81bdeb194da3cf618ab9829432
{ "intermediate": 0.3832828998565674, "beginner": 0.32120442390441895, "expert": 0.2955126464366913 }
20,792
Write a MatLab program that plots “CB” on a complex plane using the scatter() function
8b0c214c93280bcb413c5b50ebe4435e
{ "intermediate": 0.39197954535484314, "beginner": 0.14170929789543152, "expert": 0.46631112694740295 }
20,793
Write a MatLab program that plots the letters “CB” on a complex plane using the scatter() function
104ef58320bcc2fba27931ac0b4f5fe9
{ "intermediate": 0.3404489755630493, "beginner": 0.12434948235750198, "expert": 0.5352014899253845 }
20,794
This query takes 0.0005 seconds. Is there a way to speed it up? "SELECT COUNT(id), land, name FROM online_users GROUP BY land,name;"
780948ecdf89e9706dd35c4ad59217ae
{ "intermediate": 0.41386157274246216, "beginner": 0.2892162501811981, "expert": 0.29692214727401733 }
20,795
Write a MatLab program that plots points that spell out the letters “CB” on a complex plane using the scatter() function
71835f1d47ea10d371275dfc5d8d60b2
{ "intermediate": 0.3259156048297882, "beginner": 0.16582132875919342, "expert": 0.508263111114502 }
20,796
I have a series of interacting VBA codes which are not completeing and I would like your help in solving the issue. In my sheet Overtime, I have a button that calls this code; Sub CopyMatchingValues() Dim mIsSubmitted As Boolean Dim StaffForm As New StaffForm1 ' Show the UserForm as a modal dialog StaffForm.Show vbModal If Not mIsSubmitted Then Exit Sub Call CopyMatchingContinue End Sub The Form Opens, and this is the code for the Form; Private mIsSubmitted As Boolean Public Property Get IsSubmitted() As Boolean IsSubmitted = mIsSubmitted End Property Private Sub Label1_Click() End Sub Private Sub StaffSubmit_Click() mIsSubmitted = True ' Check if all text boxes are filled If FullName.Text = "" Or JobTitle.Text = "" Or ContType.Text = "" Or WorkHrs.Text = "" Then MsgBox "Please fill in all the fields.", vbExclamation Exit Sub End If ' Copy values from text boxes to 'OTForm' sheet ThisWorkbook.Sheets("OTForm").Range("B4").Value = FullName.Text ThisWorkbook.Sheets("OTForm").Range("B7").Value = JobTitle.Text ThisWorkbook.Sheets("OTForm").Range("E4").Value = ContType.Text ThisWorkbook.Sheets("OTForm").Range("E5").Value = WorkHrs.Text ThisWorkbook.Sheets("OTForm").Calculate ThisWorkbook.Sheets("OTFormX").Calculate ThisWorkbook.Sheets("OTFormX").Range("B7").Calculate ' Close the UserForm Unload Me End Sub Private Sub StaffCancel_Click() mIsSubmitted = False ' Close the UserForm Me.Hide End Sub When I click the SUBMIT button in the form, it copies the relevant inputs to the sheet 'OTForm'. On SUBMIT, it is also supposed to run the following code in my sheet, which iti is not doing. Sub CopyMatchingContinue() Dim OvertimeSheet As Worksheet Dim OTFormSheet As Worksheet Dim OvertimeRange As Range Dim OTFormRange As Range Dim OvertimeCell As Range Dim OTFormCell As Range Dim LastRow As Long Dim i As Long Dim matchCount As Long Dim calledCopyMatchingXValues As Boolean ' variable to track if 'CopyMatchingXValues' was called ' Create an instance of the UserForm Set OvertimeSheet = ThisWorkbook.Sheets("Overtime") On Error Resume Next Set OvertimeRange = Application.InputBox("Select range in column C", Type:=8) On Error GoTo 0 If OvertimeRange Is Nothing Or Not OvertimeRange.Columns(1).Column = 3 Then MsgBox "No valid range selected in column C.", vbCritical Exit Sub End If Set OTFormSheet = ThisWorkbook.Sheets("OTForm") Set OTFormRange = OTFormSheet.Range("B4") LastRow = 11 matchCount = 0 calledCopyMatchingXValues = False ' initialize to False For Each OvertimeCell In OvertimeRange If OvertimeCell.Value = OTFormRange.Value Then matchCount = matchCount + 1 If matchCount > 11 Then calledCopyMatchingXValues = True ' set to True if 'CopyMatchingXValues' is called Exit For End If OTFormSheet.Cells(LastRow, "D").Value = OvertimeCell.Offset(0, 28).Value OTFormSheet.Cells(LastRow, "C").Value = OvertimeCell.Offset(0, 27).Value OTFormSheet.Cells(LastRow, "B").Value = OvertimeCell.Offset(0, 1).Value OTFormSheet.Cells(LastRow, "A").Value = OvertimeCell.Offset(0, -2).Value LastRow = LastRow + 1 End If Next OvertimeCell If calledCopyMatchingXValues Then ' only clear the values if 'CopyMatchingXValues' was called OTFormSheet.Range("D11:D" & LastRow - 1).ClearContents OTFormSheet.Range("C11:C" & LastRow - 1).ClearContents OTFormSheet.Range("B11:B" & LastRow - 1).ClearContents OTFormSheet.Range("A11:A" & LastRow - 1).ClearContents End If If matchCount > 11 Then Call CopyMatchingXValues Exit Sub End If OTFormSheet.Range("I24").Value = Date OTFormSheet.Range("I25").Value = Date Dim message As String message = OTFormSheet.Range("B4").Value & "'s overtime dates have been entered" MsgBox message, vbInformation, "OVERTIME ENTRY" ThisWorkbook.Sheets("OTForm").Activate End Sub Sub CopyMatchingXValues() MsgBox "Values found exceed space allocated for standard sheet, Extended Overtime Sheet will be used" Dim OvertimeSheet As Worksheet Dim OTFormXSheet As Worksheet Dim OvertimeRange As Range Dim OTFormXRange As Range Dim OvertimeCell As Range Dim OTFormXCell As Range Dim LastRow As Long Dim i As Long Set OvertimeSheet = ThisWorkbook.Sheets("Overtime") On Error Resume Next Set OvertimeRange = Application.InputBox("Select range in column C", Type:=8) On Error GoTo 0 If OvertimeRange Is Nothing Or Not OvertimeRange.Columns(1).Column = 3 Then MsgBox "No valid range selected in column C.", vbCritical Exit Sub End If Set OTFormXSheet = ThisWorkbook.Sheets("OTFormX") Set OTFormXRange = OTFormXSheet.Range("B4") LastRow = 11 For Each OvertimeCell In OvertimeRange If OvertimeCell.Value = OTFormXRange.Value Then OTFormXSheet.Cells(LastRow, "D").Value = OvertimeCell.Offset(0, 28).Value OTFormXSheet.Cells(LastRow, "C").Value = OvertimeCell.Offset(0, 27).Value OTFormXSheet.Cells(LastRow, "B").Value = OvertimeCell.Offset(0, 1).Value OTFormXSheet.Cells(LastRow, "A").Value = OvertimeCell.Offset(0, -2).Value LastRow = LastRow + 1 End If Next OvertimeCell OTFormXSheet.Range("I45").Value = Date OTFormXSheet.Range("I46").Value = Date Dim message As String message = OTFormXSheet.Range("B4").Value & "'s overtime dates have been entered" MsgBox message, vbInformation, "OVERTIME ENTRY" ThisWorkbook.Sheets("OTFormX").Activate End Sub
e318d77480eec22d31385a91391d869f
{ "intermediate": 0.2864243686199188, "beginner": 0.4894214868545532, "expert": 0.22415411472320557 }