ylliX - Online Advertising Network

Import Keras np.complex_ was removed

When I try to import keras or import tensorflow I get this error “AttributeError: np.complex_ was removed in the NumPy 2.0 release. Use np.complex128 instead.” I tried changing the numpy version several times and similar solutions, but they all do not work or break something else. Sometimes it works though strangely but that’s not good […]

Scapy: How to get an Ether frame in bytes

I am capturing a single package using scapy: from scapy.all import * while True: data = sniff(iface=”lo”, count = 1) Then I try to convert the resulting object into bytes: print(raw(data)) And I’m getting an error: TypeError: ‘Ether’ object cannot be interpreted as an integer I need to capture a packet and store it in […]

Cosine similarity between three text files

I have three .txt files that contain text (they are novels). I need to compute the cosine similarity between the three texts and then produce a multi-dimensional graph that places the 3 texts in relation to each other based on cosine sim scores. The final output should be the graph. This is what my text […]

PyQT5: Center Align a label in a window

I’m very new to PyQT5 and I am just attempting to get a center aligned image in a window. Setting the alignment with label.setAlignment(QtCore.Qt.AlignCenter) does not seem to change anything from the default left alignment. What am I doing wrong? class ImageLabel(QLabel): def __init__(self, parent=None): super().__init__(parent) def setPixmap(self, pixmap): super().setPixmap(pixmap) self.resize(self.pixmap().size()) class Window(QMainWindow): def __init__(self,imageName, […]

Python FastAPI. How to disable response headers name to be converted to lower case

I am using FastAPI for building an application. I have the place where i set some custom response headers. There is the standard example from FastAPI docs from fastapi import FastAPI, Response app = FastAPI() @app.get(“/headers-and-object/”) def get_headers(response: Response): response.headers[“X-Cat-Dog”] = “alone in the world” return {“message”: “Hello World”} fastapi dev test.py –host 0.0.0.0 –port […]

Script Works in Non-Headless Mode but Fails in Headless Mode with “Element Not Found” Error

I’m using SeleniumBase in Python to automate interactions on a webpage. My script runs perfectly in non-headless mode, but when I set it to headless (headless=True or headless2=True), it fails to find certain elements, particularly #card-lib-selectCompany-change, even after multiple scrolling attempts. Here’s the relevant part of my code from seleniumbase import SB def scrape_servipag_service_reading(service_type, company, […]

In PyQT 5, always show a QCombobox using QStyledItemDelegate in QTableView (Not just when a cell is being edited)

I’m subclassing QStyledItemDelegate to show a dropdown QCombobox in a QTableView. The delegate detects the dataType from the table’s model, and if the dataType == EnumMeta, shows a dropdown list of options. With my current implementation, the dropdown is only displayed after a user double clicks a table cell. The user must then click the […]

Show product name in template django

I want to show all of the user orders in its panel so, I have following models: this is my product model in django and in my order model I have productfk field that is id of user product. class Product(models.Model): id= models.IntegerField(primary_key=True) activedate = models.DateField() name= models.CharField(max_length=256) description = models.TextField() #following u can set […]