- 1
- 2
Be gone, malicious spirit from the anus!
We don't say "amen", because we may step on the mines; we say "True"!
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
0
Be gone, malicious spirit from the anus!
We don't say "amen", because we may step on the mines; we say "True"!
Херня рулит.
0
https://twitter.com/RCS/status/1452367702727831565
Ай, Молодца !!!
+1
Щас продукты перетекают в сервисы, разработка ПО делится на фронт и бэк, всякие аджайлоскрамы со спринтами,
ретро и бэклог-ревью, автотесты, проверить работает ли код можно на лету.
А как выглядела работа у разработчиков ПО в начале 10-х, 00-х, 90-х?
Как контролировали выполнение задач?
Насколько часто переключались на проверку работоспособности кода?
Как тестили приложения с GUI (десктоп, игры всякие)?
Какие задачи давали на техническом интервью кандидатам?
0
Давайте флудить и троллить ;-)
Давайте флудить и троллить ;-)
−1
IT Оффтоп #131
#101: https://govnokod.ru/27511 https://govnokod.xyz/_27511
#102: https://govnokod.ru/27518 https://govnokod.xyz/_27518
#103: https://govnokod.ru/27526 https://govnokod.xyz/_27526
#104: https://govnokod.ru/27534 https://govnokod.xyz/_27534
#105: https://govnokod.ru/27544 https://govnokod.xyz/_27544
#106: https://govnokod.ru/27552 https://govnokod.xyz/_27552
#107: https://govnokod.ru/27554 https://govnokod.xyz/_27554
#108: https://govnokod.ru/27557 https://govnokod.xyz/_27557
#109: https://govnokod.ru/27581 https://govnokod.xyz/_27581
#110: https://govnokod.ru/27610 https://govnokod.xyz/_27610
#111: https://govnokod.ru/27644 https://govnokod.xyz/_27644
#112: https://govnokod.ru/27648 https://govnokod.xyz/_27648
#113: https://govnokod.ru/27652 https://govnokod.xyz/_27652
#114: https://govnokod.ru/27659 https://govnokod.xyz/_27659
#115: https://govnokod.ru/27665 https://govnokod.xyz/_27665
#116: https://govnokod.ru/27671 https://govnokod.xyz/_27671
#117: https://govnokod.ru/27675 https://govnokod.xyz/_27675
#118: https://govnokod.ru/27685 https://govnokod.xyz/_27685
#119: https://govnokod.ru/27701 https://govnokod.xyz/_27701
#120: https://govnokod.ru/27703 https://govnokod.xyz/_27703
#121: https://govnokod.ru/27710 https://govnokod.xyz/_27710
#122: https://govnokod.ru/27728 https://govnokod.xyz/_27728
#123: https://govnokod.ru/27729 https://govnokod.xyz/_27729
#124: https://govnokod.ru/27730 https://govnokod.xyz/_27730
#125: https://govnokod.ru/27732 https://govnokod.xyz/_27732
#126: https://govnokod.ru/27733 https://govnokod.xyz/_27733
#127: https://govnokod.ru/27737 https://govnokod.xyz/_27737
#128: https://govnokod.ru/27742 https://govnokod.xyz/_27742
#129: https://govnokod.ru/27747 https://govnokod.xyz/_27747
#130: https://govnokod.ru/27755 https://govnokod.xyz/_27755
+1
waiting_for_data(info, {Driver,Socket,Data},
#state{socket=Socket, driver=Driver, driver_mod=DriverMod, peer=Peer, control=Control, list=List} = State) ->
%% The meat of the whole project: process a function call and return
%% the data
try erlang:binary_to_term(Data) of
{{CallType,M,F,A}, Caller} when CallType =:= call; CallType =:= async_call ->
{ModVsnAllowed, RealM} = check_module_version_compat(M),
case check_if_module_allowed(RealM, Control, List) of
true ->
case ModVsnAllowed of
true ->
WorkerPid = erlang:spawn(?MODULE, call_worker, [CallType, RealM, F, A, Caller, Socket, Driver, DriverMod]),
?log(debug, "event=call_received driver=~s socket=\"~s\" peer=\"~s\" caller=\"~p\" worker_pid=\"~p\"",
[Driver, gen_rpc_helper:socket_to_string(Socket), gen_rpc_helper:peer_to_string(Peer), Caller, WorkerPid]),
{keep_state_and_data, gen_rpc_helper:get_inactivity_timeout(?MODULE)};
false ->
?log(debug, "event=incompatible_module_version driver=~s socket=\"~s\" method=~s module=~s",
[Driver, gen_rpc_helper:socket_to_string(Socket), CallType, RealM]),
waiting_for_data(info, {CallType, Caller, {badrpc,incompatible}}, State)
end;
false ->
?log(debug, "event=request_not_allowed driver=~s socket=\"~s\" control=~s method=~s module=~s",
[Driver, gen_rpc_helper:socket_to_string(Socket), Control, CallType, RealM]),
waiting_for_data(info, {CallType, Caller, {badrpc,unauthorized}}, State)
end;
{cast, _M, _F, _A} = Cast ->
handle_cast(Cast, State),
{keep_state_and_data, gen_rpc_helper:get_inactivity_timeout(?MODULE)};
BatchCast when is_list(BatchCast) ->
[handle_cast(Cast, State) || Cast <- BatchCast],
{keep_state_and_data, gen_rpc_helper:get_inactivity_timeout(?MODULE)};
{abcast, Name, Msg} ->
_Result = case check_if_module_allowed(erlang, Control, List) of
true ->
?log(debug, "event=abcast_received driver=~s socket=\"~s\" peer=\"~s\" process=~s message=\"~p\"",
[Driver, gen_rpc_helper:socket_to_string(Socket), gen_rpc_helper:peer_to_string(Peer), Name, Msg]),
Msg = erlang:send(Name, Msg);
false ->
?log(debug, "event=request_not_allowed driver=~s socket=\"~s\" control=~s method=~s",
[Driver, gen_rpc_helper:socket_to_string(Socket), Control, abcast])
end,
{keep_state_and_data, gen_rpc_helper:get_inactivity_timeout(?MODULE)};
{sbcast, Name, Msg, Caller} ->
Reply = case check_if_module_allowed(erlang, Control, List) of
true ->
?log(debug, "event=sbcast_received driver=~s socket=\"~s\" peer=\"~s\" process=~s message=\"~p\"",
[Driver, gen_rpc_helper:socket_to_string(Socket), gen_rpc_helper:peer_to_string(Peer), Name, Msg]),
case erlang:whereis(Name) of
undefined -> error;
Pid -> Msg = erlang:send(Pid, Msg), success
end;
false ->
?log(debug, "event=request_not_allowed driver=~s socket=\"~s\" control=~s method=~s",
[Driver, gen_rpc_helper:socket_to_string(Socket), Control, sbcast]),
error
end,
waiting_for_data(info, {sbcast, Caller, Reply}, State);
ping ->
?log(debug, "event=ping_received driver=~s socket=\"~s\" peer=\"~s\" action=ignore",
[Driver, gen_rpc_helper:socket_to_string(Socket), gen_rpc_helper:peer_to_string(Peer)]),
{keep_state_and_data, gen_rpc_helper:get_inactivity_timeout(?MODULE)};
OtherData ->
?log(debug, "event=erroneous_data_received driver=~s socket=\"~s\" peer=\"~s\" data=\"~p\"",
[Driver, gen_rpc_helper:socket_to_string(Socket), gen_rpc_helper:peer_to_string(Peer), OtherData]),
{stop, {badrpc,erroneous_data}, State}
catch
error:badarg ->
{stop, {badtcp,corrupt_data}, State}
end;
%% Handle the inactivity timeout gracefully
waiting_for_data(timeout, _Undefined, #state{socket=Socket, driver=Driver} = State) ->
?log(info, "message=timeout event=server_inactivity_timeout driver=~s socket=\"~s\" action=stopping",
[Driver, gen_rpc_helper:socket_to_string(Socket)]),
{stop, normal, State};
waiting_for_data(info, {DriverClosed, Socket} = Msg, #state{socket=Socket, driver_closed=DriverClosed} = State) ->
handle_event(info, Msg, waiting_for_data, State);
waiting_for_data(info, {DriverError, Socket, _Reason} = Msg, #state{socket=Socket, driver_error=DriverError} = State) ->
handle_event(info, Msg, waiting_for_data, State).
Срочно требуется учитель литературы, чтобы объяснить, что хотел сказать автор.
0
make_process_name("client", {Node,Key}) when is_atom(Node) ->
%% This function is going to be called enough to warrant a less pretty
%% process name in order to avoid calling costly functions
KeyStr = erlang:integer_to_list(erlang:phash2(Key)),
NodeStr = erlang:atom_to_list(Node),
erlang:list_to_atom("gen_rpc.client." ++ NodeStr ++ "/" ++ KeyStr);
Самый страшный грех, который только возможен в Erlang.
0
Let's count a number of rules that can be built in GoL-like automatas. Rule is the matrix that maps some condition of cells to new state.
Cell itself could be alive or dead. And cell could have 0-8 neighbors. So, there are 2^(2*9) = 262144 different rules. Well known, that
the majority of them are primitive and produces some pure pattern or just dies in finite number of generations / infinitely fills the world
with alive cells. We also know that some rules are symmetric to each other as if we just rename (swap colors of) alive and dead cells.
Conway found the most interesting rule from entropy point of view.
2^18 is not so much. Let's take a look at 2D automata known as Rule 110. State 100 keeps cell dead:
100 -> 0
While state 001 makes cell alive:
001 -> 1
In terms of neighborhood, this two rules are indifferent: both means one live neighbor next to dead cell. But in Rule 110 not only a /number/
of neighbors is meaningful, but the /position/ of separate neighbor.
Let's imagine the GoL-like rule with the same property: we will look not only at number of neighbors, but at their position. What if to have one
neighbor at north-west gives not the same result as if neighbor were at south-east.
This change gives us much more different rules. If each neighbor is meaningful, then we have 2 ^ 8 different states of neighborhood, and cell
could be still alive or dead. If I'm not wrong there must be 2 ^ (2 * (2 ^ 8)) = 2 ^ 512 different rules.
Obviously, this space includes Conway's Game of Life and all different rules from that 262144, and gives billions of new ones. Obviously,
the majority of them are trivial too. But there may be some interesting entropy-like rules different from the Conway's one.
This space is too huge to be discovered manually, and even with bruteforce algorithms too. But evolution algorithms could be used to find rules
with some special properties.
So, I have two questions:
1) Does this space has a given name, anybody researched that?
2) I will be glad to hear any ideas on how to make this space simpler by excluding symmetric states etc. to save the time for discovering.
Any cellular nerds here?
0
Время вечерней молитвы.
Примите положение А1. Постарайтесь сосредоточиться, соберитесь с мыслями. Прочтите молитву.
Инициализируйте процедуру-коллбек.
0
Application was halted by an exception.
Error 520
Ray ID: 69e3d61cfd95169b •
2021-10-14 21:18:17 UTC
Web server is returning an unknown error
You
Browser Working
Moscow
Cloudflare Working
govnokod.ru
Host Error
What happened?
There is an unknown connection issue between Cloudflare and the origin web server. As a result, the web page can not be displayed.
What can I do?
If you are a visitor of this website:
Please try again in a few minutes.
If you are the owner of this website:
There is an issue between Cloudflare's cache and your origin web server. Cloudflare monitors for these errors and automatically investigates the cause. To help support the investigation, you can pull the corresponding error log from your web server and submit it our support team. Please include the Ray ID (which is at the bottom of this error page). Additional troubleshooting resources.
Cloudflare Ray ID: 69e3d61cfd95169b
Your IP: 91.197.11.236
Performance & security by Cloudflare