V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
V2EX  ›  lbfeng  ›  全部回复第 8 页 / 共 12 页
回复总数  227
1  2  3  4  5  6  7  8  9  10 ... 12  
2018-08-09 02:31:26 +08:00
回复了 lbfeng 创建的主题 问与答 Python twisted chian 实在没看懂这段代码
我自问自答吧。。。

`b` get a callback function after `a.callback(3)`. By checking the source code( https://github.com/twisted/twisted/blob/twisted-18.7.0/src/twisted/internet/defer.py#L438). It seems that `b` is appended an "a is waiting for b to fire" callback. Chain would stop here since function `b_callback` return deferred `b`, and `b` would be the result of `a`. Note: if result is a value instead of a deferred object, chain will continue.

`b.callback(4)` passes `4` to `a`'s next callback as an argument. `b` get a `None` as a result. The chain continues.
2018-08-07 04:44:22 +08:00
回复了 lbfeng 创建的主题 问与答 Google recaptcha v2 有方法破吗?
@xiaopc 这个应该是没希望了。
2018-08-06 01:56:27 +08:00
回复了 lbfeng 创建的主题 问与答 Google recaptcha v2 有方法破吗?
@xiaopc 这个没有 checkbox,应该是最简单的那种 recaptch。load 时会有一个 post 到 https://www.google.com/recaptcha/api2/reload?k=6Lc5LiIUAAAAAOc6kBUdT9zeODIr8oRtDslX9N88。返回的东西完全看不出和 token 有啥关系。
2018-08-05 09:20:40 +08:00
回复了 lbfeng 创建的主题 问与答 Google recaptcha v2 有方法破吗?
@EchoChan sigh
2018-07-17 08:14:04 +08:00
回复了 lbfeng 创建的主题 问与答 deep learning 工作站 or 服务器
@riggzh 服务器是公司自己攒的还是买的整机。
2018-06-01 09:18:44 +08:00
回复了 lbfeng 创建的主题 问与答 Priority Queues in Python
@caviar @jedihy 我搞错了。
2018-06-01 01:43:00 +08:00
回复了 lbfeng 创建的主题 问与答 Priority Queues in Python
@jedihy @caviar 还是可以的。q.queue 返回一个 list `[(1, 'eat'), (2, 'code'), (3, 'sleep'), (4, 'play')]` 直接改 list 里的 priorityqueue 里的值也会变。
@maichael 我知道了,一开始有 array 里有 1000 个值,有 1000 个 Contact 被 mount,keyword 变化时 array 的长度变了。多余的被 unmount,剩下的不变,虽然的有新的 props 但因为没有 getDerivedStateFromProps,所以也没被更新。不知道想的对不对。
@maichael 因为要高亮 keyword 所以还是需要在 constructor 里初始化。getDerivedStateFromProps 解决了 bug

https://stackoverflow.com/questions/41233458/react-child-component-not-updating-after-parent-state-change?utm_medium=organic&utm_source=google_rich_qa&utm_campaign=google_rich_qa

const contacts = this.state.result.map((contact, i) =>
<Contact contact={contact} key={i} keyword={this.state.query} />);
console.log(contacts);

我的问题是 contacts 这个 array 已经变了,问什么还是有之前的会显示。
同时类中的方法没有实例化就使用,是不是需要全部用 @staticmethod 修饰作为静态方法

2018-02-28 12:53:40 +08:00
回复了 leslie000666 创建的主题 程序员 想要定居国外过上影片中的日子
回答你惬意舒适的国家推荐

if has_money:
return anywhere
else:
return nowhere

对于大部分人来说,脱离了中文环境你什么都不是。
2017-12-23 11:22:42 +08:00
回复了 lbfeng 创建的主题 问与答 React native redux stateToProps 影响多个页面
在 login 里把 stateToProps islogged: state.islogged 去掉的话问题就消失了。
2017-12-23 11:18:35 +08:00
回复了 lbfeng 创建的主题 问与答 React native redux stateToProps 影响多个页面
signup 完成后 login 里的 componentWillReceiveProps 也被触发了一次。
2017-12-23 09:19:12 +08:00
回复了 lbfeng 创建的主题 问与答 React native redux stateToProps 影响多个页面
@NonClockworkChen 没用 react-navigation
2017-12-23 09:18:30 +08:00
回复了 lbfeng 创建的主题 问与答 React native redux stateToProps 影响多个页面
好像不太好形容。贴个图

https://media.giphy.com/media/xULW8pqdahzUKqBBC0/giphy.gif

login 就是 Scene 1,signup 就是 Scene 2. signup 成功后,state.islogged 就是 true,但在跳到补全资料那页时会先跳回 login 页。
2017-09-13 00:28:46 +08:00
回复了 Tianny 创建的主题 Python 半夜,问个 flask import 模块的问题。
app.config.from_object(config)

app.config['xxxx']
2017-04-09 11:23:06 +08:00
回复了 lbfeng 创建的主题 Flask 记录每一次 Request
Nginx 不能记录 user_id 之类的。
2017-03-27 11:47:36 +08:00
回复了 lbfeng 创建的主题 Flask sqlalchemy 合并 query 实现
好吧,我想多了。 query_1.union(query_2)就可以。
2017-03-27 11:32:28 +08:00
回复了 lbfeng 创建的主题 Flask sqlalchemy 合并 query 实现
@xyjtou 之前采用了方法 2 。最近这个问题又出现了。感觉方法二不够好。
```
query_1 = T1.query.filter(T1.attr_1 == value1, T1.attr_2 == T2.attr, T2.attr == value_2)
query_2 = T1.query.filter(T1.attr_1 == value3, T1.attr_3 == T4.attr, T3.attr == value_4)
```

```
T1.query.filter(_or((T1.attr_1 == value1, T1.attr_2 == T2.attr, T2.attr == value_2),
(T1.attr_1 == value3, T1.attr_3 == T4.attr, T3.attr == value_4))
```
这样又会出错。
1  2  3  4  5  6  7  8  9  10 ... 12  
关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   1848 人在线   最高记录 6543   ·     Select Language
创意工作者们的社区
World is powered by solitude
VERSION: 3.9.8.5 · 27ms · UTC 00:26 · PVG 08:26 · LAX 17:26 · JFK 20:26
Developed with CodeLauncher
♥ Do have faith in what you're doing.