现在有很多关于redux镇最新孩子的讨论,redux-saga/redux-saga.它使用生成器函数来监听/调度操作.
在我绕过它之前,我想知道redux-saga
使用redux-thunk
async/await时使用的优点/缺点而不是下面的方法.
组件可能看起来像这样,像往常一样调度动作.
import { login } from 'redux/auth';
class LoginForm extends Component {
onClick(e) {
e.preventDefault();
const { user, pass } = this.refs;
this.props.dispatch(login(user.value, pass.value));
}
render() {
return (<div>
<input type="text" ref="user" />
<input type="password" ref="pass" />
<button onClick={::this.onClick}>Sign In</button>
</div>);
}
}
export default connect((state) => ({}))(LoginForm);
Run Code Online (Sandbox Code Playgroud)
然后我的行为看起来像这样:
// auth.js
import request from 'axios';
import { loadUserData } from './user';
// define constants
// define initial state
// export default reducer …
Run Code Online (Sandbox Code Playgroud) 我在Centos 6上安装了Nginx,我正在尝试设置虚拟主机.我遇到的问题是我似乎无法找到该/etc/nginx/sites-available
目录.
为了创造它,我需要做些什么吗?我知道Nginx正在运行,因为我可以浏览它.
我正在努力为<Link/>
我的材料添加组件-ui AppBar
这是我的导航类:
class Navigation extends Component {
constructor(props) {
super(props)
}
render() {
var styles = {
appBar: {
flexWrap: 'wrap'
},
tabs: {
width: '100%'
}
}
return (
<AppBar showMenuIconButton={false} style={styles.appBar}>
<Tabs style={styles.tabs}>
<Tab label='Most popular ideas'/>
<Tab label='Latest ideas' />
<Tab label='My ideas' />
</Tabs>
</AppBar>
)
}
}
Run Code Online (Sandbox Code Playgroud)
标签是可点击的,有流畅的动画,这很酷.但是如何将它们react-router
和它的<Link/>
组件连接在一起?
我试过添加这样的onChange
监听器:
<Tab
label='My ideas'
onChange={<Link to='/myPath'></Link>}
/>
Run Code Online (Sandbox Code Playgroud)
但是我收到以下错误:
Uncaught Invariant Violation: Expected onChange listener to be a …
Run Code Online (Sandbox Code Playgroud) 我正在使用ASP.NET Core Identity创建一个新用户,如下所示:
new User {
Email = "john@company.com",
Name = "John"
}
await userManager.CreateAsync(user, "password");
Run Code Online (Sandbox Code Playgroud)
我需要在创建用户时添加声明.我试过了:
new User {
Email = "john@company.com",
Name = "John",
Claims = new List<Claim> { /* Claims to be added */ }
}
Run Code Online (Sandbox Code Playgroud)
但Claim属性是只读的.
做这个的最好方式是什么?
我正在努力在我的Windows 10机器上安装Ansible Python软件包.
我不需要Ansible在我的机器上运行,这纯粹是为了我的Windows主机上的开发目的.稍后将在Linux计算机上发出所有命令.
运行后:
pip install ansible
Run Code Online (Sandbox Code Playgroud)
我得到以下异常:
命令"c:\ users\evaldas.buinauskas\appdata\local\programs\python\python37-32\python.exe -u -c"import setuptools,tokenize; __ file __ ='C:\ Users\evaldas.buinauskas\AppData\Local\Temp\pip-install-hpay_le9\_ ansible\setup.py'; f = getattr(tokenize,'open',open)(__ file __); code = f.read().replace('\ r \n', '\n'); f.close(); exec(compile(code,__ file __,'exec'))"install --record C:\ Users\evaldas.buinauskas\AppData\Local\Temp\pip-record-dvfgngpp\install-record.txt --single-version-external-managed --compile"失败,错误代码1在C:\ Users\evaldas.buinauskas\AppData\Local\Temp\pip-install-hpay_le9\ansible \
还有一个重复的例外,我认为是根本原因:
错误:无法复制'lib\ansible\module_utils\ansible_release.py':不存在或不存在常规文件
这个GitHub问题说应该可以安装,而不是运行它.这基本上就是我真正需要的.
我试图运行CMD/PowerShell中/ Cygwin的作为管理员,并没有帮助.
此外,还有一个答案告诉如何在Windows上安装它:如何克服 - 在windows上使用文件名或扩展名失败的pip install ansible太长了
但我真的不明白如何获得Ansible包的wheel文件.
我目前正在SQL Server中运行文本搜索,这正成为瓶颈,出于显而易见的原因,我想将其移至Elasticsearch,但是我知道我必须对数据进行非规范化才能获得最佳性能和可伸缩性。
目前,我的文本搜索包括一些聚合和联接多个表以获得最终输出。联接的表不是很大(每个表最多20GB),但是会不定期地更改(插入,更新,删除)(其中两个每周一次,另一个x
每天一次)。
我的计划是将Apache Kafka与Kafka Connect一起使用,以便从我的SQL Server中读取CDC,在Kafka中加入此数据并将其保留在Elasticsearch中,但是我找不到任何资料可以告诉我在处理数据时如何处理删除操作坚持使用Elasticsearch。
默认驱动程序甚至支持吗?如果没有,有什么可能?Apache Spark,Logstash?
如何在我的应用程序的任何部分中获取Shiro框架中的cacheManager对象的引用?例如,我想删除在删除用户或更新其权限期间缓存的旧用户数据.现在我按照以下方式处理它
public void cleanUserCache(final String userName) {
final EmbeddedCacheManager embeddedCacheManager = securityRealmsProducer.getEmbeddedCacheManger();
final Cache<Object, Object> authenticationCache = embeddedCacheManager.getCache("JPA-Auth-Realm.authenticationCache");
final Cache<Object, Object> authrizationCache = embeddedCacheManager.getCache("JPA-Auth-Realm.authorizationCache");
final Object userAuthenticationInfo = authenticationCache.get(userName);
if (userAuthenticationInfo != null) {
authenticationCache.remove(userName);
final SimpleAuthenticationInfo principle = (SimpleAuthenticationInfo) userAuthenticationInfo;
final SimplePrincipalCollection simple = (SimplePrincipalCollection) principle.getPrincipals();
authorizationCache.remove(simple);
}
}
Run Code Online (Sandbox Code Playgroud) I'm in progress of optimizing search queries performance and I'm following recommendations from https://www.elastic.co/guide/en/elasticsearch/reference/7.7/tune-for-search-speed.html
Query does the following:
One of the cheapest optimizations suggested is rounding dates to improve query caching. I've rounded time down to minutes at application level.
Another cheap optimization was mapping identifiers as keywords
I've tried both and none of them made …
最近我发现,通过单击SSMS工具栏上的按钮,可以选择包含最常用的查询.
您可以按照以下步骤执行此操作:
但是我正在努力解决如何添加需要执行的实际过程.
可以选择添加多个SP:
sp_help
sp_lock
sp_who
例如,如何指定我的程序Custom SP 1
?
要明确:我的目标是在SSMS工具栏中有一个按钮,它可以在点击时执行我想要的程序(查询).
这是我的存储过程:
ALTER PROCEDURE [dbo].[sp_Update_Projecttijden]
@tabelnaam NVARCHAR(30) ,
@starttijd DATETIME,
@eindtijd DATETIME,
@tijd FLOAT,
@startid INT,
@eindid INT
AS
BEGIN
-- SET NOCOUNT ON added to prevent extra result sets from
-- interfering with SELECT statements.
SET NOCOUNT ON;
-- Insert statements for procedure here
-- DECLARE @DATEVARCHAR NVARCHAR(4000);
DECLARE @SQLCommand NVARCHAR(MAX) = N'
UPDATE ' + QUOTENAME(@tabelnaam) + N'
SET Start = @starttijd
, Einde = @eindtijd
, Tijd = @tijd
, StartID = @startid
, EindID = @eindid
WHERE …
Run Code Online (Sandbox Code Playgroud) javascript ×2
reactjs ×2
sql-server ×2
ansible ×1
apache-kafka ×1
asp.net-core ×1
c# ×1
centos ×1
java ×1
material-ui ×1
nginx ×1
pip ×1
python ×1
react-router ×1
redux ×1
redux-saga ×1
redux-thunk ×1
shiro ×1
sql ×1
ssms ×1
ssms-2014 ×1
ssms-2016 ×1
virtualhost ×1