我在这个代码片段中遇到"解密失败或错误记录mac"错误:
conn = psycopg2.connect(...)
cursor = conn.cursor()
cursor.execute("SELECT id, ip FROM schema.table;")
rows = cursor.fetchall()
cursor.close()
conn.commit()
conn.close()
Run Code Online (Sandbox Code Playgroud)
这在Thread的run()方法中调用,在while(True)循环中多次调用.我只是使用psycopg2驱动程序打开与PostgreSQL数据库的连接.
在Python中打开数据线连接到线程的安全性是什么?我不知道是什么引起了这个错误.
python encryption postgresql multithreading database-connection
我有一个 JSF 组件,它通过 ajax 请求通过按钮进行刷新。该组件具有按值顺序变化的图像。如果我查看网络请求,我可以看到我的浏览器没有缓存图像,而是在每次单击时请求它们。这会导致视图渲染中出现某种“弹出”现象。
我想通过缓存图像来加快刷新时间和渲染时间。我尝试在 GET 方法上使用 RequestFilter 将 Cache-Control 标头设置为“public”,但不起作用。
任何想法?
<!-- IMPLEMENTATION -->
<composite:implementation>
<h:panelGrid columns="2">
<c:choose>
<c:when test="#{cc.attrs.latencia ge cc.attrs.umbralAlto}">
<p:graphicImage value="#{resource['images:rojo.png']}"/>
</c:when>
<c:when test="#{(cc.attrs.latencia lt cc.attrs.umbralAlto) and (cc.attrs.latencia ge cc.attrs.umbralMedio)}">
<p:graphicImage value="#{resource['images:ambar.png']}"/>
</c:when>
<c:otherwise>
<p:graphicImage value="#{resource['images:verde.png']}"/>
</c:otherwise>
</c:choose>
<h:outputText value="#{cc.attrs.latencia} ms."/>
</h:panelGrid>
</composite:implementation>
Run Code Online (Sandbox Code Playgroud)
<h:body>
<h:form id="miForm">
<h:commandButton id="boton" value="Generar Latencia">
<f:ajax render="@form" event="click" listener="#{latencyBean.actualizarLatencia()}"/>
</h:commandButton>
<miscomponentes:LatencyIndicator latencia="#{latencyBean.latencia}"/>
</h:form>
</h:body>
Run Code Online (Sandbox Code Playgroud)