Technomenace

Linux, technology, opensource etc.

Recent posts

Jan 29, 2016
Erlang Ets Types Readwrite Performance Tests ETS read/write performance tests. -module(ets_try2). -import(lists, [foldl/3, reverse/1]). -export([ match_times_test/0 ]). %% ==================================================================== %% API functions %% ==================================================================== match_times_test() -> io:format("==> Fetching GPL License v3.…
Jan 21, 2016
A Simple Tcp Server in Erlang -module(tcpserver). -export([ start/0, start/1, stop/0 ]). start() -> start(9090). start(Port) -> F = fun() -> register(tcpserver, self()), {ok, LSock} = gen_tcp:listen(Port, [binary]), io:format("====> TcpServer listening on localhost, port ~p~n~n", [Port]), spawn(fun() -> loop(LSock) end), receive stop -> exit(killed) end end, Pid = spawn(F).…
Jan 10, 2016
Receive Messages With Priority in Erlang -module(spawntest). -export([ start/0, test/0 ]). start() -> register(?MODULE, spawn(fun() -> myfun() end)). myfun() -> receive {P, critical, Msg} -> do_critical(P, Msg) after 0 -> receive {P, critical, Msg} -> do_critical(P, Msg); {P, Any} -> do_normal(P, Any) end end, myfun().…
Nov 16, 2015
Simple Gen_fsm Example My ongoing journey in the wonderful world of Erlang has been with the help of 2 books. I started off with Learn You Some Erlang For Good which is surely┬áthe best beginner guide you can ever get on Erlang language.…