我是Erlang世界的新手,目前无法弄清楚如何启动我的虚拟erlang应用程序.可能,我只是遗漏了一些东西......所以,我用rebar创建了一个应用程序(rebar create-app appid = dummys).
目前我有
我发现为了在开发期间运行应用程序,最好创建一个应该调用application:start(module)的额外start方法.
我在启动方法中添加了一些基本的日志记录.
start() ->
error_logger:info_msg("Starting app(dev)..~n"),
application:start(dummys_app).
start(_StartType, _StartArgs) ->
error_logger:info_msg("Starting app..~n"),
dummys_sup:start_link().
Run Code Online (Sandbox Code Playgroud)
如果我试试
erl -noshell -pa ebin -s application start dummys
erl -noshell -pa ebin -s application start dummys_app
Run Code Online (Sandbox Code Playgroud)
没有输出..
如果我试试
erl -noshell -pa ebin -s dummys start
Run Code Online (Sandbox Code Playgroud)
erl因错误而崩溃..
如果我试试
erl -noshell -pa ebin -s dummys_app start
Run Code Online (Sandbox Code Playgroud)
它输出的只是" 启动应用程序(开发)... "而这就是全部.但我也希望看到"正在开始使用.. "
我错过了什么或做错了什么?
=============
另一个问题:如何正确地向我的虚拟应用程序添加新模块?例如,我有一个名为"*dummys_cool*"的附加模块,它有一个" 开始 "方法.如何告诉我的应用程序运行"dummys_cool #start"方法?
谢谢!
我需要使用一些不同的git存储库.如何使用magit在它们之间切换?Magit允许我在刚开始时选择一个目录..但是如果需要的话,我不清楚如何切换到另一个仓库.我看过magit cheatsheet和docs,但还没有找到答案.谢谢.
我有一个简单的 Go/Gin 网络应用程序。我需要在 html 模板中放入一些动态内容。
例如,我有几个表(数字是动态的),其中有几行(数字是动态的)。我需要将它们放在 html 模板中。有没有办法在代码中组合模板?我更喜欢使用模板而不是在代码中构建表。
我检查了一个教程https://github.com/gin-gonic/gin但它没有在那里介绍。
在scala中,Option类被声明为
sealed abstract class _Option[+A]
case object _None extends _Option[Nothing] {}
final case class _Some[+A](x: A) extends _Option[A] {}
Run Code Online (Sandbox Code Playgroud)
什么是[+A]
?为什么不[A]
呢?可能[-A]
是它意味着什么?
对不起,如果它是重复但我找不到答案的SO.
我希望我的python脚本(连接到aws)使用来自〜/ .aws/credentials的aws配置文件
所以,我有〜/ .aws/credentials文件:
[default]
aws_access_key_id = XXX
aws_secret_access_key = AAA
region = eu-west-1
[test]
aws_access_key_id = WWW
aws_secret_access_key = ZZZ
region = eu-west-1
Run Code Online (Sandbox Code Playgroud)
我的python代码
import boto.ec2
conn = boto.ec2.EC2Connection(profile_name='test')
print conn
print conn.get_all_instances()
Run Code Online (Sandbox Code Playgroud)
输出是
EC2Connection:ec2.us-east-1.amazonaws.com
[]
Run Code Online (Sandbox Code Playgroud)
所以,它似乎没有从配置中获取配置文件.该地区是错误的.
env | grep -i aws <- returns nothing
Run Code Online (Sandbox Code Playgroud)
我错过了什么?
谢谢.
=====更新=====
我有一个〜/ .aws/config文件,看起来像
? cat config
[default]
output = text
region = eu-west-1
[profile test]
output = text
region = eu-west-1
Run Code Online (Sandbox Code Playgroud)
=====更新=====
显然,它需要连接细节..但不是区域.所以,如果我这样做
reg = next(x for x in boto.ec2.regions() if x.name=='eu-west-1') …
Run Code Online (Sandbox Code Playgroud) 我尝试用maven构建一个java项目.我使用java 7但是maven源是1.6.我无法改变它.当我运行"mvn clean install"时,它失败并出现一个奇怪的错误:
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:2.0.2:compile (default-compile) on project search: Compilation failure
[ERROR] could not parse error message: warning: [options] bootstrap class path not set in conjunction with -source 1.6
[ERROR] /someClassName.java:114: warning: [deprecation] LUCENE_36 in Version has been deprecated
[ERROR] out = new ICUCollationKeyAnalyzer(Version.LUCENE_36, l);
[ERROR] ^
[ERROR] -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:2.0.2:compile (default-compile) on project search: Compilation failure
could not parse error message: warning: [options] bootstrap class path not set …
Run Code Online (Sandbox Code Playgroud) 我已将此代码添加到Build.scala中.
lazy val root = Project("root", file(".")) dependsOn(jbcrypt)
lazy val jbcrypt = RootProject(uri("https://github.com/jeremyh/jBCrypt.git"))
Run Code Online (Sandbox Code Playgroud)
但sbt因错误而失败:
[error] (root/*:update) sbt.ResolveException: unresolved dependency: default#jbcrypt_2.11;0.1-SNAPSHOT: not found
Run Code Online (Sandbox Code Playgroud)
如何告诉sbt它是Java而不是Scala?
如何引用特定分支或标记?
谢谢.
我有2个节点的ES集群。当我重新启动节点时,群集状态yellow
与某些分片相同unassigned
。我尝试过使用google,常见的解决方案是重新路由分unassigned
片。不幸的是,它对我不起作用。
curl localhost:9200/_cluster/health?pretty=true
{
"cluster_name" : "infra",
"status" : "yellow",
"timed_out" : false,
"number_of_nodes" : 2,
"number_of_data_nodes" : 2,
"active_primary_shards" : 34,
"active_shards" : 68,
"relocating_shards" : 0,
"initializing_shards" : 0,
"unassigned_shards" : 31,
"delayed_unassigned_shards" : 0,
"number_of_pending_tasks" : 0,
"number_of_in_flight_fetch" : 0,
"task_max_waiting_in_queue_millis" : 0,
"active_shards_percent_as_number" : 68.68686868686868
}
curl localhost:9200/_cluster/settings?pretty
{
"persistent" : { },
"transient" : {
"cluster" : {
"routing" : {
"allocation" : {
"enable" : "all"
}
} …
Run Code Online (Sandbox Code Playgroud) 在某些代码中我看到过类似的东西
{ok, Req2} = cowboy_req:reply(200, [], <<"Hello World!">>, Req),
Run Code Online (Sandbox Code Playgroud)
我不知道那些<< >>是什么意思..谢谢.
我创建了一个简单的erlang应用程序,它定期收集所需的数据并将其放入riak数据库中.
当我启动我的应用程序时,它运行顺利...但是经过一段时间后,它因为对riak数据库的PUT请求变得太慢而卡住了..这是来自我的应用程序的日志:
2013-06-26 12:44:09.090 [info] <0.60.0> data processed in [16476 ms]
2013-06-26 12:45:51.472 [info] <0.60.0> data processed in [18793 ms]
...
2013-06-26 12:57:28.138 [info] <0.60.0> data processed in [15135 ms]
2013-06-26 13:07:01.484 [info] <0.60.0> data processed in [488420 ms]
2013-06-26 14:03:11.561 [info] <0.60.0> data processed in [3370075 ms]
Run Code Online (Sandbox Code Playgroud)
在riak崩溃日志中,我可以看到很多消息
2013-06-26 17:06:20 =CRASH REPORT====
crasher:
initial call: riak_kv_index_hashtree:init/1
pid: <0.13660.7>
registered_name: []
exception exit: {{{badmatch,{error,{db_open,"IO error: ./data/anti_entropy/
433883298582611803841718934712646521460354973696/MANIFEST-000004:
Cannot allocate memory"}}}, [{hashtree,new_segment_store,2,
[{file,"src/hashtree.erl"},{line,499}]},
{hashtree,new,2,[{file,"src/hashtree.erl"},{line,215}]},
{riak_kv_index_hashtree,do_new_tree,2,
[{file,"src/riak_kv_index_hashtree.erl"},
{line,426}]},{lists,foldl,3,[{file,"lists.erl"},
{line,1197}]},{riak_kv_index_hashtree,
init_trees,2,[{file,"src/riak_kv_index_hashtree.erl"},
{line,368}]},{riak_kv_index_hashtree,init,1,
[{file,"src/riak_kv_index_hashtree.erl"}, …
Run Code Online (Sandbox Code Playgroud)