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
%% http_resultテーブルから結果を取得 | |
%% 取得範囲はdatetime型でFromからToを指定 | |
select_check(Id, From, To) -> | |
do(qlc:q([X#http_result.status || X <- mnesia:table(http_result), | |
X#http_result.list_id =:= Id, | |
X#http_result.mon_time < To, | |
X#http_result.mon_time > From])). |
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
select(get_all, Table) -> | |
gen_server:call(?MODULE, {get_all, Table}); | |
select(get_uri, Id) -> | |
gen_server:call(?MODULE, {get_uri, Id}); | |
select(get_condition, Id) -> | |
gen_server:call(?MODULE, {get_condition, Id}). |
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
get_elem(all, Table) -> | |
gen_server:call(?MODULE, {all, Table}); | |
get_elem(id, Table) -> | |
gen_server:call(?MODULE, {id, Table}); | |
get_elem(uri, Id) -> | |
gen_server:call(?MODULE, {uri, Id}); | |
get_elem(condition, Id) -> |
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
%% http_listテーブルにレコードを追加/更新する | |
add_record_http_list(Id, System, Uri, Port) -> | |
Row = #http_list{id=Id, system=System, uri=Uri, port=Port}, | |
F = fun() -> | |
mnesia:write(Row) | |
end, | |
mnesia:transaction(F). |
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
add(add_http_list, Id, System, Uri, Port) -> | |
gen_server:call(?MODULE, {add_http_list, Id, System, Uri, Port}); | |
handle_call({add_http_list, Id, System, Uri, Port}, _From, State) -> | |
{reply, add_record_http_list(Id, System, Uri, Port), State}; | |
%% http_listテーブルにレコードを追加/更新する | |
add_record_http_list(Id, System, Uri, Port) -> | |
Row = #http_list{id=Id, system=System, uri=Uri, port=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
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
;; slime | |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
(add-to-list 'load-path "/usr/share/emacs/site-lisp/slime") | |
(require 'slime) | |
(setq slime-net-coding-system 'utf-8-unix) | |
(slime-setup '(slime-repl)) | |
(add-hook 'lisp-mode-hook (lambda () | |
(slime-mode t) |
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
(defun my-ring() (let ((ring-bell-function nil) | |
(visible-bell t)) | |
(while (progn | |
(ding) | |
(sit-for 0.5))))) | |
(setq riece-server-alist | |
'(("freenode" :host "irc.freenode.org" :nickname "hiyosi"))) | |
(setq riece-server "freenode") |
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(amqp_example). | |
-include("./deps/amqp_client-2.6.1/include/amqp_client.hrl"). | |
-compile([export_all]). | |
test() -> | |
{ok, Connection} = amqp_connection:start(#amqp_params_network{}), | |
{ok, Channel} = amqp_connection:open_channel(Connection), | |
#'queue.declare_ok'{queue = Q} | |
= amqp_channel:call(Channel, #'queue.declare'{}), |
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
require 'rubygems' | |
require 'bunny' | |
b = Bunny.new(:host => '192.168.0.1') | |
b.start | |
q = b.queue("test1") | |
print "Message count: #{q.message_count}\n" | |
msg = q.pop[:payload] |
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
require 'rubygems' | |
require 'bunny' | |
b = Bunny.new(:host => '192.168.0.1') | |
b.start | |
e = b.exchange("", :auto_delete => true) | |
e.publish("hello, everybody!", :key => 'test1') |
OlderNewer