有导航栏,可以在菜单中隐藏它.但是,在最后一个版本中,IntelliJ IDEA增加了另一种类型的导航栏.
它看起来像一个编辑器排水沟,但放在活动编辑器的顶部.它显示具有当前插入位置的类和方法的名称.
有没有办法隐藏它?
我react-scripts-ts用来生成React App并提供TSLint.
似乎没有选择告诉react-scripts-ts从构建管道中排除TSLint.是否可以通过禁用TSLint tslint.json?
PS
可以通过向文件添加注释来禁用它,但我不想将此注释添加到项目中的每个TS文件.
有一个功能 h(x) = ([1, x]' * [2, 3])[1]
让我们假设我想绘制并获得X和Y.一种可行的方法是遵循
X = [1 2 3]
Y = [h(xi) for xi in X]
Run Code Online (Sandbox Code Playgroud)
但是,看起来在Julia中使用elementwise运算符也可以这样做吗?
不幸的是,使用点添加函数前缀.h(X)不起作用.
如何在Julia中获得Array/Vector/Matrix的最小值?
这段代码min([1, 2, 3])不起作用......
我正试图在朱莉娅的Coursera做Logistic回归,但它不起作用.
用于计算渐变的Julia代码:
sigmoid(z) = 1 / (1 + e ^ -z)
hypotesis(theta, x) = sigmoid(scalar(theta' * x))
function gradient(theta, x, y)
(m, n) = size(x)
h = [hypotesis(theta, x[i,:]') for i in 1:m]
g = Array(Float64, n, 1)
for j in 1:n
g[j] = sum([(h[i] - y[i]) * x[i, j] for i in 1:m])
end
g
end
Run Code Online (Sandbox Code Playgroud)
如果使用此梯度,则会产生错误的结果.无法弄清楚原因,代码似乎是正确的.
该全朱莉娅脚本.在此脚本中,使用我的Gradient Descent实现和使用内置Optim包计算出最佳Theta,结果不同.
假设您有一些相当复杂的node.js服务,有一天您会在其日志中看到类似的内容:
Error: getaddrinfo ENOTFOUND not-existing-host.com not-existing-host.com:80
at errnoException (dns.js:28:10)
at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:76:26)
Run Code Online (Sandbox Code Playgroud)
注意 - 没有堆栈跟踪.如果您的服务中有大量的地方进行http调用,您会如何找到地点错误?
是否有任何解决方案可以保持堆栈跟踪(我不关心性能影响,干净的堆栈跟踪更重要)?
似乎require('longjohn')可以帮助,但它在某种程度上工作不是非常可靠,有时不打印堆栈跟踪(不能创建一个示例来证明)是否有任何其他解决方案?
将生成此类错误的代码示例.我使用http作为示例,但对于任何异步函数都是如此.
const request = require('request');
// Let's say we write some helper function that wraps "request.js"
async function get(url) {
return new Promise((resolve, reject) => {
request(url, function (error, response, body) {
error ? reject(error) : resolve(body)
})
})
}
// Running
async function run() {
console.log(await get('http://not-existing-host.com'))
}
run()
.catch((e) => {
console.log(e.stack) …Run Code Online (Sandbox Code Playgroud) Apollo GraphQL的Mocking示例具有以下代码(见下文).
有趣的是最后一行 - 他们创建并执行graphql查询.但是你通常需要创建ApolloClient对象.我无法弄清楚如何做到这一点.
ApolloClient期望NetworkingInterface作为参数而不是可执行模式.
那么,有没有办法从可执行模式创建ApolloClient,没有NetworkingInterface?
import { makeExecutableSchema, addMockFunctionsToSchema } from 'graphql-tools';
import { graphql } from 'graphql';
// Fill this in with the schema string
const schemaString = `...`;
// Make a GraphQL schema with no resolvers
const schema = makeExecutableSchema({ typeDefs: schemaString });
// Add mocks, modifies schema in place
addMockFunctionsToSchema({ schema });
const query = `
query tasksForUser {
user(id: 6) { id, name }
}
`;
graphql(schema, query).then((result) => console.log('Got result', result));
Run Code Online (Sandbox Code Playgroud) 可以使用以下方法创建多变量分布:
using Distributions
rand(MvNormal([1, 1.], [1 .5; .5 1]), 2)
Run Code Online (Sandbox Code Playgroud)
但它不适用于整数:
using Distributions
rand(MvNormal([1, 1], [1 .5; .5 1]), 2)
Run Code Online (Sandbox Code Playgroud)
为什么?
PS第二个例子会抛出一个错误:
LoadError: MethodError: `convert` has no method matching convert(::Type{Distributions.MvNormal{Cov<:PDMats.AbstractPDMat{T<:AbstractFloat},Mean<:Union{Array{Float64,1},Distributions.ZeroVector{Float64}}}}, ::Array{Int64,1}, ::Array{Float64,2})
This may have arisen from a call to the constructor Distributions.MvNormal{Cov<:PDMats.AbstractPDMat{T<:AbstractFloat},Mean<:Union{Array{Float64,1},Distributions.ZeroVector{Float64}}}(...),
since type constructors fall back to convert methods.
Closest candidates are:
Distributions.MvNormal(!Matched::Array{Float64,1}, ::Array{Float64,2})
call{T}(::Type{T}, ::Any)
convert{T}(::Type{T}, !Matched::T)
...
while loading In[113], in expression starting on line 2
in call at essentials.jl:57
Run Code Online (Sandbox Code Playgroud) julia ×4
asynchronous ×1
distribution ×1
erlang ×1
gradient ×1
graphql ×1
javascript ×1
node.js ×1
react-apollo ×1
statistics ×1
tslint ×1