This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
F = fun(B,Val) -> hd(io_lib:format("~." ++ integer_to_list(B) ++ "B", [Val])) end. F(2, 250). F(16, 250). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
code:add_patha("/src/http_omg/ebin"). | |
code:add_patha("/src/erlang_mysql-3/ebin"). | |
code:add_patha("/src/teh_pokemons/ebin"). | |
code:add_patha("/src/etap_ng/ebin"). | |
code:add_patha("/src/mochiweb/ebin"). | |
code:add_patha("/src/yaml_erlang/ebin"). | |
code:add_patha("/src/dynamic_compile/ebin"). | |
code:add_patha("/src/mochixpath/ebin"). | |
code:add_patha("/src/custom_guards/ebin"). | |
code:add_patha("/src/excavator/ebin"). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
%% Consistent hashing functions | |
%% | |
%% First, hash memcached servers to unsigned integers on a continuum. To | |
%% map a key to a memcached server, hash the key to an unsigned integer | |
%% and locate the next largest integer on the continuum. That integer | |
%% represents the hashed server that the key maps to. | |
%% reference: http://www8.org/w8-papers/2a-webserver/caching/paper2.html | |
hash_to_uint(Host, Port) when is_list(Host), is_integer(Port) -> | |
hash_to_uint(Host ++ integer_to_list(Port)). | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Query = #emo_query{limit=1, q=[ | |
{<<"orderby">>, [{<<"occurred_at">>, -1}]}, | |
{<<"query">>, [{<<"field1">>, Field1Value}]} | |
]}, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-module(rabbit_test). | |
-compile(export_all). | |
-include_lib("rabbitmq_erlang_client/include/amqp_client.hrl"). | |
-define(X, <<1,2,3,4>>). | |
-define(RoutingKey, <<5,6,7,8>>). | |
-define(Q, <<9,10,11,12>>). | |
%% ------------------------------------- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-module(t). | |
-behavior(gen_server). | |
-export([start_link/0, print_state/0]). | |
-export([init/1, handle_call/3, handle_cast/2, | |
handle_info/2, terminate/2, code_change/3]). | |
%%==================================================================== | |
%% API |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-module(p). | |
-export([start_link/0, print_state/0, init/1, loop/1, | |
system_continue/3, system_code_change/4, system_terminate/4]). | |
start_link() -> | |
proc_lib:start_link(?MODULE, init, [self()]). | |
print_state() -> | |
{ok, Result} = gen:call(?MODULE, '$p', print_state), | |
Result. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- t.erl 2010-02-11 17:34:00.000000000 -0800 | |
+++ t2.erl 2010-02-11 17:33:54.000000000 -0800 | |
@@ -35,7 +35,7 @@ | |
%% Description: Initiates the server | |
%%-------------------------------------------------------------------- | |
init([]) -> | |
- {ok, 0}. | |
+ {ok, 0.0}. | |
%%-------------------------------------------------------------------- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-module(p). | |
-export([start_link/0, print_state/0, init/1, loop/1]). | |
start_link() -> | |
proc_lib:start_link(?MODULE, init, [self()]). | |
print_state() -> | |
{ok, Result} = gen:call(?MODULE, '$p', print_state), | |
Result. | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- p.erl 2010-02-16 14:49:04.000000000 -0800 | |
+++ p2.erl 2010-02-16 14:49:02.000000000 -0800 | |
@@ -12,7 +12,7 @@ | |
init(Parent) -> | |
register(?MODULE, self()), | |
proc_lib:init_ack(Parent, {ok, self()}), | |
- ?MODULE:loop(0). | |
+ ?MODULE:loop(0.0). | |
@@ -28,7 +28,7 @@ |
OlderNewer