我已经在 Ubuntu 桌面上运行了示例 python 代码:
import dbus, gobject
from dbus.mainloop.glib import DBusGMainLoop
from dbus.mainloop.glib import threads_init
import subprocess
from subprocess import call
gobject.threads_init()
threads_init()
dbus.mainloop.glib.DBusGMainLoop( set_as_default = True )
p = subprocess.Popen('dbus-launch --sh-syntax', shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
call( "export DBUS_SESSION_BUS_ADDRESS" , shell=True )
call( "export DBUS_SESSION_BUS_PID" , shell=True )
bus = dbus.SessionBus()
# get DBUS objects, do other stuff with SESSION_BUS
# in same time we can start more independent processes with this file
# finaly kill the SESSION_BUS process
Run Code Online (Sandbox Code Playgroud)
在桌面上成功后,我将代码移至仅使用 …
用户正在将照片上传到我们的 php 构建系统。由于内容不相关,我们将其中一些标记为禁止。I\xc2\xb4m 正在搜索“自动比较”算法的优化,该算法会跳过这些标记为禁止的照片。每次上传都需要与许多 vorbinden 进行比较。
\n\n可能的解决方案:
\n\n1/ 存储禁止的文件并比较整个内容 - 效果很好,但速度很慢。
\n\n2/存储图像文件校验和并比较校验和——这是提高速度的想法。
\n\n3/任何足够快并且可以比较照片之间相似性的智能算法。但我对 PHP 中的这些没有任何想法。
\n\n最好的解决方案是什么?
\n