text
stringlengths 2
1.04M
| meta
dict |
---|---|
pfUI:RegisterSkin("Help", "vanilla:tbc", function ()
local rawborder, border = GetBorderSize()
local bpad = rawborder > 1 and border - GetPerfectPixel() or GetPerfectPixel()
-- not much here for tbc yet
if pfUI.client > 11200 then
local ticket, background = TicketStatusFrame:GetChildren()
CreateBackdrop(background, nil, true, .75)
TicketStatusFrame:SetHeight(40)
TicketStatusFrame:ClearAllPoints()
TicketStatusFrame:SetPoint("TOP", 0, -5)
UpdateMovable(TicketStatusFrame)
return
end
StripTextures(HelpFrame)
CreateBackdrop(HelpFrame, nil, nil, .75)
CreateBackdropShadow(HelpFrame)
HelpFrame.backdrop:SetPoint("TOPLEFT", 4, -4)
HelpFrame.backdrop:SetPoint("BOTTOMRIGHT", -44, 12)
HelpFrame:SetHitRectInsets(4,44,4,12)
EnableMovable(HelpFrame)
SkinCloseButton(HelpFrameCloseButton, HelpFrame.backdrop, -6, -6)
local title = GetNoNameObject(HelpFrame, "FontString", "ARTWORK", HELP_FRAME_TITLE)
title:ClearAllPoints()
title:SetPoint("TOP", HelpFrame.backdrop, "TOP", 0, -10)
-- HelpFrameHome
StripTextures(HelpFrameHomeIssues)
SkinButton(HelpFrameHomeIssues)
HelpFrameHomeIssues:SetScript("OnMouseUp", function() end)
HelpFrameHomeIssues:SetScript("OnMouseDown", function() end)
SkinButton(HelpFrameHomeCancel)
-- HelpFrameGM
SkinButton(HelpFrameGMCancel)
SkinButton(HelpFrameGMBack)
HelpFrameGMBack:ClearAllPoints()
HelpFrameGMBack:SetPoint("RIGHT", HelpFrameGMCancel, "LEFT", -2*bpad, 0)
-- HelpFrameOpenTicket
StripTextures(HelpFrameOpenTicketDivider)
CreateBackdrop(HelpFrameOpenTicketScrollFrame, nil, nil, .75)
StripTextures(HelpFrameOpenTicketScrollFrame)
SkinScrollbar(HelpFrameOpenTicketScrollFrameScrollBar)
HelpFrameOpenTicketText:SetMaxLetters(5000)
SkinButton(HelpFrameOpenTicketCancel)
SkinButton(HelpFrameOpenTicketSubmit)
HelpFrameOpenTicketSubmit:ClearAllPoints()
HelpFrameOpenTicketSubmit:SetPoint("RIGHT", HelpFrameOpenTicketCancel, "LEFT", -2*bpad, 0)
-- HelpFrameGeneral
StripTextures(HelpFrameGeneralButton)
SkinButton(HelpFrameGeneralButton)
HelpFrameGeneralButton:SetScript("OnMouseUp", function() end)
HelpFrameGeneralButton:SetScript("OnMouseDown", function() end)
StripTextures(HelpFrameGeneralButton2)
SkinButton(HelpFrameGeneralButton2)
HelpFrameGeneralButton2:SetScript("OnMouseUp", function() end)
HelpFrameGeneralButton2:SetScript("OnMouseDown", function() end)
SkinButton(HelpFrameGeneralCancel)
SkinButton(HelpFrameGeneralBack)
HelpFrameGeneralBack:ClearAllPoints()
HelpFrameGeneralBack:SetPoint("RIGHT", HelpFrameGeneralCancel, "LEFT", -2*bpad, 0)
-- HelpFrameHarassment
StripTextures(HelpFrameHarassmentDivider)
StripTextures(HelpFrameHarassmentDivider2)
StripTextures(HelpFrameVerbalHarassmentButton)
SkinButton(HelpFrameVerbalHarassmentButton)
HelpFrameVerbalHarassmentButton:SetScript("OnMouseUp", function() end)
HelpFrameVerbalHarassmentButton:SetScript("OnMouseDown", function() end)
StripTextures(HelpFramePhysicalHarassmentButton)
SkinButton(HelpFramePhysicalHarassmentButton)
HelpFramePhysicalHarassmentButton:SetScript("OnMouseUp", function() end)
HelpFramePhysicalHarassmentButton:SetScript("OnMouseDown", function() end)
SkinButton(HelpFrameHarassmentCancel)
SkinButton(HelpFrameHarassmentBack)
HelpFrameHarassmentBack:ClearAllPoints()
HelpFrameHarassmentBack:SetPoint("RIGHT", HelpFrameHarassmentCancel, "LEFT", -2*bpad, 0)
-- TicketStatusFrame
CreateBackdrop(TicketStatusFrame, nil, true, .75)
TicketStatusFrame:ClearAllPoints()
TicketStatusFrame:SetPoint("TOP", 0, -5)
UpdateMovable(TicketStatusFrame)
function TicketStatusFrame_OnEvent()
if ( event == "PLAYER_ENTERING_WORLD" ) then
GetGMTicket()
else
if ( arg1 ~= 0 ) then
this:Show()
refreshTime = GMTICKET_CHECK_INTERVAL
else
this:Hide()
end
end
end
end)
| {
"content_hash": "b498d14826033775fd8598198f2db24a",
"timestamp": "",
"source": "github",
"line_count": 115,
"max_line_length": 92,
"avg_line_length": 34.04347826086956,
"alnum_prop": 0.7821200510855684,
"repo_name": "shagu/pfUI",
"id": "54413aa16448579bc4271f931e66f352d1ca160f",
"size": "3915",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "skins/blizzard/help.lua",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Lua",
"bytes": "1504106"
}
],
"symlink_target": ""
} |
require_relative '../../test_helper'
require 'test/unit'
include Mastercard::Common
include Mastercard::Util
include Mastercard::Services::Restaurants
class ReataurantsLocalFavoritesServiceTest < Test::Unit::TestCase
def setup
@service = RestaurantsLocalFavoritesService.new(SANDBOX_CONSUMER_KEY, TestUtils.new.get_private_key(SANDBOX), SANDBOX)
end
def test_by_numeric_postal_code
options = RestaurantsLocalFavoritesRequestOptions.new(0, 25)
options.country = 'USA'
options.postal_code = 46320
restaurants = @service.get_restaurants(options)
assert(restaurants.restaurant != nil, 'true')
assert(restaurants.restaurant.count > 0, 'true')
end
end
| {
"content_hash": "ecf3d9c8bcb03ee95fba05fd0bb5d1cd",
"timestamp": "",
"source": "github",
"line_count": 23,
"max_line_length": 122,
"avg_line_length": 29.869565217391305,
"alnum_prop": 0.7569141193595342,
"repo_name": "M4gn4tor/mastercard-api-ruby",
"id": "5fda07d5dc42212fee8308cd7dad36792559fb5e",
"size": "687",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "test/services/restaurants/RestaurantsLocalFavoritesServiceTest.rb",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "Ruby",
"bytes": "222495"
}
],
"symlink_target": ""
} |
namespace ct_common {
const int QUEX_TKN_TERMINATION = ct_common::parser::token::TKN_END;
const int QUEX_TKN_UNINITIALIZED = 1;
const int QUEX_TKN_UNKNOWN = 2;
const int QUEX_TKN_FAILURE = 3;
}
#endif // CT_COMMON_PARSER_CT_COMMON_LEXER_TOKEN_IDS_H_
| {
"content_hash": "cc97f12aaf68460298128776d271be80",
"timestamp": "",
"source": "github",
"line_count": 8,
"max_line_length": 67,
"avg_line_length": 31.5,
"alnum_prop": 0.7301587301587301,
"repo_name": "xxyzzzq/ct_common",
"id": "ed0196d34abda763a1659e641664ce70ecfa161d",
"size": "473",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/ct_common/parser/ct_common_lexer-token_ids.h",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C",
"bytes": "413"
},
{
"name": "C++",
"bytes": "192453"
},
{
"name": "CMake",
"bytes": "2053"
},
{
"name": "PAWN",
"bytes": "2945"
},
{
"name": "Shell",
"bytes": "3050"
}
],
"symlink_target": ""
} |
#include "mudlle.h"
#include "tree.h"
#include <string.h>
#include <stddef.h>
#include "runtime/runtime.h"
#include "alloc.h"
#include "global.h"
#include "utils.h"
#include "mparser.h"
#include "lexer.h"
#include "calloc.h"
#include "module.h"
#include "call.h"
#include "dump.h"
#include "compile.h"
#include "this_machine.h"
#include "mate_machine.h"
static void is_gstate(struct global_state *gstate)
{
/* Could use lots more checks on gstate... */
TYPEIS(gstate, type_vector);
if (vector_len(gstate) != 8)
RUNTIME_ERROR(error_bad_type);
}
OPERATION("idebug", idebug, "n -> . Set internal debugging level",
1, (value lvl), OP_LEAF | OP_NOESCAPE)
{
ISINT(lvl);
debug_lvl = intval(lvl);
undefined();
}
OPERATION("mudlle_parse", mudlle_parse,
"s -> v. Parses a mudlle expression and returns a parse tree",
1, (struct string *code), OP_LEAF | OP_NOESCAPE)
{
mfile f;
value parsed;
block_t pmemory;
TYPEIS(code, type_string);
read_from_string(code->str, FALSE);
pmemory = new_block();
if ((f = parse(pmemory)))
parsed = mudlle_parse(pmemory, f);
else
parsed = makebool(FALSE);
free_block(pmemory);
return parsed;
}
UNSAFEOP("mudlle_parse_file", mudlle_parse_file,
"s1 s2 -> v. Parses a file s (nice name s2) and returns its parse tree",
2, (struct string *name, struct string *nicename),
OP_LEAF | OP_NOESCAPE)
{
FILE *f;
value parsed;
char *fname;
block_t pmemory;
mfile mf;
TYPEIS(name, type_string);
TYPEIS(nicename, type_string);
if (!(f = fopen(name->str, "r"))) return makebool(FALSE);
LOCALSTR(fname, nicename);
read_from_file(f, FALSE);
pmemory = new_block();
lexloc.filename = fname;
if ((mf = parse(pmemory)))
parsed = mudlle_parse(pmemory, mf);
else
parsed = makebool(FALSE);
free_block(pmemory);
fclose(f);
return parsed;
}
TYPEDOP("closure?", closurep, "x -> b. True if x is a closure",
1, (value x),
OP_LEAF | OP_NOALLOC | OP_NOESCAPE, "x.n")
{
return makebool(POINTERP(x) && OBJTYPE(x) == type_function);
}
TYPEDOP("primitive?", primitivep, "x -> b. True if x is a primitive",
1, (value x),
OP_LEAF | OP_NOALLOC | OP_NOESCAPE, "x.n")
{
return makebool(PRIMITIVEP(x));
}
TYPEDOP("primitive_nargs", primitive_nargs,
"primitive -> b. Returns # of arguments of primitive",
1, (value p),
OP_LEAF | OP_NOALLOC | OP_NOESCAPE, "f.n")
{
if (!PRIMITIVEP(p))
RUNTIME_ERROR(error_bad_type);
return makeint(PRIMARGS(p));
}
TYPEDOP("primitive_flags", primitive_flags,
"primitive -> n. Returns flags of primitive",
1, (value p),
OP_LEAF | OP_NOALLOC | OP_NOESCAPE, "f.n")
{
if (!PRIMITIVEP(p))
RUNTIME_ERROR(error_bad_type);
return makeint(PRIMOP(globals, p)->flags);
}
TYPEDOP("primitive_type", primitive_type,
"primitive -> l. Returns primitive's type signature",
1, (value p),
OP_LEAF | OP_NOESCAPE, "f.l")
{
struct list *l = NULL;
const char **atyping;
if (!PRIMITIVEP(p))
RUNTIME_ERROR(error_bad_type);
atyping = PRIMOP(globals, p)->type;
if (atyping)
{
GCPRO1(l);
while (*atyping)
{
struct string *sig = alloc_string(*atyping++);
l = alloc_list(sig, l);
}
GCPOP(1);
}
return l;
}
UNSAFEOP("make_primitive", make_primitve,
"n -> f. Returns nth primitive",
1, (value n), OP_LEAF | OP_NOESCAPE)
{
ISINT(n);
return PRIMITIVE_NB_TO_ATOM(intval(n));
}
UNSAFEOP("global_table", global_table, "gstate -> table. Returns global symbol table",
1, (struct global_state *gstate),
OP_LEAF | OP_NOALLOC | OP_NOESCAPE)
{
is_gstate(gstate);
return gstate->global;
}
TYPEDOP("global_lookup", global_lookup,
"gstate s -> n. Returns index of global variable s",
2, (struct global_state *gstate, struct string *name),
OP_LEAF | OP_NOESCAPE, "s.n")
{
is_gstate(gstate);
TYPEIS(name, type_string);
return makeint(mglobal_lookup(gstate, name));
}
TYPEDOP("global_add", global_add,
"gstate s -> n. Add and return index of global variable s",
2, (struct global_state *gstate, struct string *name),
OP_LEAF | OP_NOESCAPE, "s.n")
{
char *tname;
TYPEIS(name, type_string);
LOCALSTR(tname, name);
return makeint(global_add(gstate, tname, stype_any));
}
TYPEDOP("global_value", global_value,
"gstate n -> x. Returns value of global variable n",
2, (struct global_state *gstate, value goffset),
OP_LEAF | OP_NOALLOC | OP_NOESCAPE, "n.x")
{
ivalue n;
is_gstate(gstate);
ISINT(goffset); n = intval(goffset);
if (n < 0 || n >= intval(gstate->environment->used)) RUNTIME_ERROR(error_bad_value);
return GVAR(gstate, n);
}
UNSAFEOP("global_set!", global_setb,
"gstate n x -> . Sets global variable n to x. Fails if n is readonly",
3, (struct global_state *gstate, value goffset, value x),
OP_LEAF | OP_NOALLOC)
{
ivalue n;
is_gstate(gstate);
ISINT(goffset); n = intval(goffset);
if (n < 0 || n >= intval(gstate->environment->used) || GCONSTANT(gstate, n))
RUNTIME_ERROR(error_bad_value);
GVAR(gstate, n) = x;
undefined();
}
TYPEDOP("module_status", module_status, "gstate s -> n. Returns status of module s",
2, (struct global_state *gstate, struct string *name),
OP_LEAF | OP_NOALLOC | OP_NOESCAPE, "s.n")
{
is_gstate(gstate);
TYPEIS(name, type_string);
return makeint(module_status(gstate, name->str));
}
UNSAFEOP("module_set!", module_setb, "gstate s n -> . Sets status of module s to n",
3, (struct global_state *gstate, struct string *name, value status),
OP_LEAF | OP_NOALLOC | OP_NOESCAPE)
{
char *tname;
is_gstate(gstate);
TYPEIS(name, type_string);
LOCALSTR(tname, name);
ISINT(status);
module_set(gstate, tname, intval(status));
undefined();
}
UNSAFEOP("module_unload", module_unload,
"gstate s -> b. Unload module s, false if protected",
2, (struct global_state *gstate, struct string *name),
OP_LEAF | OP_NOALLOC)
{
is_gstate(gstate);
TYPEIS(name, type_string);
return makebool(module_unload(gstate, name->str));
}
#if 0
TYPEDOP("module_require", module_require,
"gstate s -> n. Load module s if needed, return its new status",
2, (struct global_state *gstate, struct string *name),
0, "s.n")
{
char *tname;
is_gstate(gstate);
TYPEIS(name, type_string);
LOCALSTR(tname, name);
return makeint(module_require(tname));
}
#endif
TYPEDOP("module_vstatus", module_vstatus,
"gstate n -> s/n. Return status of global variable n",
2, (struct global_state *gstate, value goffset),
OP_LEAF | OP_NOALLOC | OP_NOESCAPE, "n.S")
{
ivalue n;
struct string *mod;
int status;
is_gstate(gstate);
ISINT(goffset); n = intval(goffset);
if (n < 0 || n >= intval(gstate->environment->used)) RUNTIME_ERROR(error_bad_value);
status = module_vstatus(gstate, n, &mod);
if (status == var_module) return mod;
else return makeint(status);
}
UNSAFEOP("module_vset!", module_vsetb,
"gstate n s/n -> . Sets status of global variable n",
3, (struct global_state *gstate, value goffset, value status),
OP_LEAF | OP_NOALLOC)
{
ivalue n;
struct string *mod;
is_gstate(gstate);
ISINT(goffset); n = intval(goffset);
if (n < 0 || n >= intval(gstate->environment->used)) RUNTIME_ERROR(error_bad_value);
if (INTEGERP(status))
{
if (status != makeint(var_normal) && status != makeint(var_write))
RUNTIME_ERROR(error_bad_value);
mod = NULL;
}
else
{
mod = status;
TYPEIS(mod, type_string);
status = makeint(var_module);
}
return makebool(module_vset(gstate, n, intval(status), mod));
}
UNSAFEOP("module_table", module_table,
"gstate -> table. Returns module status table",
1, (struct global_state *gstate),
OP_LEAF | OP_NOALLOC | OP_NOESCAPE)
{
is_gstate(gstate);
return gstate->modules;
}
OPERATION("remote_save", remote_save,
"rstate x -> s. Dump x to string for remote machine rstate",
2, (struct remote_state *rstate, value x),
OP_LEAF | OP_NOESCAPE)
{
uvalue size, rglobals;
block_t mem = new_block();
u8 *dumpmem;
struct string *data, *dglobals;
struct vector *dump;
/* Lots more checks... */
TYPEIS(rstate, type_vector);
if (!remote_save(mem, rstate, x, &dumpmem, &rglobals, &size))
{
free_block(mem);
return makebool(FALSE);
}
dump = alloc_vector(2);
GCPRO1(dump);
data = alloc_string_n(rglobals);
dump->data[0] = data;
memcpy(data->str, dumpmem, rglobals);
dglobals = alloc_string_n(size - rglobals);
dump->data[1] = dglobals;
memcpy(dglobals->str, dumpmem + rglobals, size - rglobals);
GCPOP(1);
free_block(mem);
return dump;
}
static value alloc_state(struct c_machine_specification *cms)
{
struct machine_specification *machine =
(struct machine_specification *)allocate_record(type_vector, 4);
struct extptr *pms;
struct global_state *gstate;
/* Leaky. */
struct c_machine_specification *copycms = xmalloc(sizeof *copycms);
*copycms = *cms;
GCPRO1(machine);
pms = alloc_extptr(copycms);
GCPOP(1);
machine->c_machine_specification = pms;
gstate = new_global_state(machine);
GCPRO1(gstate);
runtime_setup(gstate, 0, NULL);
GCPOP(1);
return alloc_remote_state(gstate);
}
UNSAFEOP("new_imate_state", new_imate_state,
" -> rstate. Returns a new global state for int-based mate-motlle",
0, (void),
OP_LEAF | OP_NOESCAPE)
{
return alloc_state(&mate_imachine_specification);
}
UNSAFEOP("new_fmate_state", new_fmate_state,
" -> rstate. Returns a new global state for float-based mate-motlle",
0, (void),
OP_LEAF | OP_NOESCAPE)
{
return alloc_state(&mate_fmachine_specification);
}
UNSAFEOP("set_gstate_primops!", set_gstate_primops,
"gstate v -> . Internal use. Will change.",
2, (struct global_state *gstate, struct vector *nargs),
OP_LEAF)
{
/* Leaky. Yucky. */
struct primitive_ext *prims, **primarray;
int nprims, i;
struct c_machine_specification *mspec;
is_gstate(gstate);
TYPEIS(nargs, type_vector);
nprims = vector_len(nargs);
for (i = 0; i < nprims; i++)
ISINT(nargs->data[i]);
mspec = C_MACHINE_SPECIFICATION(gstate->machine);
primarray = xmalloc(nprims * sizeof *primarray);
prims = xmalloc(nprims * sizeof *prims);
for (i = 0; i < nprims; i++)
{
primarray[i] = &prims[i];
prims[i].nargs = intval(nargs->data[i]);
}
mspec->primops = primarray;
mspec->primop_count = nprims;
undefined();
}
UNSAFEOP("set_gstate_bytecodes!", set_gstate_bytecodes,
"gstate s -> . Internal use. Will change.",
2, (struct global_state *gstate, struct string *bytecodes),
OP_LEAF)
{
/* Leaky. Yucky. */
struct c_machine_specification *mspec;
is_gstate(gstate);
TYPEIS(bytecodes, type_string);
if (string_len(bytecodes) != 256)
RUNTIME_ERROR(error_bad_value);
mspec = C_MACHINE_SPECIFICATION(gstate->machine);
mspec->layout.bytecodes = xmalloc(256);
memcpy(mspec->layout.bytecodes, bytecodes->str, 256);
undefined();
}
UNSAFEOP("string_compile", string_compile,
"gstate s b -> fn. Compile s for global state context gstate.\n\
If b is true, compile as scheme string.",
3, (struct global_state *gstate, struct string *s, value is_scheme), 0)
{
block_t nb;
is_gstate(gstate);
TYPEIS(s, type_string);
nb = new_block();
read_from_string(bstrdup(nb, s->str), istrue(is_scheme));
compile_and_run(nb, gstate, "<remote>", NULL, TRUE);
return PRIMITIVE_STOLE_CC;
}
UNSAFEOP("file_compile", file_compile,
"gstate s b -> fn. Compile file s for global state context gstate.\n\
If b is true, compile as scheme file.",
3, (struct global_state *gstate, struct string *s, value is_scheme), 0)
{
block_t nb;
const char *fname;
FILE *f;
is_gstate(gstate);
TYPEIS(s, type_string);
f = fopen(s->str, "r");
if (f)
{
nb = new_block();
fname = bstrdup(nb, s->str);
read_from_file(f, istrue(is_scheme));
compile_and_run(nb, gstate, fname, NULL, TRUE);
return PRIMITIVE_STOLE_CC;
}
else
RUNTIME_ERROR(error_bad_value);
}
UNSAFEOP("closure_code", remote_toplevel_closure,
"fn -> code. Remove code of a 0-variable closure",
1, (struct closure *c), 0)
{
TYPEIS(c, type_function);
if (c->o.size != offsetof(struct closure, variables))
RUNTIME_ERROR(error_bad_value);
return c->code;
}
#if DEFINE_GLOBALS
GLOBALS(support)
{
/* Primitive flags */
system_define("OP_LEAF", makeint(OP_LEAF));
system_define("OP_NOALLOC", makeint(OP_NOALLOC));
system_define("OP_CLEAN", makeint(OP_CLEAN));
system_define("OP_NOESCAPE", makeint(OP_NOESCAPE));
/* Mudlle object flags */
system_define("MUDLLE_READONLY", makeint(OBJ_READONLY));
system_define("MUDLLE_IMMUTABLE", makeint(OBJ_IMMUTABLE));
/* Module support */
system_define("module_unloaded", makeint(module_unloaded));
system_define("module_error", makeint(module_error));
system_define("module_loading", makeint(module_loading));
system_define("module_loaded", makeint(module_loaded));
system_define("module_protected", makeint(module_protected));
system_define("var_normal", makeint(var_normal));
system_define("var_write", makeint(var_write));
/* C options information */
#ifdef GCDEBUG
system_define("OPTION_GCDEBUG", makebool(TRUE));
#else
system_define("OPTION_GCDEBUG", makebool(FALSE));
#endif
#define BC(name, value) system_define("bytecode_" #name, makeint(value));
#include "bytecodes.h"
#undef BC
}
#endif
| {
"content_hash": "eafbb7ad8d8f0b8e70803f2eef5f12ff",
"timestamp": "",
"source": "github",
"line_count": 543,
"max_line_length": 86,
"avg_line_length": 24.465930018416206,
"alnum_prop": 0.6613473842679713,
"repo_name": "fresskarma/tinyos-1.x",
"id": "f0c5d31098264ee6e992a343061f7aab2078557a",
"size": "14331",
"binary": false,
"copies": "3",
"ref": "refs/heads/master",
"path": "tos/lib/VM/languages/motlle/standalone/runtime/support.c",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "Assembly",
"bytes": "137296"
},
{
"name": "Awk",
"bytes": "2286"
},
{
"name": "C",
"bytes": "10268716"
},
{
"name": "C#",
"bytes": "140791"
},
{
"name": "C++",
"bytes": "2931461"
},
{
"name": "CSS",
"bytes": "19694"
},
{
"name": "Forth",
"bytes": "101"
},
{
"name": "Groff",
"bytes": "3149"
},
{
"name": "HTML",
"bytes": "1387492"
},
{
"name": "Inno Setup",
"bytes": "16361"
},
{
"name": "Java",
"bytes": "7496416"
},
{
"name": "Lex",
"bytes": "16806"
},
{
"name": "Logos",
"bytes": "10058"
},
{
"name": "M",
"bytes": "2148"
},
{
"name": "Makefile",
"bytes": "871469"
},
{
"name": "Mathematica",
"bytes": "164375"
},
{
"name": "Matlab",
"bytes": "760094"
},
{
"name": "OCaml",
"bytes": "34306"
},
{
"name": "Objective-C",
"bytes": "1149978"
},
{
"name": "PHP",
"bytes": "79339"
},
{
"name": "Perl",
"bytes": "649566"
},
{
"name": "Perl6",
"bytes": "13417"
},
{
"name": "PostScript",
"bytes": "476077"
},
{
"name": "Python",
"bytes": "884036"
},
{
"name": "Shell",
"bytes": "91087"
},
{
"name": "Smarty",
"bytes": "1515"
},
{
"name": "SourcePawn",
"bytes": "29314"
},
{
"name": "Standard ML",
"bytes": "2129"
},
{
"name": "Tcl",
"bytes": "168362"
},
{
"name": "TeX",
"bytes": "213012"
},
{
"name": "TypeScript",
"bytes": "3834"
},
{
"name": "Visual Basic",
"bytes": "274161"
},
{
"name": "Yacc",
"bytes": "43956"
},
{
"name": "nesC",
"bytes": "46659836"
}
],
"symlink_target": ""
} |
package main
import (
"github.com/gin-gonic/gin"
"github.com/nicolas-nannoni/fingy-gateway/events"
)
func SetupServiceSideGateway() {
r := gin.Default()
r.GET("/", index)
r.POST("/service/:serviceId/sendEvent/device/:deviceId/*path", sendEventToDevice)
r.Run(":8090")
}
func index(c *gin.Context) {
c.Status(200)
}
func sendEventToDevice(c *gin.Context) {
serviceId := c.Param("serviceId")
deviceId := c.Param("deviceId")
path := c.Param("path")
evt := events.Event{
ServiceId: serviceId,
Path: path,
}
Registry.SendToDevice(serviceId, deviceId, &evt)
}
| {
"content_hash": "c872f33367239138791a90a0e850731a",
"timestamp": "",
"source": "github",
"line_count": 33,
"max_line_length": 82,
"avg_line_length": 17.727272727272727,
"alnum_prop": 0.6837606837606838,
"repo_name": "nicolas-nannoni/fingy-gateway",
"id": "9db74432b1c0ce9d7d5782727e09dd77e63cd8f9",
"size": "585",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "serviceGateway.go",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Go",
"bytes": "8580"
}
],
"symlink_target": ""
} |
import os
import tempfile
from .test_cases import ForgeTest
from pydeploy import os_api
from pydeploy.checkout_cache import CheckoutCache
from pydeploy.checkout_cache import _CHECKOUT_CACHE_NAME
class CheckoutCacheTest(ForgeTest):
def setUp(self):
super(CheckoutCacheTest, self).setUp()
self.root = tempfile.gettempdir()
self.expecetd_checkout_path = os.path.join(self.root, _CHECKOUT_CACHE_NAME)
self.forge.replace_many(os_api, "makedirs", "directory_exists")
def test__creates_if_not_exists(self):
os_api.directory_exists(self.expecetd_checkout_path).and_return(False)
os_api.makedirs(self.expecetd_checkout_path)
self.forge.replay()
c = CheckoutCache(self.root)
def test__dont_create_if_not_exists(self):
os_api.directory_exists(self.expecetd_checkout_path).and_return(True)
self.forge.replay()
c = CheckoutCache(self.root)
def test__get_checkout_path(self):
os_api.directory_exists(self.expecetd_checkout_path).and_return(True)
self.forge.replay()
c = CheckoutCache(self.root)
url = "some.url"
path1 = c.get_checkout_path(url)
path2 = c.get_checkout_path(url)
self.assertEquals(path1, path2)
self.assertEquals(os.path.split(path1)[0], self.expecetd_checkout_path)
| {
"content_hash": "b8668ce868382f58184ec1ac5ba0f663",
"timestamp": "",
"source": "github",
"line_count": 31,
"max_line_length": 83,
"avg_line_length": 43.12903225806452,
"alnum_prop": 0.6881077038145101,
"repo_name": "vmalloc/pydeploy",
"id": "34786703c41107293fe680d69f8cd63b5bf52631",
"size": "1337",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "tests/test__checkout_cache.py",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "Python",
"bytes": "79314"
}
],
"symlink_target": ""
} |
/**
* @file STM32/pwm_lld.h
* @brief STM32 PWM subsystem low level driver header.
*
* @addtogroup PWM
* @{
*/
#ifndef _PWM_LLD_H_
#define _PWM_LLD_H_
#if HAL_USE_PWM || defined(__DOXYGEN__)
#include "stm32_tim.h"
/*===========================================================================*/
/* Driver constants. */
/*===========================================================================*/
/**
* @brief Number of PWM channels per PWM driver.
*/
#define PWM_CHANNELS STM32_TIM_MAX_CHANNELS
/**
* @name STM32-specific PWM complementary output mode macros
* @{
*/
/**
* @brief Complementary output modes mask.
* @note This is an STM32-specific setting.
*/
#define PWM_COMPLEMENTARY_OUTPUT_MASK 0xF0
/**
* @brief Complementary output not driven.
* @note This is an STM32-specific setting.
*/
#define PWM_COMPLEMENTARY_OUTPUT_DISABLED 0x00
/**
* @brief Complementary output, active is logic level one.
* @note This is an STM32-specific setting.
* @note This setting is only available if the configuration option
* @p STM32_PWM_USE_ADVANCED is set to TRUE and only for advanced
* timers TIM1 and TIM8.
*/
#define PWM_COMPLEMENTARY_OUTPUT_ACTIVE_HIGH 0x10
/**
* @brief Complementary output, active is logic level zero.
* @note This is an STM32-specific setting.
* @note This setting is only available if the configuration option
* @p STM32_PWM_USE_ADVANCED is set to TRUE and only for advanced
* timers TIM1 and TIM8.
*/
#define PWM_COMPLEMENTARY_OUTPUT_ACTIVE_LOW 0x20
/** @} */
/*===========================================================================*/
/* Driver pre-compile time settings. */
/*===========================================================================*/
/**
* @name Configuration options
* @{
*/
/**
* @brief If advanced timer features switch.
* @details If set to @p TRUE the advanced features for TIM1 and TIM8 are
* enabled.
* @note The default is @p TRUE.
*/
#if !defined(STM32_PWM_USE_ADVANCED) || defined(__DOXYGEN__)
#define STM32_PWM_USE_ADVANCED FALSE
#endif
/**
* @brief PWMD1 driver enable switch.
* @details If set to @p TRUE the support for PWMD1 is included.
* @note The default is @p TRUE.
*/
#if !defined(STM32_PWM_USE_TIM1) || defined(__DOXYGEN__)
#define STM32_PWM_USE_TIM1 FALSE
#endif
/**
* @brief PWMD2 driver enable switch.
* @details If set to @p TRUE the support for PWMD2 is included.
* @note The default is @p TRUE.
*/
#if !defined(STM32_PWM_USE_TIM2) || defined(__DOXYGEN__)
#define STM32_PWM_USE_TIM2 FALSE
#endif
/**
* @brief PWMD3 driver enable switch.
* @details If set to @p TRUE the support for PWMD3 is included.
* @note The default is @p TRUE.
*/
#if !defined(STM32_PWM_USE_TIM3) || defined(__DOXYGEN__)
#define STM32_PWM_USE_TIM3 FALSE
#endif
/**
* @brief PWMD4 driver enable switch.
* @details If set to @p TRUE the support for PWMD4 is included.
* @note The default is @p TRUE.
*/
#if !defined(STM32_PWM_USE_TIM4) || defined(__DOXYGEN__)
#define STM32_PWM_USE_TIM4 FALSE
#endif
/**
* @brief PWMD5 driver enable switch.
* @details If set to @p TRUE the support for PWMD5 is included.
* @note The default is @p TRUE.
*/
#if !defined(STM32_PWM_USE_TIM5) || defined(__DOXYGEN__)
#define STM32_PWM_USE_TIM5 FALSE
#endif
/**
* @brief PWMD8 driver enable switch.
* @details If set to @p TRUE the support for PWMD8 is included.
* @note The default is @p TRUE.
*/
#if !defined(STM32_PWM_USE_TIM8) || defined(__DOXYGEN__)
#define STM32_PWM_USE_TIM8 FALSE
#endif
/**
* @brief PWMD9 driver enable switch.
* @details If set to @p TRUE the support for PWMD9 is included.
* @note The default is @p TRUE.
*/
#if !defined(STM32_PWM_USE_TIM9) || defined(__DOXYGEN__)
#define STM32_PWM_USE_TIM9 FALSE
#endif
/**
* @brief PWMD1 interrupt priority level setting.
*/
#if !defined(STM32_PWM_TIM1_IRQ_PRIORITY) || defined(__DOXYGEN__)
#define STM32_PWM_TIM1_IRQ_PRIORITY 7
#endif
/**
* @brief PWMD2 interrupt priority level setting.
*/
#if !defined(STM32_PWM_TIM2_IRQ_PRIORITY) || defined(__DOXYGEN__)
#define STM32_PWM_TIM2_IRQ_PRIORITY 7
#endif
/**
* @brief PWMD3 interrupt priority level setting.
*/
#if !defined(STM32_PWM_TIM3_IRQ_PRIORITY) || defined(__DOXYGEN__)
#define STM32_PWM_TIM3_IRQ_PRIORITY 7
#endif
/**
* @brief PWMD4 interrupt priority level setting.
*/
#if !defined(STM32_PWM_TIM4_IRQ_PRIORITY) || defined(__DOXYGEN__)
#define STM32_PWM_TIM4_IRQ_PRIORITY 7
#endif
/**
* @brief PWMD5 interrupt priority level setting.
*/
#if !defined(STM32_PWM_TIM5_IRQ_PRIORITY) || defined(__DOXYGEN__)
#define STM32_PWM_TIM5_IRQ_PRIORITY 7
#endif
/**
* @brief PWMD8 interrupt priority level setting.
*/
#if !defined(STM32_PWM_TIM8_IRQ_PRIORITY) || defined(__DOXYGEN__)
#define STM32_PWM_TIM8_IRQ_PRIORITY 7
#endif
/** @} */
/**
* @brief PWMD9 interrupt priority level setting.
*/
#if !defined(STM32_PWM_TIM9_IRQ_PRIORITY) || defined(__DOXYGEN__)
#define STM32_PWM_TIM9_IRQ_PRIORITY 7
#endif
/** @} */
/*===========================================================================*/
/* Configuration checks. */
/*===========================================================================*/
#if STM32_PWM_USE_TIM1 && !STM32_HAS_TIM1
#error "TIM1 not present in the selected device"
#endif
#if STM32_PWM_USE_TIM2 && !STM32_HAS_TIM2
#error "TIM2 not present in the selected device"
#endif
#if STM32_PWM_USE_TIM3 && !STM32_HAS_TIM3
#error "TIM3 not present in the selected device"
#endif
#if STM32_PWM_USE_TIM4 && !STM32_HAS_TIM4
#error "TIM4 not present in the selected device"
#endif
#if STM32_PWM_USE_TIM5 && !STM32_HAS_TIM5
#error "TIM5 not present in the selected device"
#endif
#if STM32_PWM_USE_TIM8 && !STM32_HAS_TIM8
#error "TIM8 not present in the selected device"
#endif
#if STM32_PWM_USE_TIM9 && !STM32_HAS_TIM9
#error "TIM9 not present in the selected device"
#endif
#if !STM32_PWM_USE_TIM1 && !STM32_PWM_USE_TIM2 && \
!STM32_PWM_USE_TIM3 && !STM32_PWM_USE_TIM4 && \
!STM32_PWM_USE_TIM5 && !STM32_PWM_USE_TIM8 && \
!STM32_PWM_USE_TIM9
#error "PWM driver activated but no TIM peripheral assigned"
#endif
#if STM32_PWM_USE_ADVANCED && !STM32_PWM_USE_TIM1 && !STM32_PWM_USE_TIM8
#error "advanced mode selected but no advanced timer assigned"
#endif
/* Checks on allocation of TIMx units.*/
#if STM32_PWM_USE_TIM1
#if defined(STM32_TIM1_IS_USED)
#error "PWMD1 requires TIM1 but the timer is already used"
#else
#define STM32_TIM1_IS_USED
#endif
#endif
#if STM32_PWM_USE_TIM2
#if defined(STM32_TIM2_IS_USED)
#error "PWMD2 requires TIM2 but the timer is already used"
#else
#define STM32_TIM2_IS_USED
#endif
#endif
#if STM32_PWM_USE_TIM3
#if defined(STM32_TIM3_IS_USED)
#error "PWMD3 requires TIM3 but the timer is already used"
#else
#define STM32_TIM3_IS_USED
#endif
#endif
#if STM32_PWM_USE_TIM4
#if defined(STM32_TIM4_IS_USED)
#error "PWMD4 requires TIM4 but the timer is already used"
#else
#define STM32_TIM4_IS_USED
#endif
#endif
#if STM32_PWM_USE_TIM5
#if defined(STM32_TIM5_IS_USED)
#error "PWMD5 requires TIM5 but the timer is already used"
#else
#define STM32_TIM5_IS_USED
#endif
#endif
#if STM32_PWM_USE_TIM8
#if defined(STM32_TIM8_IS_USED)
#error "PWMD8 requires TIM8 but the timer is already used"
#else
#define STM32_TIM8_IS_USED
#endif
#endif
#if STM32_PWM_USE_TIM9
#if defined(STM32_TIM9_IS_USED)
#error "PWMD9 requires TIM9 but the timer is already used"
#else
#define STM32_TIM9_IS_USED
#endif
#endif
/* IRQ priority checks.*/
#if STM32_PWM_USE_TIM1 && !defined(STM32_TIM1_SUPPRESS_ISR) && \
!OSAL_IRQ_IS_VALID_PRIORITY(STM32_PWM_TIM1_IRQ_PRIORITY)
#error "Invalid IRQ priority assigned to TIM1"
#endif
#if STM32_PWM_USE_TIM2 && !defined(STM32_TIM2_SUPPRESS_ISR) && \
!OSAL_IRQ_IS_VALID_PRIORITY(STM32_PWM_TIM2_IRQ_PRIORITY)
#error "Invalid IRQ priority assigned to TIM2"
#endif
#if STM32_PWM_USE_TIM3 && !defined(STM32_TIM3_SUPPRESS_ISR) && \
!OSAL_IRQ_IS_VALID_PRIORITY(STM32_PWM_TIM3_IRQ_PRIORITY)
#error "Invalid IRQ priority assigned to TIM3"
#endif
#if STM32_PWM_USE_TIM4 && !defined(STM32_TIM4_SUPPRESS_ISR) && \
!OSAL_IRQ_IS_VALID_PRIORITY(STM32_PWM_TIM4_IRQ_PRIORITY)
#error "Invalid IRQ priority assigned to TIM4"
#endif
#if STM32_PWM_USE_TIM5 && !defined(STM32_TIM5_SUPPRESS_ISR) && \
!OSAL_IRQ_IS_VALID_PRIORITY(STM32_PWM_TIM5_IRQ_PRIORITY)
#error "Invalid IRQ priority assigned to TIM5"
#endif
#if STM32_PWM_USE_TIM8 && !defined(STM32_TIM8_SUPPRESS_ISR) && \
!OSAL_IRQ_IS_VALID_PRIORITY(STM32_PWM_TIM8_IRQ_PRIORITY)
#error "Invalid IRQ priority assigned to TIM8"
#endif
#if STM32_PWM_USE_TIM9 && !defined(STM32_TIM9_SUPPRESS_ISR) && \
!OSAL_IRQ_IS_VALID_PRIORITY(STM32_PWM_TIM9_IRQ_PRIORITY)
#error "Invalid IRQ priority assigned to TIM9"
#endif
/*===========================================================================*/
/* Driver data structures and types. */
/*===========================================================================*/
/**
* @brief Type of a PWM mode.
*/
typedef uint32_t pwmmode_t;
/**
* @brief Type of a PWM channel.
*/
typedef uint8_t pwmchannel_t;
/**
* @brief Type of a channels mask.
*/
typedef uint32_t pwmchnmsk_t;
/**
* @brief Type of a PWM counter.
*/
typedef uint32_t pwmcnt_t;
/**
* @brief Type of a PWM driver channel configuration structure.
*/
typedef struct {
/**
* @brief Channel active logic level.
*/
pwmmode_t mode;
/**
* @brief Channel callback pointer.
* @note This callback is invoked on the channel compare event. If set to
* @p NULL then the callback is disabled.
*/
pwmcallback_t callback;
/* End of the mandatory fields.*/
} PWMChannelConfig;
/**
* @brief Type of a PWM driver configuration structure.
*/
typedef struct {
/**
* @brief Timer clock in Hz.
* @note The low level can use assertions in order to catch invalid
* frequency specifications.
*/
uint32_t frequency;
/**
* @brief PWM period in ticks.
* @note The low level can use assertions in order to catch invalid
* period specifications.
*/
pwmcnt_t period;
/**
* @brief Periodic callback pointer.
* @note This callback is invoked on PWM counter reset. If set to
* @p NULL then the callback is disabled.
*/
pwmcallback_t callback;
/**
* @brief Channels configurations.
*/
PWMChannelConfig channels[PWM_CHANNELS];
/* End of the mandatory fields.*/
/**
* @brief TIM CR2 register initialization data.
* @note The value of this field should normally be equal to zero.
*/
uint32_t cr2;
#if STM32_PWM_USE_ADVANCED || defined(__DOXYGEN__)
/**
* @brief TIM BDTR (break & dead-time) register initialization data.
* @note The value of this field should normally be equal to zero.
*/ \
uint32_t bdtr;
#endif
/**
* @brief TIM DIER register initialization data.
* @note The value of this field should normally be equal to zero.
* @note Only the DMA-related bits can be specified in this field.
*/
uint32_t dier;
} PWMConfig;
/**
* @brief Structure representing a PWM driver.
*/
struct PWMDriver {
/**
* @brief Driver state.
*/
pwmstate_t state;
/**
* @brief Current driver configuration data.
*/
const PWMConfig *config;
/**
* @brief Current PWM period in ticks.
*/
pwmcnt_t period;
/**
* @brief Mask of the enabled channels.
*/
pwmchnmsk_t enabled;
/**
* @brief Number of channels in this instance.
*/
pwmchannel_t channels;
#if defined(PWM_DRIVER_EXT_FIELDS)
PWM_DRIVER_EXT_FIELDS
#endif
/* End of the mandatory fields.*/
/**
* @brief Timer base clock.
*/
uint32_t clock;
/**
* @brief Pointer to the TIMx registers block.
*/
stm32_tim_t *tim;
};
/*===========================================================================*/
/* Driver macros. */
/*===========================================================================*/
/**
* @brief Changes the period the PWM peripheral.
* @details This function changes the period of a PWM unit that has already
* been activated using @p pwmStart().
* @pre The PWM unit must have been activated using @p pwmStart().
* @post The PWM unit period is changed to the new value.
* @note The function has effect at the next cycle start.
* @note If a period is specified that is shorter than the pulse width
* programmed in one of the channels then the behavior is not
* guaranteed.
*
* @param[in] pwmp pointer to a @p PWMDriver object
* @param[in] period new cycle time in ticks
*
* @notapi
*/
#define pwm_lld_change_period(pwmp, period) \
((pwmp)->tim->ARR = ((period) - 1))
/*===========================================================================*/
/* External declarations. */
/*===========================================================================*/
#if STM32_PWM_USE_TIM1 && !defined(__DOXYGEN__)
extern PWMDriver PWMD1;
#endif
#if STM32_PWM_USE_TIM2 && !defined(__DOXYGEN__)
extern PWMDriver PWMD2;
#endif
#if STM32_PWM_USE_TIM3 && !defined(__DOXYGEN__)
extern PWMDriver PWMD3;
#endif
#if STM32_PWM_USE_TIM4 && !defined(__DOXYGEN__)
extern PWMDriver PWMD4;
#endif
#if STM32_PWM_USE_TIM5 && !defined(__DOXYGEN__)
extern PWMDriver PWMD5;
#endif
#if STM32_PWM_USE_TIM8 && !defined(__DOXYGEN__)
extern PWMDriver PWMD8;
#endif
#if STM32_PWM_USE_TIM9 && !defined(__DOXYGEN__)
extern PWMDriver PWMD9;
#endif
#ifdef __cplusplus
extern "C" {
#endif
void pwm_lld_init(void);
void pwm_lld_start(PWMDriver *pwmp);
void pwm_lld_stop(PWMDriver *pwmp);
void pwm_lld_enable_channel(PWMDriver *pwmp,
pwmchannel_t channel,
pwmcnt_t width);
void pwm_lld_disable_channel(PWMDriver *pwmp, pwmchannel_t channel);
void pwm_lld_enable_periodic_notification(PWMDriver *pwmp);
void pwm_lld_disable_periodic_notification(PWMDriver *pwmp);
void pwm_lld_enable_channel_notification(PWMDriver *pwmp,
pwmchannel_t channel);
void pwm_lld_disable_channel_notification(PWMDriver *pwmp,
pwmchannel_t channel);
void pwm_lld_serve_interrupt(PWMDriver *pwmp);
#ifdef __cplusplus
}
#endif
#endif /* HAL_USE_PWM */
#endif /* _PWM_LLD_H_ */
/** @} */
| {
"content_hash": "d2f8d18b38bd5321b98417d162ab6c77",
"timestamp": "",
"source": "github",
"line_count": 536,
"max_line_length": 79,
"avg_line_length": 29.794776119402986,
"alnum_prop": 0.5672510958046337,
"repo_name": "raphaelchang/quadthingy-software",
"id": "4bf83b0562d9a69da57599774fa1e86efc6e0d98",
"size": "16607",
"binary": false,
"copies": "14",
"ref": "refs/heads/master",
"path": "base_station/ChibiOS_16.1.4/os/hal/ports/STM32/LLD/TIMv1/pwm_lld.h",
"mode": "33261",
"license": "apache-2.0",
"language": [
{
"name": "Arduino",
"bytes": "2697"
},
{
"name": "Assembly",
"bytes": "850772"
},
{
"name": "Batchfile",
"bytes": "972"
},
{
"name": "C",
"bytes": "134554272"
},
{
"name": "C++",
"bytes": "33621621"
},
{
"name": "CMake",
"bytes": "198987"
},
{
"name": "CSS",
"bytes": "58816"
},
{
"name": "Cuda",
"bytes": "92781"
},
{
"name": "Fortran",
"bytes": "1326303"
},
{
"name": "FreeMarker",
"bytes": "962618"
},
{
"name": "HTML",
"bytes": "215008"
},
{
"name": "JavaScript",
"bytes": "7839"
},
{
"name": "Makefile",
"bytes": "2771973"
},
{
"name": "Objective-C",
"bytes": "6517968"
},
{
"name": "Python",
"bytes": "8937"
},
{
"name": "Shell",
"bytes": "26480"
}
],
"symlink_target": ""
} |
package com.zengcanxiang.example;
import android.content.Context;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.view.ViewPager;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import com.zengcanxiang.baseAdapter.viewpager.BaseAdapter;
import com.zengcanxiang.baseAdapter.viewpager.BaseFragmentAdapter;
import java.util.ArrayList;
import java.util.List;
public class ViewPagerExample extends AppCompatActivity {
private android.support.v4.view.ViewPager exampleviewpager;
ViewAdapter viewAdapter;
FragmentAdapter fragmentAdapter;
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_viewpager);
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
this.exampleviewpager = (ViewPager) findViewById(R.id.example_viewpager);
viewAdapter = new ViewAdapter(this);
List<Fragment> fragments=new ArrayList<>();
ExampleFragment oneFragment=new ExampleFragment();
ExampleFragment twoFragment=new ExampleFragment();
ExampleFragment threeFragment=new ExampleFragment();
oneFragment.setLayoutId(R.layout.example_viewpager_one);
twoFragment.setLayoutId(R.layout.example_viewpager_two);
threeFragment.setLayoutId(R.layout.example_viewpager_three);
fragments.add(oneFragment);
fragments.add(twoFragment);
fragments.add(threeFragment);
fragmentAdapter = new FragmentAdapter(getSupportFragmentManager(), fragments);
exampleviewpager.setAdapter(viewAdapter);
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
super.onCreateOptionsMenu(menu);
menu.add("view ViewPager");
menu.add("fragment ViewPager");
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getTitle().toString()) {
case "view ViewPager":
exampleviewpager.setAdapter(viewAdapter);
return true;
case "fragment ViewPager":
exampleviewpager.setAdapter(fragmentAdapter);
return true;
}
return false;
}
public class ViewAdapter extends BaseAdapter {
public ViewAdapter(Context context) {
super(context, R.layout.example_viewpager_one,R.layout.example_viewpager_two,R.layout.example_viewpager_three);
}
@Override
public void convert(View view, int position) {
}
}
public class FragmentAdapter extends BaseFragmentAdapter {
public FragmentAdapter(FragmentManager fm, @NonNull List<Fragment> fragments) {
super(fm, fragments);
}
}
}
| {
"content_hash": "f5700318ffd5bc17a9d9f1cee8e56bbc",
"timestamp": "",
"source": "github",
"line_count": 92,
"max_line_length": 123,
"avg_line_length": 33.630434782608695,
"alnum_prop": 0.7071751777634131,
"repo_name": "zengcanxiang/BaseAdapter",
"id": "556b0d576388b6485e4310c5e98354861499a9b6",
"size": "3094",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "BaseAdapter/app/src/main/java/com/zengcanxiang/example/ViewPagerExample.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Java",
"bytes": "154056"
}
],
"symlink_target": ""
} |
==================
Additional Loading
==================
Common additional loading mechanism are supported in the :py:mod:`requests_mock.contrib` module.
These modules may require dependencies outside of what is provided by `requests_mock` and so must be provided by the including application.
.. toctree::
fixture
pytest
| {
"content_hash": "126177dcbddd9176689e9330b5c8da93",
"timestamp": "",
"source": "github",
"line_count": 12,
"max_line_length": 139,
"avg_line_length": 27.833333333333332,
"alnum_prop": 0.6916167664670658,
"repo_name": "jamielennox/requests-mock",
"id": "b64d1eb1f0db5ac93e0935d4877d3e486d9e1124",
"size": "334",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "doc/source/contrib.rst",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Python",
"bytes": "141166"
}
],
"symlink_target": ""
} |
<?php
namespace ZendTest\Ldap;
use Zend\Ldap\ErrorHandlerInterface;
use Zend\Stdlib\ErrorHandler as DefaultErrorHandler;
class ErrorHandler implements ErrorHandlerInterface
{
/**
* Start the ErrorHandling-process
*
* @param int $level
*
* @return void
*/
public function startErrorHandling($level = E_WARNING)
{
DefaultErrorHandler::start($level);
}
/**
* Stop the error-handling process.
* The parameter <var>$throw</var> handles whether the captured errors shall
* be thrown as Exceptions or not
*
* @param bool|false $throw
*
* @return mixed
*/
public function stopErrorHandling($throw = false)
{
return DefaultErrorHandler::stop($throw);
}
}
| {
"content_hash": "a4a2b177b995502675b8a78379b35d11",
"timestamp": "",
"source": "github",
"line_count": 36,
"max_line_length": 80,
"avg_line_length": 21.36111111111111,
"alnum_prop": 0.6384915474642393,
"repo_name": "MadCat34/zend-ldap",
"id": "b3aec9418266584b56c2663a5e25a936a99d9ca4",
"size": "1071",
"binary": false,
"copies": "3",
"ref": "refs/heads/master",
"path": "test/ErrorHandler.php",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "PHP",
"bytes": "531194"
},
{
"name": "Shell",
"bytes": "698"
}
],
"symlink_target": ""
} |
package com.kevin.android.weatherwatch.app;
import android.content.Context;
import android.content.SharedPreferences;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
import android.preference.PreferenceManager;
import android.text.format.Time;
import com.kevin.android.weatherwatch.app.sync.SunshineSyncAdapter;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Locale;
public class Utility {
// We'll default our latlong to 0. Yay, "Earth!"
public static float DEFAULT_LATLONG = 0F;
public static boolean isLocationLatLonAvailable(Context context) {
SharedPreferences prefs
= PreferenceManager.getDefaultSharedPreferences(context);
return prefs.contains(context.getString(R.string.pref_location_latitude))
&& prefs.contains(context.getString(R.string.pref_location_longitude));
}
public static float getLocationLatitude(Context context) {
SharedPreferences prefs
= PreferenceManager.getDefaultSharedPreferences(context);
return prefs.getFloat(context.getString(R.string.pref_location_latitude),
DEFAULT_LATLONG);
}
public static float getLocationLongitude(Context context) {
SharedPreferences prefs
= PreferenceManager.getDefaultSharedPreferences(context);
return prefs.getFloat(context.getString(R.string.pref_location_longitude),
DEFAULT_LATLONG);
}
public static String getPreferredLocation(Context context) {
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
return prefs.getString(context.getString(R.string.pref_location_key),
context.getString(R.string.pref_location_default));
}
public static boolean isMetric(Context context) {
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
return prefs.getString(context.getString(R.string.pref_units_key),
context.getString(R.string.pref_units_metric))
.equals(context.getString(R.string.pref_units_metric));
}
public static String formatTemperature(Context context, double temperature) {
// Data stored in Celsius by default. If user prefers to see in Fahrenheit, convert
// the values here.
String suffix = "\u00B0";
if (!isMetric(context)) {
temperature = (temperature * 1.8) + 32;
}
// For presentation, assume the user doesn't care about tenths of a degree.
return String.format(context.getString(R.string.format_temperature), temperature);
}
static String formatDate(long dateInMilliseconds) {
Date date = new Date(dateInMilliseconds);
return DateFormat.getDateInstance().format(date);
}
// Format used for storing dates in the database. ALso used for converting those strings
// back into date objects for comparison/processing.
public static final String DATE_FORMAT = "yyyyMMdd";
/**
* Helper method to convert the database representation of the date into something to display
* to users. As classy and polished a user experience as "20140102" is, we can do better.
*
* @param context Context to use for resource localization
* @param dateInMillis The date in milliseconds
* @return a user-friendly representation of the date.
*/
public static String getFriendlyDayString(Context context, long dateInMillis, boolean displayLongToday) {
// The day string for forecast uses the following logic:
// For today: "Today, June 8"
// For tomorrow: "Tomorrow"
// For the next 5 days: "Wednesday" (just the day name)
// For all days after that: "Mon Jun 8"
Time time = new Time();
time.setToNow();
long currentTime = System.currentTimeMillis();
int julianDay = Time.getJulianDay(dateInMillis, time.gmtoff);
int currentJulianDay = Time.getJulianDay(currentTime, time.gmtoff);
// If the date we're building the String for is today's date, the format
// is "Today, June 24"
if (displayLongToday && julianDay == currentJulianDay) {
String today = context.getString(R.string.today);
int formatId = R.string.format_full_friendly_date;
return String.format(context.getString(
formatId,
today,
getFormattedMonthDay(context, dateInMillis)));
} else if ( julianDay < currentJulianDay + 7 ) {
// If the input date is less than a week in the future, just return the day name.
return getDayName(context, dateInMillis);
} else {
// Otherwise, use the form "Mon Jun 3"
SimpleDateFormat shortenedDateFormat = new SimpleDateFormat("EEE MMM dd");
return shortenedDateFormat.format(dateInMillis);
}
}
/**
* Helper method to convert the database representation of the date into something to display
* to users. As classy and polished a user experience as "20140102" is, we can do better.
*
* @param context Context to use for resource localization
* @param dateInMillis The date in milliseconds
* @return a user-friendly representation of the date.
*/
public static String getFullFriendlyDayString(Context context, long dateInMillis) {
String day = getDayName(context, dateInMillis);
int formatId = R.string.format_full_friendly_date;
return String.format(context.getString(
formatId,
day,
getFormattedMonthDay(context, dateInMillis)));
}
/**
* Given a day, returns just the name to use for that day.
* E.g "today", "tomorrow", "wednesday".
*
* @param context Context to use for resource localization
* @param dateInMillis The date in milliseconds
* @return
*/
public static String getDayName(Context context, long dateInMillis) {
// If the date is today, return the localized version of "Today" instead of the actual
// day name.
Time t = new Time();
t.setToNow();
int julianDay = Time.getJulianDay(dateInMillis, t.gmtoff);
int currentJulianDay = Time.getJulianDay(System.currentTimeMillis(), t.gmtoff);
if (julianDay == currentJulianDay) {
return context.getString(R.string.today);
} else if ( julianDay == currentJulianDay +1 ) {
return context.getString(R.string.tomorrow);
} else {
Time time = new Time();
time.setToNow();
// Otherwise, the format is just the day of the week (e.g "Wednesday".
SimpleDateFormat dayFormat = new SimpleDateFormat("EEEE");
return dayFormat.format(dateInMillis);
}
}
/**
* Converts db date format to the format "Month day", e.g "June 24".
* @param context Context to use for resource localization
* @param dateInMillis The db formatted date string, expected to be of the form specified
* in Utility.DATE_FORMAT
* @return The day in the form of a string formatted "December 6"
*/
public static String getFormattedMonthDay(Context context, long dateInMillis ) {
Time time = new Time();
time.setToNow();
SimpleDateFormat dbDateFormat = new SimpleDateFormat(Utility.DATE_FORMAT);
SimpleDateFormat monthDayFormat = new SimpleDateFormat("MMMM dd");
String monthDayString = monthDayFormat.format(dateInMillis);
return monthDayString;
}
public static String getFormattedWind(Context context, float windSpeed, float degrees) {
int windFormat;
if (Utility.isMetric(context)) {
windFormat = R.string.format_wind_kmh;
} else {
windFormat = R.string.format_wind_mph;
windSpeed = .621371192237334f * windSpeed;
}
// From wind direction in degrees, determine compass direction as a string (e.g NW)
// You know what's fun, writing really long if/else statements with tons of possible
// conditions. Seriously, try it!
String direction = "Unknown";
if (degrees >= 337.5 || degrees < 22.5) {
direction = "N";
} else if (degrees >= 22.5 && degrees < 67.5) {
direction = "NE";
} else if (degrees >= 67.5 && degrees < 112.5) {
direction = "E";
} else if (degrees >= 112.5 && degrees < 157.5) {
direction = "SE";
} else if (degrees >= 157.5 && degrees < 202.5) {
direction = "S";
} else if (degrees >= 202.5 && degrees < 247.5) {
direction = "SW";
} else if (degrees >= 247.5 && degrees < 292.5) {
direction = "W";
} else if (degrees >= 292.5 && degrees < 337.5) {
direction = "NW";
}
return String.format(context.getString(windFormat), windSpeed, direction);
}
/**
* Helper method to provide the icon resource id according to the weather condition id returned
* by the OpenWeatherMap call.
* @param weatherId from OpenWeatherMap API response
* @return resource id for the corresponding icon. -1 if no relation is found.
*/
public static int getIconResourceForWeatherCondition(int weatherId) {
// Based on weather code data found at:
// http://bugs.openweathermap.org/projects/api/wiki/Weather_Condition_Codes
if (weatherId >= 200 && weatherId <= 232) {
return R.drawable.ic_storm;
} else if (weatherId >= 300 && weatherId <= 321) {
return R.drawable.ic_light_rain;
} else if (weatherId >= 500 && weatherId <= 504) {
return R.drawable.ic_rain;
} else if (weatherId == 511) {
return R.drawable.ic_snow;
} else if (weatherId >= 520 && weatherId <= 531) {
return R.drawable.ic_rain;
} else if (weatherId >= 600 && weatherId <= 622) {
return R.drawable.ic_snow;
} else if (weatherId >= 701 && weatherId <= 761) {
return R.drawable.ic_fog;
} else if (weatherId == 761 || weatherId == 781) {
return R.drawable.ic_storm;
} else if (weatherId == 800) {
return R.drawable.ic_clear;
} else if (weatherId == 801) {
return R.drawable.ic_light_clouds;
} else if (weatherId >= 802 && weatherId <= 804) {
return R.drawable.ic_cloudy;
}
return -1;
}
/**
* Helper method to return whether or not Sunshine is using local graphics.
*
* @param context Context to use for retrieving the preference
* @return true if Sunshine is using local graphics, false otherwise.
*/
public static boolean usingLocalGraphics(Context context) {
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
String sunshineArtPack = context.getString(R.string.pref_art_pack_sunshine);
return prefs.getString(context.getString(R.string.pref_art_pack_key),
sunshineArtPack).equals(sunshineArtPack);
}
/**
* Helper method to provide the art urls according to the weather condition id returned
* by the OpenWeatherMap call.
*
* @param context Context to use for retrieving the URL format
* @param weatherId from OpenWeatherMap API response
* @return url for the corresponding weather artwork. null if no relation is found.
*/
public static String getArtUrlForWeatherCondition(Context context, int weatherId) {
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
String formatArtUrl = prefs.getString(context.getString(R.string.pref_art_pack_key),
context.getString(R.string.pref_art_pack_sunshine));
// Based on weather code data found at:
// http://bugs.openweathermap.org/projects/api/wiki/Weather_Condition_Codes
if (weatherId >= 200 && weatherId <= 232) {
return String.format(Locale.US, formatArtUrl, "storm");
} else if (weatherId >= 300 && weatherId <= 321) {
return String.format(Locale.US, formatArtUrl, "light_rain");
} else if (weatherId >= 500 && weatherId <= 504) {
return String.format(Locale.US, formatArtUrl, "rain");
} else if (weatherId == 511) {
return String.format(Locale.US, formatArtUrl, "snow");
} else if (weatherId >= 520 && weatherId <= 531) {
return String.format(Locale.US, formatArtUrl, "rain");
} else if (weatherId >= 600 && weatherId <= 622) {
return String.format(Locale.US, formatArtUrl, "snow");
} else if (weatherId >= 701 && weatherId <= 761) {
return String.format(Locale.US, formatArtUrl, "fog");
} else if (weatherId == 761 || weatherId == 781) {
return String.format(Locale.US, formatArtUrl, "storm");
} else if (weatherId == 800) {
return String.format(Locale.US, formatArtUrl, "clear");
} else if (weatherId == 801) {
return String.format(Locale.US, formatArtUrl, "light_clouds");
} else if (weatherId >= 802 && weatherId <= 804) {
return String.format(Locale.US, formatArtUrl, "clouds");
}
return null;
}
/**
* Helper method to provide the art resource id according to the weather condition id returned
* by the OpenWeatherMap call.
* @param weatherId from OpenWeatherMap API response
* @return resource id for the corresponding icon. -1 if no relation is found.
*/
public static int getArtResourceForWeatherCondition(int weatherId) {
// Based on weather code data found at:
// http://bugs.openweathermap.org/projects/api/wiki/Weather_Condition_Codes
if (weatherId >= 200 && weatherId <= 232) {
return R.drawable.art_storm;
} else if (weatherId >= 300 && weatherId <= 321) {
return R.drawable.art_light_rain;
} else if (weatherId >= 500 && weatherId <= 504) {
return R.drawable.art_rain;
} else if (weatherId == 511) {
return R.drawable.art_snow;
} else if (weatherId >= 520 && weatherId <= 531) {
return R.drawable.art_rain;
} else if (weatherId >= 600 && weatherId <= 622) {
return R.drawable.art_snow;
} else if (weatherId >= 701 && weatherId <= 761) {
return R.drawable.art_fog;
} else if (weatherId == 761 || weatherId == 781) {
return R.drawable.art_storm;
} else if (weatherId == 800) {
return R.drawable.art_clear;
} else if (weatherId == 801) {
return R.drawable.art_light_clouds;
} else if (weatherId >= 802 && weatherId <= 804) {
return R.drawable.art_clouds;
}
return -1;
}
/**
* Helper method to provide the string according to the weather
* condition id returned by the OpenWeatherMap call.
* @param context Android context
* @param weatherId from OpenWeatherMap API response
* @return string for the weather condition. null if no relation is found.
*/
public static String getStringForWeatherCondition(Context context, int weatherId) {
// Based on weather code data found at:
// http://bugs.openweathermap.org/projects/api/wiki/Weather_Condition_Codes
int stringId;
if (weatherId >= 200 && weatherId <= 232) {
stringId = R.string.condition_2xx;
} else if (weatherId >= 300 && weatherId <= 321) {
stringId = R.string.condition_3xx;
} else switch (weatherId) {
case 500:
stringId = R.string.condition_500;
break;
case 501:
stringId = R.string.condition_501;
break;
case 502:
stringId = R.string.condition_502;
break;
case 503:
stringId = R.string.condition_503;
break;
case 504:
stringId = R.string.condition_504;
break;
case 511:
stringId = R.string.condition_511;
break;
case 520:
stringId = R.string.condition_520;
break;
case 531:
stringId = R.string.condition_531;
break;
case 600:
stringId = R.string.condition_600;
break;
case 601:
stringId = R.string.condition_601;
break;
case 602:
stringId = R.string.condition_602;
break;
case 611:
stringId = R.string.condition_611;
break;
case 612:
stringId = R.string.condition_612;
break;
case 615:
stringId = R.string.condition_615;
break;
case 616:
stringId = R.string.condition_616;
break;
case 620:
stringId = R.string.condition_620;
break;
case 621:
stringId = R.string.condition_621;
break;
case 622:
stringId = R.string.condition_622;
break;
case 701:
stringId = R.string.condition_701;
break;
case 711:
stringId = R.string.condition_711;
break;
case 721:
stringId = R.string.condition_721;
break;
case 731:
stringId = R.string.condition_731;
break;
case 741:
stringId = R.string.condition_741;
break;
case 751:
stringId = R.string.condition_751;
break;
case 761:
stringId = R.string.condition_761;
break;
case 762:
stringId = R.string.condition_762;
break;
case 771:
stringId = R.string.condition_771;
break;
case 781:
stringId = R.string.condition_781;
break;
case 800:
stringId = R.string.condition_800;
break;
case 801:
stringId = R.string.condition_801;
break;
case 802:
stringId = R.string.condition_802;
break;
case 803:
stringId = R.string.condition_803;
break;
case 804:
stringId = R.string.condition_804;
break;
case 900:
stringId = R.string.condition_900;
break;
case 901:
stringId = R.string.condition_901;
break;
case 902:
stringId = R.string.condition_902;
break;
case 903:
stringId = R.string.condition_903;
break;
case 904:
stringId = R.string.condition_904;
break;
case 905:
stringId = R.string.condition_905;
break;
case 906:
stringId = R.string.condition_906;
break;
case 951:
stringId = R.string.condition_951;
break;
case 952:
stringId = R.string.condition_952;
break;
case 953:
stringId = R.string.condition_953;
break;
case 954:
stringId = R.string.condition_954;
break;
case 955:
stringId = R.string.condition_955;
break;
case 956:
stringId = R.string.condition_956;
break;
case 957:
stringId = R.string.condition_957;
break;
case 958:
stringId = R.string.condition_958;
break;
case 959:
stringId = R.string.condition_959;
break;
case 960:
stringId = R.string.condition_960;
break;
case 961:
stringId = R.string.condition_961;
break;
case 962:
stringId = R.string.condition_962;
break;
default:
return context.getString(R.string.condition_unknown, weatherId);
}
return context.getString(stringId);
}
/*
* Helper method to provide the correct image according to the weather condition id returned
* by the OpenWeatherMap call.
*
* @param weatherId from OpenWeatherMap API response
* @return A string URL to an appropriate image or null if no mapping is found
*/
public static String getImageUrlForWeatherCondition(int weatherId) {
// Based on weather code data found at:
// http://bugs.openweathermap.org/projects/api/wiki/Weather_Condition_Codes
if (weatherId >= 200 && weatherId <= 232) {
return "http://upload.wikimedia.org/wikipedia/commons/2/28/Thunderstorm_in_Annemasse,_France.jpg";
} else if (weatherId >= 300 && weatherId <= 321) {
return "http://upload.wikimedia.org/wikipedia/commons/a/a0/Rain_on_leaf_504605006.jpg";
} else if (weatherId >= 500 && weatherId <= 504) {
return "http://upload.wikimedia.org/wikipedia/commons/6/6c/Rain-on-Thassos.jpg";
} else if (weatherId == 511) {
return "http://upload.wikimedia.org/wikipedia/commons/b/b8/Fresh_snow.JPG";
} else if (weatherId >= 520 && weatherId <= 531) {
return "http://upload.wikimedia.org/wikipedia/commons/6/6c/Rain-on-Thassos.jpg";
} else if (weatherId >= 600 && weatherId <= 622) {
return "http://upload.wikimedia.org/wikipedia/commons/b/b8/Fresh_snow.JPG";
} else if (weatherId >= 701 && weatherId <= 761) {
return "http://upload.wikimedia.org/wikipedia/commons/e/e6/Westminster_fog_-_London_-_UK.jpg";
} else if (weatherId == 761 || weatherId == 781) {
return "http://upload.wikimedia.org/wikipedia/commons/d/dc/Raised_dust_ahead_of_a_severe_thunderstorm_1.jpg";
} else if (weatherId == 800) {
return "http://upload.wikimedia.org/wikipedia/commons/7/7e/A_few_trees_and_the_sun_(6009964513).jpg";
} else if (weatherId == 801) {
return "http://upload.wikimedia.org/wikipedia/commons/e/e7/Cloudy_Blue_Sky_(5031259890).jpg";
} else if (weatherId >= 802 && weatherId <= 804) {
return "http://upload.wikimedia.org/wikipedia/commons/5/54/Cloudy_hills_in_Elis,_Greece_2.jpg";
}
return null;
}
/**
* Returns true if the network is available or about to become available.
*
* @param c Context used to get the ConnectivityManager
* @return true if the network is available
*/
static public boolean isNetworkAvailable(Context c) {
ConnectivityManager cm =
(ConnectivityManager)c.getSystemService(Context.CONNECTIVITY_SERVICE);
NetworkInfo activeNetwork = cm.getActiveNetworkInfo();
return activeNetwork != null &&
activeNetwork.isConnectedOrConnecting();
}
/**
*
* @param c Context used to get the SharedPreferences
* @return the location status integer type
*/
@SuppressWarnings("ResourceType")
static public @SunshineSyncAdapter.LocationStatus
int getLocationStatus(Context c){
SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(c);
return sp.getInt(c.getString(R.string.pref_location_status_key), SunshineSyncAdapter.LOCATION_STATUS_UNKNOWN);
}
/**
* Resets the location status. (Sets it to SunshineSyncAdapter.LOCATION_STATUS_UNKNOWN)
* @param c Context used to get the SharedPreferences
*/
static public void resetLocationStatus(Context c){
SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(c);
SharedPreferences.Editor spe = sp.edit();
spe.putInt(c.getString(R.string.pref_location_status_key), SunshineSyncAdapter.LOCATION_STATUS_UNKNOWN);
spe.apply();
}
} | {
"content_hash": "94fdd4374fee5b56bba47c4e7f7f15d4",
"timestamp": "",
"source": "github",
"line_count": 588,
"max_line_length": 121,
"avg_line_length": 42.16836734693877,
"alnum_prop": 0.5899979834644081,
"repo_name": "kehannan/WeatherWatch",
"id": "2e8d8a9991c52c640f794897ff2e20d8db927f43",
"size": "25414",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "app/src/main/java/com/kevin/android/weatherwatch/app/Utility.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Java",
"bytes": "283054"
}
],
"symlink_target": ""
} |
<?xml version="1.0" ?><!DOCTYPE TS><TS language="cy" version="2.0">
<defaultcodec>UTF-8</defaultcodec>
<context>
<name>AboutDialog</name>
<message>
<location filename="../forms/aboutdialog.ui" line="+14"/>
<source>About Roxcoin</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+39"/>
<source><b>Roxcoin</b> version</source>
<translation>Fersiwn <b>Roxcoin</b></translation>
</message>
<message>
<location line="+57"/>
<source>
This is experimental software.
Distributed under the MIT/X11 software license, see the accompanying file COPYING or http://www.opensource.org/licenses/mit-license.php.
This product includes software developed by the OpenSSL Project for use in the OpenSSL Toolkit (http://www.openssl.org/) and cryptographic software written by Eric Young ([email protected]) and UPnP software written by Thomas Bernard.</source>
<translation type="unfinished"/>
</message>
<message>
<location filename="../aboutdialog.cpp" line="+14"/>
<source>Copyright</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+0"/>
<source>The Roxcoin developers</source>
<translation type="unfinished"/>
</message>
</context>
<context>
<name>AddressBookPage</name>
<message>
<location filename="../forms/addressbookpage.ui" line="+14"/>
<source>Address Book</source>
<translation>Llyfr Cyfeiriadau</translation>
</message>
<message>
<location line="+19"/>
<source>Double-click to edit address or label</source>
<translation>Clicio dwywaith i olygu cyfeiriad neu label</translation>
</message>
<message>
<location line="+27"/>
<source>Create a new address</source>
<translation>Creu cyfeiriad newydd</translation>
</message>
<message>
<location line="+14"/>
<source>Copy the currently selected address to the system clipboard</source>
<translation>Copio'r cyfeiriad sydd wedi'i ddewis i'r clipfwrdd system</translation>
</message>
<message>
<location line="-11"/>
<source>&New Address</source>
<translation type="unfinished"/>
</message>
<message>
<location filename="../addressbookpage.cpp" line="+63"/>
<source>These are your Roxcoin addresses for receiving payments. You may want to give a different one to each sender so you can keep track of who is paying you.</source>
<translation type="unfinished"/>
</message>
<message>
<location filename="../forms/addressbookpage.ui" line="+14"/>
<source>&Copy Address</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+11"/>
<source>Show &QR Code</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+11"/>
<source>Sign a message to prove you own a Roxcoin address</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Sign &Message</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+25"/>
<source>Delete the currently selected address from the list</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+27"/>
<source>Export the data in the current tab to a file</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>&Export</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-44"/>
<source>Verify a message to ensure it was signed with a specified Roxcoin address</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>&Verify Message</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+14"/>
<source>&Delete</source>
<translation>&Dileu</translation>
</message>
<message>
<location filename="../addressbookpage.cpp" line="-5"/>
<source>These are your Roxcoin addresses for sending payments. Always check the amount and the receiving address before sending coins.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+13"/>
<source>Copy &Label</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>&Edit</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Send &Coins</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+260"/>
<source>Export Address Book Data</source>
<translation>Allforio Data Llyfr Cyfeiriad</translation>
</message>
<message>
<location line="+1"/>
<source>Comma separated file (*.csv)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+13"/>
<source>Error exporting</source>
<translation>Gwall allforio</translation>
</message>
<message>
<location line="+0"/>
<source>Could not write to file %1.</source>
<translation>Ni ellir ysgrifennu i ffeil %1.</translation>
</message>
</context>
<context>
<name>AddressTableModel</name>
<message>
<location filename="../addresstablemodel.cpp" line="+144"/>
<source>Label</source>
<translation>Label</translation>
</message>
<message>
<location line="+0"/>
<source>Address</source>
<translation>Cyfeiriad</translation>
</message>
<message>
<location line="+36"/>
<source>(no label)</source>
<translation>(heb label)</translation>
</message>
</context>
<context>
<name>AskPassphraseDialog</name>
<message>
<location filename="../forms/askpassphrasedialog.ui" line="+26"/>
<source>Passphrase Dialog</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+21"/>
<source>Enter passphrase</source>
<translation>Teipiwch gyfrinymadrodd</translation>
</message>
<message>
<location line="+14"/>
<source>New passphrase</source>
<translation>Cyfrinymadrodd newydd</translation>
</message>
<message>
<location line="+14"/>
<source>Repeat new passphrase</source>
<translation>Ailadroddwch gyfrinymadrodd newydd</translation>
</message>
<message>
<location filename="../askpassphrasedialog.cpp" line="+33"/>
<source>Enter the new passphrase to the wallet.<br/>Please use a passphrase of <b>10 or more random characters</b>, or <b>eight or more words</b>.</source>
<translation>Dewiswch gyfrinymadrodd newydd ar gyfer y waled. <br/> Defnyddiwch cyfrinymadrodd o <b>10 neu fwy o lythyrennau hapgyrch</b>, neu <b> wyth neu fwy o eiriau.</translation>
</message>
<message>
<location line="+1"/>
<source>Encrypt wallet</source>
<translation>Amgryptio'r waled</translation>
</message>
<message>
<location line="+3"/>
<source>This operation needs your wallet passphrase to unlock the wallet.</source>
<translation>Mae angen i'r gweithred hon ddefnyddio'ch cyfrinymadrodd er mwyn datgloi'r waled.</translation>
</message>
<message>
<location line="+5"/>
<source>Unlock wallet</source>
<translation>Datgloi'r waled</translation>
</message>
<message>
<location line="+3"/>
<source>This operation needs your wallet passphrase to decrypt the wallet.</source>
<translation>Mae angen i'r gweithred hon ddefnyddio'ch cyfrinymadrodd er mwyn dadgryptio'r waled.</translation>
</message>
<message>
<location line="+5"/>
<source>Decrypt wallet</source>
<translation>Dadgryptio'r waled</translation>
</message>
<message>
<location line="+3"/>
<source>Change passphrase</source>
<translation>Newid cyfrinymadrodd</translation>
</message>
<message>
<location line="+1"/>
<source>Enter the old and new passphrase to the wallet.</source>
<translation>Teipiwch yr hen cyfrinymadrodd a chyfrinymadrodd newydd i mewn i'r waled.</translation>
</message>
<message>
<location line="+46"/>
<source>Confirm wallet encryption</source>
<translation>Cadarnau amgryptiad y waled</translation>
</message>
<message>
<location line="+1"/>
<source>Warning: If you encrypt your wallet and lose your passphrase, you will <b>LOSE ALL OF YOUR ROXCOINS</b>!</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+0"/>
<source>Are you sure you wish to encrypt your wallet?</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+15"/>
<source>IMPORTANT: Any previous backups you have made of your wallet file should be replaced with the newly generated, encrypted wallet file. For security reasons, previous backups of the unencrypted wallet file will become useless as soon as you start using the new, encrypted wallet.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+100"/>
<location line="+24"/>
<source>Warning: The Caps Lock key is on!</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-130"/>
<location line="+58"/>
<source>Wallet encrypted</source>
<translation>Waled wedi'i amgryptio</translation>
</message>
<message>
<location line="-56"/>
<source>Roxcoin will close now to finish the encryption process. Remember that encrypting your wallet cannot fully protect your roxcoins from being stolen by malware infecting your computer.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+13"/>
<location line="+7"/>
<location line="+42"/>
<location line="+6"/>
<source>Wallet encryption failed</source>
<translation>Amgryptiad waled wedi methu</translation>
</message>
<message>
<location line="-54"/>
<source>Wallet encryption failed due to an internal error. Your wallet was not encrypted.</source>
<translation>Methodd amgryptiad y waled oherwydd gwall mewnol. Ni amgryptwyd eich waled.</translation>
</message>
<message>
<location line="+7"/>
<location line="+48"/>
<source>The supplied passphrases do not match.</source>
<translation>Dydy'r cyfrinymadroddion a ddarparwyd ddim yn cyd-fynd â'u gilydd.</translation>
</message>
<message>
<location line="-37"/>
<source>Wallet unlock failed</source>
<translation>Methodd ddatgloi'r waled</translation>
</message>
<message>
<location line="+1"/>
<location line="+11"/>
<location line="+19"/>
<source>The passphrase entered for the wallet decryption was incorrect.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-20"/>
<source>Wallet decryption failed</source>
<translation>Methodd dadgryptiad y waled</translation>
</message>
<message>
<location line="+14"/>
<source>Wallet passphrase was successfully changed.</source>
<translation type="unfinished"/>
</message>
</context>
<context>
<name>BitcoinGUI</name>
<message>
<location filename="../bitcoingui.cpp" line="+233"/>
<source>Sign &message...</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+280"/>
<source>Synchronizing with network...</source>
<translation>Cysoni â'r rhwydwaith...</translation>
</message>
<message>
<location line="-349"/>
<source>&Overview</source>
<translation>&Trosolwg</translation>
</message>
<message>
<location line="+1"/>
<source>Show general overview of wallet</source>
<translation>Dangos trosolwg cyffredinol y waled</translation>
</message>
<message>
<location line="+20"/>
<source>&Transactions</source>
<translation>&Trafodion</translation>
</message>
<message>
<location line="+1"/>
<source>Browse transaction history</source>
<translation>Pori hanes trafodion</translation>
</message>
<message>
<location line="+7"/>
<source>Edit the list of stored addresses and labels</source>
<translation>Golygu'r rhestr o cyfeiriadau a labeli ar gadw</translation>
</message>
<message>
<location line="-14"/>
<source>Show the list of addresses for receiving payments</source>
<translation>Dangos rhestr o gyfeiriadau ar gyfer derbyn taliadau</translation>
</message>
<message>
<location line="+31"/>
<source>E&xit</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Quit application</source>
<translation>Gadael rhaglen</translation>
</message>
<message>
<location line="+4"/>
<source>Show information about Roxcoin</source>
<translation>Dangos gwybodaeth am Roxcoin</translation>
</message>
<message>
<location line="+2"/>
<source>About &Qt</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Show information about Qt</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>&Options...</source>
<translation>&Opsiynau</translation>
</message>
<message>
<location line="+6"/>
<source>&Encrypt Wallet...</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>&Backup Wallet...</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>&Change Passphrase...</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+285"/>
<source>Importing blocks from disk...</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Reindexing blocks on disk...</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-347"/>
<source>Send coins to a Roxcoin address</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+49"/>
<source>Modify configuration options for Roxcoin</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+9"/>
<source>Backup wallet to another location</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>Change the passphrase used for wallet encryption</source>
<translation>Newid y cyfrinymadrodd a ddefnyddiwyd ar gyfer amgryptio'r waled</translation>
</message>
<message>
<location line="+6"/>
<source>&Debug window</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Open debugging and diagnostic console</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-4"/>
<source>&Verify message...</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-165"/>
<location line="+530"/>
<source>Roxcoin</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-530"/>
<source>Wallet</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+101"/>
<source>&Send</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+7"/>
<source>&Receive</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+14"/>
<source>&Addresses</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+22"/>
<source>&About Roxcoin</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+9"/>
<source>&Show / Hide</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Show or hide the main Window</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Encrypt the private keys that belong to your wallet</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+7"/>
<source>Sign messages with your Roxcoin addresses to prove you own them</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>Verify messages to ensure they were signed with specified Roxcoin addresses</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+28"/>
<source>&File</source>
<translation>&Ffeil</translation>
</message>
<message>
<location line="+7"/>
<source>&Settings</source>
<translation>&Gosodiadau</translation>
</message>
<message>
<location line="+6"/>
<source>&Help</source>
<translation>&Cymorth</translation>
</message>
<message>
<location line="+9"/>
<source>Tabs toolbar</source>
<translation>Bar offer tabiau</translation>
</message>
<message>
<location line="+17"/>
<location line="+10"/>
<source>[testnet]</source>
<translation>[testnet]</translation>
</message>
<message>
<location line="+47"/>
<source>Roxcoin client</source>
<translation type="unfinished"/>
</message>
<message numerus="yes">
<location line="+141"/>
<source>%n active connection(s) to Roxcoin network</source>
<translation type="unfinished"><numerusform></numerusform><numerusform></numerusform><numerusform></numerusform><numerusform></numerusform></translation>
</message>
<message>
<location line="+22"/>
<source>No block source available...</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+12"/>
<source>Processed %1 of %2 (estimated) blocks of transaction history.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+4"/>
<source>Processed %1 blocks of transaction history.</source>
<translation type="unfinished"/>
</message>
<message numerus="yes">
<location line="+20"/>
<source>%n hour(s)</source>
<translation type="unfinished"><numerusform></numerusform><numerusform></numerusform><numerusform></numerusform><numerusform></numerusform></translation>
</message>
<message numerus="yes">
<location line="+4"/>
<source>%n day(s)</source>
<translation type="unfinished"><numerusform></numerusform><numerusform></numerusform><numerusform></numerusform><numerusform></numerusform></translation>
</message>
<message numerus="yes">
<location line="+4"/>
<source>%n week(s)</source>
<translation type="unfinished"><numerusform></numerusform><numerusform></numerusform><numerusform></numerusform><numerusform></numerusform></translation>
</message>
<message>
<location line="+4"/>
<source>%1 behind</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+14"/>
<source>Last received block was generated %1 ago.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>Transactions after this will not yet be visible.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+22"/>
<source>Error</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Warning</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Information</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+70"/>
<source>This transaction is over the size limit. You can still send it for a fee of %1, which goes to the nodes that process your transaction and helps to support the network. Do you want to pay the fee?</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-140"/>
<source>Up to date</source>
<translation>Cyfamserol</translation>
</message>
<message>
<location line="+31"/>
<source>Catching up...</source>
<translation>Dal i fyny</translation>
</message>
<message>
<location line="+113"/>
<source>Confirm transaction fee</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+8"/>
<source>Sent transaction</source>
<translation>Trafodiad a anfonwyd</translation>
</message>
<message>
<location line="+0"/>
<source>Incoming transaction</source>
<translation>Trafodiad sy'n cyrraedd</translation>
</message>
<message>
<location line="+1"/>
<source>Date: %1
Amount: %2
Type: %3
Address: %4
</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+33"/>
<location line="+23"/>
<source>URI handling</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-23"/>
<location line="+23"/>
<source>URI can not be parsed! This can be caused by an invalid Roxcoin address or malformed URI parameters.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+17"/>
<source>Wallet is <b>encrypted</b> and currently <b>unlocked</b></source>
<translation>Mae'r waled <b>wedi'i amgryptio</b> ac <b>heb ei gloi</b> ar hyn o bryd</translation>
</message>
<message>
<location line="+8"/>
<source>Wallet is <b>encrypted</b> and currently <b>locked</b></source>
<translation>Mae'r waled <b>wedi'i amgryptio</b> ac <b>ar glo</b> ar hyn o bryd</translation>
</message>
<message>
<location filename="../bitcoin.cpp" line="+111"/>
<source>A fatal error occurred. Roxcoin can no longer continue safely and will quit.</source>
<translation type="unfinished"/>
</message>
</context>
<context>
<name>ClientModel</name>
<message>
<location filename="../clientmodel.cpp" line="+104"/>
<source>Network Alert</source>
<translation type="unfinished"/>
</message>
</context>
<context>
<name>EditAddressDialog</name>
<message>
<location filename="../forms/editaddressdialog.ui" line="+14"/>
<source>Edit Address</source>
<translation>Golygu'r cyfeiriad</translation>
</message>
<message>
<location line="+11"/>
<source>&Label</source>
<translation>&Label</translation>
</message>
<message>
<location line="+10"/>
<source>The label associated with this address book entry</source>
<translation>Mae'r label hon yn cysylltiedig gyda'r cofnod llyfr cyfeiriad hon</translation>
</message>
<message>
<location line="+7"/>
<source>&Address</source>
<translation>&Cyfeiriad</translation>
</message>
<message>
<location line="+10"/>
<source>The address associated with this address book entry. This can only be modified for sending addresses.</source>
<translation>Mae'r cyfeiriad hon yn cysylltiedig gyda'r cofnod llyfr cyfeiriad hon. Gall hyn gael ei olygu dim ond ar gyfer y pwrpas o anfon cyfeiriadau.</translation>
</message>
<message>
<location filename="../editaddressdialog.cpp" line="+21"/>
<source>New receiving address</source>
<translation>Cyfeiriad derbyn newydd</translation>
</message>
<message>
<location line="+4"/>
<source>New sending address</source>
<translation>Cyfeiriad anfon newydd</translation>
</message>
<message>
<location line="+3"/>
<source>Edit receiving address</source>
<translation>Golygu'r cyfeiriad derbyn</translation>
</message>
<message>
<location line="+4"/>
<source>Edit sending address</source>
<translation>Golygu'r cyfeiriad anfon</translation>
</message>
<message>
<location line="+76"/>
<source>The entered address "%1" is already in the address book.</source>
<translation>Mae'r cyfeiriad "%1" sydd newydd gael ei geisio gennych yn y llyfr cyfeiriad yn barod.</translation>
</message>
<message>
<location line="-5"/>
<source>The entered address "%1" is not a valid Roxcoin address.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+10"/>
<source>Could not unlock wallet.</source>
<translation>Methodd ddatgloi'r waled.</translation>
</message>
<message>
<location line="+5"/>
<source>New key generation failed.</source>
<translation>Methodd gynhyrchu allwedd newydd.</translation>
</message>
</context>
<context>
<name>GUIUtil::HelpMessageBox</name>
<message>
<location filename="../guiutil.cpp" line="+424"/>
<location line="+12"/>
<source>Roxcoin-Qt</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-12"/>
<source>version</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>Usage:</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>command-line options</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+4"/>
<source>UI options</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Set language, for example "de_DE" (default: system locale)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Start minimized</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Show splash screen on startup (default: 1)</source>
<translation type="unfinished"/>
</message>
</context>
<context>
<name>OptionsDialog</name>
<message>
<location filename="../forms/optionsdialog.ui" line="+14"/>
<source>Options</source>
<translation>Opsiynau</translation>
</message>
<message>
<location line="+16"/>
<source>&Main</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+6"/>
<source>Optional transaction fee per kB that helps make sure your transactions are processed quickly. Most transactions are 1 kB.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+15"/>
<source>Pay transaction &fee</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+31"/>
<source>Automatically start Roxcoin after logging in to the system.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>&Start Roxcoin on system login</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+35"/>
<source>Reset all client options to default.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>&Reset Options</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+13"/>
<source>&Network</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+6"/>
<source>Automatically open the Roxcoin client port on the router. This only works when your router supports UPnP and it is enabled.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Map port using &UPnP</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+7"/>
<source>Connect to the Roxcoin network through a SOCKS proxy (e.g. when connecting through Tor).</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>&Connect through SOCKS proxy:</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+9"/>
<source>Proxy &IP:</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+19"/>
<source>IP address of the proxy (e.g. 127.0.0.1)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+7"/>
<source>&Port:</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+19"/>
<source>Port of the proxy (e.g. 9050)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+7"/>
<source>SOCKS &Version:</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+13"/>
<source>SOCKS version of the proxy (e.g. 5)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+36"/>
<source>&Window</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+6"/>
<source>Show only a tray icon after minimizing the window.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>&Minimize to the tray instead of the taskbar</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+7"/>
<source>Minimize instead of exit the application when the window is closed. When this option is enabled, the application will be closed only after selecting Quit in the menu.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>M&inimize on close</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+21"/>
<source>&Display</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+8"/>
<source>User Interface &language:</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+13"/>
<source>The user interface language can be set here. This setting will take effect after restarting Roxcoin.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+11"/>
<source>&Unit to show amounts in:</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+13"/>
<source>Choose the default subdivision unit to show in the interface and when sending coins.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+9"/>
<source>Whether to show Roxcoin addresses in the transaction list or not.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>&Display addresses in transaction list</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+71"/>
<source>&OK</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+7"/>
<source>&Cancel</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+10"/>
<source>&Apply</source>
<translation type="unfinished"/>
</message>
<message>
<location filename="../optionsdialog.cpp" line="+53"/>
<source>default</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+130"/>
<source>Confirm options reset</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Some settings may require a client restart to take effect.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+0"/>
<source>Do you want to proceed?</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+42"/>
<location line="+9"/>
<source>Warning</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-9"/>
<location line="+9"/>
<source>This setting will take effect after restarting Roxcoin.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+29"/>
<source>The supplied proxy address is invalid.</source>
<translation type="unfinished"/>
</message>
</context>
<context>
<name>OverviewPage</name>
<message>
<location filename="../forms/overviewpage.ui" line="+14"/>
<source>Form</source>
<translation>Ffurflen</translation>
</message>
<message>
<location line="+50"/>
<location line="+166"/>
<source>The displayed information may be out of date. Your wallet automatically synchronizes with the Roxcoin network after a connection is established, but this process has not completed yet.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-124"/>
<source>Balance:</source>
<translation>Gweddill:</translation>
</message>
<message>
<location line="+29"/>
<source>Unconfirmed:</source>
<translation>Nas cadarnheir:</translation>
</message>
<message>
<location line="-78"/>
<source>Wallet</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+107"/>
<source>Immature:</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+13"/>
<source>Mined balance that has not yet matured</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+46"/>
<source><b>Recent transactions</b></source>
<translation><b>Trafodion diweddar</b></translation>
</message>
<message>
<location line="-101"/>
<source>Your current balance</source>
<translation>Eich gweddill presennol</translation>
</message>
<message>
<location line="+29"/>
<source>Total of transactions that have yet to be confirmed, and do not yet count toward the current balance</source>
<translation>Cyfanswm o drafodion sydd heb eu cadarnhau a heb eu cyfri tuag at y gweddill presennol</translation>
</message>
<message>
<location filename="../overviewpage.cpp" line="+116"/>
<location line="+1"/>
<source>out of sync</source>
<translation type="unfinished"/>
</message>
</context>
<context>
<name>PaymentServer</name>
<message>
<location filename="../paymentserver.cpp" line="+107"/>
<source>Cannot start roxcoin: click-to-pay handler</source>
<translation type="unfinished"/>
</message>
</context>
<context>
<name>QRCodeDialog</name>
<message>
<location filename="../forms/qrcodedialog.ui" line="+14"/>
<source>QR Code Dialog</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+59"/>
<source>Request Payment</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+56"/>
<source>Amount:</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-44"/>
<source>Label:</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+19"/>
<source>Message:</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+71"/>
<source>&Save As...</source>
<translation type="unfinished"/>
</message>
<message>
<location filename="../qrcodedialog.cpp" line="+62"/>
<source>Error encoding URI into QR Code.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+40"/>
<source>The entered amount is invalid, please check.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+23"/>
<source>Resulting URI too long, try to reduce the text for label / message.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+25"/>
<source>Save QR Code</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+0"/>
<source>PNG Images (*.png)</source>
<translation type="unfinished"/>
</message>
</context>
<context>
<name>RPCConsole</name>
<message>
<location filename="../forms/rpcconsole.ui" line="+46"/>
<source>Client name</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+10"/>
<location line="+23"/>
<location line="+26"/>
<location line="+23"/>
<location line="+23"/>
<location line="+36"/>
<location line="+53"/>
<location line="+23"/>
<location line="+23"/>
<location filename="../rpcconsole.cpp" line="+339"/>
<source>N/A</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-217"/>
<source>Client version</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-45"/>
<source>&Information</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+68"/>
<source>Using OpenSSL version</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+49"/>
<source>Startup time</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+29"/>
<source>Network</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+7"/>
<source>Number of connections</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+23"/>
<source>On testnet</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+23"/>
<source>Block chain</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+7"/>
<source>Current number of blocks</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+23"/>
<source>Estimated total blocks</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+23"/>
<source>Last block time</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+52"/>
<source>&Open</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+16"/>
<source>Command-line options</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+7"/>
<source>Show the Roxcoin-Qt help message to get a list with possible Roxcoin command-line options.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>&Show</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+24"/>
<source>&Console</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-260"/>
<source>Build date</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-104"/>
<source>Roxcoin - Debug window</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+25"/>
<source>Roxcoin Core</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+279"/>
<source>Debug log file</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+7"/>
<source>Open the Roxcoin debug log file from the current data directory. This can take a few seconds for large log files.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+102"/>
<source>Clear console</source>
<translation type="unfinished"/>
</message>
<message>
<location filename="../rpcconsole.cpp" line="-30"/>
<source>Welcome to the Roxcoin RPC console.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Use up and down arrows to navigate history, and <b>Ctrl-L</b> to clear screen.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Type <b>help</b> for an overview of available commands.</source>
<translation type="unfinished"/>
</message>
</context>
<context>
<name>SendCoinsDialog</name>
<message>
<location filename="../forms/sendcoinsdialog.ui" line="+14"/>
<location filename="../sendcoinsdialog.cpp" line="+124"/>
<location line="+5"/>
<location line="+5"/>
<location line="+5"/>
<location line="+6"/>
<location line="+5"/>
<location line="+5"/>
<source>Send Coins</source>
<translation>Anfon arian</translation>
</message>
<message>
<location line="+50"/>
<source>Send to multiple recipients at once</source>
<translation>Anfon at pobl lluosog ar yr un pryd</translation>
</message>
<message>
<location line="+3"/>
<source>Add &Recipient</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+20"/>
<source>Remove all transaction fields</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Clear &All</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+22"/>
<source>Balance:</source>
<translation>Gweddill:</translation>
</message>
<message>
<location line="+10"/>
<source>123.456 BTC</source>
<translation>123.456 BTC</translation>
</message>
<message>
<location line="+31"/>
<source>Confirm the send action</source>
<translation>Cadarnhau'r gweithrediad anfon</translation>
</message>
<message>
<location line="+3"/>
<source>S&end</source>
<translation type="unfinished"/>
</message>
<message>
<location filename="../sendcoinsdialog.cpp" line="-59"/>
<source><b>%1</b> to %2 (%3)</source>
<translation><b>%1</b> to %2 (%3)</translation>
</message>
<message>
<location line="+5"/>
<source>Confirm send coins</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Are you sure you want to send %1?</source>
<translation>Ydych chi'n siwr eich bod chi eisiau anfon %1?</translation>
</message>
<message>
<location line="+0"/>
<source> and </source>
<translation>a</translation>
</message>
<message>
<location line="+23"/>
<source>The recipient address is not valid, please recheck.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+5"/>
<source>The amount to pay must be larger than 0.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+5"/>
<source>The amount exceeds your balance.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+5"/>
<source>The total exceeds your balance when the %1 transaction fee is included.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+6"/>
<source>Duplicate address found, can only send to each address once per send operation.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+5"/>
<source>Error: Transaction creation failed!</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+5"/>
<source>Error: The transaction was rejected. This might happen if some of the coins in your wallet were already spent, such as if you used a copy of wallet.dat and coins were spent in the copy but not marked as spent here.</source>
<translation type="unfinished"/>
</message>
</context>
<context>
<name>SendCoinsEntry</name>
<message>
<location filename="../forms/sendcoinsentry.ui" line="+14"/>
<source>Form</source>
<translation>Ffurflen</translation>
</message>
<message>
<location line="+15"/>
<source>A&mount:</source>
<translation>&Maint</translation>
</message>
<message>
<location line="+13"/>
<source>Pay &To:</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+34"/>
<source>The address to send the payment to (e.g. Ler4HNAEfwYhBmGXcFP2Po1NpRUEiK8km2)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+60"/>
<location filename="../sendcoinsentry.cpp" line="+26"/>
<source>Enter a label for this address to add it to your address book</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-78"/>
<source>&Label:</source>
<translation>&Label:</translation>
</message>
<message>
<location line="+28"/>
<source>Choose address from address book</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+10"/>
<source>Alt+A</source>
<translation>Alt+A</translation>
</message>
<message>
<location line="+7"/>
<source>Paste address from clipboard</source>
<translation>Gludo cyfeiriad o'r glipfwrdd</translation>
</message>
<message>
<location line="+10"/>
<source>Alt+P</source>
<translation>Alt+P</translation>
</message>
<message>
<location line="+7"/>
<source>Remove this recipient</source>
<translation type="unfinished"/>
</message>
<message>
<location filename="../sendcoinsentry.cpp" line="+1"/>
<source>Enter a Roxcoin address (e.g. Ler4HNAEfwYhBmGXcFP2Po1NpRUEiK8km2)</source>
<translation type="unfinished"/>
</message>
</context>
<context>
<name>SignVerifyMessageDialog</name>
<message>
<location filename="../forms/signverifymessagedialog.ui" line="+14"/>
<source>Signatures - Sign / Verify a Message</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+13"/>
<source>&Sign Message</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+6"/>
<source>You can sign messages with your addresses to prove you own them. Be careful not to sign anything vague, as phishing attacks may try to trick you into signing your identity over to them. Only sign fully-detailed statements you agree to.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+18"/>
<source>The address to sign the message with (e.g. Ler4HNAEfwYhBmGXcFP2Po1NpRUEiK8km2)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+10"/>
<location line="+213"/>
<source>Choose an address from the address book</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-203"/>
<location line="+213"/>
<source>Alt+A</source>
<translation>Alt+A</translation>
</message>
<message>
<location line="-203"/>
<source>Paste address from clipboard</source>
<translation>Gludo cyfeiriad o'r glipfwrdd</translation>
</message>
<message>
<location line="+10"/>
<source>Alt+P</source>
<translation>Alt+P</translation>
</message>
<message>
<location line="+12"/>
<source>Enter the message you want to sign here</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+7"/>
<source>Signature</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+27"/>
<source>Copy the current signature to the system clipboard</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+21"/>
<source>Sign the message to prove you own this Roxcoin address</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Sign &Message</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+14"/>
<source>Reset all sign message fields</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<location line="+146"/>
<source>Clear &All</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-87"/>
<source>&Verify Message</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+6"/>
<source>Enter the signing address, message (ensure you copy line breaks, spaces, tabs, etc. exactly) and signature below to verify the message. Be careful not to read more into the signature than what is in the signed message itself, to avoid being tricked by a man-in-the-middle attack.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+21"/>
<source>The address the message was signed with (e.g. Ler4HNAEfwYhBmGXcFP2Po1NpRUEiK8km2)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+40"/>
<source>Verify the message to ensure it was signed with the specified Roxcoin address</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Verify &Message</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+14"/>
<source>Reset all verify message fields</source>
<translation type="unfinished"/>
</message>
<message>
<location filename="../signverifymessagedialog.cpp" line="+27"/>
<location line="+3"/>
<source>Enter a Roxcoin address (e.g. Ler4HNAEfwYhBmGXcFP2Po1NpRUEiK8km2)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-2"/>
<source>Click "Sign Message" to generate signature</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Enter Roxcoin signature</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+82"/>
<location line="+81"/>
<source>The entered address is invalid.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-81"/>
<location line="+8"/>
<location line="+73"/>
<location line="+8"/>
<source>Please check the address and try again.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-81"/>
<location line="+81"/>
<source>The entered address does not refer to a key.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-73"/>
<source>Wallet unlock was cancelled.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+8"/>
<source>Private key for the entered address is not available.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+12"/>
<source>Message signing failed.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+5"/>
<source>Message signed.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+59"/>
<source>The signature could not be decoded.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+0"/>
<location line="+13"/>
<source>Please check the signature and try again.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+0"/>
<source>The signature did not match the message digest.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+7"/>
<source>Message verification failed.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+5"/>
<source>Message verified.</source>
<translation type="unfinished"/>
</message>
</context>
<context>
<name>SplashScreen</name>
<message>
<location filename="../splashscreen.cpp" line="+22"/>
<source>The Roxcoin developers</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>[testnet]</source>
<translation type="unfinished"/>
</message>
</context>
<context>
<name>TransactionDesc</name>
<message>
<location filename="../transactiondesc.cpp" line="+20"/>
<source>Open until %1</source>
<translation>Agor tan %1</translation>
</message>
<message>
<location line="+6"/>
<source>%1/offline</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>%1/unconfirmed</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>%1 confirmations</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+18"/>
<source>Status</source>
<translation type="unfinished"/>
</message>
<message numerus="yes">
<location line="+7"/>
<source>, broadcast through %n node(s)</source>
<translation type="unfinished"><numerusform></numerusform><numerusform></numerusform><numerusform></numerusform><numerusform></numerusform></translation>
</message>
<message>
<location line="+4"/>
<source>Date</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+7"/>
<source>Source</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+0"/>
<source>Generated</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+5"/>
<location line="+17"/>
<source>From</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<location line="+22"/>
<location line="+58"/>
<source>To</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-77"/>
<location line="+2"/>
<source>own address</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-2"/>
<source>label</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+37"/>
<location line="+12"/>
<location line="+45"/>
<location line="+17"/>
<location line="+30"/>
<source>Credit</source>
<translation type="unfinished"/>
</message>
<message numerus="yes">
<location line="-102"/>
<source>matures in %n more block(s)</source>
<translation type="unfinished"><numerusform></numerusform><numerusform></numerusform><numerusform></numerusform><numerusform></numerusform></translation>
</message>
<message>
<location line="+2"/>
<source>not accepted</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+44"/>
<location line="+8"/>
<location line="+15"/>
<location line="+30"/>
<source>Debit</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-39"/>
<source>Transaction fee</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+16"/>
<source>Net amount</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+6"/>
<source>Message</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>Comment</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>Transaction ID</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Generated coins must mature 120 blocks before they can be spent. When you generated this block, it was broadcast to the network to be added to the block chain. If it fails to get into the chain, its state will change to "not accepted" and it won't be spendable. This may occasionally happen if another node generates a block within a few seconds of yours.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+7"/>
<source>Debug information</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+8"/>
<source>Transaction</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Inputs</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+23"/>
<source>Amount</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>true</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+0"/>
<source>false</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-209"/>
<source>, has not been successfully broadcast yet</source>
<translation type="unfinished"/>
</message>
<message numerus="yes">
<location line="-35"/>
<source>Open for %n more block(s)</source>
<translation type="unfinished"><numerusform></numerusform><numerusform></numerusform><numerusform></numerusform><numerusform></numerusform></translation>
</message>
<message>
<location line="+70"/>
<source>unknown</source>
<translation type="unfinished"/>
</message>
</context>
<context>
<name>TransactionDescDialog</name>
<message>
<location filename="../forms/transactiondescdialog.ui" line="+14"/>
<source>Transaction details</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+6"/>
<source>This pane shows a detailed description of the transaction</source>
<translation type="unfinished"/>
</message>
</context>
<context>
<name>TransactionTableModel</name>
<message>
<location filename="../transactiontablemodel.cpp" line="+225"/>
<source>Date</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+0"/>
<source>Type</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+0"/>
<source>Address</source>
<translation>Cyfeiriad</translation>
</message>
<message>
<location line="+0"/>
<source>Amount</source>
<translation type="unfinished"/>
</message>
<message numerus="yes">
<location line="+57"/>
<source>Open for %n more block(s)</source>
<translation type="unfinished"><numerusform></numerusform><numerusform></numerusform><numerusform></numerusform><numerusform></numerusform></translation>
</message>
<message>
<location line="+3"/>
<source>Open until %1</source>
<translation>Agor tan %1</translation>
</message>
<message>
<location line="+3"/>
<source>Offline (%1 confirmations)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Unconfirmed (%1 of %2 confirmations)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Confirmed (%1 confirmations)</source>
<translation type="unfinished"/>
</message>
<message numerus="yes">
<location line="+8"/>
<source>Mined balance will be available when it matures in %n more block(s)</source>
<translation type="unfinished"><numerusform></numerusform><numerusform></numerusform><numerusform></numerusform><numerusform></numerusform></translation>
</message>
<message>
<location line="+5"/>
<source>This block was not received by any other nodes and will probably not be accepted!</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Generated but not accepted</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+43"/>
<source>Received with</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>Received from</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Sent to</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>Payment to yourself</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>Mined</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+38"/>
<source>(n/a)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+199"/>
<source>Transaction status. Hover over this field to show number of confirmations.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>Date and time that the transaction was received.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>Type of transaction.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>Destination address of transaction.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>Amount removed from or added to balance.</source>
<translation type="unfinished"/>
</message>
</context>
<context>
<name>TransactionView</name>
<message>
<location filename="../transactionview.cpp" line="+52"/>
<location line="+16"/>
<source>All</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-15"/>
<source>Today</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>This week</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>This month</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Last month</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>This year</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Range...</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+11"/>
<source>Received with</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>Sent to</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>To yourself</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Mined</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Other</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+7"/>
<source>Enter address or label to search</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+7"/>
<source>Min amount</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+34"/>
<source>Copy address</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Copy label</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Copy amount</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Copy transaction ID</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Edit label</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Show transaction details</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+139"/>
<source>Export Transaction Data</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Comma separated file (*.csv)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+8"/>
<source>Confirmed</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Date</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Type</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Label</source>
<translation>Label</translation>
</message>
<message>
<location line="+1"/>
<source>Address</source>
<translation>Cyfeiriad</translation>
</message>
<message>
<location line="+1"/>
<source>Amount</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>ID</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+4"/>
<source>Error exporting</source>
<translation>Gwall allforio</translation>
</message>
<message>
<location line="+0"/>
<source>Could not write to file %1.</source>
<translation>Ni ellir ysgrifennu i ffeil %1.</translation>
</message>
<message>
<location line="+100"/>
<source>Range:</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+8"/>
<source>to</source>
<translation type="unfinished"/>
</message>
</context>
<context>
<name>WalletModel</name>
<message>
<location filename="../walletmodel.cpp" line="+193"/>
<source>Send Coins</source>
<translation type="unfinished"/>
</message>
</context>
<context>
<name>WalletView</name>
<message>
<location filename="../walletview.cpp" line="+42"/>
<source>&Export</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Export the data in the current tab to a file</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+193"/>
<source>Backup Wallet</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+0"/>
<source>Wallet Data (*.dat)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Backup Failed</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+0"/>
<source>There was an error trying to save the wallet data to the new location.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+4"/>
<source>Backup Successful</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+0"/>
<source>The wallet data was successfully saved to the new location.</source>
<translation type="unfinished"/>
</message>
</context>
<context>
<name>bitcoin-core</name>
<message>
<location filename="../bitcoinstrings.cpp" line="+94"/>
<source>Roxcoin version</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+102"/>
<source>Usage:</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-29"/>
<source>Send command to -server or roxcoind</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-23"/>
<source>List commands</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-12"/>
<source>Get help for a command</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+24"/>
<source>Options:</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+24"/>
<source>Specify configuration file (default: roxcoin.conf)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Specify pid file (default: roxcoind.pid)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-1"/>
<source>Specify data directory</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-9"/>
<source>Set database cache size in megabytes (default: 25)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-28"/>
<source>Listen for connections on <port> (default: 99123 or testnet: 199123)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+5"/>
<source>Maintain at most <n> connections to peers (default: 125)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-48"/>
<source>Connect to a node to retrieve peer addresses, and disconnect</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+82"/>
<source>Specify your own public address</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Threshold for disconnecting misbehaving peers (default: 100)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-134"/>
<source>Number of seconds to keep misbehaving peers from reconnecting (default: 86400)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-29"/>
<source>An error occurred while setting up the RPC port %u for listening on IPv4: %s</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+27"/>
<source>Listen for JSON-RPC connections on <port> (default: 99124 or testnet: 14694)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+37"/>
<source>Accept command line and JSON-RPC commands</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+76"/>
<source>Run in the background as a daemon and accept commands</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+37"/>
<source>Use the test network</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-112"/>
<source>Accept connections from outside (default: 1 if no -proxy or -connect)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-80"/>
<source>%s, you must set a rpcpassword in the configuration file:
%s
It is recommended you use the following random password:
rpcuser=roxcoinrpc
rpcpassword=%s
(you do not need to remember this password)
The username and password MUST NOT be the same.
If the file does not exist, create it with owner-readable-only file permissions.
It is also recommended to set alertnotify so you are notified of problems;
for example: alertnotify=echo %%s | mail -s "Roxcoin Alert" [email protected]
</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+17"/>
<source>An error occurred while setting up the RPC port %u for listening on IPv6, falling back to IPv4: %s</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Bind to given address and always listen on it. Use [host]:port notation for IPv6</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Cannot obtain a lock on data directory %s. Roxcoin is probably already running.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Error: The transaction was rejected! This might happen if some of the coins in your wallet were already spent, such as if you used a copy of wallet.dat and coins were spent in the copy but not marked as spent here.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+4"/>
<source>Error: This transaction requires a transaction fee of at least %s because of its amount, complexity, or use of recently received funds!</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Execute command when a relevant alert is received (%s in cmd is replaced by message)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Execute command when a wallet transaction changes (%s in cmd is replaced by TxID)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+11"/>
<source>Set maximum size of high-priority/low-fee transactions in bytes (default: 27000)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+6"/>
<source>This is a pre-release test build - use at your own risk - do not use for mining or merchant applications</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+5"/>
<source>Warning: -paytxfee is set very high! This is the transaction fee you will pay if you send a transaction.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Warning: Displayed transactions may not be correct! You may need to upgrade, or other nodes may need to upgrade.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Warning: Please check that your computer's date and time are correct! If your clock is wrong Roxcoin will not work properly.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Warning: error reading wallet.dat! All keys read correctly, but transaction data or address book entries might be missing or incorrect.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Warning: wallet.dat corrupt, data salvaged! Original wallet.dat saved as wallet.{timestamp}.bak in %s; if your balance or transactions are incorrect you should restore from a backup.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+14"/>
<source>Attempt to recover private keys from a corrupt wallet.dat</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>Block creation options:</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+5"/>
<source>Connect only to the specified node(s)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Corrupted block database detected</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Discover own IP address (default: 1 when listening and no -externalip)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Do you want to rebuild the block database now?</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>Error initializing block database</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Error initializing wallet database environment %s!</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Error loading block database</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+4"/>
<source>Error opening block database</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>Error: Disk space is low!</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Error: Wallet locked, unable to create transaction!</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Error: system error: </source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Failed to listen on any port. Use -listen=0 if you want this.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Failed to read block info</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Failed to read block</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Failed to sync block index</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Failed to write block index</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Failed to write block info</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Failed to write block</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Failed to write file info</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Failed to write to coin database</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Failed to write transaction index</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Failed to write undo data</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>Find peers using DNS lookup (default: 1 unless -connect)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Generate coins (default: 0)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>How many blocks to check at startup (default: 288, 0 = all)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>How thorough the block verification is (0-4, default: 3)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+19"/>
<source>Not enough file descriptors available.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+8"/>
<source>Rebuild block chain index from current blk000??.dat files</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+16"/>
<source>Set the number of threads to service RPC calls (default: 4)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+26"/>
<source>Verifying blocks...</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Verifying wallet...</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-69"/>
<source>Imports blocks from external blk000??.dat file</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-76"/>
<source>Set the number of script verification threads (up to 16, 0 = auto, <0 = leave that many cores free, default: 0)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+77"/>
<source>Information</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Invalid -tor address: '%s'</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Invalid amount for -minrelaytxfee=<amount>: '%s'</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Invalid amount for -mintxfee=<amount>: '%s'</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+8"/>
<source>Maintain a full transaction index (default: 0)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>Maximum per-connection receive buffer, <n>*1000 bytes (default: 5000)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Maximum per-connection send buffer, <n>*1000 bytes (default: 1000)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>Only accept block chain matching built-in checkpoints (default: 1)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Only connect to nodes in network <net> (IPv4, IPv6 or Tor)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>Output extra debugging information. Implies all other -debug* options</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Output extra network debugging information</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>Prepend debug output with timestamp</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+5"/>
<source>SSL options: (see the Roxcoin Wiki for SSL setup instructions)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Select the version of socks proxy to use (4-5, default: 5)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Send trace/debug info to console instead of debug.log file</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Send trace/debug info to debugger</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+5"/>
<source>Set maximum block size in bytes (default: 250000)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Set minimum block size in bytes (default: 0)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>Shrink debug.log file on client startup (default: 1 when no -debug)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Signing transaction failed</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>Specify connection timeout in milliseconds (default: 5000)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+4"/>
<source>System error: </source>
<translation type="unfinished"/>
</message>
<message>
<location line="+4"/>
<source>Transaction amount too small</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Transaction amounts must be positive</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Transaction too large</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+7"/>
<source>Use UPnP to map the listening port (default: 0)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Use UPnP to map the listening port (default: 1 when listening)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Use proxy to reach tor hidden services (default: same as -proxy)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>Username for JSON-RPC connections</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+4"/>
<source>Warning</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Warning: This version is obsolete, upgrade required!</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>You need to rebuild the databases using -reindex to change -txindex</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>wallet.dat corrupt, salvage failed</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-50"/>
<source>Password for JSON-RPC connections</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-67"/>
<source>Allow JSON-RPC connections from specified IP address</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+76"/>
<source>Send commands to node running on <ip> (default: 127.0.0.1)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-120"/>
<source>Execute command when the best block changes (%s in cmd is replaced by block hash)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+147"/>
<source>Upgrade wallet to latest format</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-21"/>
<source>Set key pool size to <n> (default: 100)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-12"/>
<source>Rescan the block chain for missing wallet transactions</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+35"/>
<source>Use OpenSSL (https) for JSON-RPC connections</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-26"/>
<source>Server certificate file (default: server.cert)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Server private key (default: server.pem)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-151"/>
<source>Acceptable ciphers (default: TLSv1+HIGH:!SSLv2:!aNULL:!eNULL:!AH:!3DES:@STRENGTH)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+165"/>
<source>This help message</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+6"/>
<source>Unable to bind to %s on this computer (bind returned error %d, %s)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-91"/>
<source>Connect through socks proxy</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-10"/>
<source>Allow DNS lookups for -addnode, -seednode and -connect</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+55"/>
<source>Loading addresses...</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-35"/>
<source>Error loading wallet.dat: Wallet corrupted</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Error loading wallet.dat: Wallet requires newer version of Roxcoin</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+93"/>
<source>Wallet needed to be rewritten: restart Roxcoin to complete</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-95"/>
<source>Error loading wallet.dat</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+28"/>
<source>Invalid -proxy address: '%s'</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+56"/>
<source>Unknown network specified in -onlynet: '%s'</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-1"/>
<source>Unknown -socks proxy version requested: %i</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-96"/>
<source>Cannot resolve -bind address: '%s'</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Cannot resolve -externalip address: '%s'</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+44"/>
<source>Invalid amount for -paytxfee=<amount>: '%s'</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Invalid amount</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-6"/>
<source>Insufficient funds</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+10"/>
<source>Loading block index...</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-57"/>
<source>Add a node to connect to and attempt to keep the connection open</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-25"/>
<source>Unable to bind to %s on this computer. Roxcoin is probably already running.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+64"/>
<source>Fee per KB to add to transactions you send</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+19"/>
<source>Loading wallet...</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-52"/>
<source>Cannot downgrade wallet</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Cannot write default address</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+64"/>
<source>Rescanning...</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-57"/>
<source>Done loading</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+82"/>
<source>To use the %s option</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-74"/>
<source>Error</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-31"/>
<source>You must set rpcpassword=<password> in the configuration file:
%s
If the file does not exist, create it with owner-readable-only file permissions.</source>
<translation type="unfinished"/>
</message>
</context>
</TS> | {
"content_hash": "6e7c880e9127de67bd6f1713d498da28",
"timestamp": "",
"source": "github",
"line_count": 2917,
"max_line_length": 395,
"avg_line_length": 34.077819677751116,
"alnum_prop": 0.5930989386851768,
"repo_name": "Roxcoin/roxcointor",
"id": "fc44dd6d4f033d12d76791f65ef0f2035644e95b",
"size": "99407",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/qt/locale/bitcoin_cy.ts",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C",
"bytes": "8091491"
},
{
"name": "C++",
"bytes": "2600439"
},
{
"name": "CSS",
"bytes": "1127"
},
{
"name": "Objective-C++",
"bytes": "5864"
},
{
"name": "Python",
"bytes": "37260"
},
{
"name": "Shell",
"bytes": "14940"
},
{
"name": "TypeScript",
"bytes": "5232302"
}
],
"symlink_target": ""
} |
"""
Microservice for writing JSON data to MongoDB.
For DataRobot
:license: BSD, see LICENSE for more details.
"""
from flask import Flask, request
from mongokit import Connection, Document
from werkzeug import exceptions as wExceptions
from datetime import datetime
import sys
import hashlib
import json
# Configuration
MONGODB_HOST = 'localhost'
MONGODB_PORT = 27017
MONGODB_DB = 'docs'
MONGODB_COLLECTION = 'docs'
# JSON fields should be ordered before MD5
# Temporary disabled
# JSON_ORDERED = False
# JSON_ORDER_ALNUM = False
# JSON_FIELD_ORDER = [ 'date', 'uid', 'name' ]
# Create Flask app
app = Flask( __name__ )
app.config.from_object( __name__ )
app.debug = True
# Connect to DB
connection = Connection( app.config['MONGODB_HOST'], app.config['MONGODB_PORT'] )
docsCollection = connection[ app.config['MONGODB_DB']][ app.config['MONGODB_COLLECTION']]
def _saver( collection, item ):
doc = collection.Doc()
for ( k, v ) in item.iteritems():
doc[k] = v
return doc.save()
def json_load( data ):
return json.loads( data )
def json_dump( data ):
return json.dumps( data )
@connection.register
class Doc( Document ):
structure = {
'uid' : unicode,
'name' : unicode,
'date' : unicode
}
required_fields = [ 'uid', 'name', 'date' ]
def validate( self, *args, **kwargs ):
isOK = True
m = hashlib.md5()
ref = self['md5checksum']
clone = self
clone.__delitem__( 'md5checksum' )
m.update( json.dumps( clone ) )
calc = m.hexdigest()
isOK = ( ref == calc )
try:
d = datetime.strptime( self['date'], "%Y-%m-%dT%H:%M:%S.%f" )
except:
isOK = False
return isOK
@app.route( '/', methods=[ 'POST' ] )
def add_rec():
try:
d = request.json
res = dict()
# We don't need else section, valid JSON could be list/dict only
if d and isinstance( d, list ):
for item in d:
res[ item['uid'] ] = _saver( docsCollection, item )
elif d and isinstance( d, dict ):
res[ d['uid'] ] = _saver( docsCollection, d )
except wExceptions.BadRequest:
return json.dumps( { "status": "ERROR", "info": "Bad request" } )
except Exception:
return json.dumps( { "status": "ERROR", "info": sys.exc_info().__str__() } )
return json_dump( { "status": "OK", "info": res } )
@app.route( '/<uid>/<date>', methods=[ 'GET' ] )
def get_rec(uid, date):
try:
item = list(docsCollection.Doc.find())
return json_dump( { "status": "OK", item: item } )
except Exception:
return json_dump( { "status": "ERROR", "info": sys.exc_info().__str__() } ) | {
"content_hash": "3e571a3bb4668d68673bf88e485fafb0",
"timestamp": "",
"source": "github",
"line_count": 110,
"max_line_length": 89,
"avg_line_length": 25.009090909090908,
"alnum_prop": 0.5863322428207924,
"repo_name": "rliskovenko/DataRobot",
"id": "db56057ff36004552448d4f9f37c07d586014c2a",
"size": "2751",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "app/app.py",
"mode": "33188",
"license": "bsd-2-clause",
"language": [
{
"name": "Python",
"bytes": "5916"
},
{
"name": "Ruby",
"bytes": "1722"
}
],
"symlink_target": ""
} |
/**
* \file joint_sensor_iid_test.cpp
* \date August 2015
* \author Jan Issac ([email protected])
*/
#include <gtest/gtest.h>
#include "../../typecast.hpp"
#include <Eigen/Dense>
#include <cmath>
#include <iostream>
#include <fl/util/types.hpp>
#include <fl/model/sensor/linear_gaussian_sensor.hpp>
#include <fl/model/sensor/joint_sensor_iid.hpp>
template <typename TestType>
class JointSensorIidTest:
public testing::Test
{
public:
enum : signed int
{
LocalStateDim = TestType::Parameter::StateDim,
LocalObsrvDim = TestType::Parameter::ObsrvDim,
LocalNoiseDim = TestType::Parameter::ObsrvDim,
Count = TestType::Parameter::LocalModelCount,
LocalStateSize = fl::TestSize<LocalStateDim, TestType>::Value,
LocalObsrvSize = fl::TestSize<LocalObsrvDim, TestType>::Value,
LocalNoiseSize = fl::TestSize<LocalNoiseDim, TestType>::Value,
Size = fl::TestSize<Count, TestType>::Value
};
// Local model types
typedef Eigen::Matrix<fl::Real, LocalStateSize, 1> LocalState;
typedef Eigen::Matrix<fl::Real, LocalObsrvSize, 1> LocalObsrv;
typedef fl::LinearGaussianSensor<LocalObsrv, LocalState> LocalModel;
typedef typename LocalModel::Noise LocalNoise;
// Joint model types
typedef fl::JointSensor<
fl::MultipleOf<LocalModel, Size>
> JointModel;
typedef typename JointModel::Obsrv Obsrv;
typedef typename JointModel::Noise Noise;
typedef typename JointModel::State State;
enum : signed int
{
StateDim = LocalStateDim,
ObsrvDim = LocalObsrvDim * Count,
NoiseDim = LocalNoiseDim * Count,
StateSize = fl::TestSize<StateDim, TestType>::Value,
ObsrvSize = fl::TestSize<ObsrvDim, TestType>::Value,
NoiseSize = fl::TestSize<NoiseDim, TestType>::Value
};
JointSensorIidTest()
: joint_model(create_joint_sensor(create_local_model())),
noise_normal_gaussian(NoiseDim)
{ }
State zero_state() { return State::Zero(LocalStateDim); }
Obsrv zero_obsrv() { return Obsrv::Zero(LocalObsrvDim); }
Noise zero_noise() { return Noise::Zero(LocalNoiseDim); }
State rand_state() { return State::Random(LocalStateDim); }
Obsrv rand_obsrv() { return Obsrv::Random(LocalObsrvDim); }
Noise rand_noise() { return noise_normal_gaussian.sample(); }
LocalModel create_local_model()
{
return LocalModel(LocalObsrvDim, LocalStateDim);
}
template <typename LocalSensor>
JointModel create_joint_sensor(LocalSensor&& local_model)
{
return JointModel(local_model, Count);
}
void init_dimension_test()
{
EXPECT_EQ(joint_model.obsrv_dimension(), ObsrvDim);
EXPECT_EQ(joint_model.noise_dimension(), NoiseDim);
EXPECT_EQ(joint_model.state_dimension(), StateDim);
}
void observation()
{
auto y = joint_model.observation(rand_state(), rand_noise());
EXPECT_EQ(y.size(), ObsrvDim);
for (int i = 0; i < y.size(); ++i)
{
EXPECT_NE(y[i], 0.);
}
}
void nested_joint_model()
{
// nested joint model type taking multiple of JointModel
typedef fl::JointSensor<
fl::MultipleOf<JointModel, Size>
> OuterJointModel;
auto nested_joint =
OuterJointModel(
create_joint_sensor(create_local_model()), Count);
EXPECT_EQ(nested_joint.obsrv_dimension(), ObsrvDim * Count);
EXPECT_EQ(nested_joint.noise_dimension(), NoiseDim * Count);
EXPECT_EQ(nested_joint.state_dimension(), StateDim);
}
// void probability()
// {
// auto x = State::Random(StateDim).eval();
// auto y = Obsrv::Random(ObsrvDim).eval();
// auto body_prob = body_model.probability(y, x);
// auto tail_prob = tail_model.probability(y, x);
// auto body_tail_prob = body_tail_model.probability(y, x);
// ASSERT_DOUBLE_EQ((body_prob + tail_prob)/2., body_tail_prob);
// }
// void log_probability()
// {
// auto x = State::Random(StateDim).eval();
// auto y = Obsrv::Random(ObsrvDim).eval();
// auto body_prob = body_model.probability(y, x);
// auto tail_prob = tail_model.probability(y, x);
// auto body_tail_log_prob = body_tail_model.log_probability(y, x);
// ASSERT_DOUBLE_EQ(std::log((body_prob + tail_prob)/2.),
// body_tail_log_prob);
// }
protected:
JointModel joint_model;
fl::StandardGaussian<Noise> noise_normal_gaussian;
};
template <int ModelCount, int ObsrvDimension, int StateDimension>
struct Dimensions
{
enum: signed int
{
ObsrvDim = ObsrvDimension,
StateDim = StateDimension,
LocalModelCount = ModelCount
};
};
typedef ::testing::Types<
fl::StaticTest<Dimensions<1, 1, 1>>,
fl::StaticTest<Dimensions<2, 1, 1>>,
fl::StaticTest<Dimensions<10, 1, 1>>,
fl::StaticTest<Dimensions<1, 2, 1>>,
fl::StaticTest<Dimensions<2, 3, 2>>,
fl::StaticTest<Dimensions<10, 11, 1>>,
fl::DynamicTest<Dimensions<1, 1, 1>>,
fl::DynamicTest<Dimensions<2, 1, 1>>,
fl::DynamicTest<Dimensions<10, 1, 1>>,
fl::DynamicTest<Dimensions<1, 2, 1>>,
fl::DynamicTest<Dimensions<2, 3, 2>>,
fl::DynamicTest<Dimensions<10, 11, 1>>
> TestTypes;
TYPED_TEST_CASE(JointSensorIidTest, TestTypes);
TYPED_TEST(JointSensorIidTest, init_dimension)
{
TestFixture::init_dimension_test();
}
TYPED_TEST(JointSensorIidTest, observation)
{
TestFixture::observation();
}
TYPED_TEST(JointSensorIidTest, nested_joint_model)
{
TestFixture::nested_joint_model();
}
| {
"content_hash": "fc4b093af6d655907f3e7ba691fa9f9f",
"timestamp": "",
"source": "github",
"line_count": 194,
"max_line_length": 74,
"avg_line_length": 29.963917525773194,
"alnum_prop": 0.6234302425597799,
"repo_name": "filtering-library/fl",
"id": "238b20e7cf1b561ca6f2b059039603bd5f97e56b",
"size": "6231",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "test/model/sensor/joint_sensor_iid_test.cpp",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C++",
"bytes": "758041"
},
{
"name": "CMake",
"bytes": "34814"
}
],
"symlink_target": ""
} |
<!DOCTYPE html>
<!--[if IEMobile 7]><html class="iem7 no-js" lang="en" dir="ltr"><![endif]-->
<!--[if lt IE 7]><html class="lt-ie9 lt-ie8 lt-ie7 no-js" lang="en" dir="ltr"><![endif]-->
<!--[if (IE 7)&(!IEMobile)]><html class="lt-ie9 lt-ie8 no-js" lang="en" dir="ltr"><![endif]-->
<!--[if IE 8]><html class="lt-ie9 no-js" lang="en" dir="ltr"><![endif]-->
<!--[if (gt IE 8)|(gt IEMobile 7)]><!-->
<html class="no-js not-oldie" lang="en" dir="ltr">
<!--<![endif]-->
<head>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="HandheldFriendly" content="true" />
<link rel="shortcut icon" href="https://www.epa.gov/sites/all/themes/epa/favicon.ico" type="image/vnd.microsoft.icon" />
<meta name="MobileOptimized" content="width" />
<meta http-equiv="cleartype" content="on" />
<meta http-equiv="ImageToolbar" content="false" />
<meta name="viewport" content="width=device-width" />
<meta name="version" content="20161218" />
<!--googleon: all-->
<meta name="DC.description" content="" />
<meta name="DC.title" content="" />
<title>
Containment of Highly Concentrated Arsenic-laden Spent Regenerant on the Indian Subcontinent|
Research Project Database | Grantee Research Project | ORD | US EPA</title>
<!--googleoff: snippet-->
<meta name="keywords" content="" />
<link rel="shortlink" href="" />
<link rel="canonical" href="" />
<meta name="DC.creator" content="" />
<meta name="DC.language" content="en" />
<meta name="DC.Subject.epachannel" content="" />
<meta name="DC.type" content="" />
<meta name="DC.date.created" content="" />
<meta name="DC.date.modified" content="2006-09-29" />
<!--googleoff: all-->
<link type="text/css" rel="stylesheet" href="https://www.epa.gov/misc/ui/jquery.ui.autocomplete.css" media="all" />
<link type="text/css" rel="stylesheet" href="https://www.epa.gov/sites/all/themes/epa/css/lib/jquery.ui.theme.css" media="all" />
<link type="text/css" rel="stylesheet" href="https://www.epa.gov/sites/all/libraries/template2/s.css" media="all" />
<!--[if lt IE 9]><link type="text/css" rel="stylesheet" href="https://www.epa.gov/sites/all/themes/epa/css/ie.css" media="all" /><![endif]-->
<link rel="alternate" type="application/atom+xml" title="EPA.gov All Press Releases" href="https://www.epa.gov/newsreleases/search/rss" />
<link rel="alternate" type="application/atom+xml" title="EPA.gov Headquarters Press Releases" href="https://www.epa.gov/newsreleases/search/rss/field_press_office/headquarters" />
<link rel="alternate" type="application/atom+xml" title="Greenversations, EPA's Blog" href="https://blog.epa.gov/blog/feed/" />
<!--[if lt IE 9]><script src="https://www.epa.gov/sites/all/themes/epa/js/html5.js"></script><![endif]-->
<style type="text/css">
/*This style needed for highlight link. Please do not remove*/
.hlText {
font-family: "Arial";
color: red;
font-weight: bold;
font-style: italic;
background-color: yellow;
}
.tblClass {
font-size:smaller; min-width: 10%; line-height: normal;
}
</style>
</head>
<!-- NOTE, figure out body classes! -->
<body class="node-type-(web-area|page|document|webform) (microsite|resource-directory)" >
<!-- Google Tag Manager -->
<noscript>
<iframe src="//www.googletagmanager.com/ns.html?id=GTM-L8ZB" height="0" width="0" style="display:none;visibility:hidden"></iframe>
</noscript>
<script>(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src='//www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);})(window,document,'script','dataLayer','GTM-L8ZB');</script>
<!-- End Google Tag Manager -->
<div class="skip-links"><a href="#main-content" class="skip-link element-invisible element-focusable">Jump to main content</a></div>
<header class="masthead clearfix" role="banner"> <img class="site-logo" src="https://www.epa.gov/sites/all/themes/epa/logo.png" alt="" />
<hgroup class="site-name-and-slogan">
<h1 class="site-name"><a href="https://www.epa.gov/" title="Go to the home page" rel="home"><span>US EPA</span></a></h1>
<div class="site-slogan">United States Environmental Protection Agency</div>
</hgroup>
<form class="epa-search" method="get" action="https://search.epa.gov/epasearch/epasearch">
<label class="element-hidden" for="search-box">Search</label>
<input class="form-text" placeholder="Search EPA.gov" name="querytext" id="search-box" value=""/>
<button class="epa-search-button" id="search-button" type="submit" title="Search">Search</button>
<input type="hidden" name="fld" value="" />
<input type="hidden" name="areaname" value="" />
<input type="hidden" name="areacontacts" value="" />
<input type="hidden" name="areasearchurl" value="" />
<input type="hidden" name="typeofsearch" value="epa" />
<input type="hidden" name="result_template" value="2col.ftl" />
<input type="hidden" name="filter" value="sample4filt.hts" />
</form>
</header>
<section id="main-content" class="main-content clearfix" role="main">
<div class="region-preface clearfix">
<div id="block-pane-epa-web-area-connect" class="block block-pane contextual-links-region">
<ul class="menu utility-menu">
<li class="menu-item"><a href="https://www.epa.gov/research-grants/forms/contact-us-about-research-grants" class="menu-link contact-us">Contact Us</a></li>
</ul>
</div>
</div>
<div class="main-column clearfix">
<!--googleon: all-->
<div class="panel-pane pane-node-content" >
<div class="pane-content">
<div class="node node-page clearfix view-mode-full">
<div class="box multi related-info right clear-right" style="max-width:300px; font-size:14px;"><!--googleoff: index-->
<h5 class="pane-title">Project Research Results</h5>
<div class="pane-content">
<ul>
<li><a href="https://cfpub.epa.gov/ncer_abstracts/index.cfm/fuseaction/display.abstractDetail/abstract/8111/report/F">Final Report</a></li>
<li><a href="https://cfpub.epa.gov/ncer_abstracts/index.cfm/fuseaction/display.abstractDetail/abstract/8646">P3 Phase II</a>
| <a href="https://cfpub.epa.gov/ncer_abstracts/index.cfm/fuseaction/display.abstractDetail/abstract/8646/report/2008">2008 Progress Report</a>
| <a href="https://cfpub.epa.gov/ncer_abstracts/index.cfm/fuseaction/display.abstractDetail/abstract/8646/report/F">Final Report</a>
</li>
</ul>
<a href="https://cfpub.epa.gov/ncer_abstracts/index.cfm/fuseaction/display.publications/abstract/8111">3 publications for this project</a><br />
<a href="https://cfpub.epa.gov/ncer_abstracts/index.cfm/fuseaction/display.journals/abstract/8111">2 journal articles for this project</a> <br />
</div>
<!-- RFA Search start -->
<h5 class="pane-title">Related Information</h5>
<div class="pane-content">
<ul><li><a href="https://www.epa.gov/research-grants/">Research Grants</a></li>
<li><a href="https://www.epa.gov/P3">P3: Student Design Competition</a></li>
<li><a href="https://www.epa.gov/research-fellowships/">Research Fellowships</a></li>
<li><a href="https://www.epa.gov/sbir/">Small Business Innovation Research (SBIR)</a></li>
<li><a href="https://cfpub.epa.gov/ncer_abstracts/index.cfm/fuseaction/search.welcome">Grantee Research Project Results Search</a></li>
</ul>
</div>
<!-- RFA Search End --><!--googleon: index-->
</div>
<a name="content"></a>
<h2>
Containment of Highly Concentrated Arsenic-laden Spent Regenerant on the Indian Subcontinent</h2>
<b>EPA Grant Number:</b> SU833178<br />
<b>Title:</b> Containment of Highly Concentrated Arsenic-laden Spent Regenerant on the Indian Subcontinent<br />
<b>Investigators:</b>
<a href="https://cfpub.epa.gov/ncer_abstracts/index.cfm/fuseaction/display.investigatorInfo/investigator/949"> Sengupta, Arup K. </a>
, <a href="https://cfpub.epa.gov/ncer_abstracts/index.cfm/fuseaction/display.investigatorInfo/investigator/7911"> Blaney, Lee M. </a>
, <a href="https://cfpub.epa.gov/ncer_abstracts/index.cfm/fuseaction/display.investigatorInfo/investigator/9929"> Gupta, Anirban </a>
<br />
<b>Current Investigators:</b>
<a href="https://cfpub.epa.gov/ncer_abstracts/index.cfm/fuseaction/display.investigatorInfo/investigator/949"> Sengupta, Arup K. </a>
,
<a href="https://cfpub.epa.gov/ncer_abstracts/index.cfm/fuseaction/display.investigatorInfo/investigator/10757"> Alam, Morshed </a>
,
<a href="https://cfpub.epa.gov/ncer_abstracts/index.cfm/fuseaction/display.investigatorInfo/investigator/7911"> Blaney, Lee M. </a>
,
<a href="https://cfpub.epa.gov/ncer_abstracts/index.cfm/fuseaction/display.investigatorInfo/investigator/10758"> Chatterjee, Prasun </a>
,
<a href="https://cfpub.epa.gov/ncer_abstracts/index.cfm/fuseaction/display.investigatorInfo/investigator/10756"> Ghosh, Debabrata </a>
,
<a href="https://cfpub.epa.gov/ncer_abstracts/index.cfm/fuseaction/display.investigatorInfo/investigator/1647"> Greenleaf, John </a>
,
<a href="https://cfpub.epa.gov/ncer_abstracts/index.cfm/fuseaction/display.investigatorInfo/investigator/9929"> Gupta, Anirban </a>
,
<a href="https://cfpub.epa.gov/ncer_abstracts/index.cfm/fuseaction/display.investigatorInfo/investigator/15519"> Sarkar, Sudipta </a>
<br />
<strong>Institution:</strong>
<a href="https://cfpub.epa.gov/ncer_abstracts/index.cfm/fuseaction/display.institutionInfo/institution/1155">
<b>Lehigh University</b>
</a> ,
<a href="https://cfpub.epa.gov/ncer_abstracts/index.cfm/fuseaction/display.institutionInfo/institution/5154">
Bengal Engineering & Science University
</a> <br />
<strong>EPA Project Officer:</strong>
<a href="https://cfpub.epa.gov/ncer_abstracts/index.cfm/fuseaction/display.investigatorInfo/investigator/55"> Nolt-Helms, Cynthia </a>
<br />
<b>Phase:</b> I<br />
<b>Project Period:</b>
September 30, 2007 through
May 31, 2009
<br />
<b>Project Amount:</b>
$10,000
<br />
<b>RFA:</b>
P3 Awards: A National Student Design Competition for Sustainability Focusing on People, Prosperity and the Planet (2006)
<a href="https://cfpub.epa.gov/ncer_abstracts/index.cfm/fuseaction/display.rfatext/rfa_id/418">RFA Text</a> |
<a href="https://cfpub.epa.gov/ncer_abstracts/index.cfm/fuseaction/recipients.display/rfa_id/418">Recipients Lists</a>
<br />
<b>Research Category:</b>
<a href="https://cfpub.epa.gov/ncer_abstracts/index.cfm/fuseaction/display.researchCategory/rc_id/850">Nanotechnology</a>
,
<a href="https://cfpub.epa.gov/ncer_abstracts/index.cfm/fuseaction/display.researchCategory/rc_id/1091">P3 Challenge Area - Water</a>
,
<a href="https://cfpub.epa.gov/ncer_abstracts/index.cfm/fuseaction/display.researchCategory/rc_id/963">Pollution Prevention/Sustainable Development</a>
,
<a href="https://cfpub.epa.gov/ncer_abstracts/index.cfm/fuseaction/display.researchCategory/rc_id/1176">P3 Awards</a>
,
<a href="https://cfpub.epa.gov/ncer_abstracts/index.cfm/fuseaction/display.researchCategory/rc_id/1175">Sustainability</a>
<br />
<br>
<h3>Description:</h3>
<p>Due to the extensive amount and appalling degree of arsenic poisoning on the Indian subcontinent, there is a need to prevent future crises from occurring. With the advent of numerous arsenic selective sorbent media and other arsenic-removal technologies, the major environmental challenge lies not in removing dissolved arsenic from contaminated groundwater but in attaining safe, long-term disposal of arsenic-laden sludges. Safe disposal and containment of wastes would reduce the amount of toxic waste generated, prevent leaching of arsenic into soil and groundwater supplies, and allow for a more secure public. With arsenic becoming a contaminant of concern in the US due to a decreased maximum contaminant level, proper disposal and preclusion of leachability in landfills provides opportunity for profit.</p>
<p>Several research tasks will be performed to quantify current arsenic containment measures and to verify the capabilities of the proposed project towards arsenic disposal. Subsequent to laboratory analysis of arsenic-laden sludges and determination of ideal disposal conditions, a reactor and disposal site will be constructed in West Bengal, India. The results of the proposed research tasks will be evaluated according to standard methods for chemical analyses, such as USEPA TCLP, and will be demonstrated through decreased arsenic leaching from sludges and disposal sites.</p>
Finally the P3 concepts will be utilized as the M.S. project for the major co-investigator listed above; however, the project may also be employed as part of the Lehigh University undergraduate Capstone design project. Furthermore, certain students will be chosen from Bengal Engineering & Science University to complete work on this project.</p>
<p></p>
<h3>Publications and Presentations:</h3>
Publications have been submitted on this project: <a href="https://cfpub.epa.gov/ncer_abstracts/index.cfm/fuseaction/display.publications/abstract/8111">View all 3 publications for this project</a>
</p>
<h3>Journal Articles:</h3>
Journal Articles have been submitted on this project: <a href="https://cfpub.epa.gov/ncer_abstracts/index.cfm/fuseaction/display.journals/abstract/8111">View all 2 journal articles for this project</a>
</p>
<h3>Supplemental Keywords:</h3>
<i>adsorbent regeneration, arsenic, arsenic containment, Bangladesh, detoxification, groundwater protection, hazardous waste, heavy metals, India, leachate, particulates, pollution prevention, spent regenerant, sustainability toxics, waste minimization, waste reduction,</i>, RFA, Geographic Area, Water, POLLUTANTS/TOXICS, Sustainable Industry/Business, Sustainable Environment, Arsenic, Technology for Sustainable Environment, Water Pollutants, International, sustainable development, India, hazardous waste, arsenic removal, control technologies, pollution prevention, arsenic sequestration, sorbent, groundwater <p />
<P><h3>Relevant Websites:</h3>
<a href="https://cfpub.epa.gov/ncer_abstracts/index.cfm/fuseaction/display.abstractDetail/abstract/8646/report/0">Phase 2 Abstract</a>
<P><h3>Progress and Final Reports:</h3>
<a href="https://cfpub.epa.gov/ncer_abstracts/index.cfm/fuseaction/display.abstractDetail/abstract/8111/report/F">Final Report</a><br>
</P>
<h3>P3 Phase II:</h3>
<a href="https://cfpub.epa.gov/ncer_abstracts/index.cfm/fuseaction/display.abstractDetail/abstract/8646">Containment of Highly Concentrated Arsenic-laden Spent Regenerant on the Indian Subcontinent</a>
| <a href="https://cfpub.epa.gov/ncer_abstracts/index.cfm/fuseaction/display.abstractDetail/abstract/8646/report/2008">2008 Progress Report</a>
| <a href="https://cfpub.epa.gov/ncer_abstracts/index.cfm/fuseaction/display.abstractDetail/abstract/8646/report/F">Final Report</a>
<br>
</P> </div>
</div>
</div>
<div id="block-epa-og-footer" class="block block-epa-og">
<p class="pagetop"><a href="#content">Top of Page</a></p>
<!--googleoff: all-->
<p id="epa-og-footer"> The perspectives, information and conclusions conveyed in research project abstracts, progress reports, final reports, journal abstracts and journal publications convey the viewpoints of the principal investigator and may not represent the views and policies of ORD and EPA. Conclusions drawn by the principal investigators have not been reviewed by the Agency. </p>
</div>
<!--googleoff: all-->
</div>
</section>
<nav class="nav simple-nav simple-main-nav" role="navigation">
<div class="nav__inner">
<h2 class="element-invisible">Main menu</h2>
<ul class="menu" role="menu">
<li class="menu-item" id="menu-learn" role="presentation"><a href="https://www.epa.gov/environmental-topics" title="Learn about EPA's environmental topics to help protect the environment in your home, workplace, and community and EPA's research mission is to conduct leading-edge research and foster the sound use of science and technology." class="menu-link" role="menuitem">Environmental Topics</a></li>
<li class="menu-item" id="menu-lawsregs" role="presentation"><a href="https://www.epa.gov/laws-regulations" title="Laws written by Congress provide the authority for EPA to write regulations. Regulations explain the technical, operational, and legal details necessary to implement laws." class="menu-link" role="menuitem">Laws & Regulations</a></li>
<li class="menu-item" id="menu-about" role="presentation"><a href="https://www.epa.gov/aboutepa" title="Learn more about: our mission and what we do, how we are organized, and our history." class="menu-link" role="menuitem">About EPA</a></li>
</ul>
</div>
</nav>
<footer class="main-footer clearfix" role="contentinfo">
<div class="main-footer__inner">
<div class="region-footer">
<div class="block block-pane block-pane-epa-global-footer">
<div class="row cols-3">
<div class="col size-1of3">
<div class="col__title">Discover.</div>
<ul class="menu">
<li><a href="https://www.epa.gov/accessibility">Accessibility</a></li>
<li><a href="https://www.epa.gov/aboutepa/administrator-gina-mccarthy">EPA Administrator</a></li>
<li><a href="https://www.epa.gov/planandbudget">Budget & Performance</a></li>
<li><a href="https://www.epa.gov/contracts">Contracting</a></li>
<li><a href="https://www.epa.gov/home/grants-and-other-funding-opportunities">Grants</a></li>
<li><a href="https://www.epa.gov/ocr/whistleblower-protections-epa-and-how-they-relate-non-disclosure-agreements-signed-epa-employees">No FEAR Act Data</a></li>
<li><a href="https://www.epa.gov/home/privacy-and-security-notice">Privacy and Security</a></li>
</ul>
</div>
<div class="col size-1of3">
<div class="col__title">Connect.</div>
<ul class="menu">
<li><a href="https://www.data.gov/">Data.gov</a></li>
<li><a href="https://www.epa.gov/office-inspector-general/about-epas-office-inspector-general">Inspector General</a></li>
<li><a href="https://www.epa.gov/careers">Jobs</a></li>
<li><a href="https://www.epa.gov/newsroom">Newsroom</a></li>
<li><a href="https://www.whitehouse.gov/open">Open Government</a></li>
<li><a href="http://www.regulations.gov/">Regulations.gov</a></li>
<li><a href="https://www.epa.gov/newsroom/email-subscriptions">Subscribe</a></li>
<li><a href="https://www.usa.gov/">USA.gov</a></li>
<li><a href="https://www.whitehouse.gov/">White House</a></li>
</ul>
</div>
<div class="col size-1of3">
<div class="col__title">Ask.</div>
<ul class="menu">
<li><a href="https://www.epa.gov/home/forms/contact-us">Contact Us</a></li>
<li><a href="https://www.epa.gov/home/epa-hotlines">Hotlines</a></li>
<li><a href="https://www.epa.gov/foia">FOIA Requests</a></li>
<li><a href="https://www.epa.gov/home/frequent-questions-specific-epa-programstopics">Frequent Questions</a></li>
</ul>
<div class="col__title">Follow.</div>
<ul class="social-menu">
<li><a class="menu-link social-facebook" href="https://www.facebook.com/EPA">Facebook</a></li>
<li><a class="menu-link social-twitter" href="https://twitter.com/epa">Twitter</a></li>
<li><a class="menu-link social-youtube" href="https://www.youtube.com/user/USEPAgov">YouTube</a></li>
<li><a class="menu-link social-flickr" href="https://www.flickr.com/photos/usepagov">Flickr</a></li>
<li><a class="menu-link social-instagram" href="https://instagram.com/epagov">Instagram</a></li>
</ul>
<p class="last-updated">Last updated on Friday, September 29, 2006</p>
</div>
</div>
</div>
</div>
</div>
</footer>
<script src="https://www.epa.gov/sites/all/libraries/template2/jquery.js"></script>
<script src="https://www.epa.gov/sites/all/libraries/template/js.js"></script>
<script src="https://www.epa.gov/sites/all/modules/custom/epa_core/js/alert.js"></script>
<script src="https://www.epa.gov/sites/all/modules/contrib/jquery_update/replace/ui/ui/minified/jquery.ui.core.min.js"></script>
<script src="https://www.epa.gov/sites/all/modules/contrib/jquery_update/replace/ui/ui/minified/jquery.ui.widget.min.js"></script>
<script src="https://www.epa.gov/sites/all/modules/contrib/jquery_update/replace/ui/ui/minified/jquery.ui.position.min.js"></script>
<script src="https://www.epa.gov/sites/all/modules/contrib/jquery_update/replace/ui/ui/minified/jquery.ui.autocomplete.min.js"></script>
<!--[if lt IE 9]><script src="https://www.epa.gov/sites/all/themes/epa/js/ie.js"></script><![endif]-->
<!-- REMOVE if not using -->
<script language=javascript>
<!-- // Activate cloak
// pressing enter will not default submit the first defined button but the programmed defined button
function chkCDVal(cdVal)
{
var isErr = true;
try{
var CDParts = cdVal.split(',');
var st = CDParts[0];
var cd = CDParts[1];
var objRegExp = new RegExp('[0-9][0-9]');
if (!isNaN(st)) {
isErr = false;
}
if (!objRegExp.test(cd) || (cd.length>3)){
isErr = false;
}
}
catch(err){
isErr = false;
}
return isErr;
}
function checkCongDist(cdtxt)
{
//alert(cdtxt.value);
if (!chkCDVal(cdtxt.value)) {
alert('Congressional District MUST be in the following format: state, district; example: Virginia, 08');
return false;
}
else {
return true;
}
}
function fnTrapKD(btn, event)
{
var btn = getObject(btn);
if (document.all)
{
if (event.keyCode == 13)
{
event.returnValue=false;event.cancel = true;btn.click();
}
}
else
{
if (event.which == 13)
{
event.returnValue=false;event.cancelBubble = true;btn.click();
}
}
}
function CheckFilter()
{ if (document.searchform.presetTopic.options[document.searchform.presetTopic.selectedIndex].value == 'NA'){
alert('You must select a subtopic. \n This item is not selectable');
document.searchform.presetTopic.options[0].selected = true;
}
}
function openHelpWindow(url,title,scrollable)
{
var win = window.open(url,"title",'width=300,height=220,left=320,top=150,resizable=1,scrollbars='+scrollable+',menubar=no,status=no');
win.focus();
}
function openNewWindow(url,title,scrollable)
{
var win = window.open(url,"title",'width=300,height=220,left=320,top=150,resizable=1,scrollbars='+scrollable+',menubar=no,status=no');
}
function openNewWindow(url,title)
{
var win = window.open(url,"title",'width=300,height=220,left=320,top=150,resizable=1,scrollbars=no,menubar=no,status=no');
}
function openNewMapWindow(url,title)
{
var win = window.open(url,"title",'width=800,height=450,left=320,top=150,resizable=1,scrollbars=no,menubar=no,status=no');
}
function openNoticeWindow(url,title)
{
var win = window.open(url,"title",'width=300,height=150,left=500,top=150,resizable=1,scrollbars=no,menubar=no,status=no');
}
function openNewSearchWindow(site,subj)
{
title = 'window';
var win = window.open('https://cfpub.epa.gov/ncer_abstracts/index.cfm/fuseaction/display.pubsearch/site/' + site + '/redirect/' + subj,"title",'width=640,height=480,resizable=1,scrollbars=yes,menubar=yes,status=no');
}
function autoCheck(name)
{
document.forms['thisForm'].elements[name].checked = true;
}
function alertUser()
{
var ok = alert("This search might take longer than expected. Please refrain from hitting the refresh or reload button on your browser. The search results will appear after the search is complete. Thank you.");
}
function closePopupWindow(redirectUrl)
{
opener.location = redirectUrl;
opener.focus();
this.close();
}
//-->
</script>
</body>
</html> | {
"content_hash": "46d3a3b79b90b6afd994a9801dd240c0",
"timestamp": "",
"source": "github",
"line_count": 474,
"max_line_length": 836,
"avg_line_length": 56.48945147679325,
"alnum_prop": 0.62978040035853,
"repo_name": "1wheel/scraping",
"id": "ff094edafdbf12029407e6a1176bee5f90f1a52b",
"size": "26776",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "epa-grants/research/raw/08111.html",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "4406"
},
{
"name": "DIGITAL Command Language",
"bytes": "381196"
},
{
"name": "HTML",
"bytes": "2546703681"
},
{
"name": "JavaScript",
"bytes": "620077"
},
{
"name": "Jupyter Notebook",
"bytes": "14020"
}
],
"symlink_target": ""
} |
package controllers
import javax.inject.Inject
import models._
import play.api.i18n.{I18nSupport, MessagesApi}
import play.api.libs.concurrent.Execution.Implicits.defaultContext
import play.api.libs.json.Json
import play.api.mvc._
import services._
/** Renders a view with all the links a user has verified.
*
* TODO: finish the stump
*/
class Users @Inject() (
val userRepo: UserMongoRepo,
val messagesApi: MessagesApi
)
extends Controller with I18nSupport {
def stats(name: String) = Action.async {
userRepo.search("name", name) map {
case users: Traversable[User] if users.nonEmpty =>
Ok(Json.toJson(users.head))
case _ => NoContent
}
}
}
| {
"content_hash": "15b5e4d295ef79cde11aba21f0fd772e",
"timestamp": "",
"source": "github",
"line_count": 28,
"max_line_length": 66,
"avg_line_length": 26.964285714285715,
"alnum_prop": 0.6503311258278146,
"repo_name": "BonarBeavis/veritask",
"id": "49ff18b0217950756df72de4e58abc7f80406b97",
"size": "755",
"binary": false,
"copies": "1",
"ref": "refs/heads/develop",
"path": "app/controllers/Users.scala",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "HTML",
"bytes": "4929"
},
{
"name": "JavaScript",
"bytes": "6418"
},
{
"name": "Scala",
"bytes": "26532"
}
],
"symlink_target": ""
} |
> {%= description %}
## Install
{%= include("install-npm", {save: true}) %}
## Run tests
```bash
npm test
```
## Usage
```js
var assemblePush = require('{%= name %}');
```
## API
{%= comments("index.js") %}
## Contributing
Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue]({%= bugs.url %})
## Author
{%= include("author") %}
## License
{%= copyright() %}
{%= license() %}
***
{%= include("footer") %} | {
"content_hash": "4a6eafc00584750d644972956d9ea308",
"timestamp": "",
"source": "github",
"line_count": 33,
"max_line_length": 116,
"avg_line_length": 13.969696969696969,
"alnum_prop": 0.579175704989154,
"repo_name": "doowb/assemble-push",
"id": "eda2c616d0331f41009ee5d3e24c094f37819823",
"size": "497",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": ".verb.md",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "JavaScript",
"bytes": "3281"
}
],
"symlink_target": ""
} |
//
// SocializeTestCase.m
// SocializeSDK
//
// Created by Isaac Mosquera on 9/20/11.
// Copyright 2011 Socialize, Inc. All rights reserved.
//
#import "SZIntegrationTestCase.h"
#import <Socialize/Socialize.h>
#import <UIKit/UIKit.h>
#import <OCMock/ClassMockRegistry.h>
#import "StringHelper.h"
#import <BlocksKit/BlocksKit.h>
static NSString *UUIDString() {
CFUUIDRef uuidObj = CFUUIDCreate(nil);
NSString *uuidString = (NSString*)CFUUIDCreateString(nil, uuidObj);
CFRelease(uuidObj);
return [uuidString autorelease];
}
static NSString *SocializeAsyncTestCaseRunID = nil;
typedef void (^ActionBlock1)(void(^actionSuccess)(id), void(^actionFailure)(NSError*));
typedef void (^ActionBlock1B)(void(^actionSuccess)(BOOL), void(^actionFailure)(NSError*));
@implementation SZIntegrationTestCase
@synthesize socialize = socialize_;
@synthesize fetchedElements = fetchedElements_;
@synthesize createdObject = createdObject_;
@synthesize updatedObject = updatedObject_;
@synthesize deletedObject = deletedObject_;
- (void)dealloc {
self.socialize = nil;
self.fetchedElements = nil;
self.createdObject = nil;
self.updatedObject = nil;
self.deletedObject = nil;
[super dealloc];
}
- (void)handleException:(NSException *)exception {
[ClassMockRegistry stopMockingAllClasses];
}
+ (NSString*)runID {
if (SocializeAsyncTestCaseRunID == nil) {
NSString *uuid = UUIDString();
NSString *sha1 = [uuid sha1];
NSString *runID = [[sha1 substringToIndex:8] retain];
SocializeAsyncTestCaseRunID = runID;
}
return SocializeAsyncTestCaseRunID;
}
+ (void)resetRunID {
SocializeAsyncTestCaseRunID = nil;
}
+ (NSString*)testURL:(NSString*)suffix {
return [NSString stringWithFormat:@"http://itest.%@/%@", [self runID], suffix];
}
- (id)init
{
self = [super init];
if (self) {
// Initialization code here.
}
return self;
}
- (void)setUpClass {
[[self class] resetRunID];
}
- (id)callAsync1WithAction:(ActionBlock1)action {
__block id outerResult = nil;
[self prepare];
action(^(id result) {
outerResult = [result retain];
[self notify:kGHUnitWaitStatusSuccess];
}, ^(NSError *error) {
NSLog(@"Async call failed with error: %@", error);
[self notify:kGHUnitWaitStatusFailure];
});
[self waitForStatus:kGHUnitWaitStatusSuccess timeout:20];
return [outerResult autorelease];
}
- (BOOL)callAsync1BWithAction:(ActionBlock1B)action {
__block BOOL outerResult;
[self prepare];
action(^(BOOL result) {
outerResult = result;
[self notify:kGHUnitWaitStatusSuccess];
}, ^(NSError *error) {
[self notify:kGHUnitWaitStatusFailure];
});
[self waitForStatus:kGHUnitWaitStatusSuccess timeout:10];
return outerResult;
}
- (void)authenticateAnonymously {
[self prepare];
[self.socialize authenticateAnonymously];
[self waitForStatus:kGHUnitWaitStatusSuccess];
}
- (void)authenticateAnonymouslyIfNeeded {
if (![self.socialize isAuthenticated]) {
[self authenticateAnonymously];
}
}
- (Socialize*)socialize {
if (socialize_ == nil) {
socialize_ = [[Socialize alloc] initWithDelegate:self];
}
return socialize_;
}
- (void)setUp {
[self authenticateAnonymouslyIfNeeded];
}
- (void)tearDown {
}
- (NSString*)runID {
return [[self class] runID];
}
- (NSString*)testURL:(NSString*)suffix {
return [[self class] testURL:suffix];
}
- (void)waitForStatus:(NSInteger)status {
[self waitForStatus:status timeout:10.0];
}
- (void)createEntity:(id<SocializeEntity>)entity {
[self prepare];
[self.socialize createEntity:entity];
[self waitForStatus:kGHUnitWaitStatusSuccess];
}
- (void)createEntityWithURL:(NSString*)url name:(NSString*)name {
[self prepare];
[self.socialize createEntityWithKey:url name:name];
[self waitForStatus:kGHUnitWaitStatusSuccess];
}
- (void)createComments:(NSArray*)comments {
[self prepare];
SZAuthWrapper(^{
[self.socialize createComments:comments];
}, ^(NSError *error) {
[self notify:kGHUnitWaitStatusFailure];
});
[self waitForStatus:kGHUnitWaitStatusSuccess];
}
- (void)createComment:(id<SocializeComment>)comment {
[self createComments:[NSArray arrayWithObject:comment]];
}
- (id<SZComment>)addCommentWithEntity:(id<SZEntity>)entity text:(NSString*)text options:(SZCommentOptions*)options networks:(SZSocialNetwork)networks {
__block id<SZComment> createdComment = nil;
[self prepare];
[SZCommentUtils addCommentWithEntity:entity text:text options:nil networks:SZSocialNetworkNone success:^(id<SZComment> comment) {
createdComment = [comment retain];
[self notify:kGHUnitWaitStatusSuccess];
} failure:^(NSError *error) {
[self notify:kGHUnitWaitStatusFailure];
}];
[self waitForStatus:kGHUnitWaitStatusSuccess timeout:10];
return [createdComment autorelease];
}
- (id<SZComment>)getCommentWithId:(NSNumber*)commentId {
__block id<SZComment> fetchedComment = nil;
[self prepare];
[SZCommentUtils getCommentWithId:commentId success:^(id<SZComment> comment) {
fetchedComment = [comment retain];
[self notify:kGHUnitWaitStatusSuccess];
} failure:^(NSError *error) {
[self notify:kGHUnitWaitStatusFailure];
}];
[self waitForStatus:kGHUnitWaitStatusSuccess timeout:10];
return [fetchedComment autorelease];
}
- (NSArray*)utilGetCommentsForEntityWithKey:(NSString*)entityKey {
__block NSArray *fetchedComments = nil;
[self prepare];
id<SZEntity> entity = [SZEntity entityWithKey:entityKey];
[SZCommentUtils getCommentsByEntity:entity success:^(NSArray *comments) {
fetchedComments = [comments retain];
[self notify:kGHUnitWaitStatusSuccess];
} failure:^(NSError *error) {
[self notify:kGHUnitWaitStatusFailure];
}];
[self waitForStatus:kGHUnitWaitStatusSuccess timeout:10];
return [fetchedComments autorelease];
}
- (NSArray*)getCommentsByUser:(id<SZUser>)user {
__block NSArray *fetchedComments = nil;
[self prepare];
[SZCommentUtils getCommentsByUser:user first:nil last:nil success:^(NSArray *comments) {
fetchedComments = [comments retain];
[self notify:kGHUnitWaitStatusSuccess];
} failure:^(NSError *error) {
[self notify:kGHUnitWaitStatusFailure];
}];
[self waitForStatus:kGHUnitWaitStatusSuccess timeout:10];
return [fetchedComments autorelease];
}
- (NSArray*)getCommentsByUser:(id<SZUser>)user entity:(id<SZEntity>)entity {
__block NSArray *fetchedComments = nil;
[self prepare];
[SZCommentUtils getCommentsByUser:user entity:entity first:nil last:nil success:^(NSArray *comments) {
fetchedComments = [comments retain];
[self notify:kGHUnitWaitStatusSuccess];
} failure:^(NSError *error) {
[self notify:kGHUnitWaitStatusFailure];
}];
[self waitForStatus:kGHUnitWaitStatusSuccess timeout:10];
return [fetchedComments autorelease];
}
- (NSArray*)getCommentsByApplication {
return [self callAsync1WithAction:^(void(^actionSuccess)(id), void(^actionFailure)(NSError*)) {
[SZCommentUtils getCommentsByApplicationWithFirst:nil last:nil success:actionSuccess failure:actionFailure];
}];
}
- (id<SZLike>)likeWithEntity:(id<SZEntity>)entity options:(SZLikeOptions*)options networks:(SZSocialNetwork)networks {
__block id<SZLike> fetchedLike = nil;
[self prepare];
[SZLikeUtils likeWithEntity:entity options:options networks:networks success:^(id<SZLike> like) {
fetchedLike = [like retain];
[self notify:kGHUnitWaitStatusSuccess];
} failure:^(NSError *error) {
[self notify:kGHUnitWaitStatusFailure];
}];
[self waitForStatus:kGHUnitWaitStatusSuccess timeout:10];
return [fetchedLike autorelease];
}
- (id<SZLike>)unlike:(id<SZEntity>)entity {
__block id<SZLike> fetchedLike = nil;
[self prepare];
[SZLikeUtils unlike:entity success:^(id<SZLike> like) {
fetchedLike = [like retain];
[self notify:kGHUnitWaitStatusSuccess];
} failure:^(NSError *error) {
[self notify:kGHUnitWaitStatusFailure];
}];
[self waitForStatus:kGHUnitWaitStatusSuccess timeout:10];
return [fetchedLike autorelease];
}
- (BOOL)isLiked:(id<SZEntity>)entity {
return [self callAsync1BWithAction:^(void(^actionSuccess)(BOOL), void(^actionFailure)(NSError*)) {
[SZLikeUtils isLiked:entity success:actionSuccess failure:actionFailure];
}];
}
- (id<SZLike>)getLike:(id<SZEntity>)entity {
__block id<SZLike> fetchedLike = nil;
[self prepare];
[SZLikeUtils getLike:entity success:^(id<SZLike> like) {
fetchedLike = [like retain];
[self notify:kGHUnitWaitStatusSuccess];
} failure:^(NSError *error) {
[self notify:kGHUnitWaitStatusFailure];
}];
[self waitForStatus:kGHUnitWaitStatusSuccess timeout:10];
return [fetchedLike autorelease];
}
- (NSArray*)getLikesForUser:(id<SZUser>)user {
__block NSArray *fetchedLikes = nil;
[self prepare];
[SZLikeUtils getLikesForUser:user start:nil end:nil success:^(NSArray *likes) {
fetchedLikes = [likes retain];
[self notify:kGHUnitWaitStatusSuccess];
} failure:^(NSError *error) {
[self notify:kGHUnitWaitStatusFailure];
}];
[self waitForStatus:kGHUnitWaitStatusSuccess timeout:10];
return [fetchedLikes autorelease];
}
- (NSArray*)getLikesByApplication {
return [self callAsync1WithAction:^(void(^actionSuccess)(id), void(^actionFailure)(NSError*)) {
[SZLikeUtils getLikesByApplicationWithFirst:nil last:nil success:actionSuccess failure:actionFailure];
}];
}
- (NSArray*)getSharesByApplication {
return [self callAsync1WithAction:^(void(^actionSuccess)(id), void(^actionFailure)(NSError*)) {
[SZShareUtils getSharesByApplicationWithFirst:nil last:nil success:actionSuccess failure:actionFailure];
}];
}
- (id<SZLike>)getLikeForUser:(id<SZUser>)user entity:(id<SZEntity>)entity {
__block id<SZLike> fetchedLike = nil;
[self prepare];
[SZLikeUtils getLikeForUser:user entity:entity success:^(id<SZLike> like) {
fetchedLike = [like retain];
[self notify:kGHUnitWaitStatusSuccess];
} failure:^(NSError *error) {
[self notify:kGHUnitWaitStatusFailure];
}];
[self waitForStatus:kGHUnitWaitStatusSuccess timeout:10];
return [fetchedLike autorelease];
}
- (NSArray*)getActionsForApplication {
return [self callAsync1WithAction:^(void(^actionSuccess)(id), void(^actionFailure)(NSError*)) {
[SZActionUtils getActionsByApplicationWithStart:nil end:nil success:actionSuccess failure:actionFailure];
}];
}
- (NSArray*)getActionsForUser:(id<SZUser>)user {
return [self callAsync1WithAction:^(void(^actionSuccess)(id), void(^actionFailure)(NSError*)) {
[SZActionUtils getActionsByUser:user start:nil end:nil success:actionSuccess failure:actionFailure];
}];
}
- (NSArray*)getActionsByEntity:(id<SZEntity>)entity {
return [self callAsync1WithAction:^(void(^actionSuccess)(id), void(^actionFailure)(NSError*)) {
[SZActionUtils getActionsByEntity:entity start:nil end:nil success:actionSuccess failure:actionFailure];
}];
}
- (NSArray*)getActionsForUser:(id<SZUser>)user entity:(id<SZEntity>)entity {
return [self callAsync1WithAction:^(void(^actionSuccess)(id), void(^actionFailure)(NSError*)) {
[SZActionUtils getActionsByUser:user entity:entity start:nil end:nil success:actionSuccess failure:actionFailure];
}];
}
- (id<SZEntity>)getEntityWithKey:(NSString*)entityKey {
return [self callAsync1WithAction:^(void(^actionSuccess)(id), void(^actionFailure)(NSError*)) {
[SZEntityUtils getEntityWithKey:entityKey success:actionSuccess failure:actionFailure];
}];
}
- (NSArray*)getEntitiesWithSorting:(SZResultSorting)sorting {
return [self callAsync1WithAction:^(void(^actionSuccess)(id), void(^actionFailure)(NSError*)) {
[SZEntityUtils getEntitiesWithSorting:sorting first:nil last:[NSNumber numberWithInteger:20] success:actionSuccess failure:actionFailure];
}];
}
- (NSArray*)getEntities {
return [self getEntitiesWithSorting:SZResultSortingDefault];
}
- (NSArray*)getEntitiesWithIds:(NSArray*)ids {
return [self callAsync1WithAction:^(void(^actionSuccess)(id), void(^actionFailure)(NSError*)) {
[SZEntityUtils getEntitiesWithIds:ids success:actionSuccess failure:actionFailure];
}];
}
- (id<SZEntity>)addEntity:(id<SZEntity>)entity {
return [self callAsync1WithAction:^(void(^actionSuccess)(id), void(^actionFailure)(NSError*)) {
[SZEntityUtils addEntity:entity success:actionSuccess failure:actionFailure];
}];
}
- (id<SZView>)viewEntity:(id<SZEntity>)entity {
return [self callAsync1WithAction:^(void(^actionSuccess)(id), void(^actionFailure)(NSError*)) {
[SZViewUtils viewEntity:entity success:actionSuccess failure:actionFailure];
}];
}
- (id<SZSubscription>)subscribeToEntity:(id<SZEntity>)entity subscriptionType:(SZSubscriptionType)subscriptionType {
return [self callAsync1WithAction:^(void(^actionSuccess)(id), void(^actionFailure)(NSError*)) {
[SZSubscriptionUtils subscribeToEntity:entity subscriptionType:subscriptionType success:actionSuccess failure:actionFailure];
}];
}
- (id<SZSubscription>)unsubscribeFromEntity:(id<SZEntity>)entity subscriptionType:(SZSubscriptionType)subscriptionType {
return [self callAsync1WithAction:^(void(^actionSuccess)(id), void(^actionFailure)(NSError*)) {
[SZSubscriptionUtils unsubscribeFromEntity:entity subscriptionType:subscriptionType success:actionSuccess failure:actionFailure];
}];
}
- (NSArray*)getSubscriptionsForEntity:(id<SZEntity>)entity {
return [self callAsync1WithAction:^(void(^actionSuccess)(id), void(^actionFailure)(NSError*)) {
[SZSubscriptionUtils getSubscriptionsForEntity:entity subscriptionType:SZSubscriptionTypeNewComments start:nil end:nil success:actionSuccess failure:actionFailure];
}];
}
- (BOOL)isSubscribedToEntity:(id<SZEntity>)entity subscriptionType:(SZSubscriptionType)subscriptionType {
return [self callAsync1BWithAction:^(void(^actionSuccess)(BOOL), void(^actionFailure)(NSError*)) {
[SZSubscriptionUtils isSubscribedToEntity:entity subscriptionType:subscriptionType success:actionSuccess failure:actionFailure];
}];
}
- (id<SZObject>)findObjectWithId:(int)objectID inArray:(NSArray*)array {
return [array bk_match:^BOOL (id<SZObject> object) {
return [object objectID] == objectID;
}];
}
- (void)assertObject:(id<SZObject>)object inCollection:(id)collection {
id<SZObject> foundObject = (id<SZObject>)[self findObjectWithId:[object objectID] inArray:collection];
GHAssertNotNil(foundObject, @"Should have object with id %d", [object objectID]);
}
- (void)getEntityWithURL:(NSString*)url {
[self prepare];
[self.socialize getEntityByKey:url];
[self waitForStatus:kGHUnitWaitStatusSuccess];
}
- (void)createCommentWithURL:(NSString*)url text:(NSString*)text latitude:(NSNumber*)latitude longitude:(NSNumber*)longitude subscribe:(BOOL)subscribe {
[self prepare];
[self.socialize createCommentForEntityWithKey:url comment:text longitude:longitude latitude:latitude];
[self waitForStatus:kGHUnitWaitStatusSuccess];
NSLog(@"Created %@", url);
}
- (void)createCommentWithEntity:(id<SocializeEntity>)entity text:(NSString*)text latitude:(NSNumber*)latitude longitude:(NSNumber*)longitude subscribe:(BOOL)subscribe {
[self prepare];
[self.socialize createCommentForEntity:entity comment:text longitude:longitude latitude:latitude];
[self waitForStatus:kGHUnitWaitStatusSuccess];
NSLog(@"Created %@ (%@)", entity.key, entity.name);
}
- (void)getCommentsForEntityWithKey:(NSString*)entityKey {
[self prepare];
[self.socialize getCommentList:entityKey first:nil last:nil];
[self waitForStatus:kGHUnitWaitStatusSuccess];
NSLog(@"Fetched %d comments", [self.fetchedElements count]);
}
- (void)createShareWithURL:(NSString*)url medium:(SocializeShareMedium)medium text:(NSString*)text {
[self prepare];
[self.socialize createShareForEntityWithKey:url medium:medium text:text];
[self waitForStatus:kGHUnitWaitStatusSuccess];
NSLog(@"Created %@", url);
}
- (void)createShare:(id<SocializeShare>)share {
[self prepare];
[self.socialize createShare:share];
[self waitForStatus:kGHUnitWaitStatusSuccess];
}
- (void)createShare:(id<SocializeShare>)share
loopySuccess:(void(^)(AFHTTPRequestOperation *, id))loopySuccess
loopyFailure:(void(^)(AFHTTPRequestOperation *, NSError *))loopyFailure {
[self.socialize createShare:share success:nil failure:nil loopySuccess:loopySuccess loopyFailure:loopyFailure];
}
- (void)createShare:(id<SocializeShare>)share
success:(void(^)(id<SZShare> share))success
failure:(void(^)(NSError *error))failure
loopySuccess:(void(^)(AFHTTPRequestOperation *, id))loopySuccess
loopyFailure:(void(^)(AFHTTPRequestOperation *, NSError *))loopyFailure {
[self.socialize createShare:share success:success failure:failure loopySuccess:loopySuccess loopyFailure:loopyFailure];
}
- (void)createLikeWithURL:(NSString*)url latitude:(NSNumber*)latitude longitude:(NSNumber*)longitude {
[self prepare];
[self.socialize likeEntityWithKey:url longitude:longitude latitude:latitude];
[self waitForStatus:kGHUnitWaitStatusSuccess];
NSLog(@"Created %@", url);
}
- (void)createLike:(id<SocializeLike>)like {
[self prepare];
[self.socialize createLike:like];
[self waitForStatus:kGHUnitWaitStatusSuccess];
NSLog(@"Created %@", like.entity.key);
}
- (void)createViewWithURL:(NSString*)url latitude:(NSNumber*)latitude longitude:(NSNumber*)longitude {
[self prepare];
[self.socialize viewEntityWithKey:url longitude:longitude latitude:latitude];
[self waitForStatus:kGHUnitWaitStatusSuccess];
NSLog(@"Created %@", url);
}
- (void)getLikesForURL:(NSString*)url {
[self prepare];
[self.socialize getLikesForEntityKey:url first:nil last:nil];
[self waitForStatus:kGHUnitWaitStatusSuccess];
}
- (void)deleteLike:(id<SocializeLike>)like {
[self prepare];
[self.socialize unlikeEntity:like];
[self waitForStatus:kGHUnitWaitStatusSuccess];
}
/*
- (void)getViewsForURL:(NSString*)url {
[self prepare];
[self.socialize getViewsForEntityKey:url first:nil last:nil];
[self waitForStatus:kGHUnitWaitStatusSuccess];
}
*/
- (void)getActivityForApplication {
[self prepare];
[self.socialize getActivityOfCurrentApplicationWithFirst:[NSNumber numberWithInt:0] last:[NSNumber numberWithInt:10]];
[self waitForStatus:kGHUnitWaitStatusSuccess];
}
- (void)getActivityForCurrentUser {
[self prepare];
[self.socialize getActivityOfUser:[self.socialize authenticatedUser]];
[self waitForStatus:kGHUnitWaitStatusSuccess];
}
- (void)getLikesForCurrentUserWithEntity:(id<SocializeEntity>)entity {
[self prepare];
[self.socialize getLikesForUser:[self.socialize authenticatedUser] entity:entity first:nil last:nil];
[self waitForStatus:kGHUnitWaitStatusSuccess];
}
- (void)getSubscriptionsForEntityKey:(NSString*)entityKey {
[self prepare];
[self.socialize getSubscriptionsForEntityKey:entityKey first:nil last:nil];
[self waitForStatus:kGHUnitWaitStatusSuccess];
}
- (void)subscribeToCommentsOnEntity:(id<SocializeEntity>)entity {
[self prepare];
[self.socialize subscribeToCommentsForEntityKey:entity.key];
[self waitForStatus:kGHUnitWaitStatusSuccess];
}
// Wait for notify
- (void)service:(SocializeService *)request didFail:(NSError *)error {
NSLog(@"Error happened: %@", [error description]);
[self notify:kGHUnitWaitStatusFailure];
}
- (void)service:(SocializeService *)service didUpdate:(id<SocializeObject>)object {
self.updatedObject = object;
[self notify:kGHUnitWaitStatusSuccess];
}
- (void)service:(SocializeService *)service didCreate:(id<SocializeObject>)object {
self.createdObject = object;
[self notify:kGHUnitWaitStatusSuccess];
}
- (void)service:(SocializeService *)service didFetchElements:(NSArray *)dataArray {
self.fetchedElements = dataArray;
[self notify:kGHUnitWaitStatusSuccess];
}
- (void)service:(SocializeService *)service didDelete:(id<SocializeObject>)object {
self.deletedObject = object;
[self notify:kGHUnitWaitStatusSuccess];
}
- (void)didAuthenticate:(id<SocializeUser>)user {
[self notify:kGHUnitWaitStatusSuccess];
}
- (void)fakeCurrentUserWithThirdParties:(NSArray*)thirdParties {
NSUserDefaults *userDefaults = [NSUserDefaults standardUserDefaults];
NSDictionary *fakeUser = [NSDictionary dictionaryWithObjectsAndKeys:
thirdParties, @"third_party_auth",
[NSNumber numberWithInteger:123], @"id",
nil];
NSData *data = [NSKeyedArchiver archivedDataWithRootObject:fakeUser];
[userDefaults setObject:data forKey:@"SOCIALIZE_AUTHENTICATED_USER_KEY"];
[userDefaults synchronize];
}
- (void)fakeCurrentUserAnonymous {
[self fakeCurrentUserWithThirdParties:[NSArray array]];
}
- (void)fakeCurrentUserNotAuthed {
[[Socialize sharedSocialize] removeAuthenticationInfo];
}
@end
| {
"content_hash": "79ed975feefd5de7e4d4b61dfe0edc42",
"timestamp": "",
"source": "github",
"line_count": 607,
"max_line_length": 172,
"avg_line_length": 35.47940691927512,
"alnum_prop": 0.7189821693907875,
"repo_name": "dontfallisleep/socialize-sdk-ios",
"id": "b50128f45c4a87c1f9731c7c876abe5d411827ee",
"size": "21536",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "IntegrationTests/SZIntegrationTestCase.m",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "AppleScript",
"bytes": "248"
},
{
"name": "C",
"bytes": "9495"
},
{
"name": "Groff",
"bytes": "65678"
},
{
"name": "HTML",
"bytes": "1155"
},
{
"name": "Makefile",
"bytes": "10221"
},
{
"name": "Objective-C",
"bytes": "1869348"
},
{
"name": "Perl",
"bytes": "377988"
},
{
"name": "Python",
"bytes": "2952"
},
{
"name": "Ruby",
"bytes": "2922"
},
{
"name": "Shell",
"bytes": "19138"
}
],
"symlink_target": ""
} |
require "ardb/cli/clirb"
require "ardb/cli/commands"
require "ardb/version"
module Ardb
class CLI
COMMANDS =
CommandSet.new{ |unknown|
InvalidCommand.new(unknown)
}.tap do |c|
c.add(ConnectCommand)
c.add(CreateCommand)
c.add(DropCommand)
c.add(GenerateMigrationCommand)
c.add(MigrateCommand)
c.add(MigrateUpCommand)
c.add(MigrateDownCommand)
c.add(MigrateForwardCommand)
c.add(MigrateBackwardCommand)
end
def self.run(args)
new.run(args)
end
def initialize(kernel = nil, stdout = nil, stderr = nil)
@kernel = kernel || Kernel
@stdout = stdout || $stdout
@stderr = stderr || $stderr
end
def run(args)
begin
$LOAD_PATH.push(Dir.pwd) unless $LOAD_PATH.include?(Dir.pwd)
cmd_name = args.shift
cmd = COMMANDS[cmd_name]
cmd.run(args)
rescue CLIRB::HelpExit
@stdout.puts cmd.command_help
rescue CLIRB::VersionExit
@stdout.puts Ardb::VERSION
rescue CLIRB::Error, ArgumentError, InvalidCommandError => ex
display_debug(ex)
@stderr.puts "#{ex.message}\n\n"
@stdout.puts cmd.command_help
@kernel.exit 1
rescue CommandExitError
@kernel.exit 1
rescue => ex
@stderr.puts "#{ex.class}: #{ex.message}"
@stderr.puts ex.backtrace.join("\n")
@kernel.exit 1
end
@kernel.exit 0
end
private
def display_debug(exception)
if ENV["DEBUG"]
@stderr.puts "#{exception.class}: #{exception.message}"
@stderr.puts exception.backtrace.join("\n")
end
end
end
end
| {
"content_hash": "387e2ca26371ab01e3b80eef3f6d150d",
"timestamp": "",
"source": "github",
"line_count": 67,
"max_line_length": 68,
"avg_line_length": 25.238805970149254,
"alnum_prop": 0.5960969840331165,
"repo_name": "redding/ardb",
"id": "f53709bb756fde40254c07c51450b4cba60aba1d",
"size": "1722",
"binary": false,
"copies": "1",
"ref": "refs/heads/main",
"path": "lib/ardb/cli.rb",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Ruby",
"bytes": "153138"
}
],
"symlink_target": ""
} |
/* Define All Require Modules */
var express = require('express');
var router = express.Router();
var passport = require('passport');
var LocalStrategy = require('passport-local').Strategy;
var User = require('../models/user');
var bcrypt = require('bcryptjs');
/* GET users register. */
router.get('/register', function(req, res, next) {
res.render('register');
});
/* GET users login. */
router.get('/login', function(req, res, next) {
res.render('login',{success_msg : res.locals.success_msg, error_msg : res.locals.error_msg,error : res.locals.error});
});
/* GET users Profile. */
router.get('/index', function(req, res, next) {
res.render('index',{success_msg : res.locals.success_msg, error_msg : res.locals.error_msg,error : res.locals.error , data:req.user});
});
/* POST Register Data. */
router.post('/register', function(req, res, next) {
//get all the variables from the request post
var name = req.body.name;
var email = req.body.email;
var username = req.body.username;
var password = req.body.password;
// Validation
req.checkBody('name', 'Name is required').notEmpty();
req.checkBody('email', 'Email is required').notEmpty();
req.checkBody('email', 'Email is not valid').isEmail();
req.checkBody('username', 'Username is required').notEmpty();
req.checkBody('password', 'Password is required').notEmpty();
req.checkBody('password2', 'Passwords do not match').equals(req.body.password);
var errors = req.validationErrors();
if(errors){
res.render('register',{
errors:errors
});
} else {
User.getUserByUsername(username, function(err, user){
if(err) throw err;
if(!user){
//Create new object for new User
var newUser = new User({
name: name,
email:email,
username: username,
password: password
});
User.createUser(newUser,function(err,user){
if(err) throw err;
});
req.flash('success_msg', 'You are registered and can now login');
res.redirect('/users/login');
} else {
res.render('register',{
error_msg:[ {msg: 'User Already Exists'} ],
});
}
});
}
});
/* POST Profile Data For Upadte Data. */
router.post('/save', function(req, res, next) {
//get all the variables from the request post
var name = req.body.name;
var email = req.body.email;
var username = req.body.username;
var password = req.body.password;
var iddata= req.session.passport.user;
// Validation
req.checkBody('name', 'Name is required').notEmpty();
req.checkBody('email', 'Email is required').notEmpty();
req.checkBody('email', 'Email is not valid').isEmail();
req.checkBody('username', 'Username is required').notEmpty();
req.checkBody('password', 'Password is required').notEmpty();
var errors = req.validationErrors();
if(errors){
res.render('register',{
errors:errors
});
} else {
var UserData = {
name: name,
email:email,
username: username,
password: password,
iddata:iddata
};
User.UpdateUser(UserData,function(err,user){
if(err) throw err;
});
req.flash('success_msg', 'Update Profile Data Successfully.');
res.redirect('/users/login');
}
});
/* User Passport for Compare Password */
passport.use(new LocalStrategy(
function(username, password, done) {
User.getUserByUsername(username, function(err, user){
if(err) throw err;
if(!user){
return done(null, false, {message: 'Unknown User'});
}
User.comparePassword(password, user.password, function(err, isMatch){
if(err) throw err;
if(isMatch){
return done(null, user);
} else {
return done(null, false, {message: 'Invalid password'});
}
});
});
}));
/* Serialize User with using passport */
passport.serializeUser(function(user, done) {
done(null, user.id);
});
/* Deserialize User with using passport */
passport.deserializeUser(function(id, done) {
User.getUserById(id, function(err, user) {
done(err, user);
});
});
/* Post Data After Login */
router.post('/login',
passport.authenticate('local',{successRedirect:'/users/index',failureRedirect:'/users/login',failureFlash:true}),
function(req, res) {
// If this function gets called, authentication was successful.
// `req.user` contains the authenticated user.
res.redirect('/');
});
/* User Logout */
router.get('/logout',function(req,res){
req.logout();
req.flash('success_msg' , 'You are logged out');
res.redirect('/users/login');
});
module.exports = router;
| {
"content_hash": "959ec7636437a5f30b18b5ca2b3e1dff",
"timestamp": "",
"source": "github",
"line_count": 176,
"max_line_length": 138,
"avg_line_length": 31.176136363636363,
"alnum_prop": 0.5381811554583561,
"repo_name": "1986webdeveloper/Code-Examples",
"id": "eef7e9f3f9ce76ffb64c09be95ad080c466fa6f3",
"size": "5487",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "Reactjs/user-signup-login/routes/users.js",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "CSS",
"bytes": "43695"
},
{
"name": "HTML",
"bytes": "39130"
},
{
"name": "JavaScript",
"bytes": "126262"
},
{
"name": "PHP",
"bytes": "240222"
}
],
"symlink_target": ""
} |
=pod
=head1 NAME
Bio::EnsEMBL::Hive::PipelineWideParameters
=head1 DESCRIPTION
A class-container for cached pipeline-wide parameters
=head1 LICENSE
Copyright [1999-2015] Wellcome Trust Sanger Institute and the EMBL-European Bioinformatics Institute
Copyright [2016-2022] EMBL-European Bioinformatics Institute
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License
is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and limitations under the License.
=head1 CONTACT
Please subscribe to the Hive mailing list: http://listserver.ebi.ac.uk/mailman/listinfo/ehive-users to discuss Hive-related questions or to be notified of our updates
=cut
package Bio::EnsEMBL::Hive::PipelineWideParameters;
use strict;
use warnings;
use base ( 'Bio::EnsEMBL::Hive::Cacheable' );
sub unikey { # override the default from Cacheable parent
return [ 'param_name' ];
}
1;
| {
"content_hash": "655e6d2880aa90e5c60ee70e12835615",
"timestamp": "",
"source": "github",
"line_count": 46,
"max_line_length": 172,
"avg_line_length": 28.434782608695652,
"alnum_prop": 0.7507645259938838,
"repo_name": "Ensembl/ensembl-hive",
"id": "55be821ed65214b35864a3a9bc665319937de604",
"size": "1308",
"binary": false,
"copies": "1",
"ref": "refs/heads/version/2.6",
"path": "modules/Bio/EnsEMBL/Hive/PipelineWideParameters.pm",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Dockerfile",
"bytes": "2880"
},
{
"name": "Java",
"bytes": "51805"
},
{
"name": "PLpgSQL",
"bytes": "177217"
},
{
"name": "Perl",
"bytes": "1603791"
},
{
"name": "Python",
"bytes": "61905"
},
{
"name": "Shell",
"bytes": "39473"
}
],
"symlink_target": ""
} |
package com.linecorp.armeria.internal.metric;
import static com.google.common.base.Preconditions.checkArgument;
import static com.google.common.collect.ImmutableList.toImmutableList;
import static java.util.Objects.requireNonNull;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.WeakHashMap;
import java.util.function.Function;
import java.util.regex.Pattern;
import com.google.common.annotations.VisibleForTesting;
import io.prometheus.client.Collector;
import io.prometheus.client.Collector.MetricFamilySamples;
import io.prometheus.client.CollectorRegistry;
/**
* Allows reusing an existing {@link Collector} instead of raising an exception when the {@link Collector}
* being registered has the same metric family name.
*/
final class PrometheusUtil {
private static final Pattern METRIC_NAME_PATTERN = Pattern.compile("[a-zA-Z_:][a-zA-Z0-9_:]*");
@VisibleForTesting
static final Map<CollectorRegistry, Map<String, Collector>> collectors = new WeakHashMap<>();
/**
* Registers a {@link Collector} if not registered already.
* Unlike {@link CollectorRegistry#register(Collector)} which throws an exception when there's a
* {@link Collector} registered with the same metric family name, this method returns the existing
* {@link Collector}, only if it was registered via this method.
*
* @param collectorRegistry the {@link CollectorRegistry} to register a {@link Collector} to
* @param name the name of the {@link MetricFamilySamples} produced by the {@link Collector}
* being registered
* @param collectorFactory the {@link Function} that creates a {@link Collector} if there is no
* {@link Collector} bound to the specified {@code name} yet
* @param <T> type of {@link Collector}
* @return existing or newly created {@link Collector}
* @throws IllegalArgumentException if one of the following conditions meet:
* <ul><li>A {@link Collector} with the same metric family name was registered to the
* {@code collectorRegistry} without going through this method. e.g. <pre>{@code
* CollectorRegistry registry = new CollectorRegistry();
* // Register without going through the wrapper.
* registry.register(Counter.build("foo", "counting the number of foos"));
* // Will fail with an IllegalArgumentException.
* registerIfAbsent(registry, "foo", name -> Counter.build(name, "counting the number of foos"));
* }</pre></li>
* <li>One of the samples produced by an existing {@link Collector} has the same name. e.g. <pre>{@code
* registerIfAbsent(registry, "foo", name -> Summary.build("foo", "the summary of foos"));
* // Will fail because the summary above will register "foo_count".
* registryIfAbsent(registry, "foo_count", name -> Counter.build(name, "counting the number of foos"));
* }</pre></li></ul>
*/
static synchronized <T extends Collector> T registerIfAbsent(
CollectorRegistry collectorRegistry, String name, Function<String, T> collectorFactory) {
requireNonNull(collectorRegistry, "collectorRegistry");
requireNonNull(name, "name");
requireNonNull(collectorFactory, "collectorFactory");
checkArgument(METRIC_NAME_PATTERN.matcher(name).matches(),
"name: %s (expected: matches %s)", name, METRIC_NAME_PATTERN);
final Map<String, Collector> map =
collectors.computeIfAbsent(collectorRegistry, unused -> new HashMap<>());
Collector collector = map.get(name);
if (collector == null) {
// Create a new Collector using the given factory.
collector = collectorFactory.apply(name);
requireNonNull(collector, "collectorFactory returned null.");
// Get the metric family names of the collector and ensure the collector produced the metric family
// with the specified name.
final List<MetricFamilySamples> mfsList = describe(collector);
final List<String> actualNames = mfsList.stream()
.filter(Objects::nonNull)
.map(mfs -> mfs.name)
.filter(Objects::nonNull)
.collect(toImmutableList());
if (!actualNames.contains(name)) {
throw new IllegalArgumentException(
"collectorFactory did not return a Collector that produces a metric family " +
"whose name is '" + name + "'.");
}
collectorRegistry.register(collector);
for (String n : actualNames) {
map.put(n, collector);
}
}
@SuppressWarnings("unchecked")
final T castCollector = (T) collector;
return castCollector;
}
/**
* Unregisters the specified {@link Collector} from the specified {@link CollectorRegistry}.
*/
static synchronized boolean unregister(CollectorRegistry collectorRegistry, Collector collector) {
requireNonNull(collectorRegistry, "collectorRegistry");
requireNonNull(collector, "collector");
final Map<String, Collector> map = collectors.get(collectorRegistry);
if (map == null) {
return false;
}
if (map.values().removeIf(c -> c == collector)) {
collectorRegistry.unregister(collector);
return true;
} else {
return false;
}
}
/**
* Unregisters the {@link Collector} with the specified {@code name} from the specified
* {@link CollectorRegistry}.
*/
static synchronized boolean unregister(CollectorRegistry collectorRegistry, String name) {
requireNonNull(collectorRegistry, "collectorRegistry");
requireNonNull(name, "name");
final Map<String, Collector> map = collectors.get(collectorRegistry);
if (map == null) {
return false;
}
final Collector collector = map.remove(name);
if (collector == null) {
return false;
}
// NB: A collector may have more than one binding if it provides multiple sample families.
map.values().removeIf(c -> c == collector);
collectorRegistry.unregister(collector);
return true;
}
/**
* Unregisters all {@link Collector}s registered to the specified {@link CollectorRegistry} via the
* {@link #registerIfAbsent(CollectorRegistry, String, Function)} method.
*/
static synchronized boolean unregisterAll(CollectorRegistry collectorRegistry) {
requireNonNull(collectorRegistry, "collectorRegistry");
final Map<String, Collector> map = collectors.remove(collectorRegistry);
if (map == null || map.isEmpty()) {
return false;
}
for (Collector collector : map.values()) {
collectorRegistry.unregister(collector);
}
return true;
}
private static <T extends Collector> List<MetricFamilySamples> describe(T collector) {
List<MetricFamilySamples> mfsList;
if (collector instanceof Collector.Describable) {
mfsList = ((Collector.Describable) collector).describe();
} else {
mfsList = collector.collect();
}
return mfsList;
}
private PrometheusUtil() {}
}
| {
"content_hash": "bf96861998f3ce4d255601ca6e488ae7",
"timestamp": "",
"source": "github",
"line_count": 178,
"max_line_length": 111,
"avg_line_length": 42.51685393258427,
"alnum_prop": 0.6404598308668076,
"repo_name": "jonefeewang/armeria",
"id": "cb9ecb656b674eede879fd5d5ac2b8253eed930d",
"size": "8210",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "core/src/main/java/com/linecorp/armeria/internal/metric/PrometheusUtil.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "CSS",
"bytes": "25018"
},
{
"name": "HTML",
"bytes": "26000"
},
{
"name": "Java",
"bytes": "3557888"
},
{
"name": "JavaScript",
"bytes": "25771"
},
{
"name": "Protocol Buffer",
"bytes": "19765"
},
{
"name": "Python",
"bytes": "2844"
},
{
"name": "Shell",
"bytes": "1043"
},
{
"name": "Thrift",
"bytes": "130638"
}
],
"symlink_target": ""
} |
/**
* @constructor
* @extends {WebInspector.ThrottledWidget}
* @param {!WebInspector.StylesSidebarPane} stylesSidebarPane
* @param {!WebInspector.SharedSidebarModel} sharedModel
* @param {function(!WebInspector.CSSProperty)} revealCallback
*/
WebInspector.ComputedStyleWidget = function(stylesSidebarPane, sharedModel, revealCallback)
{
WebInspector.ThrottledWidget.call(this);
this.element.classList.add("computed-style-sidebar-pane");
this.registerRequiredCSS("elements/computedStyleSidebarPane.css");
this._alwaysShowComputedProperties = { "display": true, "height": true, "width": true };
this._sharedModel = sharedModel;
this._sharedModel.addEventListener(WebInspector.SharedSidebarModel.Events.ComputedStyleChanged, this.update, this);
this._showInheritedComputedStylePropertiesSetting = WebInspector.settings.createSetting("showInheritedComputedStyleProperties", false);
this._showInheritedComputedStylePropertiesSetting.addChangeListener(this._showInheritedComputedStyleChanged.bind(this));
var hbox = this.element.createChild("div", "hbox styles-sidebar-pane-toolbar");
var filterContainerElement = hbox.createChild("div", "styles-sidebar-pane-filter-box");
var filterInput = WebInspector.StylesSidebarPane.createPropertyFilterElement(WebInspector.UIString("Filter"), hbox, filterCallback.bind(this));
filterContainerElement.appendChild(filterInput);
var toolbar = new WebInspector.Toolbar("styles-pane-toolbar", hbox);
toolbar.appendToolbarItem(new WebInspector.ToolbarCheckbox(WebInspector.UIString("Show all"), undefined, this._showInheritedComputedStylePropertiesSetting));
this._propertiesOutline = new TreeOutlineInShadow();
this._propertiesOutline.hideOverflow();
this._propertiesOutline.registerRequiredCSS("elements/computedStyleSidebarPane.css");
this._propertiesOutline.element.classList.add("monospace", "computed-properties");
this.element.appendChild(this._propertiesOutline.element);
this._stylesSidebarPane = stylesSidebarPane;
this._linkifier = new WebInspector.Linkifier(new WebInspector.Linkifier.DefaultCSSFormatter());
this._revealCallback = revealCallback;
/**
* @param {?RegExp} regex
* @this {WebInspector.ComputedStyleWidget}
*/
function filterCallback(regex)
{
this._filterRegex = regex;
this._updateFilter(regex);
}
}
/**
* @param {!WebInspector.StylesSidebarPane} stylesSidebarPane
* @param {!WebInspector.SharedSidebarModel} sharedModel
* @param {function(!WebInspector.CSSProperty)} revealCallback
* @return {!WebInspector.ElementsSidebarViewWrapperPane}
*/
WebInspector.ComputedStyleWidget.createSidebarWrapper = function(stylesSidebarPane, sharedModel, revealCallback)
{
var widget = new WebInspector.ComputedStyleWidget(stylesSidebarPane, sharedModel, revealCallback);
return new WebInspector.ElementsSidebarViewWrapperPane(WebInspector.UIString("Computed Style"), widget)
}
WebInspector.ComputedStyleWidget._propertySymbol = Symbol("property");
WebInspector.ComputedStyleWidget.prototype = {
_showInheritedComputedStyleChanged: function()
{
this.update();
},
/**
* @override
* @return {!Promise.<?>}
*/
doUpdate: function()
{
var promises = [
this._sharedModel.fetchComputedStyle(),
this._stylesSidebarPane.fetchMatchedCascade()
];
return Promise.all(promises)
.spread(this._innerRebuildUpdate.bind(this));
},
/**
* @param {string} text
* @return {!Node}
*/
_processColor: function(text)
{
var color = WebInspector.Color.parse(text);
if (!color)
return createTextNode(text);
var swatch = WebInspector.ColorSwatch.create();
swatch.setColorText(text);
swatch.setFormat(WebInspector.Color.detectColorFormat(color));
return swatch;
},
/**
* @param {?WebInspector.SharedSidebarModel.ComputedStyle} nodeStyle
* @param {?WebInspector.CSSMatchedStyles} matchedStyles
*/
_innerRebuildUpdate: function(nodeStyle, matchedStyles)
{
this._propertiesOutline.removeChildren();
this._linkifier.reset();
var cssModel = this._sharedModel.cssModel();
if (!nodeStyle || !matchedStyles || !cssModel)
return;
var uniqueProperties = nodeStyle.computedStyle.keysArray();
uniqueProperties.sort(propertySorter);
var propertyTraces = this._computePropertyTraces(matchedStyles);
var inhertiedProperties = this._computeInheritedProperties(matchedStyles);
var showInherited = this._showInheritedComputedStylePropertiesSetting.get();
for (var i = 0; i < uniqueProperties.length; ++i) {
var propertyName = uniqueProperties[i];
var propertyValue = nodeStyle.computedStyle.get(propertyName);
var canonicalName = WebInspector.CSSMetadata.canonicalPropertyName(propertyName);
var inherited = !inhertiedProperties.has(canonicalName);
if (!showInherited && inherited && !(propertyName in this._alwaysShowComputedProperties))
continue;
if (propertyName !== canonicalName && propertyValue === nodeStyle.computedStyle.get(canonicalName))
continue;
var propertyElement = createElement("div");
propertyElement.classList.add("computed-style-property");
propertyElement.classList.toggle("computed-style-property-inherited", inherited);
var renderer = new WebInspector.StylesSidebarPropertyRenderer(null, nodeStyle.node, propertyName, /** @type {string} */(propertyValue));
renderer.setColorHandler(this._processColor.bind(this));
var propertyNameElement = renderer.renderName();
propertyNameElement.classList.add("property-name");
propertyElement.appendChild(propertyNameElement);
var colon = createElementWithClass("span", "delimeter");
colon.textContent = ":";
propertyNameElement.appendChild(colon);
var propertyValueElement = propertyElement.createChild("span", "property-value");
var propertyValueText = renderer.renderValue();
propertyValueText.classList.add("property-value-text");
propertyValueElement.appendChild(propertyValueText);
var semicolon = createElementWithClass("span", "delimeter");
semicolon.textContent = ";";
propertyValueElement.appendChild(semicolon);
var treeElement = new TreeElement();
treeElement.selectable = false;
treeElement.title = propertyElement;
treeElement[WebInspector.ComputedStyleWidget._propertySymbol] = {
name: propertyName,
value: propertyValue
};
var isOdd = this._propertiesOutline.rootElement().children().length % 2 === 0;
treeElement.listItemElement.classList.toggle("odd-row", isOdd);
this._propertiesOutline.appendChild(treeElement);
var trace = propertyTraces.get(propertyName);
if (trace) {
var activeProperty = this._renderPropertyTrace(cssModel, matchedStyles, nodeStyle.node, treeElement, trace);
treeElement.listItemElement.addEventListener("mousedown", consumeEvent, false);
treeElement.listItemElement.addEventListener("dblclick", consumeEvent, false);
treeElement.listItemElement.addEventListener("click", handleClick.bind(null, treeElement), false);
var gotoSourceElement = propertyValueElement.createChild("div", "goto-source-icon");
gotoSourceElement.addEventListener("click", this._navigateToSource.bind(this, activeProperty));
}
}
this._updateFilter(this._filterRegex);
/**
* @param {string} a
* @param {string} b
* @return {number}
*/
function propertySorter(a, b)
{
if (a.startsWith("-webkit") ^ b.startsWith("-webkit"))
return a.startsWith("-webkit") ? 1 : -1;
var canonicalName = WebInspector.CSSMetadata.canonicalPropertyName;
return canonicalName(a).compareTo(canonicalName(b));
}
/**
* @param {!TreeElement} treeElement
* @param {!Event} event
*/
function handleClick(treeElement, event)
{
if (!treeElement.expanded)
treeElement.expand();
else
treeElement.collapse();
consumeEvent(event);
}
},
/**
* @param {!WebInspector.CSSProperty} cssProperty
* @param {!Event} event
*/
_navigateToSource: function(cssProperty, event)
{
if (this._revealCallback)
this._revealCallback.call(null, cssProperty);
event.consume(true);
},
/**
* @param {!WebInspector.CSSStyleModel} cssModel
* @param {!WebInspector.CSSMatchedStyles} matchedStyles
* @param {!WebInspector.DOMNode} node
* @param {!TreeElement} rootTreeElement
* @param {!Array<!WebInspector.CSSProperty>} tracedProperties
* @return {!WebInspector.CSSProperty}
*/
_renderPropertyTrace: function(cssModel, matchedStyles, node, rootTreeElement, tracedProperties)
{
var activeProperty = null;
for (var property of tracedProperties) {
var trace = createElement("div");
trace.classList.add("property-trace");
if (matchedStyles.propertyState(property) === WebInspector.CSSMatchedStyles.PropertyState.Overloaded)
trace.classList.add("property-trace-inactive");
else
activeProperty = property;
var renderer = new WebInspector.StylesSidebarPropertyRenderer(null, node, property.name, /** @type {string} */(property.value));
renderer.setColorHandler(this._processColor.bind(this));
var valueElement = renderer.renderValue();
valueElement.classList.add("property-trace-value");
valueElement.addEventListener("click", this._navigateToSource.bind(this, property), false);
var gotoSourceElement = createElement("div");
gotoSourceElement.classList.add("goto-source-icon");
gotoSourceElement.addEventListener("click", this._navigateToSource.bind(this, property));
valueElement.insertBefore(gotoSourceElement, valueElement.firstChild);
trace.appendChild(valueElement);
var rule = property.ownerStyle.parentRule;
if (rule) {
var linkSpan = trace.createChild("span", "trace-link");
linkSpan.appendChild(WebInspector.StylePropertiesSection.createRuleOriginNode(matchedStyles, this._linkifier, rule));
}
var selectorElement = trace.createChild("span", "property-trace-selector");
selectorElement.textContent = rule ? rule.selectorText() : "element.style";
selectorElement.title = selectorElement.textContent;
var traceTreeElement = new TreeElement();
traceTreeElement.title = trace;
traceTreeElement.selectable = false;
rootTreeElement.appendChild(traceTreeElement);
}
return /** @type {!WebInspector.CSSProperty} */(activeProperty);
},
/**
* @param {!WebInspector.CSSMatchedStyles} matchedStyles
* @return {!Map<string, !Array<!WebInspector.CSSProperty>>}
*/
_computePropertyTraces: function(matchedStyles)
{
var result = new Map();
for (var style of matchedStyles.nodeStyles()) {
var allProperties = style.allProperties;
for (var property of allProperties) {
if (!property.activeInStyle() || !matchedStyles.propertyState(property))
continue;
if (!result.has(property.name))
result.set(property.name, []);
result.get(property.name).push(property);
}
}
return result;
},
/**
* @param {!WebInspector.CSSMatchedStyles} matchedStyles
* @return {!Set<string>}
*/
_computeInheritedProperties: function(matchedStyles)
{
var result = new Set();
for (var style of matchedStyles.nodeStyles()) {
for (var property of style.allProperties) {
if (!matchedStyles.propertyState(property))
continue;
result.add(WebInspector.CSSMetadata.canonicalPropertyName(property.name));
}
}
return result;
},
/**
* @param {?RegExp} regex
*/
_updateFilter: function(regex)
{
var children = this._propertiesOutline.rootElement().children();
for (var child of children) {
var property = child[WebInspector.ComputedStyleWidget._propertySymbol];
var matched = !regex || regex.test(property.name) || regex.test(property.value);
child.hidden = !matched;
}
},
__proto__: WebInspector.ThrottledWidget.prototype
}
| {
"content_hash": "59c9c06cd77ac48f394c51d433192558",
"timestamp": "",
"source": "github",
"line_count": 315,
"max_line_length": 161,
"avg_line_length": 42.03809523809524,
"alnum_prop": 0.6576045914514423,
"repo_name": "highweb-project/highweb-webcl-html5spec",
"id": "9fde204aa5dc724b0e13adce4ee1475b8feb6a53",
"size": "14847",
"binary": false,
"copies": "1",
"ref": "refs/heads/highweb-20160310",
"path": "third_party/WebKit/Source/devtools/front_end/elements/ComputedStyleWidget.js",
"mode": "33188",
"license": "bsd-3-clause",
"language": [],
"symlink_target": ""
} |
//@target: es6
// Generic tag with one parameter
function noParams<T>(n: T) { }
noParams ``;
// Generic tag with parameter which does not use type parameter
function noGenericParams<T>(n: string[]) { }
noGenericParams ``;
// Generic tag with multiple type parameters and only one used in parameter type annotation
function someGenerics1a<T, U>(n: T, m: number) { }
someGenerics1a `${3}`;
function someGenerics1b<T, U>(n: string[], m: U) { }
someGenerics1b `${3}`;
// Generic tag with argument of function type whose parameter is of type parameter type
function someGenerics2a<T>(strs: string[], n: (x: T) => void) { }
someGenerics2a `${(n: string) => n}`;
function someGenerics2b<T, U>(strs: string[], n: (x: T, y: U) => void) { }
someGenerics2b `${ (n: string, x: number) => n }`;
// Generic tag with argument of function type whose parameter is not of type parameter type but body/return type uses type parameter
function someGenerics3<T>(strs: string[], producer: () => T) { }
someGenerics3 `${() => ''}`;
someGenerics3 `${() => undefined}`;
someGenerics3 `${() => 3}`;
// 2 parameter generic tag with argument 1 of type parameter type and argument 2 of function type whose parameter is of type parameter type
function someGenerics4<T, U>(strs: string[], n: T, f: (x: U) => void) { }
someGenerics4 `${4}${ () => null }`;
someGenerics4 `${''}${ () => 3 }`;
someGenerics4 `${ null }${ null }`;
// 2 parameter generic tag with argument 2 of type parameter type and argument 1 of function type whose parameter is of type parameter type
function someGenerics5<U, T>(strs: string[], n: T, f: (x: U) => void) { }
someGenerics5 `${ 4 } ${ () => null }`;
someGenerics5 `${ '' }${ () => 3 }`;
someGenerics5 `${null}${null}`;
// Generic tag with multiple arguments of function types that each have parameters of the same generic type
function someGenerics6<A>(strs: string[], a: (a: A) => A, b: (b: A) => A, c: (c: A) => A) { }
someGenerics6 `${ n => n }${ n => n}${ n => n}`;
someGenerics6 `${ n => n }${ n => n}${ n => n}`;
someGenerics6 `${ (n: number) => n }${ (n: number) => n }${ (n: number) => n }`;
// Generic tag with multiple arguments of function types that each have parameters of different generic type
function someGenerics7<A, B, C>(strs: string[], a: (a: A) => A, b: (b: B) => B, c: (c: C) => C) { }
someGenerics7 `${ n => n }${ n => n }${ n => n }`;
someGenerics7 `${ n => n }${ n => n }${ n => n }`;
someGenerics7 `${(n: number) => n}${ (n: string) => n}${ (n: number) => n}`;
// Generic tag with argument of generic function type
function someGenerics8<T>(strs: string[], n: T): T { return n; }
var x = someGenerics8 `${ someGenerics7 }`;
x `${null}${null}${null}`;
// Generic tag with multiple parameters of generic type passed arguments with no best common type
function someGenerics9<T>(strs: string[], a: T, b: T, c: T): T {
return null;
}
var a9a = someGenerics9 `${ '' }${ 0 }${ [] }`;
var a9a: {};
// Generic tag with multiple parameters of generic type passed arguments with multiple best common types
interface A91 {
x: number;
y?: string;
}
interface A92 {
x: number;
z?: Date;
}
var a9e = someGenerics9 `${ undefined }${ { x: 6, z: new Date() } }${ { x: 6, y: '' } }`;
var a9e: {};
// Generic tag with multiple parameters of generic type passed arguments with a single best common type
var a9d = someGenerics9 `${ { x: 3 }}${ { x: 6 }}${ { x: 6 } }`;
var a9d: { x: number; };
// Generic tag with multiple parameters of generic type where one argument is of type 'any'
var anyVar: any;
var a = someGenerics9 `${ 7 }${ anyVar }${ 4 }`;
var a: any;
// Generic tag with multiple parameters of generic type where one argument is [] and the other is not 'any'
var arr = someGenerics9 `${ [] }${ null }${ undefined }`;
var arr: any[];
| {
"content_hash": "03377a7390994278be43a6d1c0accbfb",
"timestamp": "",
"source": "github",
"line_count": 92,
"max_line_length": 139,
"avg_line_length": 41.19565217391305,
"alnum_prop": 0.6321899736147757,
"repo_name": "freedot/tstolua",
"id": "39b8ab4199ccd25d52f10df136fd983258e5e673",
"size": "3792",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "tests/cases/conformance/es6/templates/taggedTemplateStringsTypeArgumentInferenceES6.ts",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Batchfile",
"bytes": "1125"
},
{
"name": "HTML",
"bytes": "4659"
},
{
"name": "JavaScript",
"bytes": "85"
},
{
"name": "Lua",
"bytes": "68588"
},
{
"name": "PowerShell",
"bytes": "2780"
},
{
"name": "TypeScript",
"bytes": "22883724"
}
],
"symlink_target": ""
} |
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!--NewPage-->
<HTML>
<HEAD>
<!-- Generated by javadoc (build 1.6.0_24) on Sat Nov 03 22:37:20 MDT 2012 -->
<TITLE>
Uses of Package ca.ualberta.cs.c301f12t01.dummy
</TITLE>
<META NAME="date" CONTENT="2012-11-03">
<LINK REL ="stylesheet" TYPE="text/css" HREF="../../../../../stylesheet.css" TITLE="Style">
<SCRIPT type="text/javascript">
function windowTitle()
{
if (location.href.indexOf('is-external=true') == -1) {
parent.document.title="Uses of Package ca.ualberta.cs.c301f12t01.dummy";
}
}
</SCRIPT>
<NOSCRIPT>
</NOSCRIPT>
</HEAD>
<BODY BGCOLOR="white" onload="windowTitle();">
<HR>
<!-- ========= START OF TOP NAVBAR ======= -->
<A NAME="navbar_top"><!-- --></A>
<A HREF="#skip-navbar_top" title="Skip navigation links"></A>
<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
<TR>
<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
<A NAME="navbar_top_firstrow"><!-- --></A>
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
<TR ALIGN="center" VALIGN="top">
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <FONT CLASS="NavBarFont1">Class</FONT> </TD>
<TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Use</B></FONT> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../index-files/index-1.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD>
</TR>
</TABLE>
</TD>
<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
</EM>
</TD>
</TR>
<TR>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
PREV
NEXT</FONT></TD>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
<A HREF="../../../../../index.html?ca/ualberta/cs/c301f12t01/dummy/package-use.html" target="_top"><B>FRAMES</B></A>
<A HREF="package-use.html" target="_top"><B>NO FRAMES</B></A>
<SCRIPT type="text/javascript">
<!--
if(window==top) {
document.writeln('<A HREF="../../../../../allclasses-noframe.html"><B>All Classes</B></A>');
}
//-->
</SCRIPT>
<NOSCRIPT>
<A HREF="../../../../../allclasses-noframe.html"><B>All Classes</B></A>
</NOSCRIPT>
</FONT></TD>
</TR>
</TABLE>
<A NAME="skip-navbar_top"></A>
<!-- ========= END OF TOP NAVBAR ========= -->
<HR>
<CENTER>
<H2>
<B>Uses of Package<br>ca.ualberta.cs.c301f12t01.dummy</B></H2>
</CENTER>
No usage of ca.ualberta.cs.c301f12t01.dummy
<P>
<HR>
<!-- ======= START OF BOTTOM NAVBAR ====== -->
<A NAME="navbar_bottom"><!-- --></A>
<A HREF="#skip-navbar_bottom" title="Skip navigation links"></A>
<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
<TR>
<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
<A NAME="navbar_bottom_firstrow"><!-- --></A>
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
<TR ALIGN="center" VALIGN="top">
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <FONT CLASS="NavBarFont1">Class</FONT> </TD>
<TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Use</B></FONT> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../index-files/index-1.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD>
</TR>
</TABLE>
</TD>
<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
</EM>
</TD>
</TR>
<TR>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
PREV
NEXT</FONT></TD>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
<A HREF="../../../../../index.html?ca/ualberta/cs/c301f12t01/dummy/package-use.html" target="_top"><B>FRAMES</B></A>
<A HREF="package-use.html" target="_top"><B>NO FRAMES</B></A>
<SCRIPT type="text/javascript">
<!--
if(window==top) {
document.writeln('<A HREF="../../../../../allclasses-noframe.html"><B>All Classes</B></A>');
}
//-->
</SCRIPT>
<NOSCRIPT>
<A HREF="../../../../../allclasses-noframe.html"><B>All Classes</B></A>
</NOSCRIPT>
</FONT></TD>
</TR>
</TABLE>
<A NAME="skip-navbar_bottom"></A>
<!-- ======== END OF BOTTOM NAVBAR ======= -->
<HR>
</BODY>
</HTML>
| {
"content_hash": "b7154e688f5e9970aa583dc7e77669cd",
"timestamp": "",
"source": "github",
"line_count": 144,
"max_line_length": 159,
"avg_line_length": 39.111111111111114,
"alnum_prop": 0.6120383522727273,
"repo_name": "CMPUT301F12T01/classproject",
"id": "174e3ea989d1b1e1194f9810ab40771817c2b13f",
"size": "5632",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "doc/ca/ualberta/cs/c301f12t01/dummy/package-use.html",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Java",
"bytes": "208496"
}
],
"symlink_target": ""
} |
package com.amazonaws.services.identitymanagement.model;
import java.io.Serializable;
import javax.annotation.Generated;
/**
*
* @see <a href="http://docs.aws.amazon.com/goto/WebAPI/iam-2010-05-08/UpdateServiceSpecificCredential"
* target="_top">AWS API Documentation</a>
*/
@Generated("com.amazonaws:aws-java-sdk-code-generator")
public class UpdateServiceSpecificCredentialResult extends com.amazonaws.AmazonWebServiceResult<com.amazonaws.ResponseMetadata> implements Serializable,
Cloneable {
/**
* Returns a string representation of this object. This is useful for testing and debugging. Sensitive data will be
* redacted from this string using a placeholder value.
*
* @return A string representation of this object.
*
* @see java.lang.Object#toString()
*/
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("{");
sb.append("}");
return sb.toString();
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (obj instanceof UpdateServiceSpecificCredentialResult == false)
return false;
UpdateServiceSpecificCredentialResult other = (UpdateServiceSpecificCredentialResult) obj;
return true;
}
@Override
public int hashCode() {
final int prime = 31;
int hashCode = 1;
return hashCode;
}
@Override
public UpdateServiceSpecificCredentialResult clone() {
try {
return (UpdateServiceSpecificCredentialResult) super.clone();
} catch (CloneNotSupportedException e) {
throw new IllegalStateException("Got a CloneNotSupportedException from Object.clone() " + "even though we're Cloneable!", e);
}
}
}
| {
"content_hash": "70c0d1695ed435047dcb46012edecfec",
"timestamp": "",
"source": "github",
"line_count": 62,
"max_line_length": 152,
"avg_line_length": 30.370967741935484,
"alnum_prop": 0.6585236325013276,
"repo_name": "jentfoo/aws-sdk-java",
"id": "e8b60aecc10f273bb5261d03d295a5bc4a8e08aa",
"size": "2463",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "aws-java-sdk-iam/src/main/java/com/amazonaws/services/identitymanagement/model/UpdateServiceSpecificCredentialResult.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Batchfile",
"bytes": "270"
},
{
"name": "FreeMarker",
"bytes": "173637"
},
{
"name": "Gherkin",
"bytes": "25063"
},
{
"name": "Java",
"bytes": "356214839"
},
{
"name": "Scilab",
"bytes": "3924"
},
{
"name": "Shell",
"bytes": "295"
}
],
"symlink_target": ""
} |
namespace {
void RunWebAudioMediaCodec(
base::SharedMemoryHandle encoded_data_handle,
base::FileDescriptor pcm_output) {
content::ChildThread::current()->Send(
new ViewHostMsg_RunWebAudioMediaCodec(encoded_data_handle,
pcm_output));
}
} // anonymous namespace
#endif
namespace content {
WebKitPlatformSupportImpl::WebKitPlatformSupportImpl() {
}
WebKitPlatformSupportImpl::~WebKitPlatformSupportImpl() {
}
string16 WebKitPlatformSupportImpl::GetLocalizedString(int message_id) {
return GetContentClient()->GetLocalizedString(message_id);
}
base::StringPiece WebKitPlatformSupportImpl::GetDataResource(
int resource_id,
ui::ScaleFactor scale_factor) {
return GetContentClient()->GetDataResource(resource_id, scale_factor);
}
void WebKitPlatformSupportImpl::GetPlugins(
bool refresh, std::vector<webkit::WebPluginInfo>* plugins) {
// This should not be called except in the renderer.
// RendererWebKitPlatformSupportImpl overrides this.
NOTREACHED();
}
webkit_glue::ResourceLoaderBridge*
WebKitPlatformSupportImpl::CreateResourceLoader(
const webkit_glue::ResourceLoaderBridge::RequestInfo& request_info) {
return ChildThread::current()->CreateBridge(request_info);
}
webkit_glue::WebSocketStreamHandleBridge*
WebKitPlatformSupportImpl::CreateWebSocketBridge(
WebKit::WebSocketStreamHandle* handle,
webkit_glue::WebSocketStreamHandleDelegate* delegate) {
SocketStreamDispatcher* dispatcher =
ChildThread::current()->socket_stream_dispatcher();
return dispatcher->CreateBridge(handle, delegate);
}
#if defined(OS_ANDROID)
webkit_media::WebAudioMediaCodecRunner
WebKitPlatformSupportImpl::GetWebAudioMediaCodecRunner() {
return base::Bind(&RunWebAudioMediaCodec);
}
#endif
} // namespace content
| {
"content_hash": "026527b76231c1170edbdb050f0fcb59",
"timestamp": "",
"source": "github",
"line_count": 60,
"max_line_length": 73,
"avg_line_length": 30.2,
"alnum_prop": 0.7665562913907285,
"repo_name": "plxaye/chromium",
"id": "1328bd5d1042f36f48ed6cb7cb0e78b684020829",
"size": "2384",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/content/common/webkitplatformsupport_impl.cc",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "ASP",
"bytes": "853"
},
{
"name": "AppleScript",
"bytes": "6973"
},
{
"name": "Arduino",
"bytes": "464"
},
{
"name": "Assembly",
"bytes": "1176633"
},
{
"name": "Awk",
"bytes": "9519"
},
{
"name": "C",
"bytes": "75195981"
},
{
"name": "C#",
"bytes": "36335"
},
{
"name": "C++",
"bytes": "172360762"
},
{
"name": "CSS",
"bytes": "740648"
},
{
"name": "Dart",
"bytes": "12620"
},
{
"name": "Emacs Lisp",
"bytes": "12454"
},
{
"name": "F#",
"bytes": "381"
},
{
"name": "Java",
"bytes": "3671513"
},
{
"name": "JavaScript",
"bytes": "16204541"
},
{
"name": "Max",
"bytes": "39069"
},
{
"name": "Mercury",
"bytes": "10299"
},
{
"name": "Objective-C",
"bytes": "1133728"
},
{
"name": "Objective-C++",
"bytes": "5771619"
},
{
"name": "PHP",
"bytes": "97817"
},
{
"name": "Perl",
"bytes": "166372"
},
{
"name": "Python",
"bytes": "11650532"
},
{
"name": "Ragel in Ruby Host",
"bytes": "3641"
},
{
"name": "Rebol",
"bytes": "262"
},
{
"name": "Ruby",
"bytes": "14575"
},
{
"name": "Shell",
"bytes": "1426780"
},
{
"name": "Tcl",
"bytes": "277077"
},
{
"name": "TeX",
"bytes": "43554"
},
{
"name": "VimL",
"bytes": "4953"
},
{
"name": "XSLT",
"bytes": "13493"
},
{
"name": "nesC",
"bytes": "14650"
}
],
"symlink_target": ""
} |
<div class="row">
<div class="col-md-4">
<strong>Panel Template:</strong>
<select class="form-control" ng-required="true" ng-model="model.current_panel_template" ng-change="panelTemplateChanged()" ng-options="p.panel_name for p in model.panel_templates">
</select>
<br/>
<div class="top"><strong>Sites:</strong></div>
<div data-ng-repeat="site in model.sites">
<label>
<input type="checkbox" ng-model="site.selected" ng-disabled="model.current_panel_template==null" ng-change="siteSelectionChanged()" />
{{ site.site_name }}
</label>
</div>
<br/>
<accordion close-others="false">
<accordion-group>
<accordion-heading>
Subjects <i class="pull-right glyphicon" ng-class="{'glyphicon-chevron-down': isopen, 'glyphicon-chevron-right': !isopen}"></i>
</accordion-heading>
<div data-ng-repeat="subject in model.subjects">
<label>
<input type="checkbox" ng-model="subject.selected" ng-change="updateSamples()" />
{{ subject.subject_code }}
</label>
</div>
</accordion-group>
<accordion-group>
<accordion-heading>
Visits <i class="pull-right glyphicon" ng-class="{'glyphicon-chevron-down': isopen, 'glyphicon-chevron-right': !isopen}"></i>
</accordion-heading>
<div data-ng-repeat="visit in model.visits">
<label>
<input type="checkbox" ng-model="visit.selected" ng-change="updateSamples()" />
{{ visit.visit_type_name }}
</label>
</div>
</accordion-group>
<accordion-group>
<accordion-heading>
Stimulation <i class="pull-right glyphicon" ng-class="{'glyphicon-chevron-down': isopen, 'glyphicon-chevron-right': !isopen}"></i>
</accordion-heading>
<div data-ng-repeat="stim in model.stimulations">
<label>
<input type="checkbox" ng-model="stim.selected" ng-change="updateSamples()" />
{{ stim.stimulation_name }}
</label>
</div>
</accordion-group>
<accordion-group>
<accordion-heading>
Pre-treatment <i class="pull-right glyphicon" ng-class="{'glyphicon-chevron-down': isopen, 'glyphicon-chevron-right': !isopen}"></i>
</accordion-heading>
<div data-ng-repeat="pretreatment in model.pretreatments">
<label>
<input type="checkbox" ng-model="pretreatment.selected" ng-change="updateSamples()" />
{{ pretreatment.name }}
</label>
</div>
</accordion-group>
</accordion>
</div>
<div class="col-md-8">
<table ts-wrapper class="table table-hover">
<thead>
<tr>
<th colspan="50">
<div class=" text-center">
<h4>Samples</h4>
</div>
</th>
</tr>
<tr>
<th style="width:1%;">
<input type="checkbox" ng-model="model.master_sample_checkbox" ng-change="toggleAllSamples()"/>
</th>
<th ts-criteria="original_filename">File Name</th>
<th ts-criteria="site_name">Site</th>
<th ts-criteria="subject_code">Subject</th>
<th ts-criteria="stimulation_name">Stimulation</th>
</tr>
</thead>
<tbody>
<tr ts-repeat data-ng-repeat="s in model.samples" ng-if="s.ignore == false">
<td class="no-wrap">
<input type="checkbox" ng-model="s.selected" />
</td>
<td>{{ s.original_filename }}</td>
<td>{{ s.site_name }}</td>
<td>{{ s.subject_code }}</td>
<td>{{ s.stimulation_name }}</td>
</tr>
</tbody>
</table>
</div>
</div> | {
"content_hash": "7358afbae97caed0159649d9ae6250fb",
"timestamp": "",
"source": "github",
"line_count": 102,
"max_line_length": 186,
"avg_line_length": 39.35294117647059,
"alnum_prop": 0.5209267563527653,
"repo_name": "whitews/ReFlow",
"id": "de7b563feafc609973612a7a0a6327f750fdda77",
"size": "4014",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "static/ng-app/partials/pr/choose_samples.html",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "CSS",
"bytes": "131522"
},
{
"name": "Dockerfile",
"bytes": "327"
},
{
"name": "HTML",
"bytes": "424958"
},
{
"name": "JavaScript",
"bytes": "1177023"
},
{
"name": "Python",
"bytes": "254904"
}
],
"symlink_target": ""
} |
<!doctype html>
<html>
<head>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-alpha.6/css/bootstrap.min.css" integrity="sha384-rwoIResjU2yc3z8GV/NPeZWAv56rSmLldC3R/AZzGRnGxQQKnKkoFVhFQhNUwEyJ" crossorigin="anonymous">
<script src="https://code.jquery.com/jquery-3.1.1.slim.min.js" integrity="sha384-A7FZj7v+d/sdmMqp/nOQwliLvUsJfDHW+k9Omg/a/EheAdgtzNs3hpfag6Ed950n" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/tether/1.4.0/js/tether.min.js" integrity="sha384-DztdAPBWPRXSA/3eYEEUWrWCy7G5KFbe8fFjk5JAIxUYHKkDx6Qin1DkWx51bBrb" crossorigin="anonymous"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-alpha.6/js/bootstrap.min.js" integrity="sha384-vBWWzlZJ8ea9aCX4pEW3rVHjgjt7zpkNpZk+02D9phzyeVkE+jo0ieGizqPLForn" crossorigin="anonymous"></script>
<link rel="stylesheet" type="text/css" href="style.css">
<title> Green Home </title>
</head>
<body>
<nav class="navbar navbar-toggleable-md navbar-light bg-faded">
<button class="navbar-toggler navbar-toggler-right" type="button" data-toggle="collapse" data-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<a class="navbar-brand" href="index.html"><img src="greenhomelogo.png"></a>
<div class="collapse navbar-collapse" id="navbarSupportedContent">
<ul class="navbar-nav mr-auto">
<li class="nav-item active">
<a class="nav-link" href="index.html">GreenHome<span class="sr-only">(current)</span></a>
</li>
<li class="nav-item">
<a class="nav-link" href="#">Link</a>
</li>
<li class="nav-item">
<a class="nav-link disabled" href="#">Disabled</a>
</li>
</ul>
<form class="form-inline my-2 my-lg-0">
<input class="form-control mr-sm-2" type="text" placeholder="Search">
<button class="btn btn-outline-success my-2 my-sm-0" type="submit">Search</button>
</form>
</div>
</nav>
<ul class="nav nav-pills nav-justified">
<li class="nav-item">
<a class="nav-link active" href="#">Active</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#">Longer nav link</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#">Link</a>
</li>
<li class="nav-item">
<a class="nav-link disabled" href="#">Disabled</a>
</li>
</ul>
<h1> Green Home Project </h1>
<h2> </h2>
</body>
</html>
| {
"content_hash": "86b3de502a7ec7ad04fd215322a38aaf",
"timestamp": "",
"source": "github",
"line_count": 68,
"max_line_length": 223,
"avg_line_length": 39.51470588235294,
"alnum_prop": 0.6360253070338667,
"repo_name": "lnewkold/greenhome",
"id": "6e561fde6f33bbcea626cbf364c6ebdeea67bec5",
"size": "2687",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "page2.html",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "1143"
},
{
"name": "HTML",
"bytes": "11049"
}
],
"symlink_target": ""
} |
import { Injectable } from '@angular/core';
import { Headers, Http } from '@angular/http';
import 'rxjs/add/operator/catch';
import LoginService from './login.service';
@Injectable()
export default class ImagesService {
imagesUrl = '/api/images/';
constructor(http: Http, loginService: LoginService) {
this.http = http;
this.loginService = loginService;
}
getImages() {
return this.http.get(this.imagesUrl)
.map(response => response.json())
.catch(err => this.handleError(err));
}
getImage(id) {
return this.http.get(this.imagesUrl + id).toPromise()
.map(response => response.json())
.catch(err => this.handleError(err));
}
deleteImage(id) {
const headers = new Headers({ 'Authorization': this.loginService.getToken() });
return this.http.delete(this.imagesUrl + id, { headers })
.map(response => response.json())
.catch(err => this.handleError(err));
}
saveImage(image) {
const headers = new Headers({
'Content-Type': 'application/json',
'Authorization': this.loginService.getToken(),
});
let url = this.imagesUrl;
if (image._id) {
url = url + image._id;
return this.http.put(url, JSON.stringify(image), { headers })
.catch(this.handleError);
}
return this.http.post(url, JSON.stringify(image), { headers })
.catch(this.handleError);
}
handleError(error) {
if (error.status === 401) console.log('Access denied');
console.log('An error occurred', error);
return Promise.reject(error.message || error);
}
}
| {
"content_hash": "dd56fcb84b2b3693565c3b33a6177490",
"timestamp": "",
"source": "github",
"line_count": 55,
"max_line_length": 83,
"avg_line_length": 30.10909090909091,
"alnum_prop": 0.6080917874396136,
"repo_name": "sometea/ilmapallo",
"id": "ba9ee39d4940f7b3cd5083179555fbbd4a276af2",
"size": "1686",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "client/images.service.js",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "101"
},
{
"name": "HTML",
"bytes": "4048"
},
{
"name": "JavaScript",
"bytes": "30374"
}
],
"symlink_target": ""
} |
#ifndef DETAIL_DETECT_OS_H
#define DETAIL_DETECT_OS_H
//for reference see: https://sourceforge.net/p/predef/wiki/OperatingSystems/
#if (defined(__linux) || defined(__linux__) || defined(__gnu_linux__))
#define COMPASS_CT_OS_LINUX
#endif
#if (defined(__APPLE__) || defined(__MACH__))
#define COMPASS_CT_OS_MACOS
#endif
#if (defined(_WIN16) || defined(_WIN32) || defined(_WIN64) || defined(__WIN32__))
#define COMPASS_CT_OS_WINDOWS
#endif
#include "detail/definitions.hpp"
namespace compass {
namespace compiletime {
struct linux_tag {};
struct macos_tag {};
struct windows_tag {};
struct platform {
#ifdef COMPASS_CT_OS_LINUX
typedef linux_tag type;
#endif
#ifdef COMPASS_CT_OS_MACOS
typedef macos_tag type;
#endif
#ifdef COMPASS_CT_OS_WINDOWS
typedef windows_tag type;
#endif
#if (!(defined(COMPASS_CT_OS_LINUX) || defined(COMPASS_CT_OS_MACOS) || defined(COMPASS_CT_OS_WINDOWS)))
typedef unsupported_tag type;
static_assert(true,
"\ncompass is not aware of this operating system \nPlease create an issue under https://github.com/psteinb/compass\n\n");
#endif
};
} // compiletime
} // compass
#endif /* DETAIL_DETECT_OS_H */
| {
"content_hash": "ebd2d869103a9fa4a22a18caa710821d",
"timestamp": "",
"source": "github",
"line_count": 56,
"max_line_length": 135,
"avg_line_length": 22.642857142857142,
"alnum_prop": 0.6411671924290221,
"repo_name": "psteinb/compass",
"id": "f0d3bfce39b1a57486f8b03d8c8e396918518d7a",
"size": "1268",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "include/detail/ct/detect_os.hpp",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "C++",
"bytes": "79955"
},
{
"name": "CMake",
"bytes": "54360"
}
],
"symlink_target": ""
} |
<?xml version="1.0" encoding="utf-8"?>
<!--
~ Copyright (C) 2021 The Android Open Source Project.
~
~ Licensed under the Apache License, Version 2.0 (the "License");
~ you may not use this file except in compliance with the License.
~ You may obtain a copy of the License at
~
~ http://www.apache.org/licenses/LICENSE-2.0
~
~ Unless required by applicable law or agreed to in writing, software
~ distributed under the License is distributed on an "AS IS" BASIS,
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
~ See the License for the specific language governing permissions and
~ limitations under the License.
-->
<resources>
<!-- Text Appearance Subtitle1 style -->
<style name="TextAppearance.LunchTray.Subtitle1"
parent="TextAppearance.MaterialComponents.Subtitle1">
<item name="android:textSize">18sp</item>
</style>
<!-- TextView style -->
<style name="Widget.LunchTray.TextView" parent="Widget.MaterialComponents.TextView">
<item name="android:textAppearance">?attr/textAppearanceSubtitle1</item>
</style>
<!-- Radio Button style -->
<style name="Widget.LunchTray.CompoundButton.RadioButton"
parent="Widget.MaterialComponents.CompoundButton.RadioButton">
<item name="android:paddingEnd">@dimen/radio_button_padding</item>
<item name="android:paddingStart">@dimen/radio_button_padding</item>
<item name="android:textAppearance">?attr/textAppearanceBody1</item>
</style>
<!-- Button Style for Next Button -->
<style name="Widget.Order.Button.Cancel"
parent="Widget.MaterialComponents.Button.OutlinedButton">
<item name="android:layout_width">0dp</item>
<item name="android:layout_height">wrap_content</item>
<item name="android:layout_marginEnd">@dimen/side_margin</item>
<item name="android:text">@string/cancel</item>
</style>
<!-- Button Style for Next Button -->
<style name="Widget.Order.Button.Next" parent="">
<item name="android:layout_width">0dp</item>
<item name="android:layout_height">wrap_content</item>
<item name="android:layout_marginTop">@dimen/side_margin</item>
<item name="android:text">@string/next</item>
</style>
<!-- TextView Style for Menu Item Info -->
<style name="Widget.MenuItem.TextView.Info" parent="">
<item name="android:layout_width">wrap_content</item>
<item name="android:layout_height">wrap_content</item>
<item name="android:textAppearance">?attr/textAppearanceBody2</item>
<item name="android:paddingStart">@dimen/base_margin</item>
<item name="android:paddingEnd">@dimen/base_margin</item>
<item name="singleLine">false</item>
<item name="android:scrollHorizontally">false</item>
<item name="maxLines">5</item>
</style>
<!-- TextView Style for Checkout Item Label -->
<style name="Widget.LunchTray.TextView.CheckoutItem.Label"
parent="Widget.MaterialComponents.TextView">
<item name="android:layout_width">wrap_content</item>
<item name="android:layout_height">wrap_content</item>
<item name="android:textAllCaps">true</item>
<item name="android:textAppearance">?attr/textAppearanceBody1</item>
<item name="android:textStyle">bold</item>
</style>
<!-- TextView Style for Checkout Item Name -->
<style name="Widget.LunchTray.TextView.CheckoutItem.Info"
parent="Widget.MaterialComponents.TextView">
<item name="android:layout_width">wrap_content</item>
<item name="android:layout_height">wrap_content</item>
<item name="android:layout_marginTop">@dimen/checkout_item_margin</item>
<item name="android:layout_marginBottom">@dimen/checkout_item_margin</item>
<item name="android:textAppearance">?attr/textAppearanceBody1</item>
<item name="android:textStyle">normal</item>
</style>
<!-- TextView Style for Subtotal -->
<style name="Widget.LunchTray.TextView.Subtotal" parent="">
<item name="android:layout_width">wrap_content</item>
<item name="android:layout_height">wrap_content</item>
<item name="android:layout_marginTop">@dimen/side_margin</item>
<item name="android:textAppearance">?attr/textAppearanceSubtitle1</item>
</style>
<!-- Divider style -->
<style name="Widget.LunchTray.Divider" parent="@style/Theme.LunchTray">
<item name="android:layout_width">match_parent</item>
<item name="android:layout_height">1dp</item>
<item name="android:background">?attr/dividerHorizontal</item>
<item name="android:layout_marginTop">@dimen/base_margin</item>
</style>
<string name="cancel">Cancel</string>
</resources>
| {
"content_hash": "4d56ee252efdf79ebf9294e27bd8b0da",
"timestamp": "",
"source": "github",
"line_count": 105,
"max_line_length": 88,
"avg_line_length": 45.838095238095235,
"alnum_prop": 0.6765011427384168,
"repo_name": "google-developer-training/android-basics-kotlin-lunch-tray-app",
"id": "1418d64d30c63a719285296b3f1247bcbbc4aeb4",
"size": "4813",
"binary": false,
"copies": "1",
"ref": "refs/heads/main",
"path": "app/src/main/res/values/styles.xml",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Kotlin",
"bytes": "55317"
}
],
"symlink_target": ""
} |
import mysql.connector
import numpy as np
from tqdm import tqdm
from time import time
NUMBER_OF_GENERATED_SAMPLES = 1000000
def create_listeners_table(db_cursor):
sql = """
CREATE TABLE `Listeners` (
`ListenerId` int(11) NOT NULL AUTO_INCREMENT,
`FirstName` varchar(255) NOT NULL,
`LastName` varchar(255) NOT NULL,
PRIMARY KEY (`ListenerId`))
ENGINE=InnoDB
"""
db_cursor.execute(sql)
def create_tests_table(db_cursor):
sql = """
CREATE TABLE `Tests` (
`TestId` int(11) NOT NULL AUTO_INCREMENT,
`ListenerId` int(11) NOT NULL,
`Others` int(11) NULL,
PRIMARY KEY (`TestId`))
ENGINE=InnoDB
"""
db_cursor.execute(sql)
def create_tests_table_index(db_cursor):
sql = """
CREATE TABLE `Tests` (
`TestId` int(11) NOT NULL AUTO_INCREMENT,
`ListenerId` int(11) NOT NULL,
`Others` int(11) NULL,
PRIMARY KEY (`TestId`),
FOREIGN KEY (ListenerId)
REFERENCES Listeners(ListenerId)
ON UPDATE CASCADE
ON DELETE CASCADE
)
ENGINE=InnoDB
"""
db_cursor.execute(sql)
def create_listeners_table_index(db_cursor):
sql = """
CREATE TABLE `Listeners` (
`ListenerId` int(11) NOT NULL AUTO_INCREMENT,
`FirstName` varchar(255) NOT NULL,
`LastName` varchar(255) NOT NULL,
PRIMARY KEY (`ListenerId`),
INDEX names USING BTREE (`FirstName`))
ENGINE=InnoDB
"""
db_cursor.execute(sql)
def drop_test(db_cursor):
sql = """
DROP TABLE tests
"""
db_cursor.execute(sql)
def drop_listeners(db_cursor):
sql = """
DROP TABLE listeners
"""
db_cursor.execute(sql)
def insert_tests_table(db_cursor):
np.random.seed(0xCAFFE)
random_listeners_id = np.random.randint(low=1, high=NUMBER_OF_GENERATED_SAMPLES,
size=(NUMBER_OF_GENERATED_SAMPLES, ))
random_other = np.random.randint(low=1, high=NUMBER_OF_GENERATED_SAMPLES,
size=(NUMBER_OF_GENERATED_SAMPLES, ))
data = np.hstack((random_listeners_id.reshape(-1, 1),
random_other.reshape(-1, 1)))
sql = """
INSERT INTO tests (ListenerId, Others)
VALUES (%s, %s)
"""
for row_index in tqdm(range(NUMBER_OF_GENERATED_SAMPLES)):
first, second = data[row_index]
db_cursor.execute(sql, (str(first), str(second)))
def insert_listeners_table(db_cursor):
np.random.seed(0xCAFFE)
first_names = np.array(['aaa', 'bbb', 'ccc'])
second_names = np.array(['ddd', 'eee', 'ggg', 'jjj'])
random_indexes_first = np.random.randint(low=0, high=first_names.shape[0],
size=(NUMBER_OF_GENERATED_SAMPLES, ))
random_indexes_second = np.random.randint(low=0, high=second_names.shape[0],
size=(NUMBER_OF_GENERATED_SAMPLES, ))
data = np.hstack((first_names[random_indexes_first].reshape(-1, 1),
second_names[random_indexes_second].reshape(-1, 1)))
sql = """
INSERT INTO listeners (FirstName, LastName)
VALUES (%s, %s)
"""
for row_index in tqdm(range(NUMBER_OF_GENERATED_SAMPLES)):
first_name, second_name = data[row_index]
db_cursor.execute(sql, (str(first_name), str(second_name)))
def select_with_join_and_where(db_cursor):
sql = """
SELECT *
FROM listeners as L
LEFT JOIN tests as T
ON T.ListenerId = L.ListenerId
WHERE FirstName like 'aaa'
"""
current_time = time()
db_cursor.execute(sql)
for _ in db_cursor:
pass
print('Time elapsed: %s sec' % (time() - current_time))
def main():
operation_list = [
('Create listeners table', create_listeners_table),
('Create tests table', create_tests_table),
('Inserting %d elements to listeners table' % NUMBER_OF_GENERATED_SAMPLES, insert_listeners_table),
('Inserting %d elements to tests table' % NUMBER_OF_GENERATED_SAMPLES, insert_tests_table),
('Selecting', select_with_join_and_where),
('Droping test', drop_test),
('Droping listeners', drop_listeners),
('Create listeners table with index', create_listeners_table_index),
('Create tests table with index', create_tests_table_index),
('Inserting %d elements to listeners table' % NUMBER_OF_GENERATED_SAMPLES, insert_listeners_table),
('Inserting %d elements to tests table' % NUMBER_OF_GENERATED_SAMPLES, insert_tests_table),
('Selecting', select_with_join_and_where),
('Droping test', drop_test),
('Droping listeners', drop_listeners),
]
connection = mysql.connector.connect(user='ALEXKIRNAS',
password='1234',
host='127.0.0.1',
database='database')
db_cursor = connection.cursor()
for name, function in operation_list:
print(name, end=':\n')
function(db_cursor)
connection.commit()
print("Finished")
db_cursor.close()
connection.close()
if __name__ == '__main__':
main() | {
"content_hash": "8270e949d22259445ca26bc37d57c78c",
"timestamp": "",
"source": "github",
"line_count": 178,
"max_line_length": 107,
"avg_line_length": 30.49438202247191,
"alnum_prop": 0.568349299926308,
"repo_name": "ALEXKIRNAS/KPI-Semester-5",
"id": "8af7594e15d018c1c9226781a36841709dcd9f87",
"size": "5428",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "DB/Lab_02/Lab_02.py",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C",
"bytes": "1634"
},
{
"name": "C++",
"bytes": "27482"
},
{
"name": "Common Lisp",
"bytes": "35779"
},
{
"name": "Java",
"bytes": "25992"
},
{
"name": "JavaScript",
"bytes": "2438"
},
{
"name": "PLSQL",
"bytes": "5394"
},
{
"name": "Prolog",
"bytes": "5042"
},
{
"name": "Python",
"bytes": "5428"
}
],
"symlink_target": ""
} |
class Base
{
public:
virtual int execute() = 0;
virtual void clean() = 0;
virtual ~Base() {};
};
#endif
| {
"content_hash": "e36291eb69d453daf3829cf05cb19994",
"timestamp": "",
"source": "github",
"line_count": 9,
"max_line_length": 34,
"avg_line_length": 14.777777777777779,
"alnum_prop": 0.49624060150375937,
"repo_name": "pgior001/rshell",
"id": "26b3b1e3f5f0297fc483839b6cf30d3f1fea1bb5",
"size": "259",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/Base.h",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "C++",
"bytes": "27129"
},
{
"name": "Makefile",
"bytes": "475"
},
{
"name": "Shell",
"bytes": "846"
}
],
"symlink_target": ""
} |
import pdb
import re
from collections import deque, defaultdict
from itertools import product
from .components import Pred
from .util import powerset
from delphin._exceptions import XmrsError
TOP = 'TOP'
class XmrsPathError(XmrsError): pass
class XmrsPath(object):
__slots__ = ('start', '_depth', '_distance', '_preds')
def __init__(self, startnode):
self.start = startnode
self.calculate_metrics()
def calculate_metrics(self):
self._distance = {}
self._depth = {}
self._preds = {}
self._calculate_metrics(self.start, 0, 0)
def _calculate_metrics(self, curnode, depth, distance):
if curnode is None:
return
# add pred index
try:
self._preds[curnode.pred].append(curnode)
except KeyError:
self._preds[curnode.pred] = []
self._preds[curnode.pred].append(curnode)
_id = id(curnode)
# we may re-update if we're on a shorter path
updated = False
if _id not in self._distance or distance < self._distance[_id]:
self._distance[_id] = distance
updated = True
if _id not in self._depth or abs(depth) < abs(self._depth[_id]):
self._depth[_id] = depth
updated = True
if not updated:
return
for link in curnode.links:
if link.endswith('>'):
self._calculate_metrics(curnode[link], depth+1, distance+1)
elif link.startswith('<'):
self._calculate_metrics(curnode[link], depth-1, distance+1)
else:
self._calculate_metrics(curnode[link], depth, distance+1)
def copy(self):
return XmrsPath(self.start.copy())
def distance(self, node=None):
if node is None:
return max(self._distance.values())
else:
return self._distance[id(node)]
def depth(self, node=None, direction=max):
if node is None:
return direction(self._depth.values())
return self._depth[id(node)]
def select(self, pred):
return self._preds.get(pred, [])
def find(self, pred):
if pred not in self._preds:
return []
return find(self.start, pred)
def follow(self, connectors):
node = self.start
connectors = list(reversed(connectors))
while connectors:
node = node[connectors.pop()]
return node
def extend(self, extents):
for connectors, extent in extents:
# the final connector may be new information
tgt = self.follow(connectors[:-1])
if connectors:
tgt.links.setdefault(
connectors[-1], XmrsPathNode(None, None)
)
tgt = tgt.links[connectors[-1]]
tgt.update(extent)
self.calculate_metrics()
class XmrsPathNode(object):
__slots__ = ('nodeid', 'pred', 'links')
def __init__(self, nodeid, pred, links=None):
self.nodeid = nodeid
self.pred = pred
self.links = dict(links or [])
def __getitem__(self, key):
return self.links[key]
def __iter__(self):
return iter(self.links.items())
def copy(self):
n = XmrsPathNode(self.nodeid, self.pred)
for connector, tgt in self.links.items():
n.links[connector] = tgt.copy() if tgt is not None else tgt
return n
def update(self, other):
self.nodeid = other.nodeid or self.nodeid
self.pred = other.pred or self.pred
for connector, tgt in other.links.items():
if not self.links.get(connector):
self.links[connector] = tgt
else:
self[connector].update(tgt)
# HELPER FUNCTIONS ##########################################################
def get_nodeids(path):
yield path.nodeid
for link, path_node in path:
if path_node is None:
continue
for nid in get_nodeids(path_node):
yield nid
def get_preds(path):
yield path.pred
for link, path_node in path:
if path_node is None:
continue
for pred in get_preds(path_node):
yield pred
def link_is_directed(link):
return bool(link.argname) or link.post != 'EQ'
def headed(connector):
# quantifiers and X/EQ links are not the heads of their subgraphs
if connector == '<RSTR/H:' or connector.endswith('/EQ:'):
return True
if (connector == ':RSTR/H>' or
connector.endswith('/EQ>') or
connector.startswith('<')):
return False
return True
def connector_sort(connector):
return (
not connector.endswith('>'), # forward links first
not connector.startswith('<'), # then backward, then undirected
not connector[1:].startswith('LBL'), # LBL before other args
connector[1:].startswith('BODY'), # BODY last
connector[1:] # otherwise alphabetical
)
# WRITING PATHS #############################################################
def format(node, sort_key=connector_sort, trailing_connectors='usually'):
if isinstance(node, XmrsPath):
node = node.start
return _format(
node, sort_key=sort_key, trailing_connectors=trailing_connectors
)
def _format(node, sort_key=connector_sort, trailing_connectors='usually'):
if node is None:
return ''
#if node.nodeid is not None:
# symbol = '#{}'.format(node.nodeid)
if node.pred is not None:
symbol = str(node.pred)
else:
symbol = '*'
links = []
connectors = node.links.keys()
if sort_key:
connectors = sorted(connectors, key=sort_key)
for conn in connectors:
tgt = node.links[conn]
if (tgt or
trailing_connectors == 'always' or
(trailing_connectors == 'usually' and conn != ':/EQ:') or
(trailing_connectors == 'forward' and conn.endswith('>')) or
(trailing_connectors == 'backward' and conn.startswith('<'))):
links.append(
'{}{}'.format(
conn,
_format(
tgt,
sort_key=sort_key,
trailing_connectors=trailing_connectors
)
)
)
if len(links) > 1:
subpath = '({})'.format(' & '.join(links))
else:
subpath = ''.join(links) # possibly just ''
return '{}{}'.format(symbol, subpath)
# FINDING PATHS #############################################################
def find_paths(
xmrs,
nodeids=None,
method='top-down',
allow_eq=False,
max_distance=-1):
if method not in ('top-down', 'bottom-up', 'headed'):
raise XmrsPathError("Invalid path-finding method: {}".format(method))
if nodeids is None: nodeids = [0] + xmrs.nodeids # 0 for TOP
links = _build_linkdict(xmrs, allow_eq)
paths = defaultdict(list)
for nid in nodeids:
if nid in paths: continue # maybe already visited in _find_paths
for path in _find_paths(
xmrs, nid, links, set(), method=method,
max_distance=max_distance):
paths[path.nodeid].append(XmrsPath(path))
for nid in nodeids:
for path in sorted(paths.get(nid, []), key=lambda p: p.distance()):
yield path
def _build_linkdict(xmrs, allow_eq):
links = defaultdict(dict)
for link in xmrs.links:
connector = '{}/{}'.format(link.argname or '', link.post)
if link_is_directed(link):
links[link.start][':{}>'.format(connector)] = link.end
links[link.end]['<{}:'.format(connector)] = link.start
elif allow_eq:
links[link.start][':{}:'.format(connector)] = link.end
#links[link.end][':{}:'.format(connector)] = link.start
return links
def _find_paths(
xmrs,
nodeid,
links,
seen,
method='top-down',
max_distance=-1):
if method not in ('top-down', 'bottom-up', 'headed'):
raise XmrsPathError("Invalid path-finding method: {}".format(method))
#if nodeid in seen # currently not working
if max_distance == 0: return None
seen.add(nodeid)
symbol = TOP if nodeid == 0 else xmrs.get_pred(nodeid)
local_links = links.get(nodeid, {})
connectors = _get_connectors(method, local_links)
# first just use the unfilled connectors if not TOP
if nodeid != 0:
yield XmrsPathNode(nodeid, symbol, links=connectors)
if connectors:
#pdb.set_trace()
subpaths = {}
for connector in connectors:
tgtnid = local_links[connector]
if tgtnid == 0:
subpaths[connector] = [XmrsPathNode(tgtnid, TOP)]
else:
subpaths[connector] = list(
_find_paths(
xmrs, tgtnid, links, seen, method=method,
max_distance=max_distance-1,
)
)
# beware of magic below:
# links maps a connector (like ARG1/NEQ) to a list of subpaths.
# This gets the product of subpaths for all connectors, then remaps
# the connector to the appropriate subpaths. E.g. if links is like
# {':ARG1/NEQ>': [def], ':ARG2/NEQ>': [ghi, jkl]} then lds is like
# [{':ARG1/NEQ>': def, 'ARG2/NEQ>': ghi},
# {':ARG1/NEQ>': def, 'ARG2/NEQ>': jkl}]
lds = map(
lambda z: dict(zip(subpaths.keys(), z)),
product(*subpaths.values())
)
for ld in lds:
yield XmrsPathNode(nodeid, symbol, links=ld)
def _get_connectors(method, links):
# top-down: :X/Y> or :X/Y: (the latter only if added)
if method == 'top-down':
return dict((c, None) for c in links if c.startswith(':'))
elif method == 'bottom-up':
return dict((c, None) for c in links if c.endswith(':'))
elif method == 'headed':
return dict((c, None) for c in links if headed(c))
# READING PATHS #############################################################
tokenizer = re.compile(
r'(?P<dq_string>"[^"\\]*(?:\\.[^"\\]*)*")' # quoted strings
r"|(?P<sq_string>'[^ \\]*(?:\\.[^ \\]*)*)" # single-quoted 'strings
r'|(?P<fwd_connector>:[^/]*/(?:EQ|NEQ|HEQ|H)>)' # :X/Y> connector
r'|(?P<bak_connector><[^/]*/(?:EQ|NEQ|HEQ|H):)' # <X/Y: connector
r'|(?P<und_connector>:[^/]*/(?:EQ|NEQ|HEQ|H):)' # :X/Y: connector
r'|(?P<symbol>[^\s*:/><@()\[\]=&|]+)' # non-breaking characters
r'|(?P<punc>[*()&|])' # meaningful punctuation
)
def read_path(path_string):
toks = deque((mo.lastgroup, mo.group())
for mo in tokenizer.finditer(path_string))
try:
startnode = _read_node(toks)
except IndexError:
raise XmrsPathError('Unexpected termination for path: {}'
.format(path_string))
if startnode is None:
raise XmrsPathError('Error reading path: {}'
.format(path_string))
elif toks:
raise XmrsPathError('Unconsumed tokens: {}'
.format(', '.join(tok[1] for tok in toks)))
path = XmrsPath(startnode)
return path
def _read_node(tokens):
if not tokens: return None
mtype, mtext = tokens.popleft()
if mtype in ('dq_string', 'sq_string', 'symbol'):
links = _read_links(tokens)
return XmrsPathNode(
None,
Pred.stringpred(mtext),
links
)
else:
tokens.appendleft((mtype, mtext)) # put it back
return None # current position isn't a path node
def _read_links(tokens):
if not tokens: return None
mtype, mtext = tokens.popleft()
if mtype in ('fwd_connector', 'bak_connector', 'und_connector'):
return {mtext: _read_node(tokens)}
elif mtext == '(':
links = {}
mtype, mtext = tokens.popleft()
while mtext != ')':
links[mtext] = _read_node(tokens)
mtype, mtext = tokens.popleft()
if mtext in ('&', '|'):
mtype, mtext = tokens.popleft()
elif mtext != ')':
raise XmrsPathError('Unexpected token: {}'.format(mtext))
return links
else:
tokens.appendleft((mtype, mtext)) # put it back
return None # not a link
# SEARCHING PATHS ###########################################################
def find(node, pred, connectors=[]):
matches = []
if node and node.pred == pred:
matches.append((connectors, node))
for connector, tgt in node.links.items():
if not tgt:
continue
for match in find(tgt, pred, connectors + [connector]):
matches.append(match)
return matches
def find_extents(node1, node2):
exts = []
for (connectors, first_node) in find(node1, node2.pred):
for (ext_connections, ext) in extents(first_node, node2):
exts.append((connectors + ext_connections, ext))
return exts
def extents(node1, node2):
assert node1.pred == node2.pred
exts = []
# if a constraint is violated, raise XmrsPathError
# if a constraint exists on node1 and node2, dive
# if one is on node1 but not node2, ignore
# if one is on node2 but not node1, return
for connector, tgt2 in node2.links.items():
if connector in node1.links:
tgt1 = node1.links[connector]
if tgt1.pred == tgt2.pred:
for connectors, ext in extents(tgt1, tgt2):
exts.append(([connector] + connectors, ext))
else:
raise XmrsPathError('Incompatible paths.')
else:
exts.append(([connector], tgt2))
return exts
| {
"content_hash": "b20abdf72bfdc3042cc8e9ff40deed7d",
"timestamp": "",
"source": "github",
"line_count": 421,
"max_line_length": 77,
"avg_line_length": 32.88598574821853,
"alnum_prop": 0.5482845792704948,
"repo_name": "dantiston/pydelphin",
"id": "6e74a46ae81f596b5f0976cb8e866b4191095df9",
"size": "13845",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "delphin/mrs/path.py",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Makefile",
"bytes": "6774"
},
{
"name": "Python",
"bytes": "250136"
},
{
"name": "Shell",
"bytes": "6707"
}
],
"symlink_target": ""
} |
// Copyright 1998-2015 Epic Games, Inc. All Rights Reserved.
/*=============================================================================
RHI.cpp: Render Hardware Interface implementation.
=============================================================================*/
#include "RHI.h"
#include "ModuleManager.h"
IMPLEMENT_MODULE(FDefaultModuleImpl, RHI);
/** RHI Logging. */
DEFINE_LOG_CATEGORY(LogRHI);
// Define counter stats.
DEFINE_STAT(STAT_RHIDrawPrimitiveCalls);
DEFINE_STAT(STAT_RHITriangles);
DEFINE_STAT(STAT_RHILines);
// Define memory stats.
DEFINE_STAT(STAT_RenderTargetMemory2D);
DEFINE_STAT(STAT_RenderTargetMemory3D);
DEFINE_STAT(STAT_RenderTargetMemoryCube);
DEFINE_STAT(STAT_TextureMemory2D);
DEFINE_STAT(STAT_TextureMemory3D);
DEFINE_STAT(STAT_TextureMemoryCube);
DEFINE_STAT(STAT_UniformBufferMemory);
DEFINE_STAT(STAT_IndexBufferMemory);
DEFINE_STAT(STAT_VertexBufferMemory);
DEFINE_STAT(STAT_StructuredBufferMemory);
DEFINE_STAT(STAT_PixelBufferMemory);
#if STATS
#include "StatsData.h"
static void DumpRHIMemory(FOutputDevice& OutputDevice)
{
TArray<FStatMessage> Stats;
GetPermanentStats(Stats);
FName NAME_STATGROUP_RHI(FStatGroup_STATGROUP_RHI::GetGroupName());
OutputDevice.Logf(TEXT("RHI resource memory (not tracked by our allocator)"));
int64 TotalMemory = 0;
for (int32 Index = 0; Index < Stats.Num(); Index++)
{
FStatMessage const& Meta = Stats[Index];
FName LastGroup = Meta.NameAndInfo.GetGroupName();
if (LastGroup == NAME_STATGROUP_RHI && Meta.NameAndInfo.GetFlag(EStatMetaFlags::IsMemory))
{
OutputDevice.Logf(TEXT("%s"), *FStatsUtils::DebugPrint(Meta));
TotalMemory += Meta.GetValue_int64();
}
}
OutputDevice.Logf(TEXT("%.3fMB total"), TotalMemory / 1024.f / 1024.f);
}
static FAutoConsoleCommandWithOutputDevice GDumpRHIMemoryCmd(
TEXT("rhi.DumpMemory"),
TEXT("Dumps RHI memory stats to the log"),
FConsoleCommandWithOutputDeviceDelegate::CreateStatic(DumpRHIMemory)
);
#endif
//DO NOT USE THE STATIC FLINEARCOLORS TO INITIALIZE THIS STUFF.
//Static init order is undefined and you will likely end up with bad values on some platforms.
const FClearValueBinding FClearValueBinding::None(EClearBinding::ENoneBound);
const FClearValueBinding FClearValueBinding::Black(FLinearColor(0.0f, 0.0f, 0.0f, 1.0f));
const FClearValueBinding FClearValueBinding::White(FLinearColor(1.0f, 1.0f, 1.0f, 1.0f));
const FClearValueBinding FClearValueBinding::Transparent(FLinearColor(0.0f, 0.0f, 0.0f, 0.0f));
const FClearValueBinding FClearValueBinding::DepthOne(1.0f, 0);
const FClearValueBinding FClearValueBinding::DepthZero(0.0f, 0);
const FClearValueBinding FClearValueBinding::DepthNear((float)ERHIZBuffer::NearPlane, 0);
const FClearValueBinding FClearValueBinding::DepthFar((float)ERHIZBuffer::FarPlane, 0);
TLockFreePointerList<FRHIResource> FRHIResource::PendingDeletes;
FRHIResource* FRHIResource::CurrentlyDeleting = nullptr;
#if !DISABLE_RHI_DEFFERED_DELETE
bool FRHIResource::Bypass()
{
return GRHICommandList.Bypass();
}
#endif
DECLARE_CYCLE_STAT(TEXT("Delete Resources"), STAT_DeleteResources, STATGROUP_RHICMDLIST);
void FRHIResource::FlushPendingDeletes()
{
SCOPE_CYCLE_COUNTER(STAT_DeleteResources);
check(IsInRenderingThread());
FRHICommandListExecutor::CheckNoOutstandingCmdLists();
FRHICommandListExecutor::GetImmediateCommandList().ImmediateFlush(EImmediateFlushType::FlushRHIThread);
while (1)
{
TArray<FRHIResource*> ToDelete;
PendingDeletes.PopAll(ToDelete);
if (!ToDelete.Num())
{
break;
}
for (int32 Index = 0; Index < ToDelete.Num(); Index++)
{
FRHIResource* Ref = ToDelete[Index];
check(Ref->MarkedForDelete == 1);
if (Ref->GetRefCount() == 0) // caches can bring dead objects back to life
{
CurrentlyDeleting = Ref;
delete Ref;
CurrentlyDeleting = nullptr;
}
else
{
Ref->MarkedForDelete = 0;
FPlatformMisc::MemoryBarrier();
}
}
}
}
static_assert(ERHIZBuffer::FarPlane != ERHIZBuffer::NearPlane, "Near and Far planes must be different!");
static_assert((int32)ERHIZBuffer::NearPlane == 0 || (int32)ERHIZBuffer::NearPlane == 1, "Invalid Values for Near Plane, can only be 0 or 1!");
static_assert((int32)ERHIZBuffer::FarPlane == 0 || (int32)ERHIZBuffer::FarPlane == 1, "Invalid Values for Far Plane, can only be 0 or 1");
/**
* RHI configuration settings.
*/
static TAutoConsoleVariable<int32> ResourceTableCachingCvar(
TEXT("rhi.ResourceTableCaching"),
1,
TEXT("If 1, the RHI will cache resource table contents within a frame. Otherwise resource tables are rebuilt for every draw call.")
);
static TAutoConsoleVariable<int32> GSaveScreenshotAfterProfilingGPUCVar(
TEXT("r.ProfileGPU.Screenshot"),
1,
TEXT("Whether a screenshot should be taken when profiling the GPU. 0:off, 1:on (default)"),
ECVF_RenderThreadSafe);
static TAutoConsoleVariable<int32> GShowProfilerAfterProfilingGPUCVar(
TEXT("r.ProfileGPU.ShowUI"),
1,
TEXT("Whether the user interface profiler should be displayed after profiling the GPU.\n")
TEXT("The results will always go to the log/console\n")
TEXT("0:off, 1:on (default)"),
ECVF_RenderThreadSafe);
static TAutoConsoleVariable<float> GGPUHitchThresholdCVar(
TEXT("RHI.GPUHitchThreshold"),
100.0f,
TEXT("Threshold for detecting hitches on the GPU (in milliseconds).")
);
namespace RHIConfig
{
bool ShouldSaveScreenshotAfterProfilingGPU()
{
return GSaveScreenshotAfterProfilingGPUCVar.GetValueOnAnyThread() != 0;
}
bool ShouldShowProfilerAfterProfilingGPU()
{
return GShowProfilerAfterProfilingGPUCVar.GetValueOnAnyThread() != 0;
}
float GetGPUHitchThreshold()
{
return GGPUHitchThresholdCVar.GetValueOnAnyThread() * 0.001f;
}
}
/**
* RHI globals.
*/
bool GIsRHIInitialized = false;
int32 GMaxTextureMipCount = MAX_TEXTURE_MIP_COUNT;
bool GSupportsQuadBufferStereo = false;
bool GSupportsDepthFetchDuringDepthTest = true;
FString GRHIAdapterName;
uint32 GRHIVendorId = 0;
bool GSupportsRenderDepthTargetableShaderResources = true;
bool GSupportsRenderTargetFormat_PF_G8 = true;
bool GSupportsRenderTargetFormat_PF_FloatRGBA = true;
bool GSupportsShaderFramebufferFetch = false;
bool GSupportsShaderDepthStencilFetch = false;
bool GHardwareHiddenSurfaceRemoval = false;
bool GRHISupportsAsyncTextureCreation = false;
bool GSupportsQuads = false;
bool GSupportsVolumeTextureRendering = true;
bool GSupportsSeparateRenderTargetBlendState = false;
bool GSupportsDepthRenderTargetWithoutColorRenderTarget = true;
float GMinClipZ = 0.0f;
float GProjectionSignY = 1.0f;
int32 GMaxShadowDepthBufferSizeX = 2048;
int32 GMaxShadowDepthBufferSizeY = 2048;
int32 GMaxTextureDimensions = 2048;
int32 GMaxCubeTextureDimensions = 2048;
int32 GMaxTextureArrayLayers = 256;
bool GUsingNullRHI = false;
int32 GDrawUPVertexCheckCount = MAX_int32;
int32 GDrawUPIndexCheckCount = MAX_int32;
bool GTriggerGPUProfile = false;
bool GRHISupportsTextureStreaming = false;
bool GSupportsDepthBoundsTest = false;
bool GRHISupportsBaseVertexIndex = true;
bool GRHISupportsFirstInstance = false;
bool GRHIRequiresEarlyBackBufferRenderTarget = true;
bool GRHISupportsRHIThread = false;
bool GRHISupportsParallelRHIExecute = false;
bool GSupportsHDR32bppEncodeModeIntrinsic = false;
/** Whether we are profiling GPU hitches. */
bool GTriggerGPUHitchProfile = false;
#if WITH_SLI
int32 GNumActiveGPUsForRendering = 1;
#endif
FVertexElementTypeSupportInfo GVertexElementTypeSupport;
RHI_API int32 volatile GCurrentTextureMemorySize = 0;
RHI_API int32 volatile GCurrentRendertargetMemorySize = 0;
RHI_API int64 GTexturePoolSize = 0 * 1024 * 1024;
RHI_API int32 GPoolSizeVRAMPercentage = 0;
RHI_API EShaderPlatform GShaderPlatformForFeatureLevel[ERHIFeatureLevel::Num] = {SP_NumPlatforms,SP_NumPlatforms,SP_NumPlatforms,SP_NumPlatforms};
RHI_API int32 GNumDrawCallsRHI = 0;
RHI_API int32 GNumPrimitivesDrawnRHI = 0;
/** Called once per frame only from within an RHI. */
void RHIPrivateBeginFrame()
{
GNumDrawCallsRHI = 0;
GNumPrimitivesDrawnRHI = 0;
}
//
// The current shader platform.
//
RHI_API EShaderPlatform GMaxRHIShaderPlatform = SP_PCD3D_SM5;
/** The maximum feature level supported on this machine */
RHI_API ERHIFeatureLevel::Type GMaxRHIFeatureLevel = ERHIFeatureLevel::SM5;
FName FeatureLevelNames[] =
{
FName(TEXT("ES2")),
FName(TEXT("ES3_1")),
FName(TEXT("SM4")),
FName(TEXT("SM5")),
};
static_assert(ARRAY_COUNT(FeatureLevelNames) == ERHIFeatureLevel::Num, "Missing entry from feature level names.");
RHI_API bool GetFeatureLevelFromName(FName Name, ERHIFeatureLevel::Type& OutFeatureLevel)
{
for (int32 NameIndex = 0; NameIndex < ARRAY_COUNT(FeatureLevelNames); NameIndex++)
{
if (FeatureLevelNames[NameIndex] == Name)
{
OutFeatureLevel = (ERHIFeatureLevel::Type)NameIndex;
return true;
}
}
OutFeatureLevel = ERHIFeatureLevel::Num;
return false;
}
RHI_API void GetFeatureLevelName(ERHIFeatureLevel::Type InFeatureLevel, FString& OutName)
{
check(InFeatureLevel < ARRAY_COUNT(FeatureLevelNames));
FeatureLevelNames[(int32)InFeatureLevel].ToString(OutName);
}
RHI_API void GetFeatureLevelName(ERHIFeatureLevel::Type InFeatureLevel, FName& OutName)
{
check(InFeatureLevel < ARRAY_COUNT(FeatureLevelNames));
OutName = FeatureLevelNames[(int32)InFeatureLevel];
}
static FName NAME_PCD3D_SM5(TEXT("PCD3D_SM5"));
static FName NAME_PCD3D_SM4(TEXT("PCD3D_SM4"));
static FName NAME_PCD3D_ES3_1(TEXT("PCD3D_ES31"));
static FName NAME_PCD3D_ES2(TEXT("PCD3D_ES2"));
static FName NAME_GLSL_150(TEXT("GLSL_150"));
static FName NAME_GLSL_150_MAC(TEXT("GLSL_150_MAC"));
static FName NAME_SF_PS4(TEXT("SF_PS4"));
static FName NAME_SF_XBOXONE(TEXT("SF_XBOXONE"));
static FName NAME_GLSL_430(TEXT("GLSL_430"));
static FName NAME_OPENGL_150_ES2(TEXT("GLSL_150_ES2"));
static FName NAME_OPENGL_150_ES2_NOUB(TEXT("GLSL_150_ES2_NOUB"));
static FName NAME_OPENGL_150_ES3_1(TEXT("GLSL_150_ES31"));
static FName NAME_OPENGL_ES2(TEXT("GLSL_ES2"));
static FName NAME_OPENGL_ES2_WEBGL(TEXT("GLSL_ES2_WEBGL"));
static FName NAME_OPENGL_ES2_IOS(TEXT("GLSL_ES2_IOS"));
static FName NAME_SF_METAL(TEXT("SF_METAL"));
static FName NAME_SF_METAL_MRT(TEXT("SF_METAL_MRT"));
static FName NAME_GLSL_310_ES_EXT(TEXT("GLSL_310_ES_EXT"));
static FName NAME_SF_METAL_SM5(TEXT("SF_METAL_SM5"));
static FName NAME_PC_VULKAN_ES2(TEXT("PC_VULKAN_ES2"));
FName LegacyShaderPlatformToShaderFormat(EShaderPlatform Platform)
{
switch(Platform)
{
case SP_PCD3D_SM5:
return NAME_PCD3D_SM5;
case SP_PCD3D_SM4:
return NAME_PCD3D_SM4;
case SP_PCD3D_ES3_1:
return NAME_PCD3D_ES3_1;
case SP_PCD3D_ES2:
return NAME_PCD3D_ES2;
case SP_OPENGL_SM4:
return NAME_GLSL_150;
case SP_OPENGL_SM4_MAC:
return NAME_GLSL_150_MAC;
case SP_PS4:
return NAME_SF_PS4;
case SP_XBOXONE:
return NAME_SF_XBOXONE;
case SP_OPENGL_SM5:
return NAME_GLSL_430;
case SP_OPENGL_PCES2:
{
static auto* CVar = IConsoleManager::Get().FindTConsoleVariableDataInt(TEXT("OpenGL.UseEmulatedUBs"));
return (CVar && CVar->GetValueOnAnyThread() != 0) ? NAME_OPENGL_150_ES2_NOUB : NAME_OPENGL_150_ES2;
}
case SP_OPENGL_PCES3_1:
return NAME_OPENGL_150_ES3_1;
case SP_OPENGL_ES2:
return NAME_OPENGL_ES2;
case SP_OPENGL_ES2_WEBGL:
return NAME_OPENGL_ES2_WEBGL;
case SP_OPENGL_ES2_IOS:
return NAME_OPENGL_ES2_IOS;
case SP_METAL:
return NAME_SF_METAL;
case SP_METAL_MRT:
return NAME_SF_METAL_MRT;
case SP_METAL_SM5:
return NAME_SF_METAL_SM5;
case SP_OPENGL_ES31_EXT:
return NAME_GLSL_310_ES_EXT;
case SP_VULKAN_ES2:
return NAME_PC_VULKAN_ES2;
default:
check(0);
return NAME_PCD3D_SM5;
}
}
EShaderPlatform ShaderFormatToLegacyShaderPlatform(FName ShaderFormat)
{
if (ShaderFormat == NAME_PCD3D_SM5) return SP_PCD3D_SM5;
if (ShaderFormat == NAME_PCD3D_SM4) return SP_PCD3D_SM4;
if (ShaderFormat == NAME_PCD3D_ES3_1) return SP_PCD3D_ES3_1;
if (ShaderFormat == NAME_PCD3D_ES2) return SP_PCD3D_ES2;
if (ShaderFormat == NAME_GLSL_150) return SP_OPENGL_SM4;
if (ShaderFormat == NAME_GLSL_150_MAC) return SP_OPENGL_SM4_MAC;
if (ShaderFormat == NAME_SF_PS4) return SP_PS4;
if (ShaderFormat == NAME_SF_XBOXONE) return SP_XBOXONE;
if (ShaderFormat == NAME_GLSL_430) return SP_OPENGL_SM5;
if (ShaderFormat == NAME_OPENGL_150_ES2 || ShaderFormat == NAME_OPENGL_150_ES2_NOUB)
return SP_OPENGL_PCES2;
if (ShaderFormat == NAME_OPENGL_150_ES3_1) return SP_OPENGL_PCES3_1;
if (ShaderFormat == NAME_OPENGL_ES2) return SP_OPENGL_ES2;
if (ShaderFormat == NAME_OPENGL_ES2_WEBGL) return SP_OPENGL_ES2_WEBGL;
if (ShaderFormat == NAME_OPENGL_ES2_IOS) return SP_OPENGL_ES2_IOS;
if (ShaderFormat == NAME_SF_METAL) return SP_METAL;
if (ShaderFormat == NAME_SF_METAL_MRT) return SP_METAL_MRT;
if (ShaderFormat == NAME_GLSL_310_ES_EXT) return SP_OPENGL_ES31_EXT;
if (ShaderFormat == NAME_SF_METAL_SM5) return SP_METAL_SM5;
if (ShaderFormat == NAME_PC_VULKAN_ES2) return SP_VULKAN_ES2;
return SP_NumPlatforms;
}
RHI_API bool IsRHIDeviceAMD()
{
check(GRHIVendorId != 0);
// AMD's drivers tested on July 11 2013 have hitching problems with async resource streaming, setting single threaded for now until fixed.
return GRHIVendorId == 0x1002;
}
RHI_API bool IsRHIDeviceIntel()
{
check(GRHIVendorId != 0);
// Intel GPUs are integrated and use both DedicatedVideoMemory and SharedSystemMemory.
// The hardware has fast clears so we disable exclude rects (see r.ClearWithExcludeRects)
return GRHIVendorId == 0x8086;
}
RHI_API bool IsRHIDeviceNVIDIA()
{
check(GRHIVendorId != 0);
// NVIDIA GPUs are discrete and use DedicatedVideoMemory only.
return GRHIVendorId == 0x10DE;
}
| {
"content_hash": "4ab90cd492d96de3cac5f18036fe8f63",
"timestamp": "",
"source": "github",
"line_count": 405,
"max_line_length": 146,
"avg_line_length": 33.43950617283951,
"alnum_prop": 0.7541903566418076,
"repo_name": "PopCap/GameIdea",
"id": "98870765f20e7538d3c40f65f50641cf5e41a911",
"size": "13543",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "Engine/Source/Runtime/RHI/Private/RHI.cpp",
"mode": "33188",
"license": "bsd-2-clause",
"language": [
{
"name": "ASP",
"bytes": "238055"
},
{
"name": "Assembly",
"bytes": "184134"
},
{
"name": "Batchfile",
"bytes": "116983"
},
{
"name": "C",
"bytes": "84264210"
},
{
"name": "C#",
"bytes": "9612596"
},
{
"name": "C++",
"bytes": "242290999"
},
{
"name": "CMake",
"bytes": "548754"
},
{
"name": "CSS",
"bytes": "134910"
},
{
"name": "GLSL",
"bytes": "96780"
},
{
"name": "HLSL",
"bytes": "124014"
},
{
"name": "HTML",
"bytes": "4097051"
},
{
"name": "Java",
"bytes": "757767"
},
{
"name": "JavaScript",
"bytes": "2742822"
},
{
"name": "Makefile",
"bytes": "1976144"
},
{
"name": "Objective-C",
"bytes": "75778979"
},
{
"name": "Objective-C++",
"bytes": "312592"
},
{
"name": "PAWN",
"bytes": "2029"
},
{
"name": "PHP",
"bytes": "10309"
},
{
"name": "PLSQL",
"bytes": "130426"
},
{
"name": "Pascal",
"bytes": "23662"
},
{
"name": "Perl",
"bytes": "218656"
},
{
"name": "Python",
"bytes": "21593012"
},
{
"name": "SAS",
"bytes": "1847"
},
{
"name": "Shell",
"bytes": "2889614"
},
{
"name": "Tcl",
"bytes": "1452"
}
],
"symlink_target": ""
} |
import { NgModule } from '@angular/core';
import { RouterModule, Routes } from '@angular/router';
import { FichesComponent } from './fiches.component';
import { FicheListComponent } from './fiche-list/fiche-list.component';
import { FicheDetailComponent } from './fiche-detail/fiche-detail.component';
import { FicheHomeComponent } from './fiche-home/fiche-home.component';
import { FicheAddComponent } from './fiche-add/fiche-add.component';
import { AUTHSVC_PROVIDERS } from '../services/auth.service';
import { LoggedInGuard } from '../logged-in.guard';
export const fichesRoutes: Routes = [
{
path: 'fiches',
component: FichesComponent,
canActivateChild: [ LoggedInGuard ],
children: [{
path: '',
component: FicheHomeComponent,
children: [
{
path: ':id/:uuid',
component: FicheDetailComponent
},
{
path: 'list',
component: FicheListComponent
},
{
path: 'add',
component: FicheAddComponent
}]
}
]
}
];
@NgModule({
imports: [
RouterModule.forChild(fichesRoutes)
],
exports: [
RouterModule
],
providers: []
})
export class FichesRoutingModule { }
| {
"content_hash": "ce6f79b14ce746f49b21c6a0da26ab00",
"timestamp": "",
"source": "github",
"line_count": 49,
"max_line_length": 77,
"avg_line_length": 25.020408163265305,
"alnum_prop": 0.6239804241435563,
"repo_name": "andres0sorio/CodeExperiments",
"id": "618e0a72ea2fe6667719a26c8f7cfa431b336d6e",
"size": "1406",
"binary": false,
"copies": "1",
"ref": "refs/heads/angular",
"path": "fichemgrfront/src/app/fiches/fiches-routing.module.ts",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "10613"
},
{
"name": "HTML",
"bytes": "17862"
},
{
"name": "JavaScript",
"bytes": "2913"
},
{
"name": "TypeScript",
"bytes": "63167"
}
],
"symlink_target": ""
} |
package org.apache.flink.table.planner.runtime.utils
import org.apache.flink.api.common.JobExecutionResult
import org.apache.flink.api.common.typeinfo.TypeInformation
import org.apache.flink.api.java.tuple.Tuple
import org.apache.flink.streaming.api.datastream.DataStream
import org.apache.flink.streaming.api.environment.StreamExecutionEnvironment
import org.apache.flink.streaming.api.graph.GlobalDataExchangeMode
import org.apache.flink.table.api._
import org.apache.flink.table.api.config.ExecutionConfigOptions._
import org.apache.flink.table.api.internal.TableEnvironmentImpl
import org.apache.flink.table.data.RowData
import org.apache.flink.table.data.binary.BinaryRowData
import org.apache.flink.table.data.writer.BinaryRowWriter
import org.apache.flink.table.functions.{AggregateFunction, ScalarFunction, TableFunction}
import org.apache.flink.table.planner.delegation.PlannerBase
import org.apache.flink.table.planner.factories.TestValuesTableFactory
import org.apache.flink.table.planner.plan.stats.FlinkStatistic
import org.apache.flink.table.planner.plan.utils.FlinkRelOptUtil
import org.apache.flink.table.planner.runtime.utils.BatchAbstractTestBase.DEFAULT_PARALLELISM
import org.apache.flink.table.planner.utils.{RowDataTestUtil, TableTestUtil, TestingTableEnvironment}
import org.apache.flink.table.runtime.typeutils.RowDataTypeInfo
import org.apache.flink.table.types.logical.{BigIntType, LogicalType}
import org.apache.flink.types.Row
import org.apache.flink.shaded.guava18.com.google.common.collect.Lists
import org.apache.calcite.rel.RelNode
import org.apache.calcite.runtime.CalciteContextException
import org.apache.calcite.sql.SqlExplainLevel
import org.apache.calcite.sql.parser.SqlParseException
import org.junit.Assert._
import org.junit.{After, Assert, Before}
import _root_.java.lang.{Iterable => JIterable}
import _root_.java.util.regex.Pattern
import _root_.scala.collection.JavaConverters._
import _root_.scala.collection.Seq
import _root_.scala.collection.mutable.ArrayBuffer
import _root_.scala.util.Sorting
class BatchTestBase extends BatchAbstractTestBase {
private val settings = EnvironmentSettings.newInstance().inBatchMode().build()
private val testingTableEnv: TestingTableEnvironment = TestingTableEnvironment
.create(settings, catalogManager = None, new TableConfig)
val tEnv: TableEnvironment = testingTableEnv
private val planner = tEnv.asInstanceOf[TableEnvironmentImpl].getPlanner.asInstanceOf[PlannerBase]
val env: StreamExecutionEnvironment = planner.getExecEnv
env.getConfig.enableObjectReuse()
val conf: TableConfig = tEnv.getConfig
val LINE_COL_PATTERN: Pattern = Pattern.compile("At line ([0-9]+), column ([0-9]+)")
val LINE_COL_TWICE_PATTERN: Pattern = Pattern.compile("(?s)From line ([0-9]+),"
+ " column ([0-9]+) to line ([0-9]+), column ([0-9]+): (.*)")
@Before
def before(): Unit = {
BatchTestBase.configForMiniCluster(conf)
}
@After
def after(): Unit = {
TestValuesTableFactory.clearAllData()
}
/**
* Explain ast tree nodes of table and the logical plan after optimization.
*
* @param table table to explain for
* @return string presentation of of explaining
*/
def explainLogical(table: Table): String = {
val ast = TableTestUtil.toRelNode(table)
val logicalPlan = getPlan(ast)
s"== Abstract Syntax Tree ==" +
System.lineSeparator +
s"${FlinkRelOptUtil.toString(ast)}" +
System.lineSeparator +
s"== Optimized Logical Plan ==" +
System.lineSeparator +
s"$logicalPlan"
}
def checkResult(sqlQuery: String, expectedResult: Seq[Row], isSorted: Boolean = false): Unit = {
check(sqlQuery, (result: Seq[Row]) => checkSame(expectedResult, result, isSorted))
}
def checkTableResult(table: Table, expectedResult: Seq[Row], isSorted: Boolean = false): Unit = {
checkTable(table, (result: Seq[Row]) => checkSame(expectedResult, result, isSorted))
}
def checkSize(sqlQuery: String, expectedSize: Int): Unit = {
check(sqlQuery, (result: Seq[Row]) => {
if (result.size != expectedSize) {
val errorMessage =
s"""
|Results
|${
sideBySide(
s"== Correct Result - $expectedSize ==" +:
prepareResult(Seq(), isSorted = false),
s"== Actual Result - ${result.size} ==" +:
prepareResult(result, isSorted = false)).mkString("\n")
}
""".stripMargin
Some(errorMessage)
} else None
})
}
private def getPlan(relNode: RelNode): String = {
val planner = tEnv.asInstanceOf[TableEnvironmentImpl].getPlanner.asInstanceOf[PlannerBase]
val optimized = planner.optimize(relNode)
FlinkRelOptUtil.toString(optimized, SqlExplainLevel.EXPPLAN_ATTRIBUTES)
}
def check(sqlQuery: String, checkFunc: Seq[Row] => Option[String]): Unit = {
val table = parseQuery(sqlQuery)
val result = executeQuery(table)
checkFunc(result).foreach { results =>
val plan = explainLogical(table)
Assert.fail(
s"""
|Results do not match for query:
| $sqlQuery
|$results
|Plan:
| $plan
""".stripMargin)
}
}
def checkTable(table: Table, checkFunc: Seq[Row] => Option[String]): Unit = {
val result = executeQuery(table)
checkFunc(result).foreach { results =>
val plan = explainLogical(table)
Assert.fail(
s"""
|Results do not match:
|$results
|Plan:
| $plan
""".stripMargin)
}
}
def checkFailed(sqlQuery: String, expectedMsgPattern: String): Unit = {
try {
val table = parseQuery(sqlQuery)
val _ = executeQuery(table)
// If got here, no exception is thrown.
if (expectedMsgPattern != null) {
throw new AssertionError(s"Expected query to throw exception, but it did not;"
+ s" query [$sqlQuery ];"
+ s" expected [$expectedMsgPattern]")
}
} catch {
case spe: SqlParserException =>
val errMsg = spe.getMessage
if (null == expectedMsgPattern) {
throw new RuntimeException(s"Error while parsing query: $sqlQuery", spe)
} else if (null == errMsg || !errMsg.matches(expectedMsgPattern)) {
throw new RuntimeException(s"Error did not match expected [$expectedMsgPattern] while "
+ s"parsing query [$sqlQuery]", spe)
}
case thrown: Throwable =>
var actualExp = thrown
var actualMsg = actualExp.getMessage
var actualLine = -1
var actualColumn = -1
var actualEndLine = 100
var actualEndColumn = 99
var ece: CalciteContextException = null
var spe: SqlParseException = null
var ex = actualExp
var found = false
while (null != ex && !found) {
ex match {
case ex1: CalciteContextException =>
ece = ex1
found = true
case ex2: Throwable if ex2.getCause == ex =>
found = true
case _ =>
ex = ex.getCause
}
}
ex = actualExp
found = false
while (null != ex && !found) {
ex match {
case ex1: SqlParseException if ex1.getPos != null =>
spe = ex1
found = true
case ex2: Throwable if ex2.getCause == ex =>
found = true
case _ =>
ex = ex.getCause
}
}
if (ece != null) {
actualLine = ece.getPosLine
actualColumn = ece.getPosColumn
actualEndLine = ece.getEndPosLine
actualEndColumn = ece.getEndPosColumn
if (ece.getCause != null) {
actualExp = ece.getCause
actualMsg = actualExp.getMessage
}
} else if (spe != null) {
actualLine = spe.getPos.getLineNum
actualColumn = spe.getPos.getColumnNum
actualEndLine = spe.getPos.getEndLineNum
actualEndColumn = spe.getPos.getEndColumnNum
if (spe.getCause != null) {
actualExp = spe.getCause
actualMsg = actualExp.getMessage
}
} else {
val message = actualMsg
if (message != null) {
var matcher = LINE_COL_TWICE_PATTERN.matcher(message)
if (matcher.matches) {
actualLine = matcher.group(1).toInt
actualColumn = matcher.group(2).toInt
actualEndLine = matcher.group(3).toInt
actualEndColumn = matcher.group(4).toInt
actualMsg = matcher.group(5)
}
else {
matcher = LINE_COL_PATTERN.matcher(message)
if (matcher.matches) {
actualLine = matcher.group(1).toInt
actualColumn = matcher.group(2).toInt
}
}
}
}
if (null == expectedMsgPattern) {
actualExp.printStackTrace()
fail(s"Validator threw unexpected exception; query [$sqlQuery];" +
s" exception [$actualMsg]; class [$actualExp.getClass];" +
s" pos [line $actualLine col $actualColumn thru line $actualLine col $actualColumn]")
}
if (actualMsg == null || !actualMsg.matches(expectedMsgPattern)) {
actualExp.printStackTrace()
fail(s"Validator threw different "
+ s"exception than expected; query [$sqlQuery];\n"
+ s" expected pattern [$expectedMsgPattern];\n"
+ s" actual [$actualMsg];\n"
+ s" pos [$actualLine"
+ s" col $actualColumn"
+ s" thru line $actualEndLine"
+ s" col $actualEndColumn].")
}
}
}
def checkEmptyResult(sqlQuery: String): Unit = {
val table = parseQuery(sqlQuery)
val result = executeQuery(table)
checkEmpty(result).foreach { results =>
Assert.fail(
s"""
|Results do not match for query:
|$results
""".stripMargin)
}
}
def parseQuery(sqlQuery: String): Table = tEnv.sqlQuery(sqlQuery)
def executeQuery(table: Table): Seq[Row] = Lists.newArrayList(table.execute().collect()).asScala
def executeQuery(sqlQuery: String): Seq[Row] = {
val table = parseQuery(sqlQuery)
executeQuery(table)
}
def execInsertSqlAndWaitResult(insert: String): JobExecutionResult = {
TableEnvUtil.execInsertSqlAndWaitResult(tEnv, insert)
}
def execInsertTableAndWaitResult(table: Table, targetPath: String): JobExecutionResult = {
TableEnvUtil.execInsertTableAndWaitResult(table, targetPath)
}
private def prepareResult(seq: Seq[Row], isSorted: Boolean): Seq[String] = {
if (!isSorted) seq.map(_.toString).sortBy(s => s) else seq.map(_.toString)
}
def checkSame(
expectedResult: Seq[Row],
result: Seq[Row],
isSorted: Boolean = false): Option[String] = {
if (expectedResult.size != result.size
|| !prepareResult(expectedResult, isSorted).equals(prepareResult(result, isSorted))) {
val errorMessage =
s"""
|Results
|${
sideBySide(
s"== Correct Result - ${expectedResult.size} ==" +:
prepareResult(expectedResult, isSorted),
s"== Actual Result - ${result.size} ==" +:
prepareResult(result, isSorted)).mkString("\n")
}
""".stripMargin
Some(errorMessage)
} else None
}
private def checkEmpty(result: Seq[Row]) = {
val expectedResult = Nil
checkSame(expectedResult, result, isSorted = true)
}
private def sideBySide(left: Seq[String], right: Seq[String]) = {
val maxLeftSize = left.map(_.length).max
val leftPadded = left ++ Seq.fill(math.max(right.size - left.size, 0))("")
val rightPadded = right ++ Seq.fill(math.max(left.size - right.size, 0))("")
leftPadded.zip(rightPadded).map {
case (l, r) =>
(if (l == r || l.startsWith("== Correct")) " " else "!") +
l + (" " * ((maxLeftSize - l.length) + 3)) + r
}
}
implicit def registerCollection(
tableName: String,
data: Iterable[Row],
typeInfo: TypeInformation[Row],
fields: String): Unit = {
BatchTableEnvUtil.registerCollection(tEnv, tableName, data, typeInfo, fields)
}
def registerJavaCollection[T](
tableName: String,
data: JIterable[T],
typeInfo: TypeInformation[T],
fields: String): Unit = {
BatchTableEnvUtil.registerCollection(tEnv, tableName, data.asScala, typeInfo, fields)
}
def registerCollection[T](
tableName: String,
data: Iterable[T],
typeInfo: TypeInformation[T],
fields: String,
fieldNullables: Array[Boolean]): Unit = {
BatchTableEnvUtil.registerCollection(
tEnv, tableName, data, typeInfo, fields, fieldNullables, None)
}
def registerCollection[T](
tableName: String,
data: Iterable[T],
typeInfo: TypeInformation[T],
fields: String,
fieldNullables: Array[Boolean],
statistic: FlinkStatistic): Unit = {
BatchTableEnvUtil.registerCollection(
tEnv, tableName, data, typeInfo, fields, fieldNullables, Some(statistic))
}
def registerFunction(name: String, function: ScalarFunction): Unit = {
testingTableEnv.registerFunction(name, function)
}
def registerFunction[T: TypeInformation, ACC: TypeInformation](
name: String,
f: AggregateFunction[T, ACC]): Unit = {
testingTableEnv.registerFunction(name, f)
}
def registerFunction[T: TypeInformation](name: String, tf: TableFunction[T]): Unit = {
testingTableEnv.registerFunction(name, tf)
}
def registerRange(name: String, end: Long): Unit = {
registerRange(name, 0, end)
}
def registerRange(name: String, start: Long, end: Long): Unit = {
BatchTableEnvUtil.registerBoundedStreamInternal(
tEnv, name, newRangeSource(start, end), Some[Array[String]](Array[String]("id")), None, None)
}
def newRangeSource(start: Long, end: Long): DataStream[RowData] = {
val typeInfo: TypeInformation[RowData] = new RowDataTypeInfo(new BigIntType)
val boundedStream = env.createInput(new RangeInputFormat(start, end), typeInfo)
boundedStream.setParallelism(1)
boundedStream
}
/**
* Creates a new Row and assigns the given values to the Row's fields.
* We use [[rowOf()]] here to avoid conflicts with [[ImplicitExpressionConversions.row]].
*/
protected def rowOf(args: Any*): Row = {
val row = new Row(args.length)
0 until args.length foreach {
i => row.setField(i, args(i))
}
row
}
}
object BatchTestBase {
def row(args: Any*): Row = {
val values = args.toArray
val row = new Row(values.length)
var i = 0
while (i < values.length) {
row.setField(i, values(i))
i += 1
}
row
}
def binaryRow(types: Array[LogicalType], fields: Any*): BinaryRowData = {
assertEquals(
"Filed count inconsistent with type information",
fields.length,
types.length)
val row = new BinaryRowData(fields.length)
val writer = new BinaryRowWriter(row)
writer.reset()
fields.zipWithIndex.foreach { case (field, index) =>
if (field == null) writer.setNullAt(index)
else RowDataTestUtil.write(writer, index, field, types(index))
}
writer.complete()
row
}
def compareResult[T](expectedStrings: Array[String],
result: Array[T],
sort: Boolean,
asTuples: Boolean = false): Unit = {
val resultStringsBuffer: ArrayBuffer[String] = new ArrayBuffer[String](result.length)
result.foreach { v =>
v match {
case t0: Tuple if asTuples =>
val first: Any = t0.getField(0)
val bld: StringBuilder = new StringBuilder(if (first == null) "null" else first.toString)
(1 until t0.getArity).foreach {
idx =>
val next = t0.getField(idx)
bld.append(',').append(if (next == null) "null" else next.toString)
resultStringsBuffer += bld.toString()
}
case _ =>
}
if (asTuples && !v.isInstanceOf[Tuple]) {
throw new IllegalArgumentException(v + " is no tuple")
}
if (!asTuples) {
resultStringsBuffer += (if (v == null) "null" else v.toString)
}
}
val resultStrings = resultStringsBuffer.toArray
if (sort) {
Sorting.quickSort(expectedStrings)
Sorting.quickSort(resultStrings)
}
val msg = s"Different elements in arrays: expected ${expectedStrings.length} elements " +
s"and received ${resultStrings.length}\n " +
s"expected: ${expectedStrings.mkString}\n " +
s"received: ${resultStrings.mkString}"
assertEquals(msg, expectedStrings.length, resultStrings.length)
expectedStrings.zip(resultStrings).foreach {
case (e, r) =>
assertEquals(msg, e, r)
}
}
def configForMiniCluster(conf: TableConfig): Unit = {
conf.getConfiguration.setInteger(TABLE_EXEC_RESOURCE_DEFAULT_PARALLELISM, DEFAULT_PARALLELISM)
conf.getConfiguration.setString(
TABLE_EXEC_SHUFFLE_MODE,
GlobalDataExchangeMode.ALL_EDGES_PIPELINED.toString)
}
}
| {
"content_hash": "2e9658f002c7ad091cdf0471bef5b490",
"timestamp": "",
"source": "github",
"line_count": 497,
"max_line_length": 101,
"avg_line_length": 34.70623742454728,
"alnum_prop": 0.6391674879703171,
"repo_name": "GJL/flink",
"id": "403a24002a381463f7b3038d2722b13767a068d4",
"size": "18054",
"binary": false,
"copies": "3",
"ref": "refs/heads/master",
"path": "flink-table/flink-table-planner-blink/src/test/scala/org/apache/flink/table/planner/runtime/utils/BatchTestBase.scala",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Batchfile",
"bytes": "4722"
},
{
"name": "CSS",
"bytes": "58149"
},
{
"name": "Clojure",
"bytes": "93247"
},
{
"name": "Dockerfile",
"bytes": "12142"
},
{
"name": "FreeMarker",
"bytes": "28662"
},
{
"name": "HTML",
"bytes": "108850"
},
{
"name": "Java",
"bytes": "53200856"
},
{
"name": "JavaScript",
"bytes": "1829"
},
{
"name": "Makefile",
"bytes": "5134"
},
{
"name": "Python",
"bytes": "1044728"
},
{
"name": "Scala",
"bytes": "13853249"
},
{
"name": "Shell",
"bytes": "530226"
},
{
"name": "TSQL",
"bytes": "123113"
},
{
"name": "TypeScript",
"bytes": "249103"
}
],
"symlink_target": ""
} |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.11"/>
<title>V8 API Reference Guide for node.js v5.12.0: Member List</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/javascript">
$(document).ready(function() { init_search(); });
</script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
<tbody>
<tr style="height: 56px;">
<td id="projectalign" style="padding-left: 0.5em;">
<div id="projectname">V8 API Reference Guide for node.js v5.12.0
</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.11 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
<div id="navrow1" class="tabs">
<ul class="tablist">
<li><a href="index.html"><span>Main Page</span></a></li>
<li><a href="namespaces.html"><span>Namespaces</span></a></li>
<li class="current"><a href="annotated.html"><span>Classes</span></a></li>
<li><a href="files.html"><span>Files</span></a></li>
<li><a href="examples.html"><span>Examples</span></a></li>
<li>
<div id="MSearchBox" class="MSearchBoxInactive">
<span class="left">
<img id="MSearchSelect" src="search/mag_sel.png"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
alt=""/>
<input type="text" id="MSearchField" value="Search" accesskey="S"
onfocus="searchBox.OnSearchFieldFocus(true)"
onblur="searchBox.OnSearchFieldFocus(false)"
onkeyup="searchBox.OnSearchFieldChange(event)"/>
</span><span class="right">
<a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
</span>
</div>
</li>
</ul>
</div>
<div id="navrow2" class="tabs2">
<ul class="tablist">
<li><a href="annotated.html"><span>Class List</span></a></li>
<li><a href="classes.html"><span>Class Index</span></a></li>
<li><a href="inherits.html"><span>Class Hierarchy</span></a></li>
<li><a href="functions.html"><span>Class Members</span></a></li>
</ul>
</div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>
<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0"
name="MSearchResults" id="MSearchResults">
</iframe>
</div>
<div id="nav-path" class="navpath">
<ul>
<li class="navelem"><a class="el" href="namespacev8.html">v8</a></li><li class="navelem"><a class="el" href="classv8_1_1CpuProfiler.html">CpuProfiler</a></li> </ul>
</div>
</div><!-- top -->
<div class="header">
<div class="headertitle">
<div class="title">v8::CpuProfiler Member List</div> </div>
</div><!--header-->
<div class="contents">
<p>This is the complete list of members for <a class="el" href="classv8_1_1CpuProfiler.html">v8::CpuProfiler</a>, including all inherited members.</p>
<table class="directory">
<tr class="even"><td class="entry"><a class="el" href="classv8_1_1CpuProfiler.html#a68e6da6f9ff4a0d3bde505f378a9a7fa">SetIdle</a>(bool is_idle)</td><td class="entry"><a class="el" href="classv8_1_1CpuProfiler.html">v8::CpuProfiler</a></td><td class="entry"></td></tr>
<tr><td class="entry"><a class="el" href="classv8_1_1CpuProfiler.html#ac5b05c72fb899e20adfa7f8cc57f21fb">SetSamplingInterval</a>(int us)</td><td class="entry"><a class="el" href="classv8_1_1CpuProfiler.html">v8::CpuProfiler</a></td><td class="entry"></td></tr>
<tr class="even"><td class="entry"><a class="el" href="classv8_1_1CpuProfiler.html#a7a9b75d3d7285d90344e1b8f14e97076">StartProfiling</a>(Local< String > title, bool record_samples=false)</td><td class="entry"><a class="el" href="classv8_1_1CpuProfiler.html">v8::CpuProfiler</a></td><td class="entry"></td></tr>
<tr><td class="entry"><a class="el" href="classv8_1_1CpuProfiler.html#a34acaa3b0e40cf2f92e9e6acb3fb5de7">StopProfiling</a>(Local< String > title)</td><td class="entry"><a class="el" href="classv8_1_1CpuProfiler.html">v8::CpuProfiler</a></td><td class="entry"></td></tr>
</table></div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated by  <a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.11
</small></address>
</body>
</html>
| {
"content_hash": "1405f175580ae80d56fb8674f04b64db",
"timestamp": "",
"source": "github",
"line_count": 110,
"max_line_length": 318,
"avg_line_length": 50.21818181818182,
"alnum_prop": 0.6596669080376538,
"repo_name": "v8-dox/v8-dox.github.io",
"id": "e863b82224f3b294f85e95ca410a0147619865c3",
"size": "5524",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "34b96c1/html/classv8_1_1CpuProfiler-members.html",
"mode": "33188",
"license": "mit",
"language": [],
"symlink_target": ""
} |
<div class="overlay hide" data-pages="search">
<!-- BEGIN Overlay Content !-->
<div class="overlay-content has-results m-t-20">
<!-- BEGIN Overlay Header !-->
<div class="container-fluid">
<!-- BEGIN Overlay Logo !-->
<img class="overlay-brand" src="assets/img/logo.png" alt="logo" data-src="assets/img/logo.png" data-src-retina="assets/img/logo_2x.png" width="78" height="22">
<!-- END Overlay Logo !-->
<!-- BEGIN Overlay Close !-->
<a href="#" class="close-icon-light overlay-close text-black fs-16">
<i class="pg-close"></i>
</a>
<!-- END Overlay Close !-->
</div>
<!-- END Overlay Header !-->
<div class="container-fluid">
<!-- BEGIN Overlay Controls !-->
<input id="overlay-search" class="no-border overlay-search bg-transparent" placeholder="Search..." autocomplete="off" spellcheck="false">
<br>
<div class="inline-block">
<div class="checkbox right">
<input id="checkboxn" type="checkbox" value="1" checked="checked">
<label for="checkboxn"><i class="fa fa-search"></i> Search within page</label>
</div>
</div>
<div class="inline-block m-l-10">
<p class="fs-13">Press enter to search</p>
</div>
<!-- END Overlay Controls !-->
</div>
<!-- BEGIN Overlay Search Results, This part is for demo purpose, you can add anything you like !-->
<div class="container-fluid">
<span>
<strong>suggestions :</strong>
</span>
<span id="overlay-suggestions"></span>
<br>
<div class="search-results m-t-40">
<p class="bold">Pages Search Results</p>
<div class="row">
<div class="col-md-6">
<!-- BEGIN Search Result Item !-->
<div class="">
<!-- BEGIN Search Result Item Thumbnail !-->
<div class="thumbnail-wrapper d48 circular bg-success text-white inline m-t-10">
<div>
<img width="50" height="50" src="assets/img/profiles/avatar.jpg" data-src="assets/img/profiles/avatar.jpg" data-src-retina="assets/img/profiles/avatar2x.jpg" alt="">
</div>
</div>
<!-- END Search Result Item Thumbnail !-->
<div class="p-l-10 inline p-t-5">
<h5 class="m-b-5"><span class="semi-bold result-name">ice cream</span> on pages</h5>
<p class="hint-text">via john smith</p>
</div>
</div>
<!-- END Search Result Item !-->
<!-- BEGIN Search Result Item !-->
<div class="">
<!-- BEGIN Search Result Item Thumbnail !-->
<div class="thumbnail-wrapper d48 circular bg-success text-white inline m-t-10">
<div>T</div>
</div>
<!-- END Search Result Item Thumbnail !-->
<div class="p-l-10 inline p-t-5">
<h5 class="m-b-5"><span class="semi-bold result-name">ice cream</span> related topics</h5>
<p class="hint-text">via pages</p>
</div>
</div>
<!-- END Search Result Item !-->
<!-- BEGIN Search Result Item !-->
<div class="">
<!-- BEGIN Search Result Item Thumbnail !-->
<div class="thumbnail-wrapper d48 circular bg-success text-white inline m-t-10">
<div><i class="fa fa-headphones large-text "></i>
</div>
</div>
<!-- END Search Result Item Thumbnail !-->
<div class="p-l-10 inline p-t-5">
<h5 class="m-b-5"><span class="semi-bold result-name">ice cream</span> music</h5>
<p class="hint-text">via pagesmix</p>
</div>
</div>
<!-- END Search Result Item !-->
</div>
<div class="col-md-6">
<!-- BEGIN Search Result Item !-->
<div class="">
<!-- BEGIN Search Result Item Thumbnail !-->
<div class="thumbnail-wrapper d48 circular bg-info text-white inline m-t-10">
<div><i class="fa fa-facebook large-text "></i>
</div>
</div>
<!-- END Search Result Item Thumbnail !-->
<div class="p-l-10 inline p-t-5">
<h5 class="m-b-5"><span class="semi-bold result-name">ice cream</span> on facebook</h5>
<p class="hint-text">via facebook</p>
</div>
</div>
<!-- END Search Result Item !-->
<!-- BEGIN Search Result Item !-->
<div class="">
<!-- BEGIN Search Result Item Thumbnail !-->
<div class="thumbnail-wrapper d48 circular bg-complete text-white inline m-t-10">
<div><i class="fa fa-twitter large-text "></i>
</div>
</div>
<!-- END Search Result Item Thumbnail !-->
<div class="p-l-10 inline p-t-5">
<h5 class="m-b-5">Tweats on<span class="semi-bold result-name"> ice cream</span></h5>
<p class="hint-text">via twitter</p>
</div>
</div>
<!-- END Search Result Item !-->
<!-- BEGIN Search Result Item !-->
<div class="">
<!-- BEGIN Search Result Item Thumbnail !-->
<div class="thumbnail-wrapper d48 circular text-white bg-danger inline m-t-10">
<div><i class="fa fa-google-plus large-text "></i>
</div>
</div>
<!-- END Search Result Item Thumbnail !-->
<div class="p-l-10 inline p-t-5">
<h5 class="m-b-5">Circles on<span class="semi-bold result-name"> ice cream</span></h5>
<p class="hint-text">via google plus</p>
</div>
</div>
<!-- END Search Result Item !-->
</div>
</div>
</div>
</div>
<!-- END Overlay Search Results !-->
</div>
<!-- END Overlay Content !-->
</div> | {
"content_hash": "e4d38398c2b40f47734b860b4379aa35",
"timestamp": "",
"source": "github",
"line_count": 135,
"max_line_length": 187,
"avg_line_length": 49.18518518518518,
"alnum_prop": 0.4599397590361446,
"repo_name": "farhanbashir/payment",
"id": "c1a444dd47879c79fbdbe49655f7fb6142212145",
"size": "6640",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "application/views/search.php",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "ApacheConf",
"bytes": "563"
},
{
"name": "CSS",
"bytes": "6150278"
},
{
"name": "HTML",
"bytes": "2295438"
},
{
"name": "JavaScript",
"bytes": "2601354"
},
{
"name": "PHP",
"bytes": "16570828"
},
{
"name": "Shell",
"bytes": "1490"
}
],
"symlink_target": ""
} |
"use strict";
(function() {
var BaseController = require("BaseController");
new BaseController({
siteName: "Naver Music",
playPause: ".player_controller .play",
playNext: ".player_controller .next",
playPrev: ".player_controller .prev",
mute: ".player_controller .volume",
playState: ".player_controller .play.is_paused",
song: ".info_song p:first-child span",
artist: ".info_artist .name",
art: ".player_cover img"
});
})();
| {
"content_hash": "439343c08d3fed08886e33122fe3f731",
"timestamp": "",
"source": "github",
"line_count": 17,
"max_line_length": 52,
"avg_line_length": 27.647058823529413,
"alnum_prop": 0.6425531914893617,
"repo_name": "nemchik/streamkeys",
"id": "b8bab18605e3996a5d9ef1730b09dfe34b75dc19",
"size": "470",
"binary": false,
"copies": "3",
"ref": "refs/heads/master",
"path": "code/js/controllers/NaverMusicController.js",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "16379"
},
{
"name": "HTML",
"bytes": "17690"
},
{
"name": "JavaScript",
"bytes": "191012"
},
{
"name": "Python",
"bytes": "22734"
}
],
"symlink_target": ""
} |
package org.fusesource.fabric.api;
import org.codehaus.jackson.annotate.JsonProperty;
import org.fusesource.fabric.api.jcip.Immutable;
import org.fusesource.fabric.api.jcip.ThreadSafe;
import java.io.File;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
import java.util.Set;
@Immutable
@ThreadSafe
public class CreateEnsembleOptions extends ContainerOptions {
public static final String AGENT_AUTOSTART = "agent.auto.start";
public static final String ENSEMBLE_AUTOSTART = "ensemble.auto.start";
public static final String PROFILES_AUTOIMPORT = "profiles.auto.import";
public static final String PROFILES_AUTOIMPORT_PATH = "profiles.auto.import.path";
public static final String DEFAULT_IMPORT_PATH = System.getProperty("karaf.home", ".") + File.separatorChar + "fabric" + File.separatorChar + "import";
public static final String ZOOKEEPER_PASSWORD = "zookeeper.password";
public static String ZOOKEEPER_SERVER_PORT = "zookeeper.server.port";
public static String ZOOKEEPER_SERVER_CONNECTION_PORT = "zookeeper.server.connection.port";
public static final String ROLE_DELIMITER = ",";
public static final long DEFAULT_MIGRATION_TIMEOUT = 120000L;
@JsonProperty
final int zooKeeperServerPort;
@JsonProperty
final int zooKeeperServerConnectionPort;
@JsonProperty
final String zookeeperPassword;
@JsonProperty
final boolean ensembleStart;
@JsonProperty
final boolean agentEnabled;
@JsonProperty
final boolean waitForProvision;
@JsonProperty
final long provisionTimeout;
@JsonProperty
final long migrationTimeout;
@JsonProperty
final boolean autoImportEnabled;
@JsonProperty
final String importPath;
@JsonProperty
final Map<String, String> users; // keep immutable
public static Builder<? extends Builder> builder() {
return new Builder<Builder>();
}
CreateEnsembleOptions(String bindAddress, String resolver, String globalResolver, String manualIp, int minimumPort, int maximumPort, Set<String> profiles, String version, Map<String, String> dataStoreProperties, int zooKeeperServerPort, int zooKeeperServerConnectionPort, String zookeeperPassword, boolean ensembleStart, boolean agentEnabled, boolean waitForProvision, long provisionTimeout, long migrationTimeout, boolean autoImportEnabled, String importPath, Map<String, String> users) {
super(bindAddress, resolver, globalResolver, manualIp, minimumPort, maximumPort, profiles, version, dataStoreProperties);
this.zooKeeperServerPort = zooKeeperServerPort;
this.zooKeeperServerConnectionPort = zooKeeperServerConnectionPort;
this.zookeeperPassword = zookeeperPassword;
this.ensembleStart = ensembleStart;
this.agentEnabled = agentEnabled;
this.waitForProvision = waitForProvision;
this.provisionTimeout = provisionTimeout;
this.migrationTimeout = migrationTimeout;
this.autoImportEnabled = autoImportEnabled;
this.importPath = importPath;
this.users = Collections.unmodifiableMap(new HashMap<String, String>(users));
}
public int getZooKeeperServerPort() {
return zooKeeperServerPort;
}
public int getZooKeeperServerConnectionPort() {
return zooKeeperServerConnectionPort;
}
public String getZookeeperPassword() {
return zookeeperPassword;
}
public boolean isEnsembleStart() {
return ensembleStart;
}
public boolean isAgentEnabled() {
return agentEnabled;
}
public boolean isAutoImportEnabled() {
return autoImportEnabled;
}
public String getImportPath() {
return importPath;
}
public Map<String, String> getUsers() {
return users;
}
public boolean isWaitForProvision() {
return waitForProvision;
}
public long getProvisionTimeout() {
return provisionTimeout;
}
public long getMigrationTimeout() {
return migrationTimeout;
}
@Override
public String toString() {
return super.toString() + " CreateEnsembleOptions{" +
"zooKeeperServerPort=" + zooKeeperServerPort +
", zookeeperPassword='" + zookeeperPassword + '\'' +
", agentEnabled=" + agentEnabled +
", autoImportEnabled=" + autoImportEnabled +
", importPath='" + importPath + '\'' +
", users=" + users +
'}';
}
public static class Builder<B extends Builder> extends ContainerOptions.Builder<B> {
@JsonProperty
int zooKeeperServerPort = 2181;
@JsonProperty
int zooKeeperServerConnectionPort = 2181;
@JsonProperty
String zookeeperPassword = generatePassword();
@JsonProperty
boolean ensembleStart = false;
@JsonProperty
boolean agentEnabled = true;
@JsonProperty
boolean waitForProvision = true;
@JsonProperty
long provisionTimeout = 120000L;
@JsonProperty
long migrationTimeout = DEFAULT_MIGRATION_TIMEOUT;
@JsonProperty
boolean autoImportEnabled = true;
@JsonProperty
String importPath = DEFAULT_IMPORT_PATH;
@JsonProperty
Map<String, String> users = new HashMap<String, String>();
@Override
public B fromSystemProperties() {
super.fromSystemProperties();
this.ensembleStart = Boolean.parseBoolean(System.getProperty(ENSEMBLE_AUTOSTART, "false"));
this.agentEnabled = Boolean.parseBoolean(System.getProperty(AGENT_AUTOSTART, "false"));
this.zookeeperPassword = System.getProperty(ZOOKEEPER_PASSWORD, generatePassword());
this.zooKeeperServerPort = Integer.parseInt(System.getProperty(ZOOKEEPER_SERVER_PORT, "2181"));
this.zooKeeperServerConnectionPort = Integer.parseInt(System.getProperty(ZOOKEEPER_SERVER_CONNECTION_PORT, "2181"));
this.importPath = System.getProperty(PROFILES_AUTOIMPORT_PATH, DEFAULT_IMPORT_PATH);
this.autoImportEnabled = Boolean.parseBoolean(System.getProperty(PROFILES_AUTOIMPORT, "true"));
return (B) this;
}
public B zooKeeperServerPort(int zooKeeperServerPort) {
this.zooKeeperServerPort = zooKeeperServerPort;
return (B) this;
}
public B zooKeeperServerPort(Integer zooKeeperServerPort) {
this.zooKeeperServerPort = zooKeeperServerPort;
return (B) this;
}
public B zooKeeperServerPort(Long zooKeeperServerPort) {
this.zooKeeperServerConnectionPort = zooKeeperServerPort.intValue();
return (B) this;
}
public B zooKeeperServerConnectionPort(int zooKeeperServerConnectionPort) {
this.zooKeeperServerConnectionPort = zooKeeperServerConnectionPort;
return (B) this;
}
public B zooKeeperServerConnectionPort(Integer zooKeeperServerConnectionPort) {
this.zooKeeperServerConnectionPort = zooKeeperServerConnectionPort;
return (B) this;
}
public B zooKeeperServerConnectionPort(Long zooKeeperServerConnectionPort) {
this.zooKeeperServerConnectionPort = zooKeeperServerConnectionPort.intValue();
return (B) this;
}
public B zookeeperPassword(final String zookeeperPassword) {
this.zookeeperPassword = zookeeperPassword;
return (B) this;
}
public B users(final Map<String, String> users) {
this.users = users;
return (B) this;
}
public B withUser(String user, String password, String role) {
this.users.put(user, password + ROLE_DELIMITER + role);
return (B) this;
}
public B ensembleStart(boolean ensembleStart) {
this.ensembleStart = ensembleStart;
return (B) this;
}
public B agentEnabled(boolean agentEnabled) {
this.agentEnabled = agentEnabled;
return (B) this;
}
public B agentEnabled(Boolean agentEnabled) {
this.agentEnabled = agentEnabled;
return (B) this;
}
public B autoImportEnabled(boolean autoImportEnabled) {
this.autoImportEnabled = autoImportEnabled;
return (B) this;
}
public B autoImportEnabled(Boolean autoImportEnabled) {
this.autoImportEnabled = autoImportEnabled;
return (B) this;
}
public B migrationTimeout(final long migrationTimeout) {
this.migrationTimeout = migrationTimeout;
return (B) this;
}
public B provisionTimeout(final long provisionTimeout) {
this.provisionTimeout = provisionTimeout;
return (B) this;
}
public B waitForProvision(final boolean waitForProvision) {
this.waitForProvision = waitForProvision;
return (B) this;
}
public B importPath(final String importPath) {
this.importPath = importPath;
return (B) this;
}
public void setZooKeeperServerPort(int zooKeeperServerPort) {
this.zooKeeperServerPort = zooKeeperServerPort;
}
public void setZookeeperPassword(String zookeeperPassword) {
this.zookeeperPassword = zookeeperPassword;
}
public void setEnsembleStart(boolean ensembleStart) {
this.ensembleStart = ensembleStart;
}
public void setAgentEnabled(boolean agentEnabled) {
this.agentEnabled = agentEnabled;
}
public void setAutoImportEnabled(boolean autoImportEnabled) {
this.autoImportEnabled = autoImportEnabled;
}
public void setImportPath(String importPath) {
this.importPath = importPath;
}
public void setUsers(Map<String, String> users) {
this.users = users;
}
public void setWaitForProvision(boolean waitForProvision) {
this.waitForProvision = waitForProvision;
}
public void setProvisionTimeout(long provisionTimeout) {
this.provisionTimeout = provisionTimeout;
}
public int getZooKeeperServerPort() {
return zooKeeperServerPort;
}
public int getZooKeeperServerConnectionPort() {
return zooKeeperServerConnectionPort;
}
public String getZookeeperPassword() {
return zookeeperPassword;
}
public boolean isEnsembleStart() {
return ensembleStart;
}
public boolean isAgentEnabled() {
return agentEnabled;
}
public boolean isAutoImportEnabled() {
return autoImportEnabled;
}
public String getImportPath() {
return importPath;
}
public Map<String, String> getUsers() {
return users;
}
public boolean isWaitForProvision() {
return waitForProvision;
}
public long getProvisionTimeout() {
return provisionTimeout;
}
/**
* Generate a random String that can be used as a Zookeeper password.
*
* @return
*/
private static String generatePassword() {
StringBuilder password = new StringBuilder();
for (int i = 0; i < 16; i++) {
long l = Math.round(Math.floor(Math.random() * (26 * 2 + 10)));
if (l < 10) {
password.append((char) ('0' + l));
} else if (l < 36) {
password.append((char) ('A' + l - 10));
} else {
password.append((char) ('a' + l - 36));
}
}
return password.toString();
}
public CreateEnsembleOptions build() {
return new CreateEnsembleOptions(bindAddress, resolver, globalResolver, manualIp, minimumPort, maximumPort, profiles, version, dataStoreProperties, zooKeeperServerPort, zooKeeperServerConnectionPort, zookeeperPassword, ensembleStart, agentEnabled, waitForProvision, provisionTimeout, migrationTimeout, autoImportEnabled, importPath, users);
}
}
}
| {
"content_hash": "bbf4445ada373335e73c2cc752d4ef7a",
"timestamp": "",
"source": "github",
"line_count": 358,
"max_line_length": 493,
"avg_line_length": 34.729050279329606,
"alnum_prop": 0.645700957130218,
"repo_name": "gnodet/fuse",
"id": "fab012e049baf327afd40bd6c50742ab99c0fed9",
"size": "13056",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "fabric/fabric-api/src/main/java/org/fusesource/fabric/api/CreateEnsembleOptions.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "CSS",
"bytes": "345444"
},
{
"name": "CoffeeScript",
"bytes": "278706"
},
{
"name": "Java",
"bytes": "7881745"
},
{
"name": "JavaScript",
"bytes": "2481282"
},
{
"name": "Kotlin",
"bytes": "14362"
},
{
"name": "Scala",
"bytes": "484463"
},
{
"name": "Shell",
"bytes": "21380"
},
{
"name": "XSLT",
"bytes": "26098"
}
],
"symlink_target": ""
} |
<?php
namespace selvinortiz\doxter\common\parsers;
use function selvinortiz\doxter\doxter;
/**
* The base parser that all other parsers must extend
*
* Class DoxterBaseParser
*
* @package Craft
*/
abstract class BaseParser
{
/**
* @var object The parser instance which should be defined in each extending class
*/
protected static $_instance;
/**
* Returns an instance of the class in called static context
*
* @return BaseParser|Toc|Markdown|ReferenceTag|Shortcode|CodeBlock|Header|Object
*/
public static function instance()
{
if (null === static::$_instance) {
static::$_instance = new static;
}
return static::$_instance;
}
/**
* Reports whether the source string can be safely parsed
*
* @param mixed $source
*
* @return bool
*/
public function canBeSafelyParsed($source = null)
{
return doxter()->api->canBeSafelyParsed($source);
}
/**
* Must be implemented by all extending parsers
*
* @param string $source
* @param array $options
*
* @return mixed
*/
abstract public function parse($source, array $options = []);
}
| {
"content_hash": "13db137e19f0f8596c1502e24e15c6b3",
"timestamp": "",
"source": "github",
"line_count": 55,
"max_line_length": 86,
"avg_line_length": 22.254545454545454,
"alnum_prop": 0.6127450980392157,
"repo_name": "selvinortiz/doxter",
"id": "a6b4645715fb02448cc46e045819fff3064cdb55",
"size": "1224",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "src/common/parsers/BaseParser.php",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "HTML",
"bytes": "2292"
},
{
"name": "PHP",
"bytes": "43668"
}
],
"symlink_target": ""
} |
export GREP_OPTIONS='--color=auto'
# Prevent less from clearing the screen while still showing colors.
export LESS=-XR
# Set the terminal's title bar.
function titlebar() {
echo -n $'\e]0;'"$*"$'\a'
}
# SSH auto-completion based on entries in known_hosts.
# if [[ -e ~/.ssh/known_hosts ]]; then
# complete -o default -W "$(cat ~/.ssh/known_hosts | sed 's/[, ].*//' | sort | uniq | grep -v '[0-9]')" ssh scp sftp
# fi
# Disable ansible cows }:]
export ANSIBLE_NOCOWS=1
| {
"content_hash": "a78f7212f15f15bdaede61e65c7198e1",
"timestamp": "",
"source": "github",
"line_count": 17,
"max_line_length": 118,
"avg_line_length": 28,
"alnum_prop": 0.6407563025210085,
"repo_name": "coopermaruyama/dotfiles-cowboy",
"id": "badb0ecc3bf9e833af7b07a45210fe9f4aadb080",
"size": "685",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "source/50_misc.sh",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "514"
},
{
"name": "Erlang",
"bytes": "423"
},
{
"name": "JavaScript",
"bytes": "43854"
},
{
"name": "Perl",
"bytes": "8914"
},
{
"name": "Python",
"bytes": "1697"
},
{
"name": "Ruby",
"bytes": "8372"
},
{
"name": "Shell",
"bytes": "71376"
},
{
"name": "VimL",
"bytes": "123963"
}
],
"symlink_target": ""
} |
import os
import sys
sys.path.insert(0, os.path.abspath('../..'))
# -- General configuration ----------------------------------------------------
# Add any Sphinx extension module names here, as strings. They can be
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
extensions = [
'sphinx.ext.autodoc',
# 'sphinx.ext.intersphinx',
# 'oslo.sphinx'
]
# autodoc generation is a bit aggressive and a nuisance when doing heavy
# text edit cycles.
# execute "export SPHINX_DEBUG=1" in your terminal to disable
# The suffix of source filenames.
source_suffix = '.rst'
# The master toctree document.
master_doc = 'index'
# General information about the project.
project = u'openstack-doc-tools'
copyright = u'2014, OpenStack Foundation'
# If true, '()' will be appended to :func: etc. cross-reference text.
add_function_parentheses = True
# If true, the current module name will be prepended to all description
# unit titles (such as .. function::).
add_module_names = True
# The name of the Pygments (syntax highlighting) style to use.
pygments_style = 'sphinx'
# -- Options for HTML output --------------------------------------------------
# The theme to use for HTML and HTML Help pages. Major themes that come with
# Sphinx are currently 'default' and 'sphinxdoc'.
# html_theme_path = ["."]
# html_theme = '_theme'
# html_static_path = ['static']
# Output file base name for HTML help builder.
htmlhelp_basename = '%sdoc' % project
# Grouping the document tree into LaTeX files. List of tuples
# (source start file, target name, title, author, documentclass
# [howto/manual]).
latex_documents = [
('index',
'%s.tex' % project,
u'%s Documentation' % project,
u'OpenStack Foundation', 'manual'),
]
# Example configuration for intersphinx: refer to the Python standard library.
# intersphinx_mapping = {'http://docs.python.org/': None}
# -- Options for manual page output -------------------------------------------
# One entry per manual page. List of tuples
# (source start file, name, description, authors, manual section).
man_pages = [
('man/openstack-doc-test', 'openstack-doc-test',
u'OpenStack documentation tools',
[u'OpenStack'], 1)
]
# If true, show URL addresses after external links.
# man_show_urls = False
| {
"content_hash": "538e5cedfce9bb1013f8a963b83f0250",
"timestamp": "",
"source": "github",
"line_count": 74,
"max_line_length": 79,
"avg_line_length": 31.135135135135137,
"alnum_prop": 0.6614583333333334,
"repo_name": "savinash47/openstack-doc-tools",
"id": "fe666ad0ca2d880cc943ccc097adfa18f25f2c9f",
"size": "2850",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "doc/source/conf.py",
"mode": "33261",
"license": "apache-2.0",
"language": [
{
"name": "Python",
"bytes": "253365"
},
{
"name": "Ruby",
"bytes": "1868"
},
{
"name": "Shell",
"bytes": "25163"
},
{
"name": "XSLT",
"bytes": "955"
}
],
"symlink_target": ""
} |
require("fs").readdirSync("./vendor").forEach(function(name){
require.paths.unshift("./vendor/" + name + "/lib");
});
require.paths.unshift("./lib");
module.exports = require("./lib/juggernaut");
| {
"content_hash": "d2c5be87968df2f501b6df7934887147",
"timestamp": "",
"source": "github",
"line_count": 7,
"max_line_length": 61,
"avg_line_length": 28.857142857142858,
"alnum_prop": 0.6534653465346535,
"repo_name": "brianloveswords/juggernaut",
"id": "08bdffa433208f0b13f207f90012b00b81e22974",
"size": "202",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "index.js",
"mode": "33188",
"license": "mit",
"language": [],
"symlink_target": ""
} |
declare module "it-map" {
function map<I, O>(input: AsyncIterable<I>, f: (input: I) => O): AsyncIterable<O>
export default map
} | {
"content_hash": "8559e50843c753c7e681b8a9540cfeea",
"timestamp": "",
"source": "github",
"line_count": 4,
"max_line_length": 83,
"avg_line_length": 33,
"alnum_prop": 0.6666666666666666,
"repo_name": "ipfs/webui",
"id": "3cb73a2dc84f58eeb6e463000ac90fe82dc970cd",
"size": "132",
"binary": false,
"copies": "1",
"ref": "refs/heads/feat/1482-settings",
"path": "@types/it-map/index.d.ts",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "822363"
},
{
"name": "HTML",
"bytes": "8167"
},
{
"name": "JavaScript",
"bytes": "10503778"
},
{
"name": "Shell",
"bytes": "309"
}
],
"symlink_target": ""
} |
ACCEPTED
#### According to
The Catalogue of Life, 3rd January 2011
#### Published in
null
#### Original name
null
### Remarks
null | {
"content_hash": "535f72658ef3646ef0721c226232d1ed",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 39,
"avg_line_length": 10.307692307692308,
"alnum_prop": 0.6940298507462687,
"repo_name": "mdoering/backbone",
"id": "29961e94ccda45ebe6bccc7d9f11782c7e42679e",
"size": "186",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "life/Plantae/Magnoliophyta/Magnoliopsida/Gentianales/Rubiaceae/Galium/Galium amblyophyllum/README.md",
"mode": "33188",
"license": "apache-2.0",
"language": [],
"symlink_target": ""
} |
<?php
session_start();
?>
<html>
<head>
<!-- I USE BOOTSTRAP BECAUSE IT MAKES FORMATTING/LIFE EASIER -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css"><!-- Latest compiled and minified CSS -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap-theme.min.css"><!-- Optional theme -->
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script><!-- Latest compiled and minified JavaScript -->
<title>Pick Champ Data Management System</title>
</head>
<body>
<table width="1359" border="0">
<tr>
<td colspan="2"><img src="PICK-CHAMP-HEADER.jpg" width="1260" height="240" /></td>
</tr>
<tr>
<td width="220" height="38" bgcolor="#000000"><div align="center"><a href="http://pickchamp.co/" rel="home"><font size="4" color="LawnGreen"><strong>Pick Champ</strong></font></a></div></td>
<td width="919" bgcolor="#000000"><div align="right">
<form action="<?=$_SERVER['PHP_SELF']?>" method="POST">
<a href="pick.php" class="btn btn-success">MAIN</a>
<a href="nfl.php" class="btn btn-success">NFL</a>
<a href="nhl.php" class="btn btn-success">NHL</a>
<a href="mlb.php" class="btn btn-success">MLB</a>
<input class=" btn btn-success" type="submit" name="logout" value="Logout"/>
<a href="password.php" class="btn btn-success">Change passward</a>
</form>
</div></td>
</tr>
<tr>
<td height="362" bgcolor="#000000"> </td>
<td>
<div class="container">
<?php
if($_SESSION['islogin']!='1')
{
header("Location: index.php");
exit;
}
echo $_SESSION['username'];
if(isset($_POST['logout']))
{
$link = mysqli_connect("#","#","#","#") or die ("Connection Error " . mysqli_error($link));
date_default_timezone_set("America/Chicago");
$time2=date('Y-m-d H:i:s');
$query2='UPDATE logins SET time_of_logout="' . $time2 . '" WHERE userName = "' . $_SESSION['username'].'";';
$query3='UPDATE logins SET logoutTimes=logoutTimes+1 WHERE userName = "' . $_SESSION['username'].'";';
mysqli_query($link, $query2);
mysqli_query($link, $query3);
// remove all session variables
session_unset();
// destroy the session
session_destroy();
//echo 'You logged out!';
header("Location: index.php");
}
?>
<br>NHL PICKS</br>
<br><a href="nhl_w5.php" class="btn btn-success">WEEK5</a></br>
<br><a href="nhl_w6.php" class="btn btn-success">WEEK6</a></br>
<br><a href="nhl_w7.php" class="btn btn-success">WEEK7</a></br>
</td>
</tr>
</table>
</body>
</html>
| {
"content_hash": "b517db68840ea9c79fdf3ae8da326417",
"timestamp": "",
"source": "github",
"line_count": 91,
"max_line_length": 194,
"avg_line_length": 31.582417582417584,
"alnum_prop": 0.5633263743910926,
"repo_name": "MaddenMark1495/PickChamp",
"id": "00c4f936862de044bbf7f007d175225b9ece5de2",
"size": "2874",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "nhl.php",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "JavaScript",
"bytes": "1982"
},
{
"name": "PHP",
"bytes": "102880"
}
],
"symlink_target": ""
} |
const firebase = require('firebase')
if (process.env.dev) {
require('dotenv').config()
}
const { apiKey, databaseURL } = process.env
firebase.initializeApp({ apiKey, databaseURL })
const database = firebase.database()
const authenticate = token => {
const credential = firebase.auth.GithubAuthProvider.credential(token)
return firebase
.auth()
.signInWithCredential(credential)
.catch(error => console.log(error))
}
const logout = () => firebase.auth().signOut()
const set = (repo, sha, values, token) => {
authenticate(token)
const ref = `${token}/${repo}`
values.sha = sha
firebase.database().ref(ref).push(values)
logout()
}
const get = (repo, token) => {
authenticate(token)
const ref = `${token}/${repo}`
return firebase
.database()
.ref(ref)
.limitToLast(1)
.once('value')
.then(snapshot => {
return snapshot.val() || {}
})
logout()
}
module.exports = { set, get }
| {
"content_hash": "5e19fcefa1408dc583b5ad381046be3f",
"timestamp": "",
"source": "github",
"line_count": 45,
"max_line_length": 71,
"avg_line_length": 21.022222222222222,
"alnum_prop": 0.6448202959830867,
"repo_name": "siddharthkp/perfbench",
"id": "c69b9e89f17e8a1dbda13c9b44c3a97c1c24fc1f",
"size": "946",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "store/firebase.js",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "1329"
},
{
"name": "HTML",
"bytes": "2891"
},
{
"name": "JavaScript",
"bytes": "16263"
}
],
"symlink_target": ""
} |
// Copyright 2014 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
//go:generate go run maketables.go -output tables.go
// Package display provides display names for languages, scripts and regions in
// a requested language.
//
// The data is based on CLDR's localeDisplayNames. It includes the names of the
// draft level "contributed" or "approved". The resulting tables are quite
// large. The display package is designed so that users can reduce the linked-in
// table sizes by cherry picking the languages one wishes to support. There is a
// Dictionary defined for a selected set of common languages for this purpose.
package display // import "golang.org/x/text/language/display"
import (
"strings"
"golang.org/x/text/language"
)
/*
TODO:
All fairly low priority at the moment:
- Include alternative and variants as an option (using func options).
- Option for returning the empty string for undefined values.
- Support variants, currencies, time zones, option names and other data
provided in CLDR.
- Do various optimizations:
- Reduce size of offset tables.
- Consider compressing infrequently used languages and decompress on demand.
*/
// A Namer is used to get the name for a given value, such as a Tag, Language,
// Script or Region.
type Namer interface {
// Name returns a display string for the given value. A Namer returns an
// empty string for values it does not support. A Namer may support naming
// an unspecified value. For example, when getting the name for a region for
// a tag that does not have a defined Region, it may return the name for an
// unknown region. It is up to the user to filter calls to Name for values
// for which one does not want to have a name string.
Name(x interface{}) string
}
var (
// Supported lists the languages for which names are defined.
Supported language.Coverage
// The set of all possible values for which names are defined. Note that not
// all Namer implementations will cover all the values of a given type.
// A Namer will return the empty string for unsupported values.
Values language.Coverage
matcher language.Matcher
)
func init() {
tags := make([]language.Tag, numSupported)
s := supported
for i := range tags {
p := strings.IndexByte(s, '|')
tags[i] = language.Raw.Make(s[:p])
s = s[p+1:]
}
matcher = language.NewMatcher(tags)
Supported = language.NewCoverage(tags)
Values = language.NewCoverage(langTagSet.Tags, supportedScripts, supportedRegions)
}
// Languages returns a Namer for naming languages. It returns nil if there is no
// data for the given tag. The type passed to Name must be either language.Base
// or language.Tag. Note that the result may differ between passing a tag or its
// base language. For example, for English, passing "nl-BE" would return Flemish
// whereas passing "nl" returns "Dutch".
func Languages(t language.Tag) Namer {
if _, index, conf := matcher.Match(t); conf != language.No {
return languageNamer(index)
}
return nil
}
type languageNamer int
func (n languageNamer) name(i int) string {
return lookup(langHeaders[:], int(n), i)
}
// Name implements the Namer interface for language names.
func (n languageNamer) Name(x interface{}) string {
return nameLanguage(n, x)
}
// nonEmptyIndex walks up the parent chain until a non-empty header is found.
// It returns -1 if no index could be found.
func nonEmptyIndex(h []header, index int) int {
for ; index != -1 && h[index].data == ""; index = int(parents[index]) {
}
return index
}
// Scripts returns a Namer for naming scripts. It returns nil if there is no
// data for the given tag. The type passed to Name must be either a
// language.Script or a language.Tag. It will not attempt to infer a script for
// tags with an unspecified script.
func Scripts(t language.Tag) Namer {
if _, index, conf := matcher.Match(t); conf != language.No {
if index = nonEmptyIndex(scriptHeaders[:], index); index != -1 {
return scriptNamer(index)
}
}
return nil
}
type scriptNamer int
func (n scriptNamer) name(i int) string {
return lookup(scriptHeaders[:], int(n), i)
}
// Name implements the Namer interface for script names.
func (n scriptNamer) Name(x interface{}) string {
return nameScript(n, x)
}
// Regions returns a Namer for naming regions. It returns nil if there is no
// data for the given tag. The type passed to Name must be either a
// language.Region or a language.Tag. It will not attempt to infer a region for
// tags with an unspecified region.
func Regions(t language.Tag) Namer {
if _, index, conf := matcher.Match(t); conf != language.No {
if index = nonEmptyIndex(regionHeaders[:], index); index != -1 {
return regionNamer(index)
}
}
return nil
}
type regionNamer int
func (n regionNamer) name(i int) string {
return lookup(regionHeaders[:], int(n), i)
}
// Name implements the Namer interface for region names.
func (n regionNamer) Name(x interface{}) string {
return nameRegion(n, x)
}
// Tags returns a Namer for giving a full description of a tag. The names of
// scripts and regions that are not already implied by the language name will
// in appended within parentheses. It returns nil if there is not data for the
// given tag. The type passed to Name must be a tag.
func Tags(t language.Tag) Namer {
if _, index, conf := matcher.Match(t); conf != language.No {
return tagNamer(index)
}
return nil
}
type tagNamer int
// Name implements the Namer interface for tag names.
func (n tagNamer) Name(x interface{}) string {
return nameTag(languageNamer(n), scriptNamer(n), regionNamer(n), x)
}
// lookup finds the name for an entry in a global table, traversing the
// inheritance hierarchy if needed.
func lookup(table []header, dict, want int) string {
for dict != -1 {
if s := table[dict].name(want); s != "" {
return s
}
dict = int(parents[dict])
}
return ""
}
// A Dictionary holds a collection of Namers for a single language. One can
// reduce the amount of data linked in to a binary by only referencing
// Dictionaries for the languages one needs to support instead of using the
// generic Namer factories.
type Dictionary struct {
parent *Dictionary
lang header
script header
region header
}
// Tags returns a Namer for giving a full description of a tag. The names of
// scripts and regions that are not already implied by the language name will
// in appended within parentheses. It returns nil if there is not data for the
// given tag. The type passed to Name must be a tag.
func (d *Dictionary) Tags() Namer {
return dictTags{d}
}
type dictTags struct {
d *Dictionary
}
// Name implements the Namer interface for tag names.
func (n dictTags) Name(x interface{}) string {
return nameTag(dictLanguages{n.d}, dictScripts{n.d}, dictRegions{n.d}, x)
}
// Languages returns a Namer for naming languages. It returns nil if there is no
// data for the given tag. The type passed to Name must be either language.Base
// or language.Tag. Note that the result may differ between passing a tag or its
// base language. For example, for English, passing "nl-BE" would return Flemish
// whereas passing "nl" returns "Dutch".
func (d *Dictionary) Languages() Namer {
return dictLanguages{d}
}
type dictLanguages struct {
d *Dictionary
}
func (n dictLanguages) name(i int) string {
for d := n.d; d != nil; d = d.parent {
if s := d.lang.name(i); s != "" {
return s
}
}
return ""
}
// Name implements the Namer interface for language names.
func (n dictLanguages) Name(x interface{}) string {
return nameLanguage(n, x)
}
// Scripts returns a Namer for naming scripts. It returns nil if there is no
// data for the given tag. The type passed to Name must be either a
// language.Script or a language.Tag. It will not attempt to infer a script for
// tags with an unspecified script.
func (d *Dictionary) Scripts() Namer {
return dictScripts{d}
}
type dictScripts struct {
d *Dictionary
}
func (n dictScripts) name(i int) string {
for d := n.d; d != nil; d = d.parent {
if s := d.script.name(i); s != "" {
return s
}
}
return ""
}
// Name implements the Namer interface for script names.
func (n dictScripts) Name(x interface{}) string {
return nameScript(n, x)
}
// Regions returns a Namer for naming regions. It returns nil if there is no
// data for the given tag. The type passed to Name must be either a
// language.Region or a language.Tag. It will not attempt to infer a region for
// tags with an unspecified region.
func (d *Dictionary) Regions() Namer {
return dictRegions{d}
}
type dictRegions struct {
d *Dictionary
}
func (n dictRegions) name(i int) string {
for d := n.d; d != nil; d = d.parent {
if s := d.region.name(i); s != "" {
return s
}
}
return ""
}
// Name implements the Namer interface for region names.
func (n dictRegions) Name(x interface{}) string {
return nameRegion(n, x)
}
// A SelfNamer implements a Namer that returns the name of language in this same
// language. It provides a very compact mechanism to provide a comprehensive
// list of languages to users in their native language.
type SelfNamer struct {
// Supported defines the values supported by this Namer.
Supported language.Coverage
}
var (
// Self is a shared instance of a SelfNamer.
Self *SelfNamer = &self
self = SelfNamer{language.NewCoverage(selfTagSet.Tags)}
)
// Name returns the name of a given language tag in the language identified by
// this tag. It supports both the language.Base and language.Tag types.
func (n SelfNamer) Name(x interface{}) string {
t, _ := language.All.Compose(x)
base, scr, reg := t.Raw()
baseScript := language.Script{}
if (scr == language.Script{} && reg != language.Region{}) {
// For looking up in the self dictionary, we need to select the
// maximized script. This is even the case if the script isn't
// specified.
s1, _ := t.Script()
if baseScript = getScript(base); baseScript != s1 {
scr = s1
}
}
i, scr, reg := selfTagSet.index(base, scr, reg)
if i == -1 {
return ""
}
// Only return the display name if the script matches the expected script.
if (scr != language.Script{}) {
if (baseScript == language.Script{}) {
baseScript = getScript(base)
}
if baseScript != scr {
return ""
}
}
return selfHeaders[0].name(i)
}
// getScript returns the maximized script for a base language.
func getScript(b language.Base) language.Script {
tag, _ := language.Raw.Compose(b)
scr, _ := tag.Script()
return scr
}
| {
"content_hash": "c5a50d9b5dc98c848fe3bdf5e4923295",
"timestamp": "",
"source": "github",
"line_count": 343,
"max_line_length": 83,
"avg_line_length": 31.75801749271137,
"alnum_prop": 0.692004039291288,
"repo_name": "glutwins/pholcus",
"id": "ec62972276cc3aacfb6f8a6202e8af023faae582",
"size": "10893",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "vendor/golang.org/x/text/language/display/display.go",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "CSS",
"bytes": "4157"
},
{
"name": "Go",
"bytes": "268366"
},
{
"name": "HTML",
"bytes": "5634"
},
{
"name": "JavaScript",
"bytes": "18954"
}
],
"symlink_target": ""
} |
package io.reactivex.internal.operators.observable;
import static org.junit.Assert.*;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.Mockito.*;
import java.util.*;
import java.util.concurrent.*;
import java.util.concurrent.atomic.AtomicInteger;
import org.junit.*;
import io.reactivex.*;
import io.reactivex.Observable;
import io.reactivex.Observer;
import io.reactivex.disposables.*;
import io.reactivex.exceptions.*;
import io.reactivex.functions.*;
import io.reactivex.internal.functions.Functions;
import io.reactivex.observers.TestObserver;
import io.reactivex.plugins.RxJavaPlugins;
import io.reactivex.schedulers.Schedulers;
import io.reactivex.subjects.*;
public class ObservableFlatMapTest {
@Test
public void testNormal() {
Observer<Object> o = TestHelper.mockObserver();
final List<Integer> list = Arrays.asList(1, 2, 3);
Function<Integer, List<Integer>> func = new Function<Integer, List<Integer>>() {
@Override
public List<Integer> apply(Integer t1) {
return list;
}
};
BiFunction<Integer, Integer, Integer> resFunc = new BiFunction<Integer, Integer, Integer>() {
@Override
public Integer apply(Integer t1, Integer t2) {
return t1 | t2;
}
};
List<Integer> source = Arrays.asList(16, 32, 64);
Observable.fromIterable(source).flatMapIterable(func, resFunc).subscribe(o);
for (Integer s : source) {
for (Integer v : list) {
verify(o).onNext(s | v);
}
}
verify(o).onComplete();
verify(o, never()).onError(any(Throwable.class));
}
@Test
public void testCollectionFunctionThrows() {
Observer<Object> o = TestHelper.mockObserver();
Function<Integer, List<Integer>> func = new Function<Integer, List<Integer>>() {
@Override
public List<Integer> apply(Integer t1) {
throw new TestException();
}
};
BiFunction<Integer, Integer, Integer> resFunc = new BiFunction<Integer, Integer, Integer>() {
@Override
public Integer apply(Integer t1, Integer t2) {
return t1 | t2;
}
};
List<Integer> source = Arrays.asList(16, 32, 64);
Observable.fromIterable(source).flatMapIterable(func, resFunc).subscribe(o);
verify(o, never()).onComplete();
verify(o, never()).onNext(any());
verify(o).onError(any(TestException.class));
}
@Test
public void testResultFunctionThrows() {
Observer<Object> o = TestHelper.mockObserver();
final List<Integer> list = Arrays.asList(1, 2, 3);
Function<Integer, List<Integer>> func = new Function<Integer, List<Integer>>() {
@Override
public List<Integer> apply(Integer t1) {
return list;
}
};
BiFunction<Integer, Integer, Integer> resFunc = new BiFunction<Integer, Integer, Integer>() {
@Override
public Integer apply(Integer t1, Integer t2) {
throw new TestException();
}
};
List<Integer> source = Arrays.asList(16, 32, 64);
Observable.fromIterable(source).flatMapIterable(func, resFunc).subscribe(o);
verify(o, never()).onComplete();
verify(o, never()).onNext(any());
verify(o).onError(any(TestException.class));
}
@Test
public void testMergeError() {
Observer<Object> o = TestHelper.mockObserver();
Function<Integer, Observable<Integer>> func = new Function<Integer, Observable<Integer>>() {
@Override
public Observable<Integer> apply(Integer t1) {
return Observable.error(new TestException());
}
};
BiFunction<Integer, Integer, Integer> resFunc = new BiFunction<Integer, Integer, Integer>() {
@Override
public Integer apply(Integer t1, Integer t2) {
return t1 | t2;
}
};
List<Integer> source = Arrays.asList(16, 32, 64);
Observable.fromIterable(source).flatMap(func, resFunc).subscribe(o);
verify(o, never()).onComplete();
verify(o, never()).onNext(any());
verify(o).onError(any(TestException.class));
}
<T, R> Function<T, R> just(final R value) {
return new Function<T, R>() {
@Override
public R apply(T t1) {
return value;
}
};
}
<R> Callable<R> just0(final R value) {
return new Callable<R>() {
@Override
public R call() {
return value;
}
};
}
@Test
public void testFlatMapTransformsNormal() {
Observable<Integer> onNext = Observable.fromIterable(Arrays.asList(1, 2, 3));
Observable<Integer> onComplete = Observable.fromIterable(Arrays.asList(4));
Observable<Integer> onError = Observable.fromIterable(Arrays.asList(5));
Observable<Integer> source = Observable.fromIterable(Arrays.asList(10, 20, 30));
Observer<Object> o = TestHelper.mockObserver();
source.flatMap(just(onNext), just(onError), just0(onComplete)).subscribe(o);
verify(o, times(3)).onNext(1);
verify(o, times(3)).onNext(2);
verify(o, times(3)).onNext(3);
verify(o).onNext(4);
verify(o).onComplete();
verify(o, never()).onNext(5);
verify(o, never()).onError(any(Throwable.class));
}
@Test
public void testFlatMapTransformsException() {
Observable<Integer> onNext = Observable.fromIterable(Arrays.asList(1, 2, 3));
Observable<Integer> onComplete = Observable.fromIterable(Arrays.asList(4));
Observable<Integer> onError = Observable.fromIterable(Arrays.asList(5));
Observable<Integer> source = Observable.concat(
Observable.fromIterable(Arrays.asList(10, 20, 30)),
Observable.<Integer> error(new RuntimeException("Forced failure!"))
);
Observer<Object> o = TestHelper.mockObserver();
source.flatMap(just(onNext), just(onError), just0(onComplete)).subscribe(o);
verify(o, times(3)).onNext(1);
verify(o, times(3)).onNext(2);
verify(o, times(3)).onNext(3);
verify(o).onNext(5);
verify(o).onComplete();
verify(o, never()).onNext(4);
verify(o, never()).onError(any(Throwable.class));
}
<R> Callable<R> funcThrow0(R r) {
return new Callable<R>() {
@Override
public R call() {
throw new TestException();
}
};
}
<T, R> Function<T, R> funcThrow(T t, R r) {
return new Function<T, R>() {
@Override
public R apply(T t) {
throw new TestException();
}
};
}
@Test
public void testFlatMapTransformsOnNextFuncThrows() {
Observable<Integer> onComplete = Observable.fromIterable(Arrays.asList(4));
Observable<Integer> onError = Observable.fromIterable(Arrays.asList(5));
Observable<Integer> source = Observable.fromIterable(Arrays.asList(10, 20, 30));
Observer<Object> o = TestHelper.mockObserver();
source.flatMap(funcThrow(1, onError), just(onError), just0(onComplete)).subscribe(o);
verify(o).onError(any(TestException.class));
verify(o, never()).onNext(any());
verify(o, never()).onComplete();
}
@Test
public void testFlatMapTransformsOnErrorFuncThrows() {
Observable<Integer> onNext = Observable.fromIterable(Arrays.asList(1, 2, 3));
Observable<Integer> onComplete = Observable.fromIterable(Arrays.asList(4));
Observable<Integer> onError = Observable.fromIterable(Arrays.asList(5));
Observable<Integer> source = Observable.error(new TestException());
Observer<Object> o = TestHelper.mockObserver();
source.flatMap(just(onNext), funcThrow((Throwable) null, onError), just0(onComplete)).subscribe(o);
verify(o).onError(any(CompositeException.class));
verify(o, never()).onNext(any());
verify(o, never()).onComplete();
}
@Test
public void testFlatMapTransformsOnCompletedFuncThrows() {
Observable<Integer> onNext = Observable.fromIterable(Arrays.asList(1, 2, 3));
Observable<Integer> onComplete = Observable.fromIterable(Arrays.asList(4));
Observable<Integer> onError = Observable.fromIterable(Arrays.asList(5));
Observable<Integer> source = Observable.fromIterable(Arrays.<Integer> asList());
Observer<Object> o = TestHelper.mockObserver();
source.flatMap(just(onNext), just(onError), funcThrow0(onComplete)).subscribe(o);
verify(o).onError(any(TestException.class));
verify(o, never()).onNext(any());
verify(o, never()).onComplete();
}
@Test
public void testFlatMapTransformsMergeException() {
Observable<Integer> onNext = Observable.error(new TestException());
Observable<Integer> onComplete = Observable.fromIterable(Arrays.asList(4));
Observable<Integer> onError = Observable.fromIterable(Arrays.asList(5));
Observable<Integer> source = Observable.fromIterable(Arrays.asList(10, 20, 30));
Observer<Object> o = TestHelper.mockObserver();
source.flatMap(just(onNext), just(onError), funcThrow0(onComplete)).subscribe(o);
verify(o).onError(any(TestException.class));
verify(o, never()).onNext(any());
verify(o, never()).onComplete();
}
private static <T> Observable<T> composer(Observable<T> source, final AtomicInteger subscriptionCount, final int m) {
return source.doOnSubscribe(new Consumer<Disposable>() {
@Override
public void accept(Disposable d) {
int n = subscriptionCount.getAndIncrement();
if (n >= m) {
Assert.fail("Too many subscriptions! " + (n + 1));
}
}
}).doOnComplete(new Action() {
@Override
public void run() {
int n = subscriptionCount.decrementAndGet();
if (n < 0) {
Assert.fail("Too many unsubscriptions! " + (n - 1));
}
}
});
}
@Test
public void testFlatMapMaxConcurrent() {
final int m = 4;
final AtomicInteger subscriptionCount = new AtomicInteger();
Observable<Integer> source = Observable.range(1, 10)
.flatMap(new Function<Integer, Observable<Integer>>() {
@Override
public Observable<Integer> apply(Integer t1) {
return composer(Observable.range(t1 * 10, 2), subscriptionCount, m)
.subscribeOn(Schedulers.computation());
}
}, m);
TestObserver<Integer> to = new TestObserver<Integer>();
source.subscribe(to);
to.awaitTerminalEvent();
to.assertNoErrors();
Set<Integer> expected = new HashSet<Integer>(Arrays.asList(
10, 11, 20, 21, 30, 31, 40, 41, 50, 51, 60, 61, 70, 71, 80, 81, 90, 91, 100, 101
));
Assert.assertEquals(expected.size(), to.valueCount());
Assert.assertTrue(expected.containsAll(to.values()));
}
@Test
public void testFlatMapSelectorMaxConcurrent() {
final int m = 4;
final AtomicInteger subscriptionCount = new AtomicInteger();
Observable<Integer> source = Observable.range(1, 10)
.flatMap(new Function<Integer, Observable<Integer>>() {
@Override
public Observable<Integer> apply(Integer t1) {
return composer(Observable.range(t1 * 10, 2), subscriptionCount, m)
.subscribeOn(Schedulers.computation());
}
}, new BiFunction<Integer, Integer, Integer>() {
@Override
public Integer apply(Integer t1, Integer t2) {
return t1 * 1000 + t2;
}
}, m);
TestObserver<Integer> to = new TestObserver<Integer>();
source.subscribe(to);
to.awaitTerminalEvent();
to.assertNoErrors();
Set<Integer> expected = new HashSet<Integer>(Arrays.asList(
1010, 1011, 2020, 2021, 3030, 3031, 4040, 4041, 5050, 5051,
6060, 6061, 7070, 7071, 8080, 8081, 9090, 9091, 10100, 10101
));
Assert.assertEquals(expected.size(), to.valueCount());
System.out.println("--> testFlatMapSelectorMaxConcurrent: " + to.values());
Assert.assertTrue(expected.containsAll(to.values()));
}
@Test
public void testFlatMapTransformsMaxConcurrentNormalLoop() {
for (int i = 0; i < 1000; i++) {
if (i % 100 == 0) {
System.out.println("testFlatMapTransformsMaxConcurrentNormalLoop => " + i);
}
testFlatMapTransformsMaxConcurrentNormal();
}
}
@Test
public void testFlatMapTransformsMaxConcurrentNormal() {
final int m = 2;
final AtomicInteger subscriptionCount = new AtomicInteger();
Observable<Integer> onNext =
composer(
Observable.fromIterable(Arrays.asList(1, 2, 3))
.observeOn(Schedulers.computation())
,
subscriptionCount, m)
.subscribeOn(Schedulers.computation())
;
Observable<Integer> onComplete = composer(Observable.fromIterable(Arrays.asList(4)), subscriptionCount, m)
.subscribeOn(Schedulers.computation());
Observable<Integer> onError = Observable.fromIterable(Arrays.asList(5));
Observable<Integer> source = Observable.fromIterable(Arrays.asList(10, 20, 30));
Observer<Object> o = TestHelper.mockObserver();
TestObserver<Object> to = new TestObserver<Object>(o);
Function<Throwable, Observable<Integer>> just = just(onError);
source.flatMap(just(onNext), just, just0(onComplete), m).subscribe(to);
to.awaitTerminalEvent(1, TimeUnit.SECONDS);
to.assertNoErrors();
to.assertTerminated();
verify(o, times(3)).onNext(1);
verify(o, times(3)).onNext(2);
verify(o, times(3)).onNext(3);
verify(o).onNext(4);
verify(o).onComplete();
verify(o, never()).onNext(5);
verify(o, never()).onError(any(Throwable.class));
}
@Ignore("Don't care for any reordering")
@Test(timeout = 10000)
public void flatMapRangeAsyncLoop() {
for (int i = 0; i < 2000; i++) {
if (i % 10 == 0) {
System.out.println("flatMapRangeAsyncLoop > " + i);
}
TestObserver<Integer> to = new TestObserver<Integer>();
Observable.range(0, 1000)
.flatMap(new Function<Integer, Observable<Integer>>() {
@Override
public Observable<Integer> apply(Integer t) {
return Observable.just(t);
}
})
.observeOn(Schedulers.computation())
.subscribe(to);
to.awaitTerminalEvent(2500, TimeUnit.MILLISECONDS);
if (to.completions() == 0) {
System.out.println(to.valueCount());
}
to.assertTerminated();
to.assertNoErrors();
List<Integer> list = to.values();
assertEquals(1000, list.size());
boolean f = false;
for (int j = 0; j < list.size(); j++) {
if (list.get(j) != j) {
System.out.println(j + " " + list.get(j));
f = true;
}
}
if (f) {
Assert.fail("Results are out of order!");
}
}
}
@Test(timeout = 30000)
public void flatMapRangeMixedAsyncLoop() {
for (int i = 0; i < 2000; i++) {
if (i % 10 == 0) {
System.out.println("flatMapRangeAsyncLoop > " + i);
}
TestObserver<Integer> to = new TestObserver<Integer>();
Observable.range(0, 1000)
.flatMap(new Function<Integer, Observable<Integer>>() {
final Random rnd = new Random();
@Override
public Observable<Integer> apply(Integer t) {
Observable<Integer> r = Observable.just(t);
if (rnd.nextBoolean()) {
r = r.hide();
}
return r;
}
})
.observeOn(Schedulers.computation())
.subscribe(to);
to.awaitTerminalEvent(2500, TimeUnit.MILLISECONDS);
if (to.completions() == 0) {
System.out.println(to.valueCount());
}
to.assertTerminated();
to.assertNoErrors();
List<Integer> list = to.values();
if (list.size() < 1000) {
Set<Integer> set = new HashSet<Integer>(list);
for (int j = 0; j < 1000; j++) {
if (!set.contains(j)) {
System.out.println(j + " missing");
}
}
}
assertEquals(1000, list.size());
}
}
@Test
public void flatMapIntPassthruAsync() {
for (int i = 0; i < 1000; i++) {
TestObserver<Integer> to = new TestObserver<Integer>();
Observable.range(1, 1000).flatMap(new Function<Integer, Observable<Integer>>() {
@Override
public Observable<Integer> apply(Integer t) {
return Observable.just(1).subscribeOn(Schedulers.computation());
}
}).subscribe(to);
to.awaitTerminalEvent(5, TimeUnit.SECONDS);
to.assertNoErrors();
to.assertComplete();
to.assertValueCount(1000);
}
}
@Test
public void flatMapTwoNestedSync() {
for (final int n : new int[] { 1, 1000, 1000000 }) {
TestObserver<Integer> to = new TestObserver<Integer>();
Observable.just(1, 2).flatMap(new Function<Integer, Observable<Integer>>() {
@Override
public Observable<Integer> apply(Integer t) {
return Observable.range(1, n);
}
}).subscribe(to);
System.out.println("flatMapTwoNestedSync >> @ " + n);
to.assertNoErrors();
to.assertComplete();
to.assertValueCount(n * 2);
}
}
@Test
public void flatMapBiMapper() {
Observable.just(1)
.flatMap(new Function<Integer, ObservableSource<Integer>>() {
@Override
public ObservableSource<Integer> apply(Integer v) throws Exception {
return Observable.just(v * 10);
}
}, new BiFunction<Integer, Integer, Integer>() {
@Override
public Integer apply(Integer a, Integer b) throws Exception {
return a + b;
}
}, true)
.test()
.assertResult(11);
}
@Test
public void flatMapBiMapperWithError() {
Observable.just(1)
.flatMap(new Function<Integer, ObservableSource<Integer>>() {
@Override
public ObservableSource<Integer> apply(Integer v) throws Exception {
return Observable.just(v * 10).concatWith(Observable.<Integer>error(new TestException()));
}
}, new BiFunction<Integer, Integer, Integer>() {
@Override
public Integer apply(Integer a, Integer b) throws Exception {
return a + b;
}
}, true)
.test()
.assertFailure(TestException.class, 11);
}
@Test
public void flatMapBiMapperMaxConcurrency() {
Observable.just(1, 2)
.flatMap(new Function<Integer, ObservableSource<Integer>>() {
@Override
public ObservableSource<Integer> apply(Integer v) throws Exception {
return Observable.just(v * 10);
}
}, new BiFunction<Integer, Integer, Integer>() {
@Override
public Integer apply(Integer a, Integer b) throws Exception {
return a + b;
}
}, true, 1)
.test()
.assertResult(11, 22);
}
@Test
public void flatMapEmpty() {
assertSame(Observable.empty(), Observable.empty().flatMap(new Function<Object, ObservableSource<Object>>() {
@Override
public ObservableSource<Object> apply(Object v) throws Exception {
return Observable.just(v);
}
}));
}
@Test
public void mergeScalar() {
Observable.merge(Observable.just(Observable.just(1)))
.test()
.assertResult(1);
}
@Test
public void mergeScalar2() {
Observable.merge(Observable.just(Observable.just(1)).hide())
.test()
.assertResult(1);
}
@Test
public void mergeScalarEmpty() {
Observable.merge(Observable.just(Observable.empty()).hide())
.test()
.assertResult();
}
@Test
public void mergeScalarError() {
Observable.merge(Observable.just(Observable.fromCallable(new Callable<Object>() {
@Override
public Object call() throws Exception {
throw new TestException();
}
})).hide())
.test()
.assertFailure(TestException.class);
}
@Test
public void scalarReentrant() {
final PublishSubject<Observable<Integer>> ps = PublishSubject.create();
TestObserver<Integer> to = new TestObserver<Integer>() {
@Override
public void onNext(Integer t) {
super.onNext(t);
if (t == 1) {
ps.onNext(Observable.just(2));
}
}
};
Observable.merge(ps)
.subscribe(to);
ps.onNext(Observable.just(1));
ps.onComplete();
to.assertResult(1, 2);
}
@Test
public void scalarReentrant2() {
final PublishSubject<Observable<Integer>> ps = PublishSubject.create();
TestObserver<Integer> to = new TestObserver<Integer>() {
@Override
public void onNext(Integer t) {
super.onNext(t);
if (t == 1) {
ps.onNext(Observable.just(2));
}
}
};
Observable.merge(ps, 2)
.subscribe(to);
ps.onNext(Observable.just(1));
ps.onComplete();
to.assertResult(1, 2);
}
@Test
public void innerCompleteCancelRace() {
for (int i = 0; i < TestHelper.RACE_DEFAULT_LOOPS; i++) {
final PublishSubject<Integer> ps = PublishSubject.create();
final TestObserver<Integer> to = Observable.merge(Observable.just(ps)).test();
Runnable r1 = new Runnable() {
@Override
public void run() {
ps.onComplete();
}
};
Runnable r2 = new Runnable() {
@Override
public void run() {
to.cancel();
}
};
TestHelper.race(r1, r2);
}
}
@Test
public void fusedInnerThrows() {
Observable.just(1).hide()
.flatMap(new Function<Integer, ObservableSource<Object>>() {
@Override
public ObservableSource<Object> apply(Integer v) throws Exception {
return Observable.range(1, 2).map(new Function<Integer, Object>() {
@Override
public Object apply(Integer w) throws Exception {
throw new TestException();
}
});
}
})
.test()
.assertFailure(TestException.class);
}
@Test
public void fusedInnerThrows2() {
TestObserver<Integer> to = Observable.range(1, 2).hide()
.flatMap(new Function<Integer, ObservableSource<Integer>>() {
@Override
public ObservableSource<Integer> apply(Integer v) throws Exception {
return Observable.range(1, 2).map(new Function<Integer, Integer>() {
@Override
public Integer apply(Integer w) throws Exception {
throw new TestException();
}
});
}
}, true)
.test()
.assertFailure(CompositeException.class);
List<Throwable> errors = TestHelper.errorList(to);
TestHelper.assertError(errors, 0, TestException.class);
TestHelper.assertError(errors, 1, TestException.class);
}
@Test
public void noCrossBoundaryFusion() {
for (int i = 0; i < 500; i++) {
TestObserver<Object> to = Observable.merge(
Observable.just(1).observeOn(Schedulers.single()).map(new Function<Integer, Object>() {
@Override
public Object apply(Integer v) throws Exception {
return Thread.currentThread().getName().substring(0, 4);
}
}),
Observable.just(1).observeOn(Schedulers.computation()).map(new Function<Integer, Object>() {
@Override
public Object apply(Integer v) throws Exception {
return Thread.currentThread().getName().substring(0, 4);
}
})
)
.test()
.awaitDone(5, TimeUnit.SECONDS)
.assertValueCount(2);
List<Object> list = to.values();
assertTrue(list.toString(), list.contains("RxSi"));
assertTrue(list.toString(), list.contains("RxCo"));
}
}
@Test
public void cancelScalarDrainRace() {
for (int i = 0; i < TestHelper.RACE_DEFAULT_LOOPS; i++) {
List<Throwable> errors = TestHelper.trackPluginErrors();
try {
final PublishSubject<Observable<Integer>> ps = PublishSubject.create();
final TestObserver<Integer> to = ps.flatMap(Functions.<Observable<Integer>>identity()).test();
Runnable r1 = new Runnable() {
@Override
public void run() {
to.cancel();
}
};
Runnable r2 = new Runnable() {
@Override
public void run() {
ps.onComplete();
}
};
TestHelper.race(r1, r2);
assertTrue(errors.toString(), errors.isEmpty());
} finally {
RxJavaPlugins.reset();
}
}
}
@Test
public void cancelDrainRace() {
for (int i = 0; i < TestHelper.RACE_DEFAULT_LOOPS; i++) {
for (int j = 1; j < 50; j += 5) {
List<Throwable> errors = TestHelper.trackPluginErrors();
try {
final PublishSubject<Observable<Integer>> ps = PublishSubject.create();
final TestObserver<Integer> to = ps.flatMap(Functions.<Observable<Integer>>identity()).test();
final PublishSubject<Integer> just = PublishSubject.create();
final PublishSubject<Integer> just2 = PublishSubject.create();
ps.onNext(just);
ps.onNext(just2);
Runnable r1 = new Runnable() {
@Override
public void run() {
just2.onNext(1);
to.cancel();
}
};
Runnable r2 = new Runnable() {
@Override
public void run() {
just.onNext(1);
}
};
TestHelper.race(r1, r2);
assertTrue(errors.toString(), errors.isEmpty());
} finally {
RxJavaPlugins.reset();
}
}
}
}
@Test
public void iterableMapperFunctionReturnsNull() {
Observable.just(1)
.flatMapIterable(new Function<Integer, Iterable<Object>>() {
@Override
public Iterable<Object> apply(Integer v) throws Exception {
return null;
}
}, new BiFunction<Integer, Object, Object>() {
@Override
public Object apply(Integer v, Object w) throws Exception {
return v;
}
})
.test()
.assertFailureAndMessage(NullPointerException.class, "The mapper returned a null Iterable");
}
@Test
public void combinerMapperFunctionReturnsNull() {
Observable.just(1)
.flatMap(new Function<Integer, Observable<Object>>() {
@Override
public Observable<Object> apply(Integer v) throws Exception {
return null;
}
}, new BiFunction<Integer, Object, Object>() {
@Override
public Object apply(Integer v, Object w) throws Exception {
return v;
}
})
.test()
.assertFailureAndMessage(NullPointerException.class, "The mapper returned a null ObservableSource");
}
@Test
public void failingFusedInnerCancelsSource() {
final AtomicInteger counter = new AtomicInteger();
Observable.range(1, 5)
.doOnNext(new Consumer<Integer>() {
@Override
public void accept(Integer v) throws Exception {
counter.getAndIncrement();
}
})
.flatMap(new Function<Integer, Observable<Integer>>() {
@Override
public Observable<Integer> apply(Integer v)
throws Exception {
return Observable.<Integer>fromIterable(new Iterable<Integer>() {
@Override
public Iterator<Integer> iterator() {
return new Iterator<Integer>() {
@Override
public boolean hasNext() {
return true;
}
@Override
public Integer next() {
throw new TestException();
}
@Override
public void remove() {
throw new UnsupportedOperationException();
}
};
}
});
}
})
.test()
.assertFailure(TestException.class);
assertEquals(1, counter.get());
}
@Test
public void scalarQueueNoOverflow() {
List<Throwable> errors = TestHelper.trackPluginErrors();
try {
final PublishSubject<Integer> ps = PublishSubject.create();
TestObserver<Integer> to = ps.flatMap(new Function<Integer, Observable<Integer>>() {
@Override
public Observable<Integer> apply(Integer v)
throws Exception {
return Observable.just(v + 1);
}
}, 1)
.subscribeWith(new TestObserver<Integer>() {
@Override
public void onNext(Integer t) {
super.onNext(t);
if (t == 1) {
for (int i = 1; i < 10; i++) {
ps.onNext(i);
}
ps.onComplete();
}
}
});
ps.onNext(0);
if (!errors.isEmpty()) {
to.onError(new CompositeException(errors));
}
to.assertResult(1, 2, 3, 4, 5, 6, 7, 8, 9, 10);
} finally {
RxJavaPlugins.reset();
}
}
@Test
public void scalarQueueNoOverflowHidden() {
final PublishSubject<Integer> ps = PublishSubject.create();
TestObserver<Integer> to = ps.flatMap(new Function<Integer, Observable<Integer>>() {
@Override
public Observable<Integer> apply(Integer v)
throws Exception {
return Observable.just(v + 1).hide();
}
}, 1)
.subscribeWith(new TestObserver<Integer>() {
@Override
public void onNext(Integer t) {
super.onNext(t);
if (t == 1) {
for (int i = 1; i < 10; i++) {
ps.onNext(i);
}
ps.onComplete();
}
}
});
ps.onNext(0);
to.assertResult(1, 2, 3, 4, 5, 6, 7, 8, 9, 10);
}
@Test
public void fusedSourceCrashResumeWithNextSource() {
final UnicastSubject<Integer> fusedSource = UnicastSubject.create();
TestObserver<Integer> to = new TestObserver<Integer>();
ObservableFlatMap.MergeObserver<Integer, Integer> merger =
new ObservableFlatMap.MergeObserver<Integer, Integer>(to, new Function<Integer, Observable<Integer>>() {
@Override
public Observable<Integer> apply(Integer t)
throws Exception {
if (t == 0) {
return fusedSource
.map(new Function<Integer, Integer>() {
@Override
public Integer apply(Integer v)
throws Exception { throw new TestException(); }
})
.compose(TestHelper.<Integer>observableStripBoundary());
}
return Observable.range(10 * t, 5);
}
}, true, Integer.MAX_VALUE, 128);
merger.onSubscribe(Disposables.empty());
merger.getAndIncrement();
merger.onNext(0);
merger.onNext(1);
merger.onNext(2);
assertTrue(fusedSource.hasObservers());
fusedSource.onNext(-1);
merger.drainLoop();
to.assertValuesOnly(10, 11, 12, 13, 14, 20, 21, 22, 23, 24);
}
@Test
public void maxConcurrencySustained() {
final PublishSubject<Integer> ps1 = PublishSubject.create();
final PublishSubject<Integer> ps2 = PublishSubject.create();
PublishSubject<Integer> ps3 = PublishSubject.create();
PublishSubject<Integer> ps4 = PublishSubject.create();
TestObserver<Integer> to = Observable.just(ps1, ps2, ps3, ps4)
.flatMap(new Function<PublishSubject<Integer>, ObservableSource<Integer>>() {
@Override
public ObservableSource<Integer> apply(PublishSubject<Integer> v) throws Exception {
return v;
}
}, 2)
.doOnNext(new Consumer<Integer>() {
@Override
public void accept(Integer v) throws Exception {
if (v == 1) {
// this will make sure the drain loop detects two completed
// inner sources and replaces them with fresh ones
ps1.onComplete();
ps2.onComplete();
}
}
})
.test();
ps1.onNext(1);
assertFalse(ps1.hasObservers());
assertFalse(ps2.hasObservers());
assertTrue(ps3.hasObservers());
assertTrue(ps4.hasObservers());
to.dispose();
assertFalse(ps3.hasObservers());
assertFalse(ps4.hasObservers());
}
}
| {
"content_hash": "9c67f68bffd6d6ace956839f505add5e",
"timestamp": "",
"source": "github",
"line_count": 1077,
"max_line_length": 121,
"avg_line_length": 34,
"alnum_prop": 0.5290840570211371,
"repo_name": "NiteshKant/RxJava",
"id": "960722060abbe7f9329fcb06409665b141666477",
"size": "37222",
"binary": false,
"copies": "1",
"ref": "refs/heads/2.x",
"path": "src/test/java/io/reactivex/internal/operators/observable/ObservableFlatMapTest.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "CSS",
"bytes": "12875"
},
{
"name": "Java",
"bytes": "14390953"
},
{
"name": "Shell",
"bytes": "4327"
}
],
"symlink_target": ""
} |
var JimpEdit = require('./jimp_edit');
var NeuralStyle = require('./neural');
var OPENCV = require('./opencv')
//Factory Object
function EditFactory (username)
{
this.username = username;
}
//Method responsible for creating the requested edit
EditFactory.prototype.createEdit = function(type,data)
{
let edit = {};//used if no object exists
if(type == 'JIMP')
{
edit = new JimpEdit(data, this.username)
}
else if (type == 'OPENCV')
{
edit = new OPENCV(data);
}
else if (type == 'NEURAL'){
edit = new NeuralStyle(data);
}
else
{
edit = new JimpEdit(data)
type = 'JIMP';
}
edit.type =type;
return edit;
}
module.exports = EditFactory; | {
"content_hash": "3cdf15062220e6409e9b9bf8e2c6e9db",
"timestamp": "",
"source": "github",
"line_count": 41,
"max_line_length": 54,
"avg_line_length": 16.341463414634145,
"alnum_prop": 0.6582089552238806,
"repo_name": "mrlennix/CloudProcessing",
"id": "b9a34b4c580e289167f5d2c6023eb946af03f529",
"size": "670",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "project/lib/EditFactory.js",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "4042"
},
{
"name": "HTML",
"bytes": "27374"
},
{
"name": "JavaScript",
"bytes": "28093"
},
{
"name": "Python",
"bytes": "20707"
}
],
"symlink_target": ""
} |
// Copyright 2016 The Periph Authors. All rights reserved.
// Use of this source code is governed under the Apache License, Version 2.0
// that can be found in the LICENSE file.
// Package image1bit implements black and white (1 bit per pixel) 2D graphics.
//
// It is compatible with package image/draw.
//
// VerticalLSB is the only bit packing implemented as it is used by the
// ssd1306. Others would be VerticalMSB, HorizontalLSB and HorizontalMSB.
package image1bit
import (
"image"
"image/color"
"image/draw"
)
// Bit implements a 1 bit color.
type Bit bool
// RGBA returns either all white or all black.
//
// Technically the monochrome display could be colored but this information is
// unavailable here. To use a colored display, use the 1 bit image as a mask
// for a color.
func (b Bit) RGBA() (uint32, uint32, uint32, uint32) {
if b {
return 65535, 65535, 65535, 65535
}
return 0, 0, 0, 65535
}
func (b Bit) String() string {
if b {
return "On"
}
return "Off"
}
// Possible bitness.
const (
On Bit = true
Off Bit = false
)
// BitModel is the color Model for 1 bit color.
var BitModel = color.ModelFunc(convert)
// VerticalLSB is a 1 bit (black and white) image.
//
// Each byte is 8 vertical pixels. Each stride is an horizontal band of 8
// pixels high with LSB first. So the first byte represent the following
// pixels, with lowest bit being the top left pixel.
//
// 0 x x x x x x x
// 1 x x x x x x x
// 2 x x x x x x x
// 3 x x x x x x x
// 4 x x x x x x x
// 5 x x x x x x x
// 6 x x x x x x x
// 7 x x x x x x x
//
// It is designed specifically to work with SSD1306 OLED display controler.
type VerticalLSB struct {
// Pix holds the image's pixels, as vertically LSB-first packed bitmap. It
// can be passed directly to ssd1306.Dev.Write()
Pix []byte
// Stride is the Pix stride (in bytes) between vertically adjacent 8 pixels
// horizontal bands.
Stride int
// Rect is the image's bounds.
Rect image.Rectangle
}
// NewVerticalLSB returns an initialized VerticalLSB instance.
func NewVerticalLSB(r image.Rectangle) *VerticalLSB {
w := r.Dx()
// Round down.
minY := r.Min.Y &^ 7
// Round up.
maxY := (r.Max.Y + 7) & ^7
bands := (maxY - minY) / 8
return &VerticalLSB{Pix: make([]byte, w*bands), Stride: w, Rect: r}
}
// ColorModel implements image.Image.
func (i *VerticalLSB) ColorModel() color.Model {
return BitModel
}
// Bounds implements image.Image.
func (i *VerticalLSB) Bounds() image.Rectangle {
return i.Rect
}
// At implements image.Image.
func (i *VerticalLSB) At(x, y int) color.Color {
return i.BitAt(x, y)
}
// BitAt is the optimized version of At().
func (i *VerticalLSB) BitAt(x, y int) Bit {
if !(image.Point{x, y}.In(i.Rect)) {
return Off
}
offset, mask := i.PixOffset(x, y)
return Bit(i.Pix[offset]&mask != 0)
}
// Opaque scans the entire image and reports whether it is fully opaque.
func (i *VerticalLSB) Opaque() bool {
return true
}
// PixOffset returns the index of the first element of Pix that corresponds to
// the pixel at (x, y) and the corresponding mask.
func (i *VerticalLSB) PixOffset(x, y int) (int, byte) {
// Adjust band.
minY := i.Rect.Min.Y &^ 7
pY := (y - minY)
offset := pY/8*i.Stride + (x - i.Rect.Min.X)
bit := uint(pY & 7)
return offset, 1 << bit
}
// Set implements draw.Image
func (i *VerticalLSB) Set(x, y int, c color.Color) {
i.SetBit(x, y, convertBit(c))
}
// SetBit is the optimized version of Set().
func (i *VerticalLSB) SetBit(x, y int, b Bit) {
if !(image.Point{x, y}.In(i.Rect)) {
return
}
offset, mask := i.PixOffset(x, y)
if b {
i.Pix[offset] |= mask
} else {
i.Pix[offset] &^= mask
}
}
/*
// SubImage returns an image representing the portion of the image p visible
// through r. The returned value shares pixels with the original image.
func (i *VerticalLSB) SubImage(r image.Rectangle) image.Image {
r = r.Intersect(i.Rect)
// If r1 and r2 are Rectangles, r1.Intersect(r2) is not guaranteed to be
// inside either r1 or r2 if the intersection is empty. Without explicitly
// checking for this, the Pix[i:] expression below can panic.
if r.Empty() {
return &VerticalLSB{}
}
offset, mask := i.PixOffset(r.Min.X, r.Min.Y)
// TODO(maruel): Adjust with mask.
return &VerticalLSB{
Pix: i.Pix[offset:],
Stride: i.Stride,
Rect: r,
}
}
*/
//
var _ draw.Image = &VerticalLSB{}
// Anything not transparent and not pure black is white.
func convert(c color.Color) color.Color {
return convertBit(c)
}
// Anything not transparent and not pure black is white.
func convertBit(c color.Color) Bit {
switch t := c.(type) {
case Bit:
return t
default:
r, g, b, _ := c.RGBA()
return Bit((r | g | b) >= 0x8000)
}
}
| {
"content_hash": "fa40815e59eb303584bf891dc4455111",
"timestamp": "",
"source": "github",
"line_count": 185,
"max_line_length": 78,
"avg_line_length": 25.454054054054055,
"alnum_prop": 0.6750902527075813,
"repo_name": "maruel/dotstar",
"id": "bb9c8136883ca49ab8976481ee66b0683f9554ba",
"size": "4709",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "vendor/periph.io/x/periph/devices/ssd1306/image1bit/image1bit.go",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Go",
"bytes": "41086"
},
{
"name": "HTML",
"bytes": "1020"
}
],
"symlink_target": ""
} |
require('proof')(1, require('cadence')(prove))
function prove (async, okay) {
var bin = require('../environment.bin.js')
async(function () {
var program = bin({ bind: 8888, exclude: 'PATH' }, async())
async(function () {
program.ready.wait(async())
}, function () {
program.emit('SIGTERM')
})
}, function () {
okay(true, 'done')
})
}
| {
"content_hash": "d2f1cd4cd41ba2d0acec80cce50c81d1",
"timestamp": "",
"source": "github",
"line_count": 15,
"max_line_length": 67,
"avg_line_length": 27.666666666666668,
"alnum_prop": 0.5132530120481927,
"repo_name": "bigeasy/nascent",
"id": "1d24cb50f4328f4bb2711e1cadb6bceb1f97025d",
"size": "415",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "nascent.environment/t/environment.bin.t.js",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "JavaScript",
"bytes": "7371"
},
{
"name": "Shell",
"bytes": "914"
}
],
"symlink_target": ""
} |
<?php
namespace PhpProbe\Check;
use PhpProbe\Adapter\Response\AbstractAdapterResponse;
use \PhpProbe\Adapter\Response\HttpAdapterResponse;
/**
* Class HttpCheck
*
* @author Julien CHICHIGNOUD <[email protected]>
* @package PhpProbe\Check
*/
class HttpCheck extends AbstractCheck
{
/**
* Check the http response code
*
* @param AbstractAdapterResponse $response The response object
* @param int $expected Expected code
*
* @return bool|string
*/
protected function checkHttpCode($response, $expected)
{
return $this->checkValue('httpCode', $expected, $response->getHttpCode());
}
/**
* Check content response's content
*
* @param HttpAdapterResponse $response The response object
* @param string $search Search criterion
*
* @return string|boolean
*/
protected function checkContent(HttpAdapterResponse $response, $search)
{
if (!preg_match('#' . $search . '#i', $response->getContent())) {
$reason = sprintf("Expected content '%s' not found in response.", $search);
return $reason;
}
return true;
}
}
| {
"content_hash": "ab55671e71062b1edb275f43f1989b9d",
"timestamp": "",
"source": "github",
"line_count": 46,
"max_line_length": 87,
"avg_line_length": 26.434782608695652,
"alnum_prop": 0.6233552631578947,
"repo_name": "michael-bouvy/php-probe",
"id": "219e1390c31b650635655c4ba7ee6a84bb254db3",
"size": "1216",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/PhpProbe/Check/HttpCheck.php",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "PHP",
"bytes": "92125"
},
{
"name": "Smarty",
"bytes": "1631"
}
],
"symlink_target": ""
} |
namespace cc {
LatencyInfoSwapPromise::LatencyInfoSwapPromise(const ui::LatencyInfo& latency)
: latency_(latency) {}
LatencyInfoSwapPromise::~LatencyInfoSwapPromise() = default;
void LatencyInfoSwapPromise::WillSwap(viz::CompositorFrameMetadata* metadata) {
DCHECK(!latency_.terminated());
metadata->latency_info.push_back(latency_);
}
void LatencyInfoSwapPromise::DidSwap() {}
SwapPromise::DidNotSwapAction LatencyInfoSwapPromise::DidNotSwap(
DidNotSwapReason reason) {
latency_.Terminate();
// TODO(miletus): Turn this back on once per-event LatencyInfo tracking
// is enabled in GPU side.
// DCHECK(latency_.terminated);
return DidNotSwapAction::BREAK_PROMISE;
}
int64_t LatencyInfoSwapPromise::GetTraceId() const {
return latency_.trace_id();
}
// Trace the original LatencyInfo of a LatencyInfoSwapPromise
void LatencyInfoSwapPromise::OnCommit() {
using perfetto::protos::pbzero::ChromeLatencyInfo;
using perfetto::protos::pbzero::TrackEvent;
TRACE_EVENT("input,benchmark", "LatencyInfo.Flow",
[this](perfetto::EventContext ctx) {
ChromeLatencyInfo* latency_info =
ctx.event()->set_chrome_latency_info();
latency_info->set_trace_id(GetTraceId());
latency_info->set_step(
ChromeLatencyInfo::STEP_HANDLE_INPUT_EVENT_MAIN_COMMIT);
tracing::FillFlowEvent(ctx, TrackEvent::LegacyEvent::FLOW_INOUT,
GetTraceId());
});
}
} // namespace cc
| {
"content_hash": "1bd5cf3ee38076bbc4e27b360dea6084",
"timestamp": "",
"source": "github",
"line_count": 45,
"max_line_length": 80,
"avg_line_length": 34.4,
"alnum_prop": 0.6776485788113695,
"repo_name": "ric2b/Vivaldi-browser",
"id": "a6110c4f87388c3056cd0d99beb0937eb814d0fb",
"size": "1975",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "chromium/cc/trees/latency_info_swap_promise.cc",
"mode": "33188",
"license": "bsd-3-clause",
"language": [],
"symlink_target": ""
} |
package org.math.plot.render;
/**
* BSD License
*
* @author Yann RICHET
*/
public class Projection3D extends Projection {
protected double theta;
protected double phi;
// protected boolean useRoundTrigonometry = false;
public Projection3D(AWTDrawer _draw) {
super(_draw);
theta = Math.PI / 4;
phi = Math.PI / 4;
initBaseCoordsProjection();
}
protected double[] baseCoordsScreenProjectionRatio(double[] xyz) {
double factor = 1.7;
double[] sC = new double[2];
sC[0] = 0.5
+ (cos(theta)
* ((xyz[1] - (draw.canvas.base.roundXmax[1] + draw.canvas.base.roundXmin[1]) / 2) / (draw.canvas.base.roundXmax[1] - draw.canvas.base.roundXmin[1])) - sin(theta)
* ((xyz[0] - (draw.canvas.base.roundXmax[0] + draw.canvas.base.roundXmin[0]) / 2) / (draw.canvas.base.roundXmax[0] - draw.canvas.base.roundXmin[0])))
/ factor;
sC[1] = 0.5
+ (cos(phi)
* ((xyz[2] - (draw.canvas.base.roundXmax[2] + draw.canvas.base.roundXmin[2]) / 2) / (draw.canvas.base.roundXmax[2] - draw.canvas.base.roundXmin[2]))
- sin(phi)
* cos(theta)
* ((xyz[0] - (draw.canvas.base.roundXmax[0] + draw.canvas.base.roundXmin[0]) / 2) / (draw.canvas.base.roundXmax[0] - draw.canvas.base.roundXmin[0])) - sin(phi)
* sin(theta)
* ((xyz[1] - (draw.canvas.base.roundXmax[1] + draw.canvas.base.roundXmin[1]) / 2) / (draw.canvas.base.roundXmax[1] - draw.canvas.base.roundXmin[1])))
/ factor;
// System.out.println("Theta = " + theta + " Phi = " + phi);
// System.out.println("(" + xyz[0] +"," + xyz[1] +"," + xyz[2] + ") ->
// (" + sC[0] + "," + sC[1] + ")");
return sC;
}
/*
* private final static double _2PI = 2 * Math.PI;
*
* private final static int N = 100;
*
* private final static double[] COS =
* DoubleArray.f(DoubleArray.increment(N, 0, 2 * Math.PI / (N - 1)), new
* Function() { public double f(double x) { return Math.cos(x); } });
*
* private final static double[] SIN =
* DoubleArray.f(DoubleArray.increment(N, 0, 2 * Math.PI / (N - 1)), new
* Function() { public double f(double x) { return Math.sin(x); } });
*/
private double cos(double x) {
return Math.cos(x);
}
private double sin(double x) {
return Math.sin(x);
}
public void setView(double _theta, double _phi) {
theta = _theta;
phi = _phi;
initBaseCoordsProjection();
}
public void rotate(int[] screenTranslation, int[] dimension) {
theta = theta - ((double) screenTranslation[0]) / 100;
phi = phi + ((double) screenTranslation[1]) / 100;
initBaseCoordsProjection();
}
} | {
"content_hash": "10a02482963e08b2b97860c0bfd03f4f",
"timestamp": "",
"source": "github",
"line_count": 79,
"max_line_length": 185,
"avg_line_length": 37.30379746835443,
"alnum_prop": 0.5344418052256532,
"repo_name": "NCIP/visda",
"id": "559c010c561068c2030a5f4a61edea78f79b1508",
"size": "2947",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "visda/VISDA-Developer/Month-5-yr1/visdaDev-V0.1/src/org/math/plot/render/Projection3D.java",
"mode": "33261",
"license": "bsd-3-clause",
"language": [
{
"name": "C",
"bytes": "253182"
},
{
"name": "C++",
"bytes": "298955"
},
{
"name": "Java",
"bytes": "1580087"
},
{
"name": "Shell",
"bytes": "15479"
}
],
"symlink_target": ""
} |
module Analytical
module Modules
class Google
include Analytical::Modules::Base
def initialize(options={})
super
@tracking_command_location = :head_append
end
def init_javascript(location)
init_location(location) do
js = <<-HTML
<!-- Analytical Init: Google -->
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', '#{options[:key]}', 'auto');
ga('send', 'pageview');
</script>
HTML
js
end
end
def event(*args) # name, options, callback
<<-JS.gsub(/^ {10}/, '')
ga('send', 'event', name, options && options.value);
JS
end
# def track(*args)
# "_gaq.push(['_trackPageview'#{args.empty? ? ']' : ', "' + args.first + '"]'});"
# end
# def custom_event(category, action, opt_label=nil, opt_value=nil)
# args = [category, action, opt_label, opt_value].compact
# "_gaq.push(" + [ "_trackEvent", *args].to_json + ");"
# end
# # http://code.google.com/apis/analytics/docs/tracking/gaTrackingCustomVariables.html
# #
# #_setCustomVar(index, name, value, opt_scope)
# #
# # index — The slot for the custom variable. Required. This is a number whose value can range from 1 - 5, inclusive.
# #
# # name — The name for the custom variable. Required. This is a string that identifies the custom variable and appears in the top-level Custom Variables report of the Analytics reports.
# #
# # value — The value for the custom variable. Required. This is a string that is paired with a name.
# #
# # opt_scope — The scope for the custom variable. Optional. As described above, the scope defines the level of user engagement with your site.
# # It is a number whose possible values are 1 (visitor-level), 2 (session-level), or 3 (page-level).
# # When left undefined, the custom variable scope defaults to page-level interaction.
# def set(data)
# if data.is_a?(Hash) && data.keys.any?
# index = data[:index].to_i
# name = data[:name ]
# value = data[:value]
# scope = data[:scope]
# if (1..5).to_a.include?(index) && !name.nil? && !value.nil?
# data = "#{index}, '#{name}', '#{value}'"
# data += (1..3).to_a.include?(scope) ? ", #{scope}" : ""
# return "_gaq.push(['_setCustomVar', #{ data }]);"
# end
# end
# end
#
# # http://code.google.com/apis/analytics/docs/gaJS/gaJSApiEcommerce.html#_gat.GA_Tracker_._addTrans
# # String orderId Required. Internal unique order id number for this transaction.
# # String affiliation Optional. Partner or store affiliation (undefined if absent).
# # String total Required. Total dollar amount of the transaction.
# # String tax Optional. Tax amount of the transaction.
# # String shipping Optional. Shipping charge for the transaction.
# # String city Optional. City to associate with transaction.
# # String state Optional. State to associate with transaction.
# # String country Optional. Country to associate with transaction.
# def add_trans(order_id, affiliation=nil, total=nil, tax=nil, shipping=nil, city=nil, state=nil, country=nil)
# data = []
# data << "'#{order_id}'"
# data << "'#{affiliation}'"
# data << "'#{total}'"
# data << "'#{tax}'"
# data << "'#{shipping}'"
# data << "'#{city}'"
# data << "'#{state}'"
# data << "'#{country}'"
#
# "_gaq.push(['_addTrans', #{data.join(', ')}]);"
# end
#
# # http://code.google.com/apis/analytics/docs/gaJS/gaJSApiEcommerce.html#_gat.GA_Tracker_._addItem
# # String orderId Optional Order ID of the transaction to associate with item.
# # String sku Required. Item's SKU code.
# # String name Required. Product name. Required to see data in the product detail report.
# # String category Optional. Product category.
# # String price Required. Product price.
# # String quantity Required. Purchase quantity.
# def add_item(order_id, sku, name, category, price, quantity)
# data = "'#{order_id}', '#{sku}', '#{name}', '#{category}', '#{price}', '#{quantity}'"
# "_gaq.push(['_addItem', #{data}]);"
# end
#
# # http://code.google.com/apis/analytics/docs/gaJS/gaJSApiEcommerce.html#_gat.GA_Tracker_._trackTrans
# # Sends both the transaction and item data to the Google Analytics server.
# # This method should be used in conjunction with the add_item and add_trans methods.
# def track_trans
# "_gaq.push(['_trackTrans']);"
# end
end
end
end
| {
"content_hash": "5026467a430088d1604805fa1de826a1",
"timestamp": "",
"source": "github",
"line_count": 115,
"max_line_length": 193,
"avg_line_length": 45.678260869565214,
"alnum_prop": 0.5711022272986864,
"repo_name": "pedrocarrico/analytical",
"id": "675486d39d5db9adbf271842cb8e4fcf9d60dc6b",
"size": "5261",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "lib/analytical/modules/google.rb",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Ruby",
"bytes": "90341"
}
],
"symlink_target": ""
} |
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<include layout="@layout/title"/>
<android.support.v4.view.ViewPager
android:id="@+id/whatsnew_viewpager"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginTop="39dp"
>
</android.support.v4.view.ViewPager>
<LinearLayout
android:layout_gravity="bottom"
android:layout_marginBottom="30dp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:orientation="horizontal"
>
<ImageView
android:id="@+id/page0"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/page"
/>
<ImageView
android:id="@+id/page1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:src="@drawable/page"
/>
<ImageView
android:id="@+id/page2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:src="@drawable/page"
/>
<ImageView
android:id="@+id/page3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:src="@drawable/page"
/>
<ImageView
android:id="@+id/page4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:src="@drawable/page"
/>
<ImageView
android:id="@+id/page5"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:src="@drawable/page"
/>
</LinearLayout>
</FrameLayout>
| {
"content_hash": "5f93ea8e125d8f735a1509ce063be425",
"timestamp": "",
"source": "github",
"line_count": 68,
"max_line_length": 71,
"avg_line_length": 35.05882352941177,
"alnum_prop": 0.5683724832214765,
"repo_name": "diaojianbotw/MyAppWeinxin",
"id": "48106d8f7dcbbc3f6270ca96ce05019bed72a96a",
"size": "2384",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "res/layout/whatnews_viewpager.xml",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Java",
"bytes": "30242"
}
],
"symlink_target": ""
} |
require 'sass/rails'
require 'spree_core'
require 'spree_contact_us/engine'
module SpreeContactUs
# Address ContactUs email notifications are sent from.
mattr_accessor :mailer_from
# Address to send ContactUs email notifications to.
mattr_accessor :mailer_to
# Enable or Disable name field.
mattr_accessor :require_name
# Enable or Disable subject field.
mattr_accessor :require_subject
# Default way to setup ContactUs. Run rake contact_us:install to create
# a fresh initializer with all configuration values.
def self.setup
yield self
end
end
| {
"content_hash": "85184d2b858c1c5a1ecffd5d05dbc7b6",
"timestamp": "",
"source": "github",
"line_count": 26,
"max_line_length": 73,
"avg_line_length": 22.384615384615383,
"alnum_prop": 0.7542955326460481,
"repo_name": "2beDigital/spree_contact_us",
"id": "75ff5d32547579236bb7edf684c258d36759795c",
"size": "582",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "lib/spree_contact_us.rb",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "CSS",
"bytes": "1511"
},
{
"name": "HTML",
"bytes": "3843"
},
{
"name": "JavaScript",
"bytes": "105"
},
{
"name": "Ruby",
"bytes": "23599"
}
],
"symlink_target": ""
} |
require 'test_helper'
class BidMailerTest < ActionMailer::TestCase
include Rails.application.routes.url_helpers
setup do
@listing = listings(:macbook)
@bid = listings(:macbook).bids.build(:amount => 200)
@bid.user = users(:amy)
@bid.save!
new_bid = listings(:macbook).bids.build(:amount => 300)
new_bid.user = users(:amy)
new_bid.save!
@outbid_notification = BidMailer.outbid_notification(@bid)
@seller_notification = BidMailer.seller_notification(@bid)
end
test "outbid notification should send email to bidder" do
assert @outbid_notification.to.include?(@bid.user.email)
end
test "outbid notification should have a link to the listing" do
assert_match Regexp.new(listing_path(@listing)), @outbid_notification.body.to_s
end
test "seller notification should send email to seller" do
assert @seller_notification.to.include?(@listing.user.email)
end
test "seller notification should have a link to the listing" do
assert_match Regexp.new(listing_path(@listing)), @seller_notification.body.to_s
end
end
| {
"content_hash": "04c2ec707f14df4dd1a57b9edbdbfa0f",
"timestamp": "",
"source": "github",
"line_count": 33,
"max_line_length": 83,
"avg_line_length": 33.09090909090909,
"alnum_prop": 0.7124542124542125,
"repo_name": "collectiveidea/eharbor",
"id": "d9d1eefea50d4630865a0f13f045ffb45475ea96",
"size": "1092",
"binary": false,
"copies": "1",
"ref": "refs/heads/rails-3.2",
"path": "test/functional/bid_mailer_test.rb",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "7688"
},
{
"name": "JavaScript",
"bytes": "463"
},
{
"name": "Ruby",
"bytes": "61933"
}
],
"symlink_target": ""
} |
CREATE TABLE BATCH_JOB_INSTANCE
(
JOB_INSTANCE_ID BIGINT NOT NULL,
VERSION BIGINT,
JOB_NAME VARCHAR(100) NOT NULL,
JOB_KEY VARCHAR(32) NOT NULL
);
ALTER TABLE BATCH_JOB_INSTANCE ADD CONSTRAINT JOB_INST_PK PRIMARY KEY (JOB_INSTANCE_ID);
ALTER TABLE BATCH_JOB_INSTANCE ADD CONSTRAINT JOB_INST_UN UNIQUE (JOB_NAME, JOB_KEY);
CREATE TABLE BATCH_JOB_EXECUTION
(
JOB_EXECUTION_ID BIGINT NOT NULL,
VERSION BIGINT,
JOB_INSTANCE_ID BIGINT NOT NULL,
CREATE_TIME DATETIME NOT NULL,
START_TIME DATETIME DEFAULT NULL,
END_TIME DATETIME DEFAULT NULL,
STATUS VARCHAR(10),
EXIT_CODE VARCHAR(2500),
EXIT_MESSAGE VARCHAR(2500),
LAST_UPDATED DATETIME,
JOB_CONFIGURATION_LOCATION VARCHAR(2500)
);
ALTER TABLE BATCH_JOB_EXECUTION ADD CONSTRAINT JOB_INST_EXEC_PK PRIMARY KEY (JOB_EXECUTION_ID);
ALTER TABLE BATCH_JOB_EXECUTION ADD CONSTRAINT JOB_INST_EXEC_FK FOREIGN KEY (JOB_INSTANCE_ID) REFERENCES BATCH_JOB_INSTANCE (JOB_INSTANCE_ID);
CREATE TABLE BATCH_JOB_EXECUTION_PARAMS
(
JOB_EXECUTION_ID BIGINT NOT NULL,
TYPE_CD VARCHAR(6) NOT NULL,
KEY_NAME VARCHAR(100) NOT NULL,
STRING_VAL VARCHAR(250),
DATE_VAL DATETIME DEFAULT NULL,
LONG_VAL BIGINT,
DOUBLE_VAL DOUBLE PRECISION,
IDENTIFYING CHAR(1) NOT NULL
);
ALTER TABLE BATCH_JOB_EXECUTION_PARAMS ADD CONSTRAINT JOB_EXEC_PARAMS_FK FOREIGN KEY (JOB_EXECUTION_ID) REFERENCES BATCH_JOB_EXECUTION (JOB_EXECUTION_ID);
CREATE TABLE BATCH_STEP_EXECUTION
(
STEP_EXECUTION_ID BIGINT NOT NULL,
VERSION BIGINT NOT NULL,
STEP_NAME VARCHAR(100) NOT NULL,
JOB_EXECUTION_ID BIGINT NOT NULL,
START_TIME DATETIME NOT NULL,
END_TIME DATETIME DEFAULT NULL,
STATUS VARCHAR(10),
COMMIT_COUNT BIGINT,
READ_COUNT BIGINT,
FILTER_COUNT BIGINT,
WRITE_COUNT BIGINT,
READ_SKIP_COUNT BIGINT,
WRITE_SKIP_COUNT BIGINT,
PROCESS_SKIP_COUNT BIGINT,
ROLLBACK_COUNT BIGINT,
EXIT_CODE VARCHAR(2500),
EXIT_MESSAGE VARCHAR(2500),
LAST_UPDATED DATETIME
);
ALTER TABLE BATCH_STEP_EXECUTION ADD CONSTRAINT JOB_EXEC_STEP_PK PRIMARY KEY (STEP_EXECUTION_ID);
ALTER TABLE BATCH_STEP_EXECUTION ADD CONSTRAINT JOB_EXEC_STEP_FK FOREIGN KEY (JOB_EXECUTION_ID) REFERENCES BATCH_JOB_EXECUTION (JOB_EXECUTION_ID);
CREATE TABLE BATCH_STEP_EXECUTION_CONTEXT
(
STEP_EXECUTION_ID BIGINT NOT NULL,
SHORT_CONTEXT VARCHAR(2500) NOT NULL,
SERIALIZED_CONTEXT VARCHAR(MAX)
);
ALTER TABLE BATCH_STEP_EXECUTION_CONTEXT ADD CONSTRAINT STEP_EXEC_CTX_PK PRIMARY KEY (STEP_EXECUTION_ID);
ALTER TABLE BATCH_STEP_EXECUTION_CONTEXT ADD CONSTRAINT STEP_EXEC_CTX_FK FOREIGN KEY (STEP_EXECUTION_ID) REFERENCES BATCH_STEP_EXECUTION (STEP_EXECUTION_ID);
CREATE TABLE BATCH_JOB_EXECUTION_CONTEXT
(
JOB_EXECUTION_ID BIGINT NOT NULL,
SHORT_CONTEXT VARCHAR(2500) NOT NULL,
SERIALIZED_CONTEXT VARCHAR(MAX)
);
ALTER TABLE BATCH_JOB_EXECUTION_CONTEXT ADD CONSTRAINT JOB_EXEC_CTX_PK PRIMARY KEY (JOB_EXECUTION_ID);
ALTER TABLE BATCH_JOB_EXECUTION_CONTEXT ADD CONSTRAINT JOB_EXEC_CTX_FK FOREIGN KEY (JOB_EXECUTION_ID) REFERENCES BATCH_JOB_EXECUTION (JOB_EXECUTION_ID);
| {
"content_hash": "bbedf05e54503d4a410b2f96243abb1a",
"timestamp": "",
"source": "github",
"line_count": 93,
"max_line_length": 157,
"avg_line_length": 46.82795698924731,
"alnum_prop": 0.5329506314580942,
"repo_name": "knishant/ssql",
"id": "2141760f645e9c07f4df4991fae62ddef54fe8dc",
"size": "4355",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/test/resources/translated/sqltranslatortest/SQLServer2005/spring_batch.sql",
"mode": "33261",
"license": "apache-2.0",
"language": [
{
"name": "HTML",
"bytes": "113039"
},
{
"name": "Java",
"bytes": "97884"
}
],
"symlink_target": ""
} |
/* Authors: Benjamin Scholz, Thies Oelerich */
#pragma once
#include <moveit/macros/class_forward.h>
#include <string>
namespace trajectory_processing
{
MOVEIT_CLASS_FORWARD(RobotTrajectory);
} // namespace trajectory_processing
namespace trajectory_processing
{
bool limitMaxCartesianLinkSpeed(robot_trajectory::RobotTrajectory& trajectory, const double speed,
const moveit::core::LinkModel* link_model);
bool limitMaxCartesianLinkSpeed(robot_trajectory::RobotTrajectory& trajectory, const double speed,
const std::string& link_name = "");
} // namespace trajectory_processing
| {
"content_hash": "9245fbbff7a00e869f4ebbdcabffd037",
"timestamp": "",
"source": "github",
"line_count": 20,
"max_line_length": 98,
"avg_line_length": 32.45,
"alnum_prop": 0.7164869029275809,
"repo_name": "ros-planning/moveit",
"id": "ac3ba03eeb3223c2c6e37b1f02b84feede632a48",
"size": "2481",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "moveit_core/trajectory_processing/include/moveit/trajectory_processing/limit_cartesian_speed.h",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "C",
"bytes": "2268"
},
{
"name": "C++",
"bytes": "7614097"
},
{
"name": "CMake",
"bytes": "157245"
},
{
"name": "Dockerfile",
"bytes": "5483"
},
{
"name": "GDB",
"bytes": "376"
},
{
"name": "HTML",
"bytes": "1171"
},
{
"name": "Makefile",
"bytes": "252"
},
{
"name": "NASL",
"bytes": "2404"
},
{
"name": "Python",
"bytes": "276327"
},
{
"name": "Shell",
"bytes": "15782"
},
{
"name": "TeX",
"bytes": "7222"
}
],
"symlink_target": ""
} |
using System.Collections.Generic;
using System.Net.Http;
namespace Kyrodan.HiDrive.Requests
{
public interface IBaseRequest
{
string ContentType { get; set; }
//IList<HeaderOption> Headers { get; }
IBaseClient Client { get; }
string Method { get; }
string RequestUrl { get; }
IList<KeyValuePair<string, string>> QueryOptions { get; }
HttpRequestMessage GetHttpRequestMessage();
}
} | {
"content_hash": "ed99ae1030a391fabc9524cef2f90ea4",
"timestamp": "",
"source": "github",
"line_count": 22,
"max_line_length": 65,
"avg_line_length": 20.727272727272727,
"alnum_prop": 0.6403508771929824,
"repo_name": "Kyrodan/hidrive-dotnet-sdk",
"id": "194c806bd7983d102c63993c981d93543f978280",
"size": "456",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/Kyrodan.HiDrive/Requests/IBaseRequest.cs",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Batchfile",
"bytes": "1198"
},
{
"name": "C#",
"bytes": "89721"
}
],
"symlink_target": ""
} |
package com.me.ui.widget.custom.dice;
/**
* Description
* Author: Kevin.Tang
* Date: 17/9/19 上午11:35
*/
public interface IDiceOperation {
void start();
void start(int value);
void stop();
void delayDismiss();
void reset();
void setDuration(long duration);
int getValue();
void setStateChangeListener(DiceView.DiceStateChangeListener listener);
} | {
"content_hash": "b89adae6953aa6177d7afe1a7f8bec08",
"timestamp": "",
"source": "github",
"line_count": 25,
"max_line_length": 75,
"avg_line_length": 15.76,
"alnum_prop": 0.6649746192893401,
"repo_name": "meclub/MeUI",
"id": "d9501f5fce36c819d77dd265c482d94373e85b8c",
"size": "398",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "lib_meui/src/main/java/com/me/ui/widget/custom/dice/IDiceOperation.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Java",
"bytes": "175610"
}
],
"symlink_target": ""
} |
class FileEmptyOrUnsupportedType(Exception):
def __init__(self, url):
self.str = "File empty or unsupported type: %s" % (url)
def __str__(self):
return self.str
| {
"content_hash": "167e0a0348bbd672f7bd54c8ad37967b",
"timestamp": "",
"source": "github",
"line_count": 6,
"max_line_length": 63,
"avg_line_length": 31,
"alnum_prop": 0.6129032258064516,
"repo_name": "TobyRoseman/PS4M",
"id": "abe633c5f7bfdeb20339fb50aef839ab4ff50102",
"size": "186",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "crawler/myExceptions.py",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "2929"
},
{
"name": "JavaScript",
"bytes": "7712"
},
{
"name": "Mako",
"bytes": "6779"
},
{
"name": "Nginx",
"bytes": "1562"
},
{
"name": "Python",
"bytes": "53976"
},
{
"name": "Shell",
"bytes": "1566"
}
],
"symlink_target": ""
} |
module Jigashira
module ApplicationHelper
end
end
| {
"content_hash": "1c939497ae674266b0208b147f0a8df0",
"timestamp": "",
"source": "github",
"line_count": 4,
"max_line_length": 26,
"avg_line_length": 13.5,
"alnum_prop": 0.8148148148148148,
"repo_name": "y-yagi/jigashira",
"id": "18dce86b88c158b540aa069c751613cdbccea136",
"size": "54",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "app/helpers/jigashira/application_helper.rb",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "1372"
},
{
"name": "HTML",
"bytes": "5302"
},
{
"name": "JavaScript",
"bytes": "1192"
},
{
"name": "Ruby",
"bytes": "22511"
}
],
"symlink_target": ""
} |
module ApplicationHelper
def simpleoutput
return 'simpleexample'
end
end
| {
"content_hash": "d57d8e856d00e2cdb3d9384888940bf6",
"timestamp": "",
"source": "github",
"line_count": 6,
"max_line_length": 26,
"avg_line_length": 13.666666666666666,
"alnum_prop": 0.7682926829268293,
"repo_name": "raygao/SFRWatcher",
"id": "688d3cd49aa86d7c4f0f36d798fece57aacac48b",
"size": "168",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "app/helpers/application_helper.rb",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "JavaScript",
"bytes": "85591"
},
{
"name": "Ruby",
"bytes": "197148"
}
],
"symlink_target": ""
} |
package sources
import types.DataItem
import org.openqa.selenium.{WebElement, WebDriver, By}
import io.LocalStorage
import org.openqa.selenium.support.ui.Select
import java.util.logging.Level
import java.util
import scala.collection.JavaConverters._
import org.openqa.selenium.chrome.{ChromeOptions, ChromeDriver}
abstract class DataSourceWebDriver extends DataSource {
var driver: WebDriver = null;
{
System.setProperty("webdriver.chrome.driver", "/home/home/Dropbox/web/files/chromedriver")
java.util.logging.Logger.getLogger("org.openqa.selenium.htmlunit").setLevel(Level.OFF)
java.util.logging.Logger.getLogger("com.gargoylesoftware.htmlunit").setLevel(Level.OFF)
java.util.logging.Logger.getLogger("com.gargoylesoftware").setLevel(Level.OFF)
java.util.logging.Logger.getLogger("org.apache.commons.httpclient").setLevel(Level.OFF)
java.util.logging.Logger.getLogger("org.apache.http").setLevel(Level.OFF)
java.util.logging.Logger.getLogger("").setLevel(Level.OFF)
}
def refresh() : Unit = driver = new ChromeDriver()
/**
*
* Goal: Create map of items, then fetch item, then parse item into usable form (ItemData type)
*/
def incognito(): WebDriver = {
val chromeOpts = new ChromeOptions();
chromeOpts.addArguments("--incognito");
driver = new ChromeDriver(chromeOpts);
return driver
}
def reOpen() = {
if (driver != null) {
try {
driver.close()
} catch { case ignore:Exception => ()}
}
driver = new ChromeDriver()
}
//new HtmlUnitDriver()
def getDriver(): WebDriver = {
if (driver == null) {
driver = new ChromeDriver();
return driver
} else {
return driver
}
}
def arise(func:(String) => By)(driver: WebDriver, xpath:String) : util.List[WebElement] = driver.findElements(func(xpath))
def assign(func:(String) => By)(driver: WebDriver, xpath:String, value:String) : Unit =
driver.findElements(func(xpath)).asScala.foreach((element) => element.sendKeys(value))
def select(func:(String) => By)(driver: WebDriver, xpath:String, value:String) : Unit =
driver.findElements(func(xpath)).asScala.foreach((element) => new Select(element).selectByValue(value))
def submit(func:(String) => By)(driver: WebDriver, xpath:String) : Unit =
driver.findElements(func(xpath)).asScala.foreach((element) => element.submit())
def clear(func:(String) => By)(driver: WebDriver, xpath:String) : Unit =
driver.findElements(func(xpath)).asScala.foreach((element) => element.clear())
def click(func:(String) => By)(driver: WebDriver, xpath:String) : Unit =
driver.findElements(func(xpath)).asScala.foreach((element) => element.click())
def quit()(driver: WebDriver, xpath:String) : Unit = driver.quit()
/* Hide this long find by elements */
def xarise(driver: WebDriver, xpath:String) : String = arise(By.xpath)(driver, xpath).get(0).getText
def xassign(driver: WebDriver, xpath:String, value:String) : Unit = assign(By.xpath)(driver, xpath, value)
def xselect(driver: WebDriver, xpath:String, value:String) : Unit = select(By.xpath)(driver, xpath, value)
def xsubmit(driver: WebDriver, xpath:String) : Unit = submit(By.xpath)(driver, xpath)
def xclear(driver: WebDriver, xpath:String) : Unit = clear(By.xpath)(driver, xpath)
def xclick(driver: WebDriver, xpath:String) : Unit = click(By.xpath)(driver, xpath)
def narise(driver: WebDriver, xpath:String) : String = arise(By.name)(driver, xpath).get(0).getText
def nassign(driver: WebDriver, xpath:String, value:String) : Unit = assign(By.name)(driver, xpath, value)
def nselect(driver: WebDriver, xpath:String, value:String) : Unit = select(By.name)(driver, xpath, value)
def nsubmit(driver: WebDriver, xpath:String) : Unit = submit(By.name)(driver, xpath)
def nclear(driver: WebDriver, xpath:String) : Unit = clear(By.name)(driver, xpath)
def nclick(driver: WebDriver, xpath:String) : Unit = click(By.name)(driver, xpath)
def carise(driver: WebDriver, xpath:String) : String = arise(By.cssSelector)(driver, xpath).get(0).getText
def cassign(driver: WebDriver, xpath:String, value:String) : Unit = assign(By.cssSelector)(driver, xpath, value)
def cselect(driver: WebDriver, xpath:String, value:String) : Unit = select(By.cssSelector)(driver, xpath, value)
def csubmit(driver: WebDriver, xpath:String) : Unit = submit(By.cssSelector)(driver, xpath)
def cclear(driver: WebDriver, xpath:String) : Unit = clear(By.cssSelector)(driver, xpath)
def cclick(driver: WebDriver, xpath:String) : Unit = click(By.cssSelector)(driver, xpath)
def printData(data:Seq[DataItem]) = data.sortWith((a,b) => (price2Double(a("Price").toString) < price2Double(b("Price").toString))).
map((ap) => println(ap.source + " and price:" + ap("Price")))
def manageUrl(func:(WebDriver) => DataItem)
(preFunc:Seq[(WebDriver) => Unit])
(moduleName:String, id: String, url: String,
assignMap:Map[String,String],
selectMap:Map[String,String],
submitMap:Seq[String]): DataItem = {
val result = LocalStorage.selectDataItem(moduleName, id)
if (result != null) {
return result
}
//FIXME needs to be here?
val driver: WebDriver = getDriver()
driver.get(url)
preFunc.map((a) => a(driver))
assignMap.map((variable) => xassign(driver, variable._1, variable._2))
selectMap.map((variable) => xselect(driver, variable._1, variable._2))
submitMap.map((variable) => xsubmit(driver, variable))
val predData = func(driver)
LocalStorage.storeDataItem(moduleName, predData)
}
}
| {
"content_hash": "bb516e110cea3a42457f9bf5d4bf1b6f",
"timestamp": "",
"source": "github",
"line_count": 136,
"max_line_length": 134,
"avg_line_length": 41.470588235294116,
"alnum_prop": 0.6945035460992908,
"repo_name": "kappinen/web2local",
"id": "40c0351d90d87478fbef5ff22411b8beb05749a8",
"size": "6791",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "web2local/src/main/scala/sources/DataSourceWebDriver.scala",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Scala",
"bytes": "87831"
},
{
"name": "Shell",
"bytes": "5233"
}
],
"symlink_target": ""
} |
{% extends "src/html/themes/angular/app/_layout-instructor.html" %}
{% block content %}
<div class="page-section">
<h1 class="text-display-1">Create New Course</h1>
</div>
{% include "src/html/themes/html/course/_edit-tabs.html" { tab: "lessons" } %}
{% endblock %} | {
"content_hash": "50837a739b90973e6083d697b9e09e6e",
"timestamp": "",
"source": "github",
"line_count": 11,
"max_line_length": 82,
"avg_line_length": 26.272727272727273,
"alnum_prop": 0.6228373702422145,
"repo_name": "pdev-mooc/mooc",
"id": "56a0eb377ea2c3cceba24264d1351e3fcefac850",
"size": "289",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "mooc-web/src/main/webapp/views/learning-1.1.0/src/html/themes/angular/app/instructor-edit-course-lessons.html",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "3696513"
},
{
"name": "HTML",
"bytes": "4032622"
},
{
"name": "Java",
"bytes": "104508"
},
{
"name": "JavaScript",
"bytes": "805411"
},
{
"name": "Shell",
"bytes": "364"
},
{
"name": "XSLT",
"bytes": "991"
}
],
"symlink_target": ""
} |
layout: slide
title: Scope
id: react-scope
---
<section markdown="1">
* React ist reiner *Presentation Layer* (von _MVI_)
* React ist eine *JS Library* (_kein_ Framework)
* React ist eine Gegenposition zu Angular 1
* Haupteinsatzgebiet: Single Page Applications (SPA)
</section>
<section markdown="1">
* One-way Datenfluss (Props und State)
* JSX (als Art Template)
* Virtual DOM
* Isomorph (d.h. Server-seitiges Rendering) _möglich_
</section>
<section markdown="1">
* Komponenten-basiert
* Template-basiert
* Komponenten sind ES6 Klassen
* _keine_ Vererbung
* Komponenten sind _keine_ DOM Nodes
* Komponentenzustand read-only
</section>
| {
"content_hash": "cb800d8124a0e86b3c1b46f0549a8290",
"timestamp": "",
"source": "github",
"line_count": 26,
"max_line_length": 53,
"avg_line_length": 24.653846153846153,
"alnum_prop": 0.7379095163806553,
"repo_name": "aanno/presentation-js1",
"id": "ac304e09847be1cc45358a1748867dd67011f30c",
"size": "646",
"binary": false,
"copies": "1",
"ref": "refs/heads/gh-pages",
"path": "_posts/4-1-3-react-scope.md",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "499367"
},
{
"name": "HTML",
"bytes": "620158"
},
{
"name": "JavaScript",
"bytes": "433795"
},
{
"name": "Ruby",
"bytes": "5354"
},
{
"name": "Shell",
"bytes": "238"
}
],
"symlink_target": ""
} |
// ChannelEntryType represents a single channel entry in the TSQ file
// a single instance represents a single data 'stripe' in the TEV file
#include "MexDataTypes.h"
struct ChannelEntryType{
ChannelEntryType()
: mHeaderIdx(0), mNWords(0), mOffset(0) {
}
ChannelEntryType(int idx, unsigned int size, MexSupport::MexInt64 offset)
: mHeaderIdx(idx), mNWords(size), mOffset(offset) {
}
// index into TankHeadType channels for this entry
int mHeaderIdx;
// size of this entry, in # words
unsigned int mNWords;
// offset into TEV file, bytes
MexSupport::MexInt64 mOffset;
};
#endif
| {
"content_hash": "090f1b5b99ddc30f709f0168839d2ca3",
"timestamp": "",
"source": "github",
"line_count": 21,
"max_line_length": 77,
"avg_line_length": 31.857142857142858,
"alnum_prop": 0.6576980568011959,
"repo_name": "NeuralDataFormats/matlab_tdt",
"id": "d6dfd22ae131773ac22ef7eea3bd8ecb001ea767",
"size": "729",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "old/dataRetrieval/private/ChannelEntryType.h",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C",
"bytes": "729"
},
{
"name": "C++",
"bytes": "28513"
},
{
"name": "Matlab",
"bytes": "103875"
}
],
"symlink_target": ""
} |
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#ifndef nsInternetCiter_h__
#define nsInternetCiter_h__
#include "nscore.h"
/** Mail citations using standard Internet style.
*/
class nsInternetCiter
{
public:
static nsresult GetCiteString(const nsAString & aInString, nsAString & aOutString);
static nsresult StripCites(const nsAString & aInString, nsAString & aOutString);
static nsresult Rewrap(const nsAString & aInString,
uint32_t aWrapCol, uint32_t aFirstLineOffset,
bool aRespectNewlines,
nsAString & aOutString);
protected:
static nsresult StripCitesAndLinebreaks(const nsAString& aInString, nsAString& aOutString,
bool aLinebreaksToo, int32_t* aCiteLevel);
};
#endif //nsInternetCiter_h__
| {
"content_hash": "f6e250013e827e80e6292c70aa0cfd08",
"timestamp": "",
"source": "github",
"line_count": 31,
"max_line_length": 92,
"avg_line_length": 34.483870967741936,
"alnum_prop": 0.6641721234798877,
"repo_name": "sergecodd/FireFox-OS",
"id": "57f7229a273292f9c6800637085b6e27d18fe599",
"size": "1069",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "B2G/gecko/editor/libeditor/text/nsInternetCiter.h",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Ada",
"bytes": "443"
},
{
"name": "ApacheConf",
"bytes": "85"
},
{
"name": "Assembly",
"bytes": "5123438"
},
{
"name": "Awk",
"bytes": "46481"
},
{
"name": "Batchfile",
"bytes": "56250"
},
{
"name": "C",
"bytes": "101720951"
},
{
"name": "C#",
"bytes": "38531"
},
{
"name": "C++",
"bytes": "148896543"
},
{
"name": "CMake",
"bytes": "23541"
},
{
"name": "CSS",
"bytes": "2758664"
},
{
"name": "DIGITAL Command Language",
"bytes": "56757"
},
{
"name": "Emacs Lisp",
"bytes": "12694"
},
{
"name": "Erlang",
"bytes": "889"
},
{
"name": "FLUX",
"bytes": "34449"
},
{
"name": "GLSL",
"bytes": "26344"
},
{
"name": "Gnuplot",
"bytes": "710"
},
{
"name": "Groff",
"bytes": "447012"
},
{
"name": "HTML",
"bytes": "43343468"
},
{
"name": "IDL",
"bytes": "1455122"
},
{
"name": "Java",
"bytes": "43261012"
},
{
"name": "JavaScript",
"bytes": "46646658"
},
{
"name": "Lex",
"bytes": "38358"
},
{
"name": "Logos",
"bytes": "21054"
},
{
"name": "Makefile",
"bytes": "2733844"
},
{
"name": "Matlab",
"bytes": "67316"
},
{
"name": "Max",
"bytes": "3698"
},
{
"name": "NSIS",
"bytes": "421625"
},
{
"name": "Objective-C",
"bytes": "877657"
},
{
"name": "Objective-C++",
"bytes": "737713"
},
{
"name": "PHP",
"bytes": "17415"
},
{
"name": "Pascal",
"bytes": "6780"
},
{
"name": "Perl",
"bytes": "1153180"
},
{
"name": "Perl6",
"bytes": "1255"
},
{
"name": "PostScript",
"bytes": "1139"
},
{
"name": "PowerShell",
"bytes": "8252"
},
{
"name": "Protocol Buffer",
"bytes": "26553"
},
{
"name": "Python",
"bytes": "8453201"
},
{
"name": "Ragel in Ruby Host",
"bytes": "3481"
},
{
"name": "Ruby",
"bytes": "5116"
},
{
"name": "Scilab",
"bytes": "7"
},
{
"name": "Shell",
"bytes": "3383832"
},
{
"name": "SourcePawn",
"bytes": "23661"
},
{
"name": "TeX",
"bytes": "879606"
},
{
"name": "WebIDL",
"bytes": "1902"
},
{
"name": "XSLT",
"bytes": "13134"
},
{
"name": "Yacc",
"bytes": "112744"
}
],
"symlink_target": ""
} |
import gulp from 'gulp'
import gutil from 'gulp-util'
import loadTasks from 'require-dir'
import _ from 'lodash'
import watcher from './tasks/libs/watcher'
loadTasks('./tasks')
_.set(gutil.env, 'base.src', 'src')
_.set(gutil.env, 'base.dest', 'dest')
_.set(gutil.env, 'tasks.build', {
taskQuene: [
'eslint',
'clean',
'copy',
'jade',
'stylus',
'browserify'
]
})
if (gutil.env.prod) {
process.env.NODE_ENV = 'production'
}
if (gutil.env.watch) {
watcher.setWatcher()
}
gulp.task('dev', ()=> {
watcher.setWatcher()
gulp.start(['build', 'server'])
})
gulp.task('default', ['build'])
| {
"content_hash": "eca6ec2676a1ccbb64f8ecebcab1e82a",
"timestamp": "",
"source": "github",
"line_count": 34,
"max_line_length": 42,
"avg_line_length": 18.235294117647058,
"alnum_prop": 0.617741935483871,
"repo_name": "tuberrabbit/just-do-it",
"id": "f93f426f82429a8d75bb62da56423a9a4e42bcd4",
"size": "620",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "gulpfile.babel.js",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "CSS",
"bytes": "28"
},
{
"name": "HTML",
"bytes": "243"
},
{
"name": "JavaScript",
"bytes": "13807"
}
],
"symlink_target": ""
} |
export default class Greeter {
constructor(name) {
this.name = name;
}
async greet() {
const greeting = await Greeter.sayHi(this.name);
return greeting;
}
static sayHi(name) {
return new Promise(resolve => setTimeout(() => resolve(`Hello, my name is ${name}`), 1500));
}
}
| {
"content_hash": "72f9d5d6f74283a8187b05f21aa46314",
"timestamp": "",
"source": "github",
"line_count": 15,
"max_line_length": 94,
"avg_line_length": 19.4,
"alnum_prop": 0.6529209621993127,
"repo_name": "ba55ie/babel-parse-async",
"id": "3d4570442e5bf44d7caa7794ed3644436c2d4958",
"size": "291",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "greeter.js",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "JavaScript",
"bytes": "463"
}
],
"symlink_target": ""
} |
#include <folly/String.h>
#include <folly/Format.h>
#include <folly/ScopeGuard.h>
#include <cerrno>
#include <cstdarg>
#include <cstring>
#include <stdexcept>
#include <iterator>
#include <cctype>
#include <string.h>
#include <glog/logging.h>
namespace folly {
namespace {
int stringAppendfImplHelper(char* buf,
size_t bufsize,
const char* format,
va_list args) {
va_list args_copy;
va_copy(args_copy, args);
int bytes_used = vsnprintf(buf, bufsize, format, args_copy);
va_end(args_copy);
return bytes_used;
}
void stringAppendfImpl(std::string& output, const char* format, va_list args) {
// Very simple; first, try to avoid an allocation by using an inline
// buffer. If that fails to hold the output string, allocate one on
// the heap, use it instead.
//
// It is hard to guess the proper size of this buffer; some
// heuristics could be based on the number of format characters, or
// static analysis of a codebase. Or, we can just pick a number
// that seems big enough for simple cases (say, one line of text on
// a terminal) without being large enough to be concerning as a
// stack variable.
std::array<char, 128> inline_buffer;
int bytes_used = stringAppendfImplHelper(
inline_buffer.data(), inline_buffer.size(), format, args);
if (bytes_used < 0) {
throw std::runtime_error(to<std::string>(
"Invalid format string; snprintf returned negative "
"with format string: ",
format));
}
if (static_cast<size_t>(bytes_used) < inline_buffer.size()) {
output.append(inline_buffer.data(), bytes_used);
return;
}
// Couldn't fit. Heap allocate a buffer, oh well.
std::unique_ptr<char[]> heap_buffer(new char[bytes_used + 1]);
int final_bytes_used =
stringAppendfImplHelper(heap_buffer.get(), bytes_used + 1, format, args);
// The second call can take fewer bytes if, for example, we were printing a
// string buffer with null-terminating char using a width specifier -
// vsnprintf("%.*s", buf.size(), buf)
CHECK(bytes_used >= final_bytes_used);
// We don't keep the trailing '\0' in our output string
output.append(heap_buffer.get(), final_bytes_used);
}
} // anon namespace
std::string stringPrintf(const char* format, ...) {
va_list ap;
va_start(ap, format);
SCOPE_EXIT {
va_end(ap);
};
return stringVPrintf(format, ap);
}
std::string stringVPrintf(const char* format, va_list ap) {
std::string ret;
stringAppendfImpl(ret, format, ap);
return ret;
}
// Basic declarations; allow for parameters of strings and string
// pieces to be specified.
std::string& stringAppendf(std::string* output, const char* format, ...) {
va_list ap;
va_start(ap, format);
SCOPE_EXIT {
va_end(ap);
};
return stringVAppendf(output, format, ap);
}
std::string& stringVAppendf(std::string* output,
const char* format,
va_list ap) {
stringAppendfImpl(*output, format, ap);
return *output;
}
void stringPrintf(std::string* output, const char* format, ...) {
va_list ap;
va_start(ap, format);
SCOPE_EXIT {
va_end(ap);
};
return stringVPrintf(output, format, ap);
}
void stringVPrintf(std::string* output, const char* format, va_list ap) {
output->clear();
stringAppendfImpl(*output, format, ap);
};
namespace {
struct PrettySuffix {
const char* suffix;
double val;
};
const PrettySuffix kPrettyTimeSuffixes[] = {
{ "s ", 1e0L },
{ "ms", 1e-3L },
{ "us", 1e-6L },
{ "ns", 1e-9L },
{ "ps", 1e-12L },
{ "s ", 0 },
{ 0, 0 },
};
const PrettySuffix kPrettyBytesMetricSuffixes[] = {
{ "TB", 1e12L },
{ "GB", 1e9L },
{ "MB", 1e6L },
{ "kB", 1e3L },
{ "B ", 0L },
{ 0, 0 },
};
const PrettySuffix kPrettyBytesBinarySuffixes[] = {
{ "TB", int64_t(1) << 40 },
{ "GB", int64_t(1) << 30 },
{ "MB", int64_t(1) << 20 },
{ "kB", int64_t(1) << 10 },
{ "B ", 0L },
{ 0, 0 },
};
const PrettySuffix kPrettyBytesBinaryIECSuffixes[] = {
{ "TiB", int64_t(1) << 40 },
{ "GiB", int64_t(1) << 30 },
{ "MiB", int64_t(1) << 20 },
{ "KiB", int64_t(1) << 10 },
{ "B ", 0L },
{ 0, 0 },
};
const PrettySuffix kPrettyUnitsMetricSuffixes[] = {
{ "tril", 1e12L },
{ "bil", 1e9L },
{ "M", 1e6L },
{ "k", 1e3L },
{ " ", 0 },
{ 0, 0 },
};
const PrettySuffix kPrettyUnitsBinarySuffixes[] = {
{ "T", int64_t(1) << 40 },
{ "G", int64_t(1) << 30 },
{ "M", int64_t(1) << 20 },
{ "k", int64_t(1) << 10 },
{ " ", 0 },
{ 0, 0 },
};
const PrettySuffix kPrettyUnitsBinaryIECSuffixes[] = {
{ "Ti", int64_t(1) << 40 },
{ "Gi", int64_t(1) << 30 },
{ "Mi", int64_t(1) << 20 },
{ "Ki", int64_t(1) << 10 },
{ " ", 0 },
{ 0, 0 },
};
const PrettySuffix kPrettySISuffixes[] = {
{ "Y", 1e24L },
{ "Z", 1e21L },
{ "E", 1e18L },
{ "P", 1e15L },
{ "T", 1e12L },
{ "G", 1e9L },
{ "M", 1e6L },
{ "k", 1e3L },
{ "h", 1e2L },
{ "da", 1e1L },
{ "d", 1e-1L },
{ "c", 1e-2L },
{ "m", 1e-3L },
{ "u", 1e-6L },
{ "n", 1e-9L },
{ "p", 1e-12L },
{ "f", 1e-15L },
{ "a", 1e-18L },
{ "z", 1e-21L },
{ "y", 1e-24L },
{ " ", 0 },
{ 0, 0}
};
const PrettySuffix* const kPrettySuffixes[PRETTY_NUM_TYPES] = {
kPrettyTimeSuffixes,
kPrettyBytesMetricSuffixes,
kPrettyBytesBinarySuffixes,
kPrettyBytesBinaryIECSuffixes,
kPrettyUnitsMetricSuffixes,
kPrettyUnitsBinarySuffixes,
kPrettyUnitsBinaryIECSuffixes,
kPrettySISuffixes,
};
} // namespace
std::string prettyPrint(double val, PrettyType type, bool addSpace) {
char buf[100];
// pick the suffixes to use
assert(type >= 0);
assert(type < PRETTY_NUM_TYPES);
const PrettySuffix* suffixes = kPrettySuffixes[type];
// find the first suffix we're bigger than -- then use it
double abs_val = fabs(val);
for (int i = 0; suffixes[i].suffix; ++i) {
if (abs_val >= suffixes[i].val) {
snprintf(buf, sizeof buf, "%.4g%s%s",
(suffixes[i].val ? (val / suffixes[i].val)
: val),
(addSpace ? " " : ""),
suffixes[i].suffix);
return std::string(buf);
}
}
// no suffix, we've got a tiny value -- just print it in sci-notation
snprintf(buf, sizeof buf, "%.4g", val);
return std::string(buf);
}
//TODO:
//1) Benchmark & optimize
double prettyToDouble(folly::StringPiece *const prettyString,
const PrettyType type) {
double value = folly::to<double>(prettyString);
while (prettyString->size() > 0 && std::isspace(prettyString->front())) {
prettyString->advance(1); //Skipping spaces between number and suffix
}
const PrettySuffix* suffixes = kPrettySuffixes[type];
int longestPrefixLen = -1;
int bestPrefixId = -1;
for (int j = 0 ; suffixes[j].suffix; ++j) {
if (suffixes[j].suffix[0] == ' '){//Checking for " " -> number rule.
if (longestPrefixLen == -1) {
longestPrefixLen = 0; //No characters to skip
bestPrefixId = j;
}
} else if (prettyString->startsWith(suffixes[j].suffix)) {
int suffixLen = strlen(suffixes[j].suffix);
//We are looking for a longest suffix matching prefix of the string
//after numeric value. We need this in case suffixes have common prefix.
if (suffixLen > longestPrefixLen) {
longestPrefixLen = suffixLen;
bestPrefixId = j;
}
}
}
if (bestPrefixId == -1) { //No valid suffix rule found
throw std::invalid_argument(folly::to<std::string>(
"Unable to parse suffix \"",
prettyString->toString(), "\""));
}
prettyString->advance(longestPrefixLen);
return suffixes[bestPrefixId].val ? value * suffixes[bestPrefixId].val :
value;
}
double prettyToDouble(folly::StringPiece prettyString, const PrettyType type){
double result = prettyToDouble(&prettyString, type);
detail::enforceWhitespace(prettyString.data(),
prettyString.data() + prettyString.size());
return result;
}
std::string hexDump(const void* ptr, size_t size) {
std::ostringstream os;
hexDump(ptr, size, std::ostream_iterator<StringPiece>(os, "\n"));
return os.str();
}
fbstring errnoStr(int err) {
int savedErrno = errno;
// Ensure that we reset errno upon exit.
auto guard(makeGuard([&] { errno = savedErrno; }));
char buf[1024];
buf[0] = '\0';
fbstring result;
// https://developer.apple.com/library/mac/documentation/Darwin/Reference/ManPages/man3/strerror_r.3.html
// http://www.kernel.org/doc/man-pages/online/pages/man3/strerror.3.html
#if defined(_WIN32) && (defined(__MINGW32__) || defined(_MSC_VER))
// mingw64 has no strerror_r, but Windows has strerror_s, which C11 added
// as well. So maybe we should use this across all platforms (together
// with strerrorlen_s). Note strerror_r and _s have swapped args.
int r = strerror_s(buf, sizeof(buf), err);
if (r != 0) {
result = to<fbstring>(
"Unknown error ", err,
" (strerror_r failed with error ", errno, ")");
} else {
result.assign(buf);
}
#elif defined(FOLLY_HAVE_XSI_STRERROR_R) || \
defined(__APPLE__) || defined(__ANDROID__)
// Using XSI-compatible strerror_r
int r = strerror_r(err, buf, sizeof(buf));
// OSX/FreeBSD use EINVAL and Linux uses -1 so just check for non-zero
if (r != 0) {
result = to<fbstring>(
"Unknown error ", err,
" (strerror_r failed with error ", errno, ")");
} else {
result.assign(buf);
}
#else
// Using GNU strerror_r
result.assign(strerror_r(err, buf, sizeof(buf)));
#endif
return result;
}
namespace {
void toLowerAscii8(char& c) {
// Branchless tolower, based on the input-rotating trick described
// at http://www.azillionmonkeys.com/qed/asmexample.html
//
// This algorithm depends on an observation: each uppercase
// ASCII character can be converted to its lowercase equivalent
// by adding 0x20.
// Step 1: Clear the high order bit. We'll deal with it in Step 5.
unsigned char rotated = c & 0x7f;
// Currently, the value of rotated, as a function of the original c is:
// below 'A': 0- 64
// 'A'-'Z': 65- 90
// above 'Z': 91-127
// Step 2: Add 0x25 (37)
rotated += 0x25;
// Now the value of rotated, as a function of the original c is:
// below 'A': 37-101
// 'A'-'Z': 102-127
// above 'Z': 128-164
// Step 3: clear the high order bit
rotated &= 0x7f;
// below 'A': 37-101
// 'A'-'Z': 102-127
// above 'Z': 0- 36
// Step 4: Add 0x1a (26)
rotated += 0x1a;
// below 'A': 63-127
// 'A'-'Z': 128-153
// above 'Z': 25- 62
// At this point, note that only the uppercase letters have been
// transformed into values with the high order bit set (128 and above).
// Step 5: Shift the high order bit 2 spaces to the right: the spot
// where the only 1 bit in 0x20 is. But first, how we ignored the
// high order bit of the original c in step 1? If that bit was set,
// we may have just gotten a false match on a value in the range
// 128+'A' to 128+'Z'. To correct this, need to clear the high order
// bit of rotated if the high order bit of c is set. Since we don't
// care about the other bits in rotated, the easiest thing to do
// is invert all the bits in c and bitwise-and them with rotated.
rotated &= ~c;
rotated >>= 2;
// Step 6: Apply a mask to clear everything except the 0x20 bit
// in rotated.
rotated &= 0x20;
// At this point, rotated is 0x20 if c is 'A'-'Z' and 0x00 otherwise
// Step 7: Add rotated to c
c += rotated;
}
void toLowerAscii32(uint32_t& c) {
// Besides being branchless, the algorithm in toLowerAscii8() has another
// interesting property: None of the addition operations will cause
// an overflow in the 8-bit value. So we can pack four 8-bit values
// into a uint32_t and run each operation on all four values in parallel
// without having to use any CPU-specific SIMD instructions.
uint32_t rotated = c & uint32_t(0x7f7f7f7fL);
rotated += uint32_t(0x25252525L);
rotated &= uint32_t(0x7f7f7f7fL);
rotated += uint32_t(0x1a1a1a1aL);
// Step 5 involves a shift, so some bits will spill over from each
// 8-bit value into the next. But that's okay, because they're bits
// that will be cleared by the mask in step 6 anyway.
rotated &= ~c;
rotated >>= 2;
rotated &= uint32_t(0x20202020L);
c += rotated;
}
void toLowerAscii64(uint64_t& c) {
// 64-bit version of toLower32
uint64_t rotated = c & uint64_t(0x7f7f7f7f7f7f7f7fL);
rotated += uint64_t(0x2525252525252525L);
rotated &= uint64_t(0x7f7f7f7f7f7f7f7fL);
rotated += uint64_t(0x1a1a1a1a1a1a1a1aL);
rotated &= ~c;
rotated >>= 2;
rotated &= uint64_t(0x2020202020202020L);
c += rotated;
}
} // anon namespace
void toLowerAscii(char* str, size_t length) {
static const size_t kAlignMask64 = 7;
static const size_t kAlignMask32 = 3;
// Convert a character at a time until we reach an address that
// is at least 32-bit aligned
size_t n = (size_t)str;
n &= kAlignMask32;
n = std::min(n, length);
size_t offset = 0;
if (n != 0) {
n = std::min(4 - n, length);
do {
toLowerAscii8(str[offset]);
offset++;
} while (offset < n);
}
n = (size_t)(str + offset);
n &= kAlignMask64;
if ((n != 0) && (offset + 4 <= length)) {
// The next address is 32-bit aligned but not 64-bit aligned.
// Convert the next 4 bytes in order to get to the 64-bit aligned
// part of the input.
toLowerAscii32(*(uint32_t*)(str + offset));
offset += 4;
}
// Convert 8 characters at a time
while (offset + 8 <= length) {
toLowerAscii64(*(uint64_t*)(str + offset));
offset += 8;
}
// Convert 4 characters at a time
while (offset + 4 <= length) {
toLowerAscii32(*(uint32_t*)(str + offset));
offset += 4;
}
// Convert any characters remaining after the last 4-byte aligned group
while (offset < length) {
toLowerAscii8(str[offset]);
offset++;
}
}
namespace detail {
size_t hexDumpLine(const void* ptr, size_t offset, size_t size,
std::string& line) {
// Line layout:
// 8: address
// 1: space
// (1+2)*16: hex bytes, each preceded by a space
// 1: space separating the two halves
// 3: " |"
// 16: characters
// 1: "|"
// Total: 78
line.clear();
line.reserve(78);
const uint8_t* p = reinterpret_cast<const uint8_t*>(ptr) + offset;
size_t n = std::min(size - offset, size_t(16));
format("{:08x} ", offset).appendTo(line);
for (size_t i = 0; i < n; i++) {
if (i == 8) {
line.push_back(' ');
}
format(" {:02x}", p[i]).appendTo(line);
}
// 3 spaces for each byte we're not printing, one separating the halves
// if necessary
line.append(3 * (16 - n) + (n <= 8), ' ');
line.append(" |");
for (size_t i = 0; i < n; i++) {
char c = (p[i] >= 32 && p[i] <= 126 ? static_cast<char>(p[i]) : '.');
line.push_back(c);
}
line.append(16 - n, ' ');
line.push_back('|');
DCHECK_EQ(line.size(), 78);
return n;
}
} // namespace detail
std::string stripLeftMargin(std::string s) {
std::vector<StringPiece> pieces;
split("\n", s, pieces);
auto piecer = range(pieces);
auto piece = (piecer.end() - 1);
auto needle = std::find_if(piece->begin(),
piece->end(),
[](char c) { return c != ' ' && c != '\t'; });
if (needle == piece->end()) {
(piecer.end() - 1)->clear();
}
piece = piecer.begin();
needle = std::find_if(piece->begin(),
piece->end(),
[](char c) { return c != ' ' && c != '\t'; });
if (needle == piece->end()) {
piecer.erase(piecer.begin(), piecer.begin() + 1);
}
const auto sentinel = std::numeric_limits<size_t>::max();
auto indent = sentinel;
size_t max_length = 0;
for (piece = piecer.begin(); piece != piecer.end(); piece++) {
needle = std::find_if(piece->begin(),
piece->end(),
[](char c) { return c != ' ' && c != '\t'; });
if (needle != piece->end()) {
indent = std::min<size_t>(indent, needle - piece->begin());
} else {
max_length = std::max<size_t>(piece->size(), max_length);
}
}
indent = indent == sentinel ? max_length : indent;
for (piece = piecer.begin(); piece != piecer.end(); piece++) {
if (piece->size() < indent) {
piece->clear();
} else {
piece->erase(piece->begin(), piece->begin() + indent);
}
}
return join("\n", piecer);
}
} // namespace folly
#ifdef FOLLY_DEFINED_DMGL
# undef FOLLY_DEFINED_DMGL
# undef DMGL_NO_OPTS
# undef DMGL_PARAMS
# undef DMGL_ANSI
# undef DMGL_JAVA
# undef DMGL_VERBOSE
# undef DMGL_TYPES
# undef DMGL_RET_POSTFIX
#endif
| {
"content_hash": "587e4b3dd7a54e611b7e00701eb8cd2b",
"timestamp": "",
"source": "github",
"line_count": 592,
"max_line_length": 107,
"avg_line_length": 28.49493243243243,
"alnum_prop": 0.6008062125792875,
"repo_name": "Hincoin/folly",
"id": "43404026d031324daa76bbf1495f43e00218df00",
"size": "17464",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "folly/String.cpp",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Assembly",
"bytes": "4324"
},
{
"name": "C",
"bytes": "46589"
},
{
"name": "C++",
"bytes": "5677118"
},
{
"name": "CSS",
"bytes": "165"
},
{
"name": "M4",
"bytes": "72013"
},
{
"name": "Makefile",
"bytes": "22409"
},
{
"name": "Python",
"bytes": "8610"
},
{
"name": "Ruby",
"bytes": "1531"
},
{
"name": "Shell",
"bytes": "6121"
}
],
"symlink_target": ""
} |
<?php declare(strict_types = 1);
namespace Smalldb\StateMachine\Definition\Builder;
use Smalldb\StateMachine\InvalidArgumentException;
use Throwable;
class PreprocessorPassException extends InvalidArgumentException
{
public function __construct($message = "", $code = 0, Throwable $previous = null)
{
parent::__construct($message, $code, $previous);
}
}
| {
"content_hash": "00d5730afcd57f612f9f2a390b7924c3",
"timestamp": "",
"source": "github",
"line_count": 18,
"max_line_length": 82,
"avg_line_length": 20.333333333333332,
"alnum_prop": 0.7540983606557377,
"repo_name": "smalldb/libSmalldb",
"id": "abf7e1513c2c2197da88165f56dc57aaabb474f0",
"size": "990",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/Definition/Builder/PreprocessorPassException.php",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "CSS",
"bytes": "1575"
},
{
"name": "JavaScript",
"bytes": "1585"
},
{
"name": "Makefile",
"bytes": "1786"
},
{
"name": "PHP",
"bytes": "913693"
},
{
"name": "Shell",
"bytes": "935"
}
],
"symlink_target": ""
} |
from __future__ import unicode_literals
import pytest
from gitlawca import downloader
from gitlawca.database import Act
#pylint: disable=W0621
@pytest.fixture
def act():
output = Act()
output.code = 'A-1'
output.act_date = '20150101'
output.language = 'eng'
return output
def test_act_file_location(act):
assert downloader.act_file_location(act) == 'canada/eng/acts/A/A-1.md'
| {
"content_hash": "56d610b9d2732ab2199ef10d58b98d8a",
"timestamp": "",
"source": "github",
"line_count": 17,
"max_line_length": 74,
"avg_line_length": 23.705882352941178,
"alnum_prop": 0.707196029776675,
"repo_name": "JasonMWhite/gitlawca-scraper",
"id": "96e6dc1ae7bce8c3000962d6935e42dc0b0ee44a",
"size": "403",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "tests/test_downloader.py",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Mako",
"bytes": "494"
},
{
"name": "Python",
"bytes": "42612"
}
],
"symlink_target": ""
} |
using NUnit.Framework;
using System;
using System.Web;
using System.Web.UI.WebControls;
using System.Collections;
using System.ComponentModel;
using System.IO;
namespace MonoTests.System.Web.UI.WebControls
{
[TestFixture]
public class ControlIDConverterTest
{
ControlIDConverter ctrlConv;
[TearDown]
public void TearDown () {}
[SetUp]
public void SetUp ()
{
ctrlConv = new ControlIDConverter ();
}
[Test]
public void TestGetStandardValues ()
{
Assert.IsNull (ctrlConv.GetStandardValues (), "GSV#1");
Assert.IsNull (ctrlConv.GetStandardValues (null), "GSV#2");
}
[Test]
public void TestGetStandardValuesExclusive ()
{
Assert.IsFalse (ctrlConv.GetStandardValuesExclusive (), "GSVE#1");
Assert.IsFalse (ctrlConv.GetStandardValuesExclusive (null), "GSVE#2");
}
[Test]
public void TestGetStandardValuesSupported ()
{
Assert.IsFalse (ctrlConv.GetStandardValuesSupported (), "GSVS#1");
Assert.IsFalse (ctrlConv.GetStandardValuesSupported (null), "GSVS#2");
}
}
}
#endif
| {
"content_hash": "ab24f719fd11d68cb84fbaa694e34c67",
"timestamp": "",
"source": "github",
"line_count": 53,
"max_line_length": 73,
"avg_line_length": 19.88679245283019,
"alnum_prop": 0.7077798861480076,
"repo_name": "jjenki11/blaze-chem-rendering",
"id": "f674e12f225942e932d5b2cdfb651724bd3f4164",
"size": "2332",
"binary": false,
"copies": "3",
"ref": "refs/heads/master",
"path": "qca_designer/lib/ml-pnet-0.8.1/mcs-sources/class/System.Web/Test/System.Web.UI.WebControls/TestControlIDConverter.cs",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Shell",
"bytes": "2476"
}
],
"symlink_target": ""
} |
[](https://travis-ci.org/Marius Horga/randomizeCategoryOnNSArray)
[](http://cocoadocs.org/docsets/randomizeCategoryOnNSArray)
[](http://cocoadocs.org/docsets/randomizeCategoryOnNSArray)
[](http://cocoadocs.org/docsets/randomizeCategoryOnNSArray)
## Usage
To run the example project, clone the repo, and run `pod install` from the Example directory first.
## Requirements
## Installation
randomizeCategoryOnNSArray is available through [CocoaPods](http://cocoapods.org). To install
it, simply add the following line to your Podfile:
pod "randomizeCategoryOnNSArray"
## Author
Marius Horga, [email protected]
## License
randomizeCategoryOnNSArray is available under the MIT license. See the LICENSE file for more info.
| {
"content_hash": "284a5ffd7d1a7b27da7eb438d92d5087",
"timestamp": "",
"source": "github",
"line_count": 26,
"max_line_length": 162,
"avg_line_length": 42.03846153846154,
"alnum_prop": 0.7968892955169259,
"repo_name": "mhorga/testPod",
"id": "849d426da36e40e40a7d24a47823f375f2890c4f",
"size": "1123",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "README.md",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C",
"bytes": "1000"
},
{
"name": "Objective-C",
"bytes": "9964"
},
{
"name": "Ruby",
"bytes": "4830"
},
{
"name": "Shell",
"bytes": "8074"
}
],
"symlink_target": ""
} |
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<!--[if IE]><meta http-equiv="X-UA-Compatible" content="IE=edge"><![endif]-->
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="generator" content="Asciidoctor 1.5.2">
<title>Pagination</title>
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Open+Sans:300,300italic,400,400italic,600,600italic%7CNoto+Serif:400,400italic,700,700italic%7CDroid+Sans+Mono:400">
<style>
/* Asciidoctor default stylesheet | MIT License | http://asciidoctor.org */
/* Remove the comments around the @import statement below when using this as a custom stylesheet */
/*@import "https://fonts.googleapis.com/css?family=Open+Sans:300,300italic,400,400italic,600,600italic%7CNoto+Serif:400,400italic,700,700italic%7CDroid+Sans+Mono:400";*/
article,aside,details,figcaption,figure,footer,header,hgroup,main,nav,section,summary{display:block}
audio,canvas,video{display:inline-block}
audio:not([controls]){display:none;height:0}
[hidden],template{display:none}
script{display:none!important}
html{font-family:sans-serif;-ms-text-size-adjust:100%;-webkit-text-size-adjust:100%}
body{margin:0}
a{background:transparent}
a:focus{outline:thin dotted}
a:active,a:hover{outline:0}
h1{font-size:2em;margin:.67em 0}
abbr[title]{border-bottom:1px dotted}
b,strong{font-weight:bold}
dfn{font-style:italic}
hr{-moz-box-sizing:content-box;box-sizing:content-box;height:0}
mark{background:#ff0;color:#000}
code,kbd,pre,samp{font-family:monospace;font-size:1em}
pre{white-space:pre-wrap}
q{quotes:"\201C" "\201D" "\2018" "\2019"}
small{font-size:80%}
sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}
sup{top:-.5em}
sub{bottom:-.25em}
img{border:0}
svg:not(:root){overflow:hidden}
figure{margin:0}
fieldset{border:1px solid silver;margin:0 2px;padding:.35em .625em .75em}
legend{border:0;padding:0}
button,input,select,textarea{font-family:inherit;font-size:100%;margin:0}
button,input{line-height:normal}
button,select{text-transform:none}
button,html input[type="button"],input[type="reset"],input[type="submit"]{-webkit-appearance:button;cursor:pointer}
button[disabled],html input[disabled]{cursor:default}
input[type="checkbox"],input[type="radio"]{box-sizing:border-box;padding:0}
input[type="search"]{-webkit-appearance:textfield;-moz-box-sizing:content-box;-webkit-box-sizing:content-box;box-sizing:content-box}
input[type="search"]::-webkit-search-cancel-button,input[type="search"]::-webkit-search-decoration{-webkit-appearance:none}
button::-moz-focus-inner,input::-moz-focus-inner{border:0;padding:0}
textarea{overflow:auto;vertical-align:top}
table{border-collapse:collapse;border-spacing:0}
*,*:before,*:after{-moz-box-sizing:border-box;-webkit-box-sizing:border-box;box-sizing:border-box}
html,body{font-size:100%}
body{background:#fff;color:rgba(0,0,0,.8);padding:0;margin:0;font-family:"Noto Serif","DejaVu Serif",serif;font-weight:400;font-style:normal;line-height:1;position:relative;cursor:auto}
a:hover{cursor:pointer}
img,object,embed{max-width:100%;height:auto}
object,embed{height:100%}
img{-ms-interpolation-mode:bicubic}
#map_canvas img,#map_canvas embed,#map_canvas object,.map_canvas img,.map_canvas embed,.map_canvas object{max-width:none!important}
.left{float:left!important}
.right{float:right!important}
.text-left{text-align:left!important}
.text-right{text-align:right!important}
.text-center{text-align:center!important}
.text-justify{text-align:justify!important}
.hide{display:none}
.antialiased,body{-webkit-font-smoothing:antialiased}
img{display:inline-block;vertical-align:middle}
textarea{height:auto;min-height:50px}
select{width:100%}
p.lead,.paragraph.lead>p,#preamble>.sectionbody>.paragraph:first-of-type p{font-size:1.21875em;line-height:1.6}
.subheader,.admonitionblock td.content>.title,.audioblock>.title,.exampleblock>.title,.imageblock>.title,.listingblock>.title,.literalblock>.title,.stemblock>.title,.openblock>.title,.paragraph>.title,.quoteblock>.title,table.tableblock>.title,.verseblock>.title,.videoblock>.title,.dlist>.title,.olist>.title,.ulist>.title,.qlist>.title,.hdlist>.title{line-height:1.45;color:#7a2518;font-weight:400;margin-top:0;margin-bottom:.25em}
div,dl,dt,dd,ul,ol,li,h1,h2,h3,#toctitle,.sidebarblock>.content>.title,h4,h5,h6,pre,form,p,blockquote,th,td{margin:0;padding:0;direction:ltr}
a{color:#2156a5;text-decoration:underline;line-height:inherit}
a:hover,a:focus{color:#1d4b8f}
a img{border:none}
p{font-family:inherit;font-weight:400;font-size:1em;line-height:1.6;margin-bottom:1.25em;text-rendering:optimizeLegibility}
p aside{font-size:.875em;line-height:1.35;font-style:italic}
h1,h2,h3,#toctitle,.sidebarblock>.content>.title,h4,h5,h6{font-family:"Open Sans","DejaVu Sans",sans-serif;font-weight:300;font-style:normal;color:#ba3925;text-rendering:optimizeLegibility;margin-top:1em;margin-bottom:.5em;line-height:1.0125em}
h1 small,h2 small,h3 small,#toctitle small,.sidebarblock>.content>.title small,h4 small,h5 small,h6 small{font-size:60%;color:#e99b8f;line-height:0}
h1{font-size:2.125em}
h2{font-size:1.6875em}
h3,#toctitle,.sidebarblock>.content>.title{font-size:1.375em}
h4,h5{font-size:1.125em}
h6{font-size:1em}
hr{border:solid #ddddd8;border-width:1px 0 0;clear:both;margin:1.25em 0 1.1875em;height:0}
em,i{font-style:italic;line-height:inherit}
strong,b{font-weight:bold;line-height:inherit}
small{font-size:60%;line-height:inherit}
code{font-family:"Droid Sans Mono","DejaVu Sans Mono",monospace;font-weight:400;color:rgba(0,0,0,.9)}
ul,ol,dl{font-size:1em;line-height:1.6;margin-bottom:1.25em;list-style-position:outside;font-family:inherit}
ul,ol,ul.no-bullet,ol.no-bullet{margin-left:1.5em}
ul li ul,ul li ol{margin-left:1.25em;margin-bottom:0;font-size:1em}
ul.square li ul,ul.circle li ul,ul.disc li ul{list-style:inherit}
ul.square{list-style-type:square}
ul.circle{list-style-type:circle}
ul.disc{list-style-type:disc}
ul.no-bullet{list-style:none}
ol li ul,ol li ol{margin-left:1.25em;margin-bottom:0}
dl dt{margin-bottom:.3125em;font-weight:bold}
dl dd{margin-bottom:1.25em}
abbr,acronym{text-transform:uppercase;font-size:90%;color:rgba(0,0,0,.8);border-bottom:1px dotted #ddd;cursor:help}
abbr{text-transform:none}
blockquote{margin:0 0 1.25em;padding:.5625em 1.25em 0 1.1875em;border-left:1px solid #ddd}
blockquote cite{display:block;font-size:.9375em;color:rgba(0,0,0,.6)}
blockquote cite:before{content:"\2014 \0020"}
blockquote cite a,blockquote cite a:visited{color:rgba(0,0,0,.6)}
blockquote,blockquote p{line-height:1.6;color:rgba(0,0,0,.85)}
@media only screen and (min-width:768px){h1,h2,h3,#toctitle,.sidebarblock>.content>.title,h4,h5,h6{line-height:1.2}
h1{font-size:2.75em}
h2{font-size:2.3125em}
h3,#toctitle,.sidebarblock>.content>.title{font-size:1.6875em}
h4{font-size:1.4375em}}table{background:#fff;margin-bottom:1.25em;border:solid 1px #dedede}
table thead,table tfoot{background:#f7f8f7;font-weight:bold}
table thead tr th,table thead tr td,table tfoot tr th,table tfoot tr td{padding:.5em .625em .625em;font-size:inherit;color:rgba(0,0,0,.8);text-align:left}
table tr th,table tr td{padding:.5625em .625em;font-size:inherit;color:rgba(0,0,0,.8)}
table tr.even,table tr.alt,table tr:nth-of-type(even){background:#f8f8f7}
table thead tr th,table tfoot tr th,table tbody tr td,table tr td,table tfoot tr td{display:table-cell;line-height:1.6}
h1,h2,h3,#toctitle,.sidebarblock>.content>.title,h4,h5,h6{line-height:1.2;word-spacing:-.05em}
h1 strong,h2 strong,h3 strong,#toctitle strong,.sidebarblock>.content>.title strong,h4 strong,h5 strong,h6 strong{font-weight:400}
.clearfix:before,.clearfix:after,.float-group:before,.float-group:after{content:" ";display:table}
.clearfix:after,.float-group:after{clear:both}
*:not(pre)>code{font-size:.9375em;font-style:normal!important;letter-spacing:0;padding:.1em .5ex;word-spacing:-.15em;background-color:#f7f7f8;-webkit-border-radius:4px;border-radius:4px;line-height:1.45;text-rendering:optimizeSpeed}
pre,pre>code{line-height:1.45;color:rgba(0,0,0,.9);font-family:"Droid Sans Mono","DejaVu Sans Mono",monospace;font-weight:400;text-rendering:optimizeSpeed}
.keyseq{color:rgba(51,51,51,.8)}
kbd{display:inline-block;color:rgba(0,0,0,.8);font-size:.75em;line-height:1.4;background-color:#f7f7f7;border:1px solid #ccc;-webkit-border-radius:3px;border-radius:3px;-webkit-box-shadow:0 1px 0 rgba(0,0,0,.2),0 0 0 .1em white inset;box-shadow:0 1px 0 rgba(0,0,0,.2),0 0 0 .1em #fff inset;margin:-.15em .15em 0 .15em;padding:.2em .6em .2em .5em;vertical-align:middle;white-space:nowrap}
.keyseq kbd:first-child{margin-left:0}
.keyseq kbd:last-child{margin-right:0}
.menuseq,.menu{color:rgba(0,0,0,.8)}
b.button:before,b.button:after{position:relative;top:-1px;font-weight:400}
b.button:before{content:"[";padding:0 3px 0 2px}
b.button:after{content:"]";padding:0 2px 0 3px}
p a>code:hover{color:rgba(0,0,0,.9)}
#header,#content,#footnotes,#footer{width:100%;margin-left:auto;margin-right:auto;margin-top:0;margin-bottom:0;max-width:62.5em;*zoom:1;position:relative;padding-left:.9375em;padding-right:.9375em}
#header:before,#header:after,#content:before,#content:after,#footnotes:before,#footnotes:after,#footer:before,#footer:after{content:" ";display:table}
#header:after,#content:after,#footnotes:after,#footer:after{clear:both}
#content{margin-top:1.25em}
#content:before{content:none}
#header>h1:first-child{color:rgba(0,0,0,.85);margin-top:2.25rem;margin-bottom:0}
#header>h1:first-child+#toc{margin-top:8px;border-top:1px solid #ddddd8}
#header>h1:only-child,body.toc2 #header>h1:nth-last-child(2){border-bottom:1px solid #ddddd8;padding-bottom:8px}
#header .details{border-bottom:1px solid #ddddd8;line-height:1.45;padding-top:.25em;padding-bottom:.25em;padding-left:.25em;color:rgba(0,0,0,.6);display:-ms-flexbox;display:-webkit-flex;display:flex;-ms-flex-flow:row wrap;-webkit-flex-flow:row wrap;flex-flow:row wrap}
#header .details span:first-child{margin-left:-.125em}
#header .details span.email a{color:rgba(0,0,0,.85)}
#header .details br{display:none}
#header .details br+span:before{content:"\00a0\2013\00a0"}
#header .details br+span.author:before{content:"\00a0\22c5\00a0";color:rgba(0,0,0,.85)}
#header .details br+span#revremark:before{content:"\00a0|\00a0"}
#header #revnumber{text-transform:capitalize}
#header #revnumber:after{content:"\00a0"}
#content>h1:first-child:not([class]){color:rgba(0,0,0,.85);border-bottom:1px solid #ddddd8;padding-bottom:8px;margin-top:0;padding-top:1rem;margin-bottom:1.25rem}
#toc{border-bottom:1px solid #efefed;padding-bottom:.5em}
#toc>ul{margin-left:.125em}
#toc ul.sectlevel0>li>a{font-style:italic}
#toc ul.sectlevel0 ul.sectlevel1{margin:.5em 0}
#toc ul{font-family:"Open Sans","DejaVu Sans",sans-serif;list-style-type:none}
#toc a{text-decoration:none}
#toc a:active{text-decoration:underline}
#toctitle{color:#7a2518;font-size:1.2em}
@media only screen and (min-width:768px){#toctitle{font-size:1.375em}
body.toc2{padding-left:15em;padding-right:0}
#toc.toc2{margin-top:0!important;background-color:#f8f8f7;position:fixed;width:15em;left:0;top:0;border-right:1px solid #efefed;border-top-width:0!important;border-bottom-width:0!important;z-index:1000;padding:1.25em 1em;height:100%;overflow:auto}
#toc.toc2 #toctitle{margin-top:0;font-size:1.2em}
#toc.toc2>ul{font-size:.9em;margin-bottom:0}
#toc.toc2 ul ul{margin-left:0;padding-left:1em}
#toc.toc2 ul.sectlevel0 ul.sectlevel1{padding-left:0;margin-top:.5em;margin-bottom:.5em}
body.toc2.toc-right{padding-left:0;padding-right:15em}
body.toc2.toc-right #toc.toc2{border-right-width:0;border-left:1px solid #efefed;left:auto;right:0}}@media only screen and (min-width:1280px){body.toc2{padding-left:20em;padding-right:0}
#toc.toc2{width:20em}
#toc.toc2 #toctitle{font-size:1.375em}
#toc.toc2>ul{font-size:.95em}
#toc.toc2 ul ul{padding-left:1.25em}
body.toc2.toc-right{padding-left:0;padding-right:20em}}#content #toc{border-style:solid;border-width:1px;border-color:#e0e0dc;margin-bottom:1.25em;padding:1.25em;background:#f8f8f7;-webkit-border-radius:4px;border-radius:4px}
#content #toc>:first-child{margin-top:0}
#content #toc>:last-child{margin-bottom:0}
#footer{max-width:100%;background-color:rgba(0,0,0,.8);padding:1.25em}
#footer-text{color:rgba(255,255,255,.8);line-height:1.44}
.sect1{padding-bottom:.625em}
@media only screen and (min-width:768px){.sect1{padding-bottom:1.25em}}.sect1+.sect1{border-top:1px solid #efefed}
#content h1>a.anchor,h2>a.anchor,h3>a.anchor,#toctitle>a.anchor,.sidebarblock>.content>.title>a.anchor,h4>a.anchor,h5>a.anchor,h6>a.anchor{position:absolute;z-index:1001;width:1.5ex;margin-left:-1.5ex;display:block;text-decoration:none!important;visibility:hidden;text-align:center;font-weight:400}
#content h1>a.anchor:before,h2>a.anchor:before,h3>a.anchor:before,#toctitle>a.anchor:before,.sidebarblock>.content>.title>a.anchor:before,h4>a.anchor:before,h5>a.anchor:before,h6>a.anchor:before{content:"\00A7";font-size:.85em;display:block;padding-top:.1em}
#content h1:hover>a.anchor,#content h1>a.anchor:hover,h2:hover>a.anchor,h2>a.anchor:hover,h3:hover>a.anchor,#toctitle:hover>a.anchor,.sidebarblock>.content>.title:hover>a.anchor,h3>a.anchor:hover,#toctitle>a.anchor:hover,.sidebarblock>.content>.title>a.anchor:hover,h4:hover>a.anchor,h4>a.anchor:hover,h5:hover>a.anchor,h5>a.anchor:hover,h6:hover>a.anchor,h6>a.anchor:hover{visibility:visible}
#content h1>a.link,h2>a.link,h3>a.link,#toctitle>a.link,.sidebarblock>.content>.title>a.link,h4>a.link,h5>a.link,h6>a.link{color:#ba3925;text-decoration:none}
#content h1>a.link:hover,h2>a.link:hover,h3>a.link:hover,#toctitle>a.link:hover,.sidebarblock>.content>.title>a.link:hover,h4>a.link:hover,h5>a.link:hover,h6>a.link:hover{color:#a53221}
.audioblock,.imageblock,.literalblock,.listingblock,.stemblock,.videoblock{margin-bottom:1.25em}
.admonitionblock td.content>.title,.audioblock>.title,.exampleblock>.title,.imageblock>.title,.listingblock>.title,.literalblock>.title,.stemblock>.title,.openblock>.title,.paragraph>.title,.quoteblock>.title,table.tableblock>.title,.verseblock>.title,.videoblock>.title,.dlist>.title,.olist>.title,.ulist>.title,.qlist>.title,.hdlist>.title{text-rendering:optimizeLegibility;text-align:left;font-family:"Noto Serif","DejaVu Serif",serif;font-size:1rem;font-style:italic}
table.tableblock>caption.title{white-space:nowrap;overflow:visible;max-width:0}
.paragraph.lead>p,#preamble>.sectionbody>.paragraph:first-of-type p{color:rgba(0,0,0,.85)}
table.tableblock #preamble>.sectionbody>.paragraph:first-of-type p{font-size:inherit}
.admonitionblock>table{border-collapse:separate;border:0;background:none;width:100%}
.admonitionblock>table td.icon{text-align:center;width:80px}
.admonitionblock>table td.icon img{max-width:none}
.admonitionblock>table td.icon .title{font-weight:bold;font-family:"Open Sans","DejaVu Sans",sans-serif;text-transform:uppercase}
.admonitionblock>table td.content{padding-left:1.125em;padding-right:1.25em;border-left:1px solid #ddddd8;color:rgba(0,0,0,.6)}
.admonitionblock>table td.content>:last-child>:last-child{margin-bottom:0}
.exampleblock>.content{border-style:solid;border-width:1px;border-color:#e6e6e6;margin-bottom:1.25em;padding:1.25em;background:#fff;-webkit-border-radius:4px;border-radius:4px}
.exampleblock>.content>:first-child{margin-top:0}
.exampleblock>.content>:last-child{margin-bottom:0}
.sidebarblock{border-style:solid;border-width:1px;border-color:#e0e0dc;margin-bottom:1.25em;padding:1.25em;background:#f8f8f7;-webkit-border-radius:4px;border-radius:4px}
.sidebarblock>:first-child{margin-top:0}
.sidebarblock>:last-child{margin-bottom:0}
.sidebarblock>.content>.title{color:#7a2518;margin-top:0;text-align:center}
.exampleblock>.content>:last-child>:last-child,.exampleblock>.content .olist>ol>li:last-child>:last-child,.exampleblock>.content .ulist>ul>li:last-child>:last-child,.exampleblock>.content .qlist>ol>li:last-child>:last-child,.sidebarblock>.content>:last-child>:last-child,.sidebarblock>.content .olist>ol>li:last-child>:last-child,.sidebarblock>.content .ulist>ul>li:last-child>:last-child,.sidebarblock>.content .qlist>ol>li:last-child>:last-child{margin-bottom:0}
.literalblock pre,.listingblock pre:not(.highlight),.listingblock pre[class="highlight"],.listingblock pre[class^="highlight "],.listingblock pre.CodeRay,.listingblock pre.prettyprint{background:#f7f7f8}
.sidebarblock .literalblock pre,.sidebarblock .listingblock pre:not(.highlight),.sidebarblock .listingblock pre[class="highlight"],.sidebarblock .listingblock pre[class^="highlight "],.sidebarblock .listingblock pre.CodeRay,.sidebarblock .listingblock pre.prettyprint{background:#f2f1f1}
.literalblock pre,.literalblock pre[class],.listingblock pre,.listingblock pre[class]{-webkit-border-radius:4px;border-radius:4px;word-wrap:break-word;padding:1em;font-size:.8125em}
.literalblock pre.nowrap,.literalblock pre[class].nowrap,.listingblock pre.nowrap,.listingblock pre[class].nowrap{overflow-x:auto;white-space:pre;word-wrap:normal}
@media only screen and (min-width:768px){.literalblock pre,.literalblock pre[class],.listingblock pre,.listingblock pre[class]{font-size:.90625em}}@media only screen and (min-width:1280px){.literalblock pre,.literalblock pre[class],.listingblock pre,.listingblock pre[class]{font-size:1em}}.literalblock.output pre{color:#f7f7f8;background-color:rgba(0,0,0,.9)}
.listingblock pre.highlightjs{padding:0}
.listingblock pre.highlightjs>code{padding:1em;-webkit-border-radius:4px;border-radius:4px}
.listingblock pre.prettyprint{border-width:0}
.listingblock>.content{position:relative}
.listingblock code[data-lang]:before{display:none;content:attr(data-lang);position:absolute;font-size:.75em;top:.425rem;right:.5rem;line-height:1;text-transform:uppercase;color:#999}
.listingblock:hover code[data-lang]:before{display:block}
.listingblock.terminal pre .command:before{content:attr(data-prompt);padding-right:.5em;color:#999}
.listingblock.terminal pre .command:not([data-prompt]):before{content:"$"}
table.pyhltable{border-collapse:separate;border:0;margin-bottom:0;background:none}
table.pyhltable td{vertical-align:top;padding-top:0;padding-bottom:0}
table.pyhltable td.code{padding-left:.75em;padding-right:0}
pre.pygments .lineno,table.pyhltable td:not(.code){color:#999;padding-left:0;padding-right:.5em;border-right:1px solid #ddddd8}
pre.pygments .lineno{display:inline-block;margin-right:.25em}
table.pyhltable .linenodiv{background:none!important;padding-right:0!important}
.quoteblock{margin:0 1em 1.25em 1.5em;display:table}
.quoteblock>.title{margin-left:-1.5em;margin-bottom:.75em}
.quoteblock blockquote,.quoteblock blockquote p{color:rgba(0,0,0,.85);font-size:1.15rem;line-height:1.75;word-spacing:.1em;letter-spacing:0;font-style:italic;text-align:justify}
.quoteblock blockquote{margin:0;padding:0;border:0}
.quoteblock blockquote:before{content:"\201c";float:left;font-size:2.75em;font-weight:bold;line-height:.6em;margin-left:-.6em;color:#7a2518;text-shadow:0 1px 2px rgba(0,0,0,.1)}
.quoteblock blockquote>.paragraph:last-child p{margin-bottom:0}
.quoteblock .attribution{margin-top:.5em;margin-right:.5ex;text-align:right}
.quoteblock .quoteblock{margin-left:0;margin-right:0;padding:.5em 0;border-left:3px solid rgba(0,0,0,.6)}
.quoteblock .quoteblock blockquote{padding:0 0 0 .75em}
.quoteblock .quoteblock blockquote:before{display:none}
.verseblock{margin:0 1em 1.25em 1em}
.verseblock pre{font-family:"Open Sans","DejaVu Sans",sans;font-size:1.15rem;color:rgba(0,0,0,.85);font-weight:300;text-rendering:optimizeLegibility}
.verseblock pre strong{font-weight:400}
.verseblock .attribution{margin-top:1.25rem;margin-left:.5ex}
.quoteblock .attribution,.verseblock .attribution{font-size:.9375em;line-height:1.45;font-style:italic}
.quoteblock .attribution br,.verseblock .attribution br{display:none}
.quoteblock .attribution cite,.verseblock .attribution cite{display:block;letter-spacing:-.05em;color:rgba(0,0,0,.6)}
.quoteblock.abstract{margin:0 0 1.25em 0;display:block}
.quoteblock.abstract blockquote,.quoteblock.abstract blockquote p{text-align:left;word-spacing:0}
.quoteblock.abstract blockquote:before,.quoteblock.abstract blockquote p:first-of-type:before{display:none}
table.tableblock{max-width:100%;border-collapse:separate}
table.tableblock td>.paragraph:last-child p>p:last-child,table.tableblock th>p:last-child,table.tableblock td>p:last-child{margin-bottom:0}
table.spread{width:100%}
table.tableblock,th.tableblock,td.tableblock{border:0 solid #dedede}
table.grid-all th.tableblock,table.grid-all td.tableblock{border-width:0 1px 1px 0}
table.grid-all tfoot>tr>th.tableblock,table.grid-all tfoot>tr>td.tableblock{border-width:1px 1px 0 0}
table.grid-cols th.tableblock,table.grid-cols td.tableblock{border-width:0 1px 0 0}
table.grid-all *>tr>.tableblock:last-child,table.grid-cols *>tr>.tableblock:last-child{border-right-width:0}
table.grid-rows th.tableblock,table.grid-rows td.tableblock{border-width:0 0 1px 0}
table.grid-all tbody>tr:last-child>th.tableblock,table.grid-all tbody>tr:last-child>td.tableblock,table.grid-all thead:last-child>tr>th.tableblock,table.grid-rows tbody>tr:last-child>th.tableblock,table.grid-rows tbody>tr:last-child>td.tableblock,table.grid-rows thead:last-child>tr>th.tableblock{border-bottom-width:0}
table.grid-rows tfoot>tr>th.tableblock,table.grid-rows tfoot>tr>td.tableblock{border-width:1px 0 0 0}
table.frame-all{border-width:1px}
table.frame-sides{border-width:0 1px}
table.frame-topbot{border-width:1px 0}
th.halign-left,td.halign-left{text-align:left}
th.halign-right,td.halign-right{text-align:right}
th.halign-center,td.halign-center{text-align:center}
th.valign-top,td.valign-top{vertical-align:top}
th.valign-bottom,td.valign-bottom{vertical-align:bottom}
th.valign-middle,td.valign-middle{vertical-align:middle}
table thead th,table tfoot th{font-weight:bold}
tbody tr th{display:table-cell;line-height:1.6;background:#f7f8f7}
tbody tr th,tbody tr th p,tfoot tr th,tfoot tr th p{color:rgba(0,0,0,.8);font-weight:bold}
p.tableblock>code:only-child{background:none;padding:0}
p.tableblock{font-size:1em}
td>div.verse{white-space:pre}
ol{margin-left:1.75em}
ul li ol{margin-left:1.5em}
dl dd{margin-left:1.125em}
dl dd:last-child,dl dd:last-child>:last-child{margin-bottom:0}
ol>li p,ul>li p,ul dd,ol dd,.olist .olist,.ulist .ulist,.ulist .olist,.olist .ulist{margin-bottom:.625em}
ul.unstyled,ol.unnumbered,ul.checklist,ul.none{list-style-type:none}
ul.unstyled,ol.unnumbered,ul.checklist{margin-left:.625em}
ul.checklist li>p:first-child>.fa-square-o:first-child,ul.checklist li>p:first-child>.fa-check-square-o:first-child{width:1em;font-size:.85em}
ul.checklist li>p:first-child>input[type="checkbox"]:first-child{width:1em;position:relative;top:1px}
ul.inline{margin:0 auto .625em auto;margin-left:-1.375em;margin-right:0;padding:0;list-style:none;overflow:hidden}
ul.inline>li{list-style:none;float:left;margin-left:1.375em;display:block}
ul.inline>li>*{display:block}
.unstyled dl dt{font-weight:400;font-style:normal}
ol.arabic{list-style-type:decimal}
ol.decimal{list-style-type:decimal-leading-zero}
ol.loweralpha{list-style-type:lower-alpha}
ol.upperalpha{list-style-type:upper-alpha}
ol.lowerroman{list-style-type:lower-roman}
ol.upperroman{list-style-type:upper-roman}
ol.lowergreek{list-style-type:lower-greek}
.hdlist>table,.colist>table{border:0;background:none}
.hdlist>table>tbody>tr,.colist>table>tbody>tr{background:none}
td.hdlist1{padding-right:.75em;font-weight:bold}
td.hdlist1,td.hdlist2{vertical-align:top}
.literalblock+.colist,.listingblock+.colist{margin-top:-.5em}
.colist>table tr>td:first-of-type{padding:0 .75em;line-height:1}
.colist>table tr>td:last-of-type{padding:.25em 0}
.thumb,.th{line-height:0;display:inline-block;border:solid 4px #fff;-webkit-box-shadow:0 0 0 1px #ddd;box-shadow:0 0 0 1px #ddd}
.imageblock.left,.imageblock[style*="float: left"]{margin:.25em .625em 1.25em 0}
.imageblock.right,.imageblock[style*="float: right"]{margin:.25em 0 1.25em .625em}
.imageblock>.title{margin-bottom:0}
.imageblock.thumb,.imageblock.th{border-width:6px}
.imageblock.thumb>.title,.imageblock.th>.title{padding:0 .125em}
.image.left,.image.right{margin-top:.25em;margin-bottom:.25em;display:inline-block;line-height:0}
.image.left{margin-right:.625em}
.image.right{margin-left:.625em}
a.image{text-decoration:none}
span.footnote,span.footnoteref{vertical-align:super;font-size:.875em}
span.footnote a,span.footnoteref a{text-decoration:none}
span.footnote a:active,span.footnoteref a:active{text-decoration:underline}
#footnotes{padding-top:.75em;padding-bottom:.75em;margin-bottom:.625em}
#footnotes hr{width:20%;min-width:6.25em;margin:-.25em 0 .75em 0;border-width:1px 0 0 0}
#footnotes .footnote{padding:0 .375em;line-height:1.3;font-size:.875em;margin-left:1.2em;text-indent:-1.2em;margin-bottom:.2em}
#footnotes .footnote a:first-of-type{font-weight:bold;text-decoration:none}
#footnotes .footnote:last-of-type{margin-bottom:0}
#content #footnotes{margin-top:-.625em;margin-bottom:0;padding:.75em 0}
.gist .file-data>table{border:0;background:#fff;width:100%;margin-bottom:0}
.gist .file-data>table td.line-data{width:99%}
div.unbreakable{page-break-inside:avoid}
.big{font-size:larger}
.small{font-size:smaller}
.underline{text-decoration:underline}
.overline{text-decoration:overline}
.line-through{text-decoration:line-through}
.aqua{color:#00bfbf}
.aqua-background{background-color:#00fafa}
.black{color:#000}
.black-background{background-color:#000}
.blue{color:#0000bf}
.blue-background{background-color:#0000fa}
.fuchsia{color:#bf00bf}
.fuchsia-background{background-color:#fa00fa}
.gray{color:#606060}
.gray-background{background-color:#7d7d7d}
.green{color:#006000}
.green-background{background-color:#007d00}
.lime{color:#00bf00}
.lime-background{background-color:#00fa00}
.maroon{color:#600000}
.maroon-background{background-color:#7d0000}
.navy{color:#000060}
.navy-background{background-color:#00007d}
.olive{color:#606000}
.olive-background{background-color:#7d7d00}
.purple{color:#600060}
.purple-background{background-color:#7d007d}
.red{color:#bf0000}
.red-background{background-color:#fa0000}
.silver{color:#909090}
.silver-background{background-color:#bcbcbc}
.teal{color:#006060}
.teal-background{background-color:#007d7d}
.white{color:#bfbfbf}
.white-background{background-color:#fafafa}
.yellow{color:#bfbf00}
.yellow-background{background-color:#fafa00}
span.icon>.fa{cursor:default}
.admonitionblock td.icon [class^="fa icon-"]{font-size:2.5em;text-shadow:1px 1px 2px rgba(0,0,0,.5);cursor:default}
.admonitionblock td.icon .icon-note:before{content:"\f05a";color:#19407c}
.admonitionblock td.icon .icon-tip:before{content:"\f0eb";text-shadow:1px 1px 2px rgba(155,155,0,.8);color:#111}
.admonitionblock td.icon .icon-warning:before{content:"\f071";color:#bf6900}
.admonitionblock td.icon .icon-caution:before{content:"\f06d";color:#bf3400}
.admonitionblock td.icon .icon-important:before{content:"\f06a";color:#bf0000}
.conum[data-value]{display:inline-block;color:#fff!important;background-color:rgba(0,0,0,.8);-webkit-border-radius:100px;border-radius:100px;text-align:center;font-size:.75em;width:1.67em;height:1.67em;line-height:1.67em;font-family:"Open Sans","DejaVu Sans",sans-serif;font-style:normal;font-weight:bold}
.conum[data-value] *{color:#fff!important}
.conum[data-value]+b{display:none}
.conum[data-value]:after{content:attr(data-value)}
pre .conum[data-value]{position:relative;top:-.125em}
b.conum *{color:inherit!important}
.conum:not([data-value]):empty{display:none}
h1,h2{letter-spacing:-.01em}
dt,th.tableblock,td.content{text-rendering:optimizeLegibility}
p,td.content{letter-spacing:-.01em}
p strong,td.content strong{letter-spacing:-.005em}
p,blockquote,dt,td.content{font-size:1.0625rem}
p{margin-bottom:1.25rem}
.sidebarblock p,.sidebarblock dt,.sidebarblock td.content,p.tableblock{font-size:1em}
.exampleblock>.content{background-color:#fffef7;border-color:#e0e0dc;-webkit-box-shadow:0 1px 4px #e0e0dc;box-shadow:0 1px 4px #e0e0dc}
.print-only{display:none!important}
@media print{@page{margin:1.25cm .75cm}
*{-webkit-box-shadow:none!important;box-shadow:none!important;text-shadow:none!important}
a{color:inherit!important;text-decoration:underline!important}
a.bare,a[href^="#"],a[href^="mailto:"]{text-decoration:none!important}
a[href^="http:"]:not(.bare):after,a[href^="https:"]:not(.bare):after{content:"(" attr(href) ")";display:inline-block;font-size:.875em;padding-left:.25em}
abbr[title]:after{content:" (" attr(title) ")"}
pre,blockquote,tr,img{page-break-inside:avoid}
thead{display:table-header-group}
img{max-width:100%!important}
p,blockquote,dt,td.content{font-size:1em;orphans:3;widows:3}
h2,h3,#toctitle,.sidebarblock>.content>.title{page-break-after:avoid}
#toc,.sidebarblock,.exampleblock>.content{background:none!important}
#toc{border-bottom:1px solid #ddddd8!important;padding-bottom:0!important}
.sect1{padding-bottom:0!important}
.sect1+.sect1{border:0!important}
#header>h1:first-child{margin-top:1.25rem}
body.book #header{text-align:center}
body.book #header>h1:first-child{border:0!important;margin:2.5em 0 1em 0}
body.book #header .details{border:0!important;display:block;padding:0!important}
body.book #header .details span:first-child{margin-left:0!important}
body.book #header .details br{display:block}
body.book #header .details br+span:before{content:none!important}
body.book #toc{border:0!important;text-align:left!important;padding:0!important;margin:0!important}
body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-break-before:always}
.listingblock code[data-lang]:before{display:block}
#footer{background:none!important;padding:0 .9375em}
#footer-text{color:rgba(0,0,0,.6)!important;font-size:.9em}
.hide-on-print{display:none!important}
.print-only{display:block!important}
.hide-for-print{display:none!important}
.show-for-print{display:inherit!important}}
</style>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.2.0/css/font-awesome.min.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/8.4/styles/github.min.css">
<script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/8.4/highlight.min.js"></script>
<script>hljs.initHighlightingOnLoad()</script>
</head>
<body class="book">
<div id="header">
</div>
<div id="content">
<div class="sect2">
<h3 id="overview-pagination">Pagination</h3>
<div class="paragraph">
<p>리스트 항목에 대한 요청은 기본값으로(0 page/50 size)로 반환 되어 지며 페이지 파라미터 변수를 통해 검색 범위에 대해 요청 할 수 있습니다.
예를 들어 의사 목록의 1 page의 10개의 데이터 리스트 항목은 다음과 같이 요청 할 수 있습니다.</p>
</div>
<div class="listingblock">
<div class="content">
<pre class="highlightjs highlight"><code class="language-bash" data-lang="bash">$ curl 'http://root-endpoint/doctors?page=1&size=10'</code></pre>
</div>
</div>
<div class="paragraph">
<p>모든 리스트 항목에 대해 페이지 파라미터 변수는 동일하게 지원 됩니다.</p>
</div>
<table class="tableblock frame-all grid-all spread">
<colgroup>
<col style="width: 50%;">
<col style="width: 50%;">
</colgroup>
<thead>
<tr>
<th class="tableblock halign-left valign-top">Params</th>
<th class="tableblock halign-left valign-top">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>page</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">페이지 번호</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>size</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">페이지 번호에서의 목록 사이즈</p></td>
</tr>
</tbody>
</table>
<div class="listingblock">
<div class="content">
<pre class="highlightjs highlight"><code class="language-json" data-lang="json">{
"_links": {
"self": {
"href": "http://localhost:8080/doctors?page=1&size=10{&sort}",
"templated": true
},
"next": {
"href": "http://localhost:8080/doctors?page=2&size=10{&sort}",
"templated": true
},
"prev": {
"href": "http://localhost:8080/doctors?page=0&size=10{&sort}",
"templated": true
}
},
"_embedded" : {
"doctors": [
...................................
]
},
"page": {
"size": 10,
"totalElements": 30,
"totalPages": 3,
"number": 1
}
}</code></pre>
</div>
</div>
</div>
</div>
<div id="footer">
<div id="footer-text">
Last updated 2015-10-23 10:38:39 KST
</div>
</div>
</body>
</html> | {
"content_hash": "12c7cbeebfbd906d0984d688da29e0ef",
"timestamp": "",
"source": "github",
"line_count": 495,
"max_line_length": 471,
"avg_line_length": 65.50707070707071,
"alnum_prop": 0.7704311355085425,
"repo_name": "gmind7/gmind7.github.io",
"id": "3b60ae03c7465ba11ddec4d889a1841dcdfdb241",
"size": "32688",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "overview/overview-pagination.html",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "CSS",
"bytes": "17481"
},
{
"name": "HTML",
"bytes": "849857"
},
{
"name": "JavaScript",
"bytes": "1143"
}
],
"symlink_target": ""
} |
/*************************************************************************/
/* test_geometry_2d.h */
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2021 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2021 Godot Engine contributors (cf. AUTHORS.md). */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
/* "Software"), to deal in the Software without restriction, including */
/* without limitation the rights to use, copy, modify, merge, publish, */
/* distribute, sublicense, and/or sell copies of the Software, and to */
/* permit persons to whom the Software is furnished to do so, subject to */
/* the following conditions: */
/* */
/* The above copyright notice and this permission notice shall be */
/* included in all copies or substantial portions of the Software. */
/* */
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
#ifndef TEST_GEOMETRY_2D_H
#define TEST_GEOMETRY_2D_H
#include "core/math/geometry_2d.h"
#include "core/templates/vector.h"
#include "thirdparty/doctest/doctest.h"
namespace TestGeometry2D {
TEST_CASE("[Geometry2D] Point in circle") {
CHECK(Geometry2D::is_point_in_circle(Vector2(0, 0), Vector2(0, 0), 1.0));
CHECK(Geometry2D::is_point_in_circle(Vector2(0, 0), Vector2(11.99, 0), 12));
CHECK(Geometry2D::is_point_in_circle(Vector2(-11.99, 0), Vector2(0, 0), 12));
CHECK_FALSE(Geometry2D::is_point_in_circle(Vector2(0, 0), Vector2(12.01, 0), 12));
CHECK_FALSE(Geometry2D::is_point_in_circle(Vector2(-12.01, 0), Vector2(0, 0), 12));
CHECK(Geometry2D::is_point_in_circle(Vector2(7, -42), Vector2(4, -40), 3.7));
CHECK_FALSE(Geometry2D::is_point_in_circle(Vector2(7, -42), Vector2(4, -40), 3.5));
// This tests points on the edge of the circle. They are treated as being inside the circle.
// In `is_point_in_triangle` and `is_point_in_polygon` they are treated as being outside, so in order the make
// the behaviour consistent this may change in the future (see issue #44717 and PR #44274).
CHECK(Geometry2D::is_point_in_circle(Vector2(1.0, 0.0), Vector2(0, 0), 1.0));
CHECK(Geometry2D::is_point_in_circle(Vector2(0.0, -1.0), Vector2(0, 0), 1.0));
}
TEST_CASE("[Geometry2D] Point in triangle") {
CHECK(Geometry2D::is_point_in_triangle(Vector2(0, 0), Vector2(-1, 1), Vector2(0, -1), Vector2(1, 1)));
CHECK_FALSE(Geometry2D::is_point_in_triangle(Vector2(-1.01, 1.0), Vector2(-1, 1), Vector2(0, -1), Vector2(1, 1)));
CHECK(Geometry2D::is_point_in_triangle(Vector2(3, 2.5), Vector2(1, 4), Vector2(3, 2), Vector2(5, 4)));
CHECK(Geometry2D::is_point_in_triangle(Vector2(-3, -2.5), Vector2(-1, -4), Vector2(-3, -2), Vector2(-5, -4)));
CHECK_FALSE(Geometry2D::is_point_in_triangle(Vector2(0, 0), Vector2(1, 4), Vector2(3, 2), Vector2(5, 4)));
// This tests points on the edge of the triangle. They are treated as being outside the triangle.
// In `is_point_in_circle` they are treated as being inside, so in order the make
// the behaviour consistent this may change in the future (see issue #44717 and PR #44274).
CHECK_FALSE(Geometry2D::is_point_in_triangle(Vector2(1, 1), Vector2(-1, 1), Vector2(0, -1), Vector2(1, 1)));
CHECK_FALSE(Geometry2D::is_point_in_triangle(Vector2(0, 1), Vector2(-1, 1), Vector2(0, -1), Vector2(1, 1)));
}
TEST_CASE("[Geometry2D] Point in polygon") {
Vector<Vector2> p;
CHECK_FALSE(Geometry2D::is_point_in_polygon(Vector2(0, 0), p));
p.push_back(Vector2(-88, 120));
p.push_back(Vector2(-74, -38));
p.push_back(Vector2(135, -145));
p.push_back(Vector2(425, 70));
p.push_back(Vector2(68, 112));
p.push_back(Vector2(-120, 370));
p.push_back(Vector2(-323, -145));
CHECK_FALSE(Geometry2D::is_point_in_polygon(Vector2(-350, 0), p));
CHECK_FALSE(Geometry2D::is_point_in_polygon(Vector2(-110, 60), p));
CHECK_FALSE(Geometry2D::is_point_in_polygon(Vector2(412, 96), p));
CHECK_FALSE(Geometry2D::is_point_in_polygon(Vector2(83, 130), p));
CHECK_FALSE(Geometry2D::is_point_in_polygon(Vector2(-320, -153), p));
CHECK(Geometry2D::is_point_in_polygon(Vector2(0, 0), p));
CHECK(Geometry2D::is_point_in_polygon(Vector2(-230, 0), p));
CHECK(Geometry2D::is_point_in_polygon(Vector2(130, -110), p));
CHECK(Geometry2D::is_point_in_polygon(Vector2(370, 55), p));
CHECK(Geometry2D::is_point_in_polygon(Vector2(-160, 190), p));
// This tests points on the edge of the polygon. They are treated as being outside the polygon.
// In `is_point_in_circle` they are treated as being inside, so in order the make
// the behaviour consistent this may change in the future (see issue #44717 and PR #44274).
CHECK_FALSE(Geometry2D::is_point_in_polygon(Vector2(68, 112), p));
CHECK_FALSE(Geometry2D::is_point_in_polygon(Vector2(-88, 120), p));
}
TEST_CASE("[Geometry2D] Polygon clockwise") {
Vector<Vector2> p;
CHECK_FALSE(Geometry2D::is_polygon_clockwise(p));
p.push_back(Vector2(5, -5));
p.push_back(Vector2(-1, -5));
p.push_back(Vector2(-5, -1));
p.push_back(Vector2(-1, 3));
p.push_back(Vector2(1, 5));
CHECK(Geometry2D::is_polygon_clockwise(p));
p.reverse();
CHECK_FALSE(Geometry2D::is_polygon_clockwise(p));
}
TEST_CASE("[Geometry2D] Line intersection") {
Vector2 r;
CHECK(Geometry2D::line_intersects_line(Vector2(2, 0), Vector2(0, 1), Vector2(0, 2), Vector2(1, 0), r));
CHECK(r.is_equal_approx(Vector2(2, 2)));
CHECK(Geometry2D::line_intersects_line(Vector2(-1, 1), Vector2(1, -1), Vector2(4, 1), Vector2(-1, -1), r));
CHECK(r.is_equal_approx(Vector2(1.5, -1.5)));
CHECK(Geometry2D::line_intersects_line(Vector2(-1, 0), Vector2(-1, -1), Vector2(1, 0), Vector2(1, -1), r));
CHECK(r.is_equal_approx(Vector2(0, 1)));
CHECK_FALSE_MESSAGE(
Geometry2D::line_intersects_line(Vector2(-1, 1), Vector2(1, -1), Vector2(0, 1), Vector2(1, -1), r),
"Parallel lines should not intersect.");
}
TEST_CASE("[Geometry2D] Segment intersection.") {
Vector2 r;
CHECK(Geometry2D::segment_intersects_segment(Vector2(-1, 1), Vector2(1, -1), Vector2(1, 1), Vector2(-1, -1), &r));
CHECK(r.is_equal_approx(Vector2(0, 0)));
CHECK_FALSE(Geometry2D::segment_intersects_segment(Vector2(-1, 1), Vector2(1, -1), Vector2(1, 1), Vector2(0.1, 0.1), &r));
CHECK_FALSE_MESSAGE(
Geometry2D::segment_intersects_segment(Vector2(-1, 1), Vector2(1, -1), Vector2(0, 1), Vector2(1, -1), &r),
"Parallel segments should not intersect.");
}
TEST_CASE("[Geometry2D] Closest point to segment") {
Vector2 s[] = { Vector2(-4, -4), Vector2(4, 4) };
CHECK(Geometry2D::get_closest_point_to_segment(Vector2(4.1, 4.1), s).is_equal_approx(Vector2(4, 4)));
CHECK(Geometry2D::get_closest_point_to_segment(Vector2(-4.1, -4.1), s).is_equal_approx(Vector2(-4, -4)));
CHECK(Geometry2D::get_closest_point_to_segment(Vector2(-1, 1), s).is_equal_approx(Vector2(0, 0)));
}
TEST_CASE("[Geometry2D] Closest point to uncapped segment") {
Vector2 s[] = { Vector2(-4, -4), Vector2(4, 4) };
CHECK(Geometry2D::get_closest_point_to_segment_uncapped(Vector2(-1, 1), s).is_equal_approx(Vector2(0, 0)));
CHECK(Geometry2D::get_closest_point_to_segment_uncapped(Vector2(-4, -6), s).is_equal_approx(Vector2(-5, -5)));
CHECK(Geometry2D::get_closest_point_to_segment_uncapped(Vector2(4, 6), s).is_equal_approx(Vector2(5, 5)));
}
TEST_CASE("[Geometry2D] Closest points between segments") {
Vector2 c1, c2;
Geometry2D::get_closest_points_between_segments(Vector2(2, 2), Vector2(3, 3), Vector2(4, 4), Vector2(4, 5), c1, c2);
CHECK(c1.is_equal_approx(Vector2(3, 3)));
CHECK(c2.is_equal_approx(Vector2(4, 4)));
Geometry2D::get_closest_points_between_segments(Vector2(0, 1), Vector2(-2, -1), Vector2(0, 0), Vector2(2, -2), c1, c2);
CHECK(c1.is_equal_approx(Vector2(-0.5, 0.5)));
CHECK(c2.is_equal_approx(Vector2(0, 0)));
Geometry2D::get_closest_points_between_segments(Vector2(-1, 1), Vector2(1, -1), Vector2(1, 1), Vector2(-1, -1), c1, c2);
CHECK(c1.is_equal_approx(Vector2(0, 0)));
CHECK(c2.is_equal_approx(Vector2(0, 0)));
}
TEST_CASE("[Geometry2D] Make atlas") {
Vector<Point2i> result;
Size2i size;
Vector<Size2i> r;
r.push_back(Size2i(2, 2));
Geometry2D::make_atlas(r, result, size);
CHECK(size == Size2i(2, 2));
CHECK(result.size() == r.size());
r.clear();
result.clear();
r.push_back(Size2i(1, 2));
r.push_back(Size2i(3, 4));
r.push_back(Size2i(5, 6));
r.push_back(Size2i(7, 8));
Geometry2D::make_atlas(r, result, size);
CHECK(result.size() == r.size());
}
TEST_CASE("[Geometry2D] Polygon intersection") {
Vector<Point2> a;
Vector<Point2> b;
Vector<Vector<Point2>> r;
a.push_back(Point2(30, 60));
a.push_back(Point2(70, 5));
a.push_back(Point2(200, 40));
a.push_back(Point2(80, 200));
SUBCASE("[Geometry2D] Both polygons are empty") {
r = Geometry2D::intersect_polygons(Vector<Point2>(), Vector<Point2>());
CHECK_MESSAGE(r.is_empty(), "Both polygons are empty. The intersection should also be empty.");
}
SUBCASE("[Geometry2D] One polygon is empty") {
r = Geometry2D::intersect_polygons(a, b);
REQUIRE_MESSAGE(r.is_empty(), "One polygon is empty. The intersection should also be empty.");
}
SUBCASE("[Geometry2D] Basic intersection") {
b.push_back(Point2(200, 300));
b.push_back(Point2(90, 200));
b.push_back(Point2(50, 100));
b.push_back(Point2(200, 90));
r = Geometry2D::intersect_polygons(a, b);
REQUIRE_MESSAGE(r.size() == 1, "The polygons should intersect each other with 1 resulting intersection polygon.");
REQUIRE_MESSAGE(r[0].size() == 3, "The resulting intersection polygon should have 3 vertices.");
CHECK(r[0][0].is_equal_approx(Point2(86.52174, 191.30436)));
CHECK(r[0][1].is_equal_approx(Point2(50, 100)));
CHECK(r[0][2].is_equal_approx(Point2(160.52632, 92.63157)));
}
SUBCASE("[Geometry2D] Intersection with one polygon being completely inside the other polygon") {
b.push_back(Point2(80, 100));
b.push_back(Point2(50, 50));
b.push_back(Point2(150, 50));
r = Geometry2D::intersect_polygons(a, b);
REQUIRE_MESSAGE(r.size() == 1, "The polygons should intersect each other with 1 resulting intersection polygon.");
REQUIRE_MESSAGE(r[0].size() == 3, "The resulting intersection polygon should have 3 vertices.");
CHECK(r[0][0].is_equal_approx(b[0]));
CHECK(r[0][1].is_equal_approx(b[1]));
CHECK(r[0][2].is_equal_approx(b[2]));
}
SUBCASE("[Geometry2D] No intersection with 2 non-empty polygons") {
b.push_back(Point2(150, 150));
b.push_back(Point2(250, 100));
b.push_back(Point2(300, 200));
r = Geometry2D::intersect_polygons(a, b);
REQUIRE_MESSAGE(r.is_empty(), "The polygons should not intersect each other.");
}
SUBCASE("[Geometry2D] Intersection with 2 resulting polygons") {
a.clear();
a.push_back(Point2(70, 5));
a.push_back(Point2(140, 7));
a.push_back(Point2(100, 52));
a.push_back(Point2(170, 50));
a.push_back(Point2(60, 125));
b.push_back(Point2(70, 105));
b.push_back(Point2(115, 55));
b.push_back(Point2(90, 15));
b.push_back(Point2(160, 50));
r = Geometry2D::intersect_polygons(a, b);
REQUIRE_MESSAGE(r.size() == 2, "The polygons should intersect each other with 2 resulting intersection polygons.");
REQUIRE_MESSAGE(r[0].size() == 4, "The resulting intersection polygon should have 4 vertices.");
CHECK(r[0][0].is_equal_approx(Point2(70, 105)));
CHECK(r[0][1].is_equal_approx(Point2(115, 55)));
CHECK(r[0][2].is_equal_approx(Point2(112.894737, 51.63158)));
CHECK(r[0][3].is_equal_approx(Point2(159.509537, 50.299728)));
REQUIRE_MESSAGE(r[1].size() == 3, "The intersection polygon should have 3 vertices.");
CHECK(r[1][0].is_equal_approx(Point2(119.692307, 29.846149)));
CHECK(r[1][1].is_equal_approx(Point2(107.706421, 43.33028)));
CHECK(r[1][2].is_equal_approx(Point2(90, 15)));
}
}
TEST_CASE("[Geometry2D] Merge polygons") {
Vector<Point2> a;
Vector<Point2> b;
Vector<Vector<Point2>> r;
a.push_back(Point2(225, 180));
a.push_back(Point2(160, 230));
a.push_back(Point2(20, 212));
a.push_back(Point2(50, 115));
SUBCASE("[Geometry2D] Both polygons are empty") {
r = Geometry2D::merge_polygons(Vector<Point2>(), Vector<Point2>());
REQUIRE_MESSAGE(r.is_empty(), "Both polygons are empty. The union should also be empty.");
}
SUBCASE("[Geometry2D] One polygon is empty") {
r = Geometry2D::merge_polygons(a, b);
REQUIRE_MESSAGE(r.size() == 1, "One polygon is non-empty. There should be 1 resulting merged polygon.");
REQUIRE_MESSAGE(r[0].size() == 4, "The resulting merged polygon should have 4 vertices.");
CHECK(r[0][0].is_equal_approx(a[0]));
CHECK(r[0][1].is_equal_approx(a[1]));
CHECK(r[0][2].is_equal_approx(a[2]));
CHECK(r[0][3].is_equal_approx(a[3]));
}
SUBCASE("[Geometry2D] Basic merge with 2 polygons") {
b.push_back(Point2(180, 190));
b.push_back(Point2(60, 140));
b.push_back(Point2(160, 80));
r = Geometry2D::merge_polygons(a, b);
REQUIRE_MESSAGE(r.size() == 1, "The merged polygons should result in 1 polygon.");
REQUIRE_MESSAGE(r[0].size() == 7, "The resulting merged polygon should have 7 vertices.");
CHECK(r[0][0].is_equal_approx(Point2(174.791077, 161.350967)));
CHECK(r[0][1].is_equal_approx(Point2(225, 180)));
CHECK(r[0][2].is_equal_approx(Point2(160, 230)));
CHECK(r[0][3].is_equal_approx(Point2(20, 212)));
CHECK(r[0][4].is_equal_approx(Point2(50, 115)));
CHECK(r[0][5].is_equal_approx(Point2(81.911758, 126.852943)));
CHECK(r[0][6].is_equal_approx(Point2(160, 80)));
}
SUBCASE("[Geometry2D] Merge with 2 resulting merged polygons (outline and hole)") {
b.push_back(Point2(180, 190));
b.push_back(Point2(140, 125));
b.push_back(Point2(60, 140));
b.push_back(Point2(160, 80));
r = Geometry2D::merge_polygons(a, b);
REQUIRE_MESSAGE(r.size() == 2, "The merged polygons should result in 2 polygons.");
REQUIRE_MESSAGE(!Geometry2D::is_polygon_clockwise(r[0]), "The merged polygon (outline) should be counter-clockwise.");
REQUIRE_MESSAGE(r[0].size() == 7, "The resulting merged polygon (outline) should have 7 vertices.");
CHECK(r[0][0].is_equal_approx(Point2(174.791077, 161.350967)));
CHECK(r[0][1].is_equal_approx(Point2(225, 180)));
CHECK(r[0][2].is_equal_approx(Point2(160, 230)));
CHECK(r[0][3].is_equal_approx(Point2(20, 212)));
CHECK(r[0][4].is_equal_approx(Point2(50, 115)));
CHECK(r[0][5].is_equal_approx(Point2(81.911758, 126.852943)));
CHECK(r[0][6].is_equal_approx(Point2(160, 80)));
REQUIRE_MESSAGE(Geometry2D::is_polygon_clockwise(r[1]), "The resulting merged polygon (hole) should be clockwise.");
REQUIRE_MESSAGE(r[1].size() == 3, "The resulting merged polygon (hole) should have 3 vertices.");
CHECK(r[1][0].is_equal_approx(Point2(98.083069, 132.859421)));
CHECK(r[1][1].is_equal_approx(Point2(158.689453, 155.370377)));
CHECK(r[1][2].is_equal_approx(Point2(140, 125)));
}
}
TEST_CASE("[Geometry2D] Clip polygons") {
Vector<Point2> a;
Vector<Point2> b;
Vector<Vector<Point2>> r;
a.push_back(Point2(225, 180));
a.push_back(Point2(160, 230));
a.push_back(Point2(20, 212));
a.push_back(Point2(50, 115));
SUBCASE("[Geometry2D] Both polygons are empty") {
r = Geometry2D::clip_polygons(Vector<Point2>(), Vector<Point2>());
CHECK_MESSAGE(r.is_empty(), "Both polygons are empty. The clip should also be empty.");
}
SUBCASE("[Geometry2D] Basic clip with one result polygon") {
b.push_back(Point2(250, 170));
b.push_back(Point2(175, 270));
b.push_back(Point2(120, 260));
b.push_back(Point2(25, 80));
r = Geometry2D::clip_polygons(a, b);
REQUIRE_MESSAGE(r.size() == 1, "The clipped polygons should result in 1 polygon.");
REQUIRE_MESSAGE(r[0].size() == 3, "The resulting clipped polygon should have 3 vertices.");
CHECK(r[0][0].is_equal_approx(Point2(100.102173, 222.298843)));
CHECK(r[0][1].is_equal_approx(Point2(20, 212)));
CHECK(r[0][2].is_equal_approx(Point2(47.588089, 122.798492)));
}
SUBCASE("[Geometry2D] Polygon b completely overlaps polygon a") {
b.push_back(Point2(250, 170));
b.push_back(Point2(175, 270));
b.push_back(Point2(10, 210));
b.push_back(Point2(55, 80));
r = Geometry2D::clip_polygons(a, b);
CHECK_MESSAGE(r.is_empty(), "Polygon 'b' completely overlaps polygon 'a'. This should result in no clipped polygons.");
}
SUBCASE("[Geometry2D] Polygon a completely overlaps polygon b") {
b.push_back(Point2(150, 200));
b.push_back(Point2(65, 190));
b.push_back(Point2(80, 140));
r = Geometry2D::clip_polygons(a, b);
REQUIRE_MESSAGE(r.size() == 2, "Polygon 'a' completely overlaps polygon 'b'. This should result in 2 clipped polygons.");
REQUIRE_MESSAGE(r[0].size() == 4, "The resulting clipped polygon should have 4 vertices.");
REQUIRE_MESSAGE(!Geometry2D::is_polygon_clockwise(r[0]), "The resulting clipped polygon (outline) should be counter-clockwise.");
CHECK(r[0][0].is_equal_approx(a[0]));
CHECK(r[0][1].is_equal_approx(a[1]));
CHECK(r[0][2].is_equal_approx(a[2]));
CHECK(r[0][3].is_equal_approx(a[3]));
REQUIRE_MESSAGE(r[1].size() == 3, "The resulting clipped polygon should have 3 vertices.");
REQUIRE_MESSAGE(Geometry2D::is_polygon_clockwise(r[1]), "The resulting clipped polygon (hole) should be clockwise.");
CHECK(r[1][0].is_equal_approx(b[1]));
CHECK(r[1][1].is_equal_approx(b[0]));
CHECK(r[1][2].is_equal_approx(b[2]));
}
}
TEST_CASE("[Geometry2D] Exclude polygons") {
Vector<Point2> a;
Vector<Point2> b;
Vector<Vector<Point2>> r;
a.push_back(Point2(225, 180));
a.push_back(Point2(160, 230));
a.push_back(Point2(20, 212));
a.push_back(Point2(50, 115));
SUBCASE("[Geometry2D] Both polygons are empty") {
r = Geometry2D::exclude_polygons(Vector<Point2>(), Vector<Point2>());
CHECK_MESSAGE(r.is_empty(), "Both polygons are empty. The excluded polygon should also be empty.");
}
SUBCASE("[Geometry2D] One polygon is empty") {
r = Geometry2D::exclude_polygons(a, b);
REQUIRE_MESSAGE(r.size() == 1, "One polygon is non-empty. There should be 1 resulting excluded polygon.");
REQUIRE_MESSAGE(r[0].size() == 4, "The resulting excluded polygon should have 4 vertices.");
CHECK(r[0][0].is_equal_approx(a[0]));
CHECK(r[0][1].is_equal_approx(a[1]));
CHECK(r[0][2].is_equal_approx(a[2]));
CHECK(r[0][3].is_equal_approx(a[3]));
}
SUBCASE("[Geometry2D] Exclude with 2 resulting polygons (outline and hole)") {
b.push_back(Point2(140, 160));
b.push_back(Point2(150, 220));
b.push_back(Point2(40, 200));
b.push_back(Point2(60, 140));
r = Geometry2D::exclude_polygons(a, b);
REQUIRE_MESSAGE(r.size() == 2, "There should be 2 resulting excluded polygons (outline and hole).");
REQUIRE_MESSAGE(r[0].size() == 4, "The resulting excluded polygon should have 4 vertices.");
REQUIRE_MESSAGE(!Geometry2D::is_polygon_clockwise(r[0]), "The resulting excluded polygon (outline) should be counter-clockwise.");
CHECK(r[0][0].is_equal_approx(a[0]));
CHECK(r[0][1].is_equal_approx(a[1]));
CHECK(r[0][2].is_equal_approx(a[2]));
CHECK(r[0][3].is_equal_approx(a[3]));
REQUIRE_MESSAGE(r[1].size() == 4, "The resulting excluded polygon should have 4 vertices.");
REQUIRE_MESSAGE(Geometry2D::is_polygon_clockwise(r[1]), "The resulting excluded polygon (hole) should be clockwise.");
CHECK(r[1][0].is_equal_approx(Point2(40, 200)));
CHECK(r[1][1].is_equal_approx(Point2(150, 220)));
CHECK(r[1][2].is_equal_approx(Point2(140, 160)));
CHECK(r[1][3].is_equal_approx(Point2(60, 140)));
}
}
TEST_CASE("[Geometry2D] Intersect polyline with polygon") {
Vector<Vector2> l;
Vector<Vector2> p;
Vector<Vector<Point2>> r;
l.push_back(Vector2(100, 90));
l.push_back(Vector2(120, 250));
p.push_back(Vector2(225, 180));
p.push_back(Vector2(160, 230));
p.push_back(Vector2(20, 212));
p.push_back(Vector2(50, 115));
SUBCASE("[Geometry2D] Both line and polygon are empty") {
r = Geometry2D::intersect_polyline_with_polygon(Vector<Vector2>(), Vector<Vector2>());
CHECK_MESSAGE(r.is_empty(), "Both line and polygon are empty. The intersection line should also be empty.");
}
SUBCASE("[Geometry2D] Line is non-empty and polygon is empty") {
r = Geometry2D::intersect_polyline_with_polygon(l, Vector<Vector2>());
CHECK_MESSAGE(r.is_empty(), "The polygon is empty while the line is non-empty. The intersection line should be empty.");
}
SUBCASE("[Geometry2D] Basic intersection with 1 resulting intersection line") {
r = Geometry2D::intersect_polyline_with_polygon(l, p);
REQUIRE_MESSAGE(r.size() == 1, "There should be 1 resulting intersection line.");
REQUIRE_MESSAGE(r[0].size() == 2, "The resulting intersection line should have 2 vertices.");
CHECK(r[0][0].is_equal_approx(Vector2(105.711609, 135.692886)));
CHECK(r[0][1].is_equal_approx(Vector2(116.805809, 224.446457)));
}
SUBCASE("[Geometry2D] Complex intersection with 2 resulting intersection lines") {
l.clear();
l.push_back(Vector2(100, 90));
l.push_back(Vector2(190, 255));
l.push_back(Vector2(135, 260));
l.push_back(Vector2(57, 200));
l.push_back(Vector2(50, 170));
l.push_back(Vector2(15, 155));
r = Geometry2D::intersect_polyline_with_polygon(l, p);
REQUIRE_MESSAGE(r.size() == 2, "There should be 2 resulting intersection lines.");
REQUIRE_MESSAGE(r[0].size() == 2, "The resulting intersection line should have 2 vertices.");
CHECK(r[0][0].is_equal_approx(Vector2(129.804565, 144.641693)));
CHECK(r[0][1].is_equal_approx(Vector2(171.527084, 221.132996)));
REQUIRE_MESSAGE(r[1].size() == 4, "The resulting intersection line should have 4 vertices.");
CHECK(r[1][0].is_equal_approx(Vector2(83.15609, 220.120087)));
CHECK(r[1][1].is_equal_approx(Vector2(57, 200)));
CHECK(r[1][2].is_equal_approx(Vector2(50, 170)));
CHECK(r[1][3].is_equal_approx(Vector2(34.980492, 163.563065)));
}
}
TEST_CASE("[Geometry2D] Clip polyline with polygon") {
Vector<Vector2> l;
Vector<Vector2> p;
Vector<Vector<Point2>> r;
l.push_back(Vector2(70, 140));
l.push_back(Vector2(160, 320));
p.push_back(Vector2(225, 180));
p.push_back(Vector2(160, 230));
p.push_back(Vector2(20, 212));
p.push_back(Vector2(50, 115));
SUBCASE("[Geometry2D] Both line and polygon are empty") {
r = Geometry2D::clip_polyline_with_polygon(Vector<Vector2>(), Vector<Vector2>());
CHECK_MESSAGE(r.is_empty(), "Both line and polygon are empty. The clipped line should also be empty.");
}
SUBCASE("[Geometry2D] Polygon is empty and line is non-empty") {
r = Geometry2D::clip_polyline_with_polygon(l, Vector<Vector2>());
REQUIRE_MESSAGE(r.size() == 1, "There should be 1 resulting clipped line.");
REQUIRE_MESSAGE(r[0].size() == 2, "The resulting clipped line should have 2 vertices.");
CHECK(r[0][0].is_equal_approx(l[0]));
CHECK(r[0][1].is_equal_approx(l[1]));
}
SUBCASE("[Geometry2D] Basic clip with 1 resulting clipped line") {
r = Geometry2D::clip_polyline_with_polygon(l, p);
REQUIRE_MESSAGE(r.size() == 1, "There should be 1 resulting clipped line.");
REQUIRE_MESSAGE(r[0].size() == 2, "The resulting clipped line should have 2 vertices.");
CHECK(r[0][0].is_equal_approx(Vector2(111.908401, 223.816803)));
CHECK(r[0][1].is_equal_approx(Vector2(160, 320)));
}
SUBCASE("[Geometry2D] Complex clip with 2 resulting clipped lines") {
l.clear();
l.push_back(Vector2(55, 70));
l.push_back(Vector2(50, 190));
l.push_back(Vector2(120, 165));
l.push_back(Vector2(122, 250));
l.push_back(Vector2(160, 320));
r = Geometry2D::clip_polyline_with_polygon(l, p);
REQUIRE_MESSAGE(r.size() == 2, "There should be 2 resulting clipped lines.");
REQUIRE_MESSAGE(r[0].size() == 3, "The resulting clipped line should have 3 vertices.");
CHECK(r[0][0].is_equal_approx(Vector2(160, 320)));
CHECK(r[0][1].is_equal_approx(Vector2(122, 250)));
CHECK(r[0][2].is_equal_approx(Vector2(121.412682, 225.038757)));
REQUIRE_MESSAGE(r[1].size() == 2, "The resulting clipped line should have 2 vertices.");
CHECK(r[1][0].is_equal_approx(Vector2(53.07737, 116.143021)));
CHECK(r[1][1].is_equal_approx(Vector2(55, 70)));
}
}
} // namespace TestGeometry2D
#endif // TEST_GEOMETRY_2D_H
| {
"content_hash": "1ee9a39061f761dcd49ea1589e48ef7d",
"timestamp": "",
"source": "github",
"line_count": 553,
"max_line_length": 132,
"avg_line_length": 45.379746835443036,
"alnum_prop": 0.6590555887627018,
"repo_name": "honix/godot",
"id": "32d4114a1c7de44bc03c16559c132321b6eac691",
"size": "25095",
"binary": false,
"copies": "3",
"ref": "refs/heads/master",
"path": "tests/test_geometry_2d.h",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C",
"bytes": "50004"
},
{
"name": "C++",
"bytes": "16813390"
},
{
"name": "HTML",
"bytes": "10302"
},
{
"name": "Java",
"bytes": "497061"
},
{
"name": "Makefile",
"bytes": "451"
},
{
"name": "Objective-C",
"bytes": "2644"
},
{
"name": "Objective-C++",
"bytes": "145442"
},
{
"name": "Python",
"bytes": "262658"
},
{
"name": "Shell",
"bytes": "11105"
}
],
"symlink_target": ""
} |
{% extends "horizon/common/_modal_form.html" %}
{% load i18n %}
{% load url from future %}
{% block form_id %}update_pool_form{% endblock %}
{% block form_action %}{% url 'horizon:project:lbaas:updatemember' member_id %}{% endblock %}
{% block modal-header %}{% trans "Edit Member" %}{% endblock %}
{% block modal-body %}
<div class="left">
<fieldset>
{% include "horizon/common/_form_fields.html" %}
</fieldset>
</div>
<div class="right">
<h3>{% trans "Description:" %}</h3>
<p>{% trans "You may update member attributes here: edit pool, weight or admin state." %}</p>
</div>
{% endblock %}
{% block modal-footer %}
<input class="btn btn-primary pull-right" type="submit" value="{% trans "Save Changes" %}" />
<a href="{% url 'horizon:project:lbaas:index' %}" class="btn btn-default secondary cancel close">{% trans "Cancel" %}</a>
{% endblock %}
| {
"content_hash": "f9538bd47d7a6bee471daa8a8121fd0e",
"timestamp": "",
"source": "github",
"line_count": 25,
"max_line_length": 123,
"avg_line_length": 35.04,
"alnum_prop": 0.6301369863013698,
"repo_name": "Juniper/contrail-horizon",
"id": "a1ffc9352ecde67c2420cea3dfa9c15a8aafed16",
"size": "876",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "openstack_dashboard/dashboards/project/lbaas/templates/lbaas/_updatemember.html",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "CSS",
"bytes": "2191"
},
{
"name": "HTML",
"bytes": "135295"
},
{
"name": "JavaScript",
"bytes": "445916"
},
{
"name": "Python",
"bytes": "664980"
}
],
"symlink_target": ""
} |
<?php
namespace AcmePhp\Core\Exception\Server;
use AcmePhp\Core\Exception\AcmeCoreServerException;
use Psr\Http\Message\RequestInterface;
/**
* @author Alex Plekhanov <[email protected]>
*/
class UnsupportedContactServerException extends AcmeCoreServerException
{
public function __construct(RequestInterface $request, string $detail, \Exception $previous = null)
{
parent::__construct(
$request,
'[unsupportedContact] A contact URL for an account used an unsupported protocol scheme: '.$detail,
$previous
);
}
}
| {
"content_hash": "4bcba18d4482d5f44598377c2a4b1862",
"timestamp": "",
"source": "github",
"line_count": 23,
"max_line_length": 110,
"avg_line_length": 25.434782608695652,
"alnum_prop": 0.6957264957264957,
"repo_name": "acmephp/core",
"id": "44c10e7ccefe5145046a2aea3b4a3362d8b9fd7b",
"size": "820",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "Exception/Server/UnsupportedContactServerException.php",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "PHP",
"bytes": "131157"
}
],
"symlink_target": ""
} |
require 'spec_helper'
describe EarlyAdopter do
it 'should have a name and description' do
EarlyAdopter.name.should_not be_blank
EarlyAdopter.description.should_not be_blank
end
it 'should award user if they joined github within 6 months of founding' do
profile = Fabricate(:github_profile, created_at: '2008/04/14 15:53:10 -0700')
user = Fabricate(:user, github_id: profile.github_id)
user.build_github_facts
badge = EarlyAdopter.new(user)
badge.award?.should == true
badge.reasons.should == "Created an account within GitHub's first 6 months on April 14, 2008."
end
it 'should not award the user if the they joined after 6 mounts of github founding' do
profile = Fabricate(:github_profile, created_at: '2009/04/14 15:53:10 -0700')
user = Fabricate(:user, github_id: profile.github_id)
user.build_github_facts
badge = EarlyAdopter.new(user)
badge.award?.should == false
end
end | {
"content_hash": "87b8498be6dde06cd277892f927ea6fd",
"timestamp": "",
"source": "github",
"line_count": 30,
"max_line_length": 98,
"avg_line_length": 31.633333333333333,
"alnum_prop": 0.7123287671232876,
"repo_name": "msurguy/coderwall",
"id": "4f072cfb4fa1ba77d2bfd5f1eeac9f2781121e59",
"size": "949",
"binary": false,
"copies": "3",
"ref": "refs/heads/master",
"path": "spec/models/badges/early_adopter_spec.rb",
"mode": "33188",
"license": "bsd-2-clause",
"language": [],
"symlink_target": ""
} |
ACCEPTED
#### According to
Index Fungorum
#### Published in
null
#### Original name
Usnea creberrima Vain.
### Remarks
null | {
"content_hash": "c3f865cc260db4540a063801eb3a05f6",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 22,
"avg_line_length": 9.76923076923077,
"alnum_prop": 0.7007874015748031,
"repo_name": "mdoering/backbone",
"id": "e3b6ad9f131d66c88630d6ce892fb544cd7205d5",
"size": "191",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "life/Fungi/Ascomycota/Lecanoromycetes/Lecanorales/Parmeliaceae/Usnea/Usnea bayleyi/Usnea bayleyi creberrima/README.md",
"mode": "33188",
"license": "apache-2.0",
"language": [],
"symlink_target": ""
} |
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!-- NewPage -->
<html lang="en">
<head>
<!-- Generated by javadoc (version 1.7.0_67) on Wed Oct 08 15:57:24 PDT 2014 -->
<meta http-equiv="Content-Type" content="text/html" charset="UTF-8">
<title>Uses of Class org.apache.hadoop.hbase.mapreduce.GroupingTableMapper (HBase 0.98.7-hadoop2 API)</title>
<meta name="date" content="2014-10-08">
<link rel="stylesheet" type="text/css" href="../../../../../../stylesheet.css" title="Style">
</head>
<body>
<script type="text/javascript"><!--
if (location.href.indexOf('is-external=true') == -1) {
parent.document.title="Uses of Class org.apache.hadoop.hbase.mapreduce.GroupingTableMapper (HBase 0.98.7-hadoop2 API)";
}
//-->
</script>
<noscript>
<div>JavaScript is disabled on your browser.</div>
</noscript>
<!-- ========= START OF TOP NAVBAR ======= -->
<div class="topNav"><a name="navbar_top">
<!-- -->
</a><a href="#skip-navbar_top" title="Skip navigation links"></a><a name="navbar_top_firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../../../../overview-summary.html">Overview</a></li>
<li><a href="../package-summary.html">Package</a></li>
<li><a href="../../../../../../org/apache/hadoop/hbase/mapreduce/GroupingTableMapper.html" title="class in org.apache.hadoop.hbase.mapreduce">Class</a></li>
<li class="navBarCell1Rev">Use</li>
<li><a href="../package-tree.html">Tree</a></li>
<li><a href="../../../../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../../../../index-all.html">Index</a></li>
<li><a href="../../../../../../help-doc.html">Help</a></li>
</ul>
</div>
<div class="subNav">
<ul class="navList">
<li>Prev</li>
<li>Next</li>
</ul>
<ul class="navList">
<li><a href="../../../../../../index.html?org/apache/hadoop/hbase/mapreduce/class-use/GroupingTableMapper.html" target="_top">Frames</a></li>
<li><a href="GroupingTableMapper.html" target="_top">No Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_top">
<li><a href="../../../../../../allclasses-noframe.html">All Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
allClassesLink = document.getElementById("allclasses_navbar_top");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
//-->
</script>
</div>
<a name="skip-navbar_top">
<!-- -->
</a></div>
<!-- ========= END OF TOP NAVBAR ========= -->
<div class="header">
<h2 title="Uses of Class org.apache.hadoop.hbase.mapreduce.GroupingTableMapper" class="title">Uses of Class<br>org.apache.hadoop.hbase.mapreduce.GroupingTableMapper</h2>
</div>
<div class="classUseContainer">No usage of org.apache.hadoop.hbase.mapreduce.GroupingTableMapper</div>
<!-- ======= START OF BOTTOM NAVBAR ====== -->
<div class="bottomNav"><a name="navbar_bottom">
<!-- -->
</a><a href="#skip-navbar_bottom" title="Skip navigation links"></a><a name="navbar_bottom_firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../../../../overview-summary.html">Overview</a></li>
<li><a href="../package-summary.html">Package</a></li>
<li><a href="../../../../../../org/apache/hadoop/hbase/mapreduce/GroupingTableMapper.html" title="class in org.apache.hadoop.hbase.mapreduce">Class</a></li>
<li class="navBarCell1Rev">Use</li>
<li><a href="../package-tree.html">Tree</a></li>
<li><a href="../../../../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../../../../index-all.html">Index</a></li>
<li><a href="../../../../../../help-doc.html">Help</a></li>
</ul>
</div>
<div class="subNav">
<ul class="navList">
<li>Prev</li>
<li>Next</li>
</ul>
<ul class="navList">
<li><a href="../../../../../../index.html?org/apache/hadoop/hbase/mapreduce/class-use/GroupingTableMapper.html" target="_top">Frames</a></li>
<li><a href="GroupingTableMapper.html" target="_top">No Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_bottom">
<li><a href="../../../../../../allclasses-noframe.html">All Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
allClassesLink = document.getElementById("allclasses_navbar_bottom");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
//-->
</script>
</div>
<a name="skip-navbar_bottom">
<!-- -->
</a></div>
<!-- ======== END OF BOTTOM NAVBAR ======= -->
<p class="legalCopy"><small>Copyright © 2014 <a href="http://www.apache.org/">The Apache Software Foundation</a>. All rights reserved.</small></p>
</body>
</html>
| {
"content_hash": "1590d390f92fdc2888d3720fc3b553cd",
"timestamp": "",
"source": "github",
"line_count": 117,
"max_line_length": 169,
"avg_line_length": 39.55555555555556,
"alnum_prop": 0.6242437337942955,
"repo_name": "gsoundar/mambo-ec2-deploy",
"id": "2d49fefcfacf467c55116e8f95bff2f63ea9c6b9",
"size": "4628",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "packages/hbase-0.98.7-hadoop2/docs/devapidocs/org/apache/hadoop/hbase/mapreduce/class-use/GroupingTableMapper.html",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Batchfile",
"bytes": "23179"
},
{
"name": "CSS",
"bytes": "39965"
},
{
"name": "HTML",
"bytes": "263271260"
},
{
"name": "Java",
"bytes": "103085"
},
{
"name": "JavaScript",
"bytes": "1347"
},
{
"name": "Python",
"bytes": "4101"
},
{
"name": "Ruby",
"bytes": "262588"
},
{
"name": "Shell",
"bytes": "118548"
}
],
"symlink_target": ""
} |
package com.battlelancer.seriesguide.util;
import static com.google.common.truth.Truth.assertThat;
import com.battlelancer.seriesguide.traktapi.TraktTools;
import java.util.Locale;
import org.junit.Test;
public class TraktToolsTest {
/**
* Note: ensure to test on Android as Android uses a different formatter than the local JVM.
*/
@Test
public void ratingString() {
assertThat(TraktTools.buildRatingString(1.0, Locale.GERMAN)).isEqualTo("1,0");
assertThat(TraktTools.buildRatingString(1.5, Locale.GERMAN)).isEqualTo("1,5");
assertThat(TraktTools.buildRatingString(1.05, Locale.GERMAN)).isEqualTo("1,1");
}
}
| {
"content_hash": "1af9a72007c172c8ba437399b0f5ba63",
"timestamp": "",
"source": "github",
"line_count": 20,
"max_line_length": 96,
"avg_line_length": 33.2,
"alnum_prop": 0.7259036144578314,
"repo_name": "UweTrottmann/SeriesGuide",
"id": "01ebcf1bd68128acfb40d053168a0d589e7a0720",
"size": "664",
"binary": false,
"copies": "1",
"ref": "refs/heads/dev",
"path": "app/src/androidTest/java/com/battlelancer/seriesguide/util/TraktToolsTest.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Java",
"bytes": "1005563"
},
{
"name": "Kotlin",
"bytes": "1727870"
}
],
"symlink_target": ""
} |
package energy.usef.agr.service.business;
import energy.usef.core.config.Config;
import energy.usef.core.config.ConfigParam;
import energy.usef.core.data.xml.bean.message.DispositionAvailableRequested;
import energy.usef.core.data.xml.bean.message.FlexOrder;
import energy.usef.core.data.xml.bean.message.MessageMetadata;
import energy.usef.core.data.xml.bean.message.PTU;
import energy.usef.core.exception.BusinessValidationException;
import energy.usef.core.model.CongestionPointConnectionGroup;
import energy.usef.core.model.DocumentStatus;
import energy.usef.core.model.DocumentType;
import energy.usef.core.model.PlanboardMessage;
import energy.usef.core.model.PtuContainer;
import energy.usef.core.model.PtuFlexOffer;
import energy.usef.core.service.business.CorePlanboardBusinessService;
import energy.usef.core.service.validation.CoreBusinessError;
import energy.usef.core.service.validation.CorePlanboardValidatorService;
import energy.usef.core.util.DateTimeUtil;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.function.Function;
import java.util.stream.Collectors;
import java.util.stream.IntStream;
import org.joda.time.LocalDate;
import org.joda.time.LocalDateTime;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mock;
import org.mockito.Mockito;
import org.powermock.modules.junit4.PowerMockRunner;
import org.powermock.reflect.Whitebox;
@RunWith(PowerMockRunner.class)
public class AgrValidationBusinessServiceTest {
private static final LocalDate DATE = new LocalDate("2014-12-28");
private static final long MESSAGE_SEQUENCE = 1L;
private static final String MESSAGE_ORIGIN = "dso.usef-example.com";
private static final String CONGESTION_POINT = "ean.123456789012345678";
private AgrValidationBusinessService agrValidationBusinessService;
@Mock
private AgrPlanboardBusinessService agrPlanboardBusinessService;
@Mock
private CorePlanboardValidatorService corePlanboardValidatorService;
@Mock
private CorePlanboardBusinessService corePlanboardBusinessService;
@Mock
private Config config;
@Before
public void init() {
agrValidationBusinessService = new AgrValidationBusinessService();
Whitebox.setInternalState(agrValidationBusinessService, "agrPlanboardBusinessService",
agrPlanboardBusinessService);
Whitebox.setInternalState(agrValidationBusinessService, "corePlanboardBusinessService",
corePlanboardBusinessService);
Whitebox.setInternalState(agrValidationBusinessService, "corePlanboardValidatorService",
corePlanboardValidatorService);
Whitebox.setInternalState(agrValidationBusinessService, config);
Mockito.when(config.getIntegerProperty(ConfigParam.PTU_DURATION)).thenReturn(15);
}
@Test
public void testValidateCorrespondingFlexOfferWithMatchingOfferPTUs() {
try {
FlexOrder order = createFlexOrder();
Map<Integer, PtuFlexOffer> ptuFlexOffer = createPtuFlexOffer(300, 0.045 / 1000);
PTU orderPTU = createPTU(DispositionAvailableRequested.REQUESTED, 1, 1, 300, 0.045 / 1000);
order.getPTU().clear();
order.getPTU().add(orderPTU);
PlanboardMessage planboardMessage = new PlanboardMessage(DocumentType.FLEX_OFFER, order.getFlexOfferSequence(),
DocumentStatus.ACCEPTED, order.getFlexOfferOrigin(), order.getPeriod(), order.getFlexOfferSequence(),
new CongestionPointConnectionGroup(order.getCongestionPoint()), DateTimeUtil.getEndOfDay(new LocalDateTime()));
Mockito.when(corePlanboardBusinessService
.findPtuFlexOffer(order.getFlexOfferSequence(), order.getMessageMetadata().getSenderDomain()))
.thenReturn(ptuFlexOffer);
Mockito.when(corePlanboardValidatorService
.validatePlanboardMessageExpirationDate(order.getFlexOfferSequence(), DocumentType.FLEX_OFFER,
order.getMessageMetadata().getSenderDomain())).thenReturn(planboardMessage);
agrValidationBusinessService.validateCorrespondingFlexOffer(order);
} catch (BusinessValidationException e) {
Assert.fail(" do not expect exception");
}
}
@Test
public void testValidateCorrespondingFlexOfferWithDiffPriceOfferPTUs() {
try {
FlexOrder order = createFlexOrder();
Map<Integer, PtuFlexOffer> ptuFlexOffer = createPtuFlexOffer(300, 0.045 / 1000);
PTU orderPTU = createPTU(DispositionAvailableRequested.REQUESTED, 1, 1, 300, 0.040 / 1000);
order.getPTU().clear();
order.getPTU().add(orderPTU);
PlanboardMessage planboardMessage = new PlanboardMessage(DocumentType.FLEX_OFFER, order.getFlexOfferSequence(),
DocumentStatus.ACCEPTED, order.getFlexOfferOrigin(), order.getPeriod(), order.getFlexOfferSequence(),
new CongestionPointConnectionGroup(order.getCongestionPoint()), DateTimeUtil.getEndOfDay(new LocalDateTime()));
Mockito.when(corePlanboardValidatorService
.validatePlanboardMessageExpirationDate(order.getFlexOfferSequence(), DocumentType.FLEX_OFFER,
order.getMessageMetadata().getSenderDomain())).thenReturn(planboardMessage);
agrValidationBusinessService.validateCorrespondingFlexOffer(order);
Assert.fail(" Exception epected, price is different for order and offer.");
} catch (BusinessValidationException e) {
}
}
@Test
public void testValidateCorrespondingFlexOfferWithDiffPowerInOfferPTUs() {
try {
FlexOrder order = createFlexOrder();
Map<Integer, PtuFlexOffer> ptuFlexOffer = createPtuFlexOffer(200, 0.045 / 1000);
PTU orderPTU = createPTU(DispositionAvailableRequested.REQUESTED, 1, 1, 300, 0.045 / 1000);
order.getPTU().clear();
order.getPTU().add(orderPTU);
Mockito.when(corePlanboardBusinessService
.findPtuFlexOffer(order.getFlexOfferSequence(), order.getMessageMetadata().getSenderDomain()))
.thenReturn(ptuFlexOffer);
PlanboardMessage planboardMessage = new PlanboardMessage(DocumentType.FLEX_OFFER, order.getFlexOfferSequence(),
DocumentStatus.ACCEPTED, order.getFlexOfferOrigin(), order.getPeriod(), order.getFlexOfferSequence(),
new CongestionPointConnectionGroup(order.getCongestionPoint()), DateTimeUtil.getEndOfDay(new LocalDateTime()));
Mockito.when(corePlanboardValidatorService
.validatePlanboardMessageExpirationDate(order.getFlexOfferSequence(), DocumentType.FLEX_OFFER,
order.getMessageMetadata().getSenderDomain())).thenReturn(planboardMessage);
agrValidationBusinessService.validateCorrespondingFlexOffer(order);
Assert.fail(" Exception expected, power is different for order and offer.");
} catch (BusinessValidationException e) {
}
}
@Test(expected = BusinessValidationException.class)
public void testValidateCorrespondingFlexOfferWithExpiredFlexOffer() throws Exception {
FlexOrder order = createFlexOrder();
order.setPeriod(DateTimeUtil.getCurrentDate());
Mockito.when(corePlanboardValidatorService
.validatePlanboardMessageExpirationDate(order.getFlexOfferSequence(), DocumentType.FLEX_OFFER,
order.getMessageMetadata().getSenderDomain()))
.thenThrow(new BusinessValidationException(CoreBusinessError.DOCUMENT_EXIRED, DocumentType.FLEX_OFFER,
order.getFlexOfferSequence(),
DateTimeUtil.getStartOfDay(new LocalDateTime())));
agrValidationBusinessService.validateCorrespondingFlexOffer(order);
}
@Test
public void testValidateCorrespondingFlexOfferRevoked() {
try {
FlexOrder order = createFlexOrder();
order.setPeriod(DateTimeUtil.getCurrentDate());
Map<Integer, PtuFlexOffer> ptuFlexOffer = createPtuFlexOffer(200, 0.045 / 1000);
PTU orderPTU = createPTU(DispositionAvailableRequested.REQUESTED, 1, 1, 200, 0.045 / 1000);
order.getPTU().clear();
order.getPTU().add(orderPTU);
PlanboardMessage revokedPlanboardMessage = new PlanboardMessage(DocumentType.FLEX_OFFER, order.getFlexOfferSequence(),
DocumentStatus.REVOKED, order.getFlexOfferOrigin(), order.getPeriod(), order.getFlexOfferSequence(),
new CongestionPointConnectionGroup(order.getCongestionPoint()), DateTimeUtil.getEndOfDay(new LocalDateTime()));
Mockito.when(corePlanboardBusinessService
.findPtuFlexOffer(order.getFlexOfferSequence(), order.getMessageMetadata().getSenderDomain()))
.thenReturn(ptuFlexOffer);
Mockito.when(corePlanboardValidatorService
.validatePlanboardMessageExpirationDate(order.getFlexOfferSequence(), DocumentType.FLEX_OFFER,
order.getMessageMetadata().getSenderDomain())).thenReturn(revokedPlanboardMessage);
agrValidationBusinessService.validateCorrespondingFlexOffer(order);
Assert.fail("Exception expected, offer has already been expired!");
} catch (BusinessValidationException e) {
}
}
@Test
public void testValidateFlexOrderTimingFuture() {
FlexOrder order = createFlexOrder();
order.setPeriod(DateTimeUtil.getCurrentDate().plusDays(1));
try {
agrValidationBusinessService.validateFlexOrderTiming(order);
} catch (BusinessValidationException e) {
Assert.fail("No BusinessValidationException excepted, order is in the future.");
}
}
@Test
public void testValidateFlexOrderTimingTodayAcceptable() {
FlexOrder order = createFlexOrder();
order.setPeriod(DateTimeUtil.getCurrentDate());
try {
agrValidationBusinessService.validateFlexOrderTiming(order);
} catch (BusinessValidationException e) {
Assert.fail("No BusinessValidationException excepted, future PTU's have non-zero power values.");
}
}
@Test
public void testValidateFlexOrderTimingTodayNotAcceptable() {
FlexOrder order = createFlexOrder();
order.setPeriod(DateTimeUtil.getCurrentDate());
order.getPTU().get(0).setPower(BigInteger.ZERO);
try {
agrValidationBusinessService.validateFlexOrderTiming(order);
Assert.fail("BusinessValidationException excepted, all future PTU's have zero power values.");
} catch (BusinessValidationException e) {
}
}
@Test
public void testValidateFlexOrderTimingPast() {
FlexOrder order = createFlexOrder();
order.setPeriod(DateTimeUtil.getCurrentDate().minusDays(1));
try {
agrValidationBusinessService.validateFlexOrderTiming(order);
Assert.fail("BusinessValidationException excepted, order is in the past.");
} catch (BusinessValidationException e) {
}
}
private Map<Integer, PtuFlexOffer> createPtuFlexOffer(int power, double price) {
return IntStream.rangeClosed(1, 96).mapToObj(index -> {
PtuFlexOffer ptuFlexOffer = new PtuFlexOffer();
ptuFlexOffer.setPower(BigInteger.valueOf(power));
ptuFlexOffer.setPrice(BigDecimal.valueOf(price));
ptuFlexOffer.setPtuContainer(new PtuContainer(DATE, index));
return ptuFlexOffer;
}).collect(Collectors.toMap(fo -> fo.getPtuContainer().getPtuIndex(), Function.identity()));
}
private FlexOrder createFlexOrder() {
FlexOrder flexOrder = new FlexOrder();
flexOrder.setCongestionPoint(CONGESTION_POINT);
flexOrder.setPeriod(DATE);
flexOrder.setFlexOfferOrigin(MESSAGE_ORIGIN);
flexOrder.setFlexOfferSequence(MESSAGE_SEQUENCE);
flexOrder.setCurrency("EUR");
flexOrder.setOrderReference("1");
MessageMetadata messageMetadata = new MessageMetadata();
messageMetadata.setMessageID("testId");
messageMetadata.setConversationID("testConversation");
messageMetadata.setSenderDomain("test.sender.domain");
flexOrder.setMessageMetadata(messageMetadata);
List<PTU> ptus = createPTUList(1, 96, 300, 0.045 / 1000);
flexOrder.getPTU().addAll(ptus);
return flexOrder;
}
private List<PTU> createPTUList(int start, int duration, int power, double price) {
List<PTU> ptus = new ArrayList<>();
ptus.add(createPTU(DispositionAvailableRequested.REQUESTED, start, duration, power, price));
return ptus;
}
private PTU createPTU(DispositionAvailableRequested disposition, int start, int duration, int power, double price) {
PTU ptu = new PTU();
ptu.setDisposition(disposition);
ptu.setDuration(BigInteger.valueOf(duration));
ptu.setStart(BigInteger.valueOf(start));
ptu.setPower(BigInteger.valueOf(power));
ptu.setPrice(BigDecimal.valueOf(price));
return ptu;
}
}
| {
"content_hash": "a3b8741fd1f58a0146c1092927e9ae6e",
"timestamp": "",
"source": "github",
"line_count": 282,
"max_line_length": 131,
"avg_line_length": 47.91843971631206,
"alnum_prop": 0.7045807740694147,
"repo_name": "USEF-Foundation/ri.usef.energy",
"id": "8ff49de8880b4d14b4b4355eaf3224e8300ef6a8",
"size": "14112",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "usef-build/usef-workflow/usef-agr/src/test/java/energy/usef/agr/service/business/AgrValidationBusinessServiceTest.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Batchfile",
"bytes": "25252"
},
{
"name": "CSS",
"bytes": "13416"
},
{
"name": "HTML",
"bytes": "33111187"
},
{
"name": "Java",
"bytes": "6550058"
},
{
"name": "JavaScript",
"bytes": "857"
},
{
"name": "PowerShell",
"bytes": "6025"
},
{
"name": "Shell",
"bytes": "18796"
}
],
"symlink_target": ""
} |
CPUTFont *CPUTFont::CreateFont(cString FontName, cString AbsolutePathAndFilename)
{
#ifdef UNICODE
char *pName = ws2s(FontName);
char *pPath = ws2s(AbsolutePathAndFilename);
CPUTFont *pFont;
pFont = CPUTFont::LoadBMFont( FontName, AbsolutePathAndFilename );
delete pName;
delete pPath;
return pFont;
#else
return CPUTFont::LoadBMFont( FontName, AbsolutePathAndFilename );
#endif
}
//
// Loads a binary font description file generated by BMFont: http://www.angelcode.com/products/bmfont/
// Does not load the texture file as that is handled through the material system
//
CPUTFont *CPUTFont::LoadBMFont(const cString & pPath, const cString & pFileName)
{
UINT fileSize = 0;
uint8_t *pData = NULL;
uint32_t currentPos = 0;
CPUTFont *pNewFont = new CPUTFont();
pNewFont->mFontScale = 1.0f;
//
// Load font file contents into a local buffer for processing
//
cString fontDescriptionFile(pPath + pFileName);
CPUTFileSystem::ReadFileContents(fontDescriptionFile.c_str(), &fileSize, (void **) &pData, false, true);
//
// Validate the header info for the file
//
uint8_t fileIdentifier[3];
fileIdentifier[0] = *(pData + currentPos++);
fileIdentifier[1] = *(pData + currentPos++);
fileIdentifier[2] = *(pData + currentPos++);
if ((fileIdentifier[0] != 66) || (fileIdentifier[1] != 77) || (fileIdentifier[2] != 70)) {
DEBUG_PRINT("File Identifier not valid for a BMFont binary file.");
return NULL;
}
uint8_t version;
version = *(pData + currentPos++);
if (version != 3) {
DEBUG_PRINT("BMFont file is not the correct version. Must be version 3.");
return NULL;
}
//
// Load the various blocks of the BMFont file
//
while (currentPos < fileSize) {
uint8_t blockType;
uint32_t blockSize;
blockType = *(pData + currentPos++);
memcpy(&blockSize, pData + currentPos, 4);
currentPos += 4;
switch (blockType) {
case 1:
pNewFont->mpFontInfo = (BMFontInfo *) malloc(blockSize);
memcpy(pNewFont->mpFontInfo, pData + currentPos, blockSize);
currentPos += blockSize;
break;
case 2:
pNewFont->mpFontCommon = (BMFontCommon *) malloc(blockSize);
memcpy(pNewFont->mpFontCommon, pData + currentPos, blockSize);
currentPos += blockSize;
break;
case 3:
pNewFont->mpFontPages = (BMFontPages *) malloc(blockSize);
memcpy(pNewFont->mpFontPages, pData + currentPos, blockSize);
currentPos += blockSize;
break;
case 4:
pNewFont->mNumChars = blockSize / 20; // could do a check to make sure the block size is evenly divided by 20
pNewFont->mpFontChars = (BMFontChars *) malloc(blockSize);
memcpy(pNewFont->mpFontChars, pData + currentPos, blockSize);
currentPos += blockSize;
break;
case 5:
pNewFont->mNumKerningPairs = blockSize / 10; // could do a check to make sure the block size is evenly divided by 10
pNewFont->mpFontKerningPairs = (BMFontKerningPairs *) malloc(blockSize);
memcpy(pNewFont->mpFontKerningPairs, pData + currentPos, blockSize);
currentPos += blockSize;
break;
default:
DEBUG_PRINT("Invalid block type");
break;
}
}
delete pData;
//CPUTAssetLibrary::GetAssetLibrary()->AddFont( s2cs(pFileName), _L(""), _L(""), pNewFont);
CPUTAssetLibrary::GetAssetLibrary()->AddFont( pFileName, _L(""), _L(""), pNewFont);
return pNewFont;
}
void CPUTFont::LayoutText(CPUTGUIVertex *pVtxBuffer, int *pWidth, int *pHeight, const cString& strtext, int tlx, int tly)
{
//wchar_t* wtext = strtext.c_str();
char* text = cs2s(strtext);
int x = tlx, y = tly;
BMFontChars *pPreviousChar = NULL;
for (uint32_t j = 0, index = 0; j < strtext.length(); j++) {
int charIndex = -1;
for (uint32_t i = 0; i < mNumChars; i++) {
if (((BMFontChars *)(((uint8_t *)(mpFontChars)) + (20 * i)))->id == text[j]) {
charIndex = i;
}
}
if (charIndex == -1) {
DEBUG_PRINT("Invalid character being searched for value: %d, char: %c", (int)text[j], text[j]);
}
BMFontChars *pChar = ((BMFontChars *)(((uint8_t *)(mpFontChars)) + (20 * charIndex)));
int kernAmount = 0;
if (pPreviousChar != NULL) {
for (uint32_t i = 0; i < mNumKerningPairs; i++) {
if ((((BMFontKerningPairs *)(((uint8_t *)(mpFontKerningPairs)) + (10 * i)))->first == pPreviousChar->id) &&
(((BMFontKerningPairs *)(((uint8_t *)(mpFontKerningPairs)) + (10 * i)))->second == pChar->id)) {
kernAmount = ((BMFontKerningPairs *)(((uint8_t *)(mpFontKerningPairs)) + (10 * i)))->amount;
}
}
}
pPreviousChar = pChar;
CPUTColor4 redColor;
redColor.r = redColor.a = 1.0f;
redColor.g = redColor.b = 1.0f;
float texWidth = (float) mpFontCommon->scaleW;
float texHeight = (float) mpFontCommon->scaleH;
if(pVtxBuffer)
{
pVtxBuffer[index+0].Pos = float3( (float)(x + mFontScale * (0 + pChar->xoffset + kernAmount)), (float)(y + mFontScale * (0 + pChar->yoffset)), 1.0f);
pVtxBuffer[index+0].UV = float2(pChar->x / texWidth, pChar->y / texHeight);
pVtxBuffer[index+0].Color = redColor;
pVtxBuffer[index+1].Pos = float3( (float)(x + mFontScale * (pChar->width + pChar->xoffset + kernAmount)), float(y + mFontScale * (0 + pChar->yoffset)), 1.0f);
pVtxBuffer[index+1].UV = float2((pChar->x + pChar->width) / texWidth, pChar->y / texHeight);
pVtxBuffer[index+1].Color = redColor;
pVtxBuffer[index+2].Pos = float3( (float)(x + mFontScale * (0.0f + pChar->xoffset + kernAmount)), (float)(y + mFontScale * (pChar->height + pChar->yoffset)), 1.0f);
pVtxBuffer[index+2].UV = float2(pChar->x / texWidth, (pChar->y + pChar->height) / texHeight);
pVtxBuffer[index+2].Color = redColor;
pVtxBuffer[index+3].Pos = float3( (float)(x + mFontScale * (pChar->width + pChar->xoffset + kernAmount)), (float)(y + mFontScale * (0 + pChar->yoffset)), 1.0f);
pVtxBuffer[index+3].UV = float2((pChar->x + pChar->width) / texWidth, pChar->y / texHeight);
pVtxBuffer[index+3].Color = redColor;
pVtxBuffer[index+4].Pos = float3( (float)(x + mFontScale * (pChar->width + pChar->xoffset + kernAmount)), (float)(y + mFontScale * (pChar->height + pChar->yoffset)), 1.0f);
pVtxBuffer[index+4].UV = float2((pChar->x + pChar->width) / texWidth, (pChar->y + pChar->height) / texHeight);
pVtxBuffer[index+4].Color = redColor;
pVtxBuffer[index+5].Pos = float3( (float)(x + mFontScale * (0 + pChar->xoffset + kernAmount)), (float)(y + mFontScale * (pChar->height + pChar->yoffset)), 1.0f);
pVtxBuffer[index+5].UV = float2(pChar->x / texWidth, (pChar->y + pChar->height) / texHeight);
pVtxBuffer[index+5].Color = redColor;
}
x += int((pChar->xadvance + kernAmount) * mFontScale);
index += 6;
}
SAFE_DELETE(text);
*pWidth = x - tlx;
*pHeight = int(mpFontCommon->lineHeight * mFontScale);
}
CPUTFont::~CPUTFont()
{
SAFE_DELETE(mpFontInfo);
SAFE_DELETE(mpFontCommon);
SAFE_DELETE(mpFontPages);
SAFE_DELETE(mpFontChars);
SAFE_DELETE(mpFontKerningPairs);
}
| {
"content_hash": "6319726ae10c69dfeebc86271de6cf71",
"timestamp": "",
"source": "github",
"line_count": 187,
"max_line_length": 177,
"avg_line_length": 42.149732620320854,
"alnum_prop": 0.5794214666328343,
"repo_name": "GameTechDev/ClusteredShadingAndroid",
"id": "ca74dace10f17eaf254515152a65bd8eb03f9756",
"size": "8815",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "CPUT/CPUT/CPUTFont.cpp",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Batchfile",
"bytes": "41"
},
{
"name": "C",
"bytes": "4011824"
},
{
"name": "C++",
"bytes": "1563321"
},
{
"name": "CSS",
"bytes": "2855"
},
{
"name": "GLSL",
"bytes": "40758"
},
{
"name": "Gnuplot",
"bytes": "648"
},
{
"name": "HLSL",
"bytes": "30291"
},
{
"name": "HTML",
"bytes": "250896"
},
{
"name": "Lua",
"bytes": "27295"
},
{
"name": "Makefile",
"bytes": "34999"
},
{
"name": "Perl",
"bytes": "34614"
},
{
"name": "PostScript",
"bytes": "2095"
},
{
"name": "RenderScript",
"bytes": "5718"
},
{
"name": "Rust",
"bytes": "889"
},
{
"name": "Shell",
"bytes": "20977"
}
],
"symlink_target": ""
} |
@implementation FruitTableAdapter
- (void)loadTableView:(UITableView *)tableView
{
// tableView.delegate = self;
if (!tableView.dataSource) {
// tableView.dataSource = self;
}
[tableView reloadData];
}
- (id)getItemData:(NSInteger)position
{
return self.dataSource[position];
}
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
return 1;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
if(!_dataSource){
_dataSource = [NSMutableArray new];
}
return _dataSource.count;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *identifier = @"value1";
UITableViewCell *nullableCell = [tableView dequeueReusableCellWithIdentifier:identifier];
if(!nullableCell){
nullableCell = [[UITableViewCell alloc]initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:identifier];
NSLog(@"实例化一次");
}
// FruitEntity *fruit = _dataSource[indexPath.row];
//
// nullableCell.textLabel.text = fruit.name;
// nullableCell.detailTextLabel.text = fruit.descriptions;
return nullableCell;
}
@end
| {
"content_hash": "5b95b0487eb7127978c3666005096143",
"timestamp": "",
"source": "github",
"line_count": 48,
"max_line_length": 118,
"avg_line_length": 25.520833333333332,
"alnum_prop": 0.7061224489795919,
"repo_name": "CentaFrameWork/iosframework",
"id": "0c9aaf471cad1c453f981be7e53aec5c23a59936",
"size": "1408",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "iOSFrameWork/iOSFrameWork/Adapter/FruitTableAdapter.m",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C",
"bytes": "30543"
},
{
"name": "Objective-C",
"bytes": "3294424"
},
{
"name": "Shell",
"bytes": "10319"
}
],
"symlink_target": ""
} |
function setEigenfunctions( obj, zeta, mu, varargin )
% SETEIGENFUNCTIONS Set eigenfunction data of an nlsaKoopmanOperator
% object
%
% Modified 2020/04/11
if ~isnumeric( zeta ) || ~ismatrix( zeta )
error( 'Eigenfunctions must be specified as a numeric matrix' )
end
if size( zeta, 1 ) ~= getNTotalSample( obj )
error( 'Incompatible number of samples in eigenfunction array' )
end
if size( zeta, 2 ) ~= getNEigenfunction( obj )
error( 'Incompatible number of eigenfunctions' )
end
if ~isnumeric( mu ) || ~iscolumn( mu )
msgStr = [ 'Inner product weights must be specified as a numeric ' ...
'column vector' ];
error( msgStr )
end
if numel( mu ) ~= size( zeta, 1 )
error( 'Incompatible number of samples in Riemannian measure' )
end
file = fullfile( getEigenfunctionPath( obj ), ...
getEigenfunctionFile( obj ) );
save( file, 'zeta', 'mu', varargin{ : } )
| {
"content_hash": "d662393924d44a5130b55b6635df8113",
"timestamp": "",
"source": "github",
"line_count": 30,
"max_line_length": 74,
"avg_line_length": 30.666666666666668,
"alnum_prop": 0.6652173913043479,
"repo_name": "dg227/NLSA",
"id": "73de3bcfdf298b15b7bb6b537adc6f35ad921087",
"size": "920",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "nlsa/classes/@nlsaKoopmanOperator/setEigenfunctions.m",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "Jupyter Notebook",
"bytes": "3276224"
},
{
"name": "MATLAB",
"bytes": "1847822"
},
{
"name": "Python",
"bytes": "39015"
},
{
"name": "Vim Script",
"bytes": "34"
}
],
"symlink_target": ""
} |
package org.apache.beam.sdk.values;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
import org.apache.beam.sdk.Pipeline;
import org.apache.beam.sdk.testing.PAssert;
import org.apache.beam.sdk.testing.RunnableOnService;
import org.apache.beam.sdk.testing.TestPipeline;
import org.apache.beam.sdk.transforms.Create;
import org.apache.beam.sdk.transforms.DoFn;
import org.apache.beam.sdk.transforms.ParDo;
import org.apache.beam.sdk.util.WindowingStrategy;
import org.apache.beam.sdk.values.PCollection.IsBounded;
import org.junit.Test;
import org.junit.experimental.categories.Category;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;
import java.io.Serializable;
import java.util.Arrays;
import java.util.List;
/** Unit tests for {@link PCollectionTuple}. */
@RunWith(JUnit4.class)
public final class PCollectionTupleTest implements Serializable {
@Test
public void testOfThenHas() {
Pipeline pipeline = TestPipeline.create();
PCollection<Object> pCollection = PCollection.createPrimitiveOutputInternal(
pipeline, WindowingStrategy.globalDefault(), IsBounded.BOUNDED);
TupleTag<Object> tag = new TupleTag<>();
assertTrue(PCollectionTuple.of(tag, pCollection).has(tag));
}
@Test
public void testEmpty() {
Pipeline pipeline = TestPipeline.create();
TupleTag<Object> tag = new TupleTag<>();
assertFalse(PCollectionTuple.empty(pipeline).has(tag));
}
@Test
@Category(RunnableOnService.class)
public void testComposePCollectionTuple() {
Pipeline pipeline = TestPipeline.create();
List<Integer> inputs = Arrays.asList(3, -42, 666);
TupleTag<Integer> mainOutputTag = new TupleTag<Integer>("main") {};
TupleTag<Integer> emptyOutputTag = new TupleTag<Integer>("empty") {};
final TupleTag<Integer> sideOutputTag = new TupleTag<Integer>("side") {};
PCollection<Integer> mainInput = pipeline
.apply(Create.of(inputs));
PCollectionTuple outputs = mainInput.apply(ParDo
.of(new DoFn<Integer, Integer>() {
@Override
public void processElement(ProcessContext c) {
c.sideOutput(sideOutputTag, c.element());
}})
.withOutputTags(emptyOutputTag, TupleTagList.of(sideOutputTag)));
assertNotNull("outputs.getPipeline()", outputs.getPipeline());
outputs = outputs.and(mainOutputTag, mainInput);
PAssert.that(outputs.get(mainOutputTag)).containsInAnyOrder(inputs);
PAssert.that(outputs.get(sideOutputTag)).containsInAnyOrder(inputs);
PAssert.that(outputs.get(emptyOutputTag)).empty();
pipeline.run();
}
}
| {
"content_hash": "5faf9a1edb5799d3b37ff0537a52cab6",
"timestamp": "",
"source": "github",
"line_count": 78,
"max_line_length": 80,
"avg_line_length": 34.256410256410255,
"alnum_prop": 0.7398952095808383,
"repo_name": "tweise/incubator-beam",
"id": "9a8ab30be62eb2d09beea215f54876698219ed5e",
"size": "3477",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "sdks/java/core/src/test/java/org/apache/beam/sdk/values/PCollectionTupleTest.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Java",
"bytes": "7764249"
},
{
"name": "Protocol Buffer",
"bytes": "1407"
},
{
"name": "Shell",
"bytes": "4126"
}
],
"symlink_target": ""
} |
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>ieee754: Not compatible 👼</title>
<link rel="shortcut icon" type="image/png" href="../../../../../favicon.png" />
<link href="../../../../../bootstrap.min.css" rel="stylesheet">
<link href="../../../../../bootstrap-custom.css" rel="stylesheet">
<link href="//maxcdn.bootstrapcdn.com/font-awesome/4.2.0/css/font-awesome.min.css" rel="stylesheet">
<script src="../../../../../moment.min.js"></script>
<!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
<![endif]-->
</head>
<body>
<div class="container">
<div class="navbar navbar-default" role="navigation">
<div class="container-fluid">
<div class="navbar-header">
<a class="navbar-brand" href="../../../../.."><i class="fa fa-lg fa-flag-checkered"></i> Coq bench</a>
</div>
<div id="navbar" class="collapse navbar-collapse">
<ul class="nav navbar-nav">
<li><a href="../..">clean / released</a></li>
<li class="active"><a href="">8.7.1+1 / ieee754 - 8.8.0</a></li>
</ul>
</div>
</div>
</div>
<div class="article">
<div class="row">
<div class="col-md-12">
<a href="../..">« Up</a>
<h1>
ieee754
<small>
8.8.0
<span class="label label-info">Not compatible 👼</span>
</small>
</h1>
<p>📅 <em><script>document.write(moment("2022-11-10 23:24:19 +0000", "YYYY-MM-DD HH:mm:ss Z").fromNow());</script> (2022-11-10 23:24:19 UTC)</em><p>
<h2>Context</h2>
<pre># Packages matching: installed
# Name # Installed # Synopsis
base-bigarray base
base-num base Num library distributed with the OCaml compiler
base-ocamlbuild base OCamlbuild binary and libraries distributed with the OCaml compiler
base-threads base
base-unix base
camlp5 7.14 Preprocessor-pretty-printer of OCaml
conf-findutils 1 Virtual package relying on findutils
conf-perl 2 Virtual package relying on perl
coq 8.7.1+1 Formal proof management system
num 0 The Num library for arbitrary-precision integer and rational arithmetic
ocaml 4.02.3 The OCaml compiler (virtual package)
ocaml-base-compiler 4.02.3 Official 4.02.3 release
ocaml-config 1 OCaml Switch Configuration
ocamlfind 1.9.5 A library manager for OCaml
# opam file:
opam-version: "2.0"
maintainer: "[email protected]"
homepage: "https://github.com/coq-contribs/ieee754"
license: "LGPL 2.1"
build: [make "-j%{jobs}%"]
install: [make "install"]
remove: ["rm" "-R" "%{lib}%/coq/user-contrib/IEEE754"]
depends: [
"ocaml"
"coq" {>= "8.8" & < "8.9~"}
]
tags: [
"keyword: floating-point arithmetic"
"keyword: IEEE"
"category: Computer Science/Data Types and Data Structures"
"category: Computer Science/Semantics and Compilation/Semantics"
"date: 1997"
]
authors: [ "Patrick Loiseleur" ]
bug-reports: "https://github.com/coq-contribs/ieee754/issues"
dev-repo: "git+https://github.com/coq-contribs/ieee754.git"
synopsis: "A formalisation of the IEEE754 norm on floating-point arithmetic"
description: """
This library contains a non-verified implementation of
binary floating-point addition and multiplication operators inspired
by the IEEE-754 standard. It is today outdated.
See the attached 1997 report rapport-stage-dea.ps.gz for a discussion
(in French) of this work.
For the state of the art at the time of updating this notice, see
e.g. "Flocq: A Unified Library for Proving Floating-point Algorithms
in Coq" by S. Boldo and G. Melquiond, 2011."""
flags: light-uninstall
url {
src: "https://github.com/coq-contribs/ieee754/archive/v8.8.0.tar.gz"
checksum: "md5=88242efad7f91cd7e1f4edef34915567"
}
</pre>
<h2>Lint</h2>
<dl class="dl-horizontal">
<dt>Command</dt>
<dd><code>true</code></dd>
<dt>Return code</dt>
<dd>0</dd>
</dl>
<h2>Dry install 🏜️</h2>
<p>Dry install with the current Coq version:</p>
<dl class="dl-horizontal">
<dt>Command</dt>
<dd><code>opam install -y --show-action coq-ieee754.8.8.0 coq.8.7.1+1</code></dd>
<dt>Return code</dt>
<dd>5120</dd>
<dt>Output</dt>
<dd><pre>[NOTE] Package coq is already installed (current version is 8.7.1+1).
The following dependencies couldn't be met:
- coq-ieee754 -> coq >= 8.8 -> ocaml >= 4.05.0
base of this switch (use `--unlock-base' to force)
Your request can't be satisfied:
- No available version of coq satisfies the constraints
No solution found, exiting
</pre></dd>
</dl>
<p>Dry install without Coq/switch base, to test if the problem was incompatibility with the current Coq/OCaml version:</p>
<dl class="dl-horizontal">
<dt>Command</dt>
<dd><code>opam remove -y coq; opam install -y --show-action --unlock-base coq-ieee754.8.8.0</code></dd>
<dt>Return code</dt>
<dd>0</dd>
</dl>
<h2>Install dependencies</h2>
<dl class="dl-horizontal">
<dt>Command</dt>
<dd><code>true</code></dd>
<dt>Return code</dt>
<dd>0</dd>
<dt>Duration</dt>
<dd>0 s</dd>
</dl>
<h2>Install 🚀</h2>
<dl class="dl-horizontal">
<dt>Command</dt>
<dd><code>true</code></dd>
<dt>Return code</dt>
<dd>0</dd>
<dt>Duration</dt>
<dd>0 s</dd>
</dl>
<h2>Installation size</h2>
<p>No files were installed.</p>
<h2>Uninstall 🧹</h2>
<dl class="dl-horizontal">
<dt>Command</dt>
<dd><code>true</code></dd>
<dt>Return code</dt>
<dd>0</dd>
<dt>Missing removes</dt>
<dd>
none
</dd>
<dt>Wrong removes</dt>
<dd>
none
</dd>
</dl>
</div>
</div>
</div>
<hr/>
<div class="footer">
<p class="text-center">
Sources are on <a href="https://github.com/coq-bench">GitHub</a> © Guillaume Claret 🐣
</p>
</div>
</div>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<script src="../../../../../bootstrap.min.js"></script>
</body>
</html>
| {
"content_hash": "0ab5b8ec4bc3cd980f88c7b200962208",
"timestamp": "",
"source": "github",
"line_count": 180,
"max_line_length": 159,
"avg_line_length": 42.06666666666667,
"alnum_prop": 0.5600898045430533,
"repo_name": "coq-bench/coq-bench.github.io",
"id": "32685a28cc4ae0d6368a25996477b2f81afad26d",
"size": "7597",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "clean/Linux-x86_64-4.02.3-2.0.6/released/8.7.1+1/ieee754/8.8.0.html",
"mode": "33188",
"license": "mit",
"language": [],
"symlink_target": ""
} |
using namespace std;
// Context -----------------------------------------------------------------------------------------
void Context::Clear()
{
m_goldenMatching.clear();
m_actualMatching.clear();
m_foundResults.Clear();
m_foundResultsEdits.Clear();
m_nonFoundResults.clear();
m_nonFoundResultsEdits.Clear();
m_initialized = false;
}
search::Sample Context::MakeSample(search::FeatureLoader & loader) const
{
search::Sample outSample = m_sample;
if (!m_initialized)
return outSample;
auto const & foundEntries = m_foundResultsEdits.GetEntries();
auto const & nonFoundEntries = m_nonFoundResultsEdits.GetEntries();
auto & outResults = outSample.m_results;
outResults.clear();
CHECK_EQUAL(m_goldenMatching.size(), m_sample.m_results.size(), ());
CHECK_EQUAL(m_actualMatching.size(), foundEntries.size(), ());
CHECK_EQUAL(m_actualMatching.size(), m_foundResults.GetCount(), ());
// Iterates over original (loaded from the file with search samples)
// results first.
size_t k = 0;
for (size_t i = 0; i < m_sample.m_results.size(); ++i)
{
auto const j = m_goldenMatching[i];
if (j == search::Matcher::kInvalidId)
{
auto const & entry = nonFoundEntries[k++];
auto const deleted = entry.m_deleted;
auto const & curr = entry.m_curr;
if (!deleted && curr)
{
auto result = m_sample.m_results[i];
result.m_relevance = *curr;
outResults.push_back(result);
}
continue;
}
if (!foundEntries[j].m_curr)
continue;
auto result = m_sample.m_results[i];
result.m_relevance = *foundEntries[j].m_curr;
outResults.push_back(move(result));
}
// Iterates over results retrieved during assessment.
for (size_t i = 0; i < m_foundResults.GetCount(); ++i)
{
auto const j = m_actualMatching[i];
if (j != search::Matcher::kInvalidId)
{
// This result was processed by the loop above.
continue;
}
if (!foundEntries[i].m_curr)
continue;
auto const & result = m_foundResults[i];
// No need in non-feature results.
if (result.GetResultType() != search::Result::Type::Feature)
continue;
FeatureType ft;
CHECK(loader.Load(result.GetFeatureID(), ft), ());
outResults.push_back(search::Sample::Result::Build(ft, *foundEntries[i].m_curr));
}
return outSample;
}
void Context::ApplyEdits()
{
if (!m_initialized)
return;
m_foundResultsEdits.Apply();
m_nonFoundResultsEdits.Apply();
}
// ContextList -------------------------------------------------------------------------------------
ContextList::ContextList(OnUpdate onResultsUpdate, OnUpdate onNonFoundResultsUpdate)
: m_onResultsUpdate(onResultsUpdate)
, m_onNonFoundResultsUpdate(onNonFoundResultsUpdate)
{
}
void ContextList::Resize(size_t size)
{
size_t const oldSize = m_contexts.size();
for (size_t i = size; i < oldSize; ++i)
m_contexts[i].Clear();
if (size < m_contexts.size())
m_contexts.erase(m_contexts.begin() + size, m_contexts.end());
m_hasChanges.resize(size);
for (size_t i = oldSize; i < size; ++i)
{
m_contexts.emplace_back(
[this, i](Edits::Update const & update) {
OnContextUpdated(i);
if (m_onResultsUpdate)
m_onResultsUpdate(i, update);
},
[this, i](Edits::Update const & update) {
OnContextUpdated(i);
if (m_onNonFoundResultsUpdate)
m_onNonFoundResultsUpdate(i, update);
});
}
}
vector<search::Sample> ContextList::MakeSamples(search::FeatureLoader & loader) const
{
vector<search::Sample> samples;
for (auto const & context : m_contexts)
samples.push_back(context.MakeSample(loader));
return samples;
}
void ContextList::ApplyEdits()
{
for (auto & context : m_contexts)
context.ApplyEdits();
}
void ContextList::OnContextUpdated(size_t index)
{
if (!m_hasChanges[index] && m_contexts[index].HasChanges())
++m_numChanges;
if (m_hasChanges[index] && !m_contexts[index].HasChanges())
--m_numChanges;
m_hasChanges[index] = m_contexts[index].HasChanges();
}
| {
"content_hash": "4b6cad9af177ec43083ddb6f4e23be91",
"timestamp": "",
"source": "github",
"line_count": 153,
"max_line_length": 100,
"avg_line_length": 26.875816993464053,
"alnum_prop": 0.622568093385214,
"repo_name": "bykoianko/omim",
"id": "9507febd28d64fe084e5021f4786ad8b5c049fac",
"size": "4305",
"binary": false,
"copies": "3",
"ref": "refs/heads/master",
"path": "search/search_quality/assessment_tool/context.cpp",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Awk",
"bytes": "3962"
},
{
"name": "Batchfile",
"bytes": "5586"
},
{
"name": "C",
"bytes": "13970378"
},
{
"name": "C++",
"bytes": "147850479"
},
{
"name": "CMake",
"bytes": "242731"
},
{
"name": "CSS",
"bytes": "26798"
},
{
"name": "Common Lisp",
"bytes": "17521"
},
{
"name": "DIGITAL Command Language",
"bytes": "36710"
},
{
"name": "GLSL",
"bytes": "57179"
},
{
"name": "Gherkin",
"bytes": "305230"
},
{
"name": "Go",
"bytes": "12771"
},
{
"name": "HTML",
"bytes": "9503027"
},
{
"name": "Inno Setup",
"bytes": "4337"
},
{
"name": "Java",
"bytes": "2474269"
},
{
"name": "JavaScript",
"bytes": "29076"
},
{
"name": "Lua",
"bytes": "57672"
},
{
"name": "M4",
"bytes": "53992"
},
{
"name": "Makefile",
"bytes": "429637"
},
{
"name": "Metal",
"bytes": "77540"
},
{
"name": "Module Management System",
"bytes": "2080"
},
{
"name": "Objective-C",
"bytes": "2017649"
},
{
"name": "Objective-C++",
"bytes": "1337333"
},
{
"name": "PHP",
"bytes": "2841"
},
{
"name": "Perl",
"bytes": "57807"
},
{
"name": "PowerShell",
"bytes": "1885"
},
{
"name": "Python",
"bytes": "560198"
},
{
"name": "Roff",
"bytes": "13545"
},
{
"name": "Ruby",
"bytes": "66470"
},
{
"name": "Shell",
"bytes": "1318758"
},
{
"name": "Swift",
"bytes": "489000"
},
{
"name": "sed",
"bytes": "236"
}
],
"symlink_target": ""
} |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Skeddly.Model;
namespace Skeddly.Model
{
public class GetActionTypesResponse
{
public IEnumerable<ActionType> ActionTypes { get; set; }
}
}
| {
"content_hash": "bcccd9c75caa9222e32ac5fe06cddb4d",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 58,
"avg_line_length": 18.384615384615383,
"alnum_prop": 0.7740585774058577,
"repo_name": "eleven41/skeddly-sdk-net",
"id": "fd3ea59aefda50a23b8a275cc27fd36f76460977",
"size": "241",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "SkeddlySDK/Model/GetActionTypesResponse.cs",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C#",
"bytes": "269357"
}
],
"symlink_target": ""
} |
using System;
public class Enumerator {
int counter;
public Enumerator () {
counter = 3;
}
public bool MoveNext () {
return (counter -- > 0);
}
public char Current {
get {
return 'a';
}
}
}
class RealEnumerator : Enumerator, IDisposable {
Coll c;
public RealEnumerator (Coll c) {
this.c = c;
}
public void Dispose () {
c.disposed = true;
}
}
public class Coll {
public bool disposed;
public Enumerator GetEnumerator () {
return new RealEnumerator (this);
}
}
class Test {
public static int Main(String[] args)
{
Coll coll = new Coll ();
foreach (char c in coll) {
}
return (coll.disposed ? 0 : 1);
}
}
| {
"content_hash": "9078a8a178bb0840c7da7f472f71fe15",
"timestamp": "",
"source": "github",
"line_count": 53,
"max_line_length": 48,
"avg_line_length": 12.433962264150944,
"alnum_prop": 0.6236722306525038,
"repo_name": "afrog33k/SharpNative",
"id": "e33e525582eb067efe4098784f13e8a32bbfc768",
"size": "843",
"binary": false,
"copies": "4",
"ref": "refs/heads/master",
"path": "Tests/MonoTests/Basic/150-200/test-188.cs",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Batchfile",
"bytes": "5115"
},
{
"name": "C#",
"bytes": "2230817"
},
{
"name": "D",
"bytes": "611667"
},
{
"name": "HTML",
"bytes": "44255"
},
{
"name": "Smalltalk",
"bytes": "588"
}
],
"symlink_target": ""
} |
<?php
$this->layout('_layouts/default', [
'title' => '404 - Not found'
]);
/** @var string $msg */
/** @var \Ffcms\Templex\Template\Template $this */
if (\Ffcms\Core\Helper\Type\Str::likeEmpty($msg)) {
$msg = 'No error information available yet';
}
?>
<?php $this->start('body') ?>
<?= $this->bootstrap()->alert('warning', $msg); ?>
<?= $this->insert('_core/exceptions/_back') ?>
<?php $this->stop() ?> | {
"content_hash": "4e0400910f72723eec5bc93b13252f00",
"timestamp": "",
"source": "github",
"line_count": 21,
"max_line_length": 51,
"avg_line_length": 19.857142857142858,
"alnum_prop": 0.580335731414868,
"repo_name": "phpffcms/ffcms",
"id": "2e01b058656bfe87c4a1aa849f418bd9b82b59f3",
"size": "417",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "Apps/View/Front/default/_core/exceptions/notfound.php",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Batchfile",
"bytes": "964"
},
{
"name": "CSS",
"bytes": "210016"
},
{
"name": "Hack",
"bytes": "13"
},
{
"name": "JavaScript",
"bytes": "11839"
},
{
"name": "PHP",
"bytes": "1480696"
},
{
"name": "Shell",
"bytes": "44"
}
],
"symlink_target": ""
} |
This error indicates that the bindings in a match arm would require a value to
be moved into more than one location, thus violating unique ownership. Code
like the following is invalid as it requires the entire `Option<String>` to be
moved into a variable called `op_string` while simultaneously requiring the
inner `String` to be moved into a variable called `s`.
Erroneous code example:
```compile_fail,E0382
#![feature(bindings_after_at)]
let x = Some("s".to_string());
match x {
op_string @ Some(s) => {}, // error: use of moved value
None => {},
}
```
See also the error E0303.
| {
"content_hash": "6d85b61e62579e459d1ec82c4a2881ba",
"timestamp": "",
"source": "github",
"line_count": 20,
"max_line_length": 78,
"avg_line_length": 29.8,
"alnum_prop": 0.7197986577181208,
"repo_name": "graydon/rust",
"id": "2c22b86af9246045d7b7710c8860b46d9af2fdf5",
"size": "662",
"binary": false,
"copies": "17",
"ref": "refs/heads/master",
"path": "compiler/rustc_error_codes/src/error_codes/E0007.md",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "ANTLR",
"bytes": "4990"
},
{
"name": "Assembly",
"bytes": "20064"
},
{
"name": "Awk",
"bytes": "159"
},
{
"name": "Bison",
"bytes": "78848"
},
{
"name": "C",
"bytes": "725899"
},
{
"name": "C++",
"bytes": "55803"
},
{
"name": "CSS",
"bytes": "22181"
},
{
"name": "JavaScript",
"bytes": "36295"
},
{
"name": "LLVM",
"bytes": "1587"
},
{
"name": "Makefile",
"bytes": "227056"
},
{
"name": "Puppet",
"bytes": "16300"
},
{
"name": "Python",
"bytes": "142548"
},
{
"name": "RenderScript",
"bytes": "99815"
},
{
"name": "Rust",
"bytes": "18342682"
},
{
"name": "Shell",
"bytes": "269546"
},
{
"name": "TeX",
"bytes": "57"
}
],
"symlink_target": ""
} |
Subsets and Splits