#!/usr/bin/env node
let debug = require('debug')('sbl');
let app = require('../app');
let config = require('config');
app.set('port', process.env.NODE_PORT || config.sbl.port || 15000);
let server = app.listen(app.get('port'), function() {
debug('Express server listening on port ' + server.address().port);
console.logger.debug('Express server listening on port ' + server.address().port);
});
Run Code Online (Sandbox Code Playgroud)
这是到目前为止的样子并且可以正常使用http.
我如何使它与 https 一起使用?
__index = function(tbl, key)
local a = tbl[key]
if a <=0 then a = 0 end
if a > 5 then a = 0 end
return a
end
Run Code Online (Sandbox Code Playgroud)
书中说:尽管前面的代码看起来很单纯,并且试图将表中元素的值保持在一定范围内,但是该代码会引起问题和循环引用。函数的第一行a = tbl [key]实际上会触发另一个索引函数调用,然后又将调用另一个索引函数,依此类推。
但是a = tbl [key]如何在每次调用时调用另一个索引?
--main.lua
for o = 1, 5 do
print(o)
SampleFunction()
end
Run Code Online (Sandbox Code Playgroud)
--in B.lua
function SampleFunction()
print(o) --prints nil
end
Run Code Online (Sandbox Code Playgroud)
我有一个for循环,它迭代一个范围.在for循环中,我正在调用一个其他Lua文件中的函数,我需要在其他Lua文件中访问iterator变量,但它每次只打印NIL,我需要做什么?
getImportDate <- function(){
hdfs.init()
f <- hdfs.file("/user/rstudio/rdataecommerce4.csv","r")
m <- hdfs.read(f)
c <- rawToChar(m)
data <- read.table(textConnection(c), header=TRUE , sep = ",")
print(max(data$date, na.rm=TRUE)) //ERROR AT THIS LINE
}
Run Code Online (Sandbox Code Playgroud)
我收到错误:
Error in Summary.factor(c(49L, 49L, 49L, 49L, 68L, 69L, 71L, 72L, 74L, : ‘max’ not meaningful for factors
Run Code Online (Sandbox Code Playgroud)
为什么我会收到此错误?如何解决此问题?
如何转换此命令:
curl -v -u abcdefghij1234567890:X -H "Content-Type: application/json" -X GET 'https://domain.freshdesk.com/api/v2/tickets'
Run Code Online (Sandbox Code Playgroud)
到
curl Rcurl 中的命令?
这是我的减速器的样子:
export default function catalogReducer(state = initialState.catalogItems, action){
switch (action.type) {
case types.LOAD_CATALOG_SUCCESS:
return {
count:action.count,
products :[...state['products'],
action.catalogItems ?
[...action.catalogItems['products']]
:
[]
]
default:
return state;
}
}
Run Code Online (Sandbox Code Playgroud)
我想做的事:
这是用于加载目录项的减速器
项目来自分页的 api。
问题:
我希望 state 参数应该与之前的状态相关联,但不,它总是从 initialState 获取值,我在应用程序启动时用它来初始化状态。
这是为什么?它的出路是什么?
基本上我需要通过分页api返回完整的项目集,而不仅仅是products数组中给定页面的产品。我最终得到的只是来自上次 api 调用的产品数组,因为state.products总是被初始化为空数组
另外,一般来说,我对在 react 和 redux 中处理分页 api 感到非常困惑,并且无法找到一个简单的例子。
一个方向将不胜感激。
这是 initialState.js 文件的样子:
import cookie from 'react-cookie';
export default {
categories:[],
sessionId: cookie.load('sessionId') || '',
youMayLikeItems : [],
catalogItems: {'products': []}
} …Run Code Online (Sandbox Code Playgroud) 我在R中有这行代码:
newDF <-oldDF[subsettingColumns]
Run Code Online (Sandbox Code Playgroud)
subsettingColumns有一些列名可能存在,也可能不存在oldDF.如果它不存在,我想要一个newDF用NA's 插入同一位置的列.如何在R中使用它?
https://api.aonesalons.com/dbsynch/webocitysalonpos/
Run Code Online (Sandbox Code Playgroud)
当我从POSTMAN向所提到的URL发送请求时,它工作正常.
但是,通过我的角度应用程序发送,运行在demo.aonesalons.com,
我明白了:
Failed to load https://api.aonesalons.com/dbsynch/webocitysalonpos/: The 'Access-Control-Allow-Origin' header contains multiple values '*, https://demo.aonesalons.com', but only one is allowed. Origin 'https://demo.aonesalons.com' is therefore not allowed access.
Run Code Online (Sandbox Code Playgroud)
如果我直接点击https://api.aonesalons.com/dbsynch/webocitysalonpos/in浏览器,它就可以了.但是,当从demo.aonesalons.com上运行的角度应用程序访问相同的URL时,它会抛出多个CORS头错误
在角度应用程序或直接在浏览器中点击它,我看到此请求的响应是200,具有此响应:
Access-Control-Allow-Credentials:true
Access-Control-Allow-Headers:*
Access-Control-Allow-Origin:*
Access-Control-Allow-Origin:https://demo.aonesalons.com
Access-Control-Expose-Headers:Cache-Control, Content-Type, Server
Cache-Control:must-revalidate, max-age=172800
Connection:close
Content-Length:240
Content-Type:application/json
Date:Sun, 25 Feb 2018 05:02:27 GMT
Expires:Tue, 27 Feb 2018 05:02:27 GMT
Server:CouchDB/1.6.1 (Erlang OTP/R14B04)
Run Code Online (Sandbox Code Playgroud)
当我通过邮递员打它,
access-control-allow-headers ?*
access-control-allow-origin ?*
cache-control ?must-revalidate, max-age=172800
connection ?close
content-length ?240
content-type ?text/plain; charset=utf-8
date ?Sun, 25 Feb 2018 05:11:50 …Run Code Online (Sandbox Code Playgroud) 目前,我们有以下分支机构:
Develop:内部主控Staging: 客户评论Master: 生产流量为featureBranch -> Develop -> Staging -> Master
我希望不允许直接推送到这些分支中的任何一个,而只能通过拉取请求。
由于我们很少推送到staging,master分支,因此我们一直从develop分支 创建我们的分支。
因此,在创建 PR 之前,我们develop从featureBranch.
现在,当需要合并develop到staging或stagingto时master,我们会发生冲突。我不想直接推送到这些分支,而只能通过拉取请求。
我究竟做错了什么?如何解决这个问题?
我正在使用Ambari服务器安装MYSQL,以便在ubuntu上安装hadoop。
我从Xampp安装了My Sql,并且工作正常。
set`Option关键字已从My SQL 5.6版本中删除,并且mariaDB(xampp附带)与此一致。
网站显示它与MySQL 5.6版本兼容,应该可以。
针对我发现的唯一相关链接,
当我检查我的SQL版本时:
mysql -v
The program 'mysql' can be found in the following packages:
* mysql-client-core-5.6
* mariadb-client-core-10.0
Run Code Online (Sandbox Code Playgroud)
这就是我得到的。相信链接中提到的问题在这里不是吗?
当我尝试向ambari服务器注册主机时,它会引发以下错误:
我尝试更换连接器,版本和所有可能的东西。但是我一直收到这个错误。
java.sql.SQLException: Unknown system variable 'OPTION'
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:946)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:2985)
at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1631)
at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:1723)
at com.mysql.jdbc.Connection.execSQL(Connection.java:3277)
at com.mysql.jdbc.Connection.unsetMaxRows(Connection.java:5867)
at com.mysql.jdbc.Statement.realClose(Statement.java:2070)
at com.mysql.jdbc.PreparedStatement.realClose(PreparedStatement.java:2204)
at com.mysql.jdbc.PreparedStatement.close(PreparedStatement.java:695)
at com.mchange.v1.db.sql.StatementUtils.attemptClose(StatementUtils.java:41)
at com.mchange.v2.c3p0.stmt.GooGooStatementCache.synchronousDestroyStatement(GooGooStatementCache.java:413)
at com.mchange.v2.c3p0.stmt.GooGooStatementCache.closeAll(GooGooStatementCache.java:351)
at com.mchange.v2.c3p0.impl.NewPooledConnection.closeAllCachedStatements(NewPooledConnection.java:598)
at com.mchange.v2.c3p0.impl.NewPooledConnection.close(NewPooledConnection.java:468)
at com.mchange.v2.c3p0.impl.NewPooledConnection.close(NewPooledConnection.java:191)
at com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool$1PooledConnectionResourcePoolManager.destroyResource(C3P0PooledConnectionPool.java:470)
at com.mchange.v2.resourcepool.BasicResourcePool$1DestroyResourceTask.run(BasicResourcePool.java:964)
at com.mchange.v2.async.ThreadPoolAsynchronousRunner
Run Code Online (Sandbox Code Playgroud) 我试图在页脚底部放置一个页脚。
出于某种原因出来是这样的。
在index.html中,我有:
<main flex layout="column">
<div>
<div ui-view="" ></div>
</div>
</main>
<footer>
<md-toolbar class="md-hue-2 md-scroll-shrink">
<div layout="row" layout-align="center center" flex>
Powered by Webocity Technologies
</div>
</md-toolbar>
Run Code Online (Sandbox Code Playgroud)
是否发粘,这看起来是错误的。这里似乎有什么问题以及如何解决?
my $url = "https://eutils.ncbi.nlm.nih.gov/entrez/eutils/esearch.fcgi?db=pubmed&term=journal+of+medical+virology[journal]+AND+2014[Date+-+Publication]:3000[Date+-+Publication]&usehistory=y";
print "\n before url \n";
print $url;
#post the esearch URL
my $output = get($url);
print $output;
Run Code Online (Sandbox Code Playgroud)
我以前从未使用过 perl。
如果我在浏览器中点击这个 URL,我会得到 XML。但是,从我在脚本输出中看到的内容来看,它$output是空的,并且
print $output;
Run Code Online (Sandbox Code Playgroud)
返回
Use of uninitialized value in print at ./extractEmails.pl line 48.
Run Code Online (Sandbox Code Playgroud)
请建议出了什么问题以及如何解决它
编辑:
按照建议,完整的代码:
#!/usr/bin/perl -w
# A perlscript written by Joseph Hughes, University of Glasgow
# use this perl script to parse the email addressed from the affiliations in PubMed
use strict;
use LWP::Simple;
my ($query,@queries);
#Query the Journal …Run Code Online (Sandbox Code Playgroud)