Permalink
Browse files

Removes all trailing whitespace.

  • Loading branch information...
1 parent f3e273f commit 51cfa0a5f1ac55b9be6bc0ecd8849882e61e7ca2 @m2w committed Jan 15, 2012
Showing with 137 additions and 137 deletions.
  1. +6 −6 README.md
  2. +2 −2 src/erli.erl
  3. +6 −6 src/erli.hrl
  4. +1 −1 src/erli_error_handler.erl
  5. +18 −18 src/erli_stats.erl
  6. +56 −56 src/erli_storage.erl
  7. +1 −1 src/erli_sup.erl
  8. +7 −7 src/erli_throttle.erl
  9. +1 −1 src/erli_util.erl
  10. +29 −29 src/path_resource.erl
  11. +3 −3 src/root_resource.erl
  12. +7 −7 src/static_resource.erl
View
@@ -4,17 +4,17 @@
## statistics
-Every shortened URL keeps track of visitor counts (non-real time total and unique visit counts) and provides estimates for the geographic location of visitors.
+Every shortened URL keeps track of visitor counts (non-real time total and unique visit counts) and provides estimates for the geographic location of visitors.
## 'nsfw' functionality
-Appending `?landing=true` to a shortened URL, prevents the automatic redirect, instead a landing page, showing the full target URL and an "are you sure you want to proceed" button, is displayed.
+Appending `?landing=true` to a shortened URL, prevents the automatic redirect, instead a landing page, showing the full target URL and an "are you sure you want to proceed" button, is displayed.
Reporting inappropriate URLs is kept extremely simple, just add `/report` to the URL. URLs that reach a certain threshold - this mechanism will be expanded in the future (pull requests are most welcome ;)) - are permanetly banned.
## demo
-Live demo will be up as soon as I get around to it.
+Live demo will be up as soon as I get around to it.
To play around with it on localhost, just clone, `make compile`, `./start.sh` and open [http://localhost:8000](http://localhost:8000).
@@ -46,7 +46,7 @@ code quality:
-----------------
GET /path/stats -> view stats for the path
-----------------
- GET /path/check -> utility URL to facility 'low' overhead
- checking whether a path is already taken
- via ajax (@ W3C please give us an option
+ GET /path/check -> utility URL to facility 'low' overhead
+ checking whether a path is already taken
+ via ajax (@ W3C please give us an option
to disable the automatic redirect on 30x!)
View
@@ -26,7 +26,7 @@ start_link() ->
ensure_started(mochiweb),
ensure_started(mnesia),
erli_storage:init({}), % initialize mnesia
- application:set_env(webmachine, webmachine_logger_module,
+ application:set_env(webmachine, webmachine_logger_module,
webmachine_logger),
ensure_started(webmachine),
erli_sup:start_link().
@@ -42,7 +42,7 @@ start() ->
ensure_started(mochiweb),
ensure_started(mnesia),
erli_storage:init({}), % initialize mnesia
- application:set_env(webmachine, webmachine_logger_module,
+ application:set_env(webmachine, webmachine_logger_module,
webmachine_logger),
ensure_started(webmachine),
application:start(erli).
View
@@ -6,23 +6,23 @@
% @doc The number of reports before Target URLs are banned.
-define(FLAG_LIMIT, 5).
% @doc The maximal number of attempts to generate a unique URL path.
--define(MAX_CONFLICTS, 100).
+-define(MAX_CONFLICTS, 100).
% @doc The number of requests allowed during a set timespan.
--define(REQ_LIMIT, 100000).
+-define(REQ_LIMIT, 100000).
%%%=============================================================================
%%% ERLI RECORDS
%%% @end
%%%=============================================================================
%%------------------------------------------------------------------------------
-%% @type target() = #target{target=binary(),
-%% paths=list(),
+%% @type target() = #target{target=binary(),
+%% paths=list(),
%% reported=interger(),
%% rep_num=integer()}
%%------------------------------------------------------------------------------
-record(target, {target, paths=[], reported=0, rep_num=0}).
%%------------------------------------------------------------------------------
-%% @type timeslots() = #timeslots{night=integer(),
+%% @type timeslots() = #timeslots{night=integer(),
%% morning=integer(),
%% afternoon=integer(),
%% evening=integer()}
@@ -35,7 +35,7 @@
%% country_lst=list(),
%% timeslot_visits=timeslots()}
%%------------------------------------------------------------------------------
--record(path, {path, total_clicks=0, unique_clicks=0, country_lst=[],
+-record(path, {path, total_clicks=0, unique_clicks=0, country_lst=[],
timeslot_visits=#timeslots{}}).
%%------------------------------------------------------------------------------
%% @type visitor_ip = #visitor_ip{visitor_ip=string(), path=list()}
@@ -12,7 +12,7 @@ render_error(Code, Req, Reason) ->
case Req:has_response_body() of
{true,_} ->
Req:response_body();
- {false,_} ->
+ {false,_} ->
render_error_body(Code, Req:trim_state(), Reason)
end.
View
@@ -1,7 +1,7 @@
%% @author Moritz Windelen <moritz@tibidat.com>
%% @copyright 2011-2012 Moritz Windelen.
-%% @doc gen_server that handles periodic parsing of
+%% @doc gen_server that handles periodic parsing of
%% webmachine logfiles to extract usage statistics.
%% @end
@@ -15,11 +15,11 @@
start_link/1]).
%% gen_server callbacks
--export([init/1,
- handle_call/3,
- handle_cast/2,
- handle_info/2,
- terminate/2,
+-export([init/1,
+ handle_call/3,
+ handle_cast/2,
+ handle_info/2,
+ terminate/2,
code_change/3]).
-include("erli.hrl").
@@ -40,12 +40,12 @@ start_link() ->
%% @spec start_link(list()) -> {ok, Pid}
%% @doc Api call to initialize the gen_server with custom values.
%% Notes:
-%% ScriptDir is the relative path of the script containing dir to
+%% ScriptDir is the relative path of the script containing dir to
%% code:priv_dir/1
%% ScriptFile is the filename of the script to parse the logs
-%% Interval represents the amount of time between calls to the
+%% Interval represents the amount of time between calls to the
%% script, in ms. (Note that the current implementation does <b>NOT</b>
-%% prevent calling the parser multiple times during an hour, resulting in
+%% prevent calling the parser multiple times during an hour, resulting in
%% inflated visitor counts.
%% @end
%%------------------------------------------------------------------------------
@@ -66,8 +66,8 @@ handle_cast(_Req, State) ->
handle_info(parse_eval, State) ->
{ok, App} = application:get_application(),
- PyCmd = "python -u " ++ filename:join([code:priv_dir(App),
- State#state.script_dir,
+ PyCmd = "python -u " ++ filename:join([code:priv_dir(App),
+ State#state.script_dir,
State#state.script_file]),
Port = open_port({spawn, PyCmd}, [{packet, 1}, binary, use_stdio]),
case retrieve_path_stats(Port, erli_storage:path_list()) of
@@ -92,7 +92,7 @@ code_change(_OldVsn, State, _Extra) ->
%%%=============================================================================
%%------------------------------------------------------------------------------
%% @private
-%% @spec retrieve_path_stats(Port::port(), list()) ->
+%% @spec retrieve_path_stats(Port::port(), list()) ->
%% {parsing_complete, true} |
%% {reschedule, Time::integer()} |
%% {error, timeout}
@@ -108,20 +108,20 @@ retrieve_path_stats(Port, [Path | RemPaths]) ->
case binary_to_term(RespData) of
{reschedule, Time} ->
retrieve_path_stats(Port, []), % close the port before
- % rescheduling
+ % rescheduling
{reschedule, Time};
{Countries, UniqueIPs, ClickCount, TimeStamp} ->
- erli_storage:update_path_stats(Path,
- Countries,
- UniqueIPs,
- ClickCount,
+ erli_storage:update_path_stats(Path,
+ Countries,
+ UniqueIPs,
+ ClickCount,
TimeStamp),
retrieve_path_stats(Port, RemPaths)
end
after
5000 ->
error_logger:warning_msg("[ERLI] ~s timed out on retrieve_path_stats/2"
- " for path ~s~n",
+ " for path ~s~n",
[?MODULE, Path]),
{error, timeout}
end;
Oops, something went wrong.

0 comments on commit 51cfa0a

Please sign in to comment.