cursor in mysql.connector in python keep disconnected

I’m trying to log data to table in MySQL. First function is to connect the database, second is to create table, third one is to actually log data. But after connect to database from first function, other functions can’t connect the cursor. I tried to put create table in first function and it works fine, … Read more

render firebase data in the backend angular 17 ssr

I’m using firebase for an angular 17 projects and I have activated the ssr module in the creation of the project, now I get the data from firebase but it isn’t rendering when I open Page Source, I know for http you use withHttpTransferCacheOptions but how I’m going to do it for firebase call? const … Read more

TBB parallel_sort is slow for huge std::vector

Given an std::vector containing 5k CGAL::Line_2, I need to compute all the intersection points and sort them in increasing lexicographic order. I am using exact arithmetic, in particular Exact_predicates_exact_constructions_kernel. I tried the following code: using Point2 = CGAL::Exact_predicates_exact_constructions_kernel::Point_2; std::vector<Point2> vertices; vertices.resize(lines.size() * (lines.size() – 1)); std::atomic<size_t> counter{ 0 }; { std::cout << “START vertices” << … Read more

Using DataProvider in ReactAdmin, how to fix an errorr: the expected type comes from the return type of this signature

I’m following the tutorial to implement dataprovider in react-admin. Here is the link: https://marmelab.com/react-admin/Tutorial.html#connecting-to-a-real-api Below is the sample implementation of tutorial create: (resource, params) => httpClient(`${apiUrl}/${resource}`, { method: ‘POST’, body: JSON.stringify(params.data), }).then(({ json }) => ({ data: { …params.data, id: json.id }, })), But in typescript it raise an error the expected type comes from … Read more

Python Beginner level [closed]

Closed. This question needs debugging details. It is not currently accepting answers. Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question. Closed yesterday. This post was edited and submitted for review 22 hours ago and failed … Read more

When one condition is satisfied, I don’t want the other if condition to be conducted (python)

def creation_time_of_files(folder_path, selected_date): for filename in os.listdir(folder_path): file_path = os.path.join(folder_path, filename) # print(file_path) if os.path.isfile(file_path) and filename.endswith(“.txt”): creation_time = os.path.getctime(file_path) formatted_time = datetime.fromtimestamp( creation_time).strftime(“%Y-%m-%d”) if selected_date==date.today().strftime(“%Y-%m-%d”): if formatted_time==selected_date: with open(file_path, ‘r’) as file: #when there’s today’s diary content = file.read() file_window = tk.Toplevel(new_window2) lab = tk.Label(file_window, text=str(content)) lab.pack() elif formatted_time!=selected_date: #there’s no today’s diary real_diarypage() … Read more

create maptype using ordered dictioanry

I am trying to convert an ordered dict into a pyspark MapType. from pyspark.sql.functions import create_map, lit from pyspark.sql import SparkSession from collections import OrderedDict # Sample ordered dictionary ordered_dict = OrderedDict([(‘a’, 1), (‘b’, 2), (‘c’, 3)]) create_map([lit(k) for k in ordered_dict.keys()], [lit(v) for v in ordered_dict.values()]) gives an error: TypeError: Invalid argument, not a … Read more

web scraping with loop pages is not working [closed]

Closed. This question needs debugging details. It is not currently accepting answers. Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question. Closed yesterday. Improve this question I want to do web scraping and make it on … Read more