构建HTML表单时,为什么我们不总是使用enctype="multipart/form-data"?
我正在努力使Backbone.js Collection与服务器上发生的事情保持同步.
我的代码类似于以下内容:
var Comment = Backbone.Model.extend({});
var CommentCollection = Backbone.Collection.extend({
model: Comment
});
var CommentView = Backbone.View.extend({ /* ... */ });
var CommentListView = Backbone.View.extend({
initialize: function () {
_.bindAll(this, 'addOne', 'addAll');
this.collection.bind('add', this.addOne);
this.collection.bind('refresh', this.addAll);
},
addOne: function (item) {
var view = new CommentView({model: item});
$(this.el).append(view.render().el);
},
addAll: function () {
this.collection.each(this.addOne);
}
});
var comments = new CommentCollection;
setInterval(function () {
comments.fetch();
}, 5000);
Run Code Online (Sandbox Code Playgroud)
会发生什么事情,当提取注释时,refresh被调用,相同的注释到底部CommentListView- 这是我对上面代码的期望.
我想知道的是什么是"刷新"视图的最佳方式,而不会失去任何"本地状态".
我正在研究基于这个 Kaggle kernel的 Titanic 数据集。在我尝试使用 barplot 函数的部分,它给了我一条警告消息UserWarning: Using the barplot function without specifying order,可能会产生不正确的绘图。
我应该担心吗?
我也尝试指定 order 参数和 Hue_order 。
grid = sns.FacetGrid(train_df, col='Embarked', row='Survived', height=2.2, aspect=1.6)
grid.map(sns.barplot, 'Sex', 'Fare', alpha=0.5, ci=None, order=[1,2,3], hue_order=['Embarked', 'Survived'])
grid.add_legend()
Run Code Online (Sandbox Code Playgroud)
当我指定 order 和 hue_order 时,它给了我空的条形图。 空条形图
但是,当我取出 order 和hue_order 时,它确实给了我带有以下警告消息的图:
C:\Users\user\Anaconda3\lib\site-packages\seaborn\axisgrid.py:715: UserWarning: Using the barplot function without specifying `order` is likely to produce an incorrect plot.
warnings.warn(warning)
Run Code Online (Sandbox Code Playgroud)
有什么我应该知道的想法或提示吗?提前致谢!
在Haskell中,为什么要定义具有类型约束的函数:
ghci> :t (==)
(==) :: (Eq a) => a -> a -> Bool
Run Code Online (Sandbox Code Playgroud)
而不是定义它所以它的类型是:
ghci> :t (==)
(==) :: Eq -> Eq -> Bool
Run Code Online (Sandbox Code Playgroud) 我已经下载并安装了 ANACONDA(Anaconda3-2020.02-Windows-x86)。但是,我发现我无法启动 ANACONDA 导航器,因此我尝试使用命令行并获得了反馈。
from win32com.shell import shellcon,shell
Import Error:DLL load failed: The specified moduld could not found.
***(base) C:\WINDOWS\system32>Anaconda -navigator
Traceback (most recent call last):
File "C:\Users\aaron.wu\Anaconda3\Scripts\anaconda-script.py", line 6, in <module>
from binstar_client.scripts.cli import main
File "C:\Users\aaron.wu\Anaconda3\lib\site-packages\binstar_client\__init__.py", line 17, in <module>
from .utils import compute_hash, jencode, pv
File "C:\Users\aaron.wu\Anaconda3\lib\site-packages\binstar_client\utils\__init__.py", line 17, in <module>
from .config import (get_server_api, dirs, load_token, store_token,
File "C:\Users\aaron.wu\Anaconda3\lib\site-packages\binstar_client\utils\config.py", line 54, in <module>
USER_LOGDIR = dirs.user_log_dir
File "C:\Users\aaron.wu\Anaconda3\lib\site-packages\binstar_client\utils\appdirs.py", line 258, in user_log_dir
version=self.version)
File "C:\Users\aaron.wu\Anaconda3\lib\site-packages\binstar_client\utils\appdirs.py", line …Run Code Online (Sandbox Code Playgroud) python ×2
ajax ×1
anaconda ×1
backbone.js ×1
enctype ×1
forms ×1
haskell ×1
html ×1
javascript ×1
polling ×1