Skip to main content

Posts

a DOM belongs to another html page. javascript [duplicate]

I am working on a project(a simple website). This website has multiple pages.I have a question: For example, if I am on page "index.html", I get this error for the dom element which is on another page "blog.html" and the code after the part where I got the error does not work: "Uncaught ReferenceError: context_text is not defined" . I solved this problem for the parts where I got errors as follows: if(content_text != null){ x.addeventListener... } but I don't think this is the right solution. my question is: what is the right solution for this problem? another question: should i create separate .js files for each page? Via Active questions tagged javascript - Stack Overflow https://ift.tt/XzfpWjk

Adding PDF values and export values to ComboBox using PyMuPDF

I am currently looking to set a face and export value to a PDF combobox using the good PyMuPDF module but I can't find the way. Normally, using Adobe API Javascript it would be something like this : f.setItems( ["Ohio", "OH"], ["Oregon", "OR"], ["Arizona", "AZ"] ); I am wondering if I it would be possible to apply something like this: import fitz myPDFfile = r"C:\temp\myPDFfile.pdf" with fitz.open(myPDFfile) as doc: for page in doc: widgets = page.widgets() for widget in widgets: if widget.field_type_string in ('ComboBox'): print('widget.field_name', widget.field_name, 'widget.field_value', widget.field_value) if widget.field_name == 'ComboBox1': print('widget.field_name',widget.field_name) widget.choice_values=( ["Ohio", "OH"], ["Oregon&q

How do i make a modbus simulation?

I am trying to make a Modbus simulation in python and a Modbus client to read the values from the server. But i keep getting this error: Here is my server code: import random from pymodbus.datastore import ModbusSequentialDataBlock, ModbusSlaveContext, ModbusServerContext from pymodbus.server.async_io import StartTcpServer from pymodbus.server.async_io import ModbusTcpServer # Define the Modbus registers coils = ModbusSequentialDataBlock(1, [False] * 100) discrete_inputs = ModbusSequentialDataBlock(1, [False] * 100) holding_registers = ModbusSequentialDataBlock(1, [0] * 100) input_registers = ModbusSequentialDataBlock(1, [0] * 100) temperature_values = [random.uniform(4, 15) for _ in range(7)] flow_values = [random.uniform(-1, 1) for _ in range(2)] holding_registers.setValues(0, temperature_values) holding_registers.setValues(10, flow_values) # Define the Modbus slave context slave_context = ModbusSlaveContext( di=discrete_inputs, co=coils, hr=holding_registers,

Is there a way to add an event listener to a text node?

For work I need to check if some text was clicked, then in the spot that was clicked append an 'anchor' for a sticky note. So I would like to add an event listener to the text node so that way the function will only run if text is clicked. Th event listener is currently on the text nodes container which is causing issues if you click inside the container, but not on text nothing will happen. Is there a way to only add an event listener to the text or another work around to find out if text was clicked on? Via Active questions tagged javascript - Stack Overflow https://ift.tt/tIM3nLv

window.print() duplicating pages on JS

I'm using a function to print a Modal, and it's returning with a duplicate. The Function: function printElement(btnVal) { // $('.abrirLogs').trigger( "click" ); // REMOVE OS ELEMENTOS DESNECESSÁRIOS $('html').find('.remove_on_print').remove(); // VERIFICA QUAL A DESPESA QUE ESTÁ SENDO VISUALIZADA $('html').find('.despCard').each(function (i, val) { if ($(this).css('display') == 'none') { $(this).remove(); } }); document.title = `Relatório do Pedido de Despesa # ${$('#pedidoIdentif').val()} - Despesa ${$('.despCount'+btnVal).val()}`; parent.$('title').get(0).innerHTML = 'relatorio_pedido_despesa' + $('#despID').val(); console.log(window); window.print(); parent.$('title').get(0).innerHTML = 'Pedidos Aprovados'; location.reload(); return true; }; [ The print popup images: ]( https://i.stack.imgur.com/xHdVq.png ) I've look

Can't install PyQt5 using pip on alpine docker

Here is my Dockerfile: FROM python:3.11-alpine AS app RUN apk update && apk add make automake gcc g++ subversion python3-dev gfortran openblas-dev RUN pip install --upgrade pip WORKDIR /srv When I connect to my container and I launch: pip install pyqt5 I got error: $ pip install pyqt5 Collecting pyqt5 Using cached PyQt5-5.15.9.tar.gz (3.2 MB) Installing build dependencies ... done Getting requirements to build wheel ... done Preparing metadata (pyproject.toml) ... error error: subprocess-exited-with-error × Preparing metadata (pyproject.toml) did not run successfully. │ exit code: 1 ╰─> [25 lines of output] Traceback (most recent call last): File "/usr/local/lib/python3.11/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 353, in <module> main() File "/usr/local/lib/python3.11/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 335, in main

handleCategoryClick and handleSearchChange in React app are not retaining the funcionality across different components [duplicate]

The handleCategoryClick and handleSearchChange functions function correctly on the landing page. The navigation to the Testing or Articles components also works as expected. Once in the Testing component, I can see the content "Hello" along with the <div className="nav-scroller py-1 mb-2 custom-class1"> that contains the categories and the search bar. Unfortunately, if I try to use the handleCategoryClick function within the Testing component, it does not work. The same issue occurs with the search bar as well, where typing something does not trigger any action. Another issue is that when I click on any category, such as "Mexico" it displays the corresponding cards as expected. However, if I try to use the search bar, it doesn't work properly. It only shows me the results from the selected category. I passes the functions as props to the components, still do not work. What I expect is that when I navigate to the Testing component, I shou