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(couchdb_btree_vs_dets). | |
-author('cooldaemon@gmail.com'). | |
-export([test/0, test/1]). | |
test() -> test(1000). | |
test(Count) -> | |
KVs = lists:map( | |
fun (N) -> {N, {foo, bar, baz}} end, | |
lists:seq(1, Count) |
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(lists_vs_func_vs_comp). | |
-author('cooldaemon@gmail.com'). | |
-export([test/0]). | |
test() -> | |
Seqs = lists:seq(0, 500000), | |
lists:foreach( | |
fun | |
({F, TargetName}) -> |
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(simple_counter1). | |
-export([count_to/1, increment/2, test/0]). | |
count_to(Target) -> | |
increment(0, Target). | |
increment(Target, Target) -> | |
Target; | |
increment(Count, Target) -> | |
increment(Count + 1, Target). |
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(simple_counter3). | |
-behaviour(gen_server). | |
-export([start_link/0]). | |
-export([init/1, handle_call/3, handle_cast/2, handle_info/2]). | |
-export([terminate/2, code_change/3]). | |
a | |
-export([increment/0, stop/0]). | |
-export([count_to/1, test/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
class Sandbag1 | |
def self.add1 | |
define_method(:hoge1){ puts "The method :hoge1 is called."; } | |
end | |
def self.remove1 | |
undef_method :hoge1 | |
rescue NameError => e | |
# puts e | |
end |
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(mnesia_repl_and_frag). | |
-compile([export_all]). | |
-record(store, {key, value}). | |
%% Usage: | |
%% Start secondary node, at first. Not a typo :-) | |
%% Then start primary at another node. |
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
%% Sample for mnesia fragmentation with load balancing. | |
-module(mnesia_repl_and_frag2). | |
-compile([export_all]). | |
-record(store, {key, value}). | |
primary() -> | |
net_kernel:start([localnode(1), longnames]), |
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
%% Trial for mnesia fragmentation with local_content | |
%% The answer is NEGATIVE. | |
%% fragmentation with local_content does NOT work. | |
-module(mnesia_frag_and_local). | |
-compile([export_all]). | |
-record(store, {key, value}). |
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(overload_handler_sample). | |
-auther(shino.shun@gmail.com). | |
-compile(export_all). | |
%% -record(rec, {k, v1, v2, v3}). | |
main() -> | |
%% Mnesia 開始前には subscribe してもアラートは受け取れない | |
subscribe_to_mnesia(before_mnesia_start), |
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(mnesia_index_as_ets). | |
-export([main/0]). | |
-include_lib("eunit/include/eunit.hrl"). | |
-record(kv, {key, value}). | |
main() -> | |
mnesia:start(), | |
OlderNewer