我想将整数值打印到文件.我能够将字符串值写入文件,但是当我尝试写一个整数值时,它会给出一个错误:
%this works fine
{ok, F}=file:open("bff.txt", [read,write]),
Val="howdy",
file:write(F,Val).
%this gets compiled, but results in error {error, badarg} while executing
{ok, F}=file:open("bff.txt", [read,write]),
Val=23424,
file:write(F,Val).
Run Code Online (Sandbox Code Playgroud)
有什么建议?
实际上我想为Web服务器编写一个基准测试代码,我需要将所有的时间值和没有请求的值写入输出文件,然后我将用它来绘制带有gnuplot的图形.
我想在Emacs中创建一个正则表达式,用于捕获双方括号之间的文本.
我找到了这个正则表达式.它允许在方括号中找到字符串,但它包括方括号:
"\\[\\[\\([^][]+\\)\\]\\(\\[\\([^][]+\\)\\]\\)?\\]"
Run Code Online (Sandbox Code Playgroud)
除了方括号之外,如何在双方括号之间提取字符串?
在我的生产服务器中,有人执行了rm -rf,我的重要文件被永久删除.所以,我想有一个回收站,所以如果用户这样做rm,文件将转移到RecycleBin而不是从服务器删除.我已经为它制作了以下脚本.但是我在执行时遇到了一些错误.
alias rm='/root/remove.sh'
#rm test_file
现在,在键入rm命令时将触发脚本
#!/bin/bash
dir=$(pwd)
mv $dir/$1 /root/Recyclebin
当上面的脚本被触发时,我收到以下错误.
mv:cannot move '/root/test_file' to '/root/Recyclebin': Not a directory
现在,请建议有没有其他方法来制作除此之外的回收站概念或请帮助解决错误.提前致谢.
我正在使用CentOS 5.6
我有一个 eunit 测试,它生成一个唯一的节点名称并开始分发:
{A,B,C} = now(),
Nodename = list_to_atom(lists:flatten(io_lib:format(
"test-~b-~b-~b@localhost", [A, B, C]))),
{ok, _} = net_kernel:start([Nodename, shortnames]),
Run Code Online (Sandbox Code Playgroud)
只要分布式 Erlang 节点之前在机器上运行过,因此 epmd 仍在运行,这就可以正常工作,但在构建服务器上,我不能假设是这种情况。
我通过将其添加到我的测试中解决了这个问题:
_ = os:cmd("epmd -daemon"),
Run Code Online (Sandbox Code Playgroud)
但感觉就像一个黑客。有没有更好/更好的方法来确保在运行之前启动 epmd net_kernel:start?
我正在尝试在Windows 7 64位中安装带有Erlang的RabbitMQ.我正在安装:
R16B01 Windows 64 Bit Binary File
rabbitmq-server-3.1.5.exe
Run Code Online (Sandbox Code Playgroud)
一步一步地遵循本教程
http://www.youtube.com/watch?v=x9wwZAuub1w
Run Code Online (Sandbox Code Playgroud)
但是在运行命令时:"rabbitmq-plugins enable rabbitmq_management"
出现此错误:
{error_logger,{{2013,9,12},{13,23,53}},"Failed to create cookie file 'z:/.erlang
.cookie': enoent",[]}
{error_logger,{{2013,9,12},{13,23,53}},crash_report,[[{initial_call,{auth,init,[
'Argument__1']}},{pid,<0.19.0>},{registered_name,[]},{error_info,{exit,{"Failed
to create cookie file 'z:/.erlang.cookie': enoent",[{auth,init_cookie,0,[{file,"
auth.erl"},{line,285}]},{auth,init,1,[{file,"auth.erl"},{line,139}]},{gen_server
,init_it,6,[{file,"gen_server.erl"},{line,304}]},{proc_lib,init_p_do_apply,3,[{f
ile,"proc_lib.erl"},{line,239}]}]},[{gen_server,init_it,6,[{file,"gen_server.erl
"},{line,328}]},{proc_lib,init_p_do_apply,3,[{file,"proc_lib.erl"},{line,239}]}]
}},{ancestors,[net_sup,kernel_sup,<0.10.0>]},{messages,[]},{links,[<0.17.0>]},{d
ictionary,[]},{trap_exit,true},{status,running},{heap_size,610},{stack_size,27},
{reductions,951}],[]]}
{error_logger,{{2013,9,12},{13,23,53}},supervisor_report,[{supervisor,{local,net
_sup}},{errorContext,start_error},{reason,{"Failed to create cookie file 'z:/.er
lang.cookie': enoent",[{auth,init_cookie,0,[{file,"auth.erl"},{line,285}]},{auth
,init,1,[{file,"auth.erl"},{line,139}]},{gen_server,init_it,6,[{file,"gen_server
.erl"},{line,304}]},{proc_lib,init_p_do_apply,3,[{file,"proc_lib.erl"},{line,239
}]}]}},{offender,[{pid,undefined},{name,auth},{mfargs,{auth,start_link,[]}},{res
tart_type,permanent},{shutdown,2000},{child_type,worker}]}]}
{error_logger,{{2013,9,12},{13,23,53}},supervisor_report,[{supervisor,{local,ker
nel_sup}},{errorContext,start_error},{reason,{shutdown,{failed_to_start_child,au
th,{"Failed to create cookie file 'z:/.erlang.cookie': enoent",[{auth,init_cooki
e,0,[{file,"auth.erl"},{line,285}]},{auth,init,1,[{file,"auth.erl"},{line,139}]}
,{gen_server,init_it,6,[{file,"gen_server.erl"},{line,304}]},{proc_lib,init_p_do
_apply,3,[{file,"proc_lib.erl"},{line,239}]}]}}}},{offender,[{pid,undefined},{na
me,net_sup},{mfargs,{erl_distribution,start_link,[]}},{restart_type,permanent},{
shutdown,infinity},{child_type,supervisor}]}]}
{error_logger,{{2013,9,12},{13,23,53}},crash_report,[[{initial_call,{application
_master,init,['Argument__1','Argument__2','Argument__3','Argument__4']}},{pid,<0
.9.0>},{registered_name,[]},{error_info,{exit,{{shutdown,{failed_to_start_child,
net_sup,{shutdown,{failed_to_start_child,auth,{"Failed to create cookie file 'z:
/.erlang.cookie': enoent",[{auth,init_cookie,0,[{file,"auth.erl"},{line,285}]},{
auth,init,1,[{file,"auth.erl"},{line,139}]},{gen_server,init_it,6,[{file,"gen_se
rver.erl"},{line,304}]},{proc_lib,init_p_do_apply,3,[{file,"proc_lib.erl"},{line
,239}]}]}}}}},{kernel,start,[normal,[]]}},[{application_master,init,4,[{file,"ap …Run Code Online (Sandbox Code Playgroud) 当查看来自Erlang程序中错误的堆栈跟踪时,在我看来,有时候我看不到整个图片,某些条目已被删除。堆栈跟踪中包含多少个条目是否有限制?
我尝试在Erlang中使用wxWidget在窗口中绘制一条线.我试过了:
wx:new(),
Frame = wxFrame:new(wx:null(), ?wxID_ANY, "Hello"),
wxDC:drawLine(50,50),
Run Code Online (Sandbox Code Playgroud)
我收到一个错误:
undefined function wxDC:drawLine/2
Run Code Online (Sandbox Code Playgroud)
我在这里阅读文档,但我不明白如何做到这一点:
我有一个问题:使用新的libs(loom,ofs_handler,of_driver)我需要发送设置消息给switch.我必须创建这样的记录:
-record(ofp_field, {
class = openflow_basic :: ofp_field_class(),
name :: ofp_field_type(),
has_mask = false :: boolean(),
value :: bitstring(),
mask :: bitstring()
}).
Run Code Online (Sandbox Code Playgroud)
但'value'必须是一个位串,我不知道如何正确地将端口号(例如8080,6633)转换为位串,因为我可以<<Port>>, <<Port:32/integer>>得到不同的结果.有没有人知道如何使它正确?
或者我必须使用binary:encode_unsigned?
需要帮助比较2个时间戳,如:"2016-02-23 02:41:56","2015-03-23 09:33:25"
并获得较小的一个.
在使用tensorflow安装再训练模型时,我运行了以下命令:
bazel-bin/tensorflow/examples/image_retraining/retrain --image_dir <..directory..>
Run Code Online (Sandbox Code Playgroud)
错误:
ImportError: No module named 'backports'
Traceback (most recent call last):
File "/home/nishith/tensorflow/tensorflow/bazel-bin/tensorflow/examples/image_retraining/retrain.runfiles/org_tensorflow/tensorflow/examples/image_retraining/retrain.py", line 91, in <module>
import tensorflow as tf
File "/home/nishith/tensorflow/tensorflow/bazel-bin/tensorflow/examples/image_retraining/retrain.runfiles/org_tensorflow/tensorflow/__init__.py", line 24, in <module>
from tensorflow.python import *
File "/home/nishith/tensorflow/tensorflow/bazel-bin/tensorflow/examples/image_retraining/retrain.runfiles/org_tensorflow/tensorflow/python/__init__.py", line 64, in <module>
from tensorflow.python.framework.framework_lib import *
File "/home/nishith/tensorflow/tensorflow/bazel-bin/tensorflow/examples/image_retraining/retrain.runfiles/org_tensorflow/tensorflow/python/framework/framework_lib.py", line 100, in <module>
from tensorflow.python.framework.subscribe import subscribe
File "/home/nishith/tensorflow/tensorflow/bazel-bin/tensorflow/examples/image_retraining/retrain.runfiles/org_tensorflow/tensorflow/python/framework/subscribe.py", line 26, in <module>
from tensorflow.python.ops import variables
File "/home/nishith/tensorflow/tensorflow/bazel-bin/tensorflow/examples/image_retraining/retrain.runfiles/org_tensorflow/tensorflow/python/ops/variables.py", line 26, in <module>
from tensorflow.python.ops import control_flow_ops
File "/home/nishith/tensorflow/tensorflow/bazel-bin/tensorflow/examples/image_retraining/retrain.runfiles/org_tensorflow/tensorflow/python/ops/control_flow_ops.py", line 70, in …Run Code Online (Sandbox Code Playgroud) erlang ×7
bash ×1
emacs ×1
eunit ×1
install ×1
integer ×1
linux ×1
openflow ×1
python-3.5 ×1
rabbitmq ×1
recycle-bin ×1
regex ×1
stack-trace ×1
tensorflow ×1
timestamp ×1
ubuntu-16.04 ×1
windows ×1
wxwidgets ×1