08. Dezember 2013 Falco Hirschenberger
Ok, alles klar? Fertig.
Also wie geschaffen für unsere Inspektionssysteme
Also nichts für unsere Algorithmiker
% read a file
{ok, Data} = file:read_file("/home/masc/ofiProtokoll.rst").
% sum up the size of all PNG files in a directory recursively.
filelib:fold_files("/home/masc/images", "*.png", true,
fun(File, Acc) ->
filelib:file_size(File) + Acc
end, 0).
% call function every second
timer:apply_interval(1000, io, format, ["Hello World"]).
% send a message to another process in the same VM
graph_runner ! {run_graph, [Img1, Img2]},
% send a message to a process on another computer
{masc@worker1, graph_runner} ! {run_graph, [Img1, Img2]},
receive
{result, ResultImg} -> ResultImg
end.
-module(evaluate).
-export([do_evaluate/4]).
do_evaluate(Img, FromPid, No, Width) ->
T1 = now(),
Graph = load_graph(graph_file),
case graph_runner:run_graph(Graph, [Img, Width, 1]) of
{results, Res} ->
% notify the collector of a new result
FromPid ! {new_result, Res, No},
lager:info("Graph time: ~p",
[timer:now_diff(now(), T1)/1000]);
{error, R} ->
lager:error("Evaluation error: ~p", [R]),
% notify the collector of an evaluation error
FromPid ! {error, R, No}
end.
Eshell V5.10.3 (abort with ^G) 1> Txt = "Hallo" ++ " Welt". "Hallo Welt" 2> Txt = Txt ++ "!". ** exception error: no match of right hand side value "Hallo Welt!"
Eshell V5.10.3 (abort with ^G) 3> lists:foldl(fun(N, Acc) -> N + Acc end, 0, lists:seq(1,100)). 5050