背景:我正在开发一个名为ActivityWatch的软件,它可以记录您在计算机上执行的操作.基本上是尝试解决一些问题:RescueTime,selfspy,arbtt等.
我们做的核心事情之一是关于活动窗口(类和标题)的日志信息.在过去,这已经在Linux上使用xprop和现在的python-xlib而没有问题.
但现在我们遇到了一个问题: Wayland正在崛起,据我所知,Wayland没有一个活跃窗口的概念.因此,我担心我们必须为Wayland可用的每个桌面环境实施支持(假设它们将提供获取有关活动窗口的信息的能力).
希望他们最终能够融合并拥有一些共同的界面来完成这项工作,但我并没有屏住呼吸......
我一直在期待这个问题.但今天我们得到了Wayland用户对Wayland支持的第一个用户请求.由于较大的发行版采用Wayland作为默认的显示服务器协议(Fedora 25已经在使用它,Ubuntu将在17.10中切换即将推出)随着时间的推移情况将变得更加重要.
ActivityWatch的相关问题:
还有其他应用程序,如ActivityWatch需要相同的功能(RescueTime,arbtt,selfspy等),他们似乎现在似乎不支持Wayland,我找不到任何有关他们计划这样做的细节.
我现在有兴趣实现对Gnome的支持,从而开始并跟进其他人,因为路径变得更加清晰.
这里有一个类似的关于韦斯顿的问题:在wayland weston中获取活动窗口的列表
编辑:我在Freenode的#wayland问道,得到了以下回复:
15:20:44 ErikBjare Hello everybody. I'm working on a piece of self-tracking software called ActivityWatch (https://github.com/ActivityWatch/activitywatch). I know this isn't exactly the right place to ask, but I was wondering if anyone knew anything about getting the active window in any Wayland-using DE.
15:20:57 ErikBjare Created a question on SO: https://stackoverflow.com/questions/45465016/how-do-i-get-the-active-window-on-gnome-wayland
15:21:25 ErikBjare Here's …Run Code Online (Sandbox Code Playgroud) 我正在尝试重新训练最后一层inception-resnet-v2.这是我想出的:
train_op以尽量减少这些变量损失我实现如下:
with slim.arg_scope(arg_scope):
logits = model(images_ph, is_training=True, reuse=None)
loss = tf.reduce_mean(tf.nn.sparse_softmax_cross_entropy_with_logits(logits, labels_ph))
accuracy = tf.contrib.metrics.accuracy(tf.argmax(logits, 1), labels_ph)
train_list = tf.get_collection(tf.GraphKeys.TRAINABLE_VARIABLES, 'InceptionResnetV2/Logits')
optimizer = tf.train.AdamOptimizer(learning_rate=FLAGS.learning_rate)
train_op = optimizer.minimize(loss, var_list=train_list)
# restore all variables whose names doesn't contain 'logits'
restore_list = tf.get_collection(tf.GraphKeys.TRAINABLE_VARIABLES, scope='^((?!Logits).)*$')
saver = tf.train.Saver(restore_list, write_version=tf.train.SaverDef.V2)
with tf.Session() as session:
init_op = tf.group(tf.local_variables_initializer(), tf.global_variables_initializer())
session.run(init_op)
saver.restore(session, '../models/inception_resnet_v2_2016_08_30.ckpt')
# followed by code for running train_op
Run Code Online (Sandbox Code Playgroud)
这似乎不起作用(训练损失,错误从初始值不会有太大改善).有没有更好/更优雅的方式来做到这一点?如果你能告诉我这里出了什么问题,那对我来说也不错.
所以,今天我决定尝试朱莉娅而且我遇到了一些奇怪的事情,我无法理解其原因,也没有找到适合我的搜索查询的答案所以我在这里......
首先,我想要对Python进行基准测试,我决定使用这个非常简单的代码.
def test():
start = time()
a = 1
while a < 10000000:
a+=1
print(time() - start)
Run Code Online (Sandbox Code Playgroud)
在我的机器上用Python 3.3执行大约需要0.9秒.然后我在朱莉娅跑了以下.
start = time()
a = 1
while a < 10000000
a+=1
end
print(time() - start)
Run Code Online (Sandbox Code Playgroud)
执行需要约0.7秒.所以我得出结论,Julia中的简单算术性能是〜= Python.
然而,当我把它变成一个函数时,我偶然发现了一个我没想到的奇怪的东西,这让我的结果变得不可思议.
function test_arithmetic()
start = time()
a = 1
while a < 10000000
a+=1
end
print(time() - start)
end
test_arithmetic()
Run Code Online (Sandbox Code Playgroud)
这个codenippet只需要0.1秒执行,为什么会这样?
我正在尝试使用MtGox.com WebSocket API进行身份验证,并在很长一段时间内设法完成JSON数据所需的"调用"属性.但是,我意识到我使用Python 2来运行我的代码示例,最终将实现的API应用程序是用Python 3编写的.当我试图使它在Python 3中工作时,我遇到了几个问题我尽管经过了几次长时间的努
我也尝试过2to3,但似乎没有针对这些问题的内置修复程序.
可以在此处找到经过身份验证的API调用的API规范:https: //en.bitcoin.it/wiki/MtGox/API/Streaming#Authenticated_commands
这是我用于生成JSON调用的Python 2脚本,然后我通过我为Chrome找到的WebSocket控制台扩展来运行.
import hashlib
import time
import hmac
import json
import base64
import binascii
apikey = ""
apisecret = ""
def _nonce():
"""produce a unique nonce that is guaranteed to be ever increasing"""
microtime = int(time.time() * 1E6)
return microtime
def _reqid(nonce):
return hashlib.md5(str(nonce)).hexdigest()
def send_signed_call(api_endpoint, params):
nonce = _nonce()
reqid = _reqid(nonce)
call = json.dumps({
"id" : reqid,
"nonce" : nonce,
"call" : api_endpoint,
"params" : …Run Code Online (Sandbox Code Playgroud)