小编Elo*_*nco的帖子

Node.js的Heroku工作者

我从Heroku开始,我有一个webapp,其中一部分需要每周运行一次(周一最好).我一直在读一些关于工人的事情:这里,这里这里 ......但我还是有很多疑惑:

1)这些工人在没有严格控制的情况下在背景上运行,不能安排每周运行一次.或者我错了?如果我错了,我怎么安排它?

2)为了使它们起作用,我到底需要做什么?类型

 web:     node webApp.js
 worker:  node worker.js
Run Code Online (Sandbox Code Playgroud)

在Procfile中(其中worker.js是程序的一部分,每周只需运行一次).这就是全部?? 没有其他的??太简单??

3)最后一个......但最重要的是."鳞片般的钱"......一个dyno和一个工人一样,所以如果你有一个dyno在网上运行你需要为工人买另一个......不是吗?在价格清单上额外的dyno花费34.5 $(27.87€).它不便宜...所以我想知道我是否正确,如果你想要一个工人,是否有必要买一个dyno?

heroku worker node.js

8
推荐指数
1
解决办法
3129
查看次数

Android versionCode以编程方式

有没有办法动态和编程地知道Android应用程序的versionCode?

我不知道......也许是这样的

 getApplicationContext.getVersionCode();
Run Code Online (Sandbox Code Playgroud)

非常感谢你.

android android-version

6
推荐指数
1
解决办法
5480
查看次数

如何在不同于lib(Elixir)的路径中加载文件

我试图在测试中使用帮助程序执行任务.我的文件夹结构是这样的:

config/
lib/
test/
test/test_helper.exs
test/provider_test/(the test files are here)
Run Code Online (Sandbox Code Playgroud)

而现在我想做的就是这个

config/
lib/
test/
test/test_helper.exs
test/provider_test/(the test files are here)
test/provider_test/helpers/(the helpers files... more or less, one for helper)
Run Code Online (Sandbox Code Playgroud)

我尝试使用它(在测试中):

HelperModuler.calling_function(args)
Run Code Online (Sandbox Code Playgroud)

但我得到这个错误:

 (UndefinedFunctionError) undefined function HelperModuler.calling_function/1 (module HelperModuler is not available)
Run Code Online (Sandbox Code Playgroud)

testing elixir

5
推荐指数
2
解决办法
1642
查看次数

混合(elixir)没有这样的文件或目录

我想在Ubuntu安装灵药......我曾跟随这个指令

一切似乎都很好,但是当我尝试执行混合命令时,系统向我显示以下内容:

bash: /usr/bin/mix: No such file or directory
Run Code Online (Sandbox Code Playgroud)

谢谢。

elixir-mix elixir

5
推荐指数
1
解决办法
2060
查看次数

从数组javascript中删除元素(相反的交集)

昨天nigth我做了这个问题从数组javascript中删除元素 但我错了,我的解释和我的例子是关于两个数组之间的交集.
我想问的是如何删除阵列上不存在于其他阵列上的元素.
示例:

Array A=> [a, b, c, d]  
Array B=> [b, d, e]  
Array C= removeElementsNotIn(A, B);  
Array C (after function)-> [a,c]
Run Code Online (Sandbox Code Playgroud)

非常感谢你.

javascript arrays

4
推荐指数
1
解决办法
1151
查看次数

在mongoDB上搜索子字段

可以在mongDB查询中搜索子元素吗?例如,

find({field.subfield:'value'}, function(err, doc){...});
Run Code Online (Sandbox Code Playgroud)

或者做类似的事情...

谢谢。

mongoose mongodb node.js

3
推荐指数
1
解决办法
754
查看次数

golang的多响应异步请求

我需要向服务器发出请求,该请求在不同时间返回不同的响应。我的意思是,服务器生成不同的响应,并且这些响应需要不同的执行时间,因此服务器会在响应可用时立即返回响应。

我想在服务器返回给我后立即在屏幕上打印这些响应(目前,我会解决这个问题)。

到目前为止我能做的就是打印响应,但前提是服务器返回所有响应。因此,如果第一个响应需要 1 秒,最后一个响应需要 10 秒,那么我的代码需要等待 10 秒才能打印所有消息。

编辑:添加代码我有:

//Config is gotten from yml file
RestConfig       = Config["rest"].(map[string]interface{})
ServerConfig     = Config["server"].(map[string]interface{})
RequestUrl      := ServerConfig["url"]

RequestReader   := bytes.NewReader(body)
Request, _      := http.NewRequest("POST", RequestUrl.(string), RequestReader)

//AppendHeaders append the needing headers to the request 
client.AppendHeaders(Request, RestConfig["headers"])

//the type of client.HttpClient is *http.Client
Response, _     := client.HttpClient.Do(Request)

//And to print in the screen
defer Response.Body.Close()

fmt.Println( "-> Receiving response:\n---\n" )
fmt.Println( Response , "\n---\n-> Response body:\n---\n")
body_resp, _ := ioutil.ReadAll(Response.Body)
fmt.Println( string(body_resp) …
Run Code Online (Sandbox Code Playgroud)

asynchronous request go

1
推荐指数
1
解决办法
4194
查看次数

无法获取地图元素的地址

我想找出原因

x:= odsMap[segRef]
x.GetValue("@OriginDestinationKey")
Run Code Online (Sandbox Code Playgroud)

可以,但是不能:

odsMap[segRef].GetValue("@OriginDestinationKey")
Run Code Online (Sandbox Code Playgroud)

最后一个代码段显示以下错误:

cannot call pointer method on odsMap[segRef]go
cannot take the address of odsMap[segRef]
Run Code Online (Sandbox Code Playgroud)

这些错误发生在编译时(而不是运行时)。所以,我的主要问题是为什么我需要一个中间变量x来访问该函数?

关于变量的类型odsMapmap[string]XMLElement并且segRef是字符串。

谢谢。

methods dictionary pointers go

0
推荐指数
1
解决办法
63
查看次数