code stringlengths 5 1.01M | repo_name stringlengths 5 84 | path stringlengths 4 311 | language stringclasses 30 values | license stringclasses 15 values | size int64 5 1.01M | input_ids listlengths 502 502 | token_type_ids listlengths 502 502 | attention_mask listlengths 502 502 | labels listlengths 502 502 |
|---|---|---|---|---|---|---|---|---|---|
# Hymenophyllum thuidium Harr. SPECIES
#### Status
ACCEPTED
#### According to
International Plant Names Index
#### Published in
null
#### Original name
null
### Remarks
null | mdoering/backbone | life/Plantae/Pteridophyta/Polypodiopsida/Hymenophyllales/Hymenophyllaceae/Hymenophyllum/Hymenophyllum thuidium/README.md | Markdown | apache-2.0 | 178 | [
30522,
1001,
1044,
25219,
3630,
21281,
20845,
16215,
21272,
5007,
5292,
12171,
1012,
2427,
1001,
1001,
1001,
1001,
3570,
3970,
1001,
1001,
1001,
1001,
2429,
2000,
2248,
3269,
3415,
5950,
1001,
1001,
1001,
1001,
2405,
1999,
19701,
1001,
1001... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
/*
* DO NOT EDIT. THIS FILE IS GENERATED FROM e:/builds/moz2_slave/rel-2.0-xr-w32-bld/build/dom/interfaces/html/nsIDOMHTMLMapElement.idl
*/
#ifndef __gen_nsIDOMHTMLMapElement_h__
#define __gen_nsIDOMHTMLMapElement_h__
#ifndef __gen_nsIDOMHTMLElement_h__
#include "nsIDOMHTMLElement.h"
#endif
/* For IDL files that don't want to include root IDL files. */
#ifndef NS_NO_VTABLE
#define NS_NO_VTABLE
#endif
/* starting interface: nsIDOMHTMLMapElement */
#define NS_IDOMHTMLMAPELEMENT_IID_STR "a6cf90af-15b3-11d2-932e-00805f8add32"
#define NS_IDOMHTMLMAPELEMENT_IID \
{0xa6cf90af, 0x15b3, 0x11d2, \
{ 0x93, 0x2e, 0x00, 0x80, 0x5f, 0x8a, 0xdd, 0x32 }}
/**
* The nsIDOMHTMLMapElement interface is the interface to a [X]HTML
* map element.
*
* This interface is trying to follow the DOM Level 2 HTML specification:
* http://www.w3.org/TR/DOM-Level-2-HTML/
*
* with changes from the work-in-progress WHATWG HTML specification:
* http://www.whatwg.org/specs/web-apps/current-work/
*/
class NS_NO_VTABLE NS_SCRIPTABLE nsIDOMHTMLMapElement : public nsIDOMHTMLElement {
public:
NS_DECLARE_STATIC_IID_ACCESSOR(NS_IDOMHTMLMAPELEMENT_IID)
/* readonly attribute nsIDOMHTMLCollection areas; */
NS_SCRIPTABLE NS_IMETHOD GetAreas(nsIDOMHTMLCollection **aAreas) = 0;
/* attribute DOMString name; */
NS_SCRIPTABLE NS_IMETHOD GetName(nsAString & aName) = 0;
NS_SCRIPTABLE NS_IMETHOD SetName(const nsAString & aName) = 0;
};
NS_DEFINE_STATIC_IID_ACCESSOR(nsIDOMHTMLMapElement, NS_IDOMHTMLMAPELEMENT_IID)
/* Use this macro when declaring classes that implement this interface. */
#define NS_DECL_NSIDOMHTMLMAPELEMENT \
NS_SCRIPTABLE NS_IMETHOD GetAreas(nsIDOMHTMLCollection **aAreas); \
NS_SCRIPTABLE NS_IMETHOD GetName(nsAString & aName); \
NS_SCRIPTABLE NS_IMETHOD SetName(const nsAString & aName);
/* Use this macro to declare functions that forward the behavior of this interface to another object. */
#define NS_FORWARD_NSIDOMHTMLMAPELEMENT(_to) \
NS_SCRIPTABLE NS_IMETHOD GetAreas(nsIDOMHTMLCollection **aAreas) { return _to GetAreas(aAreas); } \
NS_SCRIPTABLE NS_IMETHOD GetName(nsAString & aName) { return _to GetName(aName); } \
NS_SCRIPTABLE NS_IMETHOD SetName(const nsAString & aName) { return _to SetName(aName); }
/* Use this macro to declare functions that forward the behavior of this interface to another object in a safe way. */
#define NS_FORWARD_SAFE_NSIDOMHTMLMAPELEMENT(_to) \
NS_SCRIPTABLE NS_IMETHOD GetAreas(nsIDOMHTMLCollection **aAreas) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetAreas(aAreas); } \
NS_SCRIPTABLE NS_IMETHOD GetName(nsAString & aName) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetName(aName); } \
NS_SCRIPTABLE NS_IMETHOD SetName(const nsAString & aName) { return !_to ? NS_ERROR_NULL_POINTER : _to->SetName(aName); }
#if 0
/* Use the code below as a template for the implementation class for this interface. */
/* Header file */
class nsDOMHTMLMapElement : public nsIDOMHTMLMapElement
{
public:
NS_DECL_ISUPPORTS
NS_DECL_NSIDOMHTMLMAPELEMENT
nsDOMHTMLMapElement();
private:
~nsDOMHTMLMapElement();
protected:
/* additional members */
};
/* Implementation file */
NS_IMPL_ISUPPORTS1(nsDOMHTMLMapElement, nsIDOMHTMLMapElement)
nsDOMHTMLMapElement::nsDOMHTMLMapElement()
{
/* member initializers and constructor code */
}
nsDOMHTMLMapElement::~nsDOMHTMLMapElement()
{
/* destructor code */
}
/* readonly attribute nsIDOMHTMLCollection areas; */
NS_IMETHODIMP nsDOMHTMLMapElement::GetAreas(nsIDOMHTMLCollection **aAreas)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* attribute DOMString name; */
NS_IMETHODIMP nsDOMHTMLMapElement::GetName(nsAString & aName)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP nsDOMHTMLMapElement::SetName(const nsAString & aName)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* End of implementation class template. */
#endif
#endif /* __gen_nsIDOMHTMLMapElement_h__ */
| akiellor/selenium | third_party/gecko-2/win32/include/nsIDOMHTMLMapElement.h | C | apache-2.0 | 4,045 | [
30522,
1013,
1008,
1008,
2079,
2025,
10086,
1012,
2023,
5371,
2003,
7013,
2013,
1041,
1024,
1013,
16473,
1013,
9587,
2480,
2475,
1035,
6658,
1013,
2128,
2140,
1011,
1016,
1012,
1014,
1011,
1060,
2099,
1011,
1059,
16703,
1011,
1038,
6392,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
<?php
/**
* HassCMS (http://www.hassium.org/)
*
* @link http://github.com/hasscms for the canonical source repository
* @copyright Copyright (c) 2016-2099 Hassium Software LLC.
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
*/
namespace hass\backend\assets;
use yii\web\AssetBundle;
/**
*
* @package hass\package_name
* @author zhepama <zhepama@gmail.com>
* @since 0.1.0
*/
class IoniconsAsset extends AssetBundle
{
public $sourcePath = '@vendor/driftyco/ionicons';
public $css = [
'css/ionicons.min.css',
];
public $js = [
];
public $depends = [
];
} | hassiumsoft/hasscms-packages | hass-backend/assets/IoniconsAsset.php | PHP | gpl-3.0 | 630 | [
30522,
1026,
1029,
25718,
1013,
1008,
1008,
1008,
2038,
11020,
5244,
1006,
8299,
1024,
1013,
1013,
7479,
1012,
2038,
5332,
2819,
1012,
8917,
1013,
1007,
1008,
1008,
1030,
4957,
8299,
1024,
1013,
1013,
21025,
2705,
12083,
1012,
4012,
1013,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
/* Miscellaneous utilities for GIMPLE streaming. Things that are used
in both input and output are here.
Copyright (C) 2009-2015 Free Software Foundation, Inc.
Contributed by Doug Kwan <dougkwan@google.com>
This file is part of GCC.
GCC is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free
Software Foundation; either version 3, or (at your option) any later
version.
GCC is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with GCC; see the file COPYING3. If not see
<http://www.gnu.org/licenses/>. */
#include "config.h"
#include "system.h"
#include "coretypes.h"
#include "tm.h"
#include "toplev.h"
#include "flags.h"
#include "hash-set.h"
#include "machmode.h"
#include "vec.h"
#include "double-int.h"
#include "input.h"
#include "alias.h"
#include "symtab.h"
#include "wide-int.h"
#include "inchash.h"
#include "tree.h"
#include "fold-const.h"
#include "predict.h"
#include "hard-reg-set.h"
#include "input.h"
#include "function.h"
#include "basic-block.h"
#include "tree-ssa-alias.h"
#include "internal-fn.h"
#include "gimple-expr.h"
#include "is-a.h"
#include "gimple.h"
#include "bitmap.h"
#include "diagnostic-core.h"
#include "hash-map.h"
#include "plugin-api.h"
#include "ipa-ref.h"
#include "cgraph.h"
#include "tree-streamer.h"
#include "lto-streamer.h"
#include "lto-section-names.h"
#include "streamer-hooks.h"
/* Statistics gathered during LTO, WPA and LTRANS. */
struct lto_stats_d lto_stats;
/* LTO uses bitmaps with different life-times. So use a separate
obstack for all LTO bitmaps. */
static bitmap_obstack lto_obstack;
static bool lto_obstack_initialized;
const char *section_name_prefix = LTO_SECTION_NAME_PREFIX;
/* Set when streaming LTO for offloading compiler. */
bool lto_stream_offload_p;
/* Return a string representing LTO tag TAG. */
const char *
lto_tag_name (enum LTO_tags tag)
{
if (lto_tag_is_tree_code_p (tag))
{
/* For tags representing tree nodes, return the name of the
associated tree code. */
return get_tree_code_name (lto_tag_to_tree_code (tag));
}
if (lto_tag_is_gimple_code_p (tag))
{
/* For tags representing gimple statements, return the name of
the associated gimple code. */
return gimple_code_name[lto_tag_to_gimple_code (tag)];
}
switch (tag)
{
case LTO_null:
return "LTO_null";
case LTO_bb0:
return "LTO_bb0";
case LTO_bb1:
return "LTO_bb1";
case LTO_eh_region:
return "LTO_eh_region";
case LTO_function:
return "LTO_function";
case LTO_eh_table:
return "LTO_eh_table";
case LTO_ert_cleanup:
return "LTO_ert_cleanup";
case LTO_ert_try:
return "LTO_ert_try";
case LTO_ert_allowed_exceptions:
return "LTO_ert_allowed_exceptions";
case LTO_ert_must_not_throw:
return "LTO_ert_must_not_throw";
case LTO_tree_pickle_reference:
return "LTO_tree_pickle_reference";
case LTO_field_decl_ref:
return "LTO_field_decl_ref";
case LTO_function_decl_ref:
return "LTO_function_decl_ref";
case LTO_label_decl_ref:
return "LTO_label_decl_ref";
case LTO_namespace_decl_ref:
return "LTO_namespace_decl_ref";
case LTO_result_decl_ref:
return "LTO_result_decl_ref";
case LTO_ssa_name_ref:
return "LTO_ssa_name_ref";
case LTO_type_decl_ref:
return "LTO_type_decl_ref";
case LTO_type_ref:
return "LTO_type_ref";
case LTO_global_decl_ref:
return "LTO_global_decl_ref";
default:
return "LTO_UNKNOWN";
}
}
/* Allocate a bitmap from heap. Initializes the LTO obstack if necessary. */
bitmap
lto_bitmap_alloc (void)
{
if (!lto_obstack_initialized)
{
bitmap_obstack_initialize (<o_obstack);
lto_obstack_initialized = true;
}
return BITMAP_ALLOC (<o_obstack);
}
/* Free bitmap B. */
void
lto_bitmap_free (bitmap b)
{
BITMAP_FREE (b);
}
/* Get a section name for a particular type or name. The NAME field
is only used if SECTION_TYPE is LTO_section_function_body. For all
others it is ignored. The callee of this function is responsible
to free the returned name. */
char *
lto_get_section_name (int section_type, const char *name, struct lto_file_decl_data *f)
{
const char *add;
char post[32];
const char *sep;
if (section_type == LTO_section_function_body)
{
gcc_assert (name != NULL);
if (name[0] == '*')
name++;
add = name;
sep = "";
}
else if (section_type < LTO_N_SECTION_TYPES)
{
add = lto_section_name[section_type];
sep = ".";
}
else
internal_error ("bytecode stream: unexpected LTO section %s", name);
/* Make the section name unique so that ld -r combining sections
doesn't confuse the reader with merged sections.
For options don't add a ID, the option reader cannot deal with them
and merging should be ok here. */
if (section_type == LTO_section_opts)
strcpy (post, "");
else if (f != NULL)
sprintf (post, "." HOST_WIDE_INT_PRINT_HEX_PURE, f->id);
else
sprintf (post, "." HOST_WIDE_INT_PRINT_HEX_PURE, get_random_seed (false));
return concat (section_name_prefix, sep, add, post, NULL);
}
/* Show various memory usage statistics related to LTO. */
void
print_lto_report (const char *s)
{
unsigned i;
fprintf (stderr, "[%s] # of input files: "
HOST_WIDE_INT_PRINT_UNSIGNED "\n", s, lto_stats.num_input_files);
fprintf (stderr, "[%s] # of input cgraph nodes: "
HOST_WIDE_INT_PRINT_UNSIGNED "\n", s,
lto_stats.num_input_cgraph_nodes);
fprintf (stderr, "[%s] # of function bodies: "
HOST_WIDE_INT_PRINT_UNSIGNED "\n", s,
lto_stats.num_function_bodies);
for (i = 0; i < NUM_TREE_CODES; i++)
if (lto_stats.num_trees[i])
fprintf (stderr, "[%s] # of '%s' objects read: "
HOST_WIDE_INT_PRINT_UNSIGNED "\n", s,
get_tree_code_name ((enum tree_code) i), lto_stats.num_trees[i]);
if (flag_lto)
{
fprintf (stderr, "[%s] Compression: "
HOST_WIDE_INT_PRINT_UNSIGNED " output bytes, "
HOST_WIDE_INT_PRINT_UNSIGNED " compressed bytes", s,
lto_stats.num_output_il_bytes,
lto_stats.num_compressed_il_bytes);
if (lto_stats.num_output_il_bytes > 0)
{
const float dividend = (float) lto_stats.num_compressed_il_bytes;
const float divisor = (float) lto_stats.num_output_il_bytes;
fprintf (stderr, " (ratio: %f)", dividend / divisor);
}
fprintf (stderr, "\n");
}
if (flag_wpa)
{
fprintf (stderr, "[%s] # of output files: "
HOST_WIDE_INT_PRINT_UNSIGNED "\n", s,
lto_stats.num_output_files);
fprintf (stderr, "[%s] # of output symtab nodes: "
HOST_WIDE_INT_PRINT_UNSIGNED "\n", s,
lto_stats.num_output_symtab_nodes);
fprintf (stderr, "[%s] # of output tree pickle references: "
HOST_WIDE_INT_PRINT_UNSIGNED "\n", s,
lto_stats.num_pickle_refs_output);
fprintf (stderr, "[%s] # of output tree bodies: "
HOST_WIDE_INT_PRINT_UNSIGNED "\n", s,
lto_stats.num_tree_bodies_output);
fprintf (stderr, "[%s] # callgraph partitions: "
HOST_WIDE_INT_PRINT_UNSIGNED "\n", s,
lto_stats.num_cgraph_partitions);
fprintf (stderr, "[%s] Compression: "
HOST_WIDE_INT_PRINT_UNSIGNED " input bytes, "
HOST_WIDE_INT_PRINT_UNSIGNED " uncompressed bytes", s,
lto_stats.num_input_il_bytes,
lto_stats.num_uncompressed_il_bytes);
if (lto_stats.num_input_il_bytes > 0)
{
const float dividend = (float) lto_stats.num_uncompressed_il_bytes;
const float divisor = (float) lto_stats.num_input_il_bytes;
fprintf (stderr, " (ratio: %f)", dividend / divisor);
}
fprintf (stderr, "\n");
}
for (i = 0; i < LTO_N_SECTION_TYPES; i++)
fprintf (stderr, "[%s] Size of mmap'd section %s: "
HOST_WIDE_INT_PRINT_UNSIGNED " bytes\n", s,
lto_section_name[i], lto_stats.section_size[i]);
}
#ifdef LTO_STREAMER_DEBUG
struct tree_hash_entry
{
tree key;
intptr_t value;
};
struct tree_entry_hasher : typed_noop_remove <tree_hash_entry>
{
typedef tree_hash_entry value_type;
typedef tree_hash_entry compare_type;
static inline hashval_t hash (const value_type *);
static inline bool equal (const value_type *, const compare_type *);
};
inline hashval_t
tree_entry_hasher::hash (const value_type *e)
{
return htab_hash_pointer (e->key);
}
inline bool
tree_entry_hasher::equal (const value_type *e1, const compare_type *e2)
{
return (e1->key == e2->key);
}
static hash_table<tree_hash_entry> *tree_htab;
#endif
/* Initialization common to the LTO reader and writer. */
void
lto_streamer_init (void)
{
/* Check that all the TS_* handled by the reader and writer routines
match exactly the structures defined in treestruct.def. When a
new TS_* astructure is added, the streamer should be updated to
handle it. */
streamer_check_handled_ts_structures ();
#ifdef LTO_STREAMER_DEBUG
tree_htab = new hash_table<tree_hash_entry> (31);
#endif
}
/* Gate function for all LTO streaming passes. */
bool
gate_lto_out (void)
{
return ((flag_generate_lto || flag_generate_offload || in_lto_p)
/* Don't bother doing anything if the program has errors. */
&& !seen_error ());
}
#ifdef LTO_STREAMER_DEBUG
/* Add a mapping between T and ORIG_T, which is the numeric value of
the original address of T as it was seen by the LTO writer. This
mapping is useful when debugging streaming problems. A debugging
session can be started on both reader and writer using ORIG_T
as a breakpoint value in both sessions.
Note that this mapping is transient and only valid while T is
being reconstructed. Once T is fully built, the mapping is
removed. */
void
lto_orig_address_map (tree t, intptr_t orig_t)
{
struct tree_hash_entry ent;
struct tree_hash_entry **slot;
ent.key = t;
ent.value = orig_t;
slot = tree_htab->find_slot (&ent, INSERT);
gcc_assert (!*slot);
*slot = XNEW (struct tree_hash_entry);
**slot = ent;
}
/* Get the original address of T as it was seen by the writer. This
is only valid while T is being reconstructed. */
intptr_t
lto_orig_address_get (tree t)
{
struct tree_hash_entry ent;
struct tree_hash_entry **slot;
ent.key = t;
slot = tree_htab->find_slot (&ent, NO_INSERT);
return (slot ? (*slot)->value : 0);
}
/* Clear the mapping of T to its original address. */
void
lto_orig_address_remove (tree t)
{
struct tree_hash_entry ent;
struct tree_hash_entry **slot;
ent.key = t;
slot = tree_htab->find_slot (&ent, NO_INSERT);
gcc_assert (slot);
free (*slot);
tree_htab->clear_slot (slot);
}
#endif
/* Check that the version MAJOR.MINOR is the correct version number. */
void
lto_check_version (int major, int minor)
{
if (major != LTO_major_version || minor != LTO_minor_version)
fatal_error ("bytecode stream generated with LTO version %d.%d instead "
"of the expected %d.%d",
major, minor,
LTO_major_version, LTO_minor_version);
}
/* Initialize all the streamer hooks used for streaming GIMPLE. */
void
lto_streamer_hooks_init (void)
{
streamer_hooks_init ();
streamer_hooks.write_tree = lto_output_tree;
streamer_hooks.read_tree = lto_input_tree;
streamer_hooks.input_location = lto_input_location;
streamer_hooks.output_location = lto_output_location;
}
| kito-cheng/gcc | gcc/lto-streamer.c | C | gpl-2.0 | 11,719 | [
30522,
1013,
1008,
25408,
16548,
2005,
21025,
23344,
11058,
1012,
2477,
2008,
2024,
2109,
1999,
2119,
7953,
1998,
6434,
2024,
2182,
1012,
9385,
1006,
1039,
1007,
2268,
1011,
2325,
2489,
4007,
3192,
1010,
4297,
1012,
5201,
2011,
8788,
27741,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
<!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"/>
<title>QXmpp: QXmppClientExtension Class Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javaScript" src="search/search.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css"/>
</head>
<body onload='searchBox.OnSelectItem(0);'>
<!-- Generated by Doxygen 1.7.1 -->
<script type="text/javascript"><!--
var searchBox = new SearchBox("searchBox", "search",false,'Search');
--></script>
<div class="navigation" id="top">
<div class="tabs">
<ul class="tablist">
<li><a href="index.html"><span>Main Page</span></a></li>
<li><a href="modules.html"><span>Modules</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 id="searchli">
<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 class="tabs2">
<ul class="tablist">
<li><a href="annotated.html"><span>Class List</span></a></li>
<li><a href="hierarchy.html"><span>Class Hierarchy</span></a></li>
<li><a href="functions.html"><span>Class Members</span></a></li>
</ul>
</div>
</div>
<div class="header">
<div class="summary">
<a href="#pub-methods">Public Member Functions</a> |
<a href="#pro-methods">Protected Member Functions</a> |
<a href="#friends">Friends</a> </div>
<div class="headertitle">
<h1>QXmppClientExtension Class Reference<br/>
<small>
[<a class="el" href="group__Core.html">Core</a>]</small>
</h1> </div>
</div>
<div class="contents">
<!-- doxytag: class="QXmppClientExtension" --><!-- doxytag: inherits="QXmppLoggable" -->
<p>The <a class="el" href="classQXmppClientExtension.html" title="The QXmppClientExtension class is the base class for QXmppClient extensions.">QXmppClientExtension</a> class is the base class for <a class="el" href="classQXmppClient.html" title="The QXmppClient class is the main class for using QXmpp.">QXmppClient</a> extensions.
<a href="#_details">More...</a></p>
<p><code>#include <<a class="el" href="QXmppClientExtension_8h_source.html">QXmppClientExtension.h</a>></code></p>
<div class="dynheader">
Inheritance diagram for QXmppClientExtension:</div>
<div class="dyncontent">
<div class="center">
<img src="classQXmppClientExtension.png" usemap="#QXmppClientExtension_map" alt=""/>
<map id="QXmppClientExtension_map" name="QXmppClientExtension_map">
<area href="classQXmppLoggable.html" alt="QXmppLoggable" shape="rect" coords="0,0,163,24"/>
<area href="classQXmppArchiveManager.html" alt="QXmppArchiveManager" shape="rect" coords="173,112,336,136"/>
<area href="classQXmppCallManager.html" alt="QXmppCallManager" shape="rect" coords="173,168,336,192"/>
<area href="classQXmppDiscoveryManager.html" alt="QXmppDiscoveryManager" shape="rect" coords="173,224,336,248"/>
<area href="classQXmppEntityTimeManager.html" alt="QXmppEntityTimeManager" shape="rect" coords="173,280,336,304"/>
<area href="classQXmppMucManager.html" alt="QXmppMucManager" shape="rect" coords="173,336,336,360"/>
<area href="classQXmppRosterManager.html" alt="QXmppRosterManager" shape="rect" coords="173,392,336,416"/>
<area href="classQXmppRpcManager.html" alt="QXmppRpcManager" shape="rect" coords="173,448,336,472"/>
<area href="classQXmppTransferManager.html" alt="QXmppTransferManager" shape="rect" coords="173,504,336,528"/>
<area href="classQXmppVCardManager.html" alt="QXmppVCardManager" shape="rect" coords="173,560,336,584"/>
<area href="classQXmppVersionManager.html" alt="QXmppVersionManager" shape="rect" coords="173,616,336,640"/>
</map>
</div>
<p><a href="classQXmppClientExtension-members.html">List of all members.</a></p>
<table class="memberdecls">
<tr><td colspan="2"><h2><a name="pub-methods"></a>
Public Member Functions</h2></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"> </td><td class="memItemRight" valign="bottom"><a class="el" href="classQXmppClientExtension.html#aec299452688f50431f1028668186e3ec">QXmppClientExtension</a> ()</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">virtual </td><td class="memItemRight" valign="bottom"><a class="el" href="classQXmppClientExtension.html#aea624caf2d98d86307c08ed89bd7bc02">~QXmppClientExtension</a> ()</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">virtual QStringList </td><td class="memItemRight" valign="bottom"><a class="el" href="classQXmppClientExtension.html#a3b041abac6b95f5c1614ed1cb87163f4">discoveryFeatures</a> () const </td></tr>
<tr><td class="memItemLeft" align="right" valign="top">virtual QList<br class="typebreak"/>
< QXmppDiscoveryIq::Identity > </td><td class="memItemRight" valign="bottom"><a class="el" href="classQXmppClientExtension.html#a9acf0693520c93ddc60c4994ffe09343">discoveryIdentities</a> () const </td></tr>
<tr><td class="memItemLeft" align="right" valign="top">virtual bool </td><td class="memItemRight" valign="bottom"><a class="el" href="classQXmppClientExtension.html#af026d292204dc538249d16086e9e8108">handleStanza</a> (const QDomElement &stanza)=0</td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">You need to implement this method to process incoming XMPP stanzas. <a href="#af026d292204dc538249d16086e9e8108"></a><br/></td></tr>
<tr><td colspan="2"><h2><a name="pro-methods"></a>
Protected Member Functions</h2></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="el" href="classQXmppClient.html">QXmppClient</a> * </td><td class="memItemRight" valign="bottom"><a class="el" href="classQXmppClientExtension.html#a2476cb1a20963d15d45d39f24a0c1198">client</a> ()</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">virtual void </td><td class="memItemRight" valign="bottom"><a class="el" href="classQXmppClientExtension.html#a166f42a22447341abb26bd9c44c97590">setClient</a> (<a class="el" href="classQXmppClient.html">QXmppClient</a> *client)</td></tr>
<tr><td colspan="2"><h2><a name="friends"></a>
Friends</h2></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="aea43b485a5760f5b2a52b00f1088cc90"></a><!-- doxytag: member="QXmppClientExtension::QXmppClient" ref="aea43b485a5760f5b2a52b00f1088cc90" args="" -->
class </td><td class="memItemRight" valign="bottom"><a class="el" href="classQXmppClientExtension.html#aea43b485a5760f5b2a52b00f1088cc90">QXmppClient</a></td></tr>
</table>
<hr/><a name="_details"></a><h2>Detailed Description</h2>
<p>The <a class="el" href="classQXmppClientExtension.html" title="The QXmppClientExtension class is the base class for QXmppClient extensions.">QXmppClientExtension</a> class is the base class for <a class="el" href="classQXmppClient.html" title="The QXmppClient class is the main class for using QXmpp.">QXmppClient</a> extensions. </p>
<p>If you want to extend <a class="el" href="classQXmppClient.html" title="The QXmppClient class is the main class for using QXmpp.">QXmppClient</a>, for instance to support an IQ type which is not natively supported, you can subclass <a class="el" href="classQXmppClientExtension.html" title="The QXmppClientExtension class is the base class for QXmppClient extensions.">QXmppClientExtension</a> and implement <a class="el" href="classQXmppClientExtension.html#af026d292204dc538249d16086e9e8108" title="You need to implement this method to process incoming XMPP stanzas.">handleStanza()</a>. You can then add your extension to the client instance using <a class="el" href="classQXmppClient.html#a61ccf1c37ca3f26bfd14e65c8ecf1740">QXmppClient::addExtension()</a>. </p>
<hr/><h2>Constructor & Destructor Documentation</h2>
<a class="anchor" id="aec299452688f50431f1028668186e3ec"></a><!-- doxytag: member="QXmppClientExtension::QXmppClientExtension" ref="aec299452688f50431f1028668186e3ec" args="()" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">QXmppClientExtension::QXmppClientExtension </td>
<td>(</td>
<td class="paramname"></td>
<td> ) </td>
<td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Constructs a <a class="el" href="classQXmppClient.html" title="The QXmppClient class is the main class for using QXmpp.">QXmppClient</a> extension. </p>
</div>
</div>
<a class="anchor" id="aea624caf2d98d86307c08ed89bd7bc02"></a><!-- doxytag: member="QXmppClientExtension::~QXmppClientExtension" ref="aea624caf2d98d86307c08ed89bd7bc02" args="()" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">QXmppClientExtension::~QXmppClientExtension </td>
<td>(</td>
<td class="paramname"></td>
<td> ) </td>
<td><code> [virtual]</code></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Destroys a <a class="el" href="classQXmppClient.html" title="The QXmppClient class is the main class for using QXmpp.">QXmppClient</a> extension. </p>
</div>
</div>
<hr/><h2>Member Function Documentation</h2>
<a class="anchor" id="a2476cb1a20963d15d45d39f24a0c1198"></a><!-- doxytag: member="QXmppClientExtension::client" ref="a2476cb1a20963d15d45d39f24a0c1198" args="()" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="classQXmppClient.html">QXmppClient</a> * QXmppClientExtension::client </td>
<td>(</td>
<td class="paramname"></td>
<td> ) </td>
<td><code> [protected]</code></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Returns the client which loaded this extension. </p>
</div>
</div>
<a class="anchor" id="a3b041abac6b95f5c1614ed1cb87163f4"></a><!-- doxytag: member="QXmppClientExtension::discoveryFeatures" ref="a3b041abac6b95f5c1614ed1cb87163f4" args="() const " -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">QStringList QXmppClientExtension::discoveryFeatures </td>
<td>(</td>
<td class="paramname"></td>
<td> ) </td>
<td> const<code> [virtual]</code></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Returns the discovery features to add to the client. </p>
</div>
</div>
<a class="anchor" id="a9acf0693520c93ddc60c4994ffe09343"></a><!-- doxytag: member="QXmppClientExtension::discoveryIdentities" ref="a9acf0693520c93ddc60c4994ffe09343" args="() const " -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">QList< QXmppDiscoveryIq::Identity > QXmppClientExtension::discoveryIdentities </td>
<td>(</td>
<td class="paramname"></td>
<td> ) </td>
<td> const<code> [virtual]</code></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Returns the discovery identities to add to the client. </p>
</div>
</div>
<a class="anchor" id="af026d292204dc538249d16086e9e8108"></a><!-- doxytag: member="QXmppClientExtension::handleStanza" ref="af026d292204dc538249d16086e9e8108" args="(const QDomElement &stanza)=0" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">virtual bool QXmppClientExtension::handleStanza </td>
<td>(</td>
<td class="paramtype">const QDomElement & </td>
<td class="paramname"> <em>stanza</em></td>
<td> ) </td>
<td><code> [pure virtual]</code></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>You need to implement this method to process incoming XMPP stanzas. </p>
<p>You should return true if the stanza was handled and no further processing should occur, or false to let other extensions process the stanza. </p>
</div>
</div>
<a class="anchor" id="a166f42a22447341abb26bd9c44c97590"></a><!-- doxytag: member="QXmppClientExtension::setClient" ref="a166f42a22447341abb26bd9c44c97590" args="(QXmppClient *client)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void QXmppClientExtension::setClient </td>
<td>(</td>
<td class="paramtype"><a class="el" href="classQXmppClient.html">QXmppClient</a> * </td>
<td class="paramname"> <em>client</em></td>
<td> ) </td>
<td><code> [protected, virtual]</code></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Sets the client which loaded this extension.</p>
<dl><dt><b>Parameters:</b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td valign="top"></td><td valign="top"><em>client</em> </td><td></td></tr>
</table>
</dd>
</dl>
</div>
</div>
<hr/>The documentation for this class was generated from the following files:<ul>
<li><a class="el" href="QXmppClientExtension_8h_source.html">QXmppClientExtension.h</a></li>
<li>QXmppClientExtension.cpp</li>
</ul>
</div>
<!--- window showing the filter options -->
<div id="MSearchSelectWindow"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
onkeydown="return searchBox.OnSearchSelectKey(event)">
<a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(0)"><span class="SelectionMark"> </span>All</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(1)"><span class="SelectionMark"> </span>Classes</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(2)"><span class="SelectionMark"> </span>Functions</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(3)"><span class="SelectionMark"> </span>Enumerations</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(4)"><span class="SelectionMark"> </span>Enumerator</a></div>
<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="" frameborder="0"
name="MSearchResults" id="MSearchResults">
</iframe>
</div>
<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.7.1 </small></address>
</body>
</html>
| fredix/geekast | src/externals/qxmpp-0.3.0/doc/html/classQXmppClientExtension.html | HTML | gpl-3.0 | 15,542 | [
30522,
1026,
999,
9986,
13874,
16129,
2270,
1000,
1011,
1013,
1013,
1059,
2509,
2278,
1013,
1013,
26718,
2094,
1060,
11039,
19968,
1015,
1012,
1014,
17459,
1013,
1013,
4372,
1000,
1000,
8299,
1024,
1013,
1013,
7479,
1012,
1059,
2509,
1012,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
#ifndef CPU_H
#define CPU_H
#include "Type.h"
#include "memory.h"
#include "stages.h"
class cpu_core
{
public:
cpu_core();
~cpu_core();
void run();
word PC = 0;
memory mem;
word reg[32];
IFS ifs;
IDS ids;
EXS exs;
MYS mys;
WBS wbs;
};
#endif /* CPU_H */
| zmj1316/MIPS-Simulator | src/cpu.h | C | mit | 298 | [
30522,
1001,
2065,
13629,
2546,
17368,
1035,
1044,
1001,
9375,
17368,
1035,
1044,
1001,
2421,
1000,
2828,
1012,
1044,
1000,
1001,
2421,
1000,
3638,
1012,
1044,
1000,
1001,
2421,
1000,
5711,
1012,
1044,
1000,
2465,
17368,
1035,
4563,
1063,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
#
# Author:: Johannes Krude
# Copyright:: (c) Johannes Krude 2009
# License:: AGPL3
#
#--
# This file is part of filehosting.
#
# filehosting is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# filehosting is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with filehosting. If not, see <http://www.gnu.org/licenses/>.
#++
#
require "filehosting/datasource"
require "filehosting/samplefileinfo"
module FileHosting
# Sample DataSource generates Sample FileInfo's
class SampleDataSource < DataSource
def search_tags(tags, rule= nil)
(1..rand(6)).collect { |x| SampleFileInfo.new }
end
def fileinfo(uuid)
res= SampleFileInfo.new
res.uuid= uuid
res
end
end
end
| johannesk/filehosting | lib/filehosting/sampledatasource.rb | Ruby | agpl-3.0 | 1,149 | [
30522,
1001,
1001,
3166,
1024,
1024,
12470,
1047,
28121,
2063,
1001,
9385,
1024,
1024,
1006,
1039,
1007,
12470,
1047,
28121,
2063,
2268,
1001,
6105,
1024,
1024,
12943,
24759,
2509,
1001,
1001,
1011,
1011,
1001,
2023,
5371,
2003,
2112,
1997,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
///**
// * ClassName: MainTest.java
// * Date: 2017年5月16日
// */
//package com.ojdbc.sql.test;
//
//import java.sql.Connection;
//import java.sql.SQLException;
//
//import com.ojdbc.sql.ConnectionObject;
//import com.ojdbc.sql.DataBase;
//import com.ojdbc.sql.DataBaseEnum;
//import com.ojdbc.sql.DataBaseManager;
//import com.ojdbc.sql.SQLResultSet;
//import com.ojdbc.sql.connection.MongoDataBaseConnection;
//import com.ojdbc.sql.connection.MySQLDataBaseConnection;
//import com.ojdbc.sql.connection.OracleDataBaseConnection;
//import com.ojdbc.sql.connection.SQLiteDataBaseConnection;
//
///**
// * Author: ShaoGaige
// * Description: 猪测试类
// * Log:
// */
//public class MainTest {
//
// /**
// * @param args
// * @throws SQLException
// */
// public static void main(String[] args) throws SQLException {
// // TODO Auto-generated method stub
// ConnectionObject conn;
//
// SQLiteDataBaseConnection sqlite = new SQLiteDataBaseConnection();
// String dataBaseURL = "jdbc:sqlite://E:/shaogaige/iNote/iNoteRun/data/iNoteData.note";
// String userName = "";
// String passWord = "";
// conn = sqlite.createConnection(dataBaseURL, userName, passWord);
// System.out.println(conn.getMetaData().getURL());
//
// DataBase database = new DataBase(conn);
// SQLResultSet rs =database.exeSQLSelect("select * from noteinfo");
// System.out.println(rs.getRowNum());
//
// MongoDataBaseConnection mongo = new MongoDataBaseConnection();
// dataBaseURL = "jdbc:mongo://172.15.103.42:10001/geoglobe";
// userName = "data";
// passWord = "data";
// conn = mongo.createConnection(dataBaseURL, userName, passWord);
// System.out.println(conn.getMetaData().getURL());
//
// MySQLDataBaseConnection mysql = new MySQLDataBaseConnection();
// dataBaseURL = "jdbc:mysql://172.15.103.42:3306/geoglobe";
// userName = "root";
// passWord = "root";
// conn = mysql.createConnection(dataBaseURL, userName, passWord);
// System.out.println(conn.getMetaData().getURL());
//
// OracleDataBaseConnection oracle = new OracleDataBaseConnection();
// dataBaseURL = "jdbc:oracle:thin:@172.15.103.43:1521:geoglobe";
// userName = "autotest";
// passWord = "autotest";
// conn = oracle.createConnection(dataBaseURL, userName, passWord);
// System.out.println(conn.getMetaData().getURL());
//
// DataBaseManager.getDataBase(DataBaseEnum.ORACLE, "", "", "");
// }
//
//}
| shaogaige/iDataBaseConnection | src/com/ojdbc/sql/test/MainTest.java | Java | gpl-2.0 | 2,468 | [
30522,
1013,
1013,
1013,
1008,
1008,
1013,
1013,
1008,
2465,
18442,
1024,
2364,
22199,
1012,
9262,
1013,
1013,
1008,
3058,
1024,
2418,
1840,
1019,
1872,
2385,
1864,
1013,
1013,
1008,
1013,
1013,
1013,
7427,
4012,
1012,
1051,
3501,
18939,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
// OpenCppCoverage is an open source code coverage for C++.
// Copyright (C) 2016 OpenCppCoverage
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
namespace OpenCppCoverage.VSPackage
{
class DynamicVCConfiguration
{
//---------------------------------------------------------------------
public DynamicVCConfiguration(dynamic configuration)
{
this.configuration_ = configuration;
this.DebugSettings = new DynamicVCDebugSettings(configuration_.DebugSettings);
var compilerTool = GetTool(configuration, "VCCLCompilerTool");
if (compilerTool != null)
this.OptionalVCCLCompilerTool = new DynamicVCCLCompilerTool(compilerTool);
}
//---------------------------------------------------------------------
static dynamic GetTool(dynamic configuration, string toolKindToFind)
{
foreach (dynamic tool in configuration.Tools)
{
if (tool.ToolKind == toolKindToFind)
return tool;
}
return null;
}
//---------------------------------------------------------------------
public string ConfigurationName
{
get
{
return configuration_.ConfigurationName;
}
}
//---------------------------------------------------------------------
public string PlatformName
{
get
{
return configuration_.Platform.Name;
}
}
//---------------------------------------------------------------------
public string Evaluate(string str)
{
return configuration_.Evaluate(str);
}
//---------------------------------------------------------------------
public DynamicVCDebugSettings DebugSettings { get; }
//---------------------------------------------------------------------
public DynamicVCCLCompilerTool OptionalVCCLCompilerTool { get; }
//---------------------------------------------------------------------
public string PrimaryOutput
{
get
{
return configuration_.PrimaryOutput;
}
}
readonly dynamic configuration_;
}
}
| OpenCppCoverage/OpenCppCoveragePlugin | VSPackage/DynamicVCConfiguration.cs | C# | gpl-3.0 | 2,941 | [
30522,
1013,
1013,
2330,
21906,
15042,
7840,
4270,
2003,
2019,
2330,
3120,
3642,
6325,
2005,
1039,
1009,
1009,
1012,
1013,
1013,
9385,
1006,
1039,
1007,
2355,
2330,
21906,
15042,
7840,
4270,
1013,
1013,
1013,
1013,
2023,
2565,
2003,
2489,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
/*
* Copyright 2012-2014 the original author or authors.
*
* 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.
*/
package org.springframework.boot.autoconfigure.security;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.UUID;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.core.Ordered;
import org.springframework.security.config.http.SessionCreationPolicy;
import org.springframework.util.StringUtils;
/**
* Properties for the security aspects of an application.
*
* @author Dave Syer
*/
@ConfigurationProperties(prefix = "security", ignoreUnknownFields = false)
public class SecurityProperties implements SecurityPrerequisite {
/**
* Order before the basic authentication access control provided by Boot. This is a
* useful place to put user-defined access rules if you want to override the default
* access rules.
*/
public static final int ACCESS_OVERRIDE_ORDER = SecurityProperties.BASIC_AUTH_ORDER - 2;
/**
* Order applied to the WebSecurityConfigurerAdapter that is used to configure basic
* authentication for application endpoints. If you want to add your own
* authentication for all or some of those endpoints the best thing to do is add your
* own WebSecurityConfigurerAdapter with lower order.
*/
public static final int BASIC_AUTH_ORDER = Ordered.LOWEST_PRECEDENCE - 5;
/**
* Order applied to the WebSecurityConfigurer that ignores standard static resource
* paths.
*/
public static final int IGNORED_ORDER = Ordered.HIGHEST_PRECEDENCE;
/**
* The default order of Spring Security's Filter
*/
public static final int DEFAULT_FILTER_ORDER = 0;
/**
* Enable secure channel for all requests.
*/
private boolean requireSsl;
/**
* Enable Cross Site Request Forgery support.
*/
// Flip this when session creation is disabled by default
private boolean enableCsrf = false;
private Basic basic = new Basic();
private final Headers headers = new Headers();
/**
* Session creation policy (always, never, if_required, stateless).
*/
private SessionCreationPolicy sessions = SessionCreationPolicy.STATELESS;
/**
* Comma-separated list of paths to exclude from the default secured paths.
*/
private List<String> ignored = new ArrayList<String>();
private final User user = new User();
/**
* Security filter chain order.
*/
private int filterOrder = DEFAULT_FILTER_ORDER;
public Headers getHeaders() {
return this.headers;
}
public User getUser() {
return this.user;
}
public SessionCreationPolicy getSessions() {
return this.sessions;
}
public void setSessions(SessionCreationPolicy sessions) {
this.sessions = sessions;
}
public Basic getBasic() {
return this.basic;
}
public void setBasic(Basic basic) {
this.basic = basic;
}
public boolean isRequireSsl() {
return this.requireSsl;
}
public void setRequireSsl(boolean requireSsl) {
this.requireSsl = requireSsl;
}
public boolean isEnableCsrf() {
return this.enableCsrf;
}
public void setEnableCsrf(boolean enableCsrf) {
this.enableCsrf = enableCsrf;
}
public void setIgnored(List<String> ignored) {
this.ignored = new ArrayList<String>(ignored);
}
public List<String> getIgnored() {
return this.ignored;
}
public int getFilterOrder() {
return this.filterOrder;
}
public void setFilterOrder(int filterOrder) {
this.filterOrder = filterOrder;
}
public static class Headers {
public static enum HSTS {
NONE, DOMAIN, ALL
}
/**
* Enable cross site scripting (XSS) protection.
*/
private boolean xss;
/**
* Enable cache control HTTP headers.
*/
private boolean cache;
/**
* Enable "X-Frame-Options" header.
*/
private boolean frame;
/**
* Enable "X-Content-Type-Options" header.
*/
private boolean contentType;
/**
* HTTP Strict Transport Security (HSTS) mode (none, domain, all).
*/
private HSTS hsts = HSTS.ALL;
public boolean isXss() {
return this.xss;
}
public void setXss(boolean xss) {
this.xss = xss;
}
public boolean isCache() {
return this.cache;
}
public void setCache(boolean cache) {
this.cache = cache;
}
public boolean isFrame() {
return this.frame;
}
public void setFrame(boolean frame) {
this.frame = frame;
}
public boolean isContentType() {
return this.contentType;
}
public void setContentType(boolean contentType) {
this.contentType = contentType;
}
public HSTS getHsts() {
return this.hsts;
}
public void setHsts(HSTS hsts) {
this.hsts = hsts;
}
}
public static class Basic {
/**
* Enable basic authentication.
*/
private boolean enabled = true;
/**
* HTTP basic realm name.
*/
private String realm = "Spring";
/**
* Comma-separated list of paths to secure.
*/
private String[] path = new String[] { "/**" };
public boolean isEnabled() {
return this.enabled;
}
public void setEnabled(boolean enabled) {
this.enabled = enabled;
}
public String getRealm() {
return this.realm;
}
public void setRealm(String realm) {
this.realm = realm;
}
public String[] getPath() {
return this.path;
}
public void setPath(String... paths) {
this.path = paths;
}
}
public static class User {
/**
* Default user name.
*/
private String name = "user";
/**
* Password for the default user name.
*/
private String password = UUID.randomUUID().toString();
/**
* Granted roles for the default user name.
*/
private List<String> role = new ArrayList<String>(Arrays.asList("USER"));
private boolean defaultPassword = true;
public String getName() {
return this.name;
}
public void setName(String name) {
this.name = name;
}
public String getPassword() {
return this.password;
}
public void setPassword(String password) {
if (password.startsWith("${") && password.endsWith("}")
|| !StringUtils.hasLength(password)) {
return;
}
this.defaultPassword = false;
this.password = password;
}
public List<String> getRole() {
return this.role;
}
public void setRole(List<String> role) {
this.role = new ArrayList<String>(role);
}
public boolean isDefaultPassword() {
return this.defaultPassword;
}
}
}
| 10045125/spring-boot | spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/security/SecurityProperties.java | Java | apache-2.0 | 6,846 | [
30522,
1013,
1008,
1008,
9385,
2262,
1011,
2297,
1996,
2434,
3166,
2030,
6048,
1012,
1008,
1008,
7000,
2104,
1996,
15895,
6105,
1010,
2544,
1016,
1012,
1014,
1006,
1996,
1000,
6105,
1000,
1007,
1025,
1008,
2017,
2089,
2025,
2224,
2023,
53... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
//===--- MiscDiagnostics.cpp - AST-Level Diagnostics ----------------------===//
//
// This source file is part of the Swift.org open source project
//
// Copyright (c) 2014 - 2018 Apple Inc. and the Swift project authors
// Licensed under Apache License v2.0 with Runtime Library Exception
//
// See https://swift.org/LICENSE.txt for license information
// See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
//
//===----------------------------------------------------------------------===//
//
// This file implements AST-level diagnostics.
//
//===----------------------------------------------------------------------===//
#include "MiscDiagnostics.h"
#include "TypeChecker.h"
#include "TypeCheckAvailability.h"
#include "swift/AST/ASTWalker.h"
#include "swift/AST/NameLookup.h"
#include "swift/AST/Pattern.h"
#include "swift/Basic/Defer.h"
#include "swift/Basic/SourceManager.h"
#include "swift/Basic/StringExtras.h"
#include "swift/Parse/Lexer.h"
#include "swift/Parse/Parser.h"
#include "llvm/ADT/MapVector.h"
#include "llvm/ADT/StringSwitch.h"
#include "llvm/Support/SaveAndRestore.h"
using namespace swift;
/// Return true if this expression is an implicit promotion from T to T?.
static Expr *isImplicitPromotionToOptional(Expr *E) {
if (E->isImplicit())
if (auto IIOE = dyn_cast<InjectIntoOptionalExpr>(
E->getSemanticsProvidingExpr()))
return IIOE->getSubExpr();
return nullptr;
}
/// Diagnose syntactic restrictions of expressions.
///
/// - Module values may only occur as part of qualification.
/// - Metatype names cannot generally be used as values: they need a "T.self"
/// qualification unless used in narrow case (e.g. T() for construction).
/// - '_' may only exist on the LHS of an assignment expression.
/// - warn_unqualified_access values must not be accessed except via qualified
/// lookup.
/// - Partial application of some decls isn't allowed due to implementation
/// limitations.
/// - "&" (aka InOutExpressions) may only exist directly in function call
/// argument lists.
/// - 'self.init' and 'super.init' cannot be wrapped in a larger expression
/// or statement.
/// - Warn about promotions to optional in specific syntactic forms.
/// - Error about collection literals that default to Any collections in
/// invalid positions.
///
static void diagSyntacticUseRestrictions(TypeChecker &TC, const Expr *E,
const DeclContext *DC,
bool isExprStmt) {
class DiagnoseWalker : public ASTWalker {
SmallPtrSet<Expr*, 4> AlreadyDiagnosedMetatypes;
SmallPtrSet<DeclRefExpr*, 4> AlreadyDiagnosedNoEscapes;
SmallPtrSet<DeclRefExpr*, 4> AlreadyDiagnosedBitCasts;
// Keep track of acceptable DiscardAssignmentExpr's.
SmallPtrSet<DiscardAssignmentExpr*, 2> CorrectDiscardAssignmentExprs;
/// Keep track of InOutExprs
SmallPtrSet<InOutExpr*, 2> AcceptableInOutExprs;
/// Keep track of the arguments to CallExprs.
SmallPtrSet<Expr *, 2> CallArgs;
bool IsExprStmt;
public:
TypeChecker &TC;
const DeclContext *DC;
DiagnoseWalker(TypeChecker &TC, const DeclContext *DC, bool isExprStmt)
: IsExprStmt(isExprStmt), TC(TC), DC(DC) {}
// Selector for the partial_application_of_function_invalid diagnostic
// message.
struct PartialApplication {
enum : unsigned {
MutatingMethod,
SuperInit,
SelfInit,
};
enum : unsigned {
Error,
CompatibilityWarning,
};
unsigned compatibilityWarning: 1;
unsigned kind : 2;
unsigned level : 29;
};
// Partial applications of functions that are not permitted. This is
// tracked in post-order and unraveled as subsequent applications complete
// the call (or not).
llvm::SmallDenseMap<Expr*, PartialApplication,2> InvalidPartialApplications;
~DiagnoseWalker() override {
for (auto &unapplied : InvalidPartialApplications) {
unsigned kind = unapplied.second.kind;
if (unapplied.second.compatibilityWarning) {
TC.diagnose(unapplied.first->getLoc(),
diag::partial_application_of_function_invalid_swift4,
kind);
} else {
TC.diagnose(unapplied.first->getLoc(),
diag::partial_application_of_function_invalid,
kind);
}
}
}
/// methods are fully applied when they can't support partial application.
void checkInvalidPartialApplication(Expr *E) {
if (auto AE = dyn_cast<ApplyExpr>(E)) {
Expr *fnExpr = AE->getSemanticFn();
if (auto forceExpr = dyn_cast<ForceValueExpr>(fnExpr))
fnExpr = forceExpr->getSubExpr()->getSemanticsProvidingExpr();
if (auto dotSyntaxExpr = dyn_cast<DotSyntaxBaseIgnoredExpr>(fnExpr))
fnExpr = dotSyntaxExpr->getRHS();
// Check to see if this is a potentially unsupported partial
// application of a constructor delegation.
if (isa<OtherConstructorDeclRefExpr>(fnExpr)) {
auto kind = AE->getArg()->isSuperExpr()
? PartialApplication::SuperInit
: PartialApplication::SelfInit;
// Partial applications of delegated initializers aren't allowed, and
// don't really make sense to begin with.
InvalidPartialApplications.insert(
{E, {PartialApplication::Error, kind, 1}});
return;
}
// If this is adding a level to an active partial application, advance
// it to the next level.
auto foundApplication = InvalidPartialApplications.find(fnExpr);
if (foundApplication == InvalidPartialApplications.end())
return;
unsigned level = foundApplication->second.level;
auto kind = foundApplication->second.kind;
assert(level > 0);
InvalidPartialApplications.erase(foundApplication);
if (level > 1) {
// We have remaining argument clauses.
// Partial applications were always diagnosed in Swift 4 and before,
// so there's no need to preserve the compatibility warning bit.
InvalidPartialApplications.insert(
{AE, {PartialApplication::Error, kind, level - 1}});
}
return;
}
/// If this is a reference to a mutating method, it cannot be partially
/// applied or even referenced without full application, so arrange for
/// us to check that it gets fully applied.
auto fnDeclRef = dyn_cast<DeclRefExpr>(E);
if (!fnDeclRef)
return;
auto fn = dyn_cast<FuncDecl>(fnDeclRef->getDecl());
if (!fn || !fn->isInstanceMember() || !fn->isMutating())
return;
// Swift 4 and earlier failed to diagnose a reference to a mutating method
// without any applications at all, which would get miscompiled into a
// function with undefined behavior. Warn for source compatibility.
auto errorBehavior = TC.Context.LangOpts.isSwiftVersionAtLeast(5)
? PartialApplication::Error
: PartialApplication::CompatibilityWarning;
InvalidPartialApplications.insert(
{fnDeclRef, {errorBehavior,
PartialApplication::MutatingMethod, 2}});
}
// Not interested in going outside a basic expression.
std::pair<bool, Stmt *> walkToStmtPre(Stmt *S) override {
return { false, S };
}
std::pair<bool, Pattern*> walkToPatternPre(Pattern *P) override {
return { false, P };
}
bool walkToDeclPre(Decl *D) override { return false; }
bool walkToTypeReprPre(TypeRepr *T) override { return true; }
std::pair<bool, Expr *> walkToExprPre(Expr *E) override {
// See through implicit conversions of the expression. We want to be able
// to associate the parent of this expression with the ultimate callee.
auto Base = E;
while (auto Conv = dyn_cast<ImplicitConversionExpr>(Base))
Base = Conv->getSubExpr();
// Record call arguments.
if (auto Call = dyn_cast<CallExpr>(Base))
CallArgs.insert(Call->getArg());
if (auto *DRE = dyn_cast<DeclRefExpr>(Base)) {
// Verify metatype uses.
if (isa<TypeDecl>(DRE->getDecl())) {
if (isa<ModuleDecl>(DRE->getDecl()))
checkUseOfModule(DRE);
else
checkUseOfMetaTypeName(Base);
}
// Verify noescape parameter uses.
checkNoEscapeParameterUse(DRE, Parent.getAsExpr(), OperandKind::None);
// Verify warn_unqualified_access uses.
checkUnqualifiedAccessUse(DRE);
// Verify that special decls are eliminated.
checkForDeclWithSpecialTypeCheckingSemantics(DRE);
// Verify that `unsafeBitCast` isn't misused.
checkForSuspiciousBitCasts(DRE, nullptr);
}
if (auto *MRE = dyn_cast<MemberRefExpr>(Base)) {
if (isa<TypeDecl>(MRE->getMember().getDecl()))
checkUseOfMetaTypeName(Base);
}
if (isa<TypeExpr>(Base))
checkUseOfMetaTypeName(Base);
if (auto *SE = dyn_cast<SubscriptExpr>(E)) {
// Implicit InOutExpr's are allowed in the base of a subscript expr.
if (auto *IOE = dyn_cast<InOutExpr>(SE->getBase()))
if (IOE->isImplicit())
AcceptableInOutExprs.insert(IOE);
visitIndices(SE, [&](unsigned argIndex, Expr *arg) {
arg = lookThroughArgument(arg);
if (auto *DRE = dyn_cast<DeclRefExpr>(arg))
checkNoEscapeParameterUse(DRE, SE, OperandKind::Argument);
});
}
if (auto *AE = dyn_cast<CollectionExpr>(E)) {
visitCollectionElements(AE, [&](unsigned argIndex, Expr *arg) {
arg = lookThroughArgument(arg);
if (auto *DRE = dyn_cast<DeclRefExpr>(arg))
checkNoEscapeParameterUse(DRE, AE, OperandKind::Argument);
});
}
// Check decl refs in withoutActuallyEscaping blocks.
if (auto MakeEsc = dyn_cast<MakeTemporarilyEscapableExpr>(E)) {
if (auto DRE =
dyn_cast<DeclRefExpr>(MakeEsc->getNonescapingClosureValue()))
checkNoEscapeParameterUse(DRE, MakeEsc, OperandKind::MakeEscapable);
}
// Check function calls, looking through implicit conversions on the
// function and inspecting the arguments directly.
if (auto *Call = dyn_cast<ApplyExpr>(E)) {
// Warn about surprising implicit optional promotions.
checkOptionalPromotions(Call);
// Check the callee, looking through implicit conversions.
auto base = Call->getFn();
unsigned uncurryLevel = 0;
while (auto conv = dyn_cast<ImplicitConversionExpr>(base))
base = conv->getSubExpr();
const auto findDynamicMemberRefExpr =
[](Expr *e) -> DynamicMemberRefExpr* {
if (auto open = dyn_cast<OpenExistentialExpr>(e)) {
return dyn_cast<DynamicMemberRefExpr>(open->getSubExpr());
}
return nullptr;
};
if (auto force = dyn_cast<ForceValueExpr>(base)) {
if (auto ref = findDynamicMemberRefExpr(force->getSubExpr()))
base = ref;
} else if (auto bind = dyn_cast<BindOptionalExpr>(base)) {
if (auto ref = findDynamicMemberRefExpr(bind->getSubExpr()))
base = ref;
}
while (auto ignoredBase = dyn_cast<DotSyntaxBaseIgnoredExpr>(base))
base = ignoredBase->getRHS();
ConcreteDeclRef callee;
if (auto *calleeDRE = dyn_cast<DeclRefExpr>(base)) {
checkNoEscapeParameterUse(calleeDRE, Call, OperandKind::Callee);
checkForSuspiciousBitCasts(calleeDRE, Call);
callee = calleeDRE->getDeclRef();
// Otherwise, try to drill down through member calls for the purposes
// of argument-matching code below.
} else if (auto selfApply = dyn_cast<SelfApplyExpr>(base)) {
uncurryLevel++;
base = selfApply->getSemanticFn();
if (auto calleeDRE = dyn_cast<DeclRefExpr>(base))
callee = calleeDRE->getDeclRef();
// Otherwise, check for a dynamic member.
} else if (auto dynamicMRE = dyn_cast<DynamicMemberRefExpr>(base)) {
uncurryLevel++;
callee = dynamicMRE->getMember();
}
visitArguments(Call, [&](unsigned argIndex, Expr *arg) {
// InOutExpr's are allowed in argument lists directly.
if (auto *IOE = dyn_cast<InOutExpr>(arg)) {
if (isa<CallExpr>(Call))
AcceptableInOutExprs.insert(IOE);
}
// InOutExprs can be wrapped in some implicit casts.
Expr *unwrapped = arg;
if (auto *IIO = dyn_cast<InjectIntoOptionalExpr>(arg))
unwrapped = IIO->getSubExpr();
if (isa<InOutToPointerExpr>(unwrapped) ||
isa<ArrayToPointerExpr>(unwrapped) ||
isa<ErasureExpr>(unwrapped)) {
auto operand =
cast<ImplicitConversionExpr>(unwrapped)->getSubExpr();
if (auto *IOE = dyn_cast<InOutExpr>(operand)) {
AcceptableInOutExprs.insert(IOE);
operand = IOE->getSubExpr();
}
// Also do some additional work based on how the function uses
// the argument.
if (callee) {
checkConvertedPointerArgument(callee, uncurryLevel, argIndex,
unwrapped, operand);
}
}
// Also give special treatment to noescape function arguments.
arg = lookThroughArgument(arg);
if (auto *DRE = dyn_cast<DeclRefExpr>(arg))
checkNoEscapeParameterUse(DRE, Call, OperandKind::Argument);
});
}
// If we have an assignment expression, scout ahead for acceptable _'s.
if (auto *AE = dyn_cast<AssignExpr>(E))
markAcceptableDiscardExprs(AE->getDest());
/// Diagnose a '_' that isn't on the immediate LHS of an assignment.
if (auto *DAE = dyn_cast<DiscardAssignmentExpr>(E)) {
if (!CorrectDiscardAssignmentExprs.count(DAE) &&
!DAE->getType()->hasError())
TC.diagnose(DAE->getLoc(), diag::discard_expr_outside_of_assignment);
}
// Diagnose an '&' that isn't in an argument lists.
if (auto *IOE = dyn_cast<InOutExpr>(E)) {
if (!IOE->isImplicit() && !AcceptableInOutExprs.count(IOE) &&
!IOE->getType()->hasError())
TC.diagnose(IOE->getLoc(), diag::inout_expr_outside_of_call)
.highlight(IOE->getSubExpr()->getSourceRange());
}
// Diagnose 'self.init' or 'super.init' nested in another expression
// or closure.
if (auto *rebindSelfExpr = dyn_cast<RebindSelfInConstructorExpr>(E)) {
if (!Parent.isNull() || !IsExprStmt || DC->getParent()->isLocalContext()) {
bool isChainToSuper;
(void)rebindSelfExpr->getCalledConstructor(isChainToSuper);
TC.diagnose(E->getLoc(), diag::init_delegation_nested,
isChainToSuper, !IsExprStmt);
}
}
return { true, E };
}
/// Visit the argument/s represented by either a ParenExpr or TupleExpr,
/// unshuffling if needed. If any other kind of expression, will pass it
/// straight back.
static void argExprVisitArguments(Expr* arg,
llvm::function_ref
<void(unsigned, Expr*)> fn) {
// The argument could be shuffled if it includes default arguments,
// label differences, or other exciting things like that.
if (auto *TSE = dyn_cast<TupleShuffleExpr>(arg))
arg = TSE->getSubExpr();
// The argument is either a ParenExpr or TupleExpr.
if (auto *TE = dyn_cast<TupleExpr>(arg)) {
auto elts = TE->getElements();
for (auto i : indices(elts))
fn(i, elts[i]);
} else if (auto *PE = dyn_cast<ParenExpr>(arg)) {
fn(0, PE->getSubExpr());
} else {
fn(0, arg);
}
}
static void visitIndices(SubscriptExpr *subscript,
llvm::function_ref<void(unsigned, Expr*)> fn) {
auto *indexArgs = subscript->getIndex();
argExprVisitArguments(indexArgs, fn);
}
static void visitArguments(ApplyExpr *apply,
llvm::function_ref<void(unsigned, Expr*)> fn) {
auto *arg = apply->getArg();
argExprVisitArguments(arg, fn);
}
static void visitCollectionElements(CollectionExpr *collection,
llvm::function_ref<void(unsigned, Expr*)> fn) {
auto elts = collection->getElements();
for (auto i : indices(elts))
fn(i, elts[i]);
}
static Expr *lookThroughArgument(Expr *arg) {
while (1) {
if (auto conv = dyn_cast<ImplicitConversionExpr>(arg))
arg = conv->getSubExpr();
else if (auto *PE = dyn_cast<ParenExpr>(arg))
arg = PE->getSubExpr();
else
break;
}
return arg;
}
Expr *walkToExprPost(Expr *E) override {
checkInvalidPartialApplication(E);
return E;
}
void checkConvertedPointerArgument(ConcreteDeclRef callee,
unsigned uncurryLevel,
unsigned argIndex,
Expr *pointerExpr,
Expr *storage) {
if (!isPointerIdentityArgument(callee, uncurryLevel, argIndex))
return;
// Flag that the argument is non-accessing.
if (auto inout = dyn_cast<InOutToPointerExpr>(pointerExpr)) {
inout->setNonAccessing(true);
} else if (auto array = dyn_cast<ArrayToPointerExpr>(pointerExpr)) {
array->setNonAccessing(true);
}
// TODO: warn if taking the address of 'storage' will definitely
// yield a temporary address.
}
/// Is the given call argument, known to be of pointer type, just used
/// for its pointer identity?
bool isPointerIdentityArgument(ConcreteDeclRef ref, unsigned uncurryLevel,
unsigned argIndex) {
// FIXME: derive this from an attribute instead of hacking it based
// on the target name!
auto decl = ref.getDecl();
// Assume that == and != are non-accessing uses.
if (decl->isOperator()) {
auto op = decl->getBaseName();
if (op == "==" || op == "!=")
return true;
return false;
}
// NSObject.addObserver(_:forKeyPath:options:context:)
if (uncurryLevel == 1 && argIndex == 3) {
return decl->getFullName().isCompoundName("addObserver",
{ "", "forKeyPath",
"options", "context" });
}
// NSObject.removeObserver(_:forKeyPath:context:)
if (uncurryLevel == 1 && argIndex == 2) {
return decl->getFullName().isCompoundName("removeObserver",
{ "", "forKeyPath",
"context" });
}
return false;
}
/// We have a collection literal with a defaulted type, e.g. of [Any]. Emit
/// an error if it was inferred to this type in an invalid context, which is
/// one in which the parent expression is not itself a collection literal.
void checkTypeDefaultedCollectionExpr(CollectionExpr *c) {
// If the parent is a non-expression, or is not itself a literal, then
// produce an error with a fixit to add the type as an explicit
// annotation.
if (c->getNumElements() == 0)
TC.diagnose(c->getLoc(), diag::collection_literal_empty)
.highlight(c->getSourceRange());
else {
TC.diagnose(c->getLoc(), diag::collection_literal_heterogeneous,
c->getType())
.highlight(c->getSourceRange())
.fixItInsertAfter(c->getEndLoc(), " as " + c->getType()->getString());
}
}
/// Scout out the specified destination of an AssignExpr to recursively
/// identify DiscardAssignmentExpr in legal places. We can only allow them
/// in simple pattern-like expressions, so we reject anything complex here.
void markAcceptableDiscardExprs(Expr *E) {
if (!E) return;
if (auto *PE = dyn_cast<ParenExpr>(E))
return markAcceptableDiscardExprs(PE->getSubExpr());
if (auto *TE = dyn_cast<TupleExpr>(E)) {
for (auto &elt : TE->getElements())
markAcceptableDiscardExprs(elt);
return;
}
if (auto *DAE = dyn_cast<DiscardAssignmentExpr>(E))
CorrectDiscardAssignmentExprs.insert(DAE);
// Otherwise, we can't support this.
}
void checkUseOfModule(DeclRefExpr *E) {
// Allow module values as a part of:
// - ignored base expressions;
// - expressions that failed to type check.
if (auto *ParentExpr = Parent.getAsExpr()) {
if (isa<DotSyntaxBaseIgnoredExpr>(ParentExpr) ||
isa<UnresolvedDotExpr>(ParentExpr))
return;
}
TC.diagnose(E->getStartLoc(), diag::value_of_module_type);
}
class NoEscapeArgument {
llvm::PointerIntPair<ParamDecl*, 1, bool> ParamAndIsCapture;
public:
NoEscapeArgument() {}
NoEscapeArgument(ParamDecl *param, bool isCapture)
: ParamAndIsCapture(param, isCapture) {
assert(param);
}
explicit operator bool() const {
return ParamAndIsCapture.getPointer() != nullptr;
}
ParamDecl *getDecl() const { return ParamAndIsCapture.getPointer(); }
bool isDeclACapture() const { return ParamAndIsCapture.getInt(); }
static NoEscapeArgument find(TypeChecker &tc, ValueDecl *decl,
bool isCapture) {
if (auto param = dyn_cast<ParamDecl>(decl)) {
if (auto fnType =
param->getInterfaceType()->getAs<AnyFunctionType>()) {
if (fnType->isNoEscape())
return { param, isCapture };
}
return {};
}
if (auto fn = dyn_cast<AbstractFunctionDecl>(decl)) {
if (fn->getDeclContext()->isLocalContext()) {
return findInCaptures(tc, fn);
}
return {};
}
// FIXME: captures of computed local vars? Can these be non-escaping?
return {};
}
static NoEscapeArgument findInCaptures(TypeChecker &tc,
AnyFunctionRef fn) {
// Ensure we have accurate capture information for the function.
tc.computeCaptures(fn);
for (const auto &capture : fn.getCaptureInfo().getCaptures()) {
if (capture.isDynamicSelfMetadata()) continue;
if (auto param = find(tc, capture.getDecl(), true))
return param;
}
return {};
}
};
/// Enforce the exclusivity rule against calling a non-escaping
/// function parameter with another non-escaping function parameter
/// as an argument.
void checkNoEscapeParameterCall(ApplyExpr *apply) {
NoEscapeArgument noescapeArgument;
Expr *problematicArg = nullptr;
visitArguments(apply, [&](unsigned argIndex, Expr *arg) {
// Just find the first problematic argument.
if (noescapeArgument) return;
// Remember the expression which used the argument.
problematicArg = arg;
// Look through the same set of nodes that we look through when
// checking for no-escape functions.
arg = lookThroughArgument(arg);
// If the argument isn't noescape, ignore it.
auto fnType = arg->getType()->getAs<AnyFunctionType>();
if (!fnType || !fnType->isNoEscape())
return;
// Okay, it should be a closure or a decl ref.
if (auto declRef = dyn_cast<DeclRefExpr>(arg)) {
noescapeArgument =
NoEscapeArgument::find(TC, declRef->getDecl(), false);
} else if (auto closure = dyn_cast<AbstractClosureExpr>(arg)) {
noescapeArgument =
NoEscapeArgument::findInCaptures(TC, closure);
} else {
// This can happen with withoutActuallyEscaping.
assert(isa<OpaqueValueExpr>(arg) &&
"unexpected expression yielding noescape closure");
}
});
if (!noescapeArgument) return;
TC.diagnose(apply->getLoc(),
diag::err_noescape_param_call,
noescapeArgument.getDecl()->getName(),
noescapeArgument.isDeclACapture())
.highlight(problematicArg->getSourceRange());
}
enum class OperandKind {
None,
Callee,
Argument,
MakeEscapable,
};
/// The DRE argument is a reference to a noescape parameter. Verify that
/// its uses are ok.
void checkNoEscapeParameterUse(DeclRefExpr *DRE, Expr *parent,
OperandKind useKind) {
// This only cares about declarations of noescape function type.
auto AFT = DRE->getDecl()->getInterfaceType()->getAs<AnyFunctionType>();
if (!AFT || !AFT->isNoEscape())
return;
// Only diagnose this once. If we check and accept this use higher up in
// the AST, don't recheck here.
if (!AlreadyDiagnosedNoEscapes.insert(DRE).second)
return;
// The only valid use of the noescape parameter is an immediate call,
// either as the callee or as an argument (in which case, the typechecker
// validates that the noescape bit didn't get stripped off), or as
// a special case, e.g. in the binding of a withoutActuallyEscaping block
// or the argument of a type(of: ...).
if (parent) {
if (auto apply = dyn_cast<ApplyExpr>(parent)) {
if (isa<ParamDecl>(DRE->getDecl()) && useKind == OperandKind::Callee)
checkNoEscapeParameterCall(apply);
return;
} else if (isa<SubscriptExpr>(parent)
&& useKind == OperandKind::Argument) {
return;
} else if (isa<MakeTemporarilyEscapableExpr>(parent)) {
return;
} else if (isa<DynamicTypeExpr>(parent)) {
return;
}
}
TC.diagnose(DRE->getStartLoc(), diag::invalid_noescape_use,
cast<VarDecl>(DRE->getDecl())->getName(),
isa<ParamDecl>(DRE->getDecl()));
// If we're a parameter, emit a helpful fixit to add @escaping
auto paramDecl = dyn_cast<ParamDecl>(DRE->getDecl());
if (paramDecl) {
TC.diagnose(paramDecl->getStartLoc(), diag::noescape_parameter,
paramDecl->getName())
.fixItInsert(paramDecl->getTypeLoc().getSourceRange().Start,
"@escaping ");
}
}
// Diagnose metatype values that don't appear as part of a property,
// method, or constructor reference.
void checkUseOfMetaTypeName(Expr *E) {
// If we've already checked this at a higher level, we're done.
if (!AlreadyDiagnosedMetatypes.insert(E).second)
return;
// Allow references to types as a part of:
// - member references T.foo, T.Type, T.self, etc.
// - constructor calls T()
if (auto *ParentExpr = Parent.getAsExpr()) {
// This is an exhaustive list of the accepted syntactic forms.
if (isa<ErrorExpr>(ParentExpr) ||
isa<DotSelfExpr>(ParentExpr) || // T.self
isa<CallExpr>(ParentExpr) || // T()
isa<MemberRefExpr>(ParentExpr) || // T.foo
isa<UnresolvedMemberExpr>(ParentExpr) ||
isa<SelfApplyExpr>(ParentExpr) || // T.foo() T()
isa<UnresolvedDotExpr>(ParentExpr) ||
isa<DotSyntaxBaseIgnoredExpr>(ParentExpr) ||
isa<UnresolvedSpecializeExpr>(ParentExpr) ||
isa<OpenExistentialExpr>(ParentExpr)) {
return;
}
}
// Is this a protocol metatype?
TC.diagnose(E->getStartLoc(), diag::value_of_metatype_type);
// Add fix-it to insert '()', only if this is a metatype of
// non-existential type and has any initializers.
bool isExistential = false;
if (auto metaTy = E->getType()->getAs<MetatypeType>()) {
auto instanceTy = metaTy->getInstanceType();
isExistential = instanceTy->isExistentialType();
if (!isExistential &&
instanceTy->mayHaveMembers() &&
!TC.lookupConstructors(const_cast<DeclContext *>(DC),
instanceTy).empty()) {
TC.diagnose(E->getEndLoc(), diag::add_parens_to_type)
.fixItInsertAfter(E->getEndLoc(), "()");
}
}
// Add fix-it to insert ".self".
auto diag = TC.diagnose(E->getEndLoc(), diag::add_self_to_type);
if (E->canAppendPostfixExpression()) {
diag.fixItInsertAfter(E->getEndLoc(), ".self");
} else {
diag.fixItInsert(E->getStartLoc(), "(");
diag.fixItInsertAfter(E->getEndLoc(), ").self");
}
}
void checkUnqualifiedAccessUse(const DeclRefExpr *DRE) {
const Decl *D = DRE->getDecl();
if (!D->getAttrs().hasAttribute<WarnUnqualifiedAccessAttr>())
return;
if (auto *parentExpr = Parent.getAsExpr()) {
if (auto *ignoredBase = dyn_cast<DotSyntaxBaseIgnoredExpr>(parentExpr)){
if (!ignoredBase->isImplicit())
return;
}
if (auto *calledBase = dyn_cast<DotSyntaxCallExpr>(parentExpr)) {
if (!calledBase->isImplicit())
return;
}
}
const auto *VD = cast<ValueDecl>(D);
const TypeDecl *declParent =
VD->getDeclContext()->getSelfNominalTypeDecl();
if (!declParent) {
// If the declaration has been validated but not fully type-checked,
// the attribute might be applied to something invalid.
if (!VD->getDeclContext()->isModuleScopeContext())
return;
declParent = VD->getDeclContext()->getParentModule();
}
TC.diagnose(DRE->getLoc(), diag::warn_unqualified_access,
VD->getBaseName().getIdentifier(), VD->getDescriptiveKind(),
declParent->getDescriptiveKind(), declParent->getFullName());
TC.diagnose(VD, diag::decl_declared_here, VD->getFullName());
if (VD->getDeclContext()->isTypeContext()) {
TC.diagnose(DRE->getLoc(), diag::fix_unqualified_access_member)
.fixItInsert(DRE->getStartLoc(), "self.");
}
DeclContext *topLevelContext = DC->getModuleScopeContext();
UnqualifiedLookup lookup(VD->getBaseName(), topLevelContext, &TC,
/*Loc=*/SourceLoc(),
UnqualifiedLookup::Flags::KnownPrivate);
// Group results by module. Pick an arbitrary result from each module.
llvm::SmallDenseMap<const ModuleDecl*,const ValueDecl*,4> resultsByModule;
for (auto &result : lookup.Results) {
const ValueDecl *value = result.getValueDecl();
resultsByModule.insert(std::make_pair(value->getModuleContext(),value));
}
// Sort by module name.
using ModuleValuePair = std::pair<const ModuleDecl *, const ValueDecl *>;
SmallVector<ModuleValuePair, 4> sortedResults{
resultsByModule.begin(), resultsByModule.end()
};
llvm::array_pod_sort(sortedResults.begin(), sortedResults.end(),
[](const ModuleValuePair *lhs,
const ModuleValuePair *rhs) {
return lhs->first->getName().compare(rhs->first->getName());
});
auto topLevelDiag = diag::fix_unqualified_access_top_level;
if (sortedResults.size() > 1)
topLevelDiag = diag::fix_unqualified_access_top_level_multi;
for (const ModuleValuePair &pair : sortedResults) {
DescriptiveDeclKind k = pair.second->getDescriptiveKind();
SmallString<32> namePlusDot = pair.first->getName().str();
namePlusDot.push_back('.');
TC.diagnose(DRE->getLoc(), topLevelDiag,
namePlusDot, k, pair.first->getName())
.fixItInsert(DRE->getStartLoc(), namePlusDot);
}
}
void checkForDeclWithSpecialTypeCheckingSemantics(const DeclRefExpr *DRE) {
// Referencing type(of:) and other decls with special type-checking
// behavior as functions is not implemented. Maybe we could wrap up the
// special-case behavior in a closure someday...
if (TC.getDeclTypeCheckingSemantics(DRE->getDecl())
!= DeclTypeCheckingSemantics::Normal) {
TC.diagnose(DRE->getLoc(), diag::unsupported_special_decl_ref,
DRE->getDecl()->getBaseName().getIdentifier());
}
}
enum BitcastableNumberKind {
BNK_None = 0,
BNK_Int8,
BNK_Int16,
BNK_Int32,
BNK_Int64,
BNK_Int,
BNK_UInt8,
BNK_UInt16,
BNK_UInt32,
BNK_UInt64,
BNK_UInt,
BNK_Float,
BNK_Double,
};
BitcastableNumberKind getBitcastableNumberKind(Type t) const {
auto decl = t->getNominalOrBoundGenericNominal();
#define MATCH_DECL(type) \
if (decl == TC.Context.get##type##Decl()) \
return BNK_##type;
MATCH_DECL(Int8)
MATCH_DECL(Int16)
MATCH_DECL(Int32)
MATCH_DECL(Int64)
MATCH_DECL(Int)
MATCH_DECL(UInt8)
MATCH_DECL(UInt16)
MATCH_DECL(UInt32)
MATCH_DECL(UInt64)
MATCH_DECL(UInt)
MATCH_DECL(Float)
MATCH_DECL(Double)
#undef MATCH_DECL
return BNK_None;
}
static constexpr unsigned BNKPair(BitcastableNumberKind a,
BitcastableNumberKind b) {
return (a << 8) | b;
}
void checkForSuspiciousBitCasts(DeclRefExpr *DRE,
Expr *Parent = nullptr) {
if (DRE->getDecl() != TC.Context.getUnsafeBitCast(&TC))
return;
if (DRE->getDeclRef().getSubstitutions().empty())
return;
// Don't check the same use of unsafeBitCast twice.
if (!AlreadyDiagnosedBitCasts.insert(DRE).second)
return;
auto subMap = DRE->getDeclRef().getSubstitutions();
auto fromTy =
Type(GenericTypeParamType::get(0, 0, TC.Context)).subst(subMap);
auto toTy =
Type(GenericTypeParamType::get(0, 1, TC.Context)).subst(subMap);
// Warn about `unsafeBitCast` formulations that are undefined behavior
// or have better-defined alternative APIs that can be used instead.
// If we have a parent ApplyExpr that calls bitcast, extract the argument
// for fixits.
Expr *subExpr = nullptr;
CharSourceRange removeBeforeRange, removeAfterRange;
if (auto apply = dyn_cast_or_null<ApplyExpr>(Parent)) {
if (auto args = dyn_cast<TupleExpr>(apply->getArg())) {
subExpr = args->getElement(0);
// Determine the fixit range from the start of the application to
// the first argument, `unsafeBitCast(`
removeBeforeRange = CharSourceRange(TC.Context.SourceMgr,
DRE->getLoc(),
subExpr->getStartLoc());
// Determine the fixit range from the end of the first argument to
// the end of the application, `, to: T.self)`
removeAfterRange = CharSourceRange(TC.Context.SourceMgr,
Lexer::getLocForEndOfToken(TC.Context.SourceMgr,
subExpr->getEndLoc()),
Lexer::getLocForEndOfToken(TC.Context.SourceMgr,
apply->getEndLoc()));
}
}
// Casting to the same type or a superclass is a no-op.
if (toTy->isEqual(fromTy) ||
toTy->isExactSuperclassOf(fromTy)) {
auto d = TC.diagnose(DRE->getLoc(), diag::bitcasting_is_no_op,
fromTy, toTy);
if (subExpr) {
d.fixItRemoveChars(removeBeforeRange.getStart(),
removeBeforeRange.getEnd())
.fixItRemoveChars(removeAfterRange.getStart(),
removeAfterRange.getEnd());
}
return;
}
if (auto fromFnTy = fromTy->getAs<FunctionType>()) {
if (auto toFnTy = toTy->getAs<FunctionType>()) {
// Casting a nonescaping function to escaping is UB.
// `withoutActuallyEscaping` ought to be used instead.
if (fromFnTy->isNoEscape() && !toFnTy->isNoEscape()) {
TC.diagnose(DRE->getLoc(), diag::bitcasting_away_noescape,
fromTy, toTy);
}
// Changing function representation (say, to try to force a
// @convention(c) function pointer to exist) is also unlikely to work.
if (fromFnTy->getRepresentation() != toFnTy->getRepresentation()) {
TC.diagnose(DRE->getLoc(), diag::bitcasting_to_change_function_rep,
fromTy, toTy);
}
return;
}
}
// Unchecked casting to a subclass is better done by unsafeDowncast.
if (fromTy->isBindableToSuperclassOf(toTy)) {
TC.diagnose(DRE->getLoc(), diag::bitcasting_to_downcast,
fromTy, toTy)
.fixItReplace(DRE->getNameLoc().getBaseNameLoc(),
"unsafeDowncast");
return;
}
// Casting among pointer types should use the Unsafe*Pointer APIs for
// rebinding typed memory or accessing raw memory instead.
PointerTypeKind fromPTK, toPTK;
Type fromPointee = fromTy->getAnyPointerElementType(fromPTK);
Type toPointee = toTy->getAnyPointerElementType(toPTK);
if (fromPointee && toPointee) {
// Casting to a pointer to the same type or UnsafeRawPointer can use
// normal initializers on the destination type.
if (toPointee->isEqual(fromPointee)
|| isRawPointerKind(toPTK)) {
auto d = TC.diagnose(DRE->getLoc(),
diag::bitcasting_to_change_pointer_kind,
fromTy, toTy,
toTy->getStructOrBoundGenericStruct()->getName());
if (subExpr) {
StringRef before, after;
switch (toPTK) {
case PTK_UnsafePointer:
// UnsafePointer(mutablePointer)
before = "UnsafePointer(";
after = ")";
break;
case PTK_UnsafeMutablePointer:
case PTK_AutoreleasingUnsafeMutablePointer:
before = "UnsafeMutablePointer(mutating: ";
after = ")";
break;
case PTK_UnsafeRawPointer:
// UnsafeRawPointer(pointer)
before = "UnsafeRawPointer(";
after = ")";
break;
case PTK_UnsafeMutableRawPointer:
// UnsafeMutableRawPointer(mutating: rawPointer)
before = fromPTK == PTK_UnsafeMutablePointer
? "UnsafeMutableRawPointer("
: "UnsafeMutableRawPointer(mutating: ";
after = ")";
break;
}
d.fixItReplaceChars(removeBeforeRange.getStart(),
removeBeforeRange.getEnd(),
before)
.fixItReplaceChars(removeAfterRange.getStart(),
removeAfterRange.getEnd(),
after);
}
return;
}
// Casting to a different typed pointer type should use
// withMemoryRebound.
if (!isRawPointerKind(fromPTK) && !isRawPointerKind(toPTK)) {
TC.diagnose(DRE->getLoc(),
diag::bitcasting_to_change_pointee_type,
fromTy, toTy);
return;
}
// Casting a raw pointer to a typed pointer should bind the memory
// (or assume it's already bound).
assert(isRawPointerKind(fromPTK) && !isRawPointerKind(toPTK)
&& "unhandled cast combo?!");
TC.diagnose(DRE->getLoc(),
diag::bitcasting_to_give_type_to_raw_pointer,
fromTy, toTy);
if (subExpr) {
SmallString<64> fixitBuf;
{
llvm::raw_svector_ostream os(fixitBuf);
os << ".assumingMemoryBound(to: ";
toPointee->print(os);
os << ".self)";
}
TC.diagnose(DRE->getLoc(),
diag::bitcast_assume_memory_rebound,
toPointee)
.fixItRemoveChars(removeBeforeRange.getStart(),
removeBeforeRange.getEnd())
.fixItReplaceChars(removeAfterRange.getStart(),
removeAfterRange.getEnd(),
fixitBuf);
fixitBuf.clear();
{
llvm::raw_svector_ostream os(fixitBuf);
os << ".bindMemory(to: ";
toPointee->print(os);
os << ".self, capacity: <""#capacity#"">)";
}
TC.diagnose(DRE->getLoc(),
diag::bitcast_bind_memory,
toPointee)
.fixItRemoveChars(removeBeforeRange.getStart(),
removeBeforeRange.getEnd())
.fixItReplaceChars(removeAfterRange.getStart(),
removeAfterRange.getEnd(),
fixitBuf);
}
return;
}
StringRef replaceBefore, replaceAfter;
Optional<Diag<Type, Type>> diagID;
SmallString<64> replaceBeforeBuf;
// Bitcasting among numeric types should use `bitPattern:` initializers.
auto fromBNK = getBitcastableNumberKind(fromTy);
auto toBNK = getBitcastableNumberKind(toTy);
if (fromBNK && toBNK) {
switch (BNKPair(fromBNK, toBNK)) {
// Combos that can be bitPattern-ed with a constructor
case BNKPair(BNK_Int8, BNK_UInt8):
case BNKPair(BNK_UInt8, BNK_Int8):
case BNKPair(BNK_Int16, BNK_UInt16):
case BNKPair(BNK_UInt16, BNK_Int16):
case BNKPair(BNK_Int32, BNK_UInt32):
case BNKPair(BNK_UInt32, BNK_Int32):
case BNKPair(BNK_Int64, BNK_UInt64):
case BNKPair(BNK_UInt64, BNK_Int64):
case BNKPair(BNK_Int, BNK_UInt):
case BNKPair(BNK_UInt, BNK_Int):
case BNKPair(BNK_UInt32, BNK_Float):
case BNKPair(BNK_UInt64, BNK_Double):
diagID = diag::bitcasting_for_number_bit_pattern_init;
{
llvm::raw_svector_ostream os(replaceBeforeBuf);
toTy->print(os);
os << "(bitPattern: ";
}
replaceBefore = replaceBeforeBuf;
replaceAfter = ")";
break;
// Combos that can be bitPattern-ed with a constructor and sign flip
case BNKPair(BNK_Int32, BNK_Float):
case BNKPair(BNK_Int64, BNK_Double):
diagID = diag::bitcasting_for_number_bit_pattern_init;
{
llvm::raw_svector_ostream os(replaceBeforeBuf);
toTy->print(os);
os << "(bitPattern: ";
if (fromBNK == BNK_Int32)
os << "UInt32(bitPattern: ";
else
os << "UInt64(bitPattern: ";
}
replaceBefore = replaceBeforeBuf;
replaceAfter = "))";
break;
// Combos that can be bitPattern-ed with a property
case BNKPair(BNK_Float, BNK_UInt32):
case BNKPair(BNK_Double, BNK_UInt64):
diagID = diag::bitcasting_for_number_bit_pattern_property;
replaceAfter = ".bitPattern";
break;
// Combos that can be bitPattern-ed with a property and sign flip
case BNKPair(BNK_Float, BNK_Int32):
case BNKPair(BNK_Double, BNK_Int64):
diagID = diag::bitcasting_for_number_bit_pattern_property;
{
llvm::raw_svector_ostream os(replaceBeforeBuf);
toTy->print(os);
os << "(bitPattern: ";
}
replaceBefore = replaceBeforeBuf;
replaceAfter = ")";
break;
// Combos that can be bitPattern-ed with a constructor once (U)Int is
// converted to a sized type.
case BNKPair(BNK_UInt, BNK_Float):
case BNKPair(BNK_Int, BNK_UInt32):
case BNKPair(BNK_UInt, BNK_Int32):
case BNKPair(BNK_Int, BNK_UInt64):
case BNKPair(BNK_UInt, BNK_Int64):
case BNKPair(BNK_UInt, BNK_Double):
diagID = diag::bitcasting_for_number_bit_pattern_init;
{
llvm::raw_svector_ostream os(replaceBeforeBuf);
toTy->print(os);
os << "(bitPattern: ";
if (fromBNK == BNK_Int)
os << "Int";
else
os << "UInt";
if (toBNK == BNK_Float
|| toBNK == BNK_Int32
|| toBNK == BNK_UInt32)
os << "32(";
else
os << "64(";
}
replaceBefore = replaceBeforeBuf;
replaceAfter = "))";
break;
case BNKPair(BNK_Int, BNK_Float):
case BNKPair(BNK_Int, BNK_Double):
diagID = diag::bitcasting_for_number_bit_pattern_init;
{
llvm::raw_svector_ostream os(replaceBeforeBuf);
toTy->print(os);
os << "(bitPattern: UInt";
if (toBNK == BNK_Float
|| toBNK == BNK_Int32
|| toBNK == BNK_UInt32)
os << "32(bitPattern: Int32(";
else
os << "64(bitPattern: Int64(";
}
replaceBefore = replaceBeforeBuf;
replaceAfter = ")))";
break;
// Combos that can be bitPattern-ed then converted from a sized type
// to (U)Int.
case BNKPair(BNK_Int32, BNK_UInt):
case BNKPair(BNK_UInt32, BNK_Int):
case BNKPair(BNK_Int64, BNK_UInt):
case BNKPair(BNK_UInt64, BNK_Int):
diagID = diag::bitcasting_for_number_bit_pattern_init;
{
llvm::raw_svector_ostream os(replaceBeforeBuf);
toTy->print(os);
os << "(";
if (toBNK == BNK_UInt)
os << "UInt";
else
os << "Int";
if (fromBNK == BNK_Int32 || fromBNK == BNK_UInt32)
os << "32(bitPattern: ";
else
os << "64(bitPattern: ";
}
replaceBefore = replaceBeforeBuf;
replaceAfter = "))";
break;
case BNKPair(BNK_Float, BNK_UInt):
case BNKPair(BNK_Double, BNK_UInt):
diagID = diag::bitcasting_for_number_bit_pattern_property;
{
llvm::raw_svector_ostream os(replaceBeforeBuf);
toTy->print(os);
os << "(";
}
replaceBefore = replaceBeforeBuf;
replaceAfter = ".bitPattern)";
break;
case BNKPair(BNK_Float, BNK_Int):
case BNKPair(BNK_Double, BNK_Int):
diagID = diag::bitcasting_for_number_bit_pattern_property;
{
llvm::raw_svector_ostream os(replaceBeforeBuf);
toTy->print(os);
os << "(bitPattern: UInt(";
}
replaceBefore = replaceBeforeBuf;
replaceAfter = ".bitPattern))";
break;
// Combos that should be done with a value-preserving initializer.
case BNKPair(BNK_Int, BNK_Int32):
case BNKPair(BNK_Int, BNK_Int64):
case BNKPair(BNK_UInt, BNK_UInt32):
case BNKPair(BNK_UInt, BNK_UInt64):
case BNKPair(BNK_Int32, BNK_Int):
case BNKPair(BNK_Int64, BNK_Int):
case BNKPair(BNK_UInt32, BNK_UInt):
case BNKPair(BNK_UInt64, BNK_UInt):
diagID = diag::bitcasting_to_change_from_unsized_to_sized_int;
{
llvm::raw_svector_ostream os(replaceBeforeBuf);
toTy->print(os);
os << '(';
}
replaceBefore = replaceBeforeBuf;
replaceAfter = ")";
break;
default:
// Leave other combos alone.
break;
}
}
// Casting a pointer to an int or back should also use bitPattern
// initializers.
if (fromPointee && toBNK) {
switch (toBNK) {
case BNK_UInt:
case BNK_Int:
diagID = diag::bitcasting_for_number_bit_pattern_init;
{
llvm::raw_svector_ostream os(replaceBeforeBuf);
toTy->print(os);
os << "(bitPattern: ";
}
replaceBefore = replaceBeforeBuf;
replaceAfter = ")";
break;
case BNK_UInt64:
case BNK_UInt32:
case BNK_Int64:
case BNK_Int32:
diagID = diag::bitcasting_for_number_bit_pattern_init;
{
llvm::raw_svector_ostream os(replaceBeforeBuf);
toTy->print(os);
os << '(';
if (toBNK == BNK_UInt32 || toBNK == BNK_UInt64)
os << "UInt(bitPattern: ";
else
os << "Int(bitPattern: ";
}
replaceBefore = replaceBeforeBuf;
replaceAfter = "))";
break;
default:
break;
}
}
if (fromBNK && toPointee) {
switch (fromBNK) {
case BNK_UInt:
case BNK_Int:
diagID = diag::bitcasting_for_number_bit_pattern_init;
{
llvm::raw_svector_ostream os(replaceBeforeBuf);
toTy->print(os);
os << "(bitPattern: ";
}
replaceBefore = replaceBeforeBuf;
replaceAfter = ")";
break;
case BNK_UInt64:
case BNK_UInt32:
case BNK_Int64:
case BNK_Int32:
diagID = diag::bitcasting_for_number_bit_pattern_init;
{
llvm::raw_svector_ostream os(replaceBeforeBuf);
toTy->print(os);
os << "(bitPattern: ";
if (fromBNK == BNK_Int32 || fromBNK == BNK_Int64)
os << "Int(";
else
os << "UInt(";
}
replaceBefore = replaceBeforeBuf;
replaceAfter = "))";
break;
default:
break;
}
}
if (diagID) {
auto d = TC.diagnose(DRE->getLoc(), *diagID, fromTy, toTy);
if (subExpr) {
d.fixItReplaceChars(removeBeforeRange.getStart(),
removeBeforeRange.getEnd(),
replaceBefore);
d.fixItReplaceChars(removeAfterRange.getStart(),
removeAfterRange.getEnd(),
replaceAfter);
}
}
}
/// Return true if this is a 'nil' literal. This looks
/// like this if the type is Optional<T>:
///
/// (dot_syntax_call_expr implicit type='Int?'
/// (declref_expr implicit decl=Optional.none)
/// (type_expr type=Int?))
///
/// Or like this if it is any other ExpressibleByNilLiteral type:
///
/// (dot_syntax_call_expr implicit type='Int?'
/// (declref_expr implicit decl=Optional.none)
/// (type_expr type=Int?))
///
bool isTypeCheckedOptionalNil(Expr *E) {
auto CE = dyn_cast<ApplyExpr>(E->getSemanticsProvidingExpr());
if (!CE || !CE->isImplicit())
return false;
// First case -- Optional.none
if (auto DRE = dyn_cast<DeclRefExpr>(CE->getSemanticFn()))
return DRE->getDecl() == TC.Context.getOptionalNoneDecl();
// Second case -- init(nilLiteral:)
auto CRCE = dyn_cast<ConstructorRefCallExpr>(CE->getSemanticFn());
if (!CRCE || !CRCE->isImplicit()) return false;
if (auto DRE = dyn_cast<DeclRefExpr>(CRCE->getSemanticFn())) {
SmallString<32> NameBuffer;
auto name = DRE->getDecl()->getFullName().getString(NameBuffer);
return name == "init(nilLiteral:)";
}
return false;
}
/// Warn about surprising implicit optional promotions involving operands to
/// calls. Specifically, we warn about these expressions when the 'x'
/// operand is implicitly promoted to optional:
///
/// x ?? y
/// x == nil // also !=
///
void checkOptionalPromotions(ApplyExpr *call) {
// We only care about binary expressions.
if (!isa<BinaryExpr>(call)) return;
// Dig out the function we're calling.
auto fnExpr = call->getSemanticFn();
if (auto dotSyntax = dyn_cast<DotSyntaxCallExpr>(fnExpr))
fnExpr = dotSyntax->getSemanticFn();
auto DRE = dyn_cast<DeclRefExpr>(fnExpr);
auto args = dyn_cast<TupleExpr>(call->getArg());
if (!DRE || !DRE->getDecl()->isOperator() ||
!args || args->getNumElements() != 2)
return;
auto lhs = args->getElement(0);
auto rhs = args->getElement(1);
auto calleeName = DRE->getDecl()->getBaseName();
Expr *subExpr = nullptr;
if (calleeName == "??" &&
(subExpr = isImplicitPromotionToOptional(lhs))) {
TC.diagnose(DRE->getLoc(), diag::use_of_qq_on_non_optional_value,
subExpr->getType())
.highlight(lhs->getSourceRange())
.fixItRemove(SourceRange(DRE->getLoc(), rhs->getEndLoc()));
return;
}
if (calleeName == "==" || calleeName == "!=" ||
calleeName == "===" || calleeName == "!==") {
if (((subExpr = isImplicitPromotionToOptional(lhs)) &&
isTypeCheckedOptionalNil(rhs)) ||
(isTypeCheckedOptionalNil(lhs) &&
(subExpr = isImplicitPromotionToOptional(rhs)))) {
bool isTrue = calleeName == "!=" || calleeName == "!==";
TC.diagnose(DRE->getLoc(), diag::nonoptional_compare_to_nil,
subExpr->getType(), isTrue)
.highlight(lhs->getSourceRange())
.highlight(rhs->getSourceRange());
return;
}
}
}
};
DiagnoseWalker Walker(TC, DC, isExprStmt);
const_cast<Expr *>(E)->walk(Walker);
// Diagnose uses of collection literals with defaulted types at the top
// level.
if (auto collection
= dyn_cast<CollectionExpr>(E->getSemanticsProvidingExpr())) {
if (collection->isTypeDefaulted()) {
Walker.checkTypeDefaultedCollectionExpr(
const_cast<CollectionExpr *>(collection));
}
}
}
/// Diagnose recursive use of properties within their own accessors
static void diagRecursivePropertyAccess(TypeChecker &TC, const Expr *E,
const DeclContext *DC) {
auto fn = dyn_cast<AccessorDecl>(DC);
if (!fn)
return;
auto var = dyn_cast<VarDecl>(fn->getStorage());
if (!var) // Ignore subscripts
return;
class DiagnoseWalker : public ASTWalker {
TypeChecker &TC;
VarDecl *Var;
const AccessorDecl *Accessor;
public:
explicit DiagnoseWalker(TypeChecker &TC, VarDecl *var,
const AccessorDecl *Accessor)
: TC(TC), Var(var), Accessor(Accessor) {}
/// Return true if this is an implicit reference to self.
static bool isImplicitSelfUse(Expr *E) {
auto *DRE = dyn_cast<DeclRefExpr>(E);
return DRE && DRE->isImplicit() && isa<VarDecl>(DRE->getDecl()) &&
cast<VarDecl>(DRE->getDecl())->isSelfParameter();
}
std::pair<bool, Expr *> walkToExprPre(Expr *E) override {
Expr *subExpr;
bool isStore = false;
if (auto *AE = dyn_cast<AssignExpr>(E)) {
subExpr = AE->getDest();
// If we couldn't flatten this expression, don't explode.
if (!subExpr)
return { true, E };
isStore = true;
} else if (auto *IOE = dyn_cast<InOutExpr>(E)) {
subExpr = IOE->getSubExpr();
isStore = true;
} else {
subExpr = E;
}
if (auto *BOE = dyn_cast<BindOptionalExpr>(subExpr))
subExpr = BOE;
if (auto *DRE = dyn_cast<DeclRefExpr>(subExpr)) {
if (DRE->getDecl() == Var) {
// Handle local and top-level computed variables.
if (DRE->getAccessSemantics() == AccessSemantics::Ordinary) {
bool shouldDiagnose = false;
// Warn about any property access in the getter.
if (Accessor->isGetter())
shouldDiagnose = !isStore;
// Warn about stores in the setter, but allow loads.
if (Accessor->isSetter())
shouldDiagnose = isStore;
// But silence the warning if the base was explicitly qualified.
auto parentAsExpr = Parent.getAsExpr();
if (parentAsExpr && isa<DotSyntaxBaseIgnoredExpr>(parentAsExpr))
shouldDiagnose = false;
if (shouldDiagnose) {
TC.diagnose(subExpr->getLoc(), diag::recursive_accessor_reference,
Var->getName(), Accessor->isSetter());
}
}
// If this is a direct store in a "willSet", we reject this because
// it is about to get overwritten.
if (isStore &&
DRE->getAccessSemantics() == AccessSemantics::DirectToStorage &&
Accessor->getAccessorKind() == AccessorKind::WillSet) {
TC.diagnose(E->getLoc(), diag::store_in_willset, Var->getName());
}
}
} else if (auto *MRE = dyn_cast<MemberRefExpr>(subExpr)) {
// Handle instance and type computed variables.
// Find MemberRefExprs that have an implicit "self" base.
if (MRE->getMember().getDecl() == Var &&
isa<DeclRefExpr>(MRE->getBase()) &&
isImplicitSelfUse(MRE->getBase())) {
if (MRE->getAccessSemantics() == AccessSemantics::Ordinary) {
bool shouldDiagnose = false;
// Warn about any property access in the getter.
if (Accessor->isGetter())
shouldDiagnose = !isStore;
// Warn about stores in the setter, but allow loads.
if (Accessor->isSetter())
shouldDiagnose = isStore;
if (shouldDiagnose) {
TC.diagnose(subExpr->getLoc(), diag::recursive_accessor_reference,
Var->getName(), Accessor->isSetter());
TC.diagnose(subExpr->getLoc(),
diag::recursive_accessor_reference_silence)
.fixItInsert(subExpr->getStartLoc(), "self.");
}
}
// If this is a direct store in a "willSet", we reject this because
// it is about to get overwritten.
if (isStore &&
MRE->getAccessSemantics() == AccessSemantics::DirectToStorage &&
Accessor->getAccessorKind() == AccessorKind::WillSet) {
TC.diagnose(subExpr->getLoc(), diag::store_in_willset,
Var->getName());
}
}
}
return { true, E };
}
};
DiagnoseWalker walker(TC, var, fn);
const_cast<Expr *>(E)->walk(walker);
}
/// Look for any property references in closures that lack a "self." qualifier.
/// Within a closure, we require that the source code contain "self." explicitly
/// because 'self' is captured, not the property value. This is a common source
/// of confusion, so we force an explicit self.
static void diagnoseImplicitSelfUseInClosure(TypeChecker &TC, const Expr *E,
const DeclContext *DC) {
class DiagnoseWalker : public ASTWalker {
TypeChecker &TC;
unsigned InClosure;
public:
explicit DiagnoseWalker(TypeChecker &TC, bool isAlreadyInClosure)
: TC(TC), InClosure(isAlreadyInClosure) {}
/// Return true if this is an implicit reference to self.
static bool isImplicitSelfUse(Expr *E) {
auto *DRE = dyn_cast<DeclRefExpr>(E);
return DRE && DRE->isImplicit() && isa<VarDecl>(DRE->getDecl()) &&
cast<VarDecl>(DRE->getDecl())->isSelfParameter() &&
// Metatype self captures don't extend the lifetime of an object.
!DRE->getType()->is<MetatypeType>();
}
/// Return true if this is a closure expression that will require "self."
/// qualification of member references.
static bool isClosureRequiringSelfQualification(
const AbstractClosureExpr *CE) {
// If the closure's type was inferred to be noescape, then it doesn't
// need qualification.
return !AnyFunctionRef(const_cast<AbstractClosureExpr *>(CE))
.isKnownNoEscape();
}
// Don't walk into nested decls.
bool walkToDeclPre(Decl *D) override {
return false;
}
std::pair<bool, Expr *> walkToExprPre(Expr *E) override {
if (auto *CE = dyn_cast<AbstractClosureExpr>(E)) {
if (!CE->hasSingleExpressionBody())
return { false, E };
// If this is a potentially-escaping closure expression, start looking
// for references to self if we aren't already.
if (isClosureRequiringSelfQualification(CE))
++InClosure;
}
// If we aren't in a closure, no diagnostics will be produced.
if (!InClosure)
return { true, E };
// If we see a property reference with an implicit base from within a
// closure, then reject it as requiring an explicit "self." qualifier. We
// do this in explicit closures, not autoclosures, because otherwise the
// transparence of autoclosures is lost.
if (auto *MRE = dyn_cast<MemberRefExpr>(E))
if (isImplicitSelfUse(MRE->getBase())) {
TC.diagnose(MRE->getLoc(),
diag::property_use_in_closure_without_explicit_self,
MRE->getMember().getDecl()->getBaseName().getIdentifier())
.fixItInsert(MRE->getLoc(), "self.");
return { false, E };
}
// Handle method calls with a specific diagnostic + fixit.
if (auto *DSCE = dyn_cast<DotSyntaxCallExpr>(E))
if (isImplicitSelfUse(DSCE->getBase()) &&
isa<DeclRefExpr>(DSCE->getFn())) {
auto MethodExpr = cast<DeclRefExpr>(DSCE->getFn());
TC.diagnose(DSCE->getLoc(),
diag::method_call_in_closure_without_explicit_self,
MethodExpr->getDecl()->getBaseName().getIdentifier())
.fixItInsert(DSCE->getLoc(), "self.");
return { false, E };
}
// Catch any other implicit uses of self with a generic diagnostic.
if (isImplicitSelfUse(E))
TC.diagnose(E->getLoc(), diag::implicit_use_of_self_in_closure);
return { true, E };
}
Expr *walkToExprPost(Expr *E) override {
if (auto *CE = dyn_cast<AbstractClosureExpr>(E)) {
if (isClosureRequiringSelfQualification(CE)) {
assert(InClosure);
--InClosure;
}
}
return E;
}
};
bool isAlreadyInClosure = false;
if (DC->isLocalContext()) {
while (DC->getParent()->isLocalContext() && !isAlreadyInClosure) {
if (auto *closure = dyn_cast<AbstractClosureExpr>(DC))
if (DiagnoseWalker::isClosureRequiringSelfQualification(closure))
isAlreadyInClosure = true;
DC = DC->getParent();
}
}
const_cast<Expr *>(E)->walk(DiagnoseWalker(TC, isAlreadyInClosure));
}
bool TypeChecker::getDefaultGenericArgumentsString(
SmallVectorImpl<char> &buf,
const swift::GenericTypeDecl *typeDecl,
llvm::function_ref<Type(const GenericTypeParamDecl *)> getPreferredType) {
llvm::raw_svector_ostream genericParamText{buf};
genericParamText << "<";
auto printGenericParamSummary =
[&](GenericTypeParamType *genericParamTy) {
const GenericTypeParamDecl *genericParam = genericParamTy->getDecl();
if (Type result = getPreferredType(genericParam)) {
result.print(genericParamText);
return;
}
auto contextTy = typeDecl->mapTypeIntoContext(genericParamTy);
if (auto archetypeTy = contextTy->getAs<ArchetypeType>()) {
SmallVector<Type, 2> members;
bool hasExplicitAnyObject = archetypeTy->requiresClass();
if (auto superclass = archetypeTy->getSuperclass()) {
hasExplicitAnyObject = false;
members.push_back(superclass);
}
for (auto proto : archetypeTy->getConformsTo()) {
members.push_back(proto->getDeclaredType());
if (proto->requiresClass())
hasExplicitAnyObject = false;
}
if (hasExplicitAnyObject)
members.push_back(typeDecl->getASTContext().getAnyObjectType());
auto type = ProtocolCompositionType::get(typeDecl->getASTContext(),
members, hasExplicitAnyObject);
if (type->isObjCExistentialType() || type->isAny()) {
genericParamText << type;
return;
}
genericParamText << "<#" << genericParam->getName() << ": ";
genericParamText << type << "#>";
return;
}
genericParamText << contextTy;
};
interleave(typeDecl->getInnermostGenericParamTypes(),
printGenericParamSummary, [&]{ genericParamText << ", "; });
genericParamText << ">";
return true;
}
/// Diagnose an argument labeling issue, returning true if we successfully
/// diagnosed the issue.
bool swift::diagnoseArgumentLabelError(ASTContext &ctx,
const Expr *expr,
ArrayRef<Identifier> newNames,
bool isSubscript,
InFlightDiagnostic *existingDiag) {
Optional<InFlightDiagnostic> diagOpt;
auto getDiag = [&]() -> InFlightDiagnostic & {
if (existingDiag)
return *existingDiag;
return *diagOpt;
};
auto &diags = ctx.Diags;
auto tuple = dyn_cast<TupleExpr>(expr);
if (!tuple) {
if (newNames[0].empty()) {
// We don't know what to do with this.
return false;
}
llvm::SmallString<16> str;
// If the diagnostic is local, flush it before returning.
// This makes sure it's emitted before 'str' is destroyed.
SWIFT_DEFER { diagOpt.reset(); };
// This is a scalar-to-tuple conversion. Add the name. We "know"
// that we're inside a ParenExpr, because ParenExprs are required
// by the syntax and locator resolution looks through on level of
// them.
// Look through the paren expression, if there is one.
if (auto parenExpr = dyn_cast<ParenExpr>(expr))
expr = parenExpr->getSubExpr();
str += newNames[0].str();
str += ": ";
if (!existingDiag) {
diagOpt.emplace(diags.diagnose(expr->getStartLoc(),
diag::missing_argument_labels,
false, str.str().drop_back(),
isSubscript));
}
getDiag().fixItInsert(expr->getStartLoc(), str);
return true;
}
// Figure out how many extraneous, missing, and wrong labels are in
// the call.
unsigned numExtra = 0, numMissing = 0, numWrong = 0;
unsigned n = std::max(tuple->getNumElements(), (unsigned)newNames.size());
llvm::SmallString<16> missingBuffer;
llvm::SmallString<16> extraBuffer;
for (unsigned i = 0; i != n; ++i) {
Identifier oldName;
if (i < tuple->getNumElements())
oldName = tuple->getElementName(i);
Identifier newName;
if (i < newNames.size())
newName = newNames[i];
if (oldName == newName ||
(tuple->hasTrailingClosure() && i == tuple->getNumElements()-1))
continue;
if (oldName.empty()) {
++numMissing;
missingBuffer += newName.str();
missingBuffer += ":";
} else if (newName.empty()) {
++numExtra;
extraBuffer += oldName.str();
extraBuffer += ':';
} else
++numWrong;
}
// Emit the diagnostic.
assert(numMissing > 0 || numExtra > 0 || numWrong > 0);
llvm::SmallString<16> haveBuffer; // note: diagOpt has references to this
llvm::SmallString<16> expectedBuffer; // note: diagOpt has references to this
// If we had any wrong labels, or we have both missing and extra labels,
// emit the catch-all "wrong labels" diagnostic.
if (!existingDiag) {
bool plural = (numMissing + numExtra + numWrong) > 1;
if (numWrong > 0 || (numMissing > 0 && numExtra > 0)) {
for (unsigned i = 0, n = tuple->getNumElements(); i != n; ++i) {
auto haveName = tuple->getElementName(i);
if (haveName.empty())
haveBuffer += '_';
else
haveBuffer += haveName.str();
haveBuffer += ':';
}
for (auto expected : newNames) {
if (expected.empty())
expectedBuffer += '_';
else
expectedBuffer += expected.str();
expectedBuffer += ':';
}
StringRef haveStr = haveBuffer;
StringRef expectedStr = expectedBuffer;
diagOpt.emplace(diags.diagnose(expr->getLoc(),
diag::wrong_argument_labels,
plural, haveStr, expectedStr,
isSubscript));
} else if (numMissing > 0) {
StringRef missingStr = missingBuffer;
diagOpt.emplace(diags.diagnose(expr->getLoc(),
diag::missing_argument_labels,
plural, missingStr, isSubscript));
} else {
assert(numExtra > 0);
StringRef extraStr = extraBuffer;
diagOpt.emplace(diags.diagnose(expr->getLoc(),
diag::extra_argument_labels,
plural, extraStr, isSubscript));
}
}
// Emit Fix-Its to correct the names.
auto &diag = getDiag();
for (unsigned i = 0, n = tuple->getNumElements(); i != n; ++i) {
Identifier oldName = tuple->getElementName(i);
Identifier newName;
if (i < newNames.size())
newName = newNames[i];
if (oldName == newName || (i == n-1 && tuple->hasTrailingClosure()))
continue;
if (newName.empty()) {
// Delete the old name.
diag.fixItRemoveChars(tuple->getElementNameLocs()[i],
tuple->getElement(i)->getStartLoc());
continue;
}
bool newNameIsReserved = !canBeArgumentLabel(newName.str());
llvm::SmallString<16> newStr;
if (newNameIsReserved)
newStr += "`";
newStr += newName.str();
if (newNameIsReserved)
newStr += "`";
if (oldName.empty()) {
// Insert the name.
newStr += ": ";
diag.fixItInsert(tuple->getElement(i)->getStartLoc(), newStr);
continue;
}
// Change the name.
diag.fixItReplace(tuple->getElementNameLocs()[i], newStr);
}
// If the diagnostic is local, flush it before returning.
// This makes sure it's emitted before the message text buffers are destroyed.
diagOpt.reset();
return true;
}
static const Expr *lookThroughExprsToImmediateDeallocation(const Expr *E) {
// Look through various expressions that don't affect the fact that the user
// will be assigning a class instance that will be immediately deallocated.
while (true) {
E = E->getValueProvidingExpr();
// We don't currently deal with tuple shuffles.
if (isa<TupleShuffleExpr>(E))
return E;
// If we have a TupleElementExpr with a child TupleExpr, dig into that
// element.
if (auto *TEE = dyn_cast<TupleElementExpr>(E)) {
auto *subExpr = lookThroughExprsToImmediateDeallocation(TEE->getBase());
if (auto *TE = dyn_cast<TupleExpr>(subExpr)) {
auto *element = TE->getElements()[TEE->getFieldNumber()];
return lookThroughExprsToImmediateDeallocation(element);
}
return subExpr;
}
if (auto *ICE = dyn_cast<ImplicitConversionExpr>(E)) {
E = ICE->getSubExpr();
continue;
}
if (auto *CE = dyn_cast<CoerceExpr>(E)) {
E = CE->getSubExpr();
continue;
}
if (auto *OEE = dyn_cast<OpenExistentialExpr>(E)) {
E = OEE->getSubExpr();
continue;
}
// Look through optional evaluations, we still want to diagnose on
// things like initializers called through optional chaining and the
// unwrapping of failable initializers.
if (auto *OEE = dyn_cast<OptionalEvaluationExpr>(E)) {
E = OEE->getSubExpr();
continue;
}
if (auto *OBE = dyn_cast<BindOptionalExpr>(E)) {
E = OBE->getSubExpr();
continue;
}
if (auto *FOE = dyn_cast<ForceValueExpr>(E)) {
E = FOE->getSubExpr();
continue;
}
if (auto *ATE = dyn_cast<AnyTryExpr>(E)) {
E = ATE->getSubExpr();
continue;
}
if (auto *DSBIE = dyn_cast<DotSyntaxBaseIgnoredExpr>(E)) {
E = DSBIE->getRHS();
continue;
}
return E;
}
}
static void diagnoseUnownedImmediateDeallocationImpl(TypeChecker &TC,
const VarDecl *varDecl,
const Expr *initExpr,
SourceLoc diagLoc,
SourceRange diagRange) {
auto *ownershipAttr =
varDecl->getAttrs().getAttribute<ReferenceOwnershipAttr>();
if (!ownershipAttr || ownershipAttr->isInvalid())
return;
// Only diagnose for non-owning ownerships such as 'weak' and 'unowned'.
// Zero is the default/strong ownership strength.
if (ReferenceOwnership::Strong == ownershipAttr->get() ||
isLessStrongThan(ReferenceOwnership::Strong, ownershipAttr->get()))
return;
// Try to find a call to a constructor.
initExpr = lookThroughExprsToImmediateDeallocation(initExpr);
auto *CE = dyn_cast<CallExpr>(initExpr);
if (!CE)
return;
auto *CRCE = dyn_cast<ConstructorRefCallExpr>(CE->getFn());
if (!CRCE)
return;
auto *DRE = dyn_cast<DeclRefExpr>(CRCE->getFn());
if (!DRE)
return;
auto *constructorDecl = dyn_cast<ConstructorDecl>(DRE->getDecl());
if (!constructorDecl)
return;
// Make sure the constructor constructs an instance that allows ownership.
// This is to ensure we don't diagnose on constructors such as
// Optional.init(nilLiteral:).
auto selfType = constructorDecl->getDeclContext()->getSelfTypeInContext();
if (!selfType->allowsOwnership())
return;
// This must stay in sync with
// diag::unowned_assignment_immediate_deallocation.
enum {
SK_Variable = 0,
SK_Property
} storageKind = SK_Variable;
if (varDecl->getDeclContext()->isTypeContext())
storageKind = SK_Property;
TC.diagnose(diagLoc, diag::unowned_assignment_immediate_deallocation,
varDecl->getName(), ownershipAttr->get(), unsigned(storageKind))
.highlight(diagRange);
TC.diagnose(diagLoc, diag::unowned_assignment_requires_strong)
.highlight(diagRange);
TC.diagnose(varDecl, diag::decl_declared_here, varDecl->getFullName());
}
void swift::diagnoseUnownedImmediateDeallocation(TypeChecker &TC,
const AssignExpr *assignExpr) {
auto *destExpr = assignExpr->getDest()->getValueProvidingExpr();
auto *initExpr = assignExpr->getSrc();
// Try to find a referenced VarDecl.
const VarDecl *VD = nullptr;
if (auto *DRE = dyn_cast<DeclRefExpr>(destExpr)) {
VD = dyn_cast<VarDecl>(DRE->getDecl());
} else if (auto *MRE = dyn_cast<MemberRefExpr>(destExpr)) {
VD = dyn_cast<VarDecl>(MRE->getMember().getDecl());
}
if (VD)
diagnoseUnownedImmediateDeallocationImpl(TC, VD, initExpr,
assignExpr->getLoc(),
initExpr->getSourceRange());
}
void swift::diagnoseUnownedImmediateDeallocation(TypeChecker &TC,
const Pattern *pattern,
SourceLoc equalLoc,
const Expr *initExpr) {
pattern = pattern->getSemanticsProvidingPattern();
if (auto *TP = dyn_cast<TuplePattern>(pattern)) {
initExpr = lookThroughExprsToImmediateDeallocation(initExpr);
// If we've found a matching tuple initializer with the same number of
// elements as our pattern, diagnose each element individually.
auto TE = dyn_cast<TupleExpr>(initExpr);
if (TE && TE->getNumElements() == TP->getNumElements()) {
for (unsigned i = 0, e = TP->getNumElements(); i != e; ++i) {
const TuplePatternElt &elt = TP->getElement(i);
const Pattern *subPattern = elt.getPattern();
Expr *subInitExpr = TE->getElement(i);
diagnoseUnownedImmediateDeallocation(TC, subPattern, equalLoc,
subInitExpr);
}
}
} else if (auto *NP = dyn_cast<NamedPattern>(pattern)) {
diagnoseUnownedImmediateDeallocationImpl(TC, NP->getDecl(), initExpr,
equalLoc,
initExpr->getSourceRange());
}
}
bool swift::fixItOverrideDeclarationTypes(InFlightDiagnostic &diag,
ValueDecl *decl,
const ValueDecl *base) {
// For now, just rewrite cases where the base uses a value type and the
// override uses a reference type, and the value type is bridged to the
// reference type. This is a way to migrate code that makes use of types
// that previously were not bridged to value types.
auto checkValueReferenceType =
[&](Type overrideTy, VarDecl::Specifier overrideSpec,
Type baseTy, VarDecl::Specifier baseSpec,
SourceRange typeRange) -> bool {
if (typeRange.isInvalid())
return false;
auto normalizeType = [](Type &ty, VarDecl::Specifier spec) -> Type {
Type normalizedTy = ty;
if (Type unwrappedTy = normalizedTy->getOptionalObjectType())
normalizedTy = unwrappedTy;
if (spec == VarDecl::Specifier::InOut)
ty = InOutType::get(ty);
return normalizedTy;
};
// Is the base type bridged?
Type normalizedBaseTy = normalizeType(baseTy, baseSpec);
const DeclContext *DC = decl->getDeclContext();
ASTContext &ctx = decl->getASTContext();
// ...and just knowing that it's bridged isn't good enough if we don't
// know what it's bridged /to/. Also, don't do this check for trivial
// bridging---that doesn't count.
Type bridged;
if (normalizedBaseTy->isAny()) {
bridged = ctx.getAnyObjectType();
} else {
bridged = ctx.getBridgedToObjC(DC, normalizedBaseTy);
}
if (!bridged || bridged->isEqual(normalizedBaseTy))
return false;
// ...and is it bridged to the overridden type?
Type normalizedOverrideTy = normalizeType(overrideTy, overrideSpec);
if (!bridged->isEqual(normalizedOverrideTy)) {
// If both are nominal types, check again, ignoring generic arguments.
auto *overrideNominal = normalizedOverrideTy->getAnyNominal();
if (!overrideNominal || bridged->getAnyNominal() != overrideNominal) {
return false;
}
}
Type newOverrideTy = baseTy;
// Preserve optionality if we're dealing with a simple type.
if (Type unwrappedTy = newOverrideTy->getOptionalObjectType())
newOverrideTy = unwrappedTy;
if (overrideTy->getOptionalObjectType())
newOverrideTy = OptionalType::get(newOverrideTy);
SmallString<32> baseTypeBuf;
llvm::raw_svector_ostream baseTypeStr(baseTypeBuf);
PrintOptions options;
options.SynthesizeSugarOnTypes = true;
newOverrideTy->print(baseTypeStr, options);
diag.fixItReplace(typeRange, baseTypeStr.str());
return true;
};
// Check if overriding fails because we lack @escaping attribute on the function
// type repr.
auto checkTypeMissingEscaping = [&](Type overrideTy, Type baseTy,
SourceRange typeRange) -> bool {
// Fix-it needs position to apply.
if (typeRange.isInvalid())
return false;
auto overrideFnTy = overrideTy->getAs<AnyFunctionType>();
auto baseFnTy = baseTy->getAs<AnyFunctionType>();
// Both types should be function.
if (overrideFnTy && baseFnTy &&
// The overriding function type should be no escaping.
overrideFnTy->getExtInfo().isNoEscape() &&
// The overridden function type should be escaping.
!baseFnTy->getExtInfo().isNoEscape()) {
diag.fixItInsert(typeRange.Start, "@escaping ");
return true;
}
return false;
};
auto checkType = [&](Type overrideTy, VarDecl::Specifier overrideSpec,
Type baseTy, VarDecl::Specifier baseSpec,
SourceRange typeRange) -> bool {
return checkValueReferenceType(overrideTy, overrideSpec,
baseTy, baseSpec, typeRange) ||
checkTypeMissingEscaping(overrideTy, baseTy, typeRange);
};
if (auto *var = dyn_cast<VarDecl>(decl)) {
SourceRange typeRange = var->getTypeSourceRangeForDiagnostics();
auto *baseVar = cast<VarDecl>(base);
return checkType(var->getInterfaceType(), var->getSpecifier(),
baseVar->getInterfaceType(), var->getSpecifier(),
typeRange);
}
if (auto *fn = dyn_cast<AbstractFunctionDecl>(decl)) {
auto *baseFn = cast<AbstractFunctionDecl>(base);
bool fixedAny = false;
if (fn->getParameters()->size() ==
baseFn->getParameters()->size()) {
for_each(*fn->getParameters(),
*baseFn->getParameters(),
[&](ParamDecl *param, const ParamDecl *baseParam) {
fixedAny |= fixItOverrideDeclarationTypes(diag, param, baseParam);
});
}
if (auto *method = dyn_cast<FuncDecl>(decl)) {
auto resultType = method->mapTypeIntoContext(
method->getResultInterfaceType());
auto *baseMethod = cast<FuncDecl>(base);
auto baseResultType = baseMethod->mapTypeIntoContext(
baseMethod->getResultInterfaceType());
fixedAny |= checkType(resultType, VarDecl::Specifier::Default,
baseResultType, VarDecl::Specifier::Default,
method->getBodyResultTypeLoc().getSourceRange());
}
return fixedAny;
}
if (auto *subscript = dyn_cast<SubscriptDecl>(decl)) {
auto *baseSubscript = cast<SubscriptDecl>(base);
bool fixedAny = false;
if (subscript->getIndices()->size() ==
baseSubscript->getIndices()->size()) {
for_each(*subscript->getIndices(),
*baseSubscript->getIndices(),
[&](ParamDecl *param, const ParamDecl *baseParam) {
fixedAny |= fixItOverrideDeclarationTypes(diag, param, baseParam);
});
}
auto resultType = subscript->getDeclContext()->mapTypeIntoContext(
subscript->getElementInterfaceType());
auto baseResultType = baseSubscript->getDeclContext()->mapTypeIntoContext(
baseSubscript->getElementInterfaceType());
fixedAny |= checkType(resultType, VarDecl::Specifier::Default,
baseResultType, VarDecl::Specifier::Default,
subscript->getElementTypeLoc().getSourceRange());
return fixedAny;
}
llvm_unreachable("unknown overridable member");
}
//===----------------------------------------------------------------------===//
// Per func/init diagnostics
//===----------------------------------------------------------------------===//
namespace {
class VarDeclUsageChecker : public ASTWalker {
DiagnosticEngine &Diags;
// Keep track of some information about a variable.
enum {
RK_Read = 1, ///< Whether it was ever read.
RK_Written = 2, ///< Whether it was ever written or passed inout.
RK_CaptureList = 4 ///< Var is an entry in a capture list.
};
/// These are all of the variables that we are tracking. VarDecls get added
/// to this when the declaration is seen. We use a MapVector to keep the
/// diagnostics emission in deterministic order.
llvm::SmallMapVector<VarDecl*, unsigned, 32> VarDecls;
/// This is a mapping from an OpaqueValue to the expression that initialized
/// it.
llvm::SmallDenseMap<OpaqueValueExpr*, Expr*> OpaqueValueMap;
/// The getter associated with a setter function declaration.
const VarDecl *AssociatedGetter = nullptr;
/// The first reference to the associated getter.
const DeclRefExpr *AssociatedGetterDeclRef = nullptr;
/// This is a mapping from VarDecls to the if/while/guard statement that they
/// occur in, when they are in a pattern in a StmtCondition.
llvm::SmallDenseMap<VarDecl*, LabeledConditionalStmt*> StmtConditionForVD;
bool sawError = false;
VarDeclUsageChecker(const VarDeclUsageChecker &) = delete;
void operator=(const VarDeclUsageChecker &) = delete;
public:
VarDeclUsageChecker(TypeChecker &TC, AbstractFunctionDecl *AFD) : Diags(TC.Diags) {
// If this AFD is a setter, track the parameter and the getter for
// the containing property so if newValue isn't used but the getter is used
// an error can be reported.
if (auto FD = dyn_cast<AccessorDecl>(AFD)) {
if (FD->getAccessorKind() == AccessorKind::Set) {
if (auto getter = dyn_cast<VarDecl>(FD->getStorage())) {
auto arguments = FD->getParameters();
VarDecls[arguments->get(0)] = 0;
AssociatedGetter = getter;
}
}
}
}
VarDeclUsageChecker(DiagnosticEngine &Diags) : Diags(Diags) {}
VarDeclUsageChecker(TypeChecker &TC, VarDecl *VD) : Diags(TC.Diags) {
// Track a specific VarDecl
VarDecls[VD] = 0;
}
void suppressDiagnostics() {
sawError = true; // set this flag so that no diagnostics will be emitted on delete.
}
// After we have scanned the entire region, diagnose variables that could be
// declared with a narrower usage kind.
~VarDeclUsageChecker() override;
/// Check to see if the specified VarDecl is part of a larger
/// PatternBindingDecl, where some other bound variable was mutated. In this
/// case we don't want to generate a "variable never mutated" warning, because
/// it would require splitting up the destructuring of the tuple, which is
/// more code turmoil than the warning is worth.
bool isVarDeclPartOfPBDThatHadSomeMutation(VarDecl *VD) {
auto *PBD = VD->getParentPatternBinding();
if (!PBD) return false;
bool sawMutation = false;
for (const auto &PBE : PBD->getPatternList()) {
PBE.getPattern()->forEachVariable([&](VarDecl *VD) {
auto it = VarDecls.find(VD);
sawMutation |= it != VarDecls.end() && (it->second & RK_Written);
});
}
return sawMutation;
}
bool isVarDeclEverWritten(VarDecl *VD) {
return (VarDecls[VD] & RK_Written) != 0;
}
bool shouldTrackVarDecl(VarDecl *VD) {
// If the variable is implicit, ignore it.
if (VD->isImplicit() || VD->getLoc().isInvalid())
return false;
// If the variable is computed, ignore it.
if (!VD->hasStorage())
return false;
// If the variable was invalid, ignore it and notice that the code is
// malformed.
if (VD->isInvalid() || !VD->hasType()) {
sawError = true;
return false;
}
// If the variable is already unnamed, ignore it.
if (!VD->hasName() || VD->getName().str() == "_")
return false;
return true;
}
void addMark(Decl *D, unsigned Flag) {
auto *vd = dyn_cast<VarDecl>(D);
if (!vd) return;
auto vdi = VarDecls.find(vd);
if (vdi != VarDecls.end())
vdi->second |= Flag;
}
void markBaseOfAbstractStorageDeclStore(Expr *E, ConcreteDeclRef decl);
void markStoredOrInOutExpr(Expr *E, unsigned Flags);
// We generally walk into declarations, other than types and nested functions.
// FIXME: peek into capture lists of nested functions.
bool walkToDeclPre(Decl *D) override {
if (isa<TypeDecl>(D))
return false;
// The body of #if clauses are not walked into, we need custom processing
// for them.
if (auto *ICD = dyn_cast<IfConfigDecl>(D))
handleIfConfig(ICD);
// If this is a VarDecl, then add it to our list of things to track.
if (auto *vd = dyn_cast<VarDecl>(D))
if (shouldTrackVarDecl(vd)) {
unsigned defaultFlags = 0;
// If this VarDecl is nested inside of a CaptureListExpr, remember that
// fact for better diagnostics.
auto parentAsExpr = Parent.getAsExpr();
if (parentAsExpr && isa<CaptureListExpr>(parentAsExpr))
defaultFlags = RK_CaptureList;
VarDecls[vd] |= defaultFlags;
}
if (auto *afd = dyn_cast<AbstractFunctionDecl>(D)) {
// If this is a nested function with a capture list, mark any captured
// variables.
if (afd->isBodyTypeChecked()) {
for (const auto &capture : afd->getCaptureInfo().getCaptures())
addMark(capture.getDecl(), RK_Read|RK_Written);
} else {
// If the body hasn't been type checked yet, be super-conservative and
// mark all variables as used. This can be improved later, e.g. by
// walking the untype-checked body to look for things that could
// possibly be used.
VarDecls.clear();
}
// Don't walk into it though, it may not even be type checked yet.
return false;
}
if (auto *TLCD = dyn_cast<TopLevelCodeDecl>(D)) {
// If this is a TopLevelCodeDecl, scan for global variables
auto *body = TLCD->getBody();
for (auto node : body->getElements()) {
if (node.is<Decl *>()) {
// Flag all variables in a PatternBindingDecl
Decl *D = node.get<Decl *>();
auto *PBD = dyn_cast<PatternBindingDecl>(D);
if (!PBD) continue;
for (PatternBindingEntry PBE : PBD->getPatternList()) {
PBE.getPattern()->forEachVariable([&](VarDecl *VD) {
VarDecls[VD] = RK_Read|RK_Written;
});
}
} else if (node.is<Stmt *>()) {
// Flag all variables in guard statements
Stmt *S = node.get<Stmt *>();
auto *GS = dyn_cast<GuardStmt>(S);
if (!GS) continue;
for (StmtConditionElement SCE : GS->getCond()) {
if (auto pattern = SCE.getPatternOrNull()) {
pattern->forEachVariable([&](VarDecl *VD) {
VarDecls[VD] = RK_Read|RK_Written;
});
}
}
}
}
}
// Note that we ignore the initialization behavior of PatternBindingDecls,
// but we do want to walk into them, because we want to see any uses or
// other things going on in the initializer expressions.
return true;
}
/// The heavy lifting happens when visiting expressions.
std::pair<bool, Expr *> walkToExprPre(Expr *E) override;
/// handle #if directives.
void handleIfConfig(IfConfigDecl *ICD);
/// Custom handling for statements.
std::pair<bool, Stmt *> walkToStmtPre(Stmt *S) override {
// Keep track of an association between vardecls and the StmtCondition that
// they are bound in for IfStmt, GuardStmt, WhileStmt, etc.
if (auto LCS = dyn_cast<LabeledConditionalStmt>(S)) {
for (auto &cond : LCS->getCond())
if (auto pat = cond.getPatternOrNull()) {
pat->forEachVariable([&](VarDecl *VD) {
StmtConditionForVD[VD] = LCS;
});
}
}
// A fallthrough dest case's bound variable means the source case's
// var of the same name is read.
if (auto *fallthroughStmt = dyn_cast<FallthroughStmt>(S)) {
if (auto *sourceCase = fallthroughStmt->getFallthroughSource()) {
SmallVector<VarDecl *, 4> sourceVars;
auto sourcePattern = sourceCase->getCaseLabelItems()[0].getPattern();
sourcePattern->collectVariables(sourceVars);
auto destCase = fallthroughStmt->getFallthroughDest();
auto destPattern = destCase->getCaseLabelItems()[0].getPattern();
destPattern->forEachVariable([&](VarDecl *V) {
if (!V->hasName())
return;
for (auto *var : sourceVars) {
if (var->hasName() && var->getName() == V->getName()) {
VarDecls[var] |= RK_Read;
break;
}
}
});
}
}
return { true, S };
}
};
} // end anonymous namespace
// After we have scanned the entire region, diagnose variables that could be
// declared with a narrower usage kind.
VarDeclUsageChecker::~VarDeclUsageChecker() {
// If we saw an ErrorExpr somewhere in the body, then we have a malformed AST
// and we know stuff got dropped. Instead of producing these diagnostics,
// lets let the bigger issues get resolved first.
if (sawError)
return;
for (auto elt : VarDecls) {
auto *var = elt.first;
unsigned access = elt.second;
// If this is a 'let' value, any stores to it are actually initializations,
// not mutations.
auto isWrittenLet = false;
if (var->isImmutable()) {
isWrittenLet = (access & RK_Written) != 0;
access &= ~RK_Written;
}
// If this variable has WeakStorageType, then it can be mutated in ways we
// don't know.
if (var->getType()->is<WeakStorageType>())
access |= RK_Written;
// If this is a vardecl with 'inout' type, then it is an inout argument to a
// function, never diagnose anything related to it.
if (var->isInOut())
continue;
// If the setter parameter is not used, but the property is read, report
// a warning. Otherwise, parameters should not generate usage warnings. It
// is common to name a parameter and not use it (e.g. because you are an
// override or want the named keyword, etc). Warning to rewrite it to _ is
// more annoying than it is useful.
if (auto param = dyn_cast<ParamDecl>(var)) {
auto FD = dyn_cast<AccessorDecl>(param->getDeclContext());
if (FD && FD->getAccessorKind() == AccessorKind::Set) {
auto getter = dyn_cast<VarDecl>(FD->getStorage());
if ((access & RK_Read) == 0 && AssociatedGetter == getter) {
if (auto DRE = AssociatedGetterDeclRef) {
Diags.diagnose(DRE->getLoc(), diag::unused_setter_parameter,
var->getName());
Diags.diagnose(DRE->getLoc(), diag::fixit_for_unused_setter_parameter,
var->getName())
.fixItReplace(DRE->getSourceRange(), var->getName().str());
}
}
}
continue;
}
// Diagnose variables that were never used (other than their
// initialization).
//
if ((access & (RK_Read|RK_Written)) == 0) {
// If this is a member in a capture list, just say it is unused. We could
// produce a fixit hint with a parent map, but this is a lot of effort for
// a narrow case.
if (access & RK_CaptureList) {
Diags.diagnose(var->getLoc(), diag::capture_never_used,
var->getName());
continue;
}
// If the source of the VarDecl is a trivial PatternBinding with only a
// single binding, rewrite the whole thing into an assignment.
// let x = foo()
// ->
// _ = foo()
if (auto *pbd = var->getParentPatternBinding())
if (pbd->getSingleVar() == var && pbd->getInit(0) != nullptr &&
!isa<TypedPattern>(pbd->getPatternList()[0].getPattern())) {
unsigned varKind = var->isLet();
SourceRange replaceRange(
pbd->getStartLoc(),
pbd->getPatternList()[0].getPattern()->getEndLoc());
Diags.diagnose(var->getLoc(), diag::pbd_never_used,
var->getName(), varKind)
.fixItReplace(replaceRange, "_");
continue;
}
// If the variable is defined in a pattern in an if/while/guard statement,
// see if we can produce a tuned fixit. When we have something like:
//
// if let x = <expr> {
//
// we prefer to rewrite it to:
//
// if <expr> != nil {
//
if (auto SC = StmtConditionForVD[var]) {
// We only handle the "if let" case right now, since it is vastly the
// most common situation that people run into.
if (SC->getCond().size() == 1) {
auto pattern = SC->getCond()[0].getPattern();
if (auto OSP = dyn_cast<OptionalSomePattern>(pattern))
if (auto LP = dyn_cast<VarPattern>(OSP->getSubPattern()))
if (isa<NamedPattern>(LP->getSubPattern())) {
auto initExpr = SC->getCond()[0].getInitializer();
if (initExpr->getStartLoc().isValid()) {
unsigned noParens = initExpr->canAppendPostfixExpression();
// If the subexpr is an "as?" cast, we can rewrite it to
// be an "is" test.
bool isIsTest = false;
if (isa<ConditionalCheckedCastExpr>(initExpr) &&
!initExpr->isImplicit()) {
noParens = isIsTest = true;
}
auto diagIF = Diags.diagnose(var->getLoc(),
diag::pbd_never_used_stmtcond,
var->getName());
auto introducerLoc = SC->getCond()[0].getIntroducerLoc();
diagIF.fixItReplaceChars(introducerLoc,
initExpr->getStartLoc(),
&"("[noParens]);
if (isIsTest) {
// If this was an "x as? T" check, rewrite it to "x is T".
auto CCE = cast<ConditionalCheckedCastExpr>(initExpr);
diagIF.fixItReplace(SourceRange(CCE->getLoc(),
CCE->getQuestionLoc()),
"is");
} else {
diagIF.fixItInsertAfter(initExpr->getEndLoc(),
&") != nil"[noParens]);
}
continue;
}
}
}
}
// Otherwise, this is something more complex, perhaps
// let (a,b) = foo()
if (isWrittenLet) {
Diags.diagnose(var->getLoc(),
diag::immutable_value_never_used_but_assigned,
var->getName());
} else {
unsigned varKind = var->isLet();
// Just rewrite the one variable with a _.
Diags.diagnose(var->getLoc(), diag::variable_never_used,
var->getName(), varKind)
.fixItReplace(var->getLoc(), "_");
}
continue;
}
// If this is a mutable 'var', and it was never written to, suggest
// upgrading to 'let'. We do this even for a parameter.
if (!var->isImmutable() && (access & RK_Written) == 0 &&
// Don't warn if we have something like "let (x,y) = ..." and 'y' was
// never mutated, but 'x' was.
!isVarDeclPartOfPBDThatHadSomeMutation(var)) {
SourceLoc FixItLoc;
// Try to find the location of the 'var' so we can produce a fixit. If
// this is a simple PatternBinding, use its location.
if (auto *PBD = var->getParentPatternBinding()) {
if (PBD->getSingleVar() == var)
FixItLoc = PBD->getLoc();
} else if (auto *pattern = var->getParentPattern()) {
VarPattern *foundVP = nullptr;
pattern->forEachNode([&](Pattern *P) {
if (auto *VP = dyn_cast<VarPattern>(P))
if (VP->getSingleVar() == var)
foundVP = VP;
});
if (foundVP && !foundVP->isLet())
FixItLoc = foundVP->getLoc();
}
// If this is a parameter explicitly marked 'var', remove it.
unsigned varKind = isa<ParamDecl>(var);
if (FixItLoc.isInvalid())
Diags.diagnose(var->getLoc(), diag::variable_never_mutated,
var->getName(), varKind);
else {
bool suggestLet = true;
if (auto *stmt = var->getParentPatternStmt()) {
// Don't try to suggest 'var' -> 'let' conversion
// in case of 'for' loop because it's an implicitly
// immutable context.
suggestLet = !isa<ForEachStmt>(stmt);
}
auto diag = Diags.diagnose(var->getLoc(), diag::variable_never_mutated,
var->getName(), varKind);
if (suggestLet)
diag.fixItReplace(FixItLoc, "let");
else
diag.fixItRemove(FixItLoc);
continue;
}
}
// If this is a variable that was only written to, emit a warning.
if ((access & RK_Read) == 0) {
Diags.diagnose(var->getLoc(), diag::variable_never_read, var->getName(),
isa<ParamDecl>(var));
continue;
}
}
}
/// Handle a store to "x.y" where 'base' is the expression for x and 'decl' is
/// the decl for 'y'.
void VarDeclUsageChecker::
markBaseOfAbstractStorageDeclStore(Expr *base, ConcreteDeclRef decl) {
// If the base is a class or an rvalue, then this store just loads the base.
if (base->getType()->isAnyClassReferenceType() ||
!(base->getType()->hasLValueType() || base->isSemanticallyInOutExpr())) {
base->walk(*this);
return;
}
// If the store is to a non-mutating member, then this is just a load, even
// if the base is an inout expr.
auto *ASD = cast<AbstractStorageDecl>(decl.getDecl());
if (ASD->isSettable(nullptr) && !ASD->isSetterMutating()) {
// Sema conservatively converts the base to inout expr when it is an lvalue.
// Look through it because we know it isn't actually doing a load/store.
if (auto *ioe = dyn_cast<InOutExpr>(base))
base = ioe->getSubExpr();
base->walk(*this);
return;
}
// Otherwise this is a read and write of the base.
return markStoredOrInOutExpr(base, RK_Written|RK_Read);
}
void VarDeclUsageChecker::markStoredOrInOutExpr(Expr *E, unsigned Flags) {
// Sema leaves some subexpressions null, which seems really unfortunate. It
// should replace them with ErrorExpr.
if (E == nullptr || !E->getType() || E->getType()->hasError()) {
sawError = true;
return;
}
// Ignore parens and other easy cases.
E = E->getSemanticsProvidingExpr();
// If we found a decl that is being assigned to, then mark it.
if (auto *DRE = dyn_cast<DeclRefExpr>(E)) {
addMark(DRE->getDecl(), Flags);
return;
}
if (auto *TE = dyn_cast<TupleExpr>(E)) {
for (auto &elt : TE->getElements())
markStoredOrInOutExpr(elt, Flags);
return;
}
// If this is an assignment into a mutating subscript lvalue expr, then we
// are mutating the base expression. We also need to visit the index
// expressions as loads though.
if (auto *SE = dyn_cast<SubscriptExpr>(E)) {
// The index of the subscript is evaluated as an rvalue.
SE->getIndex()->walk(*this);
if (SE->hasDecl())
markBaseOfAbstractStorageDeclStore(SE->getBase(), SE->getDecl());
else // FIXME: Should not be needed!
markStoredOrInOutExpr(SE->getBase(), RK_Written|RK_Read);
return;
}
// Likewise for key path applications. An application of a WritableKeyPath
// reads and writes its base.
if (auto *KPA = dyn_cast<KeyPathApplicationExpr>(E)) {
auto &C = KPA->getType()->getASTContext();
KPA->getKeyPath()->walk(*this);
if (KPA->getKeyPath()->getType()->getAnyNominal()
== C.getWritableKeyPathDecl())
markStoredOrInOutExpr(KPA->getBase(), RK_Written|RK_Read);
if (KPA->getKeyPath()->getType()->getAnyNominal()
== C.getReferenceWritableKeyPathDecl())
markStoredOrInOutExpr(KPA->getBase(), RK_Read);
return;
}
if (auto *ioe = dyn_cast<InOutExpr>(E))
return markStoredOrInOutExpr(ioe->getSubExpr(), RK_Written|RK_Read);
if (auto *MRE = dyn_cast<MemberRefExpr>(E)) {
markBaseOfAbstractStorageDeclStore(MRE->getBase(), MRE->getMember());
return;
}
if (auto *TEE = dyn_cast<TupleElementExpr>(E))
return markStoredOrInOutExpr(TEE->getBase(), Flags);
if (auto *FVE = dyn_cast<ForceValueExpr>(E))
return markStoredOrInOutExpr(FVE->getSubExpr(), Flags);
if (auto *BOE = dyn_cast<BindOptionalExpr>(E))
return markStoredOrInOutExpr(BOE->getSubExpr(), Flags);
// If this is an OpaqueValueExpr that we've seen a mapping for, jump to the
// mapped value.
if (auto *OVE = dyn_cast<OpaqueValueExpr>(E))
if (auto *expr = OpaqueValueMap[OVE])
return markStoredOrInOutExpr(expr, Flags);
// If we don't know what kind of expression this is, assume it's a reference
// and mark it as a read.
E->walk(*this);
}
/// The heavy lifting happens when visiting expressions.
std::pair<bool, Expr *> VarDeclUsageChecker::walkToExprPre(Expr *E) {
// Sema leaves some subexpressions null, which seems really unfortunate. It
// should replace them with ErrorExpr.
if (E == nullptr || !E->getType() || E->getType()->hasError()) {
sawError = true;
return { false, E };
}
// If this is a DeclRefExpr found in a random place, it is a load of the
// vardecl.
if (auto *DRE = dyn_cast<DeclRefExpr>(E)) {
addMark(DRE->getDecl(), RK_Read);
// If the Decl is a read of a getter, track the first DRE for diagnostics
if (auto VD = dyn_cast<VarDecl>(DRE->getDecl())) {
if (AssociatedGetter == VD && AssociatedGetterDeclRef == nullptr)
AssociatedGetterDeclRef = DRE;
}
}
// If this is an AssignExpr, see if we're mutating something that we know
// about.
if (auto *assign = dyn_cast<AssignExpr>(E)) {
markStoredOrInOutExpr(assign->getDest(), RK_Written);
// Don't walk into the LHS of the assignment, only the RHS.
assign->getSrc()->walk(*this);
return { false, E };
}
// '&x' is a read and write of 'x'.
if (auto *io = dyn_cast<InOutExpr>(E)) {
markStoredOrInOutExpr(io->getSubExpr(), RK_Read|RK_Written);
// Don't bother walking into this.
return { false, E };
}
// If we see an OpenExistentialExpr, remember the mapping for its OpaqueValue.
if (auto *oee = dyn_cast<OpenExistentialExpr>(E))
OpaqueValueMap[oee->getOpaqueValue()] = oee->getExistentialValue();
// If we saw an ErrorExpr, take note of this.
if (isa<ErrorExpr>(E))
sawError = true;
return { true, E };
}
/// handle #if directives. All of the active clauses are already walked by the
/// AST walker, but we also want to handle the inactive ones to avoid false
/// positives.
void VarDeclUsageChecker::handleIfConfig(IfConfigDecl *ICD) {
struct ConservativeDeclMarker : public ASTWalker {
VarDeclUsageChecker &VDUC;
ConservativeDeclMarker(VarDeclUsageChecker &VDUC) : VDUC(VDUC) {}
Expr *walkToExprPost(Expr *E) override {
// If we see a bound reference to a decl in an inactive #if block, then
// conservatively mark it read and written. This will silence "variable
// unused" and "could be marked let" warnings for it.
if (auto *DRE = dyn_cast<DeclRefExpr>(E))
VDUC.addMark(DRE->getDecl(), RK_Read|RK_Written);
return E;
}
};
for (auto &clause : ICD->getClauses()) {
// Active clauses are handled by the normal AST walk.
if (clause.isActive) continue;
for (auto elt : clause.Elements)
elt.walk(ConservativeDeclMarker(*this));
}
}
/// Apply the warnings managed by VarDeclUsageChecker to the top level
/// code declarations that haven't been checked yet.
void swift::
performTopLevelDeclDiagnostics(TypeChecker &TC, TopLevelCodeDecl *TLCD) {
VarDeclUsageChecker checker(TC.Diags);
TLCD->walk(checker);
}
/// Perform diagnostics for func/init/deinit declarations.
void swift::performAbstractFuncDeclDiagnostics(TypeChecker &TC,
AbstractFunctionDecl *AFD) {
assert(AFD->getBody() && "Need a body to check");
// Don't produce these diagnostics for implicitly generated code.
if (AFD->getLoc().isInvalid() || AFD->isImplicit() || AFD->isInvalid())
return;
// Check for unused variables, as well as variables that are could be
// declared as constants.
AFD->getBody()->walk(VarDeclUsageChecker(TC, AFD));
}
// Perform MiscDiagnostics on Switch Statements.
static void checkSwitch(TypeChecker &TC, const SwitchStmt *stmt) {
// We want to warn about "case .Foo, .Bar where 1 != 100:" since the where
// clause only applies to the second case, and this is surprising.
for (auto cs : stmt->getCases()) {
TC.checkUnsupportedProtocolType(cs);
// The case statement can have multiple case items, each can have a where.
// If we find a "where", and there is a preceding item without a where, and
// if they are on the same source line, then warn.
auto items = cs->getCaseLabelItems();
// Don't do any work for the vastly most common case.
if (items.size() == 1) continue;
// Ignore the first item, since it can't have preceding ones.
for (unsigned i = 1, e = items.size(); i != e; ++i) {
// Must have a where clause.
auto where = items[i].getGuardExpr();
if (!where)
continue;
// Preceding item must not.
if (items[i-1].getGuardExpr())
continue;
// Must be on the same source line.
auto prevLoc = items[i-1].getStartLoc();
auto thisLoc = items[i].getStartLoc();
if (prevLoc.isInvalid() || thisLoc.isInvalid())
continue;
auto &SM = TC.Context.SourceMgr;
auto prevLineCol = SM.getLineAndColumn(prevLoc);
if (SM.getLineNumber(thisLoc) != prevLineCol.first)
continue;
TC.diagnose(items[i].getWhereLoc(), diag::where_on_one_item)
.highlight(items[i].getPattern()->getSourceRange())
.highlight(where->getSourceRange());
// Whitespace it out to the same column as the previous item.
std::string whitespace(prevLineCol.second-1, ' ');
TC.diagnose(thisLoc, diag::add_where_newline)
.fixItInsert(thisLoc, "\n"+whitespace);
auto whereRange = SourceRange(items[i].getWhereLoc(),
where->getEndLoc());
auto charRange = Lexer::getCharSourceRangeFromSourceRange(SM, whereRange);
auto whereText = SM.extractText(charRange);
TC.diagnose(prevLoc, diag::duplicate_where)
.fixItInsertAfter(items[i-1].getEndLoc(), " " + whereText.str())
.highlight(items[i-1].getSourceRange());
}
}
}
void swift::fixItEncloseTrailingClosure(TypeChecker &TC,
InFlightDiagnostic &diag,
const CallExpr *call,
Identifier closureLabel) {
auto argsExpr = call->getArg();
if (auto TSE = dyn_cast<TupleShuffleExpr>(argsExpr))
argsExpr = TSE->getSubExpr();
SmallString<32> replacement;
SourceLoc lastLoc;
SourceRange closureRange;
if (auto PE = dyn_cast<ParenExpr>(argsExpr)) {
assert(PE->hasTrailingClosure() && "must have trailing closure");
closureRange = PE->getSubExpr()->getSourceRange();
lastLoc = PE->getLParenLoc(); // e.g funcName() { 1 }
if (!lastLoc.isValid()) {
// Bare trailing closure: e.g. funcName { 1 }
replacement = "(";
lastLoc = call->getFn()->getEndLoc();
}
} else if (auto TE = dyn_cast<TupleExpr>(argsExpr)) {
// Tuple + trailing closure: e.g. funcName(x: 1) { 1 }
assert(TE->hasTrailingClosure() && "must have trailing closure");
auto numElements = TE->getNumElements();
assert(numElements >= 2 && "Unexpected num of elements in TupleExpr");
closureRange = TE->getElement(numElements - 1)->getSourceRange();
lastLoc = TE->getElement(numElements - 2)->getEndLoc();
replacement = ", ";
} else {
// Can't be here.
return;
}
// Add argument label of the closure.
if (!closureLabel.empty()) {
replacement += closureLabel.str();
replacement += ": ";
}
lastLoc = Lexer::getLocForEndOfToken(TC.Context.SourceMgr, lastLoc);
diag
.fixItReplaceChars(lastLoc, closureRange.Start, replacement)
.fixItInsertAfter(closureRange.End, ")");
}
// Perform checkStmtConditionTrailingClosure for single expression.
static void checkStmtConditionTrailingClosure(TypeChecker &TC, const Expr *E) {
if (E == nullptr || isa<ErrorExpr>(E)) return;
// Shallow walker. just dig into implicit expression.
class DiagnoseWalker : public ASTWalker {
TypeChecker &TC;
void diagnoseIt(const CallExpr *E) {
if (!E->hasTrailingClosure()) return;
auto argsExpr = E->getArg();
auto argsTy = argsExpr->getType();
// Ignore invalid argument type. Some diagnostics are already emitted.
if (!argsTy || argsTy->hasError()) return;
if (auto TSE = dyn_cast<TupleShuffleExpr>(argsExpr))
argsExpr = TSE->getSubExpr();
SourceLoc closureLoc;
if (auto PE = dyn_cast<ParenExpr>(argsExpr))
closureLoc = PE->getSubExpr()->getStartLoc();
else if (auto TE = dyn_cast<TupleExpr>(argsExpr))
closureLoc = TE->getElements().back()->getStartLoc();
Identifier closureLabel;
if (auto TT = argsTy->getAs<TupleType>()) {
assert(TT->getNumElements() != 0 && "Unexpected empty TupleType");
closureLabel = TT->getElement(TT->getNumElements() - 1).getName();
}
auto diag = TC.diagnose(closureLoc,
diag::trailing_closure_requires_parens);
fixItEncloseTrailingClosure(TC, diag, E, closureLabel);
}
public:
DiagnoseWalker(TypeChecker &tc) : TC(tc) { }
std::pair<bool, Expr *> walkToExprPre(Expr *E) override {
// Dig into implicit expression.
if (E->isImplicit()) return { true, E };
// Diagnose call expression.
if (auto CE = dyn_cast<CallExpr>(E))
diagnoseIt(CE);
// Don't dig any further.
return { false, E };
}
};
DiagnoseWalker Walker(TC);
const_cast<Expr *>(E)->walk(Walker);
}
/// \brief Diagnose trailing closure in statement-conditions.
///
/// Conditional statements, including 'for' or `switch` doesn't allow ambiguous
/// trailing closures in these conditions part. Even if the parser can recover
/// them, we force them to disambiguate.
//
/// E.g.:
/// if let _ = arr?.map {$0+1} { ... }
/// for _ in numbers.filter {$0 > 4} { ... }
static void checkStmtConditionTrailingClosure(TypeChecker &TC, const Stmt *S) {
if (auto LCS = dyn_cast<LabeledConditionalStmt>(S)) {
for (auto elt : LCS->getCond()) {
if (elt.getKind() == StmtConditionElement::CK_PatternBinding)
checkStmtConditionTrailingClosure(TC, elt.getInitializer());
else if (elt.getKind() == StmtConditionElement::CK_Boolean)
checkStmtConditionTrailingClosure(TC, elt.getBoolean());
// No trailing closure for CK_Availability: e.g. `if #available() {}`.
}
} else if (auto SS = dyn_cast<SwitchStmt>(S)) {
checkStmtConditionTrailingClosure(TC, SS->getSubjectExpr());
} else if (auto FES = dyn_cast<ForEachStmt>(S)) {
checkStmtConditionTrailingClosure(TC, FES->getSequence());
checkStmtConditionTrailingClosure(TC, FES->getWhere());
} else if (auto DCS = dyn_cast<DoCatchStmt>(S)) {
for (auto CS : DCS->getCatches())
checkStmtConditionTrailingClosure(TC, CS->getGuardExpr());
}
}
static Optional<ObjCSelector>
parseObjCSelector(ASTContext &ctx, StringRef string) {
// Find the first colon.
auto colonPos = string.find(':');
// If there is no colon, we have a nullary selector.
if (colonPos == StringRef::npos) {
if (string.empty() || !Lexer::isIdentifier(string)) return None;
return ObjCSelector(ctx, 0, { ctx.getIdentifier(string) });
}
SmallVector<Identifier, 2> pieces;
do {
// Check whether we have a valid selector piece.
auto piece = string.substr(0, colonPos);
if (piece.empty()) {
pieces.push_back(Identifier());
} else {
if (!Lexer::isIdentifier(piece)) return None;
pieces.push_back(ctx.getIdentifier(piece));
}
// Move to the next piece.
string = string.substr(colonPos+1);
colonPos = string.find(':');
} while (colonPos != StringRef::npos);
// If anything remains of the string, it's not a selector.
if (!string.empty()) return None;
return ObjCSelector(ctx, pieces.size(), pieces);
}
namespace {
class ObjCSelectorWalker : public ASTWalker {
TypeChecker &TC;
const DeclContext *DC;
Type SelectorTy;
/// Determine whether a reference to the given method via its
/// enclosing class/protocol is ambiguous (and, therefore, needs to
/// be disambiguated with a coercion).
bool isSelectorReferenceAmbiguous(AbstractFunctionDecl *method) {
// Determine the name we would search for. If there are no
// argument names, our lookup will be based solely on the base
// name.
DeclName lookupName = method->getFullName();
if (lookupName.getArgumentNames().empty())
lookupName = lookupName.getBaseName();
// Look for members with the given name.
auto nominal = method->getDeclContext()->getSelfNominalTypeDecl();
auto result = TC.lookupMember(const_cast<DeclContext *>(DC),
nominal->getDeclaredInterfaceType(),
lookupName,
(defaultMemberLookupOptions |
NameLookupFlags::KnownPrivate));
// If we didn't find multiple methods, there is no ambiguity.
if (result.size() < 2) return false;
// If we found more than two methods, it's ambiguous.
if (result.size() > 2) return true;
// Dig out the methods.
auto firstMethod = dyn_cast<FuncDecl>(result[0].getValueDecl());
auto secondMethod = dyn_cast<FuncDecl>(result[1].getValueDecl());
if (!firstMethod || !secondMethod) return true;
// If one is a static/class method and the other is not...
if (firstMethod->isStatic() == secondMethod->isStatic()) return true;
// ... overload resolution will prefer the static method. Check
// that it has the correct selector. We don't even care that it's
// the same method we're asking for, just that it has the right
// selector.
FuncDecl *staticMethod =
firstMethod->isStatic() ? firstMethod : secondMethod;
return staticMethod->getObjCSelector() != method->getObjCSelector();
}
public:
ObjCSelectorWalker(TypeChecker &tc, const DeclContext *dc, Type selectorTy)
: TC(tc), DC(dc), SelectorTy(selectorTy) { }
std::pair<bool, Expr *> walkToExprPre(Expr *expr) override {
auto *stringLiteral = dyn_cast<StringLiteralExpr>(expr);
bool fromStringLiteral = false;
bool hadParens = false;
if (stringLiteral) {
// Is this a string literal that has type 'Selector'.
if (!stringLiteral->getType() ||
!stringLiteral->getType()->isEqual(SelectorTy))
return { true, expr };
fromStringLiteral = true;
// FIXME: hadParens
} else {
// Is this an initialization of 'Selector'?
auto call = dyn_cast<CallExpr>(expr);
if (!call) return { true, expr };
// That produce Selectors.
if (!call->getType() || !call->getType()->isEqual(SelectorTy))
return { true, expr };
// Via a constructor.
ConstructorDecl *ctor = nullptr;
if (auto ctorRefCall = dyn_cast<ConstructorRefCallExpr>(call->getFn())) {
if (auto ctorRef = dyn_cast<DeclRefExpr>(ctorRefCall->getFn()))
ctor = dyn_cast<ConstructorDecl>(ctorRef->getDecl());
else if (auto otherCtorRef =
dyn_cast<OtherConstructorDeclRefExpr>(ctorRefCall->getFn()))
ctor = otherCtorRef->getDecl();
}
if (!ctor) return { true, expr };
// Make sure the constructor is within Selector.
auto ctorContextType = ctor->getDeclContext()
->getSelfNominalTypeDecl()
->getDeclaredType();
if (!ctorContextType || !ctorContextType->isEqual(SelectorTy))
return { true, expr };
auto argNames = ctor->getFullName().getArgumentNames();
if (argNames.size() != 1) return { true, expr };
// Is this the init(stringLiteral:) initializer or init(_:) initializer?
if (argNames[0] == TC.Context.Id_stringLiteral)
fromStringLiteral = true;
else if (!argNames[0].empty())
return { true, expr };
Expr *arg = call->getArg();
if (auto paren = dyn_cast<ParenExpr>(arg))
arg = paren->getSubExpr();
else if (auto tuple = dyn_cast<TupleExpr>(arg))
arg = tuple->getElement(0);
else
return { true, expr };
// Track whether we had parentheses around the string literal.
if (auto paren = dyn_cast<ParenExpr>(arg)) {
hadParens = true;
arg = paren->getSubExpr();
}
// Check whether we have a string literal.
stringLiteral = dyn_cast<StringLiteralExpr>(arg);
if (!stringLiteral) return { true, expr };
}
/// Retrieve the parent expression that coerces to Selector, if
/// there is one.
auto getParentCoercion = [&]() -> CoerceExpr * {
auto parentExpr = Parent.getAsExpr();
if (!parentExpr) return nullptr;
auto coerce = dyn_cast<CoerceExpr>(parentExpr);
if (!coerce) return nullptr;
if (coerce->getType() && coerce->getType()->isEqual(SelectorTy))
return coerce;
return nullptr;
};
// Local function that adds the constructor syntax around string
// literals implicitly treated as a Selector.
auto addSelectorConstruction = [&](InFlightDiagnostic &diag) {
if (!fromStringLiteral) return;
// Introduce the beginning part of the Selector construction.
diag.fixItInsert(stringLiteral->getLoc(), "Selector(");
if (auto coerce = getParentCoercion()) {
// If the string literal was coerced to Selector, replace the
// coercion with the ")".
SourceLoc endLoc = Lexer::getLocForEndOfToken(TC.Context.SourceMgr,
expr->getEndLoc());
diag.fixItReplace(SourceRange(endLoc, coerce->getEndLoc()), ")");
} else {
// Otherwise, just insert the closing ")".
diag.fixItInsertAfter(stringLiteral->getEndLoc(), ")");
}
};
// Try to parse the string literal as an Objective-C selector, and complain
// if it isn't one.
auto selector = parseObjCSelector(TC.Context, stringLiteral->getValue());
if (!selector) {
auto diag = TC.diagnose(stringLiteral->getLoc(),
diag::selector_literal_invalid);
diag.highlight(stringLiteral->getSourceRange());
addSelectorConstruction(diag);
return { true, expr };
}
// Look for methods with this selector.
SmallVector<AbstractFunctionDecl *, 8> allMethods;
DC->lookupAllObjCMethods(*selector, allMethods);
// If we didn't find any methods, complain.
if (allMethods.empty()) {
// If this was Selector(("selector-name")), suppress, the
// diagnostic.
if (!fromStringLiteral && hadParens)
return { true, expr };
{
auto diag = TC.diagnose(stringLiteral->getLoc(),
diag::selector_literal_undeclared,
*selector);
addSelectorConstruction(diag);
}
// If the result was from a Selector("selector-name"), add a
// separate note that suggests wrapping the selector in
// parentheses to silence the warning.
if (!fromStringLiteral) {
TC.diagnose(stringLiteral->getLoc(),
diag::selector_construction_suppress_warning)
.fixItInsert(stringLiteral->getStartLoc(), "(")
.fixItInsertAfter(stringLiteral->getEndLoc(), ")");
}
return { true, expr };
}
// Find the "best" method that has this selector, so we can report
// that.
AbstractFunctionDecl *bestMethod = nullptr;
for (auto method : allMethods) {
// If this is the first method, use it.
if (!bestMethod) {
bestMethod = method;
continue;
}
// If referencing the best method would produce an ambiguity and
// referencing the new method would not, we have a new "best".
if (isSelectorReferenceAmbiguous(bestMethod) &&
!isSelectorReferenceAmbiguous(method)) {
bestMethod = method;
continue;
}
// If this method is within a protocol...
if (auto proto = method->getDeclContext()->getSelfProtocolDecl()) {
// If the best so far is not from a protocol, or is from a
// protocol that inherits this protocol, we have a new best.
auto bestProto = bestMethod->getDeclContext()->getSelfProtocolDecl();
if (!bestProto || bestProto->inheritsFrom(proto))
bestMethod = method;
continue;
}
// This method is from a class.
auto classDecl = method->getDeclContext()->getSelfClassDecl();
// If the best method was from a protocol, keep it.
auto bestClassDecl = bestMethod->getDeclContext()->getSelfClassDecl();
if (!bestClassDecl) continue;
// If the best method was from a subclass of the place where
// this method was declared, we have a new best.
while (auto superclassDecl = bestClassDecl->getSuperclassDecl()) {
if (classDecl == superclassDecl) {
bestMethod = method;
break;
}
bestClassDecl = superclassDecl;
}
}
// If we have a best method, reference it.
if (bestMethod) {
// Form the replacement #selector expression.
SmallString<32> replacement;
{
llvm::raw_svector_ostream out(replacement);
auto nominal = bestMethod->getDeclContext()->getSelfNominalTypeDecl();
out << "#selector(";
DeclName name;
auto bestAccessor = dyn_cast<AccessorDecl>(bestMethod);
if (bestAccessor) {
switch (bestAccessor->getAccessorKind()) {
case AccessorKind::Get:
out << "getter: ";
name = bestAccessor->getStorage()->getFullName();
break;
case AccessorKind::Set:
case AccessorKind::WillSet:
case AccessorKind::DidSet:
out << "setter: ";
name = bestAccessor->getStorage()->getFullName();
break;
case AccessorKind::Address:
case AccessorKind::MutableAddress:
case AccessorKind::Read:
case AccessorKind::Modify:
llvm_unreachable("cannot be @objc");
}
} else {
name = bestMethod->getFullName();
}
out << nominal->getName().str() << "." << name.getBaseName();
auto argNames = name.getArgumentNames();
// Only print the parentheses if there are some argument
// names, because "()" would indicate a call.
if (!argNames.empty()) {
out << "(";
for (auto argName : argNames) {
if (argName.empty()) out << "_";
else out << argName.str();
out << ":";
}
out << ")";
}
// If there will be an ambiguity when referring to the method,
// introduce a coercion to resolve it to the method we found.
if (!bestAccessor && isSelectorReferenceAmbiguous(bestMethod)) {
if (auto fnType =
bestMethod->getInterfaceType()->getAs<FunctionType>()) {
// For static/class members, drop the metatype argument.
if (bestMethod->isStatic())
fnType = fnType->getResult()->getAs<FunctionType>();
// Coerce to this type.
out << " as ";
fnType->print(out);
}
}
out << ")";
}
// Emit the diagnostic.
SourceRange replacementRange = expr->getSourceRange();
if (auto coerce = getParentCoercion())
replacementRange.End = coerce->getEndLoc();
TC.diagnose(expr->getLoc(),
fromStringLiteral ? diag::selector_literal_deprecated_suggest
: diag::selector_construction_suggest)
.fixItReplace(replacementRange, replacement);
return { true, expr };
}
// If we couldn't pick a method to use for #selector, just wrap
// the string literal in Selector(...).
if (fromStringLiteral) {
auto diag = TC.diagnose(stringLiteral->getLoc(),
diag::selector_literal_deprecated);
addSelectorConstruction(diag);
return { true, expr };
}
return { true, expr };
}
};
} // end anonymous namespace
static void diagDeprecatedObjCSelectors(TypeChecker &tc, const DeclContext *dc,
const Expr *expr) {
auto selectorTy = tc.getObjCSelectorType(const_cast<DeclContext *>(dc));
if (!selectorTy) return;
const_cast<Expr *>(expr)->walk(ObjCSelectorWalker(tc, dc, selectorTy));
}
/// Diagnose things like this, where 'i' is an Int, not an Int?
/// if let x: Int = i {
static void
checkImplicitPromotionsInCondition(const StmtConditionElement &cond,
TypeChecker &TC) {
auto *p = cond.getPatternOrNull();
if (!p) return;
if (auto *subExpr = isImplicitPromotionToOptional(cond.getInitializer())) {
// If the subexpression was actually optional, then the pattern must be
// checking for a type, which forced it to be promoted to a double optional
// type.
if (auto ooType = subExpr->getType()->getOptionalObjectType()) {
if (auto TP = dyn_cast<TypedPattern>(p))
// Check for 'if let' to produce a tuned diagnostic.
if (isa<OptionalSomePattern>(TP->getSubPattern()) &&
TP->getSubPattern()->isImplicit()) {
TC.diagnose(cond.getIntroducerLoc(), diag::optional_check_promotion,
subExpr->getType())
.highlight(subExpr->getSourceRange())
.fixItReplace(TP->getTypeLoc().getSourceRange(),
ooType->getString());
return;
}
TC.diagnose(cond.getIntroducerLoc(),
diag::optional_pattern_match_promotion,
subExpr->getType(), cond.getInitializer()->getType())
.highlight(subExpr->getSourceRange());
return;
}
TC.diagnose(cond.getIntroducerLoc(), diag::optional_check_nonoptional,
subExpr->getType())
.highlight(subExpr->getSourceRange());
}
}
static void diagnoseUnintendedOptionalBehavior(TypeChecker &TC, const Expr *E,
const DeclContext *DC) {
if (!E || isa<ErrorExpr>(E) || !E->getType())
return;
class UnintendedOptionalBehaviorWalker : public ASTWalker {
TypeChecker &TC;
SmallPtrSet<Expr *, 16> IgnoredExprs;
class OptionalToAnyCoercion {
public:
Type DestType;
CoerceExpr *ParentCoercion;
bool shouldSuppressDiagnostic() {
// If we have a parent CoerceExpr that has the same type as our
// Optional-to-Any coercion, don't emit a diagnostic.
return ParentCoercion && ParentCoercion->getType()->isEqual(DestType);
}
};
/// Returns true iff a coercion from srcType to destType is an
/// Optional-to-Any coercion.
bool isOptionalToAnyCoercion(Type srcType, Type destType) {
size_t difference = 0;
return isOptionalToAnyCoercion(srcType, destType, difference);
}
/// Returns true iff a coercion from srcType to destType is an
/// Optional-to-Any coercion. On returning true, the value of 'difference'
/// will be the difference in the levels of optionality.
bool isOptionalToAnyCoercion(Type srcType, Type destType,
size_t &difference) {
SmallVector<Type, 4> destOptionals;
auto destValueType =
destType->lookThroughAllOptionalTypes(destOptionals);
if (!destValueType->isAny())
return false;
SmallVector<Type, 4> srcOptionals;
srcType->lookThroughAllOptionalTypes(srcOptionals);
if (srcOptionals.size() > destOptionals.size()) {
difference = srcOptionals.size() - destOptionals.size();
return true;
} else {
return false;
}
}
/// Returns true iff the collection upcast coercion is an Optional-to-Any
/// coercion.
bool isOptionalToAnyCoercion(CollectionUpcastConversionExpr::ConversionPair
conversion) {
if (!conversion.OrigValue || !conversion.Conversion)
return false;
auto srcType = conversion.OrigValue->getType();
auto destType = conversion.Conversion->getType();
return isOptionalToAnyCoercion(srcType, destType);
}
/// Looks through OptionalEvaluationExprs and InjectIntoOptionalExprs to
/// find a child ErasureExpr, returning nullptr if no such child is found.
/// Any intermediate OptionalEvaluationExprs will be marked as ignored.
ErasureExpr *findErasureExprThroughOptionalInjections(Expr *E) {
while (true) {
if (auto *next = dyn_cast<OptionalEvaluationExpr>(E)) {
// We don't want to re-visit any intermediate optional evaluations.
IgnoredExprs.insert(next);
E = next->getSubExpr();
} else if (auto *next = dyn_cast<InjectIntoOptionalExpr>(E)) {
E = next->getSubExpr();
} else {
break;
}
}
return dyn_cast<ErasureExpr>(E);
}
void emitSilenceOptionalAnyWarningWithCoercion(Expr *E, Type destType) {
SmallString<16> coercionString;
coercionString += " as ";
coercionString += destType->getWithoutParens()->getString();
TC.diagnose(E->getLoc(), diag::silence_optional_to_any,
destType, coercionString.substr(1))
.highlight(E->getSourceRange())
.fixItInsertAfter(E->getEndLoc(), coercionString);
}
static bool hasImplicitlyUnwrappedResult(Expr *E) {
auto getDeclForExpr = [&](Expr *E) -> ValueDecl * {
if (auto *call = dyn_cast<CallExpr>(E))
E = call->getDirectCallee();
if (auto *subscript = dyn_cast<SubscriptExpr>(E)) {
if (subscript->hasDecl())
return subscript->getDecl().getDecl();
return nullptr;
}
if (auto *memberRef = dyn_cast<MemberRefExpr>(E))
return memberRef->getMember().getDecl();
if (auto *declRef = dyn_cast<DeclRefExpr>(E))
return declRef->getDecl();
if (auto *apply = dyn_cast<ApplyExpr>(E))
return apply->getCalledValue();
return nullptr;
};
// Look through implicit conversions like loads, derived-to-base
// conversion, etc.
if (auto *ICE = dyn_cast<ImplicitConversionExpr>(E))
E = ICE->getSubExpr();
auto *decl = getDeclForExpr(E);
return decl
&& decl->getAttrs().hasAttribute<ImplicitlyUnwrappedOptionalAttr>();
}
void visitErasureExpr(ErasureExpr *E, OptionalToAnyCoercion coercion) {
if (coercion.shouldSuppressDiagnostic())
return;
auto subExpr = E->getSubExpr();
// Look through any BindOptionalExprs, as the coercion may have started
// from a higher level of optionality.
while (auto *bindExpr = dyn_cast<BindOptionalExpr>(subExpr))
subExpr = bindExpr->getSubExpr();
// Do not warn on coercions from implicitly unwrapped optionals
// for Swift versions less than 5.
if (!TC.Context.isSwiftVersionAtLeast(5) &&
hasImplicitlyUnwrappedResult(subExpr))
return;
// We're taking the source type from the child of any BindOptionalExprs,
// and the destination from the parent of any
// (InjectIntoOptional/OptionalEvaluation)Exprs in order to take into
// account any bindings that need to be done for nested Optional-to-Any
// coercions, e.g Int??? to Any?.
auto srcType = subExpr->getType();
auto destType = coercion.DestType;
size_t optionalityDifference = 0;
if (!isOptionalToAnyCoercion(srcType, destType, optionalityDifference))
return;
TC.diagnose(subExpr->getStartLoc(), diag::optional_to_any_coercion,
/* from */ srcType, /* to */ destType)
.highlight(subExpr->getSourceRange());
if (optionalityDifference == 1) {
TC.diagnose(subExpr->getLoc(), diag::default_optional_to_any)
.highlight(subExpr->getSourceRange())
.fixItInsertAfter(subExpr->getEndLoc(), " ?? <#default value#>");
}
SmallString<4> forceUnwrapString;
for (size_t i = 0; i < optionalityDifference; i++)
forceUnwrapString += "!";
TC.diagnose(subExpr->getLoc(), diag::force_optional_to_any)
.highlight(subExpr->getSourceRange())
.fixItInsertAfter(subExpr->getEndLoc(), forceUnwrapString);
emitSilenceOptionalAnyWarningWithCoercion(subExpr, destType);
}
void visitCollectionUpcastExpr(CollectionUpcastConversionExpr *E,
OptionalToAnyCoercion coercion) {
// We only need to consider the valueConversion, as the Key type of a
// Dictionary cannot be implicitly coerced to Any.
auto valueConversion = E->getValueConversion();
// We're handling the coercion of the entire collection, so we don't need
// to re-visit a nested ErasureExpr for the value.
if (auto conversionExpr = valueConversion.Conversion)
if (auto *erasureExpr =
findErasureExprThroughOptionalInjections(conversionExpr))
IgnoredExprs.insert(erasureExpr);
if (coercion.shouldSuppressDiagnostic() ||
!isOptionalToAnyCoercion(valueConversion))
return;
auto subExpr = E->getSubExpr();
TC.diagnose(subExpr->getStartLoc(), diag::optional_to_any_coercion,
/* from */ subExpr->getType(), /* to */ E->getType())
.highlight(subExpr->getSourceRange());
emitSilenceOptionalAnyWarningWithCoercion(subExpr, E->getType());
}
void visitPossibleOptionalToAnyExpr(Expr *E,
OptionalToAnyCoercion coercion) {
if (auto *upcastExpr =
dyn_cast<CollectionUpcastConversionExpr>(E)) {
visitCollectionUpcastExpr(upcastExpr, coercion);
} else if (auto *erasureExpr = dyn_cast<ErasureExpr>(E)) {
visitErasureExpr(erasureExpr, coercion);
} else if (auto *optionalEvalExpr = dyn_cast<OptionalEvaluationExpr>(E)) {
// The ErasureExpr could be nested within optional injections and
// bindings, such as is the case for e.g Int??? to Any?. Try and find
// and visit it directly, making sure we don't re-visit it later.
auto subExpr = optionalEvalExpr->getSubExpr();
if (auto *erasureExpr =
findErasureExprThroughOptionalInjections(subExpr)) {
visitErasureExpr(erasureExpr, coercion);
IgnoredExprs.insert(erasureExpr);
}
}
}
void visitInterpolatedStringLiteralExpr(InterpolatedStringLiteralExpr *E) {
// Warn about interpolated segments that contain optionals.
for (auto &segment : E->getSegments()) {
// Allow explicit casts.
if (auto paren = dyn_cast<ParenExpr>(segment))
if (isa<ExplicitCastExpr>(paren->getSubExpr()))
continue;
// Bail out if we don't have an optional.
if (!segment->getType()->getRValueType()->getOptionalObjectType())
continue;
TC.diagnose(segment->getStartLoc(),
diag::optional_in_string_interpolation_segment)
.highlight(segment->getSourceRange());
// Suggest 'String(describing: <expr>)'.
auto segmentStart = segment->getStartLoc().getAdvancedLoc(1);
TC.diagnose(segment->getLoc(),
diag::silence_optional_in_interpolation_segment_call)
.highlight(segment->getSourceRange())
.fixItInsert(segmentStart, "String(describing: ")
.fixItInsert(segment->getEndLoc(), ")");
// Suggest inserting a default value.
TC.diagnose(segment->getLoc(), diag::default_optional_to_any)
.highlight(segment->getSourceRange())
.fixItInsert(segment->getEndLoc(), " ?? <#default value#>");
}
}
std::pair<bool, Expr *> walkToExprPre(Expr *E) override {
if (!E || isa<ErrorExpr>(E) || !E->getType())
return { false, E };
if (auto *CE = dyn_cast<AbstractClosureExpr>(E))
if (!CE->hasSingleExpressionBody())
return { false, E };
if (IgnoredExprs.count(E))
return { true, E };
if (auto *literal = dyn_cast<InterpolatedStringLiteralExpr>(E)) {
visitInterpolatedStringLiteralExpr(literal);
} else if (auto *coercion = dyn_cast<CoerceExpr>(E)) {
// If we come across a CoerceExpr, visit its subExpr with the coercion
// as the parent, making sure we don't re-visit the subExpr later.
auto subExpr = coercion->getSubExpr();
visitPossibleOptionalToAnyExpr(subExpr,
{ subExpr->getType(), coercion });
IgnoredExprs.insert(subExpr);
} else {
visitPossibleOptionalToAnyExpr(E, { E->getType(), nullptr });
}
return { true, E };
}
public:
UnintendedOptionalBehaviorWalker(TypeChecker &tc) : TC(tc) { }
};
UnintendedOptionalBehaviorWalker Walker(TC);
const_cast<Expr *>(E)->walk(Walker);
}
static void diagnoseDeprecatedWritableKeyPath(TypeChecker &TC, const Expr *E,
const DeclContext *DC) {
if (!E || isa<ErrorExpr>(E) || !E->getType())
return;
class DeprecatedWritableKeyPathWalker : public ASTWalker {
TypeChecker &TC;
const DeclContext *DC;
void visitKeyPathApplicationExpr(KeyPathApplicationExpr *E) {
bool isWrite = false;
if (auto *P = Parent.getAsExpr())
if (auto *AE = dyn_cast<AssignExpr>(P))
if (AE->getDest() == E)
isWrite = true;
if (!isWrite)
return;
if (auto *keyPathExpr = dyn_cast<KeyPathExpr>(E->getKeyPath())) {
auto *decl = keyPathExpr->getType()->getNominalOrBoundGenericNominal();
if (decl != TC.Context.getWritableKeyPathDecl() &&
decl != TC.Context.getReferenceWritableKeyPathDecl())
return;
assert(keyPathExpr->getComponents().size() > 0);
auto &component = keyPathExpr->getComponents().back();
if (component.getKind() == KeyPathExpr::Component::Kind::Property) {
auto *storage =
cast<AbstractStorageDecl>(component.getDeclRef().getDecl());
if (!storage->isSettable(nullptr) ||
!storage->isSetterAccessibleFrom(DC)) {
TC.diagnose(keyPathExpr->getLoc(),
swift::diag::expr_deprecated_writable_keypath,
storage->getFullName());
}
}
}
}
std::pair<bool, Expr *> walkToExprPre(Expr *E) override {
if (!E || isa<ErrorExpr>(E) || !E->getType())
return {false, E};
if (auto *KPAE = dyn_cast<KeyPathApplicationExpr>(E)) {
visitKeyPathApplicationExpr(KPAE);
return {true, E};
}
return {true, E};
}
public:
DeprecatedWritableKeyPathWalker(TypeChecker &TC, const DeclContext *DC)
: TC(TC), DC(DC) {}
};
DeprecatedWritableKeyPathWalker Walker(TC, DC);
const_cast<Expr *>(E)->walk(Walker);
}
//===----------------------------------------------------------------------===//
// High-level entry points.
//===----------------------------------------------------------------------===//
/// \brief Emit diagnostics for syntactic restrictions on a given expression.
void swift::performSyntacticExprDiagnostics(TypeChecker &TC, const Expr *E,
const DeclContext *DC,
bool isExprStmt) {
TC.diagnoseSelfAssignment(E);
diagSyntacticUseRestrictions(TC, E, DC, isExprStmt);
diagRecursivePropertyAccess(TC, E, DC);
diagnoseImplicitSelfUseInClosure(TC, E, DC);
diagnoseUnintendedOptionalBehavior(TC, E, DC);
if (!TC.Context.isSwiftVersionAtLeast(5))
diagnoseDeprecatedWritableKeyPath(TC, E, DC);
if (!TC.getLangOpts().DisableAvailabilityChecking)
diagAvailability(TC, E, const_cast<DeclContext*>(DC));
if (TC.Context.LangOpts.EnableObjCInterop)
diagDeprecatedObjCSelectors(TC, DC, E);
}
void swift::performStmtDiagnostics(TypeChecker &TC, const Stmt *S) {
TC.checkUnsupportedProtocolType(const_cast<Stmt *>(S));
if (auto switchStmt = dyn_cast<SwitchStmt>(S))
checkSwitch(TC, switchStmt);
checkStmtConditionTrailingClosure(TC, S);
// Check for implicit optional promotions in stmt-condition patterns.
if (auto *lcs = dyn_cast<LabeledConditionalStmt>(S))
for (const auto &elt : lcs->getCond())
checkImplicitPromotionsInCondition(elt, TC);
}
//===----------------------------------------------------------------------===//
// Utility functions
//===----------------------------------------------------------------------===//
void swift::fixItAccess(InFlightDiagnostic &diag, ValueDecl *VD,
AccessLevel desiredAccess, bool isForSetter) {
StringRef fixItString;
switch (desiredAccess) {
case AccessLevel::Private: fixItString = "private "; break;
case AccessLevel::FilePrivate: fixItString = "fileprivate "; break;
case AccessLevel::Internal: fixItString = "internal "; break;
case AccessLevel::Public: fixItString = "public "; break;
case AccessLevel::Open: fixItString = "open "; break;
}
DeclAttributes &attrs = VD->getAttrs();
AbstractAccessControlAttr *attr;
if (isForSetter) {
attr = attrs.getAttribute<SetterAccessAttr>();
cast<AbstractStorageDecl>(VD)->overwriteSetterAccess(desiredAccess);
} else {
attr = attrs.getAttribute<AccessControlAttr>();
VD->overwriteAccess(desiredAccess);
if (auto *ASD = dyn_cast<AbstractStorageDecl>(VD)) {
if (auto *getter = ASD->getGetter())
getter->overwriteAccess(desiredAccess);
if (auto *setterAttr = attrs.getAttribute<SetterAccessAttr>()) {
if (setterAttr->getAccess() > desiredAccess)
fixItAccess(diag, VD, desiredAccess, true);
} else {
ASD->overwriteSetterAccess(desiredAccess);
}
}
}
if (isForSetter && VD->getFormalAccess() == desiredAccess) {
assert(attr);
attr->setInvalid();
// Remove the setter attribute.
diag.fixItRemove(attr->Range);
} else if (attr) {
// If the formal access already matches the desired access, the problem
// must be in a parent scope. Don't emit a fix-it.
// FIXME: It's also possible for access to already be /broader/ than what's
// desired, in which case the problem is also in a parent scope. However,
// this function is sometimes called to make access narrower, so assuming
// that a broader scope is acceptable breaks some diagnostics.
if (attr->getAccess() != desiredAccess) {
// This uses getLocation() instead of getRange() because we don't want to
// replace the "(set)" part of a setter attribute.
diag.fixItReplace(attr->getLocation(), fixItString.drop_back());
attr->setInvalid();
}
} else if (auto var = dyn_cast<VarDecl>(VD)) {
if (auto PBD = var->getParentPatternBinding())
diag.fixItInsert(PBD->getStartLoc(), fixItString);
} else {
diag.fixItInsert(VD->getStartLoc(), fixItString);
}
}
/// Retrieve the type name to be used for determining whether we can
/// omit needless words.
static OmissionTypeName getTypeNameForOmission(Type type) {
if (!type)
return "";
ASTContext &ctx = type->getASTContext();
Type boolType;
if (auto boolDecl = ctx.getBoolDecl())
boolType = boolDecl->getDeclaredInterfaceType();
Type objcBoolType;
if (auto objcBoolDecl = ctx.getObjCBoolDecl())
objcBoolType = objcBoolDecl->getDeclaredInterfaceType();
/// Determine the options associated with the given type.
auto getOptions = [&](Type type) {
// Look for Boolean types.
OmissionTypeOptions options;
// Look for Boolean types.
if (boolType && type->isEqual(boolType)) {
// Swift.Bool
options |= OmissionTypeFlags::Boolean;
} else if (objcBoolType && type->isEqual(objcBoolType)) {
// ObjectiveC.ObjCBool
options |= OmissionTypeFlags::Boolean;
}
return options;
};
do {
// Look through typealiases.
if (auto aliasTy = dyn_cast<NameAliasType>(type.getPointer())) {
type = aliasTy->getSinglyDesugaredType();
continue;
}
// Strip off lvalue/inout types.
Type newType = type->getWithoutSpecifierType();
if (newType.getPointer() != type.getPointer()) {
type = newType;
continue;
}
// Look through reference-storage types.
newType = type->getReferenceStorageReferent();
if (newType.getPointer() != type.getPointer()) {
type = newType;
continue;
}
// Look through parentheses.
type = type->getWithoutParens();
// Look through optionals.
if (auto optObjectTy = type->getOptionalObjectType()) {
type = optObjectTy;
continue;
}
break;
} while (true);
// Nominal types.
if (auto nominal = type->getAnyNominal()) {
// If we have a collection, get the element type.
if (auto bound = type->getAs<BoundGenericType>()) {
ASTContext &ctx = nominal->getASTContext();
auto args = bound->getGenericArgs();
if (!args.empty() &&
(bound->getDecl() == ctx.getArrayDecl() ||
bound->getDecl() == ctx.getSetDecl())) {
return OmissionTypeName(nominal->getName().str(),
getOptions(bound),
getTypeNameForOmission(args[0]).Name);
}
}
// AnyObject -> "Object".
if (type->isAnyObject())
return "Object";
return OmissionTypeName(nominal->getName().str(), getOptions(type));
}
// Generic type parameters.
if (auto genericParamTy = type->getAs<GenericTypeParamType>()) {
if (auto genericParam = genericParamTy->getDecl())
return genericParam->getName().str();
return "";
}
// Dependent members.
if (auto dependentMemberTy = type->getAs<DependentMemberType>()) {
return dependentMemberTy->getName().str();
}
// Archetypes.
if (auto archetypeTy = type->getAs<ArchetypeType>()) {
return archetypeTy->getName().str();
}
// Function types.
if (auto funcTy = type->getAs<AnyFunctionType>()) {
if (funcTy->getRepresentation() == AnyFunctionType::Representation::Block)
return "Block";
return "Function";
}
return "";
}
Optional<DeclName> TypeChecker::omitNeedlessWords(AbstractFunctionDecl *afd) {
auto &Context = afd->getASTContext();
if (!afd->hasInterfaceType())
validateDecl(afd);
if (afd->isInvalid() || isa<DestructorDecl>(afd))
return None;
DeclName name = afd->getFullName();
if (!name)
return None;
// String'ify the arguments.
StringRef baseNameStr = name.getBaseName().userFacingName();
SmallVector<StringRef, 4> argNameStrs;
for (auto arg : name.getArgumentNames()) {
if (arg.empty())
argNameStrs.push_back("");
else
argNameStrs.push_back(arg.str());
}
// String'ify the parameter types.
SmallVector<OmissionTypeName, 4> paramTypes;
// Always look at the parameters in the last parameter list.
for (auto param : *afd->getParameters()) {
paramTypes.push_back(getTypeNameForOmission(param->getInterfaceType())
.withDefaultArgument(param->isDefaultArgument()));
}
// Handle contextual type, result type, and returnsSelf.
Type contextType = afd->getDeclContext()->getDeclaredInterfaceType();
Type resultType;
bool returnsSelf = false;
if (auto func = dyn_cast<FuncDecl>(afd)) {
resultType = func->getResultInterfaceType();
resultType = func->mapTypeIntoContext(resultType);
returnsSelf = func->hasDynamicSelf();
} else if (isa<ConstructorDecl>(afd)) {
resultType = contextType;
returnsSelf = true;
}
// Figure out the first parameter name.
StringRef firstParamName;
auto params = afd->getParameters();
if (params->size() != 0 && !params->get(0)->getName().empty())
firstParamName = params->get(0)->getName().str();
StringScratchSpace scratch;
if (!swift::omitNeedlessWords(baseNameStr, argNameStrs, firstParamName,
getTypeNameForOmission(resultType),
getTypeNameForOmission(contextType),
paramTypes, returnsSelf, false,
/*allPropertyNames=*/nullptr, scratch))
return None;
/// Retrieve a replacement identifier.
auto getReplacementIdentifier = [&](StringRef name,
DeclBaseName old) -> DeclBaseName{
if (name.empty())
return Identifier();
if (!old.empty() && name == old.userFacingName())
return old;
return Context.getIdentifier(name);
};
auto newBaseName = getReplacementIdentifier(
baseNameStr, name.getBaseName());
SmallVector<Identifier, 4> newArgNames;
auto oldArgNames = name.getArgumentNames();
for (unsigned i = 0, n = argNameStrs.size(); i != n; ++i) {
auto argBaseName = getReplacementIdentifier(argNameStrs[i],
oldArgNames[i]);
newArgNames.push_back(argBaseName.getIdentifier());
}
return DeclName(Context, newBaseName, newArgNames);
}
Optional<Identifier> TypeChecker::omitNeedlessWords(VarDecl *var) {
auto &Context = var->getASTContext();
if (!var->hasInterfaceType())
validateDecl(var);
if (var->isInvalid() || !var->hasInterfaceType())
return None;
if (var->getName().empty())
return None;
auto name = var->getName().str();
// Dig out the context type.
Type contextType = var->getDeclContext()->getDeclaredInterfaceType();
if (!contextType)
return None;
// Dig out the type of the variable.
Type type = var->getInterfaceType()->getReferenceStorageReferent()
->getWithoutSpecifierType();
while (auto optObjectTy = type->getOptionalObjectType())
type = optObjectTy;
// Omit needless words.
StringScratchSpace scratch;
OmissionTypeName typeName = getTypeNameForOmission(var->getInterfaceType());
OmissionTypeName contextTypeName = getTypeNameForOmission(contextType);
if (::omitNeedlessWords(name, { }, "", typeName, contextTypeName, { },
/*returnsSelf=*/false, true,
/*allPropertyNames=*/nullptr, scratch)) {
return Context.getIdentifier(name);
}
return None;
}
| natecook1000/swift | lib/Sema/MiscDiagnostics.cpp | C++ | apache-2.0 | 156,126 | [
30522,
1013,
30524,
1011,
1011,
1011,
1011,
1011,
1027,
1027,
1027,
1013,
1013,
1013,
1013,
1013,
1013,
2023,
3120,
5371,
2003,
2112,
1997,
1996,
9170,
1012,
8917,
2330,
3120,
2622,
1013,
1013,
1013,
1013,
9385,
1006,
1039,
1007,
2297,
10... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package engine.detector;
import engine.model.state.Keyword;
import engine.utils.Response;
import engine.functions.Function;
import engine.functions.util.FunctionsStorage;
import java.util.List;
import java.util.Map;
import logging.utils.Verbose;
/**
*
* @author Eran
*/
public class TopicDetector implements Verbose{
/** Holds the Keyword objects that belong to the given ConversationState. */
protected List<Keyword> stateKeywords;
/** Holds the general purpose Keyword objects. */
protected List<Keyword> generalKeywords;
/** Holds the storage on the Function Objects. */
protected FunctionsStorage functions;
/** Store all regular expression matches. */
protected Map<String,String> dictionary;
/**
* The constructor.
*
* @param dictionary- holds all regular expression matches.
*/
public TopicDetector(Map<String,String> dictionary){
this.dictionary = dictionary;
}
/**
* introduces a new Function storage here.
*
* @param functions- a storage of read to be used of Function Objects.
*/
public void setFunctionStorage(FunctionsStorage functions){
this.functions = functions;
}
/**
* Introduces new Keyword Objects that belong to a given ConversationState.
*
* @param keywords- Keyword Objects that belong to a given ConversationState.
*/
public void setConversationFunctions(List<Keyword> keywords){
this.stateKeywords = keywords;
}
/**
* Introduces new Keyword Objects that should be invoked regardless a given ConversationState.
*
* @param keywords- Keyword Objects that belong to a given ConversationState.
*/
public void setLargeScaleKeyword(List<Keyword> keywords){
this.generalKeywords = keywords;
}
/**
* Try to match a proper response to the given text.
*
* @param text- the text to analyze.
*
* @return a proper response, on null if no such was found.
*/
public Response getResponse(String text){
int bestMatch = -1;
Keyword match = null;
String responseText = null;
// 1. look at the ones that belong to ConversationState.
int len = stateKeywords.size();
for(int i=0;i<len;i++)
{
Keyword keyword = stateKeywords.get(i);
Function function = fetchFunctionObject(text,keyword);
if(function==null)
{ // A bad function, just move on.
continue;
}
int score = function.getScore();
if(score>-1 && score>bestMatch)
{ // If this match is better than best match, replace it.
match = keyword;
bestMatch = score;
responseText = function.getResponse();
verbose("found a match for text("+text+"): "+match);
}
}
verbose("message: "+text+", state functions- match:"+match);
if(generalKeywords!=null)
{ // 2. look at the ones that belong to the general Keyword Objects.
len = generalKeywords.size();
for(int i=0;i<len;i++)
{
Keyword keyword = generalKeywords.get(i);
Function function = fetchFunctionObject(text,keyword);
if(function==null)
{
continue;
}
int score = function.getScore();
if(score>-1 && score>bestMatch)
{ // If this match is better than best match, replace it.
match = keyword;
bestMatch = score;
responseText = function.getResponse();
}
}
}
verbose("message: "+text+", default functions- match:"+match);
if(match==null)
{
return null;
}
Response response = new Response(bestMatch,match.getNext(),match.get("nextHappyID"),match.get("nextUnhappyID"),responseText);
return response;
}
/**
* Return a Function Object ready to be used.
*
* @param text- the text to match.
* @param keyword- the keyword to use.
*
* @return a Function Object ready to be used.
*/
protected Function fetchFunctionObject(String text, Keyword keyword){
String functionname = keyword.getClassOfFunction();
Function function = functions.getOrCreate(functionname);
if(function==null)
{
return null;
}
Map<String,String> parameters = keyword.getParameters();
function.setParameters(parameters);
function.setDictionary(dictionary);
function.setText(text);
return function;
}
} | ersh112356/ConversationEngine | src/engine/detector/TopicDetector.java | Java | gpl-3.0 | 5,414 | [
30522,
1013,
1008,
1008,
2000,
2689,
2023,
6105,
20346,
1010,
5454,
6105,
20346,
2015,
1999,
2622,
5144,
1012,
1008,
2000,
2689,
2023,
23561,
5371,
1010,
5454,
5906,
1064,
23561,
2015,
1008,
1998,
2330,
1996,
23561,
1999,
1996,
3559,
1012,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
using System;
namespace BinarySearchTree
{
class Program
{
static void Main(string[] args)
{
Tree testTree = new Tree();
Node root = null;
root = testTree.Add(root, 2);
testTree.Add(root, 1);
testTree.Add(root, 3);
Console.Read();
}
}
}
| Trey64/data-structures3 | BinarySearchTree/Program.cs | C# | mit | 353 | [
30522,
2478,
2291,
1025,
3415,
15327,
12441,
17310,
11140,
13334,
1063,
2465,
2565,
1063,
10763,
11675,
2364,
1006,
5164,
1031,
1033,
12098,
5620,
1007,
1063,
3392,
3231,
13334,
1027,
2047,
3392,
1006,
1007,
1025,
13045,
7117,
1027,
19701,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
/*
* sbt
* Copyright 2011 - 2018, Lightbend, Inc.
* Copyright 2008 - 2010, Mark Harrah
* Licensed under Apache License 2.0 (see LICENSE)
*/
package sbt
import org.scalacheck._
import Prop._
import TaskGen._
object TaskRunnerSortTest extends Properties("TaskRunnerSort") {
property("sort") = forAll(TaskListGen, MaxWorkersGen) { (list: List[Int], workers: Int) =>
val a = list.toArray
val sorted = a.toArray
java.util.Arrays.sort(sorted)
("Workers: " + workers) |: ("Array: " + a.toList) |: {
def result = tryRun(sort(a.toSeq), false, if (workers > 0) workers else 1)
checkResult(result.toList, sorted.toList)
}
}
final def sortDirect(a: Seq[Int]): Seq[Int] = {
if (a.length < 2)
a
else {
val pivot = a(0)
val (lt, gte) = a.view.drop(1).partition(_ < pivot)
sortDirect(lt.toSeq) ++ List(pivot) ++ sortDirect(gte.toSeq)
}
}
final def sort(a: Seq[Int]): Task[Seq[Int]] = {
if (a.length < 200)
task(sortDirect(a))
else {
task(a) flatMap { a =>
val pivot = a(0)
val (lt, gte) = a.view.drop(1).partition(_ < pivot)
sbt.Test.t2(sort(lt.toSeq), sort(gte.toSeq)) map {
case (l, g) => l ++ List(pivot) ++ g
}
}
}
}
}
| xuwei-k/xsbt | tasks-standard/src/test/scala/TestRunnerSort.scala | Scala | apache-2.0 | 1,267 | [
30522,
1013,
1008,
1008,
24829,
2102,
1008,
9385,
2249,
1011,
2760,
1010,
2422,
10609,
2094,
1010,
4297,
1012,
1008,
9385,
2263,
1011,
2230,
1010,
2928,
5292,
11335,
2232,
1008,
7000,
2104,
15895,
6105,
1016,
1012,
1014,
1006,
2156,
6105,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
// [branch 012] Include support for registering onCommit handlers:
#include "/home/chao/gcc/src/gcc_trunk/libitm/libitm.h"
#include "tm_utils.h"
#include "memcached.h"
// [branch 008] This is our 'safe' assert function...
#if !defined(NDEBUG)
void tm_assert_internal(const char *filename, int linenum, const char *funcname, const char *sourceline)
{
// [mfs] This isn't entirely correct... the formatting is wrong for
// Solaris, and on Linux we are supposed to also print the name of the
// executable... we can live without such touch-ups for now...
fprintf(stderr, "%s:%d: %s: Assertion '%s' failed.\n", filename, linenum, funcname, sourceline);
abort();
}
#endif
// [branch 008] This is our 'safe' printf-and-abort function
void tm_msg_and_die(const char* msg)
{
fprintf(stderr, msg);
abort();
}
// [branch 009] Provide an implementation of memcmp that is transaction_safe
//
// NB: this code was taken from
// http://doxygen.postgresql.org/memcmp_8c_source.html, and is covered by a
// BSD license
int tm_memcmp(const void *s1, const void *s2, size_t n)
{
if (n != 0) {
const unsigned char *p1 = s1, *p2 = s2;
do
{
if (*p1++ != *p2++)
return (*--p1 - *--p2);
} while (--n != 0);
}
return 0;
}
// [branch 009] Provide an implementation of memcpy that is transaction_safe
//
// NB: this code was taken from
// https://www.student.cs.uwaterloo.ca/~cs350/common/os161-src-html/memcpy_8c-source.html
void * tm_memcpy(void *dst, const void *src, size_t len)
{
size_t i;
/*
* memcpy does not support overlapping buffers, so always do it
* forwards. (Don't change this without adjusting memmove.)
*
* For speedy copying, optimize the common case where both pointers
* and the length are word-aligned, and copy word-at-a-time instead
* of byte-at-a-time. Otherwise, copy by bytes.
*
* The alignment logic below should be portable. We rely on
* the compiler to be reasonably intelligent about optimizing
* the divides and modulos out. Fortunately, it is.
*/
if ((uintptr_t)dst % sizeof(long) == 0 &&
(uintptr_t)src % sizeof(long) == 0 &&
len % sizeof(long) == 0)
{
long *d = dst;
const long *s = src;
for (i=0; i<len/sizeof(long); i++) {
d[i] = s[i];
}
}
else {
char *d = dst;
const char *s = src;
for (i=0; i<len; i++) {
d[i] = s[i];
}
}
return dst;
}
// [branch 009] provide a safe implementation of strlen
//
// NB: this code is taken from
// https://www.student.cs.uwaterloo.ca/~cs350/common/os161-src-html/strlen_8c-source.html
size_t tm_strlen(const char *s)
{
size_t ret = 0;
while (s[ret]) {
ret++;
}
return ret;
}
// [branch 009] provide a safe implementation of strncmp
//
// NB: this code is taken from
// http://www.ethernut.de/api/strncmp_8c_source.html
int tm_strncmp(const char *s1, const char *s2, size_t n)
{
if (n == 0)
return (0);
do {
if (*s1 != *s2++)
return (*(unsigned char *) s1 - *(unsigned char *) --s2);
if (*s1++ == 0)
break;
} while (--n != 0);
return (0);
}
// [branch 009] Provide a safe strncpy function
//
// NB: this code is taken from
// http://www.ethernut.de/api/strncpy_8c_source.html
char *tm_strncpy(char *dst, const char *src, size_t n)
{
if (n != 0) {
char *d = dst;
const char *s = src;
do {
if ((*d++ = *s++) == 0) {
/* NUL pad the remaining n-1 bytes */
while (--n) {
*d++ = 0;
}
break;
}
} while (--n);
}
return dst;
}
// [branch 009] Provide a transaction-safe version of realloc
void *tm_realloc(void *ptr, size_t size, size_t old_size)
{
void *oldp = ptr;
void* newp = malloc(size);
if (newp == NULL)
return NULL;
size_t copySize = *(size_t *)((char *)oldp - sizeof(size_t));
if (size < copySize)
copySize = size;
if (old_size > 0) {
tm_memcpy(newp, oldp, old_size);
}
free(oldp);
return newp;
}
// [branch 009b] Provide a safe version of strchr.
// This code taken from http://clc-wiki.net/wiki/strchr
char *tm_strchr(const char *s, int c)
{
while (*s != (char)c)
if (!*s++)
return 0;
return (char *)s;
}
// [branch 009b] Safe isspace
int tm_isspace(int c)
{
return isspace(c);
}
// [branch 009b] Provide a pure memcpy, so that we can do calle stack -to-
// caller stack transfers without having the writes getting
// buffered by the TM
__attribute__((transaction_pure))
static void *pure_memcpy(void *dest, const void *src, size_t n)
{
return memcpy(dest, src, n);
}
// [branch 009b] Provide a safe strncpy function that copies its argument to
// a local array instead of to a possibly-shared array
//
// NB: this code is taken from
// http://www.ethernut.de/api/strncpy_8c_source.html
#define MAX(x, y) ((x)>(y)) ? (x) : (y)
char *tm_strncpy_to_local(char *local_dst, const char *src, size_t n)
{
// keep track of the size, and have a local destination so that gcc
// doesn't do transactional writes, only transactional reads
int size = n;
char dst[MAX(KEY_MAX_LENGTH + 1, STAT_VAL_LEN) + 1];
if (n != 0) {
char *d = dst;
const char *s = src;
do {
if ((*d++ = *s++) == 0) {
/* NUL pad the remaining n-1 bytes */
while (--n) {
*d++ = 0;
}
break;
}
} while (--n);
}
// now we need to copy from dst (which is local to this function) to
// local_dst (which is local to the caller)
pure_memcpy(local_dst, dst, size);
return local_dst;
}
// [branch 009b] Safe strtol via marshalling
__attribute__((transaction_pure))
static long int pure_strtol(const char *nptr, char **endptr, int base)
{
return strtol(nptr, endptr, base);
}
// NB: memcached always sends NULL for endptr, so we don't have to do
// anything fancy here
long int tm_strtol(const char *nptr, char **endptr, int base)
{
// marshall string into buffer... the biggest 64-bit int is
// 9,223,372,036,854,775,807, so 19 characters. Note that the string can
// have a ton of leading whitespace, so we'll go with 4096 to play it
// safe
char buf[4096];
tm_strncpy_to_local(buf, nptr, 4096);
// now go to a pure function call
return pure_strtol(buf, endptr, base);
}
// [branch 009b] Since uses of strtoull need endptr, we re-produce the code
// instead of marshalling. Code is taken from
// http://ftp.cc.uoc.gr/mirrors/OpenBSD/src/lib/libc/stdlib/strtoull.c
unsigned long long int tm_strtoull(const char *nptr, char **endptr, int base)
{
const char *s;
unsigned long long acc, cutoff;
int c;
int neg, any, cutlim;
/*
* See strtoq for comments as to the logic used.
*/
s = nptr;
do {
c = (unsigned char) *s++;
} while (isspace(c));
if (c == '-') {
neg = 1;
c = *s++;
} else {
neg = 0;
if (c == '+')
c = *s++;
}
if ((base == 0 || base == 16) &&
c == '0' && (*s == 'x' || *s == 'X')) {
c = s[1];
s += 2;
base = 16;
}
if (base == 0)
base = c == '0' ? 8 : 10;
cutoff = ULLONG_MAX / (unsigned long long)base;
cutlim = ULLONG_MAX % (unsigned long long)base;
for (acc = 0, any = 0;; c = (unsigned char) *s++) {
if (isdigit(c))
c -= '0';
else if (isalpha(c))
c -= isupper(c) ? 'A' - 10 : 'a' - 10;
else
break;
if (c >= base)
break;
if (any < 0)
continue;
if (acc > cutoff || (acc == cutoff && c > cutlim)) {
any = -1;
acc = ULLONG_MAX;
errno = ERANGE;
} else {
any = 1;
acc *= (unsigned long long)base;
acc += c;
}
}
if (neg && any > 0)
acc = -acc;
if (endptr != 0)
*endptr = (char *) (any ? s - 1 : nptr);
return (acc);
}
// [branch 009b] This is how BSD does atoi...
int tm_atoi(const char *nptr)
{
return((int)tm_strtol(nptr, (char **)NULL, 10));
}
// [branch 012] Provide support for oncommit handlers
void registerOnCommitHandler(void (*func)(void*), void *param)
{
if (_ITM_inTransaction() == outsideTransaction) {
func(param);
}
else {
_ITM_addUserCommitAction((_ITM_userCommitFunction)func,
//_ITM_getTransactionId(),
1,
param);
}
}
| hlitz/memcached_excitevm | Condvar_version/tm_utils.cpp | C++ | bsd-3-clause | 8,873 | [
30522,
1013,
1013,
1031,
3589,
5890,
2475,
1033,
2421,
2490,
2005,
25719,
2006,
9006,
22930,
28213,
2015,
1024,
1001,
2421,
1000,
1013,
2188,
1013,
22455,
1013,
1043,
9468,
1013,
5034,
2278,
1013,
1043,
9468,
1035,
8260,
1013,
5622,
16313,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
require 'vcr'
VCR.config do |c|
c.cassette_library_dir = 'spec/fixtures/vcr_cassettes'
c.stub_with :fakeweb
end
| rafaelp/interfax-ruby | spec/support/vcr.rb | Ruby | mit | 117 | [
30522,
5478,
1005,
18315,
2099,
1005,
18315,
2099,
1012,
9530,
8873,
2290,
2079,
1064,
1039,
1064,
1039,
1012,
13903,
1035,
3075,
1035,
16101,
1027,
1005,
28699,
1013,
17407,
1013,
18315,
2099,
1035,
13903,
2015,
1005,
1039,
1012,
24646,
24... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
#! /usr/bin/env python3
from bollinger import bands, plot, strategies
import argparse
parser = argparse.ArgumentParser(description="plots bollinger bands or suggests investments", epilog="example: bolly.py plot AMZN FB")
parser.add_argument("action", metavar="ACTION", choices=["plot", "suggest"], help="either plot or suggest")
parser.add_argument("symbols", metavar="SYMBOL", nargs="+", help="stock symbols")
parser.add_argument("-s", "--strategy", choices=["uponce", "downonce", "moreup", "moredown"], default="moredown", help="selects invesment strategy")
args = parser.parse_args()
if args.action == "plot":
for symbol in args.symbols:
print("plot [ %s ]: " %(symbol), end="")
b = bands.Bands(symbol)
b.fetch()
try:
p = plot.Plot(b)
p.save()
print("OK")
except Exception as ex:
print("FAIL: (%s)"%(ex))
if args.action == "suggest":
for symbol in args.symbols:
print("suggest [ %s ]: " %(symbol), end="")
b = bands.Bands(symbol)
b.fetch()
try:
if args.strategy == "uponce": s = strategies.UpOnce(b)
elif args.strategy == "downonce": s = strategies.DownOnce(b)
elif args.strategy == "moreup": s = strategies.MoreUp(b)
elif args.strategy == "moredown": s = strategies.MoreDown(b)
print("YES" if s.invest() else "NO")
except Exception as ex:
print("FAIL: (%s)"%(ex))
| juantascon/bollinger-bands | python/bolly.py | Python | gpl-3.0 | 1,507 | [
30522,
1001,
999,
1013,
2149,
2099,
1013,
8026,
1013,
4372,
2615,
18750,
2509,
2013,
8945,
13112,
2121,
12324,
4996,
1010,
5436,
1010,
9942,
12324,
12098,
21600,
11650,
2063,
11968,
8043,
1027,
12098,
21600,
11650,
2063,
1012,
6685,
19362,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
var _ = require('lodash'),
Promise = require('bluebird'),
models = require('../../../../models'),
utils = require('../../../../utils'),
SubscribersImporter = require('./subscribers'),
PostsImporter = require('./posts'),
TagsImporter = require('./tags'),
SettingsImporter = require('./settings'),
UsersImporter = require('./users'),
RolesImporter = require('./roles'),
importers = {},
DataImporter;
DataImporter = {
type: 'data',
preProcess: function preProcess(importData) {
importData.preProcessedByData = true;
return importData;
},
init: function init(importData) {
importers.roles = new RolesImporter(importData.data);
importers.tags = new TagsImporter(importData.data);
importers.users = new UsersImporter(importData.data);
importers.subscribers = new SubscribersImporter(importData.data);
importers.posts = new PostsImporter(importData.data);
importers.settings = new SettingsImporter(importData.data);
return importData;
},
doImport: function doImport(importData) {
var ops = [], errors = [], results = [], options = {
importing: true,
context: {
internal: true
}
};
this.init(importData);
return models.Base.transaction(function (transacting) {
options.transacting = transacting;
_.each(importers, function (importer) {
ops.push(function doModelImport() {
return importer.beforeImport(options)
.then(function () {
return importer.doImport(options)
.then(function (_results) {
results = results.concat(_results);
});
});
});
});
_.each(importers, function (importer) {
ops.push(function afterImport() {
return importer.afterImport(options);
});
});
utils.sequence(ops)
.then(function () {
results.forEach(function (promise) {
if (!promise.isFulfilled()) {
errors = errors.concat(promise.reason());
}
});
if (errors.length === 0) {
transacting.commit();
} else {
transacting.rollback(errors);
}
});
}).then(function () {
/**
* data: imported data
* originalData: data from the json file
* problems: warnings
*/
var toReturn = {
data: {},
originalData: importData.data,
problems: []
};
_.each(importers, function (importer) {
toReturn.problems = toReturn.problems.concat(importer.problems);
toReturn.data[importer.dataKeyToImport] = importer.importedData;
});
return toReturn;
}).catch(function (errors) {
return Promise.reject(errors);
});
}
};
module.exports = DataImporter;
| leninhasda/Ghost | core/server/data/importer/importers/data/index.js | JavaScript | mit | 3,372 | [
30522,
13075,
1035,
1027,
5478,
1006,
1005,
8840,
8883,
2232,
1005,
1007,
1010,
4872,
1027,
5478,
1006,
1005,
2630,
9001,
1005,
1007,
1010,
4275,
1027,
5478,
1006,
1005,
1012,
1012,
1013,
1012,
1012,
1013,
1012,
1012,
1013,
1012,
1012,
10... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
#include "bitcoinunits.h"
#include <QStringList>
BitcoinUnits::BitcoinUnits(QObject *parent):
QAbstractListModel(parent),
unitlist(availableUnits())
{
}
QList<BitcoinUnits::Unit> BitcoinUnits::availableUnits()
{
QList<BitcoinUnits::Unit> unitlist;
unitlist.append(BTC);
unitlist.append(mBTC);
unitlist.append(uBTC);
return unitlist;
}
bool BitcoinUnits::valid(int unit)
{
switch(unit)
{
case BTC:
case mBTC:
case uBTC:
return true;
default:
return false;
}
}
QString BitcoinUnits::name(int unit)
{
switch(unit)
{
case BTC: return QString("LTCC");
case mBTC: return QString("mLTCC");
case uBTC: return QString::fromUtf8("μLTCC");
default: return QString("???");
}
}
QString BitcoinUnits::description(int unit)
{
switch(unit)
{
case BTC: return QString("Litecoin Classic");
case mBTC: return QString("milli Litecoin Classic (1 / 1,000)");
case uBTC: return QString("micro Litecoin Classic (1 / 1,000,000)");
default: return QString("???");
}
}
//a single unit (.00000001) of Litecoin Classic is called a "wander."
qint64 BitcoinUnits::factor(int unit)
{
switch(unit)
{
case BTC: return 100000000;
case mBTC: return 100000;
case uBTC: return 100;
default: return 100000000;
}
}
int BitcoinUnits::amountDigits(int unit)
{
switch(unit)
{
case BTC: return 8; // 21,000,000 (# digits, without commas)
case mBTC: return 11; // 21,000,000,000
case uBTC: return 14; // 21,000,000,000,000
default: return 0;
}
}
int BitcoinUnits::decimals(int unit)
{
switch(unit)
{
case BTC: return 8;
case mBTC: return 5;
case uBTC: return 2;
default: return 0;
}
}
QString BitcoinUnits::format(int unit, qint64 n, bool fPlus)
{
// Note: not using straight sprintf here because we do NOT want
// localized number formatting.
if(!valid(unit))
return QString(); // Refuse to format invalid unit
qint64 coin = factor(unit);
int num_decimals = decimals(unit);
qint64 n_abs = (n > 0 ? n : -n);
qint64 quotient = n_abs / coin;
qint64 remainder = n_abs % coin;
QString quotient_str = QString::number(quotient);
QString remainder_str = QString::number(remainder).rightJustified(num_decimals, '0');
// Right-trim excess 0's after the decimal point
int nTrim = 0;
for (int i = remainder_str.size()-1; i>=2 && (remainder_str.at(i) == '0'); --i)
++nTrim;
remainder_str.chop(nTrim);
if (n < 0)
quotient_str.insert(0, '-');
else if (fPlus && n > 0)
quotient_str.insert(0, '+');
return quotient_str + QString(".") + remainder_str;
}
QString BitcoinUnits::formatWithUnit(int unit, qint64 amount, bool plussign)
{
return format(unit, amount, plussign) + QString(" ") + name(unit);
}
bool BitcoinUnits::parse(int unit, const QString &value, qint64 *val_out)
{
if(!valid(unit) || value.isEmpty())
return false; // Refuse to parse invalid unit or empty string
int num_decimals = decimals(unit);
QStringList parts = value.split(".");
if(parts.size() > 2)
{
return false; // More than one dot
}
QString whole = parts[0];
QString decimals;
if(parts.size() > 1)
{
decimals = parts[1];
}
if(decimals.size() > num_decimals)
{
return false; // Exceeds max precision
}
bool ok = false;
QString str = whole + decimals.leftJustified(num_decimals, '0');
if(str.size() > 18)
{
return false; // Longer numbers will exceed 63 bits
}
qint64 retvalue = str.toLongLong(&ok);
if(val_out)
{
*val_out = retvalue;
}
return ok;
}
int BitcoinUnits::rowCount(const QModelIndex &parent) const
{
Q_UNUSED(parent);
return unitlist.size();
}
QVariant BitcoinUnits::data(const QModelIndex &index, int role) const
{
int row = index.row();
if(row >= 0 && row < unitlist.size())
{
Unit unit = unitlist.at(row);
switch(role)
{
case Qt::EditRole:
case Qt::DisplayRole:
return QVariant(name(unit));
case Qt::ToolTipRole:
return QVariant(description(unit));
case UnitRole:
return QVariant(static_cast<int>(unit));
}
}
return QVariant();
}
| render2k/litecoinclassic | src/qt/bitcoinunits.cpp | C++ | mit | 4,375 | [
30522,
1001,
2421,
1000,
2978,
3597,
2378,
19496,
3215,
1012,
1044,
1000,
1001,
2421,
1026,
1053,
3367,
4892,
9863,
1028,
2978,
3597,
2378,
19496,
3215,
1024,
1024,
2978,
3597,
2378,
19496,
3215,
1006,
1053,
16429,
20614,
1008,
6687,
1007,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
<?xml version="1.0" ?><!DOCTYPE TS><TS language="nb" version="2.0">
<defaultcodec>UTF-8</defaultcodec>
<context>
<name>AboutDialog</name>
<message>
<location filename="../forms/aboutdialog.ui" line="+14"/>
<source>About RupayaCoin</source>
<translation>Om RupayaCoin</translation>
</message>
<message>
<location line="+39"/>
<source><b>RupayaCoin</b> version</source>
<translation><b>RupayaCoin</b> versjon</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 (eay@cryptsoft.com) and UPnP software written by Thomas Bernard.</source>
<translation>
Dette er eksperimentell programvare.
Distribuert under MIT/X11 programvarelisensen, se medfølgende fil COPYING eller http://www.opensource.org/licenses/mit-license.php.
Dette produktet inneholder programvare utviklet av OpenSSL prosjektet for bruk i OpenSSL Toolkit (http://www.openssl.org/) og kryptografisk programvare skrevet av Eric Young (eay@cryptsoft.com) og UPnP programvare skrevet av Thomas Bernard.</translation>
</message>
<message>
<location filename="../aboutdialog.cpp" line="+14"/>
<source>Copyright</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+0"/>
<source>The RupayaCoin developers</source>
<translation type="unfinished"/>
</message>
</context>
<context>
<name>AddressBookPage</name>
<message>
<location filename="../forms/addressbookpage.ui" line="+14"/>
<source>Address Book</source>
<translation>Adressebok</translation>
</message>
<message>
<location line="+19"/>
<source>Double-click to edit address or label</source>
<translation>Dobbeltklikk for å redigere adresse eller merkelapp</translation>
</message>
<message>
<location line="+27"/>
<source>Create a new address</source>
<translation>Lag en ny adresse</translation>
</message>
<message>
<location line="+14"/>
<source>Copy the currently selected address to the system clipboard</source>
<translation>Kopier den valgte adressen til systemets utklippstavle</translation>
</message>
<message>
<location line="-11"/>
<source>&New Address</source>
<translation>&Ny Adresse</translation>
</message>
<message>
<location filename="../addressbookpage.cpp" line="+63"/>
<source>These are your RupayaCoin 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>Dette er dine RupayaCoin-adresser for mottak av betalinger. Du kan gi forskjellige adresser til alle som skal betale deg for å holde bedre oversikt.</translation>
</message>
<message>
<location filename="../forms/addressbookpage.ui" line="+14"/>
<source>&Copy Address</source>
<translation>&Kopier Adresse</translation>
</message>
<message>
<location line="+11"/>
<source>Show &QR Code</source>
<translation>Vis &QR Kode</translation>
</message>
<message>
<location line="+11"/>
<source>Sign a message to prove you own a RupayaCoin address</source>
<translation>Signer en melding for å bevise at du eier en RupayaCoin-adresse</translation>
</message>
<message>
<location line="+3"/>
<source>Sign &Message</source>
<translation>Signér &Melding</translation>
</message>
<message>
<location line="+25"/>
<source>Delete the currently selected address from the list</source>
<translation>Slett den valgte adressen fra listen.</translation>
</message>
<message>
<location line="+27"/>
<source>Export the data in the current tab to a file</source>
<translation>Eksporter data fra nåværende fane til fil</translation>
</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 RupayaCoin address</source>
<translation>Verifiser en melding for å være sikker på at den ble signert av en angitt RupayaCoin-adresse</translation>
</message>
<message>
<location line="+3"/>
<source>&Verify Message</source>
<translation>&Verifiser Melding</translation>
</message>
<message>
<location line="+14"/>
<source>&Delete</source>
<translation>&Slett</translation>
</message>
<message>
<location filename="../addressbookpage.cpp" line="-5"/>
<source>These are your RupayaCoin 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>Kopier &Merkelapp</translation>
</message>
<message>
<location line="+1"/>
<source>&Edit</source>
<translation>&Rediger</translation>
</message>
<message>
<location line="+1"/>
<source>Send &Coins</source>
<translation>Send &Coins</translation>
</message>
<message>
<location line="+260"/>
<source>Export Address Book Data</source>
<translation>Eksporter adressebok</translation>
</message>
<message>
<location line="+1"/>
<source>Comma separated file (*.csv)</source>
<translation>Kommaseparert fil (*.csv)</translation>
</message>
<message>
<location line="+13"/>
<source>Error exporting</source>
<translation>Feil ved eksportering</translation>
</message>
<message>
<location line="+0"/>
<source>Could not write to file %1.</source>
<translation>Kunne ikke skrive til filen %1.</translation>
</message>
</context>
<context>
<name>AddressTableModel</name>
<message>
<location filename="../addresstablemodel.cpp" line="+144"/>
<source>Label</source>
<translation>Merkelapp</translation>
</message>
<message>
<location line="+0"/>
<source>Address</source>
<translation>Adresse</translation>
</message>
<message>
<location line="+36"/>
<source>(no label)</source>
<translation>(ingen merkelapp)</translation>
</message>
</context>
<context>
<name>AskPassphraseDialog</name>
<message>
<location filename="../forms/askpassphrasedialog.ui" line="+26"/>
<source>Passphrase Dialog</source>
<translation>Dialog for Adgangsfrase</translation>
</message>
<message>
<location line="+21"/>
<source>Enter passphrase</source>
<translation>Angi adgangsfrase</translation>
</message>
<message>
<location line="+14"/>
<source>New passphrase</source>
<translation>Ny adgangsfrase</translation>
</message>
<message>
<location line="+14"/>
<source>Repeat new passphrase</source>
<translation>Gjenta ny adgangsfrase</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>Skriv inn den nye adgangsfrasen for lommeboken.<br/>Vennligst bruk en adgangsfrase med <b>10 eller flere tilfeldige tegn</b>, eller <b>åtte eller flere ord</b>.</translation>
</message>
<message>
<location line="+1"/>
<source>Encrypt wallet</source>
<translation>Krypter lommebok</translation>
</message>
<message>
<location line="+3"/>
<source>This operation needs your wallet passphrase to unlock the wallet.</source>
<translation>Denne operasjonen krever adgangsfrasen til lommeboken for å låse den opp.</translation>
</message>
<message>
<location line="+5"/>
<source>Unlock wallet</source>
<translation>Lås opp lommebok</translation>
</message>
<message>
<location line="+3"/>
<source>This operation needs your wallet passphrase to decrypt the wallet.</source>
<translation>Denne operasjonen krever adgangsfrasen til lommeboken for å dekryptere den.</translation>
</message>
<message>
<location line="+5"/>
<source>Decrypt wallet</source>
<translation>Dekrypter lommebok</translation>
</message>
<message>
<location line="+3"/>
<source>Change passphrase</source>
<translation>Endre adgangsfrase</translation>
</message>
<message>
<location line="+1"/>
<source>Enter the old and new passphrase to the wallet.</source>
<translation>Skriv inn gammel og ny adgangsfrase for lommeboken.</translation>
</message>
<message>
<location line="+46"/>
<source>Confirm wallet encryption</source>
<translation>Bekreft kryptering av lommebok</translation>
</message>
<message>
<location line="+1"/>
<source>Warning: If you encrypt your wallet and lose your passphrase, you will <b>LOSE ALL OF YOUR RupayaCoinS</b>!</source>
<translation>Advarsel: Hvis du krypterer lommeboken og mister adgangsfrasen, så vil du <b>MISTE ALLE DINE RupayaCoinS</b>!</translation>
</message>
<message>
<location line="+0"/>
<source>Are you sure you wish to encrypt your wallet?</source>
<translation>Er du sikker på at du vil kryptere lommeboken?</translation>
</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>VIKTIG: Tidligere sikkerhetskopier av din lommebok-fil, bør erstattes med den nylig genererte, krypterte filen, da de blir ugyldiggjort av sikkerhetshensyn så snart du begynner å bruke den nye krypterte lommeboken.</translation>
</message>
<message>
<location line="+100"/>
<location line="+24"/>
<source>Warning: The Caps Lock key is on!</source>
<translation>Advarsel: Caps Lock er på !</translation>
</message>
<message>
<location line="-130"/>
<location line="+58"/>
<source>Wallet encrypted</source>
<translation>Lommebok kryptert</translation>
</message>
<message>
<location line="-56"/>
<source>RupayaCoin will close now to finish the encryption process. Remember that encrypting your wallet cannot fully protect your RupayaCoins from being stolen by malware infecting your computer.</source>
<translation>RupayaCoin vil nå lukkes for å fullføre krypteringsprosessen. Husk at kryptering av lommeboken ikke fullt ut kan beskytte dine RupayaCoins fra å bli stjålet om skadevare infiserer datamaskinen.</translation>
</message>
<message>
<location line="+13"/>
<location line="+7"/>
<location line="+42"/>
<location line="+6"/>
<source>Wallet encryption failed</source>
<translation>Kryptering av lommebok feilet</translation>
</message>
<message>
<location line="-54"/>
<source>Wallet encryption failed due to an internal error. Your wallet was not encrypted.</source>
<translation>Kryptering av lommebok feilet på grunn av en intern feil. Din lommebok ble ikke kryptert.</translation>
</message>
<message>
<location line="+7"/>
<location line="+48"/>
<source>The supplied passphrases do not match.</source>
<translation>De angitte adgangsfrasene er ulike.</translation>
</message>
<message>
<location line="-37"/>
<source>Wallet unlock failed</source>
<translation>Opplåsing av lommebok feilet</translation>
</message>
<message>
<location line="+1"/>
<location line="+11"/>
<location line="+19"/>
<source>The passphrase entered for the wallet decryption was incorrect.</source>
<translation>Adgangsfrasen angitt for dekryptering av lommeboken var feil.</translation>
</message>
<message>
<location line="-20"/>
<source>Wallet decryption failed</source>
<translation>Dekryptering av lommebok feilet</translation>
</message>
<message>
<location line="+14"/>
<source>Wallet passphrase was successfully changed.</source>
<translation>Adgangsfrase for lommebok endret.</translation>
</message>
</context>
<context>
<name>BitcoinGUI</name>
<message>
<location filename="../bitcoingui.cpp" line="+233"/>
<source>Sign &message...</source>
<translation>Signer &melding...</translation>
</message>
<message>
<location line="+280"/>
<source>Synchronizing with network...</source>
<translation>Synkroniserer med nettverk...</translation>
</message>
<message>
<location line="-349"/>
<source>&Overview</source>
<translation>&Oversikt</translation>
</message>
<message>
<location line="+1"/>
<source>Show general overview of wallet</source>
<translation>Vis generell oversikt over lommeboken</translation>
</message>
<message>
<location line="+20"/>
<source>&Transactions</source>
<translation>&Transaksjoner</translation>
</message>
<message>
<location line="+1"/>
<source>Browse transaction history</source>
<translation>Vis transaksjonshistorikk</translation>
</message>
<message>
<location line="+7"/>
<source>Edit the list of stored addresses and labels for sending</source>
<translation>Rediger listen over adresser og deres merkelapper</translation>
</message>
<message>
<location line="-14"/>
<source>Show the list of addresses for receiving payments</source>
<translation>Vis listen over adresser for mottak av betalinger</translation>
</message>
<message>
<location line="+31"/>
<source>E&xit</source>
<translation>&Avslutt</translation>
</message>
<message>
<location line="+1"/>
<source>Quit application</source>
<translation>Avslutt applikasjonen</translation>
</message>
<message>
<location line="+4"/>
<source>Show information about RupayaCoin</source>
<translation>Vis informasjon om RupayaCoin</translation>
</message>
<message>
<location line="+2"/>
<source>About &Qt</source>
<translation>Om &Qt</translation>
</message>
<message>
<location line="+1"/>
<source>Show information about Qt</source>
<translation>Vis informasjon om Qt</translation>
</message>
<message>
<location line="+2"/>
<source>&Options...</source>
<translation>&Innstillinger...</translation>
</message>
<message>
<location line="+6"/>
<source>&Encrypt Wallet...</source>
<translation>&Krypter Lommebok...</translation>
</message>
<message>
<location line="+3"/>
<source>&Backup Wallet...</source>
<translation>Lag &Sikkerhetskopi av Lommebok...</translation>
</message>
<message>
<location line="+2"/>
<source>&Change Passphrase...</source>
<translation>&Endre Adgangsfrase...</translation>
</message>
<message>
<location line="+285"/>
<source>Importing blocks from disk...</source>
<translation>Importere blokker...</translation>
</message>
<message>
<location line="+3"/>
<source>Reindexing blocks on disk...</source>
<translation>Re-indekserer blokker på disk...</translation>
</message>
<message>
<location line="-347"/>
<source>Send coins to a RupayaCoin address</source>
<translation>Send til en RupayaCoin-adresse</translation>
</message>
<message>
<location line="+49"/>
<source>Modify configuration options for RupayaCoin</source>
<translation>Endre oppsett for RupayaCoin</translation>
</message>
<message>
<location line="+9"/>
<source>Backup wallet to another location</source>
<translation>Sikkerhetskopiér lommebok til annet sted</translation>
</message>
<message>
<location line="+2"/>
<source>Change the passphrase used for wallet encryption</source>
<translation>Endre adgangsfrasen brukt for kryptering av lommebok</translation>
</message>
<message>
<location line="+6"/>
<source>&Debug window</source>
<translation>&Feilsøkingsvindu</translation>
</message>
<message>
<location line="+1"/>
<source>Open debugging and diagnostic console</source>
<translation>Åpne konsoll for feilsøk og diagnostikk</translation>
</message>
<message>
<location line="-4"/>
<source>&Verify message...</source>
<translation>&Verifiser melding...</translation>
</message>
<message>
<location line="-165"/>
<location line="+530"/>
<source>RupayaCoin</source>
<translation>RupayaCoin</translation>
</message>
<message>
<location line="-530"/>
<source>Wallet</source>
<translation>Lommebok</translation>
</message>
<message>
<location line="+101"/>
<source>&Send</source>
<translation>&Send</translation>
</message>
<message>
<location line="+7"/>
<source>&Receive</source>
<translation>&Motta</translation>
</message>
<message>
<location line="+14"/>
<source>&Addresses</source>
<translation>&Adressebok</translation>
</message>
<message>
<location line="+22"/>
<source>&About RupayaCoin</source>
<translation>&Om RupayaCoin</translation>
</message>
<message>
<location line="+9"/>
<source>&Show / Hide</source>
<translation>&Gjem / vis</translation>
</message>
<message>
<location line="+1"/>
<source>Show or hide the main Window</source>
<translation>Vis eller skjul hovedvinduet</translation>
</message>
<message>
<location line="+3"/>
<source>Encrypt the private keys that belong to your wallet</source>
<translation>Krypter de private nøklene som tilhører lommeboken din</translation>
</message>
<message>
<location line="+7"/>
<source>Sign messages with your RupayaCoin addresses to prove you own them</source>
<translation>Signér en melding for å bevise at du eier denne adressen</translation>
</message>
<message>
<location line="+2"/>
<source>Verify messages to ensure they were signed with specified RupayaCoin addresses</source>
<translation>Bekreft meldinger for å være sikker på at de ble signert av en angitt RupayaCoin-adresse</translation>
</message>
<message>
<location line="+28"/>
<source>&File</source>
<translation>&Fil</translation>
</message>
<message>
<location line="+7"/>
<source>&Settings</source>
<translation>&Innstillinger</translation>
</message>
<message>
<location line="+6"/>
<source>&Help</source>
<translation>&Hjelp</translation>
</message>
<message>
<location line="+9"/>
<source>Tabs toolbar</source>
<translation>Verktøylinje for faner</translation>
</message>
<message>
<location line="+17"/>
<location line="+10"/>
<source>[testnet]</source>
<translation>[testnett]</translation>
</message>
<message>
<location line="+47"/>
<source>RupayaCoin client</source>
<translation>RupayaCoinklient</translation>
</message>
<message numerus="yes">
<location line="+141"/>
<source>%n active connection(s) to RupayaCoin network</source>
<translation><numerusform>%n aktiv forbindelse til RupayaCoin-nettverket</numerusform><numerusform>%n aktive forbindelser til RupayaCoin-nettverket</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>Lastet %1 blokker med transaksjonshistorikk.</translation>
</message>
<message numerus="yes">
<location line="+20"/>
<source>%n hour(s)</source>
<translation type="unfinished"><numerusform></numerusform><numerusform></numerusform></translation>
</message>
<message numerus="yes">
<location line="+4"/>
<source>%n day(s)</source>
<translation type="unfinished"><numerusform></numerusform><numerusform></numerusform></translation>
</message>
<message numerus="yes">
<location line="+4"/>
<source>%n week(s)</source>
<translation type="unfinished"><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>Transaksjoner etter dette vil ikke være synlige enda.</translation>
</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>Denne transaksjonen overstiger størrelsesbegrensningen. Du kan likevel sende den med et gebyr på %1, som går til nodene som prosesserer transaksjonen din og støtter nettverket. Vil du betale gebyret?</translation>
</message>
<message>
<location line="-140"/>
<source>Up to date</source>
<translation>Ajour</translation>
</message>
<message>
<location line="+31"/>
<source>Catching up...</source>
<translation>Kommer ajour...</translation>
</message>
<message>
<location line="+113"/>
<source>Confirm transaction fee</source>
<translation>Bekreft transaksjonsgebyr</translation>
</message>
<message>
<location line="+8"/>
<source>Sent transaction</source>
<translation>Sendt transaksjon</translation>
</message>
<message>
<location line="+0"/>
<source>Incoming transaction</source>
<translation>Innkommende transaksjon</translation>
</message>
<message>
<location line="+1"/>
<source>Date: %1
Amount: %2
Type: %3
Address: %4
</source>
<translation>Dato: %1
Beløp: %2
Type: %3
Adresse: %4
</translation>
</message>
<message>
<location line="+33"/>
<location line="+23"/>
<source>URI handling</source>
<translation>URI håndtering</translation>
</message>
<message>
<location line="-23"/>
<location line="+23"/>
<source>URI can not be parsed! This can be caused by an invalid RupayaCoin address or malformed URI parameters.</source>
<translation>URI kunne ikke tolkes! Dette kan forårsakes av en ugyldig RupayaCoin-adresse eller feil i URI-parametere.</translation>
</message>
<message>
<location line="+17"/>
<source>Wallet is <b>encrypted</b> and currently <b>unlocked</b></source>
<translation>Lommeboken er <b>kryptert</b> og for tiden <b>ulåst</b></translation>
</message>
<message>
<location line="+8"/>
<source>Wallet is <b>encrypted</b> and currently <b>locked</b></source>
<translation>Lommeboken er <b>kryptert</b> og for tiden <b>låst</b></translation>
</message>
<message>
<location filename="../bitcoin.cpp" line="+111"/>
<source>A fatal error occurred. RupayaCoin can no longer continue safely and will quit.</source>
<translation>En fatal feil har inntruffet. Det er ikke trygt å fortsette og RupayaCoin må derfor avslutte.</translation>
</message>
</context>
<context>
<name>ClientModel</name>
<message>
<location filename="../clientmodel.cpp" line="+104"/>
<source>Network Alert</source>
<translation>Nettverksvarsel</translation>
</message>
</context>
<context>
<name>EditAddressDialog</name>
<message>
<location filename="../forms/editaddressdialog.ui" line="+14"/>
<source>Edit Address</source>
<translation>Rediger adresse</translation>
</message>
<message>
<location line="+11"/>
<source>&Label</source>
<translation>&Merkelapp</translation>
</message>
<message>
<location line="+10"/>
<source>The label associated with this address book entry</source>
<translation>Merkelappen koblet til denne adressen i adresseboken</translation>
</message>
<message>
<location line="+7"/>
<source>&Address</source>
<translation>&Adresse</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>Adressen til denne oppføringen i adresseboken. Denne kan kun endres for utsendingsadresser.</translation>
</message>
<message>
<location filename="../editaddressdialog.cpp" line="+21"/>
<source>New receiving address</source>
<translation>Ny mottaksadresse</translation>
</message>
<message>
<location line="+4"/>
<source>New sending address</source>
<translation>Ny utsendingsadresse</translation>
</message>
<message>
<location line="+3"/>
<source>Edit receiving address</source>
<translation>Rediger mottaksadresse</translation>
</message>
<message>
<location line="+4"/>
<source>Edit sending address</source>
<translation>Rediger utsendingsadresse</translation>
</message>
<message>
<location line="+76"/>
<source>The entered address "%1" is already in the address book.</source>
<translation>Den oppgitte adressen "%1" er allerede i adresseboken.</translation>
</message>
<message>
<location line="-5"/>
<source>The entered address "%1" is not a valid RupayaCoin address.</source>
<translation>Den angitte adressed "%1" er ikke en gyldig RupayaCoin-adresse.</translation>
</message>
<message>
<location line="+10"/>
<source>Could not unlock wallet.</source>
<translation>Kunne ikke låse opp lommeboken.</translation>
</message>
<message>
<location line="+5"/>
<source>New key generation failed.</source>
<translation>Generering av ny nøkkel feilet.</translation>
</message>
</context>
<context>
<name>GUIUtil::HelpMessageBox</name>
<message>
<location filename="../guiutil.cpp" line="+424"/>
<location line="+12"/>
<source>RupayaCoin-Qt</source>
<translation>RupayaCoin-Qt</translation>
</message>
<message>
<location line="-12"/>
<source>version</source>
<translation>versjon</translation>
</message>
<message>
<location line="+2"/>
<source>Usage:</source>
<translation>Bruk:</translation>
</message>
<message>
<location line="+1"/>
<source>command-line options</source>
<translation>kommandolinjevalg</translation>
</message>
<message>
<location line="+4"/>
<source>UI options</source>
<translation>valg i brukergrensesnitt</translation>
</message>
<message>
<location line="+1"/>
<source>Set language, for example "de_DE" (default: system locale)</source>
<translation>Sett språk, for eksempel "nb_NO" (standardverdi: fra operativsystem)</translation>
</message>
<message>
<location line="+1"/>
<source>Start minimized</source>
<translation>Start minimert
</translation>
</message>
<message>
<location line="+1"/>
<source>Show splash screen on startup (default: 1)</source>
<translation>Vis splashskjerm ved oppstart (standardverdi: 1)</translation>
</message>
</context>
<context>
<name>OptionsDialog</name>
<message>
<location filename="../forms/optionsdialog.ui" line="+14"/>
<source>Options</source>
<translation>Innstillinger</translation>
</message>
<message>
<location line="+16"/>
<source>&Main</source>
<translation>&Hoved</translation>
</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>Betal transaksjons&gebyr</translation>
</message>
<message>
<location line="+31"/>
<source>Automatically start RupayaCoin after logging in to the system.</source>
<translation>Start RupayaCoin automatisk etter innlogging.</translation>
</message>
<message>
<location line="+3"/>
<source>&Start RupayaCoin on system login</source>
<translation>&Start RupayaCoin ved systeminnlogging</translation>
</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>&Nettverk</translation>
</message>
<message>
<location line="+6"/>
<source>Automatically open the RupayaCoin client port on the router. This only works when your router supports UPnP and it is enabled.</source>
<translation>Åpne automatisk RupayaCoin klientporten på ruteren. Dette virker kun om din ruter støtter UPnP og dette er påslått.</translation>
</message>
<message>
<location line="+3"/>
<source>Map port using &UPnP</source>
<translation>Sett opp port vha. &UPnP</translation>
</message>
<message>
<location line="+7"/>
<source>Connect to the RupayaCoin network through a SOCKS proxy (e.g. when connecting through Tor).</source>
<translation>Koble til RupayaCoin-nettverket gjennom en SOCKS proxy (f.eks. ved tilkobling gjennom Tor).</translation>
</message>
<message>
<location line="+3"/>
<source>&Connect through SOCKS proxy:</source>
<translation>&Koble til gjenom SOCKS proxy:</translation>
</message>
<message>
<location line="+9"/>
<source>Proxy &IP:</source>
<translation>Proxy &IP:</translation>
</message>
<message>
<location line="+19"/>
<source>IP address of the proxy (e.g. 127.0.0.1)</source>
<translation>IP-adresse for mellomtjener (f.eks. 127.0.0.1)</translation>
</message>
<message>
<location line="+7"/>
<source>&Port:</source>
<translation>&Port:</translation>
</message>
<message>
<location line="+19"/>
<source>Port of the proxy (e.g. 9050)</source>
<translation>Proxyens port (f.eks. 9050)</translation>
</message>
<message>
<location line="+7"/>
<source>SOCKS &Version:</source>
<translation>SOCKS &Versjon:</translation>
</message>
<message>
<location line="+13"/>
<source>SOCKS version of the proxy (e.g. 5)</source>
<translation>Proxyens SOCKS versjon (f.eks. 5)</translation>
</message>
<message>
<location line="+36"/>
<source>&Window</source>
<translation>&Vindu</translation>
</message>
<message>
<location line="+6"/>
<source>Show only a tray icon after minimizing the window.</source>
<translation>Vis kun ikon i systemkurv etter minimering av vinduet.</translation>
</message>
<message>
<location line="+3"/>
<source>&Minimize to the tray instead of the taskbar</source>
<translation>&Minimer til systemkurv istedenfor oppgavelinjen</translation>
</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>Minimerer vinduet istedenfor å avslutte applikasjonen når vinduet lukkes. Når dette er slått på avsluttes applikasjonen kun ved å velge avslutt i menyen.</translation>
</message>
<message>
<location line="+3"/>
<source>M&inimize on close</source>
<translation>M&inimer ved lukking</translation>
</message>
<message>
<location line="+21"/>
<source>&Display</source>
<translation>&Visning</translation>
</message>
<message>
<location line="+8"/>
<source>User Interface &language:</source>
<translation>&Språk for brukergrensesnitt</translation>
</message>
<message>
<location line="+13"/>
<source>The user interface language can be set here. This setting will take effect after restarting RupayaCoin.</source>
<translation>Språket for brukergrensesnittet kan settes her. Innstillingen trer i kraft ved omstart av RupayaCoin.</translation>
</message>
<message>
<location line="+11"/>
<source>&Unit to show amounts in:</source>
<translation>&Enhet for visning av beløper:</translation>
</message>
<message>
<location line="+13"/>
<source>Choose the default subdivision unit to show in the interface and when sending coins.</source>
<translation>Velg standard delt enhet for visning i grensesnittet og for sending av RupayaCoins.</translation>
</message>
<message>
<location line="+9"/>
<source>Whether to show RupayaCoin addresses in the transaction list or not.</source>
<translation>Om RupayaCoin-adresser skal vises i transaksjonslisten eller ikke.</translation>
</message>
<message>
<location line="+3"/>
<source>&Display addresses in transaction list</source>
<translation>&Vis adresser i transaksjonslisten</translation>
</message>
<message>
<location line="+71"/>
<source>&OK</source>
<translation>&OK</translation>
</message>
<message>
<location line="+7"/>
<source>&Cancel</source>
<translation>&Avbryt</translation>
</message>
<message>
<location line="+10"/>
<source>&Apply</source>
<translation>&Bruk</translation>
</message>
<message>
<location filename="../optionsdialog.cpp" line="+53"/>
<source>default</source>
<translation>standardverdi</translation>
</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>Advarsel</translation>
</message>
<message>
<location line="-9"/>
<location line="+9"/>
<source>This setting will take effect after restarting RupayaCoin.</source>
<translation>Denne innstillingen trer i kraft etter omstart av RupayaCoin.</translation>
</message>
<message>
<location line="+29"/>
<source>The supplied proxy address is invalid.</source>
<translation>Angitt proxyadresse er ugyldig.</translation>
</message>
</context>
<context>
<name>OverviewPage</name>
<message>
<location filename="../forms/overviewpage.ui" line="+14"/>
<source>Form</source>
<translation>Skjema</translation>
</message>
<message>
<location line="+50"/>
<location line="+166"/>
<source>The displayed information may be out of date. Your wallet automatically synchronizes with the RupayaCoin network after a connection is established, but this process has not completed yet.</source>
<translation>Informasjonen som vises kan være foreldet. Din lommebok synkroniseres automatisk med RupayaCoin-nettverket etter at tilkobling er opprettet, men denne prosessen er ikke ferdig enda.</translation>
</message>
<message>
<location line="-124"/>
<source>Balance:</source>
<translation>Saldo:</translation>
</message>
<message>
<location line="+29"/>
<source>Unconfirmed:</source>
<translation>Ubekreftet</translation>
</message>
<message>
<location line="-78"/>
<source>Wallet</source>
<translation>Lommebok</translation>
</message>
<message>
<location line="+107"/>
<source>Immature:</source>
<translation>Umoden:</translation>
</message>
<message>
<location line="+13"/>
<source>Mined balance that has not yet matured</source>
<translation>Minet saldo har ikke modnet enda</translation>
</message>
<message>
<location line="+46"/>
<source><b>Recent transactions</b></source>
<translation><b>Siste transaksjoner</b></translation>
</message>
<message>
<location line="-101"/>
<source>Your current balance</source>
<translation>Din nåværende saldo</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>Totalt antall ubekreftede transaksjoner som ikke telles med i saldo enda</translation>
</message>
<message>
<location filename="../overviewpage.cpp" line="+116"/>
<location line="+1"/>
<source>out of sync</source>
<translation>ute av synk</translation>
</message>
</context>
<context>
<name>PaymentServer</name>
<message>
<location filename="../paymentserver.cpp" line="+107"/>
<source>Cannot start RupayaCoin: click-to-pay handler</source>
<translation>Kan ikke starte RupayaCoin: klikk-og-betal håndterer</translation>
</message>
</context>
<context>
<name>QRCodeDialog</name>
<message>
<location filename="../forms/qrcodedialog.ui" line="+14"/>
<source>QR Code Dialog</source>
<translation>Dialog for QR Kode</translation>
</message>
<message>
<location line="+59"/>
<source>Request Payment</source>
<translation>Etterspør Betaling</translation>
</message>
<message>
<location line="+56"/>
<source>Amount:</source>
<translation>Beløp:</translation>
</message>
<message>
<location line="-44"/>
<source>Label:</source>
<translation>Merkelapp:</translation>
</message>
<message>
<location line="+19"/>
<source>Message:</source>
<translation>Melding:</translation>
</message>
<message>
<location line="+71"/>
<source>&Save As...</source>
<translation>&Lagre Som...</translation>
</message>
<message>
<location filename="../qrcodedialog.cpp" line="+62"/>
<source>Error encoding URI into QR Code.</source>
<translation>Feil ved koding av URI i QR kode.</translation>
</message>
<message>
<location line="+40"/>
<source>The entered amount is invalid, please check.</source>
<translation>Angitt beløp er ugyldig.</translation>
</message>
<message>
<location line="+23"/>
<source>Resulting URI too long, try to reduce the text for label / message.</source>
<translation>Resulterende URI for lang, prøv å redusere teksten for merkelapp / melding.</translation>
</message>
<message>
<location line="+25"/>
<source>Save QR Code</source>
<translation>Lagre QR Kode</translation>
</message>
<message>
<location line="+0"/>
<source>PNG Images (*.png)</source>
<translation>PNG bilder (*.png)</translation>
</message>
</context>
<context>
<name>RPCConsole</name>
<message>
<location filename="../forms/rpcconsole.ui" line="+46"/>
<source>Client name</source>
<translation>Klientnavn</translation>
</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>-</translation>
</message>
<message>
<location line="-217"/>
<source>Client version</source>
<translation>Klientversjon</translation>
</message>
<message>
<location line="-45"/>
<source>&Information</source>
<translation>&Informasjon</translation>
</message>
<message>
<location line="+68"/>
<source>Using OpenSSL version</source>
<translation>Bruker OpenSSL versjon</translation>
</message>
<message>
<location line="+49"/>
<source>Startup time</source>
<translation>Oppstartstidspunkt</translation>
</message>
<message>
<location line="+29"/>
<source>Network</source>
<translation>Nettverk</translation>
</message>
<message>
<location line="+7"/>
<source>Number of connections</source>
<translation>Antall tilkoblinger</translation>
</message>
<message>
<location line="+23"/>
<source>On testnet</source>
<translation>På testnett</translation>
</message>
<message>
<location line="+23"/>
<source>Block chain</source>
<translation>Blokkjeden</translation>
</message>
<message>
<location line="+7"/>
<source>Current number of blocks</source>
<translation>Nåværende antall blokker</translation>
</message>
<message>
<location line="+23"/>
<source>Estimated total blocks</source>
<translation>Estimert totalt antall blokker</translation>
</message>
<message>
<location line="+23"/>
<source>Last block time</source>
<translation>Tidspunkt for siste blokk</translation>
</message>
<message>
<location line="+52"/>
<source>&Open</source>
<translation>&Åpne</translation>
</message>
<message>
<location line="+16"/>
<source>Command-line options</source>
<translation>Kommandolinjevalg</translation>
</message>
<message>
<location line="+7"/>
<source>Show the RupayaCoin-Qt help message to get a list with possible RupayaCoin command-line options.</source>
<translation>Vis RupayaCoin-Qt hjelpemelding for å få en liste med mulige kommandolinjevalg.</translation>
</message>
<message>
<location line="+3"/>
<source>&Show</source>
<translation>&Vis</translation>
</message>
<message>
<location line="+24"/>
<source>&Console</source>
<translation>&Konsoll</translation>
</message>
<message>
<location line="-260"/>
<source>Build date</source>
<translation>Byggedato</translation>
</message>
<message>
<location line="-104"/>
<source>RupayaCoin - Debug window</source>
<translation>RupayaCoin - vindu for feilsøk</translation>
</message>
<message>
<location line="+25"/>
<source>RupayaCoin Core</source>
<translation>RupayaCoin Kjerne</translation>
</message>
<message>
<location line="+279"/>
<source>Debug log file</source>
<translation>Loggfil for feilsøk</translation>
</message>
<message>
<location line="+7"/>
<source>Open the RupayaCoin debug log file from the current data directory. This can take a few seconds for large log files.</source>
<translation>Åpne RupayaCoin loggfil for feilsøk fra datamappen. Dette kan ta noen sekunder for store loggfiler.</translation>
</message>
<message>
<location line="+102"/>
<source>Clear console</source>
<translation>Tøm konsoll</translation>
</message>
<message>
<location filename="../rpcconsole.cpp" line="-30"/>
<source>Welcome to the RupayaCoin RPC console.</source>
<translation>Velkommen til RupayaCoin RPC konsoll.</translation>
</message>
<message>
<location line="+1"/>
<source>Use up and down arrows to navigate history, and <b>Ctrl-L</b> to clear screen.</source>
<translation>Bruk opp og ned pil for å navigere historikken, og <b>Ctrl-L</b> for å tømme skjermen.</translation>
</message>
<message>
<location line="+1"/>
<source>Type <b>help</b> for an overview of available commands.</source>
<translation>Skriv <b>help</b> for en oversikt over kommandoer.</translation>
</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>Send RupayaCoins</translation>
</message>
<message>
<location line="+50"/>
<source>Send to multiple recipients at once</source>
<translation>Send til flere enn én mottaker</translation>
</message>
<message>
<location line="+3"/>
<source>Add &Recipient</source>
<translation>&Legg til Mottaker</translation>
</message>
<message>
<location line="+20"/>
<source>Remove all transaction fields</source>
<translation>Fjern alle transaksjonsfelter</translation>
</message>
<message>
<location line="+3"/>
<source>Clear &All</source>
<translation>Fjern &Alt</translation>
</message>
<message>
<location line="+22"/>
<source>Balance:</source>
<translation>Saldo:</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>Bekreft sending</translation>
</message>
<message>
<location line="+3"/>
<source>S&end</source>
<translation>S&end</translation>
</message>
<message>
<location filename="../sendcoinsdialog.cpp" line="-59"/>
<source><b>%1</b> to %2 (%3)</source>
<translation><b>%1</b> til %2 (%3)</translation>
</message>
<message>
<location line="+5"/>
<source>Confirm send coins</source>
<translation>Bekreft sending av RupayaCoins</translation>
</message>
<message>
<location line="+1"/>
<source>Are you sure you want to send %1?</source>
<translation>Er du sikker på at du vil sende %1?</translation>
</message>
<message>
<location line="+0"/>
<source> and </source>
<translation> og </translation>
</message>
<message>
<location line="+23"/>
<source>The recipient address is not valid, please recheck.</source>
<translation>Adresse for mottaker er ugyldig.</translation>
</message>
<message>
<location line="+5"/>
<source>The amount to pay must be larger than 0.</source>
<translation>Beløpen som skal betales må være over 0.</translation>
</message>
<message>
<location line="+5"/>
<source>The amount exceeds your balance.</source>
<translation>Beløpet overstiger saldo.</translation>
</message>
<message>
<location line="+5"/>
<source>The total exceeds your balance when the %1 transaction fee is included.</source>
<translation>Totalbeløpet overstiger saldo etter at %1 transaksjonsgebyr er lagt til.</translation>
</message>
<message>
<location line="+6"/>
<source>Duplicate address found, can only send to each address once per send operation.</source>
<translation>Duplikate adresser funnet. Kan bare sende én gang til hver adresse per operasjon.</translation>
</message>
<message>
<location line="+5"/>
<source>Error: Transaction creation failed!</source>
<translation>Feil: Opprettelse av transaksjon feilet </translation>
</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>Feil: Transaksjonen ble avvist. Dette kan skje om noe av beløpet allerede var brukt, f.eks. hvis du kopierte wallet.dat og noen RupayaCoins ble brukt i kopien men ikke ble markert som brukt her.</translation>
</message>
</context>
<context>
<name>SendCoinsEntry</name>
<message>
<location filename="../forms/sendcoinsentry.ui" line="+14"/>
<source>Form</source>
<translation>Skjema</translation>
</message>
<message>
<location line="+15"/>
<source>A&mount:</source>
<translation>&Beløp:</translation>
</message>
<message>
<location line="+13"/>
<source>Pay &To:</source>
<translation>Betal &Til:</translation>
</message>
<message>
<location line="+34"/>
<source>The address to send the payment to (e.g. Ler4HNAEfwYhBmGXcFP2Po1NpRUEiK8km2)</source>
<translation>Adressen betalingen skal sendes til (f.eks. Ler4HNAEfwYhBmGXcFP2Po1NpRUEiK8km2)</translation>
</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>Skriv inn en merkelapp for denne adressen for å legge den til i din adressebok</translation>
</message>
<message>
<location line="-78"/>
<source>&Label:</source>
<translation>&Merkelapp:</translation>
</message>
<message>
<location line="+28"/>
<source>Choose address from address book</source>
<translation>Velg adresse fra adresseboken</translation>
</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>Lim inn adresse fra utklippstavlen</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>Fjern denne mottakeren</translation>
</message>
<message>
<location filename="../sendcoinsentry.cpp" line="+1"/>
<source>Enter a RupayaCoin address (e.g. Ler4HNAEfwYhBmGXcFP2Po1NpRUEiK8km2)</source>
<translation>Skriv inn en RupayaCoin adresse (f.eks. Ler4HNAEfwYhBmGXcFP2Po1NpRUEiK8km2)</translation>
</message>
</context>
<context>
<name>SignVerifyMessageDialog</name>
<message>
<location filename="../forms/signverifymessagedialog.ui" line="+14"/>
<source>Signatures - Sign / Verify a Message</source>
<translation>Signaturer - Signer / Verifiser en melding</translation>
</message>
<message>
<location line="+13"/>
<source>&Sign Message</source>
<translation>&Signér Melding</translation>
</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>Du kan signere meldinger med dine adresser for å bevise at du eier dem. Ikke signér vage meldinger da phishing-angrep kan prøve å lure deg til å signere din identitet over til andre. Signér kun fullt detaljerte utsagn som du er enig i.</translation>
</message>
<message>
<location line="+18"/>
<source>The address to sign the message with (e.g. Ler4HNAEfwYhBmGXcFP2Po1NpRUEiK8km2)</source>
<translation>Adressen for signering av meldingen (f.eks. Ler4HNAEfwYhBmGXcFP2Po1NpRUEiK8km2)</translation>
</message>
<message>
<location line="+10"/>
<location line="+213"/>
<source>Choose an address from the address book</source>
<translation>Velg en adresse fra adresseboken</translation>
</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>Lim inn adresse fra utklippstavlen</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>Skriv inn meldingen du vil signere her</translation>
</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>Kopier valgt signatur til utklippstavle</translation>
</message>
<message>
<location line="+21"/>
<source>Sign the message to prove you own this RupayaCoin address</source>
<translation>Signer meldingen for å bevise at du eier denne RupayaCoin-adressen</translation>
</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>Tilbakestill alle felter for meldingssignering</translation>
</message>
<message>
<location line="+3"/>
<location line="+146"/>
<source>Clear &All</source>
<translation>Fjern &Alt</translation>
</message>
<message>
<location line="-87"/>
<source>&Verify Message</source>
<translation>&Verifiser Melding</translation>
</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>Angi adresse for signering, melding (vær sikker på at du kopierer linjeskift, mellomrom, tab, etc. helt nøyaktig) og signatur under for å verifisere meldingen. Vær forsiktig med at du ikke gir signaturen mer betydning enn det som faktisk står i meldingen, for å unngå å bli lurt av såkalte "man-in-the-middle" angrep.</translation>
</message>
<message>
<location line="+21"/>
<source>The address the message was signed with (e.g. Ler4HNAEfwYhBmGXcFP2Po1NpRUEiK8km2)</source>
<translation>Adressen meldingen var signert med (f.eks. Ler4HNAEfwYhBmGXcFP2Po1NpRUEiK8km2)</translation>
</message>
<message>
<location line="+40"/>
<source>Verify the message to ensure it was signed with the specified RupayaCoin address</source>
<translation>Verifiser meldingen for å være sikker på at den ble signert av den angitte RupayaCoin-adressen</translation>
</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>Tilbakestill alle felter for meldingsverifikasjon</translation>
</message>
<message>
<location filename="../signverifymessagedialog.cpp" line="+27"/>
<location line="+3"/>
<source>Enter a RupayaCoin address (e.g. Ler4HNAEfwYhBmGXcFP2Po1NpRUEiK8km2)</source>
<translation>Skriv inn en RupayaCoin adresse (f.eks. Ler4HNAEfwYhBmGXcFP2Po1NpRUEiK8km2)</translation>
</message>
<message>
<location line="-2"/>
<source>Click "Sign Message" to generate signature</source>
<translation>Klikk "Signer Melding" for å generere signatur</translation>
</message>
<message>
<location line="+3"/>
<source>Enter RupayaCoin signature</source>
<translation>Angi RupayaCoin signatur</translation>
</message>
<message>
<location line="+82"/>
<location line="+81"/>
<source>The entered address is invalid.</source>
<translation>Angitt adresse er ugyldig.</translation>
</message>
<message>
<location line="-81"/>
<location line="+8"/>
<location line="+73"/>
<location line="+8"/>
<source>Please check the address and try again.</source>
<translation>Vennligst sjekk adressen og prøv igjen.</translation>
</message>
<message>
<location line="-81"/>
<location line="+81"/>
<source>The entered address does not refer to a key.</source>
<translation>Angitt adresse refererer ikke til en nøkkel.</translation>
</message>
<message>
<location line="-73"/>
<source>Wallet unlock was cancelled.</source>
<translation>Opplåsing av lommebok ble avbrutt.</translation>
</message>
<message>
<location line="+8"/>
<source>Private key for the entered address is not available.</source>
<translation>Privat nøkkel for den angitte adressen er ikke tilgjengelig.</translation>
</message>
<message>
<location line="+12"/>
<source>Message signing failed.</source>
<translation>Signering av melding feilet.</translation>
</message>
<message>
<location line="+5"/>
<source>Message signed.</source>
<translation>Melding signert.</translation>
</message>
<message>
<location line="+59"/>
<source>The signature could not be decoded.</source>
<translation>Signaturen kunne ikke dekodes.</translation>
</message>
<message>
<location line="+0"/>
<location line="+13"/>
<source>Please check the signature and try again.</source>
<translation>Vennligst sjekk signaturen og prøv igjen.</translation>
</message>
<message>
<location line="+0"/>
<source>The signature did not match the message digest.</source>
<translation>Signaturen passer ikke til meldingen.</translation>
</message>
<message>
<location line="+7"/>
<source>Message verification failed.</source>
<translation>Verifikasjon av melding feilet.</translation>
</message>
<message>
<location line="+5"/>
<source>Message verified.</source>
<translation>Melding verifisert.</translation>
</message>
</context>
<context>
<name>SplashScreen</name>
<message>
<location filename="../splashscreen.cpp" line="+22"/>
<source>The RupayaCoin developers</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>[testnet]</source>
<translation>[testnett]</translation>
</message>
</context>
<context>
<name>TransactionDesc</name>
<message>
<location filename="../transactiondesc.cpp" line="+20"/>
<source>Open until %1</source>
<translation>Åpen til %1</translation>
</message>
<message>
<location line="+6"/>
<source>%1/offline</source>
<translation>%1/frakoblet</translation>
</message>
<message>
<location line="+2"/>
<source>%1/unconfirmed</source>
<translation>%1/ubekreftet</translation>
</message>
<message>
<location line="+2"/>
<source>%1 confirmations</source>
<translation>%1 bekreftelser</translation>
</message>
<message>
<location line="+18"/>
<source>Status</source>
<translation>Status</translation>
</message>
<message numerus="yes">
<location line="+7"/>
<source>, broadcast through %n node(s)</source>
<translation><numerusform>, kringkast gjennom %n node</numerusform><numerusform>, kringkast gjennom %n noder</numerusform></translation>
</message>
<message>
<location line="+4"/>
<source>Date</source>
<translation>Dato</translation>
</message>
<message>
<location line="+7"/>
<source>Source</source>
<translation>Kilde</translation>
</message>
<message>
<location line="+0"/>
<source>Generated</source>
<translation>Generert</translation>
</message>
<message>
<location line="+5"/>
<location line="+17"/>
<source>From</source>
<translation>Fra</translation>
</message>
<message>
<location line="+1"/>
<location line="+22"/>
<location line="+58"/>
<source>To</source>
<translation>Til</translation>
</message>
<message>
<location line="-77"/>
<location line="+2"/>
<source>own address</source>
<translation>egen adresse</translation>
</message>
<message>
<location line="-2"/>
<source>label</source>
<translation>merkelapp</translation>
</message>
<message>
<location line="+37"/>
<location line="+12"/>
<location line="+45"/>
<location line="+17"/>
<location line="+30"/>
<source>Credit</source>
<translation>Kredit</translation>
</message>
<message numerus="yes">
<location line="-102"/>
<source>matures in %n more block(s)</source>
<translation><numerusform>blir moden om %n blokk</numerusform><numerusform>blir moden om %n blokker</numerusform></translation>
</message>
<message>
<location line="+2"/>
<source>not accepted</source>
<translation>ikke akseptert</translation>
</message>
<message>
<location line="+44"/>
<location line="+8"/>
<location line="+15"/>
<location line="+30"/>
<source>Debit</source>
<translation>Debet</translation>
</message>
<message>
<location line="-39"/>
<source>Transaction fee</source>
<translation>Transaksjonsgebyr</translation>
</message>
<message>
<location line="+16"/>
<source>Net amount</source>
<translation>Nettobeløp</translation>
</message>
<message>
<location line="+6"/>
<source>Message</source>
<translation>Melding</translation>
</message>
<message>
<location line="+2"/>
<source>Comment</source>
<translation>Kommentar</translation>
</message>
<message>
<location line="+2"/>
<source>Transaction ID</source>
<translation>Transaksjons-ID</translation>
</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>Genererte RupayaCoins må modnes 120 blokker før de kan brukes. Da du genererte denne blokken ble den kringkastet til nettverket for å legges til i blokkjeden. Hvis den ikke kommer inn i kjeden får den tilstanden "ikke akseptert" og vil ikke kunne brukes. Dette skjer noen ganger hvis en annen node genererer en blokk noen sekunder fra din.</translation>
</message>
<message>
<location line="+7"/>
<source>Debug information</source>
<translation>Informasjon for feilsøk</translation>
</message>
<message>
<location line="+8"/>
<source>Transaction</source>
<translation>Transaksjon</translation>
</message>
<message>
<location line="+3"/>
<source>Inputs</source>
<translation>Inndata</translation>
</message>
<message>
<location line="+23"/>
<source>Amount</source>
<translation>Beløp</translation>
</message>
<message>
<location line="+1"/>
<source>true</source>
<translation>sann</translation>
</message>
<message>
<location line="+0"/>
<source>false</source>
<translation>usann</translation>
</message>
<message>
<location line="-209"/>
<source>, has not been successfully broadcast yet</source>
<translation>, har ikke blitt kringkastet uten problemer enda.</translation>
</message>
<message numerus="yes">
<location line="-35"/>
<source>Open for %n more block(s)</source>
<translation type="unfinished"><numerusform></numerusform><numerusform></numerusform></translation>
</message>
<message>
<location line="+70"/>
<source>unknown</source>
<translation>ukjent</translation>
</message>
</context>
<context>
<name>TransactionDescDialog</name>
<message>
<location filename="../forms/transactiondescdialog.ui" line="+14"/>
<source>Transaction details</source>
<translation>Transaksjonsdetaljer</translation>
</message>
<message>
<location line="+6"/>
<source>This pane shows a detailed description of the transaction</source>
<translation>Her vises en detaljert beskrivelse av transaksjonen</translation>
</message>
</context>
<context>
<name>TransactionTableModel</name>
<message>
<location filename="../transactiontablemodel.cpp" line="+225"/>
<source>Date</source>
<translation>Dato</translation>
</message>
<message>
<location line="+0"/>
<source>Type</source>
<translation>Type</translation>
</message>
<message>
<location line="+0"/>
<source>Address</source>
<translation>Adresse</translation>
</message>
<message>
<location line="+0"/>
<source>Amount</source>
<translation>Beløp</translation>
</message>
<message numerus="yes">
<location line="+57"/>
<source>Open for %n more block(s)</source>
<translation type="unfinished"><numerusform></numerusform><numerusform></numerusform></translation>
</message>
<message>
<location line="+3"/>
<source>Open until %1</source>
<translation>Åpen til %1</translation>
</message>
<message>
<location line="+3"/>
<source>Offline (%1 confirmations)</source>
<translation>Frakoblet (%1 bekreftelser)</translation>
</message>
<message>
<location line="+3"/>
<source>Unconfirmed (%1 of %2 confirmations)</source>
<translation>Ubekreftet (%1 av %2 bekreftelser)</translation>
</message>
<message>
<location line="+3"/>
<source>Confirmed (%1 confirmations)</source>
<translation>Bekreftet (%1 bekreftelser)</translation>
</message>
<message numerus="yes">
<location line="+8"/>
<source>Mined balance will be available when it matures in %n more block(s)</source>
<translation><numerusform>Minet saldo blir tilgjengelig når den modner om %n blokk</numerusform><numerusform>Minet saldo blir tilgjengelig når den modner om %n blokker</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>Denne blokken har ikke blitt mottatt av noen andre noder og vil sannsynligvis ikke bli akseptert!</translation>
</message>
<message>
<location line="+3"/>
<source>Generated but not accepted</source>
<translation>Generert men ikke akseptert</translation>
</message>
<message>
<location line="+43"/>
<source>Received with</source>
<translation>Mottatt med</translation>
</message>
<message>
<location line="+2"/>
<source>Received from</source>
<translation>Mottatt fra</translation>
</message>
<message>
<location line="+3"/>
<source>Sent to</source>
<translation>Sendt til</translation>
</message>
<message>
<location line="+2"/>
<source>Payment to yourself</source>
<translation>Betaling til deg selv</translation>
</message>
<message>
<location line="+2"/>
<source>Mined</source>
<translation>Utvunnet</translation>
</message>
<message>
<location line="+38"/>
<source>(n/a)</source>
<translation>-</translation>
</message>
<message>
<location line="+199"/>
<source>Transaction status. Hover over this field to show number of confirmations.</source>
<translation>Transaksjonsstatus. Hold muspekeren over dette feltet for å se antall bekreftelser.</translation>
</message>
<message>
<location line="+2"/>
<source>Date and time that the transaction was received.</source>
<translation>Dato og tid for da transaksjonen ble mottat.</translation>
</message>
<message>
<location line="+2"/>
<source>Type of transaction.</source>
<translation>Type transaksjon.</translation>
</message>
<message>
<location line="+2"/>
<source>Destination address of transaction.</source>
<translation>Mottaksadresse for transaksjonen</translation>
</message>
<message>
<location line="+2"/>
<source>Amount removed from or added to balance.</source>
<translation>Beløp fjernet eller lagt til saldo.</translation>
</message>
</context>
<context>
<name>TransactionView</name>
<message>
<location filename="../transactionview.cpp" line="+52"/>
<location line="+16"/>
<source>All</source>
<translation>Alle</translation>
</message>
<message>
<location line="-15"/>
<source>Today</source>
<translation>I dag</translation>
</message>
<message>
<location line="+1"/>
<source>This week</source>
<translation>Denne uken</translation>
</message>
<message>
<location line="+1"/>
<source>This month</source>
<translation>Denne måneden</translation>
</message>
<message>
<location line="+1"/>
<source>Last month</source>
<translation>Forrige måned</translation>
</message>
<message>
<location line="+1"/>
<source>This year</source>
<translation>Dette året</translation>
</message>
<message>
<location line="+1"/>
<source>Range...</source>
<translation>Intervall...</translation>
</message>
<message>
<location line="+11"/>
<source>Received with</source>
<translation>Mottatt med</translation>
</message>
<message>
<location line="+2"/>
<source>Sent to</source>
<translation>Sendt til</translation>
</message>
<message>
<location line="+2"/>
<source>To yourself</source>
<translation>Til deg selv</translation>
</message>
<message>
<location line="+1"/>
<source>Mined</source>
<translation>Utvunnet</translation>
</message>
<message>
<location line="+1"/>
<source>Other</source>
<translation>Andre</translation>
</message>
<message>
<location line="+7"/>
<source>Enter address or label to search</source>
<translation>Skriv inn adresse eller merkelapp for søk</translation>
</message>
<message>
<location line="+7"/>
<source>Min amount</source>
<translation>Minimumsbeløp</translation>
</message>
<message>
<location line="+34"/>
<source>Copy address</source>
<translation>Kopier adresse</translation>
</message>
<message>
<location line="+1"/>
<source>Copy label</source>
<translation>Kopier merkelapp</translation>
</message>
<message>
<location line="+1"/>
<source>Copy amount</source>
<translation>Kopiér beløp</translation>
</message>
<message>
<location line="+1"/>
<source>Copy transaction ID</source>
<translation>Kopier transaksjons-ID</translation>
</message>
<message>
<location line="+1"/>
<source>Edit label</source>
<translation>Rediger merkelapp</translation>
</message>
<message>
<location line="+1"/>
<source>Show transaction details</source>
<translation>Vis transaksjonsdetaljer</translation>
</message>
<message>
<location line="+139"/>
<source>Export Transaction Data</source>
<translation>Eksporter transaksjonsdata</translation>
</message>
<message>
<location line="+1"/>
<source>Comma separated file (*.csv)</source>
<translation>Kommaseparert fil (*.csv)</translation>
</message>
<message>
<location line="+8"/>
<source>Confirmed</source>
<translation>Bekreftet</translation>
</message>
<message>
<location line="+1"/>
<source>Date</source>
<translation>Dato</translation>
</message>
<message>
<location line="+1"/>
<source>Type</source>
<translation>Type</translation>
</message>
<message>
<location line="+1"/>
<source>Label</source>
<translation>Merkelapp</translation>
</message>
<message>
<location line="+1"/>
<source>Address</source>
<translation>Adresse</translation>
</message>
<message>
<location line="+1"/>
<source>Amount</source>
<translation>Beløp</translation>
</message>
<message>
<location line="+1"/>
<source>ID</source>
<translation>ID</translation>
</message>
<message>
<location line="+4"/>
<source>Error exporting</source>
<translation>Feil ved eksport</translation>
</message>
<message>
<location line="+0"/>
<source>Could not write to file %1.</source>
<translation>Kunne ikke skrive til filen %1.</translation>
</message>
<message>
<location line="+100"/>
<source>Range:</source>
<translation>Intervall:</translation>
</message>
<message>
<location line="+8"/>
<source>to</source>
<translation>til</translation>
</message>
</context>
<context>
<name>WalletModel</name>
<message>
<location filename="../walletmodel.cpp" line="+193"/>
<source>Send Coins</source>
<translation>Send RupayaCoins</translation>
</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>Eksporter data fra nåværende fane til fil</translation>
</message>
<message>
<location line="+193"/>
<source>Backup Wallet</source>
<translation>Sikkerhetskopier lommebok</translation>
</message>
<message>
<location line="+0"/>
<source>Wallet Data (*.dat)</source>
<translation>Lommebokdata (*.dat)</translation>
</message>
<message>
<location line="+3"/>
<source>Backup Failed</source>
<translation>Sikkerhetskopiering feilet</translation>
</message>
<message>
<location line="+0"/>
<source>There was an error trying to save the wallet data to the new location.</source>
<translation>En feil oppstod under lagringen av lommeboken til den nye plasseringen.</translation>
</message>
<message>
<location line="+4"/>
<source>Backup Successful</source>
<translation>Sikkerhetskopiering fullført</translation>
</message>
<message>
<location line="+0"/>
<source>The wallet data was successfully saved to the new location.</source>
<translation>Lommebokdata ble lagret til den nye plasseringen. </translation>
</message>
</context>
<context>
<name>bitcoin-core</name>
<message>
<location filename="../bitcoinstrings.cpp" line="+94"/>
<source>RupayaCoin version</source>
<translation>RupayaCoin versjon</translation>
</message>
<message>
<location line="+102"/>
<source>Usage:</source>
<translation>Bruk:</translation>
</message>
<message>
<location line="-29"/>
<source>Send command to -server or RupayaCoind</source>
<translation>Send kommando til -server eller RupayaCoind</translation>
</message>
<message>
<location line="-23"/>
<source>List commands</source>
<translation>List opp kommandoer</translation>
</message>
<message>
<location line="-12"/>
<source>Get help for a command</source>
<translation>Vis hjelpetekst for en kommando</translation>
</message>
<message>
<location line="+24"/>
<source>Options:</source>
<translation>Innstillinger:</translation>
</message>
<message>
<location line="+24"/>
<source>Specify configuration file (default: RupayaCoin.conf)</source>
<translation>Angi konfigurasjonsfil (standardverdi: RupayaCoin.conf)</translation>
</message>
<message>
<location line="+3"/>
<source>Specify pid file (default: RupayaCoind.pid)</source>
<translation>Angi pid-fil (standardverdi: RupayaCoind.pid)</translation>
</message>
<message>
<location line="-1"/>
<source>Specify data directory</source>
<translation>Angi mappe for datafiler</translation>
</message>
<message>
<location line="-9"/>
<source>Set database cache size in megabytes (default: 25)</source>
<translation>Sett størrelse på mellomlager for database i megabytes (standardverdi: 25)</translation>
</message>
<message>
<location line="-28"/>
<source>Listen for connections on <port> (default: 22556 or testnet: 44556)</source>
<translation>Lytt etter tilkoblinger på <port> (standardverdi: 22556 eller testnet: 44556)</translation>
</message>
<message>
<location line="+5"/>
<source>Maintain at most <n> connections to peers (default: 125)</source>
<translation>Hold maks <n> koblinger åpne til andre noder (standardverdi: 125)</translation>
</message>
<message>
<location line="-48"/>
<source>Connect to a node to retrieve peer addresses, and disconnect</source>
<translation>Koble til node for å hente adresser til andre noder, koble så fra igjen</translation>
</message>
<message>
<location line="+82"/>
<source>Specify your own public address</source>
<translation>Angi din egen offentlige adresse</translation>
</message>
<message>
<location line="+3"/>
<source>Threshold for disconnecting misbehaving peers (default: 100)</source>
<translation>Grenseverdi for å koble fra noder med dårlig oppførsel (standardverdi: 100)</translation>
</message>
<message>
<location line="-134"/>
<source>Number of seconds to keep misbehaving peers from reconnecting (default: 86400)</source>
<translation>Antall sekunder noder med dårlig oppførsel hindres fra å koble til på nytt (standardverdi: 86400)</translation>
</message>
<message>
<location line="-29"/>
<source>An error occurred while setting up the RPC port %u for listening on IPv4: %s</source>
<translation>En feil oppstod ved opprettelse av RPC port %u for lytting: %s</translation>
</message>
<message>
<location line="+27"/>
<source>Listen for JSON-RPC connections on <port> (default: 22555 or testnet: 44555)</source>
<translation>Lytt etter JSON-RPC tilkoblinger på <port> (standardverdi: 22555 or testnet: 44555)</translation>
</message>
<message>
<location line="+37"/>
<source>Accept command line and JSON-RPC commands</source>
<translation>Ta imot kommandolinje- og JSON-RPC-kommandoer</translation>
</message>
<message>
<location line="+76"/>
<source>Run in the background as a daemon and accept commands</source>
<translation>Kjør i bakgrunnen som daemon og ta imot kommandoer</translation>
</message>
<message>
<location line="+37"/>
<source>Use the test network</source>
<translation>Bruk testnettverket</translation>
</message>
<message>
<location line="-112"/>
<source>Accept connections from outside (default: 1 if no -proxy or -connect)</source>
<translation>Ta imot tilkoblinger fra utsiden (standardverdi: 1 hvis uten -proxy eller -connect)</translation>
</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=RupayaCoinrpc
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 "RupayaCoin Alert" admin@foo.com
</source>
<translation>%s, du må angi rpcpassord i konfigurasjonsfilen.
%s
Det anbefales at du bruker det følgende tilfeldige passordet:
rpcbruker=RupayaCoinrpc
rpcpassord=%s
(du behøver ikke å huske passordet)
Brukernavnet og passordet MÅ IKKE være like.
Om filen ikke eksisterer, opprett den nå med eier-kun-les filrettigheter.
Det er også anbefalt at å sette varselsmelding slik du får melding om problemer.
For eksempel: varselmelding=echo %%s | mail -s "RupayaCoin varsel" admin@foo.com</translation>
</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>En feil oppstod under oppsettet av RPC port %u for IPv6, tilbakestilles til IPv4: %s</translation>
</message>
<message>
<location line="+3"/>
<source>Bind to given address and always listen on it. Use [host]:port notation for IPv6</source>
<translation>Bind til angitt adresse. Bruk [vertsmaskin]:port notasjon for IPv6</translation>
</message>
<message>
<location line="+3"/>
<source>Cannot obtain a lock on data directory %s. RupayaCoin 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>Kjør kommando når relevant varsel blir mottatt (%s i cmd er erstattet med TxID)</translation>
</message>
<message>
<location line="+3"/>
<source>Execute command when a wallet transaction changes (%s in cmd is replaced by TxID)</source>
<translation>Kjør kommando når en lommeboktransaksjon endres (%s i cmd er erstattet med TxID)</translation>
</message>
<message>
<location line="+11"/>
<source>Set maximum size of high-priority/low-fee transactions in bytes (default: 27000)</source>
<translation>Sett maks størrelse for transaksjoner med høy prioritet / lavt gebyr, i bytes (standardverdi: 27000)</translation>
</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>Advarsel: -paytxfee er satt veldig høyt! Dette er transaksjonsgebyret du betaler når du sender transaksjoner.</translation>
</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>Advarsel: Viste transaksjoner kan være feil! Du, eller andre noder, kan trenge en oppgradering.</translation>
</message>
<message>
<location line="+3"/>
<source>Warning: Please check that your computer's date and time are correct! If your clock is wrong RupayaCoin will not work properly.</source>
<translation>Advarsel: Vennligst undersøk at din datamaskin har riktig dato og klokkeslett! Hvis klokken er stilt feil vil ikke RupayaCoin fungere riktig.</translation>
</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>Valg for opprettelse av blokker:</translation>
</message>
<message>
<location line="+5"/>
<source>Connect only to the specified node(s)</source>
<translation>Koble kun til angitt(e) node(r)</translation>
</message>
<message>
<location line="+3"/>
<source>Corrupted block database detected</source>
<translation>Oppdaget korrupt blokkdatabase</translation>
</message>
<message>
<location line="+1"/>
<source>Discover own IP address (default: 1 when listening and no -externalip)</source>
<translation>Oppdag egen IP-adresse (standardverdi: 1 ved lytting og uten -externalip)</translation>
</message>
<message>
<location line="+1"/>
<source>Do you want to rebuild the block database now?</source>
<translation>Ønsker du å gjenopprette blokkdatabasen nå?</translation>
</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>Feil under oppstart av lommebokdatabasemiljø %s!</translation>
</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>Feil under åpning av blokkdatabase</translation>
</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>Kunne ikke lytte på noen port. Bruk -listen=0 hvis det er dette du vil.</translation>
</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>Finn andre noder gjennom DNS-oppslag (standardverdi: 1 med mindre -connect er oppgit)</translation>
</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>Gjenopprett blokkjedeindex fra blk000??.dat filer</translation>
</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>Verifiserer blokker...</translation>
</message>
<message>
<location line="+1"/>
<source>Verifying wallet...</source>
<translation>Verifiserer lommebok...</translation>
</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>Ugyldig -tor adresse: '%s'</translation>
</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>Maks mottaksbuffer per forbindelse, <n>*1000 bytes (standardverdi: 5000)</translation>
</message>
<message>
<location line="+1"/>
<source>Maximum per-connection send buffer, <n>*1000 bytes (default: 1000)</source>
<translation>Maks sendebuffer per forbindelse, <n>*1000 bytes (standardverdi: 1000)</translation>
</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>Koble kun til noder i nettverket <nett> (IPv4, IPv6 eller Tor)</translation>
</message>
<message>
<location line="+2"/>
<source>Output extra debugging information. Implies all other -debug* options</source>
<translation>Skriv ekstra informasjon for feilsøk. Medfører at alle -debug* valg tas med</translation>
</message>
<message>
<location line="+1"/>
<source>Output extra network debugging information</source>
<translation>Skriv ekstra informasjon for feilsøk av nettverk</translation>
</message>
<message>
<location line="+2"/>
<source>Prepend debug output with timestamp (default: 1)</source>
<translation>Sett tidsstempel på debugmeldinger</translation>
</message>
<message>
<location line="+5"/>
<source>SSL options: (see the RupayaCoin Wiki for SSL setup instructions)</source>
<translation>SSL valg: (se RupayaCoin Wiki for instruksjoner for oppsett av SSL)</translation>
</message>
<message>
<location line="+1"/>
<source>Select the version of socks proxy to use (4-5, default: 5)</source>
<translation>Velg versjon av socks proxy (4-5, standardverdi 5)</translation>
</message>
<message>
<location line="+3"/>
<source>Send trace/debug info to console instead of debug.log file</source>
<translation>Send spor/debug informasjon til konsollet istedenfor debug.log filen</translation>
</message>
<message>
<location line="+1"/>
<source>Send trace/debug info to debugger</source>
<translation>Send spor/debug informasjon til debugger</translation>
</message>
<message>
<location line="+5"/>
<source>Set maximum block size in bytes (default: 250000)</source>
<translation>Sett maks blokkstørrelse i bytes (standardverdi: 250000)</translation>
</message>
<message>
<location line="+1"/>
<source>Set minimum block size in bytes (default: 0)</source>
<translation>Sett minimum blokkstørrelse i bytes (standardverdi: 0)</translation>
</message>
<message>
<location line="+2"/>
<source>Shrink debug.log file on client startup (default: 1 when no -debug)</source>
<translation>Krymp debug.log filen når klienten starter (standardverdi: 1 hvis uten -debug)</translation>
</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>Angi tidsavbrudd for forbindelse i millisekunder (standardverdi: 5000)</translation>
</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>Bruk UPnP for lytteport (standardverdi: 0)</translation>
</message>
<message>
<location line="+1"/>
<source>Use UPnP to map the listening port (default: 1 when listening)</source>
<translation>Bruk UPnP for lytteport (standardverdi: 1 ved lytting)</translation>
</message>
<message>
<location line="+1"/>
<source>Use proxy to reach tor hidden services (default: same as -proxy)</source>
<translation>Bruk en proxy for å nå skjulte tor tjenester (standardverdi: samme som -proxy)</translation>
</message>
<message>
<location line="+2"/>
<source>Username for JSON-RPC connections</source>
<translation>Brukernavn for JSON-RPC forbindelser</translation>
</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>Advarsel: Denne versjonen er foreldet, oppgradering kreves!</translation>
</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>Passord for JSON-RPC forbindelser</translation>
</message>
<message>
<location line="-67"/>
<source>Allow JSON-RPC connections from specified IP address</source>
<translation>Tillat JSON-RPC tilkoblinger fra angitt IP-adresse</translation>
</message>
<message>
<location line="+76"/>
<source>Send commands to node running on <ip> (default: 127.0.0.1)</source>
<translation>Send kommandoer til node på <ip> (standardverdi: 127.0.0.1)</translation>
</message>
<message>
<location line="-120"/>
<source>Execute command when the best block changes (%s in cmd is replaced by block hash)</source>
<translation>Eksekvér kommando når beste blokk endrer seg (%s i kommandoen erstattes med blokkens hash)</translation>
</message>
<message>
<location line="+147"/>
<source>Upgrade wallet to latest format</source>
<translation>Oppgradér lommebok til nyeste format</translation>
</message>
<message>
<location line="-21"/>
<source>Set key pool size to <n> (default: 100)</source>
<translation>Angi størrelse på nøkkel-lager til <n> (standardverdi: 100)</translation>
</message>
<message>
<location line="-12"/>
<source>Rescan the block chain for missing wallet transactions</source>
<translation>Se gjennom blokk-kjeden etter manglende lommeboktransaksjoner</translation>
</message>
<message>
<location line="+35"/>
<source>Use OpenSSL (https) for JSON-RPC connections</source>
<translation>Bruk OpenSSL (https) for JSON-RPC forbindelser</translation>
</message>
<message>
<location line="-26"/>
<source>Server certificate file (default: server.cert)</source>
<translation>Servers sertifikat (standardverdi: server.cert)</translation>
</message>
<message>
<location line="+1"/>
<source>Server private key (default: server.pem)</source>
<translation>Servers private nøkkel (standardverdi: server.pem)</translation>
</message>
<message>
<location line="-151"/>
<source>Acceptable ciphers (default: TLSv1+HIGH:!SSLv2:!aNULL:!eNULL:!AH:!3DES:@STRENGTH)</source>
<translation>Akseptable krypteringsmetoder (standardverdi: TLSv1+HIGH:!SSLv2:!aNULL:!eNULL:!AH:!3DES:@STRENGTH)</translation>
</message>
<message>
<location line="+165"/>
<source>This help message</source>
<translation>Denne hjelpemeldingen</translation>
</message>
<message>
<location line="+6"/>
<source>Unable to bind to %s on this computer (bind returned error %d, %s)</source>
<translation>Kan ikke binde til %s på denne datamaskinen (bind returnerte feil %d, %s)</translation>
</message>
<message>
<location line="-91"/>
<source>Connect through socks proxy</source>
<translation>Koble til gjennom socks proxy</translation>
</message>
<message>
<location line="-10"/>
<source>Allow DNS lookups for -addnode, -seednode and -connect</source>
<translation>Tillat DNS oppslag for -addnode, -seednode og -connect</translation>
</message>
<message>
<location line="+55"/>
<source>Loading addresses...</source>
<translation>Laster adresser...</translation>
</message>
<message>
<location line="-35"/>
<source>Error loading wallet.dat: Wallet corrupted</source>
<translation>Feil ved lasting av wallet.dat: Lommeboken er skadet</translation>
</message>
<message>
<location line="+1"/>
<source>Error loading wallet.dat: Wallet requires newer version of RupayaCoin</source>
<translation>Feil ved lasting av wallet.dat: Lommeboken krever en nyere versjon av RupayaCoin</translation>
</message>
<message>
<location line="+93"/>
<source>Wallet needed to be rewritten: restart RupayaCoin to complete</source>
<translation>Lommeboken måtte skrives om: start RupayaCoin på nytt for å fullføre</translation>
</message>
<message>
<location line="-95"/>
<source>Error loading wallet.dat</source>
<translation>Feil ved lasting av wallet.dat</translation>
</message>
<message>
<location line="+28"/>
<source>Invalid -proxy address: '%s'</source>
<translation>Ugyldig -proxy adresse: '%s'</translation>
</message>
<message>
<location line="+56"/>
<source>Unknown network specified in -onlynet: '%s'</source>
<translation>Ukjent nettverk angitt i -onlynet '%s'</translation>
</message>
<message>
<location line="-1"/>
<source>Unknown -socks proxy version requested: %i</source>
<translation>Ukjent -socks proxy versjon angitt: %i</translation>
</message>
<message>
<location line="-96"/>
<source>Cannot resolve -bind address: '%s'</source>
<translation>Kunne ikke slå opp -bind adresse: '%s'</translation>
</message>
<message>
<location line="+1"/>
<source>Cannot resolve -externalip address: '%s'</source>
<translation>Kunne ikke slå opp -externalip adresse: '%s'</translation>
</message>
<message>
<location line="+44"/>
<source>Invalid amount for -paytxfee=<amount>: '%s'</source>
<translation>Ugyldig beløp for -paytxfee=<beløp>: '%s'</translation>
</message>
<message>
<location line="+1"/>
<source>Invalid amount</source>
<translation>Ugyldig beløp</translation>
</message>
<message>
<location line="-6"/>
<source>Insufficient funds</source>
<translation>Utilstrekkelige midler</translation>
</message>
<message>
<location line="+10"/>
<source>Loading block index...</source>
<translation>Laster blokkindeks...</translation>
</message>
<message>
<location line="-57"/>
<source>Add a node to connect to and attempt to keep the connection open</source>
<translation>Legg til node for tilkobling og hold forbindelsen åpen</translation>
</message>
<message>
<location line="-25"/>
<source>Unable to bind to %s on this computer. RupayaCoin is probably already running.</source>
<translation>Kan ikke binde til %s på denne datamaskinen. Sannsynligvis kjører RupayaCoin allerede.</translation>
</message>
<message>
<location line="+64"/>
<source>Fee per KB to add to transactions you send</source>
<translation>Gebyr per KB for transaksjoner du sender</translation>
</message>
<message>
<location line="+19"/>
<source>Loading wallet...</source>
<translation>Laster lommebok...</translation>
</message>
<message>
<location line="-52"/>
<source>Cannot downgrade wallet</source>
<translation>Kan ikke nedgradere lommebok</translation>
</message>
<message>
<location line="+3"/>
<source>Cannot write default address</source>
<translation>Kan ikke skrive standardadresse</translation>
</message>
<message>
<location line="+64"/>
<source>Rescanning...</source>
<translation>Leser gjennom...</translation>
</message>
<message>
<location line="-57"/>
<source>Done loading</source>
<translation>Ferdig med lasting</translation>
</message>
<message>
<location line="+82"/>
<source>To use the %s option</source>
<translation>For å bruke %s opsjonen</translation>
</message>
<message>
<location line="-74"/>
<source>Error</source>
<translation>Feil</translation>
</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>Du må sette rpcpassword=<passord> i konfigurasjonsfilen:
%s
Hvis filen ikke finnes, opprett den med leserettighet kun for eier av filen.</translation>
</message>
</context>
</TS>
| tyarlande/rupayacoin | src/qt/locale/bitcoin_nb.ts | TypeScript | mit | 113,521 | [
30522,
1026,
1029,
20950,
2544,
1027,
1000,
1015,
1012,
1014,
1000,
1029,
1028,
1026,
999,
9986,
13874,
24529,
1028,
1026,
24529,
2653,
1027,
1000,
1050,
2497,
1000,
2544,
1027,
1000,
1016,
1012,
1014,
1000,
1028,
1026,
12398,
16044,
2278,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
# Croton uruguayensis Baill. SPECIES
#### Status
ACCEPTED
#### According to
The Catalogue of Life, 3rd January 2011
#### Published in
null
#### Original name
null
### Remarks
null | mdoering/backbone | life/Plantae/Magnoliophyta/Magnoliopsida/Malpighiales/Euphorbiaceae/Croton/Croton uruguayensis/README.md | Markdown | apache-2.0 | 184 | [
30522,
1001,
13675,
25862,
11724,
9911,
15358,
2140,
1012,
2427,
1001,
1001,
1001,
1001,
3570,
3970,
1001,
1001,
1001,
1001,
2429,
2000,
1996,
10161,
1997,
2166,
1010,
3822,
2254,
2249,
1001,
1001,
1001,
1001,
2405,
1999,
19701,
1001,
1001,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
angular.module('app')
.controller('ProgressController', ['$scope', function ($scope) {
$scope.percent = 45;
$scope.setPercent = function(p) {
$scope.percent = p;
}
}]) | ShadowZheng/angular-ui-newbee | doc/app/controllers/ProgressController.js | JavaScript | mit | 173 | [
30522,
16108,
1012,
11336,
1006,
1005,
10439,
1005,
1007,
1012,
11486,
1006,
1005,
5082,
8663,
13181,
10820,
1005,
1010,
1031,
1005,
1002,
9531,
1005,
1010,
3853,
1006,
1002,
9531,
1007,
1063,
1002,
9531,
1012,
3867,
1027,
3429,
1025,
1002,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
---
layout: page
title: Montgomery Financial Seminar
date: 2016-05-24
author: Michael Chase
tags: weekly links, java
status: published
summary: Fusce non ultrices urna. Aliquam congue.
banner: images/banner/meeting-01.jpg
booking:
startDate: 07/01/2017
endDate: 07/02/2017
ctyhocn: CHIRSHX
groupCode: MFS
published: true
---
Aenean diam tellus, finibus sit amet quam id, eleifend dignissim ligula. Duis non vulputate diam. Nunc finibus turpis leo, id ultrices nunc ultrices vitae. Maecenas in augue magna. Quisque porta, nibh in posuere aliquam, massa neque malesuada tellus, porttitor vehicula arcu nunc ac magna. Curabitur vel tincidunt augue, vel sollicitudin metus. Aenean a consectetur eros, sit amet sagittis lorem. Phasellus vitae velit est.
Nulla condimentum enim in nibh tristique imperdiet. Duis elementum commodo feugiat. Nullam at sodales turpis, id venenatis neque. Duis ac enim aliquet, iaculis quam nec, hendrerit lacus. Curabitur fringilla, enim quis tristique pharetra, mauris nisi condimentum dui, sed sodales neque velit vel lectus. Vestibulum ullamcorper nibh sit amet aliquet vestibulum. Maecenas placerat fermentum auctor.
* Aenean ac sem fermentum, euismod sem et, tincidunt diam
* Donec sodales lorem in laoreet finibus.
Aliquam feugiat nec dui ut malesuada. Suspendisse bibendum nibh mi. Phasellus augue magna, sagittis a suscipit eget, blandit facilisis diam. Aenean vitae pellentesque eros. Nunc aliquam dapibus dictum. Donec cursus lectus nunc, eget semper elit aliquam quis. Aenean euismod mollis bibendum. Proin porta dolor vel urna convallis, ac auctor ante convallis. Nam gravida pharetra iaculis. Duis consectetur purus non ligula molestie mattis. Nullam varius sit amet magna sed sollicitudin. Duis ac auctor lacus. Pellentesque nec neque magna. Phasellus ullamcorper consequat nulla, quis pretium erat fringilla iaculis. Fusce eu aliquam massa. Vivamus varius diam ut rhoncus volutpat.
Suspendisse sed rhoncus ex. Phasellus nulla quam, porta ut lorem ornare, ornare feugiat felis. In facilisis gravida luctus. Quisque posuere sapien vel ultricies aliquam. Etiam porta justo eu erat viverra euismod a at mauris. Suspendisse lobortis dolor neque. Morbi ut velit non lectus tristique blandit eu ac quam. Phasellus lorem elit, eleifend at aliquet id, mattis id sapien. Maecenas id ex sed orci condimentum aliquet in ac nisl. Phasellus tincidunt, orci ac rutrum tristique, ante lorem semper lacus, in egestas tortor leo vitae diam. Etiam pretium massa a lobortis laoreet. Praesent dignissim enim eget pellentesque consequat. Duis eleifend vitae nulla sit amet gravida. Sed vitae congue tortor. Cras a faucibus massa, nec consectetur felis. Aenean eget purus molestie, viverra dolor id, euismod ligula.
| KlishGroup/prose-pogs | pogs/C/CHIRSHX/MFS/index.md | Markdown | mit | 2,742 | [
30522,
1011,
1011,
1011,
9621,
1024,
3931,
2516,
1024,
8482,
3361,
18014,
3058,
1024,
2355,
1011,
5709,
1011,
2484,
3166,
1024,
2745,
5252,
22073,
1024,
4882,
6971,
1010,
9262,
3570,
1024,
2405,
12654,
1024,
11865,
11020,
2063,
2512,
17359,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
'use strict';
var conf = require('../config');
var ctrlBuilder = require('../controllers/face-controller');
var version = conf.get('version');
var base_route = conf.get('baseurlpath');
var face_route = base_route + '/face';
module.exports = function (server, models, redis) {
var controller = ctrlBuilder(server, models, redis);
server.get({path: face_route, version: version}, controller.randomFace);
server.head({path: face_route, version: version}, controller.randomFace);
};
| epappas/random-api | openapi/routes/face.js | JavaScript | mit | 497 | [
30522,
1005,
2224,
9384,
1005,
1025,
13075,
9530,
2546,
1027,
5478,
1006,
1005,
1012,
1012,
1013,
9530,
8873,
2290,
1005,
1007,
1025,
13075,
14931,
12190,
8569,
23891,
2099,
1027,
5478,
1006,
1005,
1012,
1012,
1013,
21257,
1013,
2227,
1011,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
/* eslint-env mocha */
import { Controller } from '../'
import assert from 'assert'
import { equals } from './'
import { state, props } from '../tags'
describe('operator.equals', () => {
it('should go down path based on props', () => {
let count = 0
const controller = Controller({
state: {
foo: 'bar',
},
signals: {
test: [
equals(props`foo`),
{
bar: [
() => {
count++
},
],
otherwise: [],
},
],
},
})
controller.getSignal('test')({ foo: 'bar' })
assert.equal(count, 1)
})
it('should go down path based on state', () => {
let count = 0
const controller = Controller({
state: {
foo: 'bar',
},
signals: {
test: [
equals(state`foo`),
{
bar: [
() => {
count++
},
],
otherwise: [],
},
],
},
})
controller.getSignal('test')()
assert.equal(count, 1)
})
it('should throw on bad argument', done => {
const controller = Controller({
state: {
foo: 'bar',
},
signals: {
test: [
equals('foo'),
{
bar: [() => {}],
otherwise: [],
},
],
},
})
controller.removeListener('error')
controller.once('error', error => {
assert.ok(error)
done()
})
controller.getSignal('test')()
})
})
| garth/cerebral | packages/node_modules/cerebral/src/operators/equals.test.js | JavaScript | mit | 1,570 | [
30522,
1013,
1008,
9686,
30524,
12324,
20865,
2013,
1005,
20865,
1005,
12324,
1063,
19635,
1065,
2013,
1005,
1012,
1013,
1005,
12324,
1063,
2110,
1010,
24387,
1065,
2013,
1005,
1012,
1012,
1013,
22073,
1005,
6235,
1006,
1005,
6872,
1012,
19... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
body, html {
margin: 0;
padding: 0;
font-family: Roboto;
background: #ebeff1;
}
#insert-box, #list-box, h1 {
width: 86%;
padding: 3%;
margin-left: auto;
margin-right: auto;
}
.box {
box-shadow: 0px 3px 1px -2px rgba(0, 0, 0, 0.2), 0px 2px 2px 0px rgba(0, 0, 0, 0.14), 0px 1px 5px 0px rgba(0, 0, 0, 0.12);
margin-bottom: 20px;
background: white;
}
#insert-box h3, #insert-box input, #insert-box button {
width: 100%;
}
.box h3 {
margin-top: 0;
}
input {
font-size: 16px;
font-weight: lighter;
border: 0;
border-bottom: 1px solid #999;
margin-bottom: 20px;
padding-bottom: 7px;
}
input:focus {
outline: none;
}
button {
background-color: #009688;
outline: none;
border: none;
color: white;
font-size: 16px;
border-radius: 4px;
padding: 1.5%;
cursor: pointer;
box-shadow: 0px 3px 1px -2px rgba(0, 0, 0, 0.2), 0px 2px 2px 0px rgba(0, 0, 0, 0.14), 0px 1px 5px 0px rgba(0, 0, 0, 0.12);
}
h1 {
display: block;
font-size: 1.17em;
-webkit-margin-before: 1em;
-webkit-margin-after: 1em;
-webkit-margin-start: 0px;
-webkit-margin-end: 0px;
font-weight: bold;
margin: 0 auto;
padding: 3%;
width: 92%;
}
h3 {
font-size: 14px;
color: rgba(0, 0, 0, 0.54);
}
ul {
list-style: none;
padding: 0 16px;
display: inline-block;
position: relative;
}
ul#heroes-list li {
width: 100%;
float: left;
margin-top: 6px;
margin-bottom: 6px;
}
.color-box {
width: 20px;
height: 20px;
float: left;
margin-right: 11px;
border-radius: 2px;
border-width: 1px;
border-style: solid;
border-color: grey;
}
#leader-icon {
float: right;
font-size: 21px;
margin-top: -10px;
color: #afaf18;
margin-right: -10px;
display: none;
}
| natew/rxdb | examples/vanilla/style.css | CSS | apache-2.0 | 1,852 | [
30522,
2303,
1010,
16129,
1063,
7785,
1024,
1014,
1025,
11687,
4667,
1024,
1014,
1025,
15489,
1011,
2155,
1024,
8957,
2080,
1025,
4281,
1024,
1001,
1041,
4783,
4246,
2487,
1025,
1065,
1001,
19274,
1011,
3482,
1010,
1001,
2862,
1011,
3482,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
<?xml version="1.0" ?><!DOCTYPE TS><TS language="de" version="2.0">
<defaultcodec>UTF-8</defaultcodec>
<context>
<name>AboutDialog</name>
<message>
<location filename="../forms/aboutdialog.ui" line="+14"/>
<source>About Blizzardcoin</source>
<translation>Über Blizzardcoin</translation>
</message>
<message>
<location line="+39"/>
<source><b>Blizzardcoin</b> version</source>
<translation><b>Blizzardcoin</b>-Version</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 (eay@cryptsoft.com) and UPnP software written by Thomas Bernard.</source>
<translation>
Dies ist experimentelle Software.
Veröffentlicht unter der MIT/X11-Softwarelizenz, siehe beiligende Datei COPYING oder http://www.opensource.org/licenses/mit-license.php.
Dieses Produkt enthält Software, die vom OpenSSL-Projekt zur Verwendung im OpenSSL-Toolkit (http://www.openssl.org/) entwickelt wurde, sowie kryptographische Software geschrieben von Eric Young (eay@cryptsoft.com) und UPnP-Software geschrieben von Thomas Bernard.</translation>
</message>
<message>
<location filename="../aboutdialog.cpp" line="+14"/>
<source>Copyright</source>
<translation>Copyright</translation>
</message>
<message>
<location line="+0"/>
<source>The Blizzardcoin developers</source>
<translation>Die Blizzardcoinentwickler</translation>
</message>
</context>
<context>
<name>AddressBookPage</name>
<message>
<location filename="../forms/addressbookpage.ui" line="+14"/>
<source>Address Book</source>
<translation>Adressbuch</translation>
</message>
<message>
<location line="+19"/>
<source>Double-click to edit address or label</source>
<translation>Doppelklicken, um die Adresse oder die Bezeichnung zu bearbeiten</translation>
</message>
<message>
<location line="+27"/>
<source>Create a new address</source>
<translation>Eine neue Adresse erstellen</translation>
</message>
<message>
<location line="+14"/>
<source>Copy the currently selected address to the system clipboard</source>
<translation>Ausgewählte Adresse in die Zwischenablage kopieren</translation>
</message>
<message>
<location line="-11"/>
<source>&New Address</source>
<translation>&Neue Adresse</translation>
</message>
<message>
<location filename="../addressbookpage.cpp" line="+63"/>
<source>These are your Blizzardcoin 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>Dies sind Ihre Blizzardcoin-Adressen zum Empfangen von Zahlungen. Es steht Ihnen frei, jedem Absender eine Andere mitzuteilen, um einen besseren Überblick über eingehende Zahlungen zu erhalten.</translation>
</message>
<message>
<location filename="../forms/addressbookpage.ui" line="+14"/>
<source>&Copy Address</source>
<translation>Adresse &kopieren</translation>
</message>
<message>
<location line="+11"/>
<source>Show &QR Code</source>
<translation>&QR-Code anzeigen</translation>
</message>
<message>
<location line="+11"/>
<source>Sign a message to prove you own a Blizzardcoin address</source>
<translation>Eine Nachricht signieren, um den Besitz einer Blizzardcoin-Adresse zu beweisen</translation>
</message>
<message>
<location line="+3"/>
<source>Sign &Message</source>
<translation>Nachricht &signieren</translation>
</message>
<message>
<location line="+25"/>
<source>Delete the currently selected address from the list</source>
<translation>Die ausgewählte Adresse aus der Liste entfernen.</translation>
</message>
<message>
<location line="+27"/>
<source>Export the data in the current tab to a file</source>
<translation>Daten der aktuellen Ansicht in eine Datei exportieren</translation>
</message>
<message>
<location line="+3"/>
<source>&Export</source>
<translation>E&xportieren</translation>
</message>
<message>
<location line="-44"/>
<source>Verify a message to ensure it was signed with a specified Blizzardcoin address</source>
<translation>Eine Nachricht verifizieren, um sicherzustellen, dass diese mit einer angegebenen Blizzardcoin-Adresse signiert wurde</translation>
</message>
<message>
<location line="+3"/>
<source>&Verify Message</source>
<translation>Nachricht &verifizieren</translation>
</message>
<message>
<location line="+14"/>
<source>&Delete</source>
<translation>&Löschen</translation>
</message>
<message>
<location filename="../addressbookpage.cpp" line="-5"/>
<source>These are your Blizzardcoin addresses for sending payments. Always check the amount and the receiving address before sending coins.</source>
<translation>Dies sind Ihre Blizzardcoin-Adressen zum Tätigen von Überweisungen. Bitte prüfen Sie den Betrag und die Empfangsadresse, bevor Sie Blizzardcoins überweisen.</translation>
</message>
<message>
<location line="+13"/>
<source>Copy &Label</source>
<translation>&Bezeichnung kopieren</translation>
</message>
<message>
<location line="+1"/>
<source>&Edit</source>
<translation>&Editieren</translation>
</message>
<message>
<location line="+1"/>
<source>Send &Coins</source>
<translation>Blizzardcoins &überweisen</translation>
</message>
<message>
<location line="+260"/>
<source>Export Address Book Data</source>
<translation>Adressbuch exportieren</translation>
</message>
<message>
<location line="+1"/>
<source>Comma separated file (*.csv)</source>
<translation>Kommagetrennte-Datei (*.csv)</translation>
</message>
<message>
<location line="+13"/>
<source>Error exporting</source>
<translation>Fehler beim Exportieren</translation>
</message>
<message>
<location line="+0"/>
<source>Could not write to file %1.</source>
<translation>Konnte nicht in Datei %1 schreiben.</translation>
</message>
</context>
<context>
<name>AddressTableModel</name>
<message>
<location filename="../addresstablemodel.cpp" line="+144"/>
<source>Label</source>
<translation>Bezeichnung</translation>
</message>
<message>
<location line="+0"/>
<source>Address</source>
<translation>Adresse</translation>
</message>
<message>
<location line="+36"/>
<source>(no label)</source>
<translation>(keine Bezeichnung)</translation>
</message>
</context>
<context>
<name>AskPassphraseDialog</name>
<message>
<location filename="../forms/askpassphrasedialog.ui" line="+26"/>
<source>Passphrase Dialog</source>
<translation>Passphrasendialog</translation>
</message>
<message>
<location line="+21"/>
<source>Enter passphrase</source>
<translation>Passphrase eingeben</translation>
</message>
<message>
<location line="+14"/>
<source>New passphrase</source>
<translation>Neue Passphrase</translation>
</message>
<message>
<location line="+14"/>
<source>Repeat new passphrase</source>
<translation>Neue Passphrase wiederholen</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>Geben Sie die neue Passphrase für die Brieftasche ein.<br>Bitte benutzen Sie eine Passphrase bestehend aus <b>10 oder mehr zufälligen Zeichen</b> oder <b>8 oder mehr Wörtern</b>.</translation>
</message>
<message>
<location line="+1"/>
<source>Encrypt wallet</source>
<translation>Brieftasche verschlüsseln</translation>
</message>
<message>
<location line="+3"/>
<source>This operation needs your wallet passphrase to unlock the wallet.</source>
<translation>Dieser Vorgang benötigt Ihre Passphrase, um die Brieftasche zu entsperren.</translation>
</message>
<message>
<location line="+5"/>
<source>Unlock wallet</source>
<translation>Brieftasche entsperren</translation>
</message>
<message>
<location line="+3"/>
<source>This operation needs your wallet passphrase to decrypt the wallet.</source>
<translation>Dieser Vorgang benötigt Ihre Passphrase, um die Brieftasche zu entschlüsseln.</translation>
</message>
<message>
<location line="+5"/>
<source>Decrypt wallet</source>
<translation>Brieftasche entschlüsseln</translation>
</message>
<message>
<location line="+3"/>
<source>Change passphrase</source>
<translation>Passphrase ändern</translation>
</message>
<message>
<location line="+1"/>
<source>Enter the old and new passphrase to the wallet.</source>
<translation>Geben Sie die alte und neue Passphrase der Brieftasche ein.</translation>
</message>
<message>
<location line="+46"/>
<source>Confirm wallet encryption</source>
<translation>Verschlüsselung der Brieftasche bestätigen</translation>
</message>
<message>
<location line="+1"/>
<source>Warning: If you encrypt your wallet and lose your passphrase, you will <b>LOSE ALL OF YOUR BLIZZARDCOINS</b>!</source>
<translation>Warnung: Wenn Sie Ihre Brieftasche verschlüsseln und Ihre Passphrase verlieren, werden Sie <b>alle Ihre Blizzardcoins verlieren</b>!</translation>
</message>
<message>
<location line="+0"/>
<source>Are you sure you wish to encrypt your wallet?</source>
<translation>Sind Sie sich sicher, dass Sie Ihre Brieftasche verschlüsseln möchten?</translation>
</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>WICHTIG: Alle vorherigen Sicherungen Ihrer Brieftasche sollten durch die neu erzeugte, verschlüsselte Brieftasche ersetzt werden. Aus Sicherheitsgründen werden vorherige Sicherungen der unverschlüsselten Brieftasche nutzlos, sobald Sie die neue, verschlüsselte Brieftasche verwenden.</translation>
</message>
<message>
<location line="+100"/>
<location line="+24"/>
<source>Warning: The Caps Lock key is on!</source>
<translation>Warnung: Die Feststelltaste ist aktiviert!</translation>
</message>
<message>
<location line="-130"/>
<location line="+58"/>
<source>Wallet encrypted</source>
<translation>Brieftasche verschlüsselt</translation>
</message>
<message>
<location line="-56"/>
<source>Blizzardcoin will close now to finish the encryption process. Remember that encrypting your wallet cannot fully protect your blizzardcoins from being stolen by malware infecting your computer.</source>
<translation>Blizzardcoin wird jetzt beendet, um den Verschlüsselungsprozess abzuschließen. Bitte beachten Sie, dass die Verschlüsselung Ihrer Brieftasche nicht vollständig vor Diebstahl Ihrer Blizzardcoins durch Schadsoftware schützt, die Ihren Computer befällt.</translation>
</message>
<message>
<location line="+13"/>
<location line="+7"/>
<location line="+42"/>
<location line="+6"/>
<source>Wallet encryption failed</source>
<translation>Verschlüsselung der Brieftasche fehlgeschlagen</translation>
</message>
<message>
<location line="-54"/>
<source>Wallet encryption failed due to an internal error. Your wallet was not encrypted.</source>
<translation>Die Verschlüsselung der Brieftasche ist aufgrund eines internen Fehlers fehlgeschlagen. Ihre Brieftasche wurde nicht verschlüsselt.</translation>
</message>
<message>
<location line="+7"/>
<location line="+48"/>
<source>The supplied passphrases do not match.</source>
<translation>Die eingegebenen Passphrasen stimmen nicht überein.</translation>
</message>
<message>
<location line="-37"/>
<source>Wallet unlock failed</source>
<translation>Entsperrung der Brieftasche fehlgeschlagen</translation>
</message>
<message>
<location line="+1"/>
<location line="+11"/>
<location line="+19"/>
<source>The passphrase entered for the wallet decryption was incorrect.</source>
<translation>Die eingegebene Passphrase zum Entschlüsseln der Brieftasche war nicht korrekt.</translation>
</message>
<message>
<location line="-20"/>
<source>Wallet decryption failed</source>
<translation>Entschlüsselung der Brieftasche fehlgeschlagen</translation>
</message>
<message>
<location line="+14"/>
<source>Wallet passphrase was successfully changed.</source>
<translation>Die Passphrase der Brieftasche wurde erfolgreich geändert.</translation>
</message>
</context>
<context>
<name>BitcoinGUI</name>
<message>
<location filename="../bitcoingui.cpp" line="+233"/>
<source>Sign &message...</source>
<translation>Nachricht s&ignieren...</translation>
</message>
<message>
<location line="+280"/>
<source>Synchronizing with network...</source>
<translation>Synchronisiere mit Netzwerk...</translation>
</message>
<message>
<location line="-349"/>
<source>&Overview</source>
<translation>&Übersicht</translation>
</message>
<message>
<location line="+1"/>
<source>Show general overview of wallet</source>
<translation>Allgemeine Übersicht der Brieftasche anzeigen</translation>
</message>
<message>
<location line="+20"/>
<source>&Transactions</source>
<translation>&Transaktionen</translation>
</message>
<message>
<location line="+1"/>
<source>Browse transaction history</source>
<translation>Transaktionsverlauf durchsehen</translation>
</message>
<message>
<location line="+7"/>
<source>Edit the list of stored addresses and labels</source>
<translation>Liste der gespeicherten Zahlungsadressen und Bezeichnungen bearbeiten</translation>
</message>
<message>
<location line="-14"/>
<source>Show the list of addresses for receiving payments</source>
<translation>Liste der Empfangsadressen anzeigen</translation>
</message>
<message>
<location line="+31"/>
<source>E&xit</source>
<translation>&Beenden</translation>
</message>
<message>
<location line="+1"/>
<source>Quit application</source>
<translation>Anwendung beenden</translation>
</message>
<message>
<location line="+4"/>
<source>Show information about Blizzardcoin</source>
<translation>Informationen über Blizzardcoin anzeigen</translation>
</message>
<message>
<location line="+2"/>
<source>About &Qt</source>
<translation>Über &Qt</translation>
</message>
<message>
<location line="+1"/>
<source>Show information about Qt</source>
<translation>Informationen über Qt anzeigen</translation>
</message>
<message>
<location line="+2"/>
<source>&Options...</source>
<translation>&Konfiguration...</translation>
</message>
<message>
<location line="+6"/>
<source>&Encrypt Wallet...</source>
<translation>Brieftasche &verschlüsseln...</translation>
</message>
<message>
<location line="+3"/>
<source>&Backup Wallet...</source>
<translation>Brieftasche &sichern...</translation>
</message>
<message>
<location line="+2"/>
<source>&Change Passphrase...</source>
<translation>Passphrase &ändern...</translation>
</message>
<message>
<location line="+285"/>
<source>Importing blocks from disk...</source>
<translation>Importiere Blöcke von Laufwerk...</translation>
</message>
<message>
<location line="+3"/>
<source>Reindexing blocks on disk...</source>
<translation>Reindiziere Blöcke auf Laufwerk...</translation>
</message>
<message>
<location line="-347"/>
<source>Send coins to a Blizzardcoin address</source>
<translation>Blizzardcoins an eine Blizzardcoin-Adresse überweisen</translation>
</message>
<message>
<location line="+49"/>
<source>Modify configuration options for Blizzardcoin</source>
<translation>Die Konfiguration des Clients bearbeiten</translation>
</message>
<message>
<location line="+9"/>
<source>Backup wallet to another location</source>
<translation>Eine Sicherungskopie der Brieftasche erstellen und abspeichern</translation>
</message>
<message>
<location line="+2"/>
<source>Change the passphrase used for wallet encryption</source>
<translation>Ändert die Passphrase, die für die Verschlüsselung der Brieftasche benutzt wird</translation>
</message>
<message>
<location line="+6"/>
<source>&Debug window</source>
<translation>&Debugfenster</translation>
</message>
<message>
<location line="+1"/>
<source>Open debugging and diagnostic console</source>
<translation>Debugging- und Diagnosekonsole öffnen</translation>
</message>
<message>
<location line="-4"/>
<source>&Verify message...</source>
<translation>Nachricht &verifizieren...</translation>
</message>
<message>
<location line="-165"/>
<location line="+530"/>
<source>Blizzardcoin</source>
<translation>Blizzardcoin</translation>
</message>
<message>
<location line="-530"/>
<source>Wallet</source>
<translation>Brieftasche</translation>
</message>
<message>
<location line="+101"/>
<source>&Send</source>
<translation>Überweisen</translation>
</message>
<message>
<location line="+7"/>
<source>&Receive</source>
<translation>&Empfangen</translation>
</message>
<message>
<location line="+14"/>
<source>&Addresses</source>
<translation>&Adressen</translation>
</message>
<message>
<location line="+22"/>
<source>&About Blizzardcoin</source>
<translation>&Über Blizzardcoin</translation>
</message>
<message>
<location line="+9"/>
<source>&Show / Hide</source>
<translation>&Anzeigen / Verstecken</translation>
</message>
<message>
<location line="+1"/>
<source>Show or hide the main Window</source>
<translation>Das Hauptfenster anzeigen oder verstecken</translation>
</message>
<message>
<location line="+3"/>
<source>Encrypt the private keys that belong to your wallet</source>
<translation>Verschlüsselt die zu Ihrer Brieftasche gehörenden privaten Schlüssel</translation>
</message>
<message>
<location line="+7"/>
<source>Sign messages with your Blizzardcoin addresses to prove you own them</source>
<translation>Nachrichten signieren, um den Besitz Ihrer Blizzardcoin-Adressen zu beweisen</translation>
</message>
<message>
<location line="+2"/>
<source>Verify messages to ensure they were signed with specified Blizzardcoin addresses</source>
<translation>Nachrichten verifizieren, um sicherzustellen, dass diese mit den angegebenen Blizzardcoin-Adressen signiert wurden</translation>
</message>
<message>
<location line="+28"/>
<source>&File</source>
<translation>&Datei</translation>
</message>
<message>
<location line="+7"/>
<source>&Settings</source>
<translation>&Einstellungen</translation>
</message>
<message>
<location line="+6"/>
<source>&Help</source>
<translation>&Hilfe</translation>
</message>
<message>
<location line="+9"/>
<source>Tabs toolbar</source>
<translation>Registerkartenleiste</translation>
</message>
<message>
<location line="+17"/>
<location line="+10"/>
<source>[testnet]</source>
<translation>[Testnetz]</translation>
</message>
<message>
<location line="+47"/>
<source>Blizzardcoin client</source>
<translation>Blizzardcoin-Client</translation>
</message>
<message numerus="yes">
<location line="+141"/>
<source>%n active connection(s) to Blizzardcoin network</source>
<translation><numerusform>%n aktive Verbindung zum Blizzardcoin-Netzwerk</numerusform><numerusform>%n aktive Verbindungen zum Blizzardcoin-Netzwerk</numerusform></translation>
</message>
<message>
<location line="+22"/>
<source>No block source available...</source>
<translation>Keine Blockquelle verfügbar...</translation>
</message>
<message>
<location line="+12"/>
<source>Processed %1 of %2 (estimated) blocks of transaction history.</source>
<translation>%1 von (geschätzten) %2 Blöcken des Transaktionsverlaufs verarbeitet.</translation>
</message>
<message>
<location line="+4"/>
<source>Processed %1 blocks of transaction history.</source>
<translation>%1 Blöcke des Transaktionsverlaufs verarbeitet.</translation>
</message>
<message numerus="yes">
<location line="+20"/>
<source>%n hour(s)</source>
<translation><numerusform>%n Stunde</numerusform><numerusform>%n Stunden</numerusform></translation>
</message>
<message numerus="yes">
<location line="+4"/>
<source>%n day(s)</source>
<translation><numerusform>%n Tag</numerusform><numerusform>%n Tage</numerusform></translation>
</message>
<message numerus="yes">
<location line="+4"/>
<source>%n week(s)</source>
<translation><numerusform>%n Woche</numerusform><numerusform>%n Wochen</numerusform></translation>
</message>
<message>
<location line="+4"/>
<source>%1 behind</source>
<translation>%1 im Rückstand</translation>
</message>
<message>
<location line="+14"/>
<source>Last received block was generated %1 ago.</source>
<translation>Der letzte empfangene Block ist %1 alt.</translation>
</message>
<message>
<location line="+2"/>
<source>Transactions after this will not yet be visible.</source>
<translation>Transaktionen hiernach werden noch nicht angezeigt.</translation>
</message>
<message>
<location line="+22"/>
<source>Error</source>
<translation>Fehler</translation>
</message>
<message>
<location line="+3"/>
<source>Warning</source>
<translation>Warnung</translation>
</message>
<message>
<location line="+3"/>
<source>Information</source>
<translation>Hinweis</translation>
</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>Die Transaktion übersteigt das Größenlimit. Sie können sie trotzdem senden, wenn Sie eine zusätzliche Transaktionsgebühr in Höhe von %1 zahlen. Diese wird an die Knoten verteilt, die Ihre Transaktion bearbeiten und unterstützt damit das Blizzardcoin-Netzwerk. Möchten Sie die Gebühr bezahlen?</translation>
</message>
<message>
<location line="-140"/>
<source>Up to date</source>
<translation>Auf aktuellem Stand</translation>
</message>
<message>
<location line="+31"/>
<source>Catching up...</source>
<translation>Hole auf...</translation>
</message>
<message>
<location line="+113"/>
<source>Confirm transaction fee</source>
<translation>Transaktionsgebühr bestätigen</translation>
</message>
<message>
<location line="+8"/>
<source>Sent transaction</source>
<translation>Gesendete Transaktion</translation>
</message>
<message>
<location line="+0"/>
<source>Incoming transaction</source>
<translation>Eingehende Transaktion</translation>
</message>
<message>
<location line="+1"/>
<source>Date: %1
Amount: %2
Type: %3
Address: %4
</source>
<translation>Datum: %1
Betrag: %2
Typ: %3
Adresse: %4</translation>
</message>
<message>
<location line="+33"/>
<location line="+23"/>
<source>URI handling</source>
<translation>URI Verarbeitung</translation>
</message>
<message>
<location line="-23"/>
<location line="+23"/>
<source>URI can not be parsed! This can be caused by an invalid Blizzardcoin address or malformed URI parameters.</source>
<translation>URI kann nicht analysiert werden! Dies kann durch eine ungültige Blizzardcoin-Adresse oder fehlerhafte URI-Parameter verursacht werden.</translation>
</message>
<message>
<location line="+17"/>
<source>Wallet is <b>encrypted</b> and currently <b>unlocked</b></source>
<translation>Brieftasche ist <b>verschlüsselt</b> und aktuell <b>entsperrt</b></translation>
</message>
<message>
<location line="+8"/>
<source>Wallet is <b>encrypted</b> and currently <b>locked</b></source>
<translation>Brieftasche ist <b>verschlüsselt</b> und aktuell <b>gesperrt</b></translation>
</message>
<message>
<location filename="../bitcoin.cpp" line="+111"/>
<source>A fatal error occurred. Blizzardcoin can no longer continue safely and will quit.</source>
<translation>Ein schwerer Fehler ist aufgetreten. Blizzardcoin kann nicht stabil weiter ausgeführt werden und wird beendet.</translation>
</message>
</context>
<context>
<name>ClientModel</name>
<message>
<location filename="../clientmodel.cpp" line="+104"/>
<source>Network Alert</source>
<translation>Netzwerkalarm</translation>
</message>
</context>
<context>
<name>EditAddressDialog</name>
<message>
<location filename="../forms/editaddressdialog.ui" line="+14"/>
<source>Edit Address</source>
<translation>Adresse bearbeiten</translation>
</message>
<message>
<location line="+11"/>
<source>&Label</source>
<translation>&Bezeichnung</translation>
</message>
<message>
<location line="+10"/>
<source>The label associated with this address book entry</source>
<translation>Die Bezeichnung dieses Adressbuchseintrags</translation>
</message>
<message>
<location line="+7"/>
<source>&Address</source>
<translation>&Adresse</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>Die Adresse des Adressbucheintrags. Diese kann nur für Zahlungsadressen bearbeitet werden.</translation>
</message>
<message>
<location filename="../editaddressdialog.cpp" line="+21"/>
<source>New receiving address</source>
<translation>Neue Empfangsadresse</translation>
</message>
<message>
<location line="+4"/>
<source>New sending address</source>
<translation>Neue Zahlungsadresse</translation>
</message>
<message>
<location line="+3"/>
<source>Edit receiving address</source>
<translation>Empfangsadresse bearbeiten</translation>
</message>
<message>
<location line="+4"/>
<source>Edit sending address</source>
<translation>Zahlungsadresse bearbeiten</translation>
</message>
<message>
<location line="+76"/>
<source>The entered address "%1" is already in the address book.</source>
<translation>Die eingegebene Adresse "%1" befindet sich bereits im Adressbuch.</translation>
</message>
<message>
<location line="-5"/>
<source>The entered address "%1" is not a valid Blizzardcoin address.</source>
<translation>Die eingegebene Adresse "%1" ist keine gültige Blizzardcoin-Adresse.</translation>
</message>
<message>
<location line="+10"/>
<source>Could not unlock wallet.</source>
<translation>Die Brieftasche konnte nicht entsperrt werden.</translation>
</message>
<message>
<location line="+5"/>
<source>New key generation failed.</source>
<translation>Generierung eines neuen Schlüssels fehlgeschlagen.</translation>
</message>
</context>
<context>
<name>GUIUtil::HelpMessageBox</name>
<message>
<location filename="../guiutil.cpp" line="+424"/>
<location line="+12"/>
<source>Blizzardcoin-Qt</source>
<translation>Blizzardcoin-Qt</translation>
</message>
<message>
<location line="-12"/>
<source>version</source>
<translation>Version</translation>
</message>
<message>
<location line="+2"/>
<source>Usage:</source>
<translation>Benutzung:</translation>
</message>
<message>
<location line="+1"/>
<source>command-line options</source>
<translation>Kommandozeilenoptionen</translation>
</message>
<message>
<location line="+4"/>
<source>UI options</source>
<translation>UI-Optionen</translation>
</message>
<message>
<location line="+1"/>
<source>Set language, for example "de_DE" (default: system locale)</source>
<translation>Sprache festlegen, z.B. "de_DE" (Standard: System Locale)</translation>
</message>
<message>
<location line="+1"/>
<source>Start minimized</source>
<translation>Minimiert starten</translation>
</message>
<message>
<location line="+1"/>
<source>Show splash screen on startup (default: 1)</source>
<translation>Startbildschirm beim Starten anzeigen (Standard: 1)</translation>
</message>
</context>
<context>
<name>OptionsDialog</name>
<message>
<location filename="../forms/optionsdialog.ui" line="+14"/>
<source>Options</source>
<translation>Erweiterte Einstellungen</translation>
</message>
<message>
<location line="+16"/>
<source>&Main</source>
<translation>&Allgemein</translation>
</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>Optionale Transaktionsgebühr pro KB, die sicherstellt, dass Ihre Transaktionen schnell bearbeitet werden. Die meisten Transaktionen sind 1 kB groß.</translation>
</message>
<message>
<location line="+15"/>
<source>Pay transaction &fee</source>
<translation>Transaktions&gebühr bezahlen</translation>
</message>
<message>
<location line="+31"/>
<source>Automatically start Blizzardcoin after logging in to the system.</source>
<translation>Blizzardcoin nach der Anmeldung am System automatisch ausführen.</translation>
</message>
<message>
<location line="+3"/>
<source>&Start Blizzardcoin on system login</source>
<translation>&Starte Blizzardcoin nach Systemanmeldung</translation>
</message>
<message>
<location line="+35"/>
<source>Reset all client options to default.</source>
<translation>Setzt die Clientkonfiguration auf Standardwerte zurück.</translation>
</message>
<message>
<location line="+3"/>
<source>&Reset Options</source>
<translation>Konfiguration &zurücksetzen</translation>
</message>
<message>
<location line="+13"/>
<source>&Network</source>
<translation>&Netzwerk</translation>
</message>
<message>
<location line="+6"/>
<source>Automatically open the Blizzardcoin client port on the router. This only works when your router supports UPnP and it is enabled.</source>
<translation>Automatisch den Blizzardcoin-Clientport auf dem Router öffnen. Dies funktioniert nur, wenn Ihr Router UPnP unterstützt und dies aktiviert ist.</translation>
</message>
<message>
<location line="+3"/>
<source>Map port using &UPnP</source>
<translation>Portweiterleitung via &UPnP</translation>
</message>
<message>
<location line="+7"/>
<source>Connect to the Blizzardcoin network through a SOCKS proxy (e.g. when connecting through Tor).</source>
<translation>Über einen SOCKS-Proxy mit dem Blizzardcoin-Netzwerk verbinden (z.B. beim Verbinden über Tor).</translation>
</message>
<message>
<location line="+3"/>
<source>&Connect through SOCKS proxy:</source>
<translation>Über einen SOCKS-Proxy &verbinden:</translation>
</message>
<message>
<location line="+9"/>
<source>Proxy &IP:</source>
<translation>Proxy-&IP:</translation>
</message>
<message>
<location line="+19"/>
<source>IP address of the proxy (e.g. 127.0.0.1)</source>
<translation>IP-Adresse des Proxies (z.B. 127.0.0.1)</translation>
</message>
<message>
<location line="+7"/>
<source>&Port:</source>
<translation>&Port:</translation>
</message>
<message>
<location line="+19"/>
<source>Port of the proxy (e.g. 9050)</source>
<translation>Port des Proxies (z.B. 9050)</translation>
</message>
<message>
<location line="+7"/>
<source>SOCKS &Version:</source>
<translation>SOCKS-&Version:</translation>
</message>
<message>
<location line="+13"/>
<source>SOCKS version of the proxy (e.g. 5)</source>
<translation>SOCKS-Version des Proxies (z.B. 5)</translation>
</message>
<message>
<location line="+36"/>
<source>&Window</source>
<translation>&Programmfenster</translation>
</message>
<message>
<location line="+6"/>
<source>Show only a tray icon after minimizing the window.</source>
<translation>Nur ein Symbol im Infobereich anzeigen, nachdem das Programmfenster minimiert wurde.</translation>
</message>
<message>
<location line="+3"/>
<source>&Minimize to the tray instead of the taskbar</source>
<translation>In den Infobereich anstatt in die Taskleiste &minimieren</translation>
</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>Minimiert die Anwendung anstatt sie zu beenden wenn das Fenster geschlossen wird. Wenn dies aktiviert ist, müssen Sie das Programm über "Beenden" im Menü schließen.</translation>
</message>
<message>
<location line="+3"/>
<source>M&inimize on close</source>
<translation>Beim Schließen m&inimieren</translation>
</message>
<message>
<location line="+21"/>
<source>&Display</source>
<translation>&Anzeige</translation>
</message>
<message>
<location line="+8"/>
<source>User Interface &language:</source>
<translation>&Sprache der Benutzeroberfläche:</translation>
</message>
<message>
<location line="+13"/>
<source>The user interface language can be set here. This setting will take effect after restarting Blizzardcoin.</source>
<translation>Legt die Sprache der Benutzeroberfläche fest. Diese Einstellung wird erst nach einem Neustart von Blizzardcoin aktiv.</translation>
</message>
<message>
<location line="+11"/>
<source>&Unit to show amounts in:</source>
<translation>&Einheit der Beträge:</translation>
</message>
<message>
<location line="+13"/>
<source>Choose the default subdivision unit to show in the interface and when sending coins.</source>
<translation>Wählen Sie die Standarduntereinheit, die in der Benutzeroberfläche und beim Überweisen von Blizzardcoins angezeigt werden soll.</translation>
</message>
<message>
<location line="+9"/>
<source>Whether to show Blizzardcoin addresses in the transaction list or not.</source>
<translation>Legt fest, ob Blizzardcoin-Adressen in der Transaktionsliste angezeigt werden.</translation>
</message>
<message>
<location line="+3"/>
<source>&Display addresses in transaction list</source>
<translation>Adressen in der Transaktionsliste &anzeigen</translation>
</message>
<message>
<location line="+71"/>
<source>&OK</source>
<translation>&OK</translation>
</message>
<message>
<location line="+7"/>
<source>&Cancel</source>
<translation>&Abbrechen</translation>
</message>
<message>
<location line="+10"/>
<source>&Apply</source>
<translation>&Übernehmen</translation>
</message>
<message>
<location filename="../optionsdialog.cpp" line="+53"/>
<source>default</source>
<translation>Standard</translation>
</message>
<message>
<location line="+130"/>
<source>Confirm options reset</source>
<translation>Zurücksetzen der Konfiguration bestätigen</translation>
</message>
<message>
<location line="+1"/>
<source>Some settings may require a client restart to take effect.</source>
<translation>Einige Einstellungen benötigen möglicherweise einen Clientneustart, um aktiv zu werden.</translation>
</message>
<message>
<location line="+0"/>
<source>Do you want to proceed?</source>
<translation>Wollen Sie fortfahren?</translation>
</message>
<message>
<location line="+42"/>
<location line="+9"/>
<source>Warning</source>
<translation>Warnung</translation>
</message>
<message>
<location line="-9"/>
<location line="+9"/>
<source>This setting will take effect after restarting Blizzardcoin.</source>
<translation>Diese Einstellung wird erst nach einem Neustart von Blizzardcoin aktiv.</translation>
</message>
<message>
<location line="+29"/>
<source>The supplied proxy address is invalid.</source>
<translation>Die eingegebene Proxyadresse ist ungültig.</translation>
</message>
</context>
<context>
<name>OverviewPage</name>
<message>
<location filename="../forms/overviewpage.ui" line="+14"/>
<source>Form</source>
<translation>Formular</translation>
</message>
<message>
<location line="+50"/>
<location line="+166"/>
<source>The displayed information may be out of date. Your wallet automatically synchronizes with the Blizzardcoin network after a connection is established, but this process has not completed yet.</source>
<translation>Die angezeigten Informationen sind möglicherweise nicht mehr aktuell. Ihre Brieftasche wird automatisch synchronisiert, nachdem eine Verbindung zum Blizzardcoin-Netzwerk hergestellt wurde. Dieser Prozess ist jedoch derzeit noch nicht abgeschlossen.</translation>
</message>
<message>
<location line="-124"/>
<source>Balance:</source>
<translation>Kontostand:</translation>
</message>
<message>
<location line="+29"/>
<source>Unconfirmed:</source>
<translation>Unbestätigt:</translation>
</message>
<message>
<location line="-78"/>
<source>Wallet</source>
<translation>Brieftasche</translation>
</message>
<message>
<location line="+107"/>
<source>Immature:</source>
<translation>Unreif:</translation>
</message>
<message>
<location line="+13"/>
<source>Mined balance that has not yet matured</source>
<translation>Erarbeiteter Betrag der noch nicht gereift ist</translation>
</message>
<message>
<location line="+46"/>
<source><b>Recent transactions</b></source>
<translation><b>Letzte Transaktionen</b></translation>
</message>
<message>
<location line="-101"/>
<source>Your current balance</source>
<translation>Ihr aktueller Kontostand</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>Betrag aus unbestätigten Transaktionen, der noch nicht im aktuellen Kontostand enthalten ist</translation>
</message>
<message>
<location filename="../overviewpage.cpp" line="+116"/>
<location line="+1"/>
<source>out of sync</source>
<translation>nicht synchron</translation>
</message>
</context>
<context>
<name>PaymentServer</name>
<message>
<location filename="../paymentserver.cpp" line="+107"/>
<source>Cannot start blizzardcoin: click-to-pay handler</source>
<translation>"blizzardcoin: Klicken-zum-Bezahlen"-Handler konnte nicht gestartet werden</translation>
</message>
</context>
<context>
<name>QRCodeDialog</name>
<message>
<location filename="../forms/qrcodedialog.ui" line="+14"/>
<source>QR Code Dialog</source>
<translation>QR-Code-Dialog</translation>
</message>
<message>
<location line="+59"/>
<source>Request Payment</source>
<translation>Zahlung anfordern</translation>
</message>
<message>
<location line="+56"/>
<source>Amount:</source>
<translation>Betrag:</translation>
</message>
<message>
<location line="-44"/>
<source>Label:</source>
<translation>Bezeichnung:</translation>
</message>
<message>
<location line="+19"/>
<source>Message:</source>
<translation>Nachricht:</translation>
</message>
<message>
<location line="+71"/>
<source>&Save As...</source>
<translation>&Speichern unter...</translation>
</message>
<message>
<location filename="../qrcodedialog.cpp" line="+62"/>
<source>Error encoding URI into QR Code.</source>
<translation>Fehler beim Kodieren der URI in den QR-Code.</translation>
</message>
<message>
<location line="+40"/>
<source>The entered amount is invalid, please check.</source>
<translation>Der eingegebene Betrag ist ungültig, bitte überprüfen.</translation>
</message>
<message>
<location line="+23"/>
<source>Resulting URI too long, try to reduce the text for label / message.</source>
<translation>Resultierende URI zu lang, bitte den Text für Bezeichnung / Nachricht kürzen.</translation>
</message>
<message>
<location line="+25"/>
<source>Save QR Code</source>
<translation>QR-Code abspeichern</translation>
</message>
<message>
<location line="+0"/>
<source>PNG Images (*.png)</source>
<translation>PNG-Bild (*.png)</translation>
</message>
</context>
<context>
<name>RPCConsole</name>
<message>
<location filename="../forms/rpcconsole.ui" line="+46"/>
<source>Client name</source>
<translation>Clientname</translation>
</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>n.v.</translation>
</message>
<message>
<location line="-217"/>
<source>Client version</source>
<translation>Clientversion</translation>
</message>
<message>
<location line="-45"/>
<source>&Information</source>
<translation>&Information</translation>
</message>
<message>
<location line="+68"/>
<source>Using OpenSSL version</source>
<translation>Verwendete OpenSSL-Version</translation>
</message>
<message>
<location line="+49"/>
<source>Startup time</source>
<translation>Startzeit</translation>
</message>
<message>
<location line="+29"/>
<source>Network</source>
<translation>Netzwerk</translation>
</message>
<message>
<location line="+7"/>
<source>Number of connections</source>
<translation>Anzahl Verbindungen</translation>
</message>
<message>
<location line="+23"/>
<source>On testnet</source>
<translation>Im Testnetz</translation>
</message>
<message>
<location line="+23"/>
<source>Block chain</source>
<translation>Blockkette</translation>
</message>
<message>
<location line="+7"/>
<source>Current number of blocks</source>
<translation>Aktuelle Anzahl Blöcke</translation>
</message>
<message>
<location line="+23"/>
<source>Estimated total blocks</source>
<translation>Geschätzte Gesamtzahl Blöcke</translation>
</message>
<message>
<location line="+23"/>
<source>Last block time</source>
<translation>Letzte Blockzeit</translation>
</message>
<message>
<location line="+52"/>
<source>&Open</source>
<translation>&Öffnen</translation>
</message>
<message>
<location line="+16"/>
<source>Command-line options</source>
<translation>Kommandozeilenoptionen</translation>
</message>
<message>
<location line="+7"/>
<source>Show the Blizzardcoin-Qt help message to get a list with possible Blizzardcoin command-line options.</source>
<translation>Zeige die Blizzardcoin-Qt-Hilfsnachricht, um eine Liste mit möglichen Kommandozeilenoptionen zu erhalten.</translation>
</message>
<message>
<location line="+3"/>
<source>&Show</source>
<translation>&Anzeigen</translation>
</message>
<message>
<location line="+24"/>
<source>&Console</source>
<translation>&Konsole</translation>
</message>
<message>
<location line="-260"/>
<source>Build date</source>
<translation>Erstellungsdatum</translation>
</message>
<message>
<location line="-104"/>
<source>Blizzardcoin - Debug window</source>
<translation>Blizzardcoin - Debugfenster</translation>
</message>
<message>
<location line="+25"/>
<source>Blizzardcoin Core</source>
<translation>Blizzardcoin-Kern</translation>
</message>
<message>
<location line="+279"/>
<source>Debug log file</source>
<translation>Debugprotokolldatei</translation>
</message>
<message>
<location line="+7"/>
<source>Open the Blizzardcoin debug log file from the current data directory. This can take a few seconds for large log files.</source>
<translation>Öffnet die Blizzardcoin-Debugprotokolldatei aus dem aktuellen Datenverzeichnis. Dies kann bei großen Protokolldateien einige Sekunden dauern.</translation>
</message>
<message>
<location line="+102"/>
<source>Clear console</source>
<translation>Konsole zurücksetzen</translation>
</message>
<message>
<location filename="../rpcconsole.cpp" line="-30"/>
<source>Welcome to the Blizzardcoin RPC console.</source>
<translation>Willkommen in der Blizzardcoin-RPC-Konsole.</translation>
</message>
<message>
<location line="+1"/>
<source>Use up and down arrows to navigate history, and <b>Ctrl-L</b> to clear screen.</source>
<translation>Pfeiltaste hoch und runter, um die Historie durchzublättern und <b>Strg-L</b>, um die Konsole zurückzusetzen.</translation>
</message>
<message>
<location line="+1"/>
<source>Type <b>help</b> for an overview of available commands.</source>
<translation>Bitte <b>help</b> eingeben, um eine Übersicht verfügbarer Befehle zu erhalten.</translation>
</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>Blizzardcoins überweisen</translation>
</message>
<message>
<location line="+50"/>
<source>Send to multiple recipients at once</source>
<translation>In einer Transaktion an mehrere Empfänger auf einmal überweisen</translation>
</message>
<message>
<location line="+3"/>
<source>Add &Recipient</source>
<translation>Empfänger &hinzufügen</translation>
</message>
<message>
<location line="+20"/>
<source>Remove all transaction fields</source>
<translation>Alle Überweisungsfelder zurücksetzen</translation>
</message>
<message>
<location line="+3"/>
<source>Clear &All</source>
<translation>&Zurücksetzen</translation>
</message>
<message>
<location line="+22"/>
<source>Balance:</source>
<translation>Kontostand:</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>Überweisung bestätigen</translation>
</message>
<message>
<location line="+3"/>
<source>S&end</source>
<translation>&Überweisen</translation>
</message>
<message>
<location filename="../sendcoinsdialog.cpp" line="-59"/>
<source><b>%1</b> to %2 (%3)</source>
<translation><b>%1</b> an %2 (%3)</translation>
</message>
<message>
<location line="+5"/>
<source>Confirm send coins</source>
<translation>Überweisung bestätigen</translation>
</message>
<message>
<location line="+1"/>
<source>Are you sure you want to send %1?</source>
<translation>Sind Sie sich sicher, dass Sie die folgende Überweisung ausführen möchten?<br>%1</translation>
</message>
<message>
<location line="+0"/>
<source> and </source>
<translation> und </translation>
</message>
<message>
<location line="+23"/>
<source>The recipient address is not valid, please recheck.</source>
<translation>Die Zahlungsadresse ist ungültig, bitte nochmals überprüfen.</translation>
</message>
<message>
<location line="+5"/>
<source>The amount to pay must be larger than 0.</source>
<translation>Der zu zahlende Betrag muss größer als 0 sein.</translation>
</message>
<message>
<location line="+5"/>
<source>The amount exceeds your balance.</source>
<translation>Der angegebene Betrag übersteigt Ihren Kontostand.</translation>
</message>
<message>
<location line="+5"/>
<source>The total exceeds your balance when the %1 transaction fee is included.</source>
<translation>Der angegebene Betrag übersteigt aufgrund der Transaktionsgebühr in Höhe von %1 Ihren Kontostand.</translation>
</message>
<message>
<location line="+6"/>
<source>Duplicate address found, can only send to each address once per send operation.</source>
<translation>Doppelte Adresse gefunden, pro Überweisung kann an jede Adresse nur einmalig etwas überwiesen werden.</translation>
</message>
<message>
<location line="+5"/>
<source>Error: Transaction creation failed!</source>
<translation>Fehler: Transaktionserstellung fehlgeschlagen!</translation>
</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>Fehler: Die Transaktion wurde abgelehnt. Dies kann passieren, wenn einige Blizzardcoins aus Ihrer Brieftasche bereits ausgegeben wurden. Beispielsweise weil Sie eine Kopie Ihrer wallet.dat genutzt, die Blizzardcoins dort ausgegeben haben und dies daher in der derzeit aktiven Brieftasche nicht vermerkt ist.</translation>
</message>
</context>
<context>
<name>SendCoinsEntry</name>
<message>
<location filename="../forms/sendcoinsentry.ui" line="+14"/>
<source>Form</source>
<translation>Formular</translation>
</message>
<message>
<location line="+15"/>
<source>A&mount:</source>
<translation>&Betrag:</translation>
</message>
<message>
<location line="+13"/>
<source>Pay &To:</source>
<translation>&Empfänger:</translation>
</message>
<message>
<location line="+34"/>
<source>The address to send the payment to (e.g. Ler4HNAEfwYhBmGXcFP2Po1NpRUEiK8km2)</source>
<translation>Die Zahlungsadresse der Überweisung (z.B. Ler4HNAEfwYhBmGXcFP2Po1NpRUEiK8km2)</translation>
</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>Adressbezeichnung eingeben (diese wird zusammen mit der Adresse dem Adressbuch hinzugefügt)</translation>
</message>
<message>
<location line="-78"/>
<source>&Label:</source>
<translation>&Bezeichnung:</translation>
</message>
<message>
<location line="+28"/>
<source>Choose address from address book</source>
<translation>Adresse aus Adressbuch wählen</translation>
</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>Adresse aus der Zwischenablage einfügen</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>Diesen Empfänger entfernen</translation>
</message>
<message>
<location filename="../sendcoinsentry.cpp" line="+1"/>
<source>Enter a Blizzardcoin address (e.g. Ler4HNAEfwYhBmGXcFP2Po1NpRUEiK8km2)</source>
<translation>Blizzardcoin-Adresse eingeben (z.B. Ler4HNAEfwYhBmGXcFP2Po1NpRUEiK8km2)</translation>
</message>
</context>
<context>
<name>SignVerifyMessageDialog</name>
<message>
<location filename="../forms/signverifymessagedialog.ui" line="+14"/>
<source>Signatures - Sign / Verify a Message</source>
<translation>Signaturen - eine Nachricht signieren / verifizieren</translation>
</message>
<message>
<location line="+13"/>
<source>&Sign Message</source>
<translation>Nachricht &signieren</translation>
</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>Sie können Nachrichten mit Ihren Adressen signieren, um den Besitz dieser Adressen zu beweisen. Bitte nutzen Sie diese Funktion mit Vorsicht und nehmen Sie sich vor Phishingangriffen in Acht. Signieren Sie nur Nachrichten, mit denen Sie vollständig einverstanden sind.</translation>
</message>
<message>
<location line="+18"/>
<source>The address to sign the message with (e.g. Ler4HNAEfwYhBmGXcFP2Po1NpRUEiK8km2)</source>
<translation>Die Adresse mit der die Nachricht signiert wird (z.B. Ler4HNAEfwYhBmGXcFP2Po1NpRUEiK8km2)</translation>
</message>
<message>
<location line="+10"/>
<location line="+213"/>
<source>Choose an address from the address book</source>
<translation>Eine Adresse aus dem Adressbuch wählen</translation>
</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>Adresse aus der Zwischenablage einfügen</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>Zu signierende Nachricht hier eingeben</translation>
</message>
<message>
<location line="+7"/>
<source>Signature</source>
<translation>Signatur</translation>
</message>
<message>
<location line="+27"/>
<source>Copy the current signature to the system clipboard</source>
<translation>Aktuelle Signatur in die Zwischenablage kopieren</translation>
</message>
<message>
<location line="+21"/>
<source>Sign the message to prove you own this Blizzardcoin address</source>
<translation>Die Nachricht signieren, um den Besitz dieser Blizzardcoin-Adresse zu beweisen</translation>
</message>
<message>
<location line="+3"/>
<source>Sign &Message</source>
<translation>&Nachricht signieren</translation>
</message>
<message>
<location line="+14"/>
<source>Reset all sign message fields</source>
<translation>Alle "Nachricht signieren"-Felder zurücksetzen</translation>
</message>
<message>
<location line="+3"/>
<location line="+146"/>
<source>Clear &All</source>
<translation>&Zurücksetzen</translation>
</message>
<message>
<location line="-87"/>
<source>&Verify Message</source>
<translation>Nachricht &verifizieren</translation>
</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>Geben Sie die signierende Adresse, Nachricht (achten Sie darauf Zeilenumbrüche, Leerzeichen, Tabulatoren usw. exakt zu kopieren) und Signatur unten ein, um die Nachricht zu verifizieren. Vorsicht, interpretieren Sie nicht mehr in die Signatur, als in der signierten Nachricht selber enthalten ist, um nicht von einerm Man-in-the-middle-Angriff hinters Licht geführt zu werden.</translation>
</message>
<message>
<location line="+21"/>
<source>The address the message was signed with (e.g. Ler4HNAEfwYhBmGXcFP2Po1NpRUEiK8km2)</source>
<translation>Die Adresse mit der die Nachricht signiert wurde (z.B. Ler4HNAEfwYhBmGXcFP2Po1NpRUEiK8km2)</translation>
</message>
<message>
<location line="+40"/>
<source>Verify the message to ensure it was signed with the specified Blizzardcoin address</source>
<translation>Die Nachricht verifizieren, um sicherzustellen, dass diese mit der angegebenen Blizzardcoin-Adresse signiert wurde</translation>
</message>
<message>
<location line="+3"/>
<source>Verify &Message</source>
<translation>&Nachricht verifizieren</translation>
</message>
<message>
<location line="+14"/>
<source>Reset all verify message fields</source>
<translation>Alle "Nachricht verifizieren"-Felder zurücksetzen</translation>
</message>
<message>
<location filename="../signverifymessagedialog.cpp" line="+27"/>
<location line="+3"/>
<source>Enter a Blizzardcoin address (e.g. Ler4HNAEfwYhBmGXcFP2Po1NpRUEiK8km2)</source>
<translation>Blizzardcoin-Adresse eingeben (z.B. Ler4HNAEfwYhBmGXcFP2Po1NpRUEiK8km2)</translation>
</message>
<message>
<location line="-2"/>
<source>Click "Sign Message" to generate signature</source>
<translation>Auf "Nachricht signieren" klicken, um die Signatur zu erzeugen</translation>
</message>
<message>
<location line="+3"/>
<source>Enter Blizzardcoin signature</source>
<translation>Blizzardcoin-Signatur eingeben</translation>
</message>
<message>
<location line="+82"/>
<location line="+81"/>
<source>The entered address is invalid.</source>
<translation>Die eingegebene Adresse ist ungültig.</translation>
</message>
<message>
<location line="-81"/>
<location line="+8"/>
<location line="+73"/>
<location line="+8"/>
<source>Please check the address and try again.</source>
<translation>Bitte überprüfen Sie die Adresse und versuchen Sie es erneut.</translation>
</message>
<message>
<location line="-81"/>
<location line="+81"/>
<source>The entered address does not refer to a key.</source>
<translation>Die eingegebene Adresse verweist nicht auf einen Schlüssel.</translation>
</message>
<message>
<location line="-73"/>
<source>Wallet unlock was cancelled.</source>
<translation>Entsperrung der Brieftasche wurde abgebrochen.</translation>
</message>
<message>
<location line="+8"/>
<source>Private key for the entered address is not available.</source>
<translation>Privater Schlüssel zur eingegebenen Adresse ist nicht verfügbar.</translation>
</message>
<message>
<location line="+12"/>
<source>Message signing failed.</source>
<translation>Signierung der Nachricht fehlgeschlagen.</translation>
</message>
<message>
<location line="+5"/>
<source>Message signed.</source>
<translation>Nachricht signiert.</translation>
</message>
<message>
<location line="+59"/>
<source>The signature could not be decoded.</source>
<translation>Die Signatur konnte nicht dekodiert werden.</translation>
</message>
<message>
<location line="+0"/>
<location line="+13"/>
<source>Please check the signature and try again.</source>
<translation>Bitte überprüfen Sie die Signatur und versuchen Sie es erneut.</translation>
</message>
<message>
<location line="+0"/>
<source>The signature did not match the message digest.</source>
<translation>Die Signatur entspricht nicht dem Message Digest.</translation>
</message>
<message>
<location line="+7"/>
<source>Message verification failed.</source>
<translation>Verifikation der Nachricht fehlgeschlagen.</translation>
</message>
<message>
<location line="+5"/>
<source>Message verified.</source>
<translation>Nachricht verifiziert.</translation>
</message>
</context>
<context>
<name>SplashScreen</name>
<message>
<location filename="../splashscreen.cpp" line="+22"/>
<source>The Blizzardcoin developers</source>
<translation>Die Blizzardcoinentwickler</translation>
</message>
<message>
<location line="+1"/>
<source>[testnet]</source>
<translation>[Testnetz]</translation>
</message>
</context>
<context>
<name>TransactionDesc</name>
<message>
<location filename="../transactiondesc.cpp" line="+20"/>
<source>Open until %1</source>
<translation>Offen bis %1</translation>
</message>
<message>
<location line="+6"/>
<source>%1/offline</source>
<translation>%1/offline</translation>
</message>
<message>
<location line="+2"/>
<source>%1/unconfirmed</source>
<translation>%1/unbestätigt</translation>
</message>
<message>
<location line="+2"/>
<source>%1 confirmations</source>
<translation>%1 Bestätigungen</translation>
</message>
<message>
<location line="+18"/>
<source>Status</source>
<translation>Status</translation>
</message>
<message numerus="yes">
<location line="+7"/>
<source>, broadcast through %n node(s)</source>
<translation><numerusform>, über %n Knoten übertragen</numerusform><numerusform>, über %n Knoten übertragen</numerusform></translation>
</message>
<message>
<location line="+4"/>
<source>Date</source>
<translation>Datum</translation>
</message>
<message>
<location line="+7"/>
<source>Source</source>
<translation>Quelle</translation>
</message>
<message>
<location line="+0"/>
<source>Generated</source>
<translation>Generiert</translation>
</message>
<message>
<location line="+5"/>
<location line="+17"/>
<source>From</source>
<translation>Von</translation>
</message>
<message>
<location line="+1"/>
<location line="+22"/>
<location line="+58"/>
<source>To</source>
<translation>An</translation>
</message>
<message>
<location line="-77"/>
<location line="+2"/>
<source>own address</source>
<translation>eigene Adresse</translation>
</message>
<message>
<location line="-2"/>
<source>label</source>
<translation>Bezeichnung</translation>
</message>
<message>
<location line="+37"/>
<location line="+12"/>
<location line="+45"/>
<location line="+17"/>
<location line="+30"/>
<source>Credit</source>
<translation>Gutschrift</translation>
</message>
<message numerus="yes">
<location line="-102"/>
<source>matures in %n more block(s)</source>
<translation><numerusform>reift noch %n weiteren Block</numerusform><numerusform>reift noch %n weitere Blöcke</numerusform></translation>
</message>
<message>
<location line="+2"/>
<source>not accepted</source>
<translation>nicht angenommen</translation>
</message>
<message>
<location line="+44"/>
<location line="+8"/>
<location line="+15"/>
<location line="+30"/>
<source>Debit</source>
<translation>Belastung</translation>
</message>
<message>
<location line="-39"/>
<source>Transaction fee</source>
<translation>Transaktionsgebühr</translation>
</message>
<message>
<location line="+16"/>
<source>Net amount</source>
<translation>Nettobetrag</translation>
</message>
<message>
<location line="+6"/>
<source>Message</source>
<translation>Nachricht signieren</translation>
</message>
<message>
<location line="+2"/>
<source>Comment</source>
<translation>Kommentar</translation>
</message>
<message>
<location line="+2"/>
<source>Transaction ID</source>
<translation>Transaktions-ID</translation>
</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>Generierte Blizzardcoins müssen 120 Blöcke lang reifen, bevor sie ausgegeben werden können. Als Sie diesen Block generierten, wurde er an das Netzwerk übertragen, um ihn der Blockkette hinzuzufügen. Falls dies fehlschlägt wird der Status in "nicht angenommen" geändert und der Betrag wird nicht verfügbar werden. Das kann gelegentlich passieren, wenn ein anderer Knoten einen Block fast zeitgleich generiert.</translation>
</message>
<message>
<location line="+7"/>
<source>Debug information</source>
<translation>Debuginformationen</translation>
</message>
<message>
<location line="+8"/>
<source>Transaction</source>
<translation>Transaktion</translation>
</message>
<message>
<location line="+3"/>
<source>Inputs</source>
<translation>Eingaben</translation>
</message>
<message>
<location line="+23"/>
<source>Amount</source>
<translation>Betrag</translation>
</message>
<message>
<location line="+1"/>
<source>true</source>
<translation>wahr</translation>
</message>
<message>
<location line="+0"/>
<source>false</source>
<translation>falsch</translation>
</message>
<message>
<location line="-209"/>
<source>, has not been successfully broadcast yet</source>
<translation>, wurde noch nicht erfolgreich übertragen</translation>
</message>
<message numerus="yes">
<location line="-35"/>
<source>Open for %n more block(s)</source>
<translation><numerusform>Offen für %n weiteren Block</numerusform><numerusform>Offen für %n weitere Blöcke</numerusform></translation>
</message>
<message>
<location line="+70"/>
<source>unknown</source>
<translation>unbekannt</translation>
</message>
</context>
<context>
<name>TransactionDescDialog</name>
<message>
<location filename="../forms/transactiondescdialog.ui" line="+14"/>
<source>Transaction details</source>
<translation>Transaktionsdetails</translation>
</message>
<message>
<location line="+6"/>
<source>This pane shows a detailed description of the transaction</source>
<translation>Dieser Bereich zeigt eine detaillierte Beschreibung der Transaktion an</translation>
</message>
</context>
<context>
<name>TransactionTableModel</name>
<message>
<location filename="../transactiontablemodel.cpp" line="+225"/>
<source>Date</source>
<translation>Datum</translation>
</message>
<message>
<location line="+0"/>
<source>Type</source>
<translation>Typ</translation>
</message>
<message>
<location line="+0"/>
<source>Address</source>
<translation>Adresse</translation>
</message>
<message>
<location line="+0"/>
<source>Amount</source>
<translation>Betrag</translation>
</message>
<message numerus="yes">
<location line="+57"/>
<source>Open for %n more block(s)</source>
<translation><numerusform>Offen für %n weiteren Block</numerusform><numerusform>Offen für %n weitere Blöcke</numerusform></translation>
</message>
<message>
<location line="+3"/>
<source>Open until %1</source>
<translation>Offen bis %1</translation>
</message>
<message>
<location line="+3"/>
<source>Offline (%1 confirmations)</source>
<translation>Offline (%1 Bestätigungen)</translation>
</message>
<message>
<location line="+3"/>
<source>Unconfirmed (%1 of %2 confirmations)</source>
<translation>Unbestätigt (%1 von %2 Bestätigungen)</translation>
</message>
<message>
<location line="+3"/>
<source>Confirmed (%1 confirmations)</source>
<translation>Bestätigt (%1 Bestätigungen)</translation>
</message>
<message numerus="yes">
<location line="+8"/>
<source>Mined balance will be available when it matures in %n more block(s)</source>
<translation><numerusform>Erarbeiteter Betrag wird verfügbar sein, nachdem er noch %n weiteren Block reift</numerusform><numerusform>Erarbeiteter Betrag wird verfügbar sein, nachdem er noch %n weitere Blöcke reift</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>Dieser Block wurde von keinem anderen Knoten empfangen und wird wahrscheinlich nicht angenommen werden!</translation>
</message>
<message>
<location line="+3"/>
<source>Generated but not accepted</source>
<translation>Generiert, jedoch nicht angenommen</translation>
</message>
<message>
<location line="+43"/>
<source>Received with</source>
<translation>Empfangen über</translation>
</message>
<message>
<location line="+2"/>
<source>Received from</source>
<translation>Empfangen von</translation>
</message>
<message>
<location line="+3"/>
<source>Sent to</source>
<translation>Überwiesen an</translation>
</message>
<message>
<location line="+2"/>
<source>Payment to yourself</source>
<translation>Eigenüberweisung</translation>
</message>
<message>
<location line="+2"/>
<source>Mined</source>
<translation>Erarbeitet</translation>
</message>
<message>
<location line="+38"/>
<source>(n/a)</source>
<translation>(k.A.)</translation>
</message>
<message>
<location line="+199"/>
<source>Transaction status. Hover over this field to show number of confirmations.</source>
<translation>Transaktionsstatus. Fahren Sie mit der Maus über dieses Feld, um die Anzahl der Bestätigungen zu sehen.</translation>
</message>
<message>
<location line="+2"/>
<source>Date and time that the transaction was received.</source>
<translation>Datum und Uhrzeit als die Transaktion empfangen wurde.</translation>
</message>
<message>
<location line="+2"/>
<source>Type of transaction.</source>
<translation>Art der Transaktion</translation>
</message>
<message>
<location line="+2"/>
<source>Destination address of transaction.</source>
<translation>Zieladresse der Transaktion</translation>
</message>
<message>
<location line="+2"/>
<source>Amount removed from or added to balance.</source>
<translation>Der Betrag, der dem Kontostand abgezogen oder hinzugefügt wurde.</translation>
</message>
</context>
<context>
<name>TransactionView</name>
<message>
<location filename="../transactionview.cpp" line="+52"/>
<location line="+16"/>
<source>All</source>
<translation>Alle</translation>
</message>
<message>
<location line="-15"/>
<source>Today</source>
<translation>Heute</translation>
</message>
<message>
<location line="+1"/>
<source>This week</source>
<translation>Diese Woche</translation>
</message>
<message>
<location line="+1"/>
<source>This month</source>
<translation>Diesen Monat</translation>
</message>
<message>
<location line="+1"/>
<source>Last month</source>
<translation>Letzten Monat</translation>
</message>
<message>
<location line="+1"/>
<source>This year</source>
<translation>Dieses Jahr</translation>
</message>
<message>
<location line="+1"/>
<source>Range...</source>
<translation>Zeitraum...</translation>
</message>
<message>
<location line="+11"/>
<source>Received with</source>
<translation>Empfangen über</translation>
</message>
<message>
<location line="+2"/>
<source>Sent to</source>
<translation>Überwiesen an</translation>
</message>
<message>
<location line="+2"/>
<source>To yourself</source>
<translation>Eigenüberweisung</translation>
</message>
<message>
<location line="+1"/>
<source>Mined</source>
<translation>Erarbeitet</translation>
</message>
<message>
<location line="+1"/>
<source>Other</source>
<translation>Andere</translation>
</message>
<message>
<location line="+7"/>
<source>Enter address or label to search</source>
<translation>Zu suchende Adresse oder Bezeichnung eingeben</translation>
</message>
<message>
<location line="+7"/>
<source>Min amount</source>
<translation>Minimaler Betrag</translation>
</message>
<message>
<location line="+34"/>
<source>Copy address</source>
<translation>Adresse kopieren</translation>
</message>
<message>
<location line="+1"/>
<source>Copy label</source>
<translation>Bezeichnung kopieren</translation>
</message>
<message>
<location line="+1"/>
<source>Copy amount</source>
<translation>Betrag kopieren</translation>
</message>
<message>
<location line="+1"/>
<source>Copy transaction ID</source>
<translation>Transaktions-ID kopieren</translation>
</message>
<message>
<location line="+1"/>
<source>Edit label</source>
<translation>Bezeichnung bearbeiten</translation>
</message>
<message>
<location line="+1"/>
<source>Show transaction details</source>
<translation>Transaktionsdetails anzeigen</translation>
</message>
<message>
<location line="+139"/>
<source>Export Transaction Data</source>
<translation>Transaktionen exportieren</translation>
</message>
<message>
<location line="+1"/>
<source>Comma separated file (*.csv)</source>
<translation>Kommagetrennte-Datei (*.csv)</translation>
</message>
<message>
<location line="+8"/>
<source>Confirmed</source>
<translation>Bestätigt</translation>
</message>
<message>
<location line="+1"/>
<source>Date</source>
<translation>Datum</translation>
</message>
<message>
<location line="+1"/>
<source>Type</source>
<translation>Typ</translation>
</message>
<message>
<location line="+1"/>
<source>Label</source>
<translation>Bezeichnung</translation>
</message>
<message>
<location line="+1"/>
<source>Address</source>
<translation>Adresse</translation>
</message>
<message>
<location line="+1"/>
<source>Amount</source>
<translation>Betrag</translation>
</message>
<message>
<location line="+1"/>
<source>ID</source>
<translation>ID</translation>
</message>
<message>
<location line="+4"/>
<source>Error exporting</source>
<translation>Fehler beim Exportieren</translation>
</message>
<message>
<location line="+0"/>
<source>Could not write to file %1.</source>
<translation>Konnte nicht in Datei %1 schreiben.</translation>
</message>
<message>
<location line="+100"/>
<source>Range:</source>
<translation>Zeitraum:</translation>
</message>
<message>
<location line="+8"/>
<source>to</source>
<translation>bis</translation>
</message>
</context>
<context>
<name>WalletModel</name>
<message>
<location filename="../walletmodel.cpp" line="+193"/>
<source>Send Coins</source>
<translation>Blizzardcoins überweisen</translation>
</message>
</context>
<context>
<name>WalletView</name>
<message>
<location filename="../walletview.cpp" line="+42"/>
<source>&Export</source>
<translation>E&xportieren</translation>
</message>
<message>
<location line="+1"/>
<source>Export the data in the current tab to a file</source>
<translation>Daten der aktuellen Ansicht in eine Datei exportieren</translation>
</message>
<message>
<location line="+193"/>
<source>Backup Wallet</source>
<translation>Brieftasche sichern</translation>
</message>
<message>
<location line="+0"/>
<source>Wallet Data (*.dat)</source>
<translation>Brieftaschendaten (*.dat)</translation>
</message>
<message>
<location line="+3"/>
<source>Backup Failed</source>
<translation>Sicherung fehlgeschlagen</translation>
</message>
<message>
<location line="+0"/>
<source>There was an error trying to save the wallet data to the new location.</source>
<translation>Beim Speichern der Brieftaschendaten an die neue Position ist ein Fehler aufgetreten.</translation>
</message>
<message>
<location line="+4"/>
<source>Backup Successful</source>
<translation>Sicherung erfolgreich</translation>
</message>
<message>
<location line="+0"/>
<source>The wallet data was successfully saved to the new location.</source>
<translation>Speichern der Brieftaschendaten an die neue Position war erfolgreich.</translation>
</message>
</context>
<context>
<name>bitcoin-core</name>
<message>
<location filename="../bitcoinstrings.cpp" line="+94"/>
<source>Blizzardcoin version</source>
<translation>Blizzardcoin-Version</translation>
</message>
<message>
<location line="+102"/>
<source>Usage:</source>
<translation>Benutzung:</translation>
</message>
<message>
<location line="-29"/>
<source>Send command to -server or blizzardcoind</source>
<translation>Befehl an -server oder blizzardcoind senden</translation>
</message>
<message>
<location line="-23"/>
<source>List commands</source>
<translation>Befehle auflisten</translation>
</message>
<message>
<location line="-12"/>
<source>Get help for a command</source>
<translation>Hilfe zu einem Befehl erhalten</translation>
</message>
<message>
<location line="+24"/>
<source>Options:</source>
<translation>Optionen:</translation>
</message>
<message>
<location line="+24"/>
<source>Specify configuration file (default: blizzardcoin.conf)</source>
<translation>Konfigurationsdatei festlegen (Standard: blizzardcoin.conf)</translation>
</message>
<message>
<location line="+3"/>
<source>Specify pid file (default: blizzardcoind.pid)</source>
<translation>PID-Datei festlegen (Standard: blizzardcoind.pid)</translation>
</message>
<message>
<location line="-1"/>
<source>Specify data directory</source>
<translation>Datenverzeichnis festlegen</translation>
</message>
<message>
<location line="-9"/>
<source>Set database cache size in megabytes (default: 25)</source>
<translation>Größe des Datenbankcaches in MB festlegen (Standard: 25)</translation>
</message>
<message>
<location line="-28"/>
<source>Listen for connections on <port> (default: 9333 or testnet: 19333)</source>
<translation><port> nach Verbindungen abhören (Standard: 9333 oder Testnetz: 19333)</translation>
</message>
<message>
<location line="+5"/>
<source>Maintain at most <n> connections to peers (default: 125)</source>
<translation>Maximal <n> Verbindungen zu Gegenstellen aufrechterhalten (Standard: 125)</translation>
</message>
<message>
<location line="-48"/>
<source>Connect to a node to retrieve peer addresses, and disconnect</source>
<translation>Mit dem Knoten verbinden um Adressen von Gegenstellen abzufragen, danach trennen</translation>
</message>
<message>
<location line="+82"/>
<source>Specify your own public address</source>
<translation>Die eigene öffentliche Adresse angeben</translation>
</message>
<message>
<location line="+3"/>
<source>Threshold for disconnecting misbehaving peers (default: 100)</source>
<translation>Schwellenwert, um Verbindungen zu sich nicht konform verhaltenden Gegenstellen zu beenden (Standard: 100)</translation>
</message>
<message>
<location line="-134"/>
<source>Number of seconds to keep misbehaving peers from reconnecting (default: 86400)</source>
<translation>Anzahl Sekunden, während denen sich nicht konform verhaltenden Gegenstellen die Wiederverbindung verweigert wird (Standard: 86400)</translation>
</message>
<message>
<location line="-29"/>
<source>An error occurred while setting up the RPC port %u for listening on IPv4: %s</source>
<translation>Beim Einrichten des abzuhörenden RPC-Ports %u für IPv4 ist ein Fehler aufgetreten: %s</translation>
</message>
<message>
<location line="+27"/>
<source>Listen for JSON-RPC connections on <port> (default: 9332 or testnet: 19332)</source>
<translation><port> nach JSON-RPC-Verbindungen abhören (Standard: 9332 oder Testnetz: 19332)</translation>
</message>
<message>
<location line="+37"/>
<source>Accept command line and JSON-RPC commands</source>
<translation>Kommandozeilenbefehle und JSON-RPC-Befehle annehmen</translation>
</message>
<message>
<location line="+76"/>
<source>Run in the background as a daemon and accept commands</source>
<translation>Als Hintergrunddienst starten und Befehle annehmen</translation>
</message>
<message>
<location line="+37"/>
<source>Use the test network</source>
<translation>Das Testnetz verwenden</translation>
</message>
<message>
<location line="-112"/>
<source>Accept connections from outside (default: 1 if no -proxy or -connect)</source>
<translation>Eingehende Verbindungen annehmen (Standard: 1, wenn nicht -proxy oder -connect)</translation>
</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=blizzardcoinrpc
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 "Blizzardcoin Alert" admin@foo.com
</source>
<translation>%s, Sie müssen den Wert rpcpasswort in dieser Konfigurationsdatei angeben:
%s
Es wird empfohlen das folgende Zufallspasswort zu verwenden:
rpcuser=blizzardcoinrpc
rpcpassword=%s
(Sie müssen sich dieses Passwort nicht merken!)
Der Benutzername und das Passwort dürfen NICHT identisch sein.
Falls die Konfigurationsdatei nicht existiert, erzeugen Sie diese bitte mit Leserechten nur für den Dateibesitzer.
Es wird ebenfalls empfohlen alertnotify anzugeben, um im Problemfall benachrichtig zu werden;
zum Beispiel: alertnotify=echo %%s | mail -s \"Blizzardcoin Alert\" admin@foo.com
</translation>
</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>Beim Einrichten des abzuhörenden RPC-Ports %u für IPv6 ist ein Fehler aufgetreten, es wird auf IPv4 zurückgegriffen: %s</translation>
</message>
<message>
<location line="+3"/>
<source>Bind to given address and always listen on it. Use [host]:port notation for IPv6</source>
<translation>An die angegebene Adresse binden und immer abhören. Für IPv6 [Host]:Port-Schreibweise verwenden</translation>
</message>
<message>
<location line="+3"/>
<source>Cannot obtain a lock on data directory %s. Blizzardcoin is probably already running.</source>
<translation>Datenverzeichnis %s kann nicht gesperrt werden. Evtl. wurde Blizzardcoin bereits gestartet.</translation>
</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>Fehler: Die Transaktion wurde abgelehnt! Dies kann passieren, wenn einige Blizzardcoins aus Ihrer Brieftasche bereits ausgegeben wurden. Beispielsweise weil Sie eine Kopie Ihrer wallet.dat genutzt, die Blizzardcoins dort ausgegeben haben und dies daher in der derzeit aktiven Brieftasche nicht vermerkt ist.</translation>
</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>Fehler: Diese Transaktion benötigt aufgrund ihres Betrags, ihrer Komplexität oder der Nutzung kürzlich erhaltener Zahlungen eine Transaktionsgebühr in Höhe von mindestens %s!</translation>
</message>
<message>
<location line="+3"/>
<source>Execute command when a relevant alert is received (%s in cmd is replaced by message)</source>
<translation>Kommando ausführen wenn ein relevanter Alarm empfangen wird (%s im Kommando wird durch die Nachricht ersetzt)</translation>
</message>
<message>
<location line="+3"/>
<source>Execute command when a wallet transaction changes (%s in cmd is replaced by TxID)</source>
<translation>Kommando ausführen wenn sich eine Transaktion der Briefrasche verändert (%s im Kommando wird durch die TxID ersetzt)</translation>
</message>
<message>
<location line="+11"/>
<source>Set maximum size of high-priority/low-fee transactions in bytes (default: 27000)</source>
<translation>Maximale Größe von "high-priority/low-fee"-Transaktionen in Byte festlegen (Standard: 27000)</translation>
</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>Dies ist eine Vorab-Testversion - Verwendung auf eigene Gefahr - nicht für Mining- oder Handelsanwendungen nutzen!</translation>
</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>Warnung: -paytxfee ist auf einen sehr hohen Wert festgelegt! Dies ist die Gebühr die beim Senden einer Transaktion fällig wird.</translation>
</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>Warnung: Angezeigte Transaktionen sind evtl. nicht korrekt! Sie oder die anderen Knoten müssen unter Umständen (den Client) aktualisieren.</translation>
</message>
<message>
<location line="+3"/>
<source>Warning: Please check that your computer's date and time are correct! If your clock is wrong Blizzardcoin will not work properly.</source>
<translation>Warnung: Bitte korrigieren Sie die Datums- und Uhrzeiteinstellungen Ihres Computers, da Blizzardcoin ansonsten nicht ordnungsgemäß funktionieren wird!</translation>
</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>Warnung: Lesen von wallet.dat fehlgeschlagen! Alle Schlüssel wurden korrekt gelesen, Transaktionsdaten bzw. Adressbucheinträge fehlen aber möglicherweise oder sind inkorrekt.</translation>
</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>Warnung: wallet.dat beschädigt, Rettung erfolgreich! Original wallet.dat wurde als wallet.{Zeitstempel}.dat in %s gespeichert. Falls Ihr Kontostand oder Transaktionen nicht korrekt sind, sollten Sie von einer Datensicherung wiederherstellen.</translation>
</message>
<message>
<location line="+14"/>
<source>Attempt to recover private keys from a corrupt wallet.dat</source>
<translation>Versucht private Schlüssel aus einer beschädigten wallet.dat wiederherzustellen</translation>
</message>
<message>
<location line="+2"/>
<source>Block creation options:</source>
<translation>Blockerzeugungsoptionen:</translation>
</message>
<message>
<location line="+5"/>
<source>Connect only to the specified node(s)</source>
<translation>Nur mit dem/den angegebenen Knoten verbinden</translation>
</message>
<message>
<location line="+3"/>
<source>Corrupted block database detected</source>
<translation>Beschädigte Blockdatenbank erkannt</translation>
</message>
<message>
<location line="+1"/>
<source>Discover own IP address (default: 1 when listening and no -externalip)</source>
<translation>Eigene IP-Adresse erkennen (Standard: 1, wenn abgehört wird und nicht -externalip)</translation>
</message>
<message>
<location line="+1"/>
<source>Do you want to rebuild the block database now?</source>
<translation>Möchten Sie die Blockdatenbank nun neu aufbauen?</translation>
</message>
<message>
<location line="+2"/>
<source>Error initializing block database</source>
<translation>Fehler beim Initialisieren der Blockdatenbank</translation>
</message>
<message>
<location line="+1"/>
<source>Error initializing wallet database environment %s!</source>
<translation>Fehler beim Initialisieren der Brieftaschen-Datenbankumgebung %s!</translation>
</message>
<message>
<location line="+1"/>
<source>Error loading block database</source>
<translation>Fehler beim Laden der Blockdatenbank</translation>
</message>
<message>
<location line="+4"/>
<source>Error opening block database</source>
<translation>Fehler beim Öffnen der Blockdatenbank</translation>
</message>
<message>
<location line="+2"/>
<source>Error: Disk space is low!</source>
<translation>Fehler: Zu wenig freier Laufwerksspeicherplatz!</translation>
</message>
<message>
<location line="+1"/>
<source>Error: Wallet locked, unable to create transaction!</source>
<translation>Fehler: Brieftasche gesperrt, Transaktion kann nicht erstellt werden!</translation>
</message>
<message>
<location line="+1"/>
<source>Error: system error: </source>
<translation>Fehler: Systemfehler: </translation>
</message>
<message>
<location line="+1"/>
<source>Failed to listen on any port. Use -listen=0 if you want this.</source>
<translation>Fehler, es konnte kein Port abgehört werden. Wenn dies so gewünscht wird -listen=0 verwenden.</translation>
</message>
<message>
<location line="+1"/>
<source>Failed to read block info</source>
<translation>Lesen der Blockinformationen fehlgeschlagen</translation>
</message>
<message>
<location line="+1"/>
<source>Failed to read block</source>
<translation>Lesen des Blocks fehlgeschlagen</translation>
</message>
<message>
<location line="+1"/>
<source>Failed to sync block index</source>
<translation>Synchronisation des Blockindex fehlgeschlagen</translation>
</message>
<message>
<location line="+1"/>
<source>Failed to write block index</source>
<translation>Schreiben des Blockindex fehlgeschlagen</translation>
</message>
<message>
<location line="+1"/>
<source>Failed to write block info</source>
<translation>Schreiben der Blockinformationen fehlgeschlagen</translation>
</message>
<message>
<location line="+1"/>
<source>Failed to write block</source>
<translation>Schreiben des Blocks fehlgeschlagen</translation>
</message>
<message>
<location line="+1"/>
<source>Failed to write file info</source>
<translation>Schreiben der Dateiinformationen fehlgeschlagen</translation>
</message>
<message>
<location line="+1"/>
<source>Failed to write to coin database</source>
<translation>Schreiben in die Münzendatenbank fehlgeschlagen</translation>
</message>
<message>
<location line="+1"/>
<source>Failed to write transaction index</source>
<translation>Schreiben des Transaktionsindex fehlgeschlagen</translation>
</message>
<message>
<location line="+1"/>
<source>Failed to write undo data</source>
<translation>Schreiben der Rücksetzdaten fehlgeschlagen</translation>
</message>
<message>
<location line="+2"/>
<source>Find peers using DNS lookup (default: 1 unless -connect)</source>
<translation>Gegenstellen via DNS-Namensauflösung finden (Standard: 1, außer bei -connect)</translation>
</message>
<message>
<location line="+1"/>
<source>Generate coins (default: 0)</source>
<translation>Blizzardcoins generieren (Standard: 0)</translation>
</message>
<message>
<location line="+2"/>
<source>How many blocks to check at startup (default: 288, 0 = all)</source>
<translation>Wieviele Blöcke sollen beim Starten geprüft werden (Standard: 288, 0 = alle)</translation>
</message>
<message>
<location line="+1"/>
<source>How thorough the block verification is (0-4, default: 3)</source>
<translation>Wie gründlich soll die Blockprüfung sein (0-4, Standard: 3)</translation>
</message>
<message>
<location line="+19"/>
<source>Not enough file descriptors available.</source>
<translation>Nicht genügend File-Deskriptoren verfügbar.</translation>
</message>
<message>
<location line="+8"/>
<source>Rebuild block chain index from current blk000??.dat files</source>
<translation>Blockkettenindex aus aktuellen Dateien blk000??.dat wiederaufbauen</translation>
</message>
<message>
<location line="+16"/>
<source>Set the number of threads to service RPC calls (default: 4)</source>
<translation>Maximale Anzahl an Threads zur Verarbeitung von RPC-Anfragen festlegen (Standard: 4)</translation>
</message>
<message>
<location line="+26"/>
<source>Verifying blocks...</source>
<translation>Verifiziere Blöcke...</translation>
</message>
<message>
<location line="+1"/>
<source>Verifying wallet...</source>
<translation>Verifiziere Brieftasche...</translation>
</message>
<message>
<location line="-69"/>
<source>Imports blocks from external blk000??.dat file</source>
<translation>Blöcke aus externer Datei blk000??.dat importieren</translation>
</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>Maximale Anzahl an Skript-Verifizierungs-Threads festlegen (bis zu 16, 0 = automatisch, <0 = soviele Kerne frei lassen, Standard: 0)</translation>
</message>
<message>
<location line="+77"/>
<source>Information</source>
<translation>Hinweis</translation>
</message>
<message>
<location line="+3"/>
<source>Invalid -tor address: '%s'</source>
<translation>Ungültige Adresse in -tor: '%s'</translation>
</message>
<message>
<location line="+1"/>
<source>Invalid amount for -minrelaytxfee=<amount>: '%s'</source>
<translation>Ungültiger Betrag für -minrelaytxfee=<amount>: '%s'</translation>
</message>
<message>
<location line="+1"/>
<source>Invalid amount for -mintxfee=<amount>: '%s'</source>
<translation>Ungültiger Betrag für -mintxfee=<amount>: '%s'</translation>
</message>
<message>
<location line="+8"/>
<source>Maintain a full transaction index (default: 0)</source>
<translation>Einen vollständigen Transaktionsindex pflegen (Standard: 0)</translation>
</message>
<message>
<location line="+2"/>
<source>Maximum per-connection receive buffer, <n>*1000 bytes (default: 5000)</source>
<translation>Maximale Größe, <n> * 1000 Byte, des Empfangspuffers pro Verbindung (Standard: 5000)</translation>
</message>
<message>
<location line="+1"/>
<source>Maximum per-connection send buffer, <n>*1000 bytes (default: 1000)</source>
<translation>Maximale Größe, <n> * 1000 Byte, des Sendepuffers pro Verbindung (Standard: 1000)</translation>
</message>
<message>
<location line="+2"/>
<source>Only accept block chain matching built-in checkpoints (default: 1)</source>
<translation>Blockkette nur akzeptieren, wenn sie mit den integrierten Prüfpunkten übereinstimmt (Standard: 1)</translation>
</message>
<message>
<location line="+1"/>
<source>Only connect to nodes in network <net> (IPv4, IPv6 or Tor)</source>
<translation>Verbinde nur zu Knoten des Netztyps <net> (IPv4, IPv6 oder Tor)</translation>
</message>
<message>
<location line="+2"/>
<source>Output extra debugging information. Implies all other -debug* options</source>
<translation>Ausgabe zusätzlicher Debugginginformationen. Beinhaltet alle anderen "-debug*"-Parameter</translation>
</message>
<message>
<location line="+1"/>
<source>Output extra network debugging information</source>
<translation>Ausgabe zusätzlicher Netzwerk-Debugginginformationen</translation>
</message>
<message>
<location line="+2"/>
<source>Prepend debug output with timestamp</source>
<translation>Der Debugausgabe einen Zeitstempel voranstellen</translation>
</message>
<message>
<location line="+5"/>
<source>SSL options: (see the Blizzardcoin Wiki for SSL setup instructions)</source>
<translation>SSL-Optionen: (siehe Blizzardcoin-Wiki für SSL-Installationsanweisungen)</translation>
</message>
<message>
<location line="+1"/>
<source>Select the version of socks proxy to use (4-5, default: 5)</source>
<translation>SOCKS-Version des Proxies festlegen (4-5, Standard: 5)</translation>
</message>
<message>
<location line="+3"/>
<source>Send trace/debug info to console instead of debug.log file</source>
<translation>Rückverfolgungs- und Debuginformationen an die Konsole senden anstatt sie in die Datei debug.log zu schreiben</translation>
</message>
<message>
<location line="+1"/>
<source>Send trace/debug info to debugger</source>
<translation>Rückverfolgungs- und Debuginformationen an den Debugger senden</translation>
</message>
<message>
<location line="+5"/>
<source>Set maximum block size in bytes (default: 250000)</source>
<translation>Maximale Blockgröße in Byte festlegen (Standard: 250000)</translation>
</message>
<message>
<location line="+1"/>
<source>Set minimum block size in bytes (default: 0)</source>
<translation>Minimale Blockgröße in Byte festlegen (Standard: 0)</translation>
</message>
<message>
<location line="+2"/>
<source>Shrink debug.log file on client startup (default: 1 when no -debug)</source>
<translation>Verkleinere Datei debug.log beim Start des Clients (Standard: 1, wenn kein -debug)</translation>
</message>
<message>
<location line="+1"/>
<source>Signing transaction failed</source>
<translation>Signierung der Transaktion fehlgeschlagen</translation>
</message>
<message>
<location line="+2"/>
<source>Specify connection timeout in milliseconds (default: 5000)</source>
<translation>Verbindungstimeout in Millisekunden festlegen (Standard: 5000)</translation>
</message>
<message>
<location line="+4"/>
<source>System error: </source>
<translation>Systemfehler: </translation>
</message>
<message>
<location line="+4"/>
<source>Transaction amount too small</source>
<translation>Transaktionsbetrag zu gering</translation>
</message>
<message>
<location line="+1"/>
<source>Transaction amounts must be positive</source>
<translation>Transaktionsbeträge müssen positiv sein</translation>
</message>
<message>
<location line="+1"/>
<source>Transaction too large</source>
<translation>Transaktion zu groß</translation>
</message>
<message>
<location line="+7"/>
<source>Use UPnP to map the listening port (default: 0)</source>
<translation>UPnP verwenden, um die Portweiterleitung einzurichten (Standard: 0)</translation>
</message>
<message>
<location line="+1"/>
<source>Use UPnP to map the listening port (default: 1 when listening)</source>
<translation>UPnP verwenden, um die Portweiterleitung einzurichten (Standard: 1, wenn abgehört wird)</translation>
</message>
<message>
<location line="+1"/>
<source>Use proxy to reach tor hidden services (default: same as -proxy)</source>
<translation>Proxy verwenden, um versteckte Tor-Dienste zu erreichen (Standard: identisch mit -proxy)</translation>
</message>
<message>
<location line="+2"/>
<source>Username for JSON-RPC connections</source>
<translation>Benutzername für JSON-RPC-Verbindungen</translation>
</message>
<message>
<location line="+4"/>
<source>Warning</source>
<translation>Warnung</translation>
</message>
<message>
<location line="+1"/>
<source>Warning: This version is obsolete, upgrade required!</source>
<translation>Warnung: Diese Version is veraltet, Aktualisierung erforderlich!</translation>
</message>
<message>
<location line="+1"/>
<source>You need to rebuild the databases using -reindex to change -txindex</source>
<translation>Sie müssen die Datenbank mit Hilfe von -reindex neu aufbauen, um -txindex zu verändern.</translation>
</message>
<message>
<location line="+1"/>
<source>wallet.dat corrupt, salvage failed</source>
<translation>wallet.dat beschädigt, Rettung fehlgeschlagen</translation>
</message>
<message>
<location line="-50"/>
<source>Password for JSON-RPC connections</source>
<translation>Passwort für JSON-RPC-Verbindungen</translation>
</message>
<message>
<location line="-67"/>
<source>Allow JSON-RPC connections from specified IP address</source>
<translation>JSON-RPC-Verbindungen von der angegebenen IP-Adresse erlauben</translation>
</message>
<message>
<location line="+76"/>
<source>Send commands to node running on <ip> (default: 127.0.0.1)</source>
<translation>Sende Befehle an Knoten <ip> (Standard: 127.0.0.1)</translation>
</message>
<message>
<location line="-120"/>
<source>Execute command when the best block changes (%s in cmd is replaced by block hash)</source>
<translation>Kommando ausführen wenn der beste Block wechselt (%s im Kommando wird durch den Hash des Blocks ersetzt)</translation>
</message>
<message>
<location line="+147"/>
<source>Upgrade wallet to latest format</source>
<translation>Brieftasche auf das neueste Format aktualisieren</translation>
</message>
<message>
<location line="-21"/>
<source>Set key pool size to <n> (default: 100)</source>
<translation>Größe des Schlüsselpools festlegen auf <n> (Standard: 100)</translation>
</message>
<message>
<location line="-12"/>
<source>Rescan the block chain for missing wallet transactions</source>
<translation>Blockkette erneut nach fehlenden Transaktionen der Brieftasche durchsuchen</translation>
</message>
<message>
<location line="+35"/>
<source>Use OpenSSL (https) for JSON-RPC connections</source>
<translation>OpenSSL (https) für JSON-RPC-Verbindungen verwenden</translation>
</message>
<message>
<location line="-26"/>
<source>Server certificate file (default: server.cert)</source>
<translation>Serverzertifikat (Standard: server.cert)</translation>
</message>
<message>
<location line="+1"/>
<source>Server private key (default: server.pem)</source>
<translation>Privater Serverschlüssel (Standard: server.pem)</translation>
</message>
<message>
<location line="-151"/>
<source>Acceptable ciphers (default: TLSv1+HIGH:!SSLv2:!aNULL:!eNULL:!AH:!3DES:@STRENGTH)</source>
<translation>Akzeptierte Chiffren (Standard: TLSv1+HIGH:!SSLv2:!aNULL:!eNULL:!AH:!3DES:@STRENGTH)</translation>
</message>
<message>
<location line="+165"/>
<source>This help message</source>
<translation>Dieser Hilfetext</translation>
</message>
<message>
<location line="+6"/>
<source>Unable to bind to %s on this computer (bind returned error %d, %s)</source>
<translation>Kann auf diesem Computer nicht an %s binden (von bind zurückgegebener Fehler %d, %s)</translation>
</message>
<message>
<location line="-91"/>
<source>Connect through socks proxy</source>
<translation>Verbindung über SOCKS-Proxy herstellen</translation>
</message>
<message>
<location line="-10"/>
<source>Allow DNS lookups for -addnode, -seednode and -connect</source>
<translation>Erlaube DNS-Namensauflösung für -addnode, -seednode und -connect</translation>
</message>
<message>
<location line="+55"/>
<source>Loading addresses...</source>
<translation>Lade Adressen...</translation>
</message>
<message>
<location line="-35"/>
<source>Error loading wallet.dat: Wallet corrupted</source>
<translation>Fehler beim Laden von wallet.dat: Brieftasche beschädigt</translation>
</message>
<message>
<location line="+1"/>
<source>Error loading wallet.dat: Wallet requires newer version of Blizzardcoin</source>
<translation>Fehler beim Laden von wallet.dat: Brieftasche benötigt neuere Version von Blizzardcoin</translation>
</message>
<message>
<location line="+93"/>
<source>Wallet needed to be rewritten: restart Blizzardcoin to complete</source>
<translation>Brieftasche musste neu geschrieben werden: Starten Sie Blizzardcoin zur Fertigstellung neu</translation>
</message>
<message>
<location line="-95"/>
<source>Error loading wallet.dat</source>
<translation>Fehler beim Laden von wallet.dat (Brieftasche)</translation>
</message>
<message>
<location line="+28"/>
<source>Invalid -proxy address: '%s'</source>
<translation>Ungültige Adresse in -proxy: '%s'</translation>
</message>
<message>
<location line="+56"/>
<source>Unknown network specified in -onlynet: '%s'</source>
<translation>Unbekannter Netztyp in -onlynet angegeben: '%s'</translation>
</message>
<message>
<location line="-1"/>
<source>Unknown -socks proxy version requested: %i</source>
<translation>Unbekannte Proxyversion in -socks angefordert: %i</translation>
</message>
<message>
<location line="-96"/>
<source>Cannot resolve -bind address: '%s'</source>
<translation>Kann Adresse in -bind nicht auflösen: '%s'</translation>
</message>
<message>
<location line="+1"/>
<source>Cannot resolve -externalip address: '%s'</source>
<translation>Kann Adresse in -externalip nicht auflösen: '%s'</translation>
</message>
<message>
<location line="+44"/>
<source>Invalid amount for -paytxfee=<amount>: '%s'</source>
<translation>Ungültiger Betrag für -paytxfee=<amount>: '%s'</translation>
</message>
<message>
<location line="+1"/>
<source>Invalid amount</source>
<translation>Ungültiger Betrag</translation>
</message>
<message>
<location line="-6"/>
<source>Insufficient funds</source>
<translation>Unzureichender Kontostand</translation>
</message>
<message>
<location line="+10"/>
<source>Loading block index...</source>
<translation>Lade Blockindex...</translation>
</message>
<message>
<location line="-57"/>
<source>Add a node to connect to and attempt to keep the connection open</source>
<translation>Mit dem Knoten verbinden und versuchen die Verbindung aufrecht zu halten</translation>
</message>
<message>
<location line="-25"/>
<source>Unable to bind to %s on this computer. Blizzardcoin is probably already running.</source>
<translation>Kann auf diesem Computer nicht an %s binden. Evtl. wurde Blizzardcoin bereits gestartet.</translation>
</message>
<message>
<location line="+64"/>
<source>Fee per KB to add to transactions you send</source>
<translation>Gebühr pro KB, die gesendeten Transaktionen hinzugefügt wird</translation>
</message>
<message>
<location line="+19"/>
<source>Loading wallet...</source>
<translation>Lade Brieftasche...</translation>
</message>
<message>
<location line="-52"/>
<source>Cannot downgrade wallet</source>
<translation>Brieftasche kann nicht auf eine ältere Version herabgestuft werden</translation>
</message>
<message>
<location line="+3"/>
<source>Cannot write default address</source>
<translation>Standardadresse kann nicht geschrieben werden</translation>
</message>
<message>
<location line="+64"/>
<source>Rescanning...</source>
<translation>Durchsuche erneut...</translation>
</message>
<message>
<location line="-57"/>
<source>Done loading</source>
<translation>Laden abgeschlossen</translation>
</message>
<message>
<location line="+82"/>
<source>To use the %s option</source>
<translation>Zur Nutzung der %s Option</translation>
</message>
<message>
<location line="-74"/>
<source>Error</source>
<translation>Fehler</translation>
</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>Sie müssen den Wert rpcpassword=<passwort> in der Konfigurationsdatei angeben:
%s
Falls die Konfigurationsdatei nicht existiert, erzeugen Sie diese bitte mit Leserechten nur für den Dateibesitzer.</translation>
</message>
</context>
</TS> | blizzardcoin/blizzardcoin | src/qt/locale/bitcoin_de.ts | TypeScript | mit | 120,925 | [
30522,
1026,
1029,
20950,
2544,
1027,
1000,
1015,
1012,
1014,
1000,
1029,
1028,
1026,
999,
9986,
13874,
24529,
1028,
1026,
24529,
2653,
1027,
1000,
2139,
1000,
2544,
1027,
1000,
1016,
1012,
1014,
1000,
1028,
1026,
12398,
16044,
2278,
1028,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
#include <iostream>
#include <ifaddrs.h>
#include <stdio.h>
#include <stdlib.h>
#include <signal.h>
#include <stdio.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#include <time.h>
#include <syslog.h>
#include <dlfcn.h>
#include <sys/socket.h>
#include <netdb.h>
#include <string.h>
#include "webserver_api_functions.h"
static void termination_handler(int signum) {
WebserverShutdownHandler();
}
static void sig_pipe_hanler(int signum) {
//printf("Sig Pipe\n");
}
DEFINE_WEBSOCKET_HANDLER( "TestSocket" , TestSocket ) {
switch (signal) {
case WEBSOCKET_CONNECT:
printf("Websocket API Connect TestSocket : %s \n", guid);
break;
case WEBSOCKET_DISCONNECT:
printf("Websocket API Disconnect TestSocket : %s \n", guid);
break;
case WEBSOCKET_MSG:
printf("Websocket API TestSocket Msg 1 %s\n", msg);
WebsocketSendTextFrame(guid, msg, strlen(msg));
break;
}
}
int main(int argc, char **argv) {
if (signal(SIGINT, termination_handler) == SIG_IGN ) signal(SIGINT, SIG_IGN);
if (signal(SIGHUP, termination_handler) == SIG_IGN ) signal(SIGHUP, SIG_IGN);
if (signal(SIGTERM, termination_handler) == SIG_IGN ) signal(SIGTERM, SIG_IGN);
if (signal(SIGPIPE, sig_pipe_hanler) == SIG_IGN ) signal(SIGPIPE, SIG_IGN);
if (0 == WebserverInit()) {
WebserverAddFileDir("", "www");
WebserverConfigSetInt("port",8080);
REGISTER_WEBSOCKET_HANDLER ( TestSocket );
WebserverStart();
}
WebserverShutdown();
return 0;
}
| lordrasmus/libcwebui | tests/config_variants/LinuxWebsocketSelect/main.cpp | C++ | mpl-2.0 | 1,502 | [
30522,
1001,
2421,
1026,
16380,
25379,
1028,
1001,
2421,
1026,
2065,
30524,
1026,
25353,
2015,
1013,
4127,
1012,
1044,
1028,
1001,
2421,
1026,
25353,
2015,
1013,
28093,
1012,
1044,
1028,
1001,
2421,
1026,
4895,
2923,
2094,
1012,
1044,
1028,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
---
title: Announcing Istio 1.11.6
linktitle: 1.11.6
subtitle: Patch Release
description: Istio 1.11.6 patch release.
publishdate: 2022-02-03
release: 1.11.6
aliases:
- /news/announcing-1.11.6
---
This release contains bug fixes to improve robustness. This release note describes what’s different between Istio 1.11.5 and Istio 1.11.6
{{< relnote >}}
## Changes
- **Added** privileged flag to Istio-CNI Helm charts to set `securityContext` flag.
([Issue #34211](https://github.com/istio/istio/issues/34211))
- **Added** an option to disable a number of nonstandard kubeconfig authentication methods when using multicluster secret by configuring the
`PILOT_INSECURE_MULTICLUSTER_KUBECONFIG_OPTIONS` environment variable in Istiod. By default, this option is configured to allow all methods; future versions will restrict this by default.
- **Fixed** an issue where enabling tracing with telemetry API would cause a malformed host header being used at the trace report request. ([Issue #35750](https://github.com/istio/istio/issues/35750)),([Issue #36166](https://github.com/istio/istio/issues/36166)),([Issue #36521](https://github.com/istio/istio/issues/36521))
- **Fixed** error format after json marshal in virtual machine config.
([Issue #36358](https://github.com/istio/istio/issues/36358))
- **Fixed** endpoint slice cache memory leak.
- **Fixed** an issue where `EnvoyFilter` patches on `virtualOutbound-blackhole` could cause memory leaks.
- **Fixed** an issue where using `ISTIO_MUTUAL` TLS mode in Gateways while also setting `credentialName` causes mutual TLS to not be configured.
For backwards compatibility, this only introduces a warning. To enable the new behavior, set the `PILOT_ENABLE_LEGACY_ISTIO_MUTUAL_CREDENTIAL_NAME=false`
environment variable in Istiod. This will cause invalid configurations to be rejected, and will be the default behavior in future releases.
| istio/istio.io | content/en/news/releases/1.11.x/announcing-1.11.6/index.md | Markdown | apache-2.0 | 1,907 | [
30522,
1011,
1011,
1011,
2516,
1024,
13856,
21541,
3695,
1015,
1012,
2340,
1012,
1020,
4957,
3775,
9286,
1024,
1015,
1012,
2340,
1012,
1020,
4942,
3775,
9286,
1024,
8983,
2713,
6412,
1024,
21541,
3695,
1015,
1012,
2340,
1012,
1020,
8983,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ESSSM.Configuration
{
public interface IConfigureComplexAwaitTransitionDefinition<TState, TContext, TInput> :
IConfigureComplexTransitionDefinition<TState, TContext>,
IRecordTransitionMetadata<TContext, TInput, IConfigureComplexAwaitTransitionDefinition<TState, TContext, TInput>>
{
IConfigureComplexTransitionDefinition<TState, TContext> OnReceive(Action<TContext, TInput> handler);
}
}
| stanshillis/ESSSM | src/ESSSM/Configuration/IConfigureComplexAwaitTransitionDefinition.cs | C# | mit | 524 | [
30522,
2478,
2291,
1025,
2478,
2291,
1012,
6407,
1012,
12391,
1025,
2478,
2291,
1012,
11409,
4160,
1025,
2478,
2291,
1012,
3793,
1025,
3415,
15327,
9686,
4757,
2213,
1012,
9563,
1063,
2270,
8278,
12696,
8873,
27390,
8586,
25377,
2571,
18684... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
/*
* arch/arm/mach-tegra/pm-t3.c
*
* Tegra3 SOC-specific power and cluster management
*
* Copyright (c) 2009-2011, NVIDIA Corporation.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*/
#include <linux/kernel.h>
#include <linux/init.h>
#include <linux/io.h>
#include <linux/smp.h>
#include <linux/interrupt.h>
#include <linux/clk.h>
#include <linux/delay.h>
#include <linux/irq.h>
#include <mach/gpio.h>
#include <mach/iomap.h>
#include <mach/irqs.h>
#include <asm/cpu_pm.h>
#include <asm/hardware/gic.h>
#include <trace/events/power.h>
#include "clock.h"
#include "cpuidle.h"
#include "pm.h"
#include "sleep.h"
#include "tegra3_emc.h"
#include "dvfs.h"
#ifdef CONFIG_TEGRA_CLUSTER_CONTROL
#define CAR_CCLK_BURST_POLICY \
(IO_ADDRESS(TEGRA_CLK_RESET_BASE) + 0x20)
#define CAR_SUPER_CCLK_DIVIDER \
(IO_ADDRESS(TEGRA_CLK_RESET_BASE) + 0x24)
#define CAR_CCLKG_BURST_POLICY \
(IO_ADDRESS(TEGRA_CLK_RESET_BASE) + 0x368)
#define CAR_SUPER_CCLKG_DIVIDER \
(IO_ADDRESS(TEGRA_CLK_RESET_BASE) + 0x36C)
#define CAR_CCLKLP_BURST_POLICY \
(IO_ADDRESS(TEGRA_CLK_RESET_BASE) + 0x370)
#define PLLX_DIV2_BYPASS_LP (1<<16)
#define CAR_SUPER_CCLKLP_DIVIDER \
(IO_ADDRESS(TEGRA_CLK_RESET_BASE) + 0x374)
#define CAR_BOND_OUT_V \
(IO_ADDRESS(TEGRA_CLK_RESET_BASE) + 0x390)
#define CAR_BOND_OUT_V_CPU_G (1<<0)
#define CAR_BOND_OUT_V_CPU_LP (1<<1)
#define CAR_CLK_ENB_V_SET \
(IO_ADDRESS(TEGRA_CLK_RESET_BASE) + 0x440)
#define CAR_CLK_ENB_V_CPU_G (1<<0)
#define CAR_CLK_ENB_V_CPU_LP (1<<1)
#define CAR_RST_CPUG_CMPLX_SET \
(IO_ADDRESS(TEGRA_CLK_RESET_BASE) + 0x450)
#define CAR_RST_CPUG_CMPLX_CLR \
(IO_ADDRESS(TEGRA_CLK_RESET_BASE) + 0x454)
#define CAR_RST_CPULP_CMPLX_SET \
(IO_ADDRESS(TEGRA_CLK_RESET_BASE) + 0x458)
#define CAR_RST_CPULP_CMPLX_CLR \
(IO_ADDRESS(TEGRA_CLK_RESET_BASE) + 0x45C)
#define CAR_CLK_CPUG_CMPLX_SET \
(IO_ADDRESS(TEGRA_CLK_RESET_BASE) + 0x460)
#define CAR_CLK_CPUG_CMPLX_CLR \
(IO_ADDRESS(TEGRA_CLK_RESET_BASE) + 0x464)
#define CAR_CLK_CPULP_CMPLX_SET \
(IO_ADDRESS(TEGRA_CLK_RESET_BASE) + 0x468)
#define CAR_CLK_CPULP_CMPLX_CLR \
(IO_ADDRESS(TEGRA_CLK_RESET_BASE) + 0x46C)
#define CPU_CLOCK(cpu) (0x1<<(8+cpu))
#define CPU_RESET(cpu) (0x1111ul<<(cpu))
static int cluster_switch_prolog_clock(unsigned int flags)
{
u32 reg;
u32 CclkBurstPolicy;
u32 SuperCclkDivier;
/* Read the bond out register containing the G and LP CPUs. */
reg = readl(CAR_BOND_OUT_V);
/* Sync G-PLLX divider bypass with LP (no effect on G, just to prevent
LP settings overwrite by save/restore code */
CclkBurstPolicy = ~PLLX_DIV2_BYPASS_LP & readl(CAR_CCLKG_BURST_POLICY);
CclkBurstPolicy |= PLLX_DIV2_BYPASS_LP & readl(CAR_CCLKLP_BURST_POLICY);
writel(CclkBurstPolicy, CAR_CCLKG_BURST_POLICY);
/* Switching to G? */
if (flags & TEGRA_POWER_CLUSTER_G) {
/* Do the G CPUs exist? */
if (reg & CAR_BOND_OUT_V_CPU_G)
return -ENXIO;
/* Keep G CPU clock policy set by upper laayer, with the
exception of the transition via LP1 */
if (flags & TEGRA_POWER_SDRAM_SELFREFRESH) {
/* In LP1 power mode come up on CLKM (oscillator) */
CclkBurstPolicy = readl(CAR_CCLKG_BURST_POLICY);
CclkBurstPolicy &= ~0xF;
SuperCclkDivier = 0;
writel(CclkBurstPolicy, CAR_CCLKG_BURST_POLICY);
writel(SuperCclkDivier, CAR_SUPER_CCLKG_DIVIDER);
}
/* Hold G CPUs 1-3 in reset after the switch */
reg = CPU_RESET(1) | CPU_RESET(2) | CPU_RESET(3);
writel(reg, CAR_RST_CPUG_CMPLX_SET);
/* Take G CPU 0 out of reset after the switch */
reg = CPU_RESET(0);
writel(reg, CAR_RST_CPUG_CMPLX_CLR);
/* Disable the clocks on G CPUs 1-3 after the switch */
reg = CPU_CLOCK(1) | CPU_CLOCK(2) | CPU_CLOCK(3);
writel(reg, CAR_CLK_CPUG_CMPLX_SET);
/* Enable the clock on G CPU 0 after the switch */
reg = CPU_CLOCK(0);
writel(reg, CAR_CLK_CPUG_CMPLX_CLR);
/* Enable the G CPU complex clock after the switch */
reg = CAR_CLK_ENB_V_CPU_G;
writel(reg, CAR_CLK_ENB_V_SET);
}
/* Switching to LP? */
else if (flags & TEGRA_POWER_CLUSTER_LP) {
/* Does the LP CPU exist? */
if (reg & CAR_BOND_OUT_V_CPU_LP)
return -ENXIO;
/* Keep LP CPU clock policy set by upper layer, with the
exception of the transition via LP1 */
if (flags & TEGRA_POWER_SDRAM_SELFREFRESH) {
/* In LP1 power mode come up on CLKM (oscillator) */
CclkBurstPolicy = readl(CAR_CCLKLP_BURST_POLICY);
CclkBurstPolicy &= ~0xF;
SuperCclkDivier = 0;
writel(CclkBurstPolicy, CAR_CCLKLP_BURST_POLICY);
writel(SuperCclkDivier, CAR_SUPER_CCLKLP_DIVIDER);
}
/* Take the LP CPU ut of reset after the switch */
reg = CPU_RESET(0);
writel(reg, CAR_RST_CPULP_CMPLX_CLR);
/* Enable the clock on the LP CPU after the switch */
reg = CPU_CLOCK(0);
writel(reg, CAR_CLK_CPULP_CMPLX_CLR);
/* Enable the LP CPU complex clock after the switch */
reg = CAR_CLK_ENB_V_CPU_LP;
writel(reg, CAR_CLK_ENB_V_SET);
}
return 0;
}
void tegra_cluster_switch_prolog(unsigned int flags)
{
unsigned int target_cluster = flags & TEGRA_POWER_CLUSTER_MASK;
unsigned int current_cluster = is_lp_cluster()
? TEGRA_POWER_CLUSTER_LP
: TEGRA_POWER_CLUSTER_G;
u32 reg;
/* Read the flow controler CSR register and clear the CPU switch
and immediate flags. If an actual CPU switch is to be performed,
re-write the CSR register with the desired values. */
reg = readl(FLOW_CTRL_CPU_CSR(0));
reg &= ~(FLOW_CTRL_CPU_CSR_IMMEDIATE_WAKE |
FLOW_CTRL_CPU_CSR_SWITCH_CLUSTER);
/* Program flow controller for immediate wake if requested */
if (flags & TEGRA_POWER_CLUSTER_IMMEDIATE)
reg |= FLOW_CTRL_CPU_CSR_IMMEDIATE_WAKE;
/* Do nothing if no switch actions requested */
if (!target_cluster)
goto done;
if ((current_cluster != target_cluster) ||
(flags & TEGRA_POWER_CLUSTER_FORCE)) {
if (current_cluster != target_cluster) {
// Set up the clocks for the target CPU.
if (cluster_switch_prolog_clock(flags)) {
/* The target CPU does not exist */
goto done;
}
/* Set up the flow controller to switch CPUs. */
reg |= FLOW_CTRL_CPU_CSR_SWITCH_CLUSTER;
}
}
done:
writel(reg, FLOW_CTRL_CPU_CSR(0));
}
static void cluster_switch_epilog_actlr(void)
{
u32 actlr;
/* TLB maintenance broadcast bit (FW) is stubbed out on LP CPU (reads
as zero, writes ignored). Hence, it is not preserved across G=>LP=>G
switch by CPU save/restore code, but SMP bit is restored correctly.
Synchronize these two bits here after LP=>G transition. Note that
only CPU0 core is powered on before and after the switch. See also
bug 807595. */
__asm__("mrc p15, 0, %0, c1, c0, 1\n" : "=r" (actlr));
if (actlr & (0x1 << 6)) {
actlr |= 0x1;
__asm__("mcr p15, 0, %0, c1, c0, 1\n" : : "r" (actlr));
}
}
static void cluster_switch_epilog_gic(void)
{
unsigned int max_irq, i;
void __iomem *gic_base = IO_ADDRESS(TEGRA_ARM_INT_DIST_BASE);
/* Reprogram the interrupt affinity because the on the LP CPU,
the interrupt distributor affinity regsiters are stubbed out
by ARM (reads as zero, writes ignored). So when the LP CPU
context save code runs, the affinity registers will read
as all zero. This causes all interrupts to be effectively
disabled when back on the G CPU because they aren't routable
to any CPU. See bug 667720 for details. */
max_irq = readl(gic_base + GIC_DIST_CTR) & 0x1f;
max_irq = (max_irq + 1) * 32;
for (i = 32; i < max_irq; i += 4) {
u32 val = 0x01010101;
#ifdef CONFIG_GIC_SET_MULTIPLE_CPUS
unsigned int irq;
for (irq = i; irq < (i + 4); irq++) {
struct cpumask mask;
struct irq_desc *desc = irq_to_desc(irq);
if (desc && desc->affinity_hint &&
desc->irq_data.affinity) {
if (cpumask_and(&mask, desc->affinity_hint,
desc->irq_data.affinity))
val |= (*cpumask_bits(&mask) & 0xff) <<
((irq & 3) * 8);
}
}
#endif
writel(val, gic_base + GIC_DIST_TARGET + i * 4 / 4);
}
}
void tegra_cluster_switch_epilog(unsigned int flags)
{
u32 reg;
/* Make sure the switch and immediate flags are cleared in
the flow controller to prevent undesirable side-effects
for future users of the flow controller. */
reg = readl(FLOW_CTRL_CPU_CSR(0));
reg &= ~(FLOW_CTRL_CPU_CSR_IMMEDIATE_WAKE |
FLOW_CTRL_CPU_CSR_SWITCH_CLUSTER);
writel(reg, FLOW_CTRL_CPU_CSR(0));
/* Perform post-switch LP=>G clean-up */
if (!is_lp_cluster()) {
cluster_switch_epilog_actlr();
cluster_switch_epilog_gic();
}
#if DEBUG_CLUSTER_SWITCH
{
/* FIXME: clock functions below are taking mutex */
struct clk *c = tegra_get_clock_by_name(
is_lp_cluster() ? "cpu_lp" : "cpu_g");
DEBUG_CLUSTER(("%s: %s freq %lu\r\n", __func__,
is_lp_cluster() ? "LP" : "G", clk_get_rate(c)));
}
#endif
}
int tegra_cluster_control(unsigned int us, unsigned int flags)
{
static ktime_t last_g2lp;
unsigned int target_cluster = flags & TEGRA_POWER_CLUSTER_MASK;
unsigned int current_cluster = is_lp_cluster()
? TEGRA_POWER_CLUSTER_LP
: TEGRA_POWER_CLUSTER_G;
unsigned long irq_flags;
if ((target_cluster == TEGRA_POWER_CLUSTER_MASK) || !target_cluster)
return -EINVAL;
if (num_online_cpus() > 1)
return -EBUSY;
if ((current_cluster == target_cluster)
&& !(flags & TEGRA_POWER_CLUSTER_FORCE))
return -EEXIST;
if (target_cluster == TEGRA_POWER_CLUSTER_G)
if (!is_g_cluster_present())
return -EPERM;
trace_power_start(POWER_PSTATE, target_cluster, 0);
if (flags & TEGRA_POWER_CLUSTER_IMMEDIATE)
us = 0;
DEBUG_CLUSTER(("%s(LP%d): %s->%s %s %s %d\r\n", __func__,
(flags & TEGRA_POWER_SDRAM_SELFREFRESH) ? 1 : 2,
is_lp_cluster() ? "LP" : "G",
(target_cluster == TEGRA_POWER_CLUSTER_G) ? "G" : "LP",
(flags & TEGRA_POWER_CLUSTER_IMMEDIATE) ? "immediate" : "",
(flags & TEGRA_POWER_CLUSTER_FORCE) ? "force" : "",
us));
local_irq_save(irq_flags);
if (current_cluster != target_cluster && !timekeeping_suspended) {
ktime_t now = ktime_get();
if (target_cluster == TEGRA_POWER_CLUSTER_G) {
s64 t = ktime_to_us(ktime_sub(now, last_g2lp));
s64 t_off = tegra_cpu_power_off_time();
if (t_off > t)
udelay((unsigned int)(t_off - t));
tegra_dvfs_rail_on(tegra_cpu_rail, now);
} else {
last_g2lp = now;
tegra_dvfs_rail_off(tegra_cpu_rail, now);
}
}
if (flags & TEGRA_POWER_SDRAM_SELFREFRESH) {
if (us)
tegra_lp2_set_trigger(us);
tegra_cluster_switch_prolog(flags);
tegra_suspend_dram(TEGRA_SUSPEND_LP1, flags);
tegra_cluster_switch_epilog(flags);
if (us)
tegra_lp2_set_trigger(0);
} else {
tegra_set_cpu_in_lp2(0);
cpu_pm_enter();
tegra_idle_lp2_last(0, flags);
cpu_pm_exit();
tegra_clear_cpu_in_lp2(0);
}
local_irq_restore(irq_flags);
DEBUG_CLUSTER(("%s: %s\r\n", __func__, is_lp_cluster() ? "LP" : "G"));
return 0;
}
#endif
#ifdef CONFIG_PM_SLEEP
void tegra_lp0_suspend_mc(void)
{
/* Since memory frequency after LP0 is restored to boot rate
mc timing is saved during init, not on entry to LP0. Keep
this hook just in case, anyway */
}
void tegra_lp0_resume_mc(void)
{
tegra_mc_timing_restore();
}
void tegra_exit_lp_mode(void)
{
unsigned int flags;
printk("tegra_exit_lp_mod+\n");
if (is_lp_cluster()) {
flags = TEGRA_POWER_CLUSTER_G;
flags |= TEGRA_POWER_CLUSTER_IMMEDIATE;
tegra_cluster_control(0, flags);
}
printk("tegra_exit_lp_mod-\n");
}
void tegra_enter_lp_mode(void)
{
unsigned int flags;
printk("tegra_enter_lp_mod+\n");
if (!is_lp_cluster()) {
flags = TEGRA_POWER_CLUSTER_LP;
flags |= TEGRA_POWER_CLUSTER_IMMEDIATE;
tegra_cluster_control(0, flags);
}
printk("tegra_enter_lp_mod-\n");
}
void tegra_lp0_cpu_mode(bool enter)
{
static bool entered_on_g = false;
unsigned int flags;
if (enter)
entered_on_g = !is_lp_cluster();
if (entered_on_g) {
flags = enter ? TEGRA_POWER_CLUSTER_LP : TEGRA_POWER_CLUSTER_G;
flags |= TEGRA_POWER_CLUSTER_IMMEDIATE;
tegra_cluster_control(0, flags);
}
}
#endif
| Galaxian-Soup/android_kernel_asus_tf300t | arch/arm/mach-tegra/pm-t3.c | C | gpl-2.0 | 12,299 | [
30522,
1013,
1008,
1008,
7905,
1013,
2849,
1013,
24532,
1011,
8915,
17643,
1013,
7610,
1011,
1056,
2509,
1012,
1039,
1008,
1008,
8915,
17643,
2509,
27084,
1011,
3563,
2373,
1998,
9324,
2968,
1008,
1008,
9385,
1006,
1039,
1007,
2268,
1011,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
/* {{{
This file is part of DPGSolver.
DPGSolver is free software: you can redistribute it and/or modify it under the terms of the GNU
General Public License as published by the Free Software Foundation, either version 3 of the
License, or any later version.
DPGSolver is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
Public License for more details.
You should have received a copy of the GNU General Public License along with DPGSolver. If not, see
<http://www.gnu.org/licenses/>.
}}} */
/** \file
*/
#include "computational_elements.h"
#include "face_solver_adaptive.h"
#include "face_solver_dg.h"
#include "face_solver_dpg.h"
#include "face_solver_opg.h"
#include "volume_solver_adaptive.h"
#include "volume_solver_dg.h"
#include "volume_solver_dpg.h"
#include "volume_solver_opg.h"
#include "element.h"
#include "element_geometry.h"
#include "element_plotting.h"
#include "element_solution.h"
#include "element_adaptation.h"
#include "element_solver.h"
#include "element_solver_dg.h"
#include "element_solver_dpg.h"
#include "element_solver_opg.h"
#include "intrusive.h"
#include "simulation.h"
// Templated functions ********************************************************************************************** //
#include "def_templates_type_d.h"
#include "computational_elements_T.c"
#include "undef_templates_type.h"
#include "def_templates_type_dc.h"
#include "computational_elements_T.c"
#include "undef_templates_type.h"
// Static function declarations ************************************************************************************* //
/** \brief Function pointer to a derived Element destructor function for a element which is part of an
* \ref Intrusive_List.
* \param element Pointer to the element link in the list.
*/
typedef void (*destructor_derived_Element_fptr)
(struct Element* element_ptr
);
/// Container holding information used for \ref constructor_derived_Elements and \ref destructor_derived_Elements.
struct Derived_Elements_Info {
size_t sizeof_base, ///< The size of the base element.
sizeof_derived; ///< The size of the derived element.
constructor_derived_Element_fptr constructor_derived_Element; ///< \ref constructor_derived_Element_fptr.
destructor_derived_Element_fptr destructor_derived_Element; ///< \ref destructor_derived_Element_fptr.
};
/** \brief Return a stack-allocated \ref Derived_Elements_Info container for \ref constructor_derived_Elements.
* \return See brief. */
static struct Derived_Elements_Info get_c_Derived_Elements_Info
(const int derived_name, ///< Defined for \ref constructor_derived_Elements.
const struct Simulation* sim ///< \ref Simulation.
);
/** \brief Return a stack-allocated \ref Derived_Elements_Info container for \ref destructor_derived_Elements.
* \return See brief. */
static struct Derived_Elements_Info get_d_Derived_Elements_Info
(const int base_name, ///< Defined for \ref destructor_derived_Elements.
const int derived_name ///< Defined for \ref constructor_derived_Elements.
);
/// \brief Update the pointers to the \ref Element members in the current computational element lists.
static void update_computational_element_elements
(struct Simulation* sim ///< \ref Simulation.
);
/** \brief `const` version of \ref constructor_derived_Intrusive_Link.
* \return See brief. */
static const struct const_Intrusive_Link* constructor_derived_const_Intrusive_Link
(const struct const_Intrusive_Link* base, ///< Defined for \ref constructor_derived_Intrusive_Link.
const size_t sizeof_base, ///< Defined for \ref constructor_derived_Intrusive_Link.
const size_t sizeof_derived ///< Defined for \ref constructor_derived_Intrusive_Link.
);
/** \brief `const` version of \ref constructor_base_Intrusive_Link.
* \return See brief. */
static const struct const_Intrusive_Link* constructor_base_const_Intrusive_Link
(const struct const_Intrusive_Link* derived, ///< Defined for \ref constructor_base_Intrusive_Link.
const size_t sizeof_base ///< Defined for \ref constructor_base_Intrusive_Link.
);
// Interface functions ********************************************************************************************** //
void constructor_derived_Elements (struct Simulation* sim, const int derived_name)
{
struct Derived_Elements_Info de_i = get_c_Derived_Elements_Info(derived_name,sim);
const struct const_Intrusive_List* base = sim->elements;
// Reserve memory for the derived element list.
const struct const_Intrusive_List* elements = constructor_empty_const_IL(derived_name,base); // moved
for (const struct const_Intrusive_Link* curr = base->first; curr; curr = curr->next)
push_back_const_IL(elements,
constructor_derived_const_Intrusive_Link(curr,de_i.sizeof_base,de_i.sizeof_derived));
set_element_pointers((struct Intrusive_List*)elements);
sim->elements = elements;
// Perform construction specific to the derived element list.
for (const struct const_Intrusive_Link* curr = sim->elements->first; curr; ) {
const struct const_Intrusive_Link* next = curr->next;
const struct const_Element* element = (struct const_Element*) curr;
if (element->present)
de_i.constructor_derived_Element((struct Element*)curr,sim);
curr = next;
}
// Update pointers to the base elements to point to the derived elements.
update_computational_element_elements(sim);
// Destruct the base list.
destructor_const_IL_base(sim->elements);
}
void destructor_derived_Elements (struct Simulation* sim, const int base_name)
{
struct Derived_Elements_Info de_i = get_d_Derived_Elements_Info(base_name,sim->elements->name);
// Perform destruction specific to the derived element list.
for (const struct const_Intrusive_Link* curr = sim->elements->first; curr; ) {
const struct const_Intrusive_Link* next = curr->next;
const struct const_Element* element = (struct const_Element*) curr;
if (element->present)
de_i.destructor_derived_Element((struct Element*)curr);
curr = next;
}
// Reserve memory for the base element list.
const struct const_Intrusive_List* elements_prev = sim->elements;
sim->elements = constructor_empty_const_IL(base_name,NULL); // keep
for (const struct const_Intrusive_Link* curr = elements_prev->first; curr; curr = curr->next) {
push_back_const_IL(sim->elements,constructor_base_const_Intrusive_Link(curr,de_i.sizeof_base));
}
// Update pointers to the derived elements to point to the base elements.
update_computational_element_elements(sim);
// Destruct the derived list.
destructor_const_IL(elements_prev,true);
}
struct Intrusive_Link* constructor_derived_Intrusive_Link
(struct Intrusive_Link* base, const size_t sizeof_base, const size_t sizeof_derived)
{
struct Intrusive_Link* derived = calloc(1,sizeof_derived); // returned
memcpy(derived,base,sizeof_base); // shallow copy of the base.
assert(base->derived == NULL);
base->derived = derived;
return derived;
}
void constructor_offset_derived_Element
(constructor_derived_Element_fptr cde, const size_t sizeof_base, const struct Element*const base_e,
struct Element*const curr_e, const struct Simulation*const sim)
{
memcpy(curr_e,base_e,sizeof_base);
struct Intrusive_List* elements = constructor_empty_IL(IL_INVALID,NULL); // destructed
const ptrdiff_t curr_offset = BYTE_DIFF(curr_e,base_e);
for (const struct const_Intrusive_Link* curr = sim->elements->first; curr; curr = curr->next) {
struct Element* sim_e = (struct Element*) curr;
push_back_IL(elements,(struct Intrusive_Link*)BYTE_ADD(curr,curr_offset));
if (sim_e->type == curr_e->type)
break;
}
set_element_pointers(elements);
destructor_IL(elements,false);
cde(curr_e,sim);
}
bool list_is_derived_from (const char*const name_desired, const char list_type, const struct Simulation*const sim)
{
bool is_derived_from = false;
switch (list_type) {
case 'e':
if (strcmp(name_desired,"solver") == 0) {
switch (sim->elements->name) {
case IL_ELEMENT_SOLVER: // fallthrough
case IL_ELEMENT_SOLVER_DG: // fallthrough
case IL_ELEMENT_SOLVER_DPG: // fallthrough
case IL_ELEMENT_SOLVER_OPG:
is_derived_from = true;
break;
default:
; // Do nothing
break;
}
} else {
EXIT_ERROR("Unsupported: %s\n",name_desired);
}
break;
case 'f':
if (strcmp(name_desired,"solver") == 0) {
switch (sim->faces->name) {
case IL_FACE_SOLVER: // fallthrough
case IL_FACE_SOLVER_DG: // fallthrough
case IL_FACE_SOLVER_DPG: // fallthrough
case IL_FACE_SOLVER_OPG:
is_derived_from = true;
break;
default:
; // Do nothing
break;
}
} else {
EXIT_ERROR("Unsupported: %s\n",name_desired);
}
break;
case 'v':
if (strcmp(name_desired,"solver") == 0) {
switch (sim->volumes->name) {
case IL_VOLUME_SOLVER: // fallthrough
case IL_VOLUME_SOLVER_DG: // fallthrough
case IL_VOLUME_SOLVER_DPG: // fallthrough
case IL_VOLUME_SOLVER_OPG:
is_derived_from = true;
break;
default:
; // Do nothing
break;
}
} else {
EXIT_ERROR("Unsupported: %s\n",name_desired);
}
break;
default:
EXIT_ERROR("Unsupported: %c\n",list_type);
break;
}
return is_derived_from;
}
// Static functions ************************************************************************************************* //
// Level 0 ********************************************************************************************************** //
static struct Derived_Elements_Info get_c_Derived_Elements_Info (const int derived_name, const struct Simulation* sim)
{
struct Derived_Elements_Info de_info;
switch (derived_name) {
case IL_ELEMENT_GEOMETRY:
assert(sim->elements->name == IL_ELEMENT);
de_info.sizeof_base = sizeof(struct Element);
de_info.sizeof_derived = sizeof(struct Geometry_Element);
de_info.constructor_derived_Element = constructor_derived_Geometry_Element;
break;
case IL_ELEMENT_PLOTTING:
assert(sim->elements->name == IL_ELEMENT);
de_info.sizeof_base = sizeof(struct Element);
de_info.sizeof_derived = sizeof(struct Plotting_Element);
de_info.constructor_derived_Element = constructor_derived_Plotting_Element;
break;
case IL_ELEMENT_SOLUTION:
assert(sim->elements->name == IL_ELEMENT);
de_info.sizeof_base = sizeof(struct Element);
de_info.sizeof_derived = sizeof(struct Solution_Element);
de_info.constructor_derived_Element = constructor_derived_Solution_Element;
break;
case IL_ELEMENT_ADAPTATION:
assert(sim->elements->name == IL_ELEMENT);
de_info.sizeof_base = sizeof(struct Element);
de_info.sizeof_derived = sizeof(struct Adaptation_Element);
de_info.constructor_derived_Element = constructor_derived_Adaptation_Element;
break;
case IL_ELEMENT_SOLVER:
assert(sim->elements->name == IL_ELEMENT);
de_info.sizeof_base = sizeof(struct Element);
de_info.sizeof_derived = sizeof(struct Solver_Element);
de_info.constructor_derived_Element = constructor_derived_Solver_Element;
break;
case IL_ELEMENT_SOLVER_DG:
assert(sim->elements->name == IL_ELEMENT_SOLVER);
de_info.sizeof_base = sizeof(struct Solver_Element);
de_info.sizeof_derived = sizeof(struct DG_Solver_Element);
de_info.constructor_derived_Element = constructor_derived_DG_Solver_Element;
break;
case IL_ELEMENT_SOLVER_DPG:
assert(sim->elements->name == IL_ELEMENT_SOLVER);
de_info.sizeof_base = sizeof(struct Solver_Element);
de_info.sizeof_derived = sizeof(struct DPG_Solver_Element);
de_info.constructor_derived_Element = constructor_derived_DPG_Solver_Element;
break;
case IL_ELEMENT_SOLVER_OPG:
assert(sim->elements->name == IL_ELEMENT_SOLVER);
de_info.sizeof_base = sizeof(struct Solver_Element);
de_info.sizeof_derived = sizeof(struct OPG_Solver_Element);
de_info.constructor_derived_Element = constructor_derived_OPG_Solver_Element;
break;
default:
EXIT_ERROR("Unsupported: %d\n",derived_name);
break;
}
return de_info;
}
static struct Derived_Elements_Info get_d_Derived_Elements_Info (const int base_name, const int derived_name)
{
struct Derived_Elements_Info de_info;
switch (base_name) {
case IL_ELEMENT:
de_info.sizeof_base = sizeof(struct Element);
break;
case IL_ELEMENT_SOLUTION:
de_info.sizeof_base = sizeof(struct Solution_Element);
break;
case IL_ELEMENT_SOLVER:
de_info.sizeof_base = sizeof(struct Solver_Element);
break;
default:
EXIT_ERROR("Unsupported: %d\n",base_name);
break;
}
switch (derived_name) {
case IL_ELEMENT_GEOMETRY:
assert(base_name == IL_ELEMENT);
de_info.destructor_derived_Element = destructor_derived_Geometry_Element;
break;
case IL_ELEMENT_PLOTTING:
assert(base_name == IL_ELEMENT);
de_info.destructor_derived_Element = destructor_derived_Plotting_Element;
break;
case IL_ELEMENT_SOLUTION:
assert(base_name == IL_ELEMENT);
de_info.destructor_derived_Element = destructor_derived_Solution_Element;
break;
case IL_ELEMENT_ADAPTATION:
assert(base_name == IL_ELEMENT);
de_info.destructor_derived_Element = destructor_derived_Adaptation_Element;
break;
case IL_ELEMENT_SOLVER:
assert(base_name == IL_ELEMENT);
de_info.destructor_derived_Element = destructor_derived_Solver_Element;
break;
case IL_ELEMENT_SOLVER_DG:
assert(base_name == IL_ELEMENT_SOLVER);
de_info.destructor_derived_Element = destructor_derived_DG_Solver_Element;
break;
case IL_ELEMENT_SOLVER_DPG:
assert(base_name == IL_ELEMENT_SOLVER);
de_info.destructor_derived_Element = destructor_derived_DPG_Solver_Element;
break;
case IL_ELEMENT_SOLVER_OPG:
assert(base_name == IL_ELEMENT_SOLVER);
de_info.destructor_derived_Element = destructor_derived_OPG_Solver_Element;
break;
default:
EXIT_ERROR("Unsupported: %d\n",derived_name);
break;
}
return de_info;
}
static void update_computational_element_elements (struct Simulation* sim)
{
const struct const_Intrusive_List* elements = sim->elements;
for (struct Intrusive_Link* curr = sim->volumes->first; curr; curr = curr->next) {
struct Volume* volume = (struct Volume*) curr;
const_cast_const_Element(&volume->element,get_element_by_type(elements,volume->element->type));
}
for (struct Intrusive_Link* curr = sim->faces->first; curr; curr = curr->next) {
struct Face* face = (struct Face*) curr;
const_cast_const_Element(&face->element,get_element_by_type(elements,face->element->type));
}
}
static const struct const_Intrusive_Link* constructor_derived_const_Intrusive_Link
(const struct const_Intrusive_Link* base, const size_t sizeof_base, const size_t sizeof_derived)
{
return (const struct const_Intrusive_Link*)
constructor_derived_Intrusive_Link((struct Intrusive_Link*)base,sizeof_base,sizeof_derived);
}
static const struct const_Intrusive_Link* constructor_base_const_Intrusive_Link
(const struct const_Intrusive_Link* derived, const size_t sizeof_base)
{
return (const struct const_Intrusive_Link*)
constructor_base_Intrusive_Link((struct Intrusive_Link*)derived,sizeof_base);
}
| PhilipZwanenburg/DPGSolver | src/simulation/computational_elements/computational_elements.c | C | gpl-3.0 | 15,138 | [
30522,
1013,
1008,
1063,
1063,
1063,
2023,
5371,
2003,
2112,
1997,
1040,
26952,
19454,
6299,
1012,
1040,
26952,
19454,
6299,
2003,
2489,
4007,
1024,
2017,
2064,
2417,
2923,
3089,
8569,
2618,
2009,
1998,
1013,
2030,
19933,
2009,
2104,
1996,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
/**
* Copyright (C) 2009-2014 BIMserver.org
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package cn.dlb.bim.models.ifc4.impl;
import org.eclipse.emf.ecore.EClass;
import cn.dlb.bim.models.ifc4.Ifc4Package;
import cn.dlb.bim.models.ifc4.IfcSlabType;
import cn.dlb.bim.models.ifc4.IfcSlabTypeEnum;
/**
* <!-- begin-user-doc -->
* An implementation of the model object '<em><b>Ifc Slab Type</b></em>'.
* <!-- end-user-doc -->
* <p>
* The following features are implemented:
* </p>
* <ul>
* <li>{@link cn.dlb.bim.models.ifc4.impl.IfcSlabTypeImpl#getPredefinedType <em>Predefined Type</em>}</li>
* </ul>
*
* @generated
*/
public class IfcSlabTypeImpl extends IfcBuildingElementTypeImpl implements IfcSlabType {
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected IfcSlabTypeImpl() {
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
protected EClass eStaticClass() {
return Ifc4Package.Literals.IFC_SLAB_TYPE;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public IfcSlabTypeEnum getPredefinedType() {
return (IfcSlabTypeEnum) eGet(Ifc4Package.Literals.IFC_SLAB_TYPE__PREDEFINED_TYPE, true);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setPredefinedType(IfcSlabTypeEnum newPredefinedType) {
eSet(Ifc4Package.Literals.IFC_SLAB_TYPE__PREDEFINED_TYPE, newPredefinedType);
}
} //IfcSlabTypeImpl
| shenan4321/BIMplatform | generated/cn/dlb/bim/models/ifc4/impl/IfcSlabTypeImpl.java | Java | agpl-3.0 | 2,127 | [
30522,
1013,
1008,
1008,
1008,
9385,
1006,
1039,
1007,
2268,
1011,
2297,
12170,
5244,
2121,
6299,
1012,
8917,
1008,
1008,
2023,
2565,
2003,
2489,
4007,
1024,
2017,
2064,
2417,
2923,
3089,
8569,
2618,
2009,
1998,
1013,
2030,
19933,
1008,
2... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
export * from './privacy.component';
| asadsahi/AspNetCoreSpa | src/Presentation/Web/ClientApp/src/app/components/privacy/index.ts | TypeScript | mit | 37 | [
30522,
9167,
1008,
2013,
1005,
1012,
1013,
9394,
1012,
6922,
1005,
1025,
102,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
{% import "macros.html" as macros %}
{% cache 0 "questions" questions search_tags scope sort query context.page context.page_size language_code %}
{% for question in questions.object_list %}
{{macros.question_summary(question)}}
{% endfor %}
{% endcache %}
{# comment todo: fix css here #}
{% if questions_count == 0 %}
{% include "main_page/nothing_found.html" %}
{% else %}
<div class="evenMore">
{% trans %}Did not find what you were looking for?{% endtrans %}
<a href="{% url ask %}">{% trans %}Please, post your question!{% endtrans %}</a>
</div>
{% endif %}
| samhoo/askbot-realworld | askbot/skins/default/templates/main_page/questions_loop.html | HTML | gpl-3.0 | 610 | [
30522,
1063,
1003,
12324,
1000,
26632,
2015,
1012,
16129,
1000,
2004,
26632,
2015,
1003,
1065,
1063,
1003,
17053,
1014,
1000,
3980,
1000,
3980,
3945,
1035,
22073,
9531,
4066,
23032,
6123,
1012,
3931,
6123,
1012,
3931,
1035,
2946,
2653,
1035... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
body {
background-color: #fff;
}
#xo-print {
width: 640px;
border: 1px solid #575757;
padding: 1px;
margin: 1px;
}
#xo-print-content {
margin: 1px;
padding: 1px;
}
.item {
margin: 1px;
padding: 1px;
}
.itemTitle {
font-size: 1.3em;
font-weight: bold;
font-variant: small-caps;
background-color: transparent;
text-align: left;
}
.itemBody {
font-size: 1em;
background-color: transparent;
}
.itemText {
font-size: 1em;
background-color: transparent;
}
.itemLink {
font-size: 1em;
background-color: transparent;
text-align: center;
}
.itemInfo {
text-align: right;
padding: 3px;
background-color: transparent;
font-size: 0.9em;
}
.itemImg {
text-align: center;
outline: none;
font-weight: bold;
}
li {
list-style: none;
}
html, body {
margin: 0;
padding: 0;
font-size: 9pt;
font-family: "Lucida Grande", Verdana, sans-serif;
background-color: #fff;
color: #000;
width: 95%;
}
a {
text-decoration: none;
color: #575757;
font-weight: bold;
}
/* display none */
#xo-noprint {
display: none;
}
#xo-canvas-leftcolumn {
display: none;
}
#xo-canvas-rightcolumn {
display: none;
}
#xo-language, #xo-userbar, xo-searchbar {
display: none;
}
#xo-top {
display: none;
}
body.theme-dialog #xo-banner {
display: none;
}
/*#xo-banner, */
#xo-banner-ad {
display: none;
}
#xo-globalnav {
display: none;
}
#xo-uptop {
display: none;
}
#xo-breadcrumb {
display: none;
}
#xo-footer .validw3c {
display: none;
}
#xo-footer span.design {
display: none;
}
#xo-footer .rss {
display: none;
}
#xo-logger-output {
display: none;
}
#system-select_notifications {
display: none;
}
.itemFoot {
display: none;
}
#xo-smiley {
display: none;
}
#user_sigSmiley {
display: none;
}
#user_sigStyletext {
display: none;
}
select#user_sigFont, select#user_sigColor, select#user_sigFont, select#user_sigSize {
display: none;
}
span#xoopsHiddenText {
display: none;
}
hr {
display: none;
}
form [name=notification_select] {
display: none;
}
input[type=submit], input[type=reset], input[type=button] {
display: none;
}
/*select { display: none;}*/
/*textarea { display: none;}*/
/* display for print */
h1, h2, h3, h4, h5, h6 {
text-decoration: none;
}
h1 {
font-size: 1.2em;
font-weight: bold;
}
h2 {
font-size: 1.1em;
}
h3, h4, h5, h6 {
font-size: 1em;
}
h1, h2, h3, h4, h5, h6 {
page-break-after: avoid !important;
}
img {
border: 0;
}
abbr, acronym {
border: 0;
}
abbr[title]:after, acronym[title]:after {
content: " (" attr(title) ")";
font-style: italic;
}
blockquote, q {
font-style: italic;
quotes: "\00AB\00A0" "\00A0\00BB" "\0022" "\0022";
}
pre, code, table {
page-break-inside: avoid !important;
}
pre {
border: 1px dotted;
padding: 12pt;
}
table th {
font-size: 1.4em;
font-weight: bold;
padding-bottom: 1em;
}
/* formulaire */
form, input, select {
font-size: .9em;
}
input[type=text] {
border-width: 0 0 1px 0 !important;
border-style: dotted;
border-color: #666;
}
input[type=checkbox] {
margin: 0;
border: none;
}
select {
font-size: .8em;
border-width: 0 0 1px 0 !important;
border-style: dotted;
border-color: #666;
}
textarea {
border: 1px dotted #666 !important;
height: auto;
overflow: hidden;
font-size: .9em;
font-style: italic;
}
/* for newbb/cbb */
td.foot {
display: none;
}
form#quick_reply {
display: none;
}
form[name=forum_jumpbox] {
display: none;
}
select#topicoption, select#viewmode {
display: none;
}
| mambax7/news | assets/css/print.css | CSS | gpl-2.0 | 3,754 | [
30522,
2303,
1063,
4281,
1011,
3609,
1024,
1001,
21461,
2546,
1025,
1065,
1001,
1060,
2080,
1011,
6140,
1063,
9381,
1024,
19714,
2361,
2595,
1025,
3675,
1024,
1015,
2361,
2595,
5024,
1001,
5401,
28311,
28311,
1025,
11687,
4667,
1024,
1015,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
/*
* This file is part of the LibreOffice project.
*
* 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/.
*
* This file incorporates work covered by the following license notice:
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed
* with this work for additional information regarding copyright
* ownership. The ASF licenses this file to you 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 .
*/
package ifc.style;
import lib.MultiPropertyTest;
/**
* Testing <code>com.sun.star.style.CharacterStyle</code>
* service properties :
* <ul>
* <li><code> CharDiffHeight</code></li>
* <li><code> CharPropHeight</code></li>
* <li><code> CharDiffHeightAsian</code></li>
* <li><code> CharPropHeightAsian</code></li>
* <li><code> CharDiffHeightComplex</code></li>
* <li><code> CharPropHeightComplex</code></li>
* </ul> <p>
* Properties testing is automated by <code>lib.MultiPropertyTest</code>.
* @see com.sun.star.style.CharacterStyle
*/
public class _CharacterStyle extends MultiPropertyTest {
}
| jvanz/core | qadevOOo/tests/java/ifc/style/_CharacterStyle.java | Java | gpl-3.0 | 1,421 | [
30522,
1013,
1008,
1008,
2023,
5371,
2003,
2112,
1997,
1996,
21091,
7245,
6610,
2622,
1012,
1008,
1008,
2023,
3120,
3642,
2433,
2003,
3395,
2000,
1996,
3408,
1997,
1996,
9587,
5831,
4571,
2270,
1008,
6105,
1010,
1058,
1012,
1016,
1012,
10... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
from flask_bcrypt import generate_password_hash
# Change the number of rounds (second argument) until it takes between
# 0.25 and 0.5 seconds to run.
generate_password_hash('password1', 8)
| VaSe7u/Supernutrient_0_5 | hash_check.py | Python | mit | 195 | [
30522,
2013,
13109,
19895,
1035,
4647,
2854,
13876,
12324,
9699,
1035,
20786,
1035,
23325,
1001,
2689,
1996,
2193,
1997,
6241,
1006,
2117,
6685,
1007,
2127,
2009,
3138,
2090,
1001,
1014,
1012,
2423,
1998,
1014,
1012,
1019,
3823,
2000,
2448,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
# SourceCode-Read
this repository contains of the some source code which I read to study.
看源代码写的一些注释。
| CloudFeng/SourceCode-Read | README.md | Markdown | gpl-2.0 | 125 | [
30522,
1001,
3120,
16044,
1011,
3191,
2023,
22409,
3397,
1997,
1996,
2070,
3120,
3642,
2029,
1045,
3191,
2000,
2817,
1012,
100,
100,
1760,
100,
100,
1916,
1740,
100,
100,
100,
1636,
102,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
/*
* Copyright (c) 2012-2013 Open Source Community - <http://www.peerfact.org>
* Copyright (c) 2011-2012 University of Paderborn - UPB
* Copyright (c) 2005-2011 KOM - Multimedia Communications Lab
*
* This file is part of PeerfactSim.KOM.
*
* PeerfactSim.KOM is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* any later version.
*
* PeerfactSim.KOM is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with PeerfactSim.KOM. If not, see <http://www.gnu.org/licenses/>.
*
*/
package org.peerfact.impl.application.infodissemination.moveModels;
import java.awt.Point;
import org.peerfact.impl.application.infodissemination.IDOApplication;
/**
* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
* This part of the Simulator is not maintained in the current version of
* PeerfactSim.KOM. There is no intention of the authors to fix this
* circumstances, since the changes needed are huge compared to overall benefit.
*
* If you want it to work correctly, you are free to make the specific changes
* and provide it to the community.
* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!
*
* This interface is used to allow the interchangeability of the move model for
* the peers.
*
* @author Julius Rueckert <peerfact@kom.tu-darmstadt.de>
* @version 01/06/2011
*
*/
public interface IMoveModel {
public Point getNextPosition(IDOApplication app);
}
| flyroom/PeerfactSimKOM_Clone | src/org/peerfact/impl/application/infodissemination/moveModels/IMoveModel.java | Java | gpl-2.0 | 1,841 | [
30522,
1013,
1008,
1008,
9385,
1006,
1039,
1007,
2262,
1011,
2286,
2330,
3120,
2451,
1011,
1026,
8299,
1024,
1013,
1013,
7479,
1012,
8152,
7011,
6593,
1012,
8917,
1028,
1008,
9385,
1006,
1039,
1007,
2249,
1011,
2262,
2118,
1997,
11687,
21... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
<?php
return array (
'id' => 'nokia_c7_00_ver1_subuaold_subu2k9',
'fallback' => 'nokia_c7_00_ver1_subuaold',
'capabilities' =>
array (
'mobile_browser' => 'UCWeb',
'mobile_browser_version' => '9',
),
);
| cuckata23/wurfl-data | data/nokia_c7_00_ver1_subuaold_subu2k9.php | PHP | mit | 222 | [
30522,
1026,
1029,
25718,
2709,
9140,
1006,
1005,
8909,
1005,
1027,
1028,
1005,
22098,
1035,
1039,
2581,
1035,
4002,
1035,
2310,
2099,
2487,
1035,
4942,
6692,
11614,
1035,
4942,
2226,
2475,
2243,
2683,
1005,
1010,
1005,
2991,
5963,
1005,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
// Copyright 2022 Google LLC
//
// 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
//
// https://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.
// Generated by the Codegen C++ plugin.
// If you make any local changes, they will be lost.
// source: google/cloud/pubsublite/v1/topic_stats.proto
#include "google/cloud/pubsublite/internal/topic_stats_auth_decorator.h"
#include <google/cloud/pubsublite/v1/topic_stats.grpc.pb.h>
#include <memory>
namespace google {
namespace cloud {
namespace pubsublite_internal {
GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_BEGIN
TopicStatsServiceAuth::TopicStatsServiceAuth(
std::shared_ptr<google::cloud::internal::GrpcAuthenticationStrategy> auth,
std::shared_ptr<TopicStatsServiceStub> child)
: auth_(std::move(auth)), child_(std::move(child)) {}
StatusOr<google::cloud::pubsublite::v1::ComputeMessageStatsResponse>
TopicStatsServiceAuth::ComputeMessageStats(
grpc::ClientContext& context,
google::cloud::pubsublite::v1::ComputeMessageStatsRequest const& request) {
auto status = auth_->ConfigureContext(context);
if (!status.ok()) return status;
return child_->ComputeMessageStats(context, request);
}
StatusOr<google::cloud::pubsublite::v1::ComputeHeadCursorResponse>
TopicStatsServiceAuth::ComputeHeadCursor(
grpc::ClientContext& context,
google::cloud::pubsublite::v1::ComputeHeadCursorRequest const& request) {
auto status = auth_->ConfigureContext(context);
if (!status.ok()) return status;
return child_->ComputeHeadCursor(context, request);
}
StatusOr<google::cloud::pubsublite::v1::ComputeTimeCursorResponse>
TopicStatsServiceAuth::ComputeTimeCursor(
grpc::ClientContext& context,
google::cloud::pubsublite::v1::ComputeTimeCursorRequest const& request) {
auto status = auth_->ConfigureContext(context);
if (!status.ok()) return status;
return child_->ComputeTimeCursor(context, request);
}
GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_END
} // namespace pubsublite_internal
} // namespace cloud
} // namespace google
| googleapis/google-cloud-cpp | google/cloud/pubsublite/internal/topic_stats_auth_decorator.cc | C++ | apache-2.0 | 2,452 | [
30522,
1013,
1013,
9385,
16798,
2475,
8224,
11775,
1013,
1013,
1013,
1013,
7000,
2104,
1996,
15895,
6105,
1010,
2544,
1016,
1012,
1014,
1006,
1996,
1000,
6105,
1000,
1007,
1025,
1013,
1013,
2017,
2089,
2025,
2224,
2023,
5371,
3272,
1999,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
module.exports = function (config) {
'use strict';
config.set({
basePath: '../',
files: [
// Angular libraries.
'app/assets/lib/angular/angular.js',
'app/assets/lib/angular-ui-router/release/angular-ui-router.js',
'app/assets/lib/angular-bootstrap/ui-bootstrap.min.js',
'app/assets/lib/angular-mocks/angular-mocks.js',
'app/assets/lib/angular-bootstrap/ui-bootstrap-tpls.min.js',
'app/assets/lib/angular-busy/dist/angular-busy.min.js',
'app/assets/lib/angular-resource/angular-resource.min.js',
'app/assets/lib/angular-confirm-modal/angular-confirm.js',
// JS files.
'app/app.js',
'app/components/**/*.js',
'app/shared/*.js',
'app/shared/**/*.js',
'app/assets/js/*.js',
// Test Specs.
'tests/unit/*.js'
],
autoWatch: true,
frameworks: ['jasmine'],
browsers: ['Firefox', 'PhantomJS', 'Chrome'],
plugins: [
'karma-chrome-launcher',
'karma-firefox-launcher',
'karma-phantomjs-launcher',
'karma-jasmine'
],
junitReporter: {
outputFile: 'test_out/unit.xml',
suite: 'unit'
}
});
};
| markvoelker/refstack | refstack-ui/tests/karma.conf.js | JavaScript | apache-2.0 | 1,354 | [
30522,
11336,
1012,
14338,
1027,
3853,
1006,
9530,
8873,
2290,
1007,
1063,
1005,
2224,
30524,
1063,
2918,
15069,
1024,
1005,
1012,
1012,
1013,
1005,
1010,
6764,
1024,
1031,
1013,
1013,
16108,
8860,
1012,
1005,
10439,
1013,
7045,
1013,
5622,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
using System.Web.UI;
namespace TestWebFormsApp.Account
{
public partial class ResetPasswordConfirmation : Page
{
}
} | idoychinov/Telerik_Academy_Homework | ASP.NETWeb Forms/1.IntroductionToAspNet/WebApps/TestWebFormsApp/Account/ResetPasswordConfirmation.aspx.cs | C# | mit | 132 | [
30522,
2478,
2291,
1012,
4773,
1012,
21318,
1025,
3415,
15327,
3231,
8545,
29292,
2953,
5244,
29098,
1012,
4070,
1063,
2270,
7704,
2465,
25141,
15194,
18351,
8663,
27972,
3370,
1024,
3931,
1063,
1065,
1065,
102,
0,
0,
0,
0,
0,
0,
0,
0... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
rr-boilerplate
==============
Ruby and React boilerplate
| mfolkeseth/rr-boilerplate | README.md | Markdown | mit | 58 | [
30522,
25269,
1011,
15635,
15725,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
10090,
1998,
10509,
15635,
15725,
102,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
/*
* linux/kernel/timer.c
*
* Kernel internal timers, basic process system calls
*
* Copyright (C) 1991, 1992 Linus Torvalds
*
* 1997-01-28 Modified by Finn Arne Gangstad to make timers scale better.
*
* 1997-09-10 Updated NTP code according to technical memorandum Jan '96
* "A Kernel Model for Precision Timekeeping" by Dave Mills
* 1998-12-24 Fixed a xtime SMP race (we need the xtime_lock rw spinlock to
* serialize accesses to xtime/lost_ticks).
* Copyright (C) 1998 Andrea Arcangeli
* 1999-03-10 Improved NTP compatibility by Ulrich Windl
* 2002-05-31 Move sys_sysinfo here and make its locking sane, Robert Love
* 2000-10-05 Implemented scalable SMP per-CPU timer handling.
* Copyright (C) 2000, 2001, 2002 Ingo Molnar
* Designed by David S. Miller, Alexey Kuznetsov and Ingo Molnar
*/
#include <linux/kernel_stat.h>
#include <linux/export.h>
#include <linux/interrupt.h>
#include <linux/percpu.h>
#include <linux/init.h>
#include <linux/mm.h>
#include <linux/swap.h>
#include <linux/pid_namespace.h>
#include <linux/notifier.h>
#include <linux/thread_info.h>
#include <linux/time.h>
#include <linux/jiffies.h>
#include <linux/posix-timers.h>
#include <linux/cpu.h>
#include <linux/syscalls.h>
#include <linux/delay.h>
#include <linux/tick.h>
#include <linux/kallsyms.h>
#include <linux/irq_work.h>
#include <linux/sched.h>
#include <linux/slab.h>
#include <asm/uaccess.h>
#include <asm/unistd.h>
#include <asm/div64.h>
#include <asm/timex.h>
#include <asm/io.h>
#define CREATE_TRACE_POINTS
#include <trace/events/timer.h>
u64 jiffies_64 __cacheline_aligned_in_smp = INITIAL_JIFFIES;
EXPORT_SYMBOL(jiffies_64);
/*
* per-CPU timer vector definitions:
*/
#define TVN_BITS (CONFIG_BASE_SMALL ? 4 : 6)
#define TVR_BITS (CONFIG_BASE_SMALL ? 6 : 8)
#define TVN_SIZE (1 << TVN_BITS)
#define TVR_SIZE (1 << TVR_BITS)
#define TVN_MASK (TVN_SIZE - 1)
#define TVR_MASK (TVR_SIZE - 1)
#define MAX_TVAL ((unsigned long)((1ULL << (TVR_BITS + 4*TVN_BITS)) - 1))
struct tvec {
struct list_head vec[TVN_SIZE];
};
struct tvec_root {
struct list_head vec[TVR_SIZE];
};
struct tvec_base {
spinlock_t lock;
struct timer_list *running_timer;
unsigned long timer_jiffies;
unsigned long next_timer;
struct tvec_root tv1;
struct tvec tv2;
struct tvec tv3;
struct tvec tv4;
struct tvec tv5;
} ____cacheline_aligned;
struct tvec_base boot_tvec_bases;
EXPORT_SYMBOL(boot_tvec_bases);
static DEFINE_PER_CPU(struct tvec_base *, tvec_bases) = &boot_tvec_bases;
/* Functions below help us manage 'deferrable' flag */
static inline unsigned int tbase_get_deferrable(struct tvec_base *base)
{
return ((unsigned int)(unsigned long)base & TBASE_DEFERRABLE_FLAG);
}
static inline struct tvec_base *tbase_get_base(struct tvec_base *base)
{
return ((struct tvec_base *)((unsigned long)base & ~TBASE_DEFERRABLE_FLAG));
}
static inline void timer_set_deferrable(struct timer_list *timer)
{
timer->base = TBASE_MAKE_DEFERRED(timer->base);
}
static inline void
timer_set_base(struct timer_list *timer, struct tvec_base *new_base)
{
timer->base = (struct tvec_base *)((unsigned long)(new_base) |
tbase_get_deferrable(timer->base));
}
static unsigned long round_jiffies_common(unsigned long j, int cpu,
bool force_up)
{
int rem;
unsigned long original = j;
/*
* We don't want all cpus firing their timers at once hitting the
* same lock or cachelines, so we skew each extra cpu with an extra
* 3 jiffies. This 3 jiffies came originally from the mm/ code which
* already did this.
* The skew is done by adding 3*cpunr, then round, then subtract this
* extra offset again.
*/
j += cpu * 3;
rem = j % HZ;
/*
* If the target jiffie is just after a whole second (which can happen
* due to delays of the timer irq, long irq off times etc etc) then
* we should round down to the whole second, not up. Use 1/4th second
* as cutoff for this rounding as an extreme upper bound for this.
* But never round down if @force_up is set.
*/
if (rem < HZ/4 && !force_up) /* round down */
j = j - rem;
else /* round up */
j = j - rem + HZ;
/* now that we have rounded, subtract the extra skew again */
j -= cpu * 3;
/*
* Make sure j is still in the future. Otherwise return the
* unmodified value.
*/
return time_is_after_jiffies(j) ? j : original;
}
/**
* __round_jiffies - function to round jiffies to a full second
* @j: the time in (absolute) jiffies that should be rounded
* @cpu: the processor number on which the timeout will happen
*
* __round_jiffies() rounds an absolute time in the future (in jiffies)
* up or down to (approximately) full seconds. This is useful for timers
* for which the exact time they fire does not matter too much, as long as
* they fire approximately every X seconds.
*
* By rounding these timers to whole seconds, all such timers will fire
* at the same time, rather than at various times spread out. The goal
* of this is to have the CPU wake up less, which saves power.
*
* The exact rounding is skewed for each processor to avoid all
* processors firing at the exact same time, which could lead
* to lock contention or spurious cache line bouncing.
*
* The return value is the rounded version of the @j parameter.
*/
unsigned long __round_jiffies(unsigned long j, int cpu)
{
return round_jiffies_common(j, cpu, false);
}
EXPORT_SYMBOL_GPL(__round_jiffies);
/**
* __round_jiffies_relative - function to round jiffies to a full second
* @j: the time in (relative) jiffies that should be rounded
* @cpu: the processor number on which the timeout will happen
*
* __round_jiffies_relative() rounds a time delta in the future (in jiffies)
* up or down to (approximately) full seconds. This is useful for timers
* for which the exact time they fire does not matter too much, as long as
* they fire approximately every X seconds.
*
* By rounding these timers to whole seconds, all such timers will fire
* at the same time, rather than at various times spread out. The goal
* of this is to have the CPU wake up less, which saves power.
*
* The exact rounding is skewed for each processor to avoid all
* processors firing at the exact same time, which could lead
* to lock contention or spurious cache line bouncing.
*
* The return value is the rounded version of the @j parameter.
*/
unsigned long __round_jiffies_relative(unsigned long j, int cpu)
{
unsigned long j0 = jiffies;
/* Use j0 because jiffies might change while we run */
return round_jiffies_common(j + j0, cpu, false) - j0;
}
EXPORT_SYMBOL_GPL(__round_jiffies_relative);
/**
* round_jiffies - function to round jiffies to a full second
* @j: the time in (absolute) jiffies that should be rounded
*
* round_jiffies() rounds an absolute time in the future (in jiffies)
* up or down to (approximately) full seconds. This is useful for timers
* for which the exact time they fire does not matter too much, as long as
* they fire approximately every X seconds.
*
* By rounding these timers to whole seconds, all such timers will fire
* at the same time, rather than at various times spread out. The goal
* of this is to have the CPU wake up less, which saves power.
*
* The return value is the rounded version of the @j parameter.
*/
unsigned long round_jiffies(unsigned long j)
{
return round_jiffies_common(j, raw_smp_processor_id(), false);
}
EXPORT_SYMBOL_GPL(round_jiffies);
/**
* round_jiffies_relative - function to round jiffies to a full second
* @j: the time in (relative) jiffies that should be rounded
*
* round_jiffies_relative() rounds a time delta in the future (in jiffies)
* up or down to (approximately) full seconds. This is useful for timers
* for which the exact time they fire does not matter too much, as long as
* they fire approximately every X seconds.
*
* By rounding these timers to whole seconds, all such timers will fire
* at the same time, rather than at various times spread out. The goal
* of this is to have the CPU wake up less, which saves power.
*
* The return value is the rounded version of the @j parameter.
*/
unsigned long round_jiffies_relative(unsigned long j)
{
return __round_jiffies_relative(j, raw_smp_processor_id());
}
EXPORT_SYMBOL_GPL(round_jiffies_relative);
/**
* __round_jiffies_up - function to round jiffies up to a full second
* @j: the time in (absolute) jiffies that should be rounded
* @cpu: the processor number on which the timeout will happen
*
* This is the same as __round_jiffies() except that it will never
* round down. This is useful for timeouts for which the exact time
* of firing does not matter too much, as long as they don't fire too
* early.
*/
unsigned long __round_jiffies_up(unsigned long j, int cpu)
{
return round_jiffies_common(j, cpu, true);
}
EXPORT_SYMBOL_GPL(__round_jiffies_up);
/**
* __round_jiffies_up_relative - function to round jiffies up to a full second
* @j: the time in (relative) jiffies that should be rounded
* @cpu: the processor number on which the timeout will happen
*
* This is the same as __round_jiffies_relative() except that it will never
* round down. This is useful for timeouts for which the exact time
* of firing does not matter too much, as long as they don't fire too
* early.
*/
unsigned long __round_jiffies_up_relative(unsigned long j, int cpu)
{
unsigned long j0 = jiffies;
/* Use j0 because jiffies might change while we run */
return round_jiffies_common(j + j0, cpu, true) - j0;
}
EXPORT_SYMBOL_GPL(__round_jiffies_up_relative);
/**
* round_jiffies_up - function to round jiffies up to a full second
* @j: the time in (absolute) jiffies that should be rounded
*
* This is the same as round_jiffies() except that it will never
* round down. This is useful for timeouts for which the exact time
* of firing does not matter too much, as long as they don't fire too
* early.
*/
unsigned long round_jiffies_up(unsigned long j)
{
return round_jiffies_common(j, raw_smp_processor_id(), true);
}
EXPORT_SYMBOL_GPL(round_jiffies_up);
/**
* round_jiffies_up_relative - function to round jiffies up to a full second
* @j: the time in (relative) jiffies that should be rounded
*
* This is the same as round_jiffies_relative() except that it will never
* round down. This is useful for timeouts for which the exact time
* of firing does not matter too much, as long as they don't fire too
* early.
*/
unsigned long round_jiffies_up_relative(unsigned long j)
{
return __round_jiffies_up_relative(j, raw_smp_processor_id());
}
EXPORT_SYMBOL_GPL(round_jiffies_up_relative);
/**
* set_timer_slack - set the allowed slack for a timer
* @timer: the timer to be modified
* @slack_hz: the amount of time (in jiffies) allowed for rounding
*
* Set the amount of time, in jiffies, that a certain timer has
* in terms of slack. By setting this value, the timer subsystem
* will schedule the actual timer somewhere between
* the time mod_timer() asks for, and that time plus the slack.
*
* By setting the slack to -1, a percentage of the delay is used
* instead.
*/
void set_timer_slack(struct timer_list *timer, int slack_hz)
{
timer->slack = slack_hz;
}
EXPORT_SYMBOL_GPL(set_timer_slack);
static void internal_add_timer(struct tvec_base *base, struct timer_list *timer)
{
unsigned long expires = timer->expires;
unsigned long idx = expires - base->timer_jiffies;
struct list_head *vec;
if (idx < TVR_SIZE) {
int i = expires & TVR_MASK;
vec = base->tv1.vec + i;
} else if (idx < 1 << (TVR_BITS + TVN_BITS)) {
int i = (expires >> TVR_BITS) & TVN_MASK;
vec = base->tv2.vec + i;
} else if (idx < 1 << (TVR_BITS + 2 * TVN_BITS)) {
int i = (expires >> (TVR_BITS + TVN_BITS)) & TVN_MASK;
vec = base->tv3.vec + i;
} else if (idx < 1 << (TVR_BITS + 3 * TVN_BITS)) {
int i = (expires >> (TVR_BITS + 2 * TVN_BITS)) & TVN_MASK;
vec = base->tv4.vec + i;
} else if ((signed long) idx < 0) {
/*
* Can happen if you add a timer with expires == jiffies,
* or you set a timer to go off in the past
*/
vec = base->tv1.vec + (base->timer_jiffies & TVR_MASK);
} else {
int i;
/* If the timeout is larger than MAX_TVAL (on 64-bit
* architectures or with CONFIG_BASE_SMALL=1) then we
* use the maximum timeout.
*/
if (idx > MAX_TVAL) {
idx = MAX_TVAL;
expires = idx + base->timer_jiffies;
}
i = (expires >> (TVR_BITS + 3 * TVN_BITS)) & TVN_MASK;
vec = base->tv5.vec + i;
}
/*
* Timers are FIFO:
*/
list_add_tail(&timer->entry, vec);
}
#ifdef CONFIG_TIMER_STATS
void __timer_stats_timer_set_start_info(struct timer_list *timer, void *addr)
{
if (timer->start_site)
return;
timer->start_site = addr;
memcpy(timer->start_comm, current->comm, TASK_COMM_LEN);
timer->start_pid = current->pid;
}
static void timer_stats_account_timer(struct timer_list *timer)
{
unsigned int flag = 0;
if (likely(!timer->start_site))
return;
if (unlikely(tbase_get_deferrable(timer->base)))
flag |= TIMER_STATS_FLAG_DEFERRABLE;
timer_stats_update_stats(timer, timer->start_pid, timer->start_site,
timer->function, timer->start_comm, flag);
}
#else
static void timer_stats_account_timer(struct timer_list *timer) {}
#endif
#ifdef CONFIG_DEBUG_OBJECTS_TIMERS
static struct debug_obj_descr timer_debug_descr;
static void *timer_debug_hint(void *addr)
{
return ((struct timer_list *) addr)->function;
}
/*
* fixup_init is called when:
* - an active object is initialized
*/
static int timer_fixup_init(void *addr, enum debug_obj_state state)
{
struct timer_list *timer = addr;
switch (state) {
case ODEBUG_STATE_ACTIVE:
del_timer_sync(timer);
debug_object_init(timer, &timer_debug_descr);
return 1;
default:
return 0;
}
}
/* Stub timer callback for improperly used timers. */
static void stub_timer(unsigned long data)
{
WARN_ON(1);
}
/*
* fixup_activate is called when:
* - an active object is activated
* - an unknown object is activated (might be a statically initialized object)
*/
static int timer_fixup_activate(void *addr, enum debug_obj_state state)
{
struct timer_list *timer = addr;
switch (state) {
case ODEBUG_STATE_NOTAVAILABLE:
/*
* This is not really a fixup. The timer was
* statically initialized. We just make sure that it
* is tracked in the object tracker.
*/
if (timer->entry.next == NULL &&
timer->entry.prev == TIMER_ENTRY_STATIC) {
debug_object_init(timer, &timer_debug_descr);
debug_object_activate(timer, &timer_debug_descr);
return 0;
} else {
setup_timer(timer, stub_timer, 0);
return 1;
}
return 0;
case ODEBUG_STATE_ACTIVE:
WARN_ON(1);
default:
return 0;
}
}
/*
* fixup_free is called when:
* - an active object is freed
*/
static int timer_fixup_free(void *addr, enum debug_obj_state state)
{
struct timer_list *timer = addr;
switch (state) {
case ODEBUG_STATE_ACTIVE:
del_timer_sync(timer);
debug_object_free(timer, &timer_debug_descr);
return 1;
default:
return 0;
}
}
/*
* fixup_assert_init is called when:
* - an untracked/uninit-ed object is found
*/
static int timer_fixup_assert_init(void *addr, enum debug_obj_state state)
{
struct timer_list *timer = addr;
switch (state) {
case ODEBUG_STATE_NOTAVAILABLE:
if (timer->entry.prev == TIMER_ENTRY_STATIC) {
/*
* This is not really a fixup. The timer was
* statically initialized. We just make sure that it
* is tracked in the object tracker.
*/
debug_object_init(timer, &timer_debug_descr);
return 0;
} else {
setup_timer(timer, stub_timer, 0);
return 1;
}
default:
return 0;
}
}
static struct debug_obj_descr timer_debug_descr = {
.name = "timer_list",
.debug_hint = timer_debug_hint,
.fixup_init = timer_fixup_init,
.fixup_activate = timer_fixup_activate,
.fixup_free = timer_fixup_free,
.fixup_assert_init = timer_fixup_assert_init,
};
static inline void debug_timer_init(struct timer_list *timer)
{
debug_object_init(timer, &timer_debug_descr);
}
static inline void debug_timer_activate(struct timer_list *timer)
{
debug_object_activate(timer, &timer_debug_descr);
}
static inline void debug_timer_deactivate(struct timer_list *timer)
{
debug_object_deactivate(timer, &timer_debug_descr);
}
static inline void debug_timer_free(struct timer_list *timer)
{
debug_object_free(timer, &timer_debug_descr);
}
static inline void debug_timer_assert_init(struct timer_list *timer)
{
debug_object_assert_init(timer, &timer_debug_descr);
}
static void __init_timer(struct timer_list *timer,
const char *name,
struct lock_class_key *key);
void init_timer_on_stack_key(struct timer_list *timer,
const char *name,
struct lock_class_key *key)
{
debug_object_init_on_stack(timer, &timer_debug_descr);
__init_timer(timer, name, key);
}
EXPORT_SYMBOL_GPL(init_timer_on_stack_key);
void destroy_timer_on_stack(struct timer_list *timer)
{
debug_object_free(timer, &timer_debug_descr);
}
EXPORT_SYMBOL_GPL(destroy_timer_on_stack);
#else
static inline void debug_timer_init(struct timer_list *timer) { }
static inline void debug_timer_activate(struct timer_list *timer) { }
static inline void debug_timer_deactivate(struct timer_list *timer) { }
static inline void debug_timer_assert_init(struct timer_list *timer) { }
#endif
static inline void debug_init(struct timer_list *timer)
{
debug_timer_init(timer);
trace_timer_init(timer);
}
static inline void
debug_activate(struct timer_list *timer, unsigned long expires)
{
debug_timer_activate(timer);
trace_timer_start(timer, expires,
tbase_get_deferrable(timer->base) > 0 ? 'y' : 'n');
}
static inline void debug_deactivate(struct timer_list *timer)
{
debug_timer_deactivate(timer);
trace_timer_cancel(timer);
}
static inline void debug_assert_init(struct timer_list *timer)
{
debug_timer_assert_init(timer);
}
static void __init_timer(struct timer_list *timer,
const char *name,
struct lock_class_key *key)
{
timer->entry.next = NULL;
timer->base = __raw_get_cpu_var(tvec_bases);
timer->slack = -1;
#ifdef CONFIG_TIMER_STATS
timer->start_site = NULL;
timer->start_pid = -1;
memset(timer->start_comm, 0, TASK_COMM_LEN);
#endif
lockdep_init_map(&timer->lockdep_map, name, key, 0);
}
void setup_deferrable_timer_on_stack_key(struct timer_list *timer,
const char *name,
struct lock_class_key *key,
void (*function)(unsigned long),
unsigned long data)
{
timer->function = function;
timer->data = data;
init_timer_on_stack_key(timer, name, key);
timer_set_deferrable(timer);
}
EXPORT_SYMBOL_GPL(setup_deferrable_timer_on_stack_key);
/**
* init_timer_key - initialize a timer
* @timer: the timer to be initialized
* @name: name of the timer
* @key: lockdep class key of the fake lock used for tracking timer
* sync lock dependencies
*
* init_timer_key() must be done to a timer prior calling *any* of the
* other timer functions.
*/
void init_timer_key(struct timer_list *timer,
const char *name,
struct lock_class_key *key)
{
debug_init(timer);
__init_timer(timer, name, key);
}
EXPORT_SYMBOL(init_timer_key);
void init_timer_deferrable_key(struct timer_list *timer,
const char *name,
struct lock_class_key *key)
{
init_timer_key(timer, name, key);
timer_set_deferrable(timer);
}
EXPORT_SYMBOL(init_timer_deferrable_key);
static inline void detach_timer(struct timer_list *timer,
int clear_pending)
{
struct list_head *entry = &timer->entry;
debug_deactivate(timer);
__list_del(entry->prev, entry->next);
if (clear_pending)
entry->next = NULL;
entry->prev = LIST_POISON2;
}
/*
* We are using hashed locking: holding per_cpu(tvec_bases).lock
* means that all timers which are tied to this base via timer->base are
* locked, and the base itself is locked too.
*
* So __run_timers/migrate_timers can safely modify all timers which could
* be found on ->tvX lists.
*
* When the timer's base is locked, and the timer removed from list, it is
* possible to set timer->base = NULL and drop the lock: the timer remains
* locked.
*/
static struct tvec_base *lock_timer_base(struct timer_list *timer,
unsigned long *flags)
__acquires(timer->base->lock)
{
struct tvec_base *base;
for (;;) {
struct tvec_base *prelock_base = timer->base;
base = tbase_get_base(prelock_base);
if (likely(base != NULL)) {
spin_lock_irqsave(&base->lock, *flags);
if (likely(prelock_base == timer->base))
return base;
/* The timer has migrated to another CPU */
spin_unlock_irqrestore(&base->lock, *flags);
}
cpu_relax();
}
}
static inline int
__mod_timer(struct timer_list *timer, unsigned long expires,
bool pending_only, int pinned)
{
struct tvec_base *base, *new_base;
unsigned long flags;
int ret = 0 , cpu;
timer_stats_timer_set_start_info(timer);
BUG_ON(!timer->function);
base = lock_timer_base(timer, &flags);
if (timer_pending(timer)) {
detach_timer(timer, 0);
if (timer->expires == base->next_timer &&
!tbase_get_deferrable(timer->base))
base->next_timer = base->timer_jiffies;
ret = 1;
} else {
if (pending_only)
goto out_unlock;
}
debug_activate(timer, expires);
cpu = smp_processor_id();
#if defined(CONFIG_NO_HZ) && defined(CONFIG_SMP)
if (!pinned && get_sysctl_timer_migration() && idle_cpu(cpu))
cpu = get_nohz_timer_target();
#endif
new_base = per_cpu(tvec_bases, cpu);
if (base != new_base) {
/*
* We are trying to schedule the timer on the local CPU.
* However we can't change timer's base while it is running,
* otherwise del_timer_sync() can't detect that the timer's
* handler yet has not finished. This also guarantees that
* the timer is serialized wrt itself.
*/
if (likely(base->running_timer != timer)) {
/* See the comment in lock_timer_base() */
timer_set_base(timer, NULL);
spin_unlock(&base->lock);
base = new_base;
spin_lock(&base->lock);
timer_set_base(timer, base);
}
}
timer->expires = expires;
if (time_before(timer->expires, base->next_timer) &&
!tbase_get_deferrable(timer->base))
base->next_timer = timer->expires;
internal_add_timer(base, timer);
out_unlock:
spin_unlock_irqrestore(&base->lock, flags);
return ret;
}
/**
* mod_timer_pending - modify a pending timer's timeout
* @timer: the pending timer to be modified
* @expires: new timeout in jiffies
*
* mod_timer_pending() is the same for pending timers as mod_timer(),
* but will not re-activate and modify already deleted timers.
*
* It is useful for unserialized use of timers.
*/
int mod_timer_pending(struct timer_list *timer, unsigned long expires)
{
return __mod_timer(timer, expires, true, TIMER_NOT_PINNED);
}
EXPORT_SYMBOL(mod_timer_pending);
/*
* Decide where to put the timer while taking the slack into account
*
* Algorithm:
* 1) calculate the maximum (absolute) time
* 2) calculate the highest bit where the expires and new max are different
* 3) use this bit to make a mask
* 4) use the bitmask to round down the maximum time, so that all last
* bits are zeros
*/
static inline
unsigned long apply_slack(struct timer_list *timer, unsigned long expires)
{
unsigned long expires_limit, mask;
int bit;
if (timer->slack >= 0) {
expires_limit = expires + timer->slack;
} else {
long delta = expires - jiffies;
if (delta < 256)
return expires;
expires_limit = expires + delta / 256;
}
mask = expires ^ expires_limit;
if (mask == 0)
return expires;
bit = find_last_bit(&mask, BITS_PER_LONG);
mask = (1UL << bit) - 1;
expires_limit = expires_limit & ~(mask);
return expires_limit;
}
/**
* mod_timer - modify a timer's timeout
* @timer: the timer to be modified
* @expires: new timeout in jiffies
*
* mod_timer() is a more efficient way to update the expire field of an
* active timer (if the timer is inactive it will be activated)
*
* mod_timer(timer, expires) is equivalent to:
*
* del_timer(timer); timer->expires = expires; add_timer(timer);
*
* Note that if there are multiple unserialized concurrent users of the
* same timer, then mod_timer() is the only safe way to modify the timeout,
* since add_timer() cannot modify an already running timer.
*
* The function returns whether it has modified a pending timer or not.
* (ie. mod_timer() of an inactive timer returns 0, mod_timer() of an
* active timer returns 1.)
*/
int mod_timer(struct timer_list *timer, unsigned long expires)
{
expires = apply_slack(timer, expires);
/*
* This is a common optimization triggered by the
* networking code - if the timer is re-modified
* to be the same thing then just return:
*/
if (timer_pending(timer) && timer->expires == expires)
return 1;
return __mod_timer(timer, expires, false, TIMER_NOT_PINNED);
}
EXPORT_SYMBOL(mod_timer);
/**
* mod_timer_pinned - modify a timer's timeout
* @timer: the timer to be modified
* @expires: new timeout in jiffies
*
* mod_timer_pinned() is a way to update the expire field of an
* active timer (if the timer is inactive it will be activated)
* and not allow the timer to be migrated to a different CPU.
*
* mod_timer_pinned(timer, expires) is equivalent to:
*
* del_timer(timer); timer->expires = expires; add_timer(timer);
*/
int mod_timer_pinned(struct timer_list *timer, unsigned long expires)
{
if (timer->expires == expires && timer_pending(timer))
return 1;
return __mod_timer(timer, expires, false, TIMER_PINNED);
}
EXPORT_SYMBOL(mod_timer_pinned);
/**
* add_timer - start a timer
* @timer: the timer to be added
*
* The kernel will do a ->function(->data) callback from the
* timer interrupt at the ->expires point in the future. The
* current time is 'jiffies'.
*
* The timer's ->expires, ->function (and if the handler uses it, ->data)
* fields must be set prior calling this function.
*
* Timers with an ->expires field in the past will be executed in the next
* timer tick.
*/
void add_timer(struct timer_list *timer)
{
BUG_ON(timer_pending(timer));
mod_timer(timer, timer->expires);
}
EXPORT_SYMBOL(add_timer);
/**
* add_timer_on - start a timer on a particular CPU
* @timer: the timer to be added
* @cpu: the CPU to start it on
*
* This is not very scalable on SMP. Double adds are not possible.
*/
void add_timer_on(struct timer_list *timer, int cpu)
{
struct tvec_base *base = per_cpu(tvec_bases, cpu);
unsigned long flags;
timer_stats_timer_set_start_info(timer);
BUG_ON(timer_pending(timer) || !timer->function);
spin_lock_irqsave(&base->lock, flags);
timer_set_base(timer, base);
debug_activate(timer, timer->expires);
if (time_before(timer->expires, base->next_timer) &&
!tbase_get_deferrable(timer->base))
base->next_timer = timer->expires;
internal_add_timer(base, timer);
/*
* Check whether the other CPU is idle and needs to be
* triggered to reevaluate the timer wheel when nohz is
* active. We are protected against the other CPU fiddling
* with the timer by holding the timer base lock. This also
* makes sure that a CPU on the way to idle can not evaluate
* the timer wheel.
*/
wake_up_idle_cpu(cpu);
spin_unlock_irqrestore(&base->lock, flags);
}
EXPORT_SYMBOL_GPL(add_timer_on);
/**
* del_timer - deactive a timer.
* @timer: the timer to be deactivated
*
* del_timer() deactivates a timer - this works on both active and inactive
* timers.
*
* The function returns whether it has deactivated a pending timer or not.
* (ie. del_timer() of an inactive timer returns 0, del_timer() of an
* active timer returns 1.)
*/
int del_timer(struct timer_list *timer)
{
struct tvec_base *base;
unsigned long flags;
int ret = 0;
debug_assert_init(timer);
timer_stats_timer_clear_start_info(timer);
if (timer_pending(timer)) {
base = lock_timer_base(timer, &flags);
if (timer_pending(timer)) {
detach_timer(timer, 1);
if (timer->expires == base->next_timer &&
!tbase_get_deferrable(timer->base))
base->next_timer = base->timer_jiffies;
ret = 1;
}
spin_unlock_irqrestore(&base->lock, flags);
}
return ret;
}
EXPORT_SYMBOL(del_timer);
/**
* try_to_del_timer_sync - Try to deactivate a timer
* @timer: timer do del
*
* This function tries to deactivate a timer. Upon successful (ret >= 0)
* exit the timer is not queued and the handler is not running on any CPU.
*/
int try_to_del_timer_sync(struct timer_list *timer)
{
struct tvec_base *base;
unsigned long flags;
int ret = -1;
debug_assert_init(timer);
base = lock_timer_base(timer, &flags);
if (base->running_timer == timer)
goto out;
timer_stats_timer_clear_start_info(timer);
ret = 0;
if (timer_pending(timer)) {
detach_timer(timer, 1);
if (timer->expires == base->next_timer &&
!tbase_get_deferrable(timer->base))
base->next_timer = base->timer_jiffies;
ret = 1;
}
out:
spin_unlock_irqrestore(&base->lock, flags);
return ret;
}
EXPORT_SYMBOL(try_to_del_timer_sync);
#ifdef CONFIG_SMP
/**
* del_timer_sync - deactivate a timer and wait for the handler to finish.
* @timer: the timer to be deactivated
*
* This function only differs from del_timer() on SMP: besides deactivating
* the timer it also makes sure the handler has finished executing on other
* CPUs.
*
* Synchronization rules: Callers must prevent restarting of the timer,
* otherwise this function is meaningless. It must not be called from
* interrupt contexts. The caller must not hold locks which would prevent
* completion of the timer's handler. The timer's handler must not call
* add_timer_on(). Upon exit the timer is not queued and the handler is
* not running on any CPU.
*
* Note: You must not hold locks that are held in interrupt context
* while calling this function. Even if the lock has nothing to do
* with the timer in question. Here's why:
*
* CPU0 CPU1
* ---- ----
* <SOFTIRQ>
* call_timer_fn();
* base->running_timer = mytimer;
* spin_lock_irq(somelock);
* <IRQ>
* spin_lock(somelock);
* del_timer_sync(mytimer);
* while (base->running_timer == mytimer);
*
* Now del_timer_sync() will never return and never release somelock.
* The interrupt on the other CPU is waiting to grab somelock but
* it has interrupted the softirq that CPU0 is waiting to finish.
*
* The function returns whether it has deactivated a pending timer or not.
*/
int del_timer_sync(struct timer_list *timer)
{
#ifdef CONFIG_LOCKDEP
unsigned long flags;
/*
* If lockdep gives a backtrace here, please reference
* the synchronization rules above.
*/
local_irq_save(flags);
lock_map_acquire(&timer->lockdep_map);
lock_map_release(&timer->lockdep_map);
local_irq_restore(flags);
#endif
/*
* don't use it in hardirq context, because it
* could lead to deadlock.
*/
WARN_ON(in_irq());
for (;;) {
int ret = try_to_del_timer_sync(timer);
if (ret >= 0)
return ret;
cpu_relax();
}
}
EXPORT_SYMBOL(del_timer_sync);
#endif
static int cascade(struct tvec_base *base, struct tvec *tv, int index)
{
/* cascade all the timers from tv up one level */
struct timer_list *timer, *tmp;
struct list_head tv_list;
list_replace_init(tv->vec + index, &tv_list);
/*
* We are removing _all_ timers from the list, so we
* don't have to detach them individually.
*/
list_for_each_entry_safe(timer, tmp, &tv_list, entry) {
BUG_ON(tbase_get_base(timer->base) != base);
internal_add_timer(base, timer);
}
return index;
}
static void call_timer_fn(struct timer_list *timer, void (*fn)(unsigned long),
unsigned long data)
{
int preempt_count = preempt_count();
#ifdef CONFIG_LOCKDEP
/*
* It is permissible to free the timer from inside the
* function that is called from it, this we need to take into
* account for lockdep too. To avoid bogus "held lock freed"
* warnings as well as problems when looking into
* timer->lockdep_map, make a copy and use that here.
*/
struct lockdep_map lockdep_map = timer->lockdep_map;
#endif
/*
* Couple the lock chain with the lock chain at
* del_timer_sync() by acquiring the lock_map around the fn()
* call here and in del_timer_sync().
*/
lock_map_acquire(&lockdep_map);
trace_timer_expire_entry(timer);
fn(data);
trace_timer_expire_exit(timer);
lock_map_release(&lockdep_map);
if (preempt_count != preempt_count()) {
WARN_ONCE(1, "timer: %pF preempt leak: %08x -> %08x\n",
fn, preempt_count, preempt_count());
/*
* Restore the preempt count. That gives us a decent
* chance to survive and extract information. If the
* callback kept a lock held, bad luck, but not worse
* than the BUG() we had.
*/
preempt_count() = preempt_count;
}
}
#define INDEX(N) ((base->timer_jiffies >> (TVR_BITS + (N) * TVN_BITS)) & TVN_MASK)
/**
* __run_timers - run all expired timers (if any) on this CPU.
* @base: the timer vector to be processed.
*
* This function cascades all vectors and executes all expired timer
* vectors.
*/
static inline void __run_timers(struct tvec_base *base)
{
struct timer_list *timer;
spin_lock_irq(&base->lock);
while (time_after_eq(jiffies, base->timer_jiffies)) {
struct list_head work_list;
struct list_head *head = &work_list;
int index = base->timer_jiffies & TVR_MASK;
/*
* Cascade timers:
*/
if (!index &&
(!cascade(base, &base->tv2, INDEX(0))) &&
(!cascade(base, &base->tv3, INDEX(1))) &&
!cascade(base, &base->tv4, INDEX(2)))
cascade(base, &base->tv5, INDEX(3));
++base->timer_jiffies;
list_replace_init(base->tv1.vec + index, &work_list);
while (!list_empty(head)) {
void (*fn)(unsigned long);
unsigned long data;
timer = list_first_entry(head, struct timer_list,entry);
fn = timer->function;
data = timer->data;
timer_stats_account_timer(timer);
base->running_timer = timer;
detach_timer(timer, 1);
spin_unlock_irq(&base->lock);
call_timer_fn(timer, fn, data);
spin_lock_irq(&base->lock);
}
}
base->running_timer = NULL;
spin_unlock_irq(&base->lock);
}
#ifdef CONFIG_NO_HZ
/*
* Find out when the next timer event is due to happen. This
* is used on S/390 to stop all activity when a CPU is idle.
* This function needs to be called with interrupts disabled.
*/
static unsigned long __next_timer_interrupt(struct tvec_base *base)
{
unsigned long timer_jiffies = base->timer_jiffies;
unsigned long expires = timer_jiffies + NEXT_TIMER_MAX_DELTA;
int index, slot, array, found = 0;
struct timer_list *nte;
struct tvec *varray[4];
/* Look for timer events in tv1. */
index = slot = timer_jiffies & TVR_MASK;
do {
list_for_each_entry(nte, base->tv1.vec + slot, entry) {
if (tbase_get_deferrable(nte->base))
continue;
found = 1;
expires = nte->expires;
/* Look at the cascade bucket(s)? */
if (!index || slot < index)
goto cascade;
return expires;
}
slot = (slot + 1) & TVR_MASK;
} while (slot != index);
cascade:
/* Calculate the next cascade event */
if (index)
timer_jiffies += TVR_SIZE - index;
timer_jiffies >>= TVR_BITS;
/* Check tv2-tv5. */
varray[0] = &base->tv2;
varray[1] = &base->tv3;
varray[2] = &base->tv4;
varray[3] = &base->tv5;
for (array = 0; array < 4; array++) {
struct tvec *varp = varray[array];
index = slot = timer_jiffies & TVN_MASK;
do {
list_for_each_entry(nte, varp->vec + slot, entry) {
if (tbase_get_deferrable(nte->base))
continue;
found = 1;
if (time_before(nte->expires, expires))
expires = nte->expires;
}
/*
* Do we still search for the first timer or are
* we looking up the cascade buckets ?
*/
if (found) {
/* Look at the cascade bucket(s)? */
if (!index || slot < index)
break;
return expires;
}
slot = (slot + 1) & TVN_MASK;
} while (slot != index);
if (index)
timer_jiffies += TVN_SIZE - index;
timer_jiffies >>= TVN_BITS;
}
return expires;
}
/*
* Check, if the next hrtimer event is before the next timer wheel
* event:
*/
static unsigned long cmp_next_hrtimer_event(unsigned long now,
unsigned long expires)
{
ktime_t hr_delta = hrtimer_get_next_event();
struct timespec tsdelta;
unsigned long delta;
if (hr_delta.tv64 == KTIME_MAX)
return expires;
/*
* Expired timer available, let it expire in the next tick
*/
if (hr_delta.tv64 <= 0)
return now + 1;
tsdelta = ktime_to_timespec(hr_delta);
delta = timespec_to_jiffies(&tsdelta);
/*
* Limit the delta to the max value, which is checked in
* tick_nohz_stop_sched_tick():
*/
if (delta > NEXT_TIMER_MAX_DELTA)
delta = NEXT_TIMER_MAX_DELTA;
/*
* Take rounding errors in to account and make sure, that it
* expires in the next tick. Otherwise we go into an endless
* ping pong due to tick_nohz_stop_sched_tick() retriggering
* the timer softirq
*/
if (delta < 1)
delta = 1;
now += delta;
if (time_before(now, expires))
return now;
return expires;
}
/**
* get_next_timer_interrupt - return the jiffy of the next pending timer
* @now: current time (in jiffies)
*/
unsigned long get_next_timer_interrupt(unsigned long now)
{
struct tvec_base *base = __this_cpu_read(tvec_bases);
unsigned long expires;
/*
* Pretend that there is no timer pending if the cpu is offline.
* Possible pending timers will be migrated later to an active cpu.
*/
if (cpu_is_offline(smp_processor_id()))
return now + NEXT_TIMER_MAX_DELTA;
spin_lock(&base->lock);
if (time_before_eq(base->next_timer, base->timer_jiffies))
base->next_timer = __next_timer_interrupt(base);
expires = base->next_timer;
spin_unlock(&base->lock);
if (time_before_eq(expires, now))
return now;
return cmp_next_hrtimer_event(now, expires);
}
#endif
/*
* Called from the timer interrupt handler to charge one tick to the current
* process. user_tick is 1 if the tick is user time, 0 for system.
*/
void update_process_times(int user_tick)
{
struct task_struct *p = current;
int cpu = smp_processor_id();
/* Note: this timer irq context must be accounted for as well. */
account_process_tick(p, user_tick);
run_local_timers();
rcu_check_callbacks(cpu, user_tick);
printk_tick();
#ifdef CONFIG_IRQ_WORK
if (in_irq())
irq_work_run();
#endif
scheduler_tick();
run_posix_cpu_timers(p);
}
/*
* This function runs timers and the timer-tq in bottom half context.
*/
static void run_timer_softirq(struct softirq_action *h)
{
struct tvec_base *base = __this_cpu_read(tvec_bases);
hrtimer_run_pending();
if (time_after_eq(jiffies, base->timer_jiffies))
__run_timers(base);
}
/*
* Called by the local, per-CPU timer interrupt on SMP.
*/
void run_local_timers(void)
{
hrtimer_run_queues();
raise_softirq(TIMER_SOFTIRQ);
}
#ifdef __ARCH_WANT_SYS_ALARM
/*
* For backwards compatibility? This can be done in libc so Alpha
* and all newer ports shouldn't need it.
*/
SYSCALL_DEFINE1(alarm, unsigned int, seconds)
{
return alarm_setitimer(seconds);
}
#endif
#ifndef __alpha__
/*
* The Alpha uses getxpid, getxuid, and getxgid instead. Maybe this
* should be moved into arch/i386 instead?
*/
/**
* sys_getpid - return the thread group id of the current process
*
* Note, despite the name, this returns the tgid not the pid. The tgid and
* the pid are identical unless CLONE_THREAD was specified on clone() in
* which case the tgid is the same in all threads of the same group.
*
* This is SMP safe as current->tgid does not change.
*/
SYSCALL_DEFINE0(getpid)
{
return task_tgid_vnr(current);
}
/*
* Accessing ->real_parent is not SMP-safe, it could
* change from under us. However, we can use a stale
* value of ->real_parent under rcu_read_lock(), see
* release_task()->call_rcu(delayed_put_task_struct).
*/
SYSCALL_DEFINE0(getppid)
{
int pid;
rcu_read_lock();
pid = task_tgid_vnr(rcu_dereference(current->real_parent));
rcu_read_unlock();
return pid;
}
SYSCALL_DEFINE0(getuid)
{
/* Only we change this so SMP safe */
return current_uid();
}
SYSCALL_DEFINE0(geteuid)
{
/* Only we change this so SMP safe */
return current_euid();
}
SYSCALL_DEFINE0(getgid)
{
/* Only we change this so SMP safe */
return current_gid();
}
SYSCALL_DEFINE0(getegid)
{
/* Only we change this so SMP safe */
return current_egid();
}
#endif
static void process_timeout(unsigned long __data)
{
wake_up_process((struct task_struct *)__data);
}
/**
* schedule_timeout - sleep until timeout
* @timeout: timeout value in jiffies
*
* Make the current task sleep until @timeout jiffies have
* elapsed. The routine will return immediately unless
* the current task state has been set (see set_current_state()).
*
* You can set the task state as follows -
*
* %TASK_UNINTERRUPTIBLE - at least @timeout jiffies are guaranteed to
* pass before the routine returns. The routine will return 0
*
* %TASK_INTERRUPTIBLE - the routine may return early if a signal is
* delivered to the current task. In this case the remaining time
* in jiffies will be returned, or 0 if the timer expired in time
*
* The current task state is guaranteed to be TASK_RUNNING when this
* routine returns.
*
* Specifying a @timeout value of %MAX_SCHEDULE_TIMEOUT will schedule
* the CPU away without a bound on the timeout. In this case the return
* value will be %MAX_SCHEDULE_TIMEOUT.
*
* In all cases the return value is guaranteed to be non-negative.
*/
signed long __sched schedule_timeout(signed long timeout)
{
struct timer_list timer;
unsigned long expire;
switch (timeout)
{
case MAX_SCHEDULE_TIMEOUT:
/*
* These two special cases are useful to be comfortable
* in the caller. Nothing more. We could take
* MAX_SCHEDULE_TIMEOUT from one of the negative value
* but I' d like to return a valid offset (>=0) to allow
* the caller to do everything it want with the retval.
*/
schedule();
goto out;
default:
/*
* Another bit of PARANOID. Note that the retval will be
* 0 since no piece of kernel is supposed to do a check
* for a negative retval of schedule_timeout() (since it
* should never happens anyway). You just have the printk()
* that will tell you if something is gone wrong and where.
*/
if (timeout < 0) {
printk(KERN_ERR "schedule_timeout: wrong timeout "
"value %lx\n", timeout);
dump_stack();
current->state = TASK_RUNNING;
goto out;
}
}
expire = timeout + jiffies;
setup_timer_on_stack(&timer, process_timeout, (unsigned long)current);
__mod_timer(&timer, expire, false, TIMER_NOT_PINNED);
schedule();
del_singleshot_timer_sync(&timer);
/* Remove the timer from the object tracker */
destroy_timer_on_stack(&timer);
timeout = expire - jiffies;
out:
return timeout < 0 ? 0 : timeout;
}
EXPORT_SYMBOL(schedule_timeout);
/*
* We can use __set_current_state() here because schedule_timeout() calls
* schedule() unconditionally.
*/
signed long __sched schedule_timeout_interruptible(signed long timeout)
{
__set_current_state(TASK_INTERRUPTIBLE);
return schedule_timeout(timeout);
}
EXPORT_SYMBOL(schedule_timeout_interruptible);
signed long __sched schedule_timeout_killable(signed long timeout)
{
__set_current_state(TASK_KILLABLE);
return schedule_timeout(timeout);
}
EXPORT_SYMBOL(schedule_timeout_killable);
signed long __sched schedule_timeout_uninterruptible(signed long timeout)
{
__set_current_state(TASK_UNINTERRUPTIBLE);
return schedule_timeout(timeout);
}
EXPORT_SYMBOL(schedule_timeout_uninterruptible);
/* Thread ID - the internal kernel "pid" */
SYSCALL_DEFINE0(gettid)
{
return task_pid_vnr(current);
}
/**
* do_sysinfo - fill in sysinfo struct
* @info: pointer to buffer to fill
*/
int do_sysinfo(struct sysinfo *info)
{
unsigned long mem_total, sav_total;
unsigned int mem_unit, bitcount;
struct timespec tp;
memset(info, 0, sizeof(struct sysinfo));
ktime_get_ts(&tp);
monotonic_to_bootbased(&tp);
info->uptime = tp.tv_sec + (tp.tv_nsec ? 1 : 0);
get_avenrun(info->loads, 0, SI_LOAD_SHIFT - FSHIFT);
info->procs = nr_threads;
si_meminfo(info);
si_swapinfo(info);
/*
* If the sum of all the available memory (i.e. ram + swap)
* is less than can be stored in a 32 bit unsigned long then
* we can be binary compatible with 2.2.x kernels. If not,
* well, in that case 2.2.x was broken anyways...
*
* -Erik Andersen <andersee@debian.org>
*/
mem_total = info->totalram + info->totalswap;
if (mem_total < info->totalram || mem_total < info->totalswap)
goto out;
bitcount = 0;
mem_unit = info->mem_unit;
while (mem_unit > 1) {
bitcount++;
mem_unit >>= 1;
sav_total = mem_total;
mem_total <<= 1;
if (mem_total < sav_total)
goto out;
}
/*
* If mem_total did not overflow, multiply all memory values by
* info->mem_unit and set it to 1. This leaves things compatible
* with 2.2.x, and also retains compatibility with earlier 2.4.x
* kernels...
*/
info->mem_unit = 1;
info->totalram <<= bitcount;
info->freeram <<= bitcount;
info->sharedram <<= bitcount;
info->bufferram <<= bitcount;
info->totalswap <<= bitcount;
info->freeswap <<= bitcount;
info->totalhigh <<= bitcount;
info->freehigh <<= bitcount;
out:
return 0;
}
SYSCALL_DEFINE1(sysinfo, struct sysinfo __user *, info)
{
struct sysinfo val;
do_sysinfo(&val);
if (copy_to_user(info, &val, sizeof(struct sysinfo)))
return -EFAULT;
return 0;
}
static int __cpuinit init_timers_cpu(int cpu)
{
int j;
struct tvec_base *base;
static char __cpuinitdata tvec_base_done[NR_CPUS];
if (!tvec_base_done[cpu]) {
static char boot_done;
if (boot_done) {
/*
* The APs use this path later in boot
*/
base = kmalloc_node(sizeof(*base),
GFP_KERNEL | __GFP_ZERO,
cpu_to_node(cpu));
if (!base)
return -ENOMEM;
/* Make sure that tvec_base is 2 byte aligned */
if (tbase_get_deferrable(base)) {
WARN_ON(1);
kfree(base);
return -ENOMEM;
}
per_cpu(tvec_bases, cpu) = base;
} else {
/*
* This is for the boot CPU - we use compile-time
* static initialisation because per-cpu memory isn't
* ready yet and because the memory allocators are not
* initialised either.
*/
boot_done = 1;
base = &boot_tvec_bases;
}
tvec_base_done[cpu] = 1;
} else {
base = per_cpu(tvec_bases, cpu);
}
spin_lock_init(&base->lock);
for (j = 0; j < TVN_SIZE; j++) {
INIT_LIST_HEAD(base->tv5.vec + j);
INIT_LIST_HEAD(base->tv4.vec + j);
INIT_LIST_HEAD(base->tv3.vec + j);
INIT_LIST_HEAD(base->tv2.vec + j);
}
for (j = 0; j < TVR_SIZE; j++)
INIT_LIST_HEAD(base->tv1.vec + j);
base->timer_jiffies = jiffies;
base->next_timer = base->timer_jiffies;
return 0;
}
#ifdef CONFIG_HOTPLUG_CPU
static void migrate_timer_list(struct tvec_base *new_base, struct list_head *head)
{
struct timer_list *timer;
while (!list_empty(head)) {
timer = list_first_entry(head, struct timer_list, entry);
detach_timer(timer, 0);
timer_set_base(timer, new_base);
if (time_before(timer->expires, new_base->next_timer) &&
!tbase_get_deferrable(timer->base))
new_base->next_timer = timer->expires;
internal_add_timer(new_base, timer);
}
}
static void __cpuinit migrate_timers(int cpu)
{
struct tvec_base *old_base;
struct tvec_base *new_base;
int i;
BUG_ON(cpu_online(cpu));
old_base = per_cpu(tvec_bases, cpu);
new_base = get_cpu_var(tvec_bases);
/*
* The caller is globally serialized and nobody else
* takes two locks at once, deadlock is not possible.
*/
spin_lock_irq(&new_base->lock);
spin_lock_nested(&old_base->lock, SINGLE_DEPTH_NESTING);
BUG_ON(old_base->running_timer);
for (i = 0; i < TVR_SIZE; i++)
migrate_timer_list(new_base, old_base->tv1.vec + i);
for (i = 0; i < TVN_SIZE; i++) {
migrate_timer_list(new_base, old_base->tv2.vec + i);
migrate_timer_list(new_base, old_base->tv3.vec + i);
migrate_timer_list(new_base, old_base->tv4.vec + i);
migrate_timer_list(new_base, old_base->tv5.vec + i);
}
spin_unlock(&old_base->lock);
spin_unlock_irq(&new_base->lock);
put_cpu_var(tvec_bases);
}
#endif /* CONFIG_HOTPLUG_CPU */
static int __cpuinit timer_cpu_notify(struct notifier_block *self,
unsigned long action, void *hcpu)
{
long cpu = (long)hcpu;
int err;
switch(action) {
case CPU_UP_PREPARE:
case CPU_UP_PREPARE_FROZEN:
err = init_timers_cpu(cpu);
if (err < 0)
return notifier_from_errno(err);
break;
#ifdef CONFIG_HOTPLUG_CPU
case CPU_DEAD:
case CPU_DEAD_FROZEN:
migrate_timers(cpu);
break;
#endif
default:
break;
}
return NOTIFY_OK;
}
static struct notifier_block __cpuinitdata timers_nb = {
.notifier_call = timer_cpu_notify,
};
void __init init_timers(void)
{
int err = timer_cpu_notify(&timers_nb, (unsigned long)CPU_UP_PREPARE,
(void *)(long)smp_processor_id());
init_timer_stats();
BUG_ON(err != NOTIFY_OK);
register_cpu_notifier(&timers_nb);
open_softirq(TIMER_SOFTIRQ, run_timer_softirq);
}
/**
* msleep - sleep safely even with waitqueue interruptions
* @msecs: Time in milliseconds to sleep for
*/
void msleep(unsigned int msecs)
{
unsigned long timeout = msecs_to_jiffies(msecs) + 1;
while (timeout)
timeout = schedule_timeout_uninterruptible(timeout);
}
EXPORT_SYMBOL(msleep);
/**
* msleep_interruptible - sleep waiting for signals
* @msecs: Time in milliseconds to sleep for
*/
unsigned long msleep_interruptible(unsigned int msecs)
{
unsigned long timeout = msecs_to_jiffies(msecs) + 1;
while (timeout && !signal_pending(current))
timeout = schedule_timeout_interruptible(timeout);
return jiffies_to_msecs(timeout);
}
EXPORT_SYMBOL(msleep_interruptible);
static int __sched do_usleep_range(unsigned long min, unsigned long max)
{
ktime_t kmin;
unsigned long delta;
kmin = ktime_set(0, min * NSEC_PER_USEC);
delta = (max - min) * NSEC_PER_USEC;
return schedule_hrtimeout_range(&kmin, delta, HRTIMER_MODE_REL);
}
/**
* usleep_range - Drop in replacement for udelay where wakeup is flexible
* @min: Minimum time in usecs to sleep
* @max: Maximum time in usecs to sleep
*/
void usleep_range(unsigned long min, unsigned long max)
{
__set_current_state(TASK_UNINTERRUPTIBLE);
do_usleep_range(min, max);
}
EXPORT_SYMBOL(usleep_range);
| KryptonOmni/android_kernel_lge_mako | kernel/timer.c | C | gpl-2.0 | 50,313 | [
30522,
1013,
1008,
1008,
11603,
1013,
16293,
1013,
25309,
1012,
1039,
1008,
1008,
16293,
4722,
25309,
2015,
1010,
3937,
2832,
2291,
4455,
1008,
1008,
9385,
1006,
1039,
1007,
2889,
1010,
2826,
11409,
2271,
17153,
10175,
5104,
1008,
1008,
272... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
package Koha::TrackedLinks;
# This file is part of Koha.
#
# Koha is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# Koha is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Koha; if not, see <http://www.gnu.org/licenses>.
use Modern::Perl;
use Koha::Database;
use Koha::TrackedLink;
use base qw(Koha::Objects);
=head1 NAME
Koha::TrackedLinks - Koha TrackedLink Object set class
=head1 API
=head2 Class Methods
=cut
=head3 type
=cut
sub _type {
return 'Linktracker';
}
sub object_class {
return 'Koha::TrackedLink';
}
1;
| PTFS-Europe/koha | Koha/TrackedLinks.pm | Perl | gpl-3.0 | 988 | [
30522,
7427,
12849,
3270,
1024,
1024,
12808,
13767,
2015,
1025,
1001,
2023,
5371,
2003,
2112,
1997,
12849,
3270,
1012,
1001,
1001,
12849,
3270,
2003,
2489,
4007,
1025,
2017,
2064,
2417,
2923,
3089,
8569,
2618,
2009,
1998,
1013,
2030,
19933,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
/**
* guy
* 异步树
* @class BI.TreeView
* @extends BI.Pane
*/
BI.TreeView = BI.inherit(BI.Pane, {
_defaultConfig: function () {
return BI.extend(BI.TreeView.superclass._defaultConfig.apply(this, arguments), {
_baseCls: "bi-tree",
paras: {
selectedValues: {}
},
itemsCreator: BI.emptyFn
});
},
_init: function () {
BI.TreeView.superclass._init.apply(this, arguments);
var o = this.options;
this._stop = false;
this._createTree();
this.tip = BI.createWidget({
type: "bi.loading_bar",
invisible: true,
handler: BI.bind(this._loadMore, this)
});
BI.createWidget({
type: "bi.vertical",
scrollable: true,
scrolly: false,
element: this,
items: [this.tip]
});
if(BI.isNotNull(o.value)) {
this.setSelectedValue(o.value);
}
if (BI.isIE9Below && BI.isIE9Below()) {
this.element.addClass("hack");
}
},
_createTree: function () {
this.id = "bi-tree" + BI.UUID();
if (this.nodes) {
this.nodes.destroy();
}
if (this.tree) {
this.tree.destroy();
}
this.tree = BI.createWidget({
type: "bi.layout",
element: "<ul id='" + this.id + "' class='ztree'></ul>"
});
BI.createWidget({
type: "bi.default",
element: this.element,
items: [this.tree]
});
},
// 选择节点触发方法
_selectTreeNode: function (treeId, treeNode) {
this.fireEvent(BI.Controller.EVENT_CHANGE, BI.Events.CLICK, treeNode, this);
this.fireEvent(BI.TreeView.EVENT_CHANGE, treeNode, this);
},
// 配置属性
_configSetting: function () {
var paras = this.options.paras;
var self = this;
var setting = {
async: {
enable: true,
url: getUrl,
autoParam: ["id", "name"], // 节点展开异步请求自动提交id和name
otherParam: BI.cjkEncodeDO(paras) // 静态参数
},
check: {
enable: true
},
data: {
key: {
title: "title",
name: "text" // 节点的name属性替换成text
},
simpleData: {
enable: true // 可以穿id,pid属性的对象数组
}
},
view: {
showIcon: false,
expandSpeed: "",
nameIsHTML: true, // 节点可以用html标签代替
dblClickExpand: false
},
callback: {
beforeExpand: beforeExpand,
onAsyncSuccess: onAsyncSuccess,
onAsyncError: onAsyncError,
beforeCheck: beforeCheck,
onCheck: onCheck,
onExpand: onExpand,
onCollapse: onCollapse,
onClick: onClick
}
};
var className = "dark", perTime = 100;
function onClick (event, treeId, treeNode) {
// 当前点击节点的状态是半选,且为true_part, 则将其改为false_part,使得点击半选后切换到的是全选
var checked = treeNode.checked;
var status = treeNode.getCheckStatus();
if(status.half === true && status.checked === true) {
checked = false;
}
// 更新此node的check状态, 影响父子关联,并调用beforeCheck和onCheck回调
self.nodes.checkNode(treeNode, !checked, true, true);
}
function getUrl (treeId, treeNode) {
var parentNode = self._getParentValues(treeNode);
treeNode.times = treeNode.times || 1;
var param = "id=" + treeNode.id
+ "×=" + (treeNode.times++)
+ "&parentValues= " + _global.encodeURIComponent(BI.jsonEncode(parentNode))
+ "&checkState=" + _global.encodeURIComponent(BI.jsonEncode(treeNode.getCheckStatus()));
return "&" + param;
}
function beforeExpand (treeId, treeNode) {
if (!treeNode.isAjaxing) {
if (!treeNode.children) {
treeNode.times = 1;
ajaxGetNodes(treeNode, "refresh");
}
return true;
}
BI.Msg.toast("Please Wait。", "warning"); // 不展开节点,也不触发onExpand事件
return false;
}
function onAsyncSuccess (event, treeId, treeNode, msg) {
treeNode.halfCheck = false;
if (!msg || msg.length === 0 || /^<html>[\s,\S]*<\/html>$/gi.test(msg) || self._stop) {
return;
}
var zTree = self.nodes;
var totalCount = treeNode.count || 0;
// 尝试去获取下一组节点,若获取值为空数组,表示获取完成
// TODO by GUY
if (treeNode.children.length > totalCount) {
treeNode.count = treeNode.children.length;
BI.delay(function () {
ajaxGetNodes(treeNode);
}, perTime);
} else {
// treeNode.icon = "";
zTree.updateNode(treeNode);
zTree.selectNode(treeNode.children[0]);
// className = (className === "dark" ? "":"dark");
}
}
function onAsyncError (event, treeId, treeNode, XMLHttpRequest, textStatus, errorThrown) {
var zTree = self.nodes;
BI.Msg.toast("Error!", "warning");
// treeNode.icon = "";
// zTree.updateNode(treeNode);
}
function ajaxGetNodes (treeNode, reloadType) {
var zTree = self.nodes;
if (reloadType == "refresh") {
zTree.updateNode(treeNode); // 刷新一下当前节点,如果treeNode.xxx被改了的话
}
zTree.reAsyncChildNodes(treeNode, reloadType, true); // 强制加载子节点,reloadType === refresh为先清空再加载,否则为追加到现有子节点之后
}
function beforeCheck (treeId, treeNode) {
treeNode.halfCheck = false;
if (treeNode.checked === true) {
// 将展开的节点halfCheck设为false,解决展开节点存在halfCheck=true的情况 guy
// 所有的半选状态都需要取消halfCheck=true的情况
function track (children) {
BI.each(children, function (i, ch) {
if (ch.halfCheck === true) {
ch.halfCheck = false;
track(ch.children);
}
});
}
track(treeNode.children);
var treeObj = self.nodes;
var nodes = treeObj.getSelectedNodes();
BI.$.each(nodes, function (index, node) {
node.halfCheck = false;
});
}
var status = treeNode.getCheckStatus();
// 当前点击节点的状态是半选,且为true_part, 则将其改为false_part,使得点击半选后切换到的是全选
if(status.half === true && status.checked === true) {
treeNode.checked = false;
}
}
function onCheck (event, treeId, treeNode) {
self._selectTreeNode(treeId, treeNode);
}
function onExpand (event, treeId, treeNode) {
treeNode.halfCheck = false;
}
function onCollapse (event, treeId, treeNode) {
}
return setting;
},
_getParentValues: function (treeNode) {
if (!treeNode.getParentNode()) {
return [];
}
var parentNode = treeNode.getParentNode();
var result = this._getParentValues(parentNode);
result = result.concat([this._getNodeValue(parentNode)]);
return result;
},
_getNodeValue: function (node) {
// 去除标红
return node.value == null ? BI.replaceAll(node.text.replace(/<[^>]+>/g, ""), " ", " ") : node.value;
},
// 获取半选框值
_getHalfSelectedValues: function (map, node) {
var self = this;
var checkState = node.getCheckStatus();
// 将未选的去掉
if (checkState.checked === false && checkState.half === false) {
return;
}
// 如果节点已展开,并且是半选
if (BI.isNotEmptyArray(node.children) && checkState.half === true) {
var children = node.children;
BI.each(children, function (i, ch) {
self._getHalfSelectedValues(map, ch);
});
return;
}
var parent = node.parentValues || self._getParentValues(node);
var path = parent.concat(this._getNodeValue(node));
// 当前节点是全选的,因为上面的判断已经排除了不选和半选
if (BI.isNotEmptyArray(node.children) || checkState.half === false) {
this._buildTree(map, path);
return;
}
// 剩下的就是半选不展开的节点,因为不知道里面是什么情况,所以借助selectedValues(这个是完整的选中情况)
var storeValues = BI.deepClone(this.options.paras.selectedValues);
var treeNode = this._getTree(storeValues, path);
this._addTreeNode(map, parent, this._getNodeValue(node), treeNode);
},
// 获取的是以values最后一个节点为根的子树
_getTree: function (map, values) {
var cur = map;
BI.any(values, function (i, value) {
if (cur[value] == null) {
return true;
}
cur = cur[value];
});
return cur;
},
// 以values为path一路向里补充map, 并在末尾节点添加key: value节点
_addTreeNode: function (map, values, key, value) {
var cur = map;
BI.each(values, function (i, value) {
if (cur[value] == null) {
cur[value] = {};
}
cur = cur[value];
});
cur[key] = value;
},
// 构造树节点
_buildTree: function (map, values) {
var cur = map;
BI.each(values, function (i, value) {
if (cur[value] == null) {
cur[value] = {};
}
cur = cur[value];
});
},
// 获取选中的值
_getSelectedValues: function () {
var self = this;
var hashMap = {};
var rootNoots = this.nodes.getNodes();
track(rootNoots); // 可以看到这个方法没有递归调用,所以在_getHalfSelectedValues中需要关心全选的节点
function track (nodes) {
BI.each(nodes, function (i, node) {
var checkState = node.getCheckStatus();
if (checkState.checked === true || checkState.half === true) {
if (checkState.half === true) {
self._getHalfSelectedValues(hashMap, node);
} else {
var parentValues = node.parentValues || self._getParentValues(node);
var values = parentValues.concat([self._getNodeValue(node)]);
self._buildTree(hashMap, values);
}
}
});
}
return hashMap;
},
// 处理节点
_dealWidthNodes: function (nodes) {
var self = this, o = this.options;
var ns = BI.Tree.arrayFormat(nodes);
BI.each(ns, function (i, n) {
n.title = n.title || n.text || n.value;
n.isParent = n.isParent || n.parent;
// 处理标红
if (BI.isKey(o.paras.keyword)) {
n.text = BI.$("<div>").__textKeywordMarked__(n.text, o.paras.keyword, n.py).html();
} else {
n.text = BI.htmlEncode(n.text + "");
}
});
return nodes;
},
_loadMore: function () {
var self = this, o = this.options;
this.tip.setLoading();
var op = BI.extend({}, o.paras, {
times: ++this.times
});
o.itemsCreator(op, function (res) {
if (self._stop === true) {
return;
}
var hasNext = !!res.hasNext, nodes = res.items || [];
if (!hasNext) {
self.tip.setEnd();
} else {
self.tip.setLoaded();
}
if (nodes.length > 0) {
self.nodes.addNodes(null, self._dealWidthNodes(nodes));
}
});
},
// 生成树内部方法
_initTree: function (setting) {
var self = this, o = this.options;
self.fireEvent(BI.Events.INIT);
this.times = 1;
var tree = this.tree;
tree.empty();
this.loading();
this.tip.setVisible(false);
var callback = function (nodes) {
if (self._stop === true) {
return;
}
self.nodes = BI.$.fn.zTree.init(tree.element, setting, nodes);
};
var op = BI.extend({}, o.paras, {
times: 1
});
o.itemsCreator(op, function (res) {
if (self._stop === true) {
return;
}
var hasNext = !!res.hasNext, nodes = res.items || [];
if (nodes.length > 0) {
callback(self._dealWidthNodes(nodes));
}
self.setTipVisible(nodes.length <= 0);
self.loaded();
if (!hasNext) {
self.tip.invisible();
} else {
self.tip.setLoaded();
}
op.times === 1 && self.fireEvent(BI.Events.AFTERINIT);
});
},
// 构造树结构,
initTree: function (nodes, setting) {
var setting = setting || {
async: {
enable: false
},
check: {
enable: false
},
data: {
key: {
title: "title",
name: "text"
},
simpleData: {
enable: true
}
},
view: {
showIcon: false,
expandSpeed: "",
nameIsHTML: true
},
callback: {}
};
this.nodes = BI.$.fn.zTree.init(this.tree.element, setting, nodes);
},
start: function () {
this._stop = false;
},
stop: function () {
this._stop = true;
},
// 生成树方法
stroke: function (config) {
delete this.options.keyword;
BI.extend(this.options.paras, config);
var setting = this._configSetting();
this._createTree();
this.start();
this._initTree(setting);
},
populate: function () {
this.stroke.apply(this, arguments);
},
hasChecked: function () {
var treeObj = this.nodes;
return treeObj.getCheckedNodes(true).length > 0;
},
checkAll: function (checked) {
function setNode (children) {
BI.each(children, function (i, child) {
child.halfCheck = false;
setNode(child.children);
});
}
if (!this.nodes) {
return;
}
BI.each(this.nodes.getNodes(), function (i, node) {
node.halfCheck = false;
setNode(node.children);
});
this.nodes.checkAllNodes(checked);
},
expandAll: function (flag) {
this.nodes && this.nodes.expandAll(flag);
},
// 设置树节点的状态
setValue: function (value, param) {
this.checkAll(false);
this.updateValue(value, param);
this.refresh();
},
setSelectedValue: function (value) {
this.options.paras.selectedValues = BI.deepClone(value || {});
},
updateValue: function (values, param) {
if (!this.nodes) {
return;
}
param || (param = "value");
var treeObj = this.nodes;
BI.each(values, function (v, op) {
var nodes = treeObj.getNodesByParam(param, v, null);
BI.each(nodes, function (j, node) {
BI.extend(node, {checked: true}, op);
treeObj.updateNode(node);
});
});
},
refresh: function () {
this.nodes && this.nodes.refresh();
},
getValue: function () {
if (!this.nodes) {
return null;
}
return this._getSelectedValues();
},
destroyed: function () {
this.stop();
this.nodes && this.nodes.destroy();
}
});
BI.extend(BI.TreeView, {
REQ_TYPE_INIT_DATA: 1,
REQ_TYPE_ADJUST_DATA: 2,
REQ_TYPE_SELECT_DATA: 3,
REQ_TYPE_GET_SELECTED_DATA: 4
});
BI.TreeView.EVENT_CHANGE = "EVENT_CHANGE";
BI.TreeView.EVENT_INIT = BI.Events.INIT;
BI.TreeView.EVENT_AFTERINIT = BI.Events.AFTERINIT;
BI.shortcut("bi.tree_view", BI.TreeView); | fanruan/fineui | src/base/tree/ztree/treeview.js | JavaScript | apache-2.0 | 17,478 | [
30522,
1013,
1008,
1008,
1008,
3124,
1008,
100,
100,
100,
1008,
1030,
2465,
12170,
1012,
3392,
8584,
1008,
1030,
8908,
12170,
1012,
6090,
2063,
1008,
1013,
12170,
1012,
3392,
8584,
1027,
12170,
1012,
22490,
1006,
12170,
1012,
6090,
2063,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
/*
* Driver for the Conexant CX25821 PCIe bridge
*
* Copyright (C) 2009 Conexant Systems Inc.
* Authors <shu.lin@conexant.com>, <hiep.huynh@conexant.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
*
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#ifndef _MEDUSA_VIDEO_H
#define _MEDUSA_VIDEO_H
#include "cx25821-medusa-defines.h"
// Color control constants
#define VIDEO_PROCAMP_MIN 0
#define VIDEO_PROCAMP_MAX 10000
#define UNSIGNED_BYTE_MIN 0
#define UNSIGNED_BYTE_MAX 0xFF
#define SIGNED_BYTE_MIN -128
#define SIGNED_BYTE_MAX 127
// Default video color settings
#define SHARPNESS_DEFAULT 50
#define SATURATION_DEFAULT 5000
#define BRIGHTNESS_DEFAULT 6200
#define CONTRAST_DEFAULT 5000
#define HUE_DEFAULT 5000
unsigned short _num_decoders;
unsigned short _num_cameras;
unsigned int _video_standard;
int _display_field_cnt[MAX_DECODERS];
#endif
| go2ev-devteam/Gplus_2159_0801 | openplatform/sdk/os/kernel-2.6.32/drivers/staging/cx25821/cx25821-medusa-video.h | C | gpl-2.0 | 1,665 | [
30522,
1013,
1008,
1008,
4062,
2005,
1996,
13171,
18684,
3372,
1039,
2595,
17788,
2620,
17465,
7473,
2666,
2958,
1008,
1008,
9385,
1006,
1039,
1007,
2268,
13171,
18684,
3372,
3001,
4297,
1012,
1008,
6048,
1026,
18454,
1012,
11409,
1030,
131... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
require_relative "../client"
require_relative "../request"
require_relative "../response"
module Vault
class Client
# A proxy to the {Sys} methods.
# @return [Sys]
def sys
@sys ||= Sys.new(self)
end
end
class Sys < Request; end
end
require_relative "sys/audit"
require_relative "sys/auth"
require_relative "sys/init"
require_relative "sys/leader"
require_relative "sys/lease"
require_relative "sys/mount"
require_relative "sys/policy"
require_relative "sys/seal"
| NicheProject/vault-ruby | lib/vault/api/sys.rb | Ruby | mpl-2.0 | 494 | [
30522,
5478,
1035,
5816,
1000,
1012,
1012,
1013,
7396,
1000,
5478,
1035,
5816,
1000,
1012,
1012,
1013,
5227,
1000,
5478,
1035,
5816,
1000,
1012,
1012,
1013,
3433,
1000,
11336,
11632,
2465,
7396,
1001,
1037,
24540,
30524,
1000,
5478,
1035,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
//
// HHHTextField.h
// HHHFieldView
//
// Created by xiaoaihhh on 2018/2/12.
// Copyright © 2018年 com.hhh.www. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface HHHTextField : UITextField
@end
| SwiftlyFly/problemsOfiOS | HHHTextField/HHHTextField/HHHTextField.h | C | apache-2.0 | 213 | [
30522,
1013,
1013,
1013,
1013,
1044,
23644,
18209,
3790,
1012,
1044,
1013,
1013,
1044,
23644,
3790,
8584,
1013,
1013,
1013,
1013,
2580,
2011,
19523,
4886,
23644,
2232,
2006,
2760,
1013,
1016,
1013,
2260,
1012,
1013,
1013,
9385,
1075,
2760,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
<html xmlns="http://www.w3.org/1999/xhtml" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" type="text/css" href="style.css" />
</head>
<body style="padding: 15px">
<div id="content">
<h1 class="documentFirstHeading">
<span class="" id="parent-fieldname-title">
Clay or concrete tile [RMT1]
</span>
</h1>
<div class="" id="parent-fieldname-definition">
<p><a name="taxonomy:RMT1"></a></p>
<p>All types of clay tile and concrete tile roofing. Overlapping and sometimes fastened to wood battens. Also includes flat roofs that are covered with paving tiles (laid over some type of membrane), but does not include stone slabs.</p>
<p><img src="../../images-1/rmt1_cuba_brzev_1/image_preview.jpg" alt="RMT1_Cuba_Brzev_1" width="326" class="image-inline" height="244"></img></p>
<p>Clay tiles, Cuba (S. Brzev)</p>
<p><img src="../../images-1/rmt1_indonesia_bothara_1.jpg" alt="RMT1_Indonesia_Bothara_1" width="366" class="image-inline" height="275"></img></p>
<p>Clay tile roof covering, Padang, Indonesia (J. Bothara)</p>
<p><img src="../../images-1/rmt1_india_rawal_1/image_preview.jpg" alt="RMT1_India_Rawal_1" class="image-inline"></img></p>
<p>Clay tiles (Mangalore tiles), India (People in Centre)</p>
</div>
</div>
</body>
</html>
| pslh/testidct | app/src/main/assets/glossary/glossary_cleaned/clay-or-concrete-tile--rmt1.html | HTML | agpl-3.0 | 1,375 | [
30522,
1026,
16129,
20950,
3619,
1027,
1000,
8299,
1024,
1013,
1013,
7479,
1012,
1059,
2509,
1012,
8917,
1013,
2639,
1013,
1060,
11039,
19968,
1000,
11374,
1027,
1000,
4372,
1000,
1028,
1026,
2132,
1028,
1026,
18804,
8299,
1011,
1041,
15549... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
MessagesStore | kristijan-pajtasev/ChatBOx | dev/js/.module-cache/de6546b2c9685657e1a6a668adbc9d9f63aaa6bd.js | JavaScript | bsd-2-clause | 13 | [
30522,
7696,
23809,
2063,
102,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
/*
* Copyright (C) 2013 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.
*/
package com.android.inputmethod.keyboard.internal;
import android.content.res.TypedArray;
import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.PorterDuff;
import android.graphics.PorterDuffXfermode;
import android.graphics.Rect;
import android.os.Message;
import android.util.SparseArray;
import android.view.View;
import com.android.inputmethod.keyboard.PointerTracker;
import com.android.inputmethod.keyboard.internal.GestureTrail.Params;
import com.android.inputmethod.latin.CollectionUtils;
import com.android.inputmethod.latin.StaticInnerHandlerWrapper;
/**
* Draw gesture trail preview graphics during gesture.
*/
public final class GestureTrailsPreview extends AbstractDrawingPreview {
private final SparseArray<GestureTrail> mGestureTrails = CollectionUtils.newSparseArray();
private final Params mGestureTrailParams;
private final Paint mGesturePaint;
private int mOffscreenWidth;
private int mOffscreenHeight;
private int mOffscreenOffsetY;
private Bitmap mOffscreenBuffer;
private final Canvas mOffscreenCanvas = new Canvas();
private final Rect mOffscreenSrcRect = new Rect();
private final Rect mDirtyRect = new Rect();
private final Rect mGestureTrailBoundsRect = new Rect(); // per trail
private final DrawingHandler mDrawingHandler;
private static final class DrawingHandler
extends StaticInnerHandlerWrapper<GestureTrailsPreview> {
private static final int MSG_UPDATE_GESTURE_TRAIL = 0;
private final Params mGestureTrailParams;
public DrawingHandler(final GestureTrailsPreview outerInstance,
final Params gestureTrailParams) {
super(outerInstance);
mGestureTrailParams = gestureTrailParams;
}
@Override
public void handleMessage(final Message msg) {
final GestureTrailsPreview preview = getOuterInstance();
if (preview == null) return;
switch (msg.what) {
case MSG_UPDATE_GESTURE_TRAIL:
preview.getDrawingView().invalidate();
break;
}
}
public void postUpdateGestureTrailPreview() {
removeMessages(MSG_UPDATE_GESTURE_TRAIL);
sendMessageDelayed(obtainMessage(MSG_UPDATE_GESTURE_TRAIL),
mGestureTrailParams.mUpdateInterval);
}
}
public GestureTrailsPreview(final View drawingView, final TypedArray mainKeyboardViewAttr) {
super(drawingView);
mGestureTrailParams = new Params(mainKeyboardViewAttr);
mDrawingHandler = new DrawingHandler(this, mGestureTrailParams);
final Paint gesturePaint = new Paint();
gesturePaint.setAntiAlias(true);
gesturePaint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.SRC));
mGesturePaint = gesturePaint;
}
@Override
public void setKeyboardGeometry(final int[] originCoords, final int width, final int height) {
mOffscreenOffsetY = (int)(
height * GestureStroke.EXTRA_GESTURE_TRAIL_AREA_ABOVE_KEYBOARD_RATIO);
mOffscreenWidth = width;
mOffscreenHeight = mOffscreenOffsetY + height;
}
@Override
public void onDetachFromWindow() {
freeOffscreenBuffer();
}
private void freeOffscreenBuffer() {
if (mOffscreenBuffer != null) {
mOffscreenBuffer.recycle();
mOffscreenBuffer = null;
}
}
private void mayAllocateOffscreenBuffer() {
if (mOffscreenBuffer != null && mOffscreenBuffer.getWidth() == mOffscreenWidth
&& mOffscreenBuffer.getHeight() == mOffscreenHeight) {
return;
}
freeOffscreenBuffer();
mOffscreenBuffer = Bitmap.createBitmap(
mOffscreenWidth, mOffscreenHeight, Bitmap.Config.ARGB_8888);
mOffscreenCanvas.setBitmap(mOffscreenBuffer);
mOffscreenCanvas.translate(0, mOffscreenOffsetY);
}
private boolean drawGestureTrails(final Canvas offscreenCanvas, final Paint paint,
final Rect dirtyRect) {
// Clear previous dirty rectangle.
if (!dirtyRect.isEmpty()) {
paint.setColor(Color.TRANSPARENT);
paint.setStyle(Paint.Style.FILL);
offscreenCanvas.drawRect(dirtyRect, paint);
}
dirtyRect.setEmpty();
boolean needsUpdatingGestureTrail = false;
// Draw gesture trails to offscreen buffer.
synchronized (mGestureTrails) {
// Trails count == fingers count that have ever been active.
final int trailsCount = mGestureTrails.size();
for (int index = 0; index < trailsCount; index++) {
final GestureTrail trail = mGestureTrails.valueAt(index);
needsUpdatingGestureTrail |= trail.drawGestureTrail(offscreenCanvas, paint,
mGestureTrailBoundsRect, mGestureTrailParams);
// {@link #mGestureTrailBoundsRect} has bounding box of the trail.
dirtyRect.union(mGestureTrailBoundsRect);
}
}
return needsUpdatingGestureTrail;
}
/**
* Draws the preview
* @param canvas The canvas where the preview is drawn.
*/
@Override
public void drawPreview(final Canvas canvas) {
if (!isPreviewEnabled()) {
return;
}
mayAllocateOffscreenBuffer();
// Draw gesture trails to offscreen buffer.
final boolean needsUpdatingGestureTrail = drawGestureTrails(
mOffscreenCanvas, mGesturePaint, mDirtyRect);
if (needsUpdatingGestureTrail) {
mDrawingHandler.postUpdateGestureTrailPreview();
}
// Transfer offscreen buffer to screen.
if (!mDirtyRect.isEmpty()) {
mOffscreenSrcRect.set(mDirtyRect);
mOffscreenSrcRect.offset(0, mOffscreenOffsetY);
canvas.drawBitmap(mOffscreenBuffer, mOffscreenSrcRect, mDirtyRect, null);
// Note: Defer clearing the dirty rectangle here because we will get cleared
// rectangle on the canvas.
}
}
/**
* Set the position of the preview.
* @param tracker The new location of the preview is based on the points in PointerTracker.
*/
@Override
public void setPreviewPosition(final PointerTracker tracker) {
if (!isPreviewEnabled()) {
return;
}
GestureTrail trail;
synchronized (mGestureTrails) {
trail = mGestureTrails.get(tracker.mPointerId);
if (trail == null) {
trail = new GestureTrail();
mGestureTrails.put(tracker.mPointerId, trail);
}
}
trail.addStroke(tracker.getGestureStrokeWithPreviewPoints(), tracker.getDownTime());
// TODO: Should narrow the invalidate region.
getDrawingView().invalidate();
}
}
| slightfoot/android-kioskime | src/com/android/inputmethod/keyboard/internal/GestureTrailsPreview.java | Java | apache-2.0 | 7,627 | [
30522,
1013,
1008,
1008,
9385,
1006,
1039,
1007,
2286,
1996,
11924,
2330,
3120,
2622,
1008,
1008,
7000,
2104,
1996,
15895,
6105,
1010,
2544,
1016,
1012,
1014,
1006,
1996,
1000,
6105,
1000,
1007,
1025,
1008,
2017,
2089,
2025,
2224,
2023,
5... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
/*
* Copyright (c) 2016 airbug Inc. http://airbug.com
*
* bugcore may be freely distributed under the MIT license.
*/
//-------------------------------------------------------------------------------
// Annotations
//-------------------------------------------------------------------------------
//@TestFile
//@Require('Class')
//@Require('Map')
//@Require('ObservableMap')
//@Require('PutChange')
//@Require('TypeUtil')
//@Require('bugdouble.BugDouble')
//@Require('bugmeta.BugMeta')
//@Require('bugunit.TestTag')
//-------------------------------------------------------------------------------
// Context
//-------------------------------------------------------------------------------
require('bugpack').context("*", function(bugpack) {
//-------------------------------------------------------------------------------
// BugPack
//-------------------------------------------------------------------------------
var Class = bugpack.require('Class');
var Map = bugpack.require('Map');
var ObservableMap = bugpack.require('ObservableMap');
var PutChange = bugpack.require('PutChange');
var TypeUtil = bugpack.require('TypeUtil');
var BugDouble = bugpack.require('bugdouble.BugDouble');
var BugMeta = bugpack.require('bugmeta.BugMeta');
var TestTag = bugpack.require('bugunit.TestTag');
//-------------------------------------------------------------------------------
// Simplify References
//-------------------------------------------------------------------------------
var bugmeta = BugMeta.context();
var spyOnObject = BugDouble.spyOnObject;
var test = TestTag.test;
//-------------------------------------------------------------------------------
// Declare Tests
//-------------------------------------------------------------------------------
/**
* This tests...
* 1) Instantiating a ObservableMap class with no parameters
*/
var observableMapInstantiationTest = {
// Setup Test
//-------------------------------------------------------------------------------
setup: function() {
this.testObservableMap = new ObservableMap();
},
// Run Test
//-------------------------------------------------------------------------------
test: function(test) {
test.assertTrue(Class.doesExtend(this.testObservableMap.getObserved(), Map),
"Assert ObservableMap.observed defaults to a Map")
}
};
bugmeta.tag(observableMapInstantiationTest).with(
test().name("ObservableMap - instantiation test")
);
/**
* This tests...
* 1) Instantiating a ObservableMap class with parameters
*/
var observableMapInstantiationWithParametersTest = {
// Setup Test
//-------------------------------------------------------------------------------
setup: function() {
this.testKey = "testKey";
this.testValue = "testValue";
this.testMap = new Map();
this.testMap.put(this.testKey, this.testValue);
this.testObservableMap = new ObservableMap(this.testMap);
},
// Run Test
//-------------------------------------------------------------------------------
test: function(test) {
test.assertTrue(Class.doesExtend(this.testObservableMap.getObserved(), Map),
"Assert ObservableMap.observed was set to a Map");
test.assertEqual(this.testObservableMap.getObserved().get(this.testKey), this.testValue,
"Assert ObservableMap.observed was set correctly");
}
};
bugmeta.tag(observableMapInstantiationWithParametersTest).with(
test().name("ObservableMap - instantiation with parameters test")
);
});
| airbug/bugcore | libraries/bugcore/js/test/observe/data/ObservableMapTests.js | JavaScript | mit | 3,975 | [
30522,
1013,
1008,
1008,
9385,
1006,
1039,
1007,
2355,
2250,
8569,
2290,
4297,
1012,
8299,
1024,
1013,
1013,
2250,
8569,
2290,
1012,
4012,
1008,
1008,
11829,
17345,
2089,
2022,
10350,
5500,
2104,
1996,
10210,
6105,
1012,
1008,
1013,
1013,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
--------------------------------------------------------------------------------
## Treebank Statistics (UD_Hungarian)
This relation is universal.
1 nodes (0%) are attached to their parents as `discourse`.
1 instances of `discourse` (100%) are right-to-left (child precedes parent).
Average distance between parent and child is 3.
The following 1 pairs of parts of speech are connected with `discourse`: [hu-pos/VERB]()-[hu-pos/NOUN]() (1; 100% instances).
~~~ conllu
# visual-style 23 bgColor:blue
# visual-style 23 fgColor:white
# visual-style 26 bgColor:blue
# visual-style 26 fgColor:white
# visual-style 26 23 discourse color:blue
1 A a DET _ Definite=Def|PronType=Art 3 det _ _
2 nagy nagy ADJ _ Case=Nom|Degree=Pos|Number=Sing|Number[psed]=None|Number[psor]=None|Person[psor]=None 3 amod:att _ _
3 elődök előd NOUN _ Case=Nom|Number=Plur|Number[psed]=None|Number[psor]=None|Person[psor]=None 11 nmod:att _ _
4 ( ( PUNCT _ _ 6 punct _ _
5 Sean Sean PROPN _ Case=Nom|Number=Sing|Number[psed]=None|Number[psor]=None|Person[psor]=None 6 name _ _
6 Connery Connery PROPN _ Case=Nom|Number=Sing|Number[psed]=None|Number[psor]=None|Person[psor]=None 3 appos _ _
7 , , PUNCT _ _ 6 punct _ _
8 Roger Roger PROPN _ Case=Nom|Number=Sing|Number[psed]=None|Number[psor]=None|Person[psor]=None 9 name _ _
9 Moore Moore PROPN _ Case=Nom|Number=Sing|Number[psed]=None|Number[psor]=None|Person[psor]=None 6 conj _ _
10 ) ) PUNCT _ _ 6 punct _ _
11 játékában játék NOUN _ Case=Ine|Number=Sing|Number[psed]=None|Number[psor]=Sing|Person[psor]=3 12 nmod:obl _ _
12 fellelhető fellelhető ADJ _ Case=Nom|Number=Sing|Number[psed]=None|Number[psor]=None|Person[psor]=None|VerbForm=PartPres 13 amod:att _ _
13 irónia irónia NOUN _ Case=Nom|Number=Sing|Number[psed]=None|Number[psor]=None|Person[psor]=None 18 nsubj _ _
14 Brosnannek Brosnan PROPN _ Case=Gen|Number=Sing|Number[psed]=None|Number[psor]=None|Person[psor]=None 18 nmod:att _ _
15 ugyan ugyan ADV _ _ 18 advmod:mode _ _
16 nem nem ADV _ PronType=Neg 18 neg _ _
17 az az DET _ Definite=Def|PronType=Art 18 det _ _
18 erőssége erősség NOUN _ Case=Nom|Number=Sing|Number[psed]=None|Number[psor]=Sing|Person[psor]=3 0 root _ _
19 , , PUNCT _ _ 18 punct _ _
20 de de CONJ _ _ 18 cc _ _
21 hál hál NOUN _ Case=Nom|Number=Sing|Number[psed]=None|Number[psor]=None|Person[psor]=None 23 nmod:att _ _
22 ' ' PUNCT _ _ 23 punct _ _
23 isten isten NOUN _ Case=Nom|Number=Sing|Number[psed]=None|Number[psor]=None|Person[psor]=None 26 discourse _ _
24 nem nem ADV _ PronType=Neg 26 neg _ _
25 is is ADV _ _ 26 advmod:mode _ _
26 erőlteti erőltet VERB _ Definite=Def|Mood=Ind|Number=Sing|Person=3|Tense=Pres|VerbForm=Fin|Voice=Act 18 conj _ _
27 sem sem CONJ _ _ 28 cc _ _
28 ő ő PRON _ Case=Nom|Number=Sing|Number[psed]=None|Number[psor]=None|Person=3|Person[psor]=None|PronType=Prs 26 nsubj _ _
29 , , PUNCT _ _ 28 punct _ _
30 sem sem CONJ _ _ 28 cc _ _
31 a a DET _ Definite=Def|PronType=Art 32 det _ _
32 történet történet NOUN _ Case=Nom|Number=Sing|Number[psed]=None|Number[psor]=None|Person[psor]=None 33 nmod:att _ _
33 kiagyalói kiagyalói ADJ _ Case=Nom|Degree=Pos|Number=Sing|Number[psed]=None|Number[psor]=None|Person[psor]=None 28 conj _ _
34 . . PUNCT _ _ 18 punct _ _
~~~
| fginter/docs-fginterfork | _includes/stats/hu/dep/discourse.md | Markdown | apache-2.0 | 3,255 | [
30522,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
101... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
package com.baomidou.mybatisplus.test.plugins.paginationInterceptor;
import java.io.Reader;
import java.sql.Connection;
import java.util.List;
import org.apache.ibatis.io.Resources;
import org.apache.ibatis.jdbc.ScriptRunner;
import org.apache.ibatis.session.RowBounds;
import org.apache.ibatis.session.SqlSession;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mybatis.spring.SqlSessionTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import com.baomidou.mybatisplus.plugins.Page;
import com.baomidou.mybatisplus.test.plugins.RandomUtils;
import com.baomidou.mybatisplus.test.plugins.paginationInterceptor.entity.PageUser;
import com.baomidou.mybatisplus.test.plugins.paginationInterceptor.mapper.PageUserMapper;
import com.baomidou.mybatisplus.test.plugins.paginationInterceptor.service.PageUserService;
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations = { "/plugins/paginationInterceptor.xml" })
public class PaginationInterceptorTest {
@Autowired
private SqlSessionTemplate sqlSessionTemplate;
@Autowired
private PageUserService pageUserService;
@Autowired
private PageUserMapper pageUserMapper;
private int current;
private int size;
@Before
public void setUp() throws Exception {
SqlSession session = sqlSessionTemplate.getSqlSessionFactory().openSession();
Connection conn = session.getConnection();
Reader reader = Resources.getResourceAsReader("com/baomidou/mybatisplus/test/plugins/paginationInterceptor/CreateDB.sql");
ScriptRunner runner = new ScriptRunner(conn);
runner.setLogWriter(null);
runner.runScript(reader);
reader.close();
session.close();
// 随机当前页和分页大小
size = RandomUtils.nextInt(1, 50);
current = RandomUtils.nextInt(1, 200 / size);
System.err.println("当前页为:" + current + " 分页大小为" + size);
}
@Test
public void pageSimpleTest() {
// 最基础分页
Page<PageUser> page1 = new Page<>(current, size);
Page<PageUser> result1 = pageUserService.selectPage(page1);
Assert.assertTrue(!result1.getRecords().isEmpty());
}
@Test
public void pageOrderByTest() {
// 带OrderBy
Page<PageUser> page2 = new Page<>(current, size, "name");
Page<PageUser> result2 = pageUserService.selectPage(page2);
Assert.assertTrue(!result2.getRecords().isEmpty());
// 没有orderby但是设置了倒叙
Page<PageUser> page3 = new Page<>(current, size);
page3.setAsc(false);
Page<PageUser> result3 = pageUserService.selectPage(page3);
Assert.assertTrue(!result3.getRecords().isEmpty());
// 有orderby设置了倒叙
Page<PageUser> page4 = new Page<>(current, size, "name");
page3.setAsc(false);
Page<PageUser> result4 = pageUserService.selectPage(page4);
Assert.assertTrue(!result4.getRecords().isEmpty());
}
@Test
public void pageCountTest() {
// 设置不count
Page<PageUser> page = new Page<>(current, size);
page.setSearchCount(false);
Page<PageUser> result = pageUserService.selectPage(page);
Assert.assertTrue(result.getTotal() == 0);
}
@Test
public void rowBoundTest() {
System.err.println("测试原生RowBounds分页");
int offset = RandomUtils.nextInt(1, 190);
int limit = RandomUtils.nextInt(1,20);
RowBounds rowBounds = new RowBounds(offset, limit);
List<PageUser> result = pageUserMapper.selectPage(rowBounds, null);
Assert.assertTrue(!result.isEmpty());
}
}
| nobdy/mybatis-plus | mybatis-plus/src/test/java/com/baomidou/mybatisplus/test/plugins/paginationInterceptor/PaginationInterceptorTest.java | Java | apache-2.0 | 3,569 | [
30522,
7427,
4012,
1012,
25945,
4328,
26797,
1012,
2026,
14479,
2483,
24759,
2271,
1012,
3231,
1012,
13354,
7076,
1012,
6643,
20876,
3508,
18447,
2121,
3401,
13876,
2953,
1025,
12324,
9262,
1012,
22834,
1012,
8068,
1025,
12324,
9262,
1012,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
using Test
using StaticArrays
using Polyhedra
@testset "Element" begin
@testset "RemProj" begin
r = Ray([1//1, -5//1, 0//1])
l = Line([-15//1, 75//1, -26//1])
r = Polyhedra.remproj(r, l)
@test r isa Ray
@test coord(r) == [1//1, -5//1, -15//1]
@test r == Ray([1, -5, -15])
@test r != Line([1, -5, -15])
end
@testset "Simplify" begin
r = @inferred simplify(Ray([0, 0]))
@test r isa Ray{Int}
@test coord(r) == [0, 0]
p = @inferred simplify([6, 4])
@test p isa Vector{Int}
@test p == [6, 4]
l = @inferred simplify(Line([6, 4]))
@test l isa Line{Int}
@test coord(l) == [3, 2]
hp = @inferred simplify(HyperPlane([6, 4], 2))
@test hp isa HyperPlane{Int}
@test hp.a == [3, 2]
@test hp.β == 1
hs = @inferred simplify(HalfSpace([0, 0], 0))
@test hs isa HalfSpace{Int}
@test hs.a == [0, 0]
@test hs.β == 0
hpr = @inferred simplify(HyperPlane([0//1, 0//1], 0//1))
@test hpr isa HyperPlane{Rational{Int}}
@test hpr.a == [0, 0]
@test hpr.β == 0
end
@testset "Lift" begin
@test lift(HalfSpace([1, 2], 3)) == HalfSpace([-3, 1, 2], 0)
@test lift(HalfSpace((@SVector [1, 2]), 3)) == HalfSpace((@SVector [-3, 1, 2]), 0)
@test lift(HyperPlane([1, 2], 3)) == HyperPlane([-3, 1, 2], 0)
@test lift(HyperPlane((@SVector [1, 2]), 3)) == HyperPlane((@SVector [-3, 1, 2]), 0)
#@test lift(SymPoint([2, 3])) == SymPoint([1, 2, 3])
#@test lift(SymPoint(@SVector [2, 3])) == SymPoint(@SVector [1, 2, 3])
@test lift([2, 3]) == [1, 2, 3]
@test lift(@SVector [2, 3]) == @SVector [1, 2, 3]
@test lift(Line([2, 3])) == Line([0, 2, 3])
@test lift(Line(@SVector [2, 3])) == Line(@SVector [0, 2, 3])
@test lift(Ray([2, 3])) == Ray([0, 2, 3])
@test lift(Ray(@SVector [2, 3])) == Ray(@SVector [0, 2, 3])
end
@testset "Promote" begin
@test promote_type(HyperPlane{Int, Vector{Int}}, HyperPlane{Float64, Vector{Float64}}) == HyperPlane{Float64, Vector{Float64}}
@test promote_type(HyperPlane{Float64, SVector{2, Float64}}, HyperPlane{Int, SVector{2, Int}}) == HyperPlane{Float64, SVector{2, Float64}}
err = ErrorException("Cannot mix Polyhedra elements of vector type $(Vector{Int}) and $(SVector{2, Int})")
@test_throws err promote_type(HyperPlane{Int, Vector{Int}}, HyperPlane{Int, SVector{2, Int}})
err = ErrorException("Cannot mix Polyhedra elements of vector type $(Vector{Float64}) and $(SVector{2, Float64})")
@test_throws err promote_type(HyperPlane{Int, Vector{Int}}, HyperPlane{Float64, SVector{2, Float64}})
end
end
| blegat/Polyhedra.jl | test/elements.jl | Julia | mit | 2,788 | [
30522,
2478,
3231,
2478,
10763,
2906,
9447,
2015,
2478,
26572,
9072,
2527,
1030,
5852,
3388,
1000,
5783,
1000,
30524,
1007,
1048,
1027,
2240,
1006,
1031,
1011,
2321,
1013,
1013,
1015,
1010,
4293,
1013,
1013,
1015,
1010,
1011,
2656,
1013,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
package com.xoba.smr;
import java.io.PrintWriter;
import java.io.StringReader;
import java.io.StringWriter;
import java.net.URI;
import java.util.Collection;
import java.util.Formatter;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
import java.util.Properties;
import java.util.Set;
import java.util.SortedSet;
import java.util.TreeMap;
import java.util.TreeSet;
import org.apache.commons.codec.binary.Base64;
import com.amazonaws.Request;
import com.amazonaws.auth.AWSCredentials;
import com.amazonaws.handlers.AbstractRequestHandler;
import com.amazonaws.services.ec2.AmazonEC2;
import com.amazonaws.services.ec2.AmazonEC2Client;
import com.amazonaws.services.ec2.model.CreateTagsRequest;
import com.amazonaws.services.ec2.model.Instance;
import com.amazonaws.services.ec2.model.LaunchSpecification;
import com.amazonaws.services.ec2.model.RequestSpotInstancesRequest;
import com.amazonaws.services.ec2.model.RequestSpotInstancesResult;
import com.amazonaws.services.ec2.model.RunInstancesRequest;
import com.amazonaws.services.ec2.model.RunInstancesResult;
import com.amazonaws.services.ec2.model.Tag;
import com.amazonaws.services.s3.AmazonS3;
import com.amazonaws.services.s3.AmazonS3Client;
import com.amazonaws.services.simpledb.AmazonSimpleDB;
import com.amazonaws.services.simpledb.AmazonSimpleDBClient;
import com.amazonaws.services.sqs.AmazonSQS;
import com.amazonaws.services.sqs.AmazonSQSClient;
import com.amazonaws.services.sqs.model.SendMessageRequest;
import com.xoba.util.ILogger;
import com.xoba.util.LogFactory;
import com.xoba.util.MraUtils;
public class SimpleMapReduce {
private static final ILogger logger = LogFactory.getDefault().create();
public static void launch(Properties config, Collection<String> inputSplitPrefixes, AmazonInstance ai,
int machineCount) throws Exception {
launch(config, inputSplitPrefixes, ai, machineCount, true);
}
public static void launch(Properties config, Collection<String> inputSplitPrefixes, AmazonInstance ai,
int machineCount, boolean spotInstances) throws Exception {
if (!config.containsKey(ConfigKey.JOB_ID.toString())) {
config.put(ConfigKey.JOB_ID.toString(), MraUtils.md5Hash(new TreeMap<Object, Object>(config).toString())
.substring(0, 8));
}
String id = config.getProperty(ConfigKey.JOB_ID.toString());
AWSCredentials aws = create(config);
AmazonSimpleDB db = new AmazonSimpleDBClient(aws);
AmazonSQS sqs = new AmazonSQSClient(aws);
AmazonS3 s3 = new AmazonS3Client(aws);
final String mapQueue = config.getProperty(ConfigKey.MAP_QUEUE.toString());
final String reduceQueue = config.getProperty(ConfigKey.REDUCE_QUEUE.toString());
final String dom = config.getProperty(ConfigKey.SIMPLEDB_DOM.toString());
final String mapInputBucket = config.getProperty(ConfigKey.MAP_INPUTS_BUCKET.toString());
final String shuffleBucket = config.getProperty(ConfigKey.SHUFFLE_BUCKET.toString());
final String reduceOutputBucket = config.getProperty(ConfigKey.REDUCE_OUTPUTS_BUCKET.toString());
final int hashCard = new Integer(config.getProperty(ConfigKey.HASH_CARDINALITY.toString()));
s3.createBucket(reduceOutputBucket);
final long inputSplitCount = inputSplitPrefixes.size();
for (String key : inputSplitPrefixes) {
Properties p = new Properties();
p.setProperty("input", "s3://" + mapInputBucket + "/" + key);
sqs.sendMessage(new SendMessageRequest(mapQueue, serialize(p)));
}
SimpleDbCommitter.commitNewAttribute(db, dom, "parameters", "splits", "" + inputSplitCount);
SimpleDbCommitter.commitNewAttribute(db, dom, "parameters", "hashes", "" + hashCard);
SimpleDbCommitter.commitNewAttribute(db, dom, "parameters", "done", "1");
for (String hash : getAllHashes(hashCard)) {
Properties p = new Properties();
p.setProperty("input", "s3://" + shuffleBucket + "/" + hash);
sqs.sendMessage(new SendMessageRequest(reduceQueue, serialize(p)));
}
if (machineCount == 1) {
// run locally
SMRDriver.main(new String[] { MraUtils.convertToHex(serialize(config).getBytes()) });
} else if (machineCount > 1) {
// run in the cloud
String userData = produceUserData(ai, config,
new URI(config.getProperty(ConfigKey.RUNNABLE_JARFILE_URI.toString())));
logger.debugf("launching job with id %s:", id);
System.out.println(userData);
AmazonEC2 ec2 = new AmazonEC2Client(aws);
if (spotInstances) {
RequestSpotInstancesRequest sir = new RequestSpotInstancesRequest();
sir.setSpotPrice(new Double(ai.getPrice()).toString());
sir.setInstanceCount(machineCount);
sir.setType("one-time");
LaunchSpecification spec = new LaunchSpecification();
spec.setImageId(ai.getDefaultAMI());
spec.setUserData(new String(new Base64().encode(userData.getBytes("US-ASCII"))));
spec.setInstanceType(ai.getApiName());
sir.setLaunchSpecification(spec);
RequestSpotInstancesResult result = ec2.requestSpotInstances(sir);
logger.debugf("spot instance request result: %s", result);
} else {
RunInstancesRequest req = new RunInstancesRequest(ai.getDefaultAMI(), machineCount, machineCount);
req.setClientToken(id);
req.setInstanceType(ai.getApiName());
req.setInstanceInitiatedShutdownBehavior("terminate");
req.setUserData(new String(new Base64().encode(userData.getBytes("US-ASCII"))));
RunInstancesResult resp = ec2.runInstances(req);
logger.debugf("on demand reservation id: %s", resp.getReservation().getReservationId());
labelEc2Instance(ec2, resp, "smr-" + id);
}
}
}
public static void labelEc2Instance(AmazonEC2 ec2, RunInstancesResult resp, String title) throws Exception {
int tries = 0;
boolean done = false;
while (tries++ < 3 && !done) {
try {
List<String> resources = new LinkedList<String>();
for (Instance i : resp.getReservation().getInstances()) {
resources.add(i.getInstanceId());
}
List<Tag> tags = new LinkedList<Tag>();
tags.add(new Tag("Name", title));
CreateTagsRequest ctr = new CreateTagsRequest(resources, tags);
ec2.createTags(ctr);
done = true;
logger.debugf("set tag(s)");
} catch (Exception e) {
logger.warnf("exception setting tags: %s", e);
Thread.sleep(3000);
}
}
}
public static String produceUserData(AmazonInstance ai, Properties c, URI jarFileURI) throws Exception {
StringWriter sw = new StringWriter();
LinuxLineConventionPrintWriter pw = new LinuxLineConventionPrintWriter(new PrintWriter(sw));
pw.println("#!/bin/sh");
pw.println("cd /root");
pw.println("chmod 777 /mnt");
pw.println("aptitude update");
Set<String> set = new TreeSet<String>();
set.add("openjdk-6-jdk");
set.add("wget");
if (set.size() > 0) {
pw.print("aptitude install -y ");
Iterator<String> it = set.iterator();
while (it.hasNext()) {
String x = it.next();
pw.print(x);
if (it.hasNext()) {
pw.print(" ");
}
}
pw.println();
}
pw.printf("wget %s", jarFileURI);
pw.println();
String[] parts = jarFileURI.getPath().split("/");
String jar = parts[parts.length - 1];
pw.printf("java -Xmx%.0fm -cp %s %s %s", 1000 * 0.8 * ai.getMemoryGB(), jar, SMRDriver.class.getName(),
MraUtils.convertToHex(serialize(c).getBytes()));
pw.println();
pw.println("poweroff");
pw.close();
return sw.toString();
}
public static AmazonS3 getS3(AWSCredentials aws) {
AmazonS3Client s3 = new AmazonS3Client(aws);
s3.addRequestHandler(new AbstractRequestHandler() {
@Override
public void beforeRequest(Request<?> request) {
request.addHeader("x-amz-request-payer", "requester");
}
});
return s3;
}
public static String prefixedName(String p, String n) {
return p + "-" + n;
}
public static AWSCredentials create(final Properties p) {
return new AWSCredentials() {
@Override
public String getAWSSecretKey() {
return p.getProperty(ConfigKey.AWS_SECRETKEY.toString());
}
@Override
public String getAWSAccessKeyId() {
return p.getProperty(ConfigKey.AWS_KEYID.toString());
}
};
}
public static SortedSet<String> getAllHashes(long mod) {
SortedSet<String> out = new TreeSet<String>();
for (long i = 0; i < mod; i++) {
out.add(fmt(i, mod));
}
return out;
}
public static String hash(byte[] key, long mod) {
byte[] buf = MraUtils.md5HashBytesToBytes(key);
long x = Math.abs(MraUtils.extractLongValue(buf));
return fmt(x % mod, mod);
}
private static String fmt(long x, long mod) {
long places = Math.round(Math.ceil(Math.log10(mod)));
if (places == 0) {
places = 1;
}
return new Formatter().format("%0" + places + "d", x).toString();
}
public static String serialize(Properties p) throws Exception {
StringWriter sw = new StringWriter();
try {
p.store(sw, "n/a");
} finally {
sw.close();
}
return sw.toString();
}
public static Properties marshall(String s) throws Exception {
Properties p = new Properties();
StringReader sr = new StringReader(s);
try {
p.load(sr);
} finally {
sr.close();
}
return p;
}
}
| mrallc/smr | code/src/com/xoba/smr/SimpleMapReduce.java | Java | bsd-3-clause | 9,071 | [
30522,
7427,
4012,
1012,
1060,
16429,
2050,
1012,
15488,
2099,
1025,
12324,
9262,
1012,
22834,
1012,
6140,
15994,
1025,
12324,
9262,
30524,
5164,
15994,
1025,
12324,
9262,
1012,
5658,
1012,
24471,
2072,
1025,
12324,
9262,
1012,
21183,
4014,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
---@module fimbul.v35.material_template
local material_template = {}
function material_template:new(y)
local neu = y or {}
-- Do a deep resolve
if neu.material then
neu = neu.material
end
setmetatable(neu, self)
self.__index = self
neu.templatetype = "material"
-- TODO: Check if everything is here and in proper order
-- neu:check()
return neu
end
return material_template
| n0la/fimbul | fimbul/v35/material_template.lua | Lua | bsd-2-clause | 418 | [
30522,
1011,
1011,
1011,
1030,
11336,
10882,
14905,
5313,
1012,
1058,
19481,
1012,
3430,
1035,
23561,
2334,
3430,
1035,
23561,
1027,
1063,
1065,
3853,
3430,
1035,
23561,
1024,
30524,
1037,
2784,
10663,
2065,
11265,
2226,
1012,
3430,
2059,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
/* -*- mode: c; c-basic-offset: 8; -*-
* vim: noexpandtab sw=8 ts=8 sts=0:
*
* dlmglue.h
*
* description here
*
* Copyright (C) 2002, 2004 Oracle. All rights reserved.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this program; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 021110-1307, USA.
*/
#ifndef DLMGLUE_H
#define DLMGLUE_H
#include "dcache.h"
#define OCFS2_LVB_VERSION 5
struct ocfs2_meta_lvb {
__u8 lvb_version;
__u8 lvb_reserved0;
__be16 lvb_idynfeatures;
__be32 lvb_iclusters;
__be32 lvb_iuid;
__be32 lvb_igid;
__be64 lvb_iatime_packed;
__be64 lvb_ictime_packed;
__be64 lvb_imtime_packed;
__be64 lvb_isize;
__be16 lvb_imode;
__be16 lvb_inlink;
__be32 lvb_iattr;
__be32 lvb_igeneration;
__be32 lvb_reserved2;
};
#define OCFS2_QINFO_LVB_VERSION 1
struct ocfs2_qinfo_lvb {
__u8 lvb_version;
__u8 lvb_reserved[3];
__be32 lvb_bgrace;
__be32 lvb_igrace;
__be32 lvb_syncms;
__be32 lvb_blocks;
__be32 lvb_free_blk;
__be32 lvb_free_entry;
};
#define OCFS2_ORPHAN_LVB_VERSION 1
struct ocfs2_orphan_scan_lvb {
__u8 lvb_version;
__u8 lvb_reserved[3];
__be32 lvb_os_seqno;
};
struct ocfs2_lock_holder {
struct list_head oh_list;
struct pid *oh_owner_pid;
};
/* ocfs2_inode_lock_full() 'arg_flags' flags */
/* don't wait on recovery. */
#define OCFS2_META_LOCK_RECOVERY (0x01)
/* Instruct the dlm not to queue ourselves on the other node. */
#define OCFS2_META_LOCK_NOQUEUE (0x02)
/* don't block waiting for the downconvert thread, instead return -EAGAIN */
#define OCFS2_LOCK_NONBLOCK (0x04)
/* just get back disk inode bh if we've got cluster lock. */
#define OCFS2_META_LOCK_GETBH (0x08)
/* Locking subclasses of inode cluster lock */
enum {
OI_LS_NORMAL = 0,
OI_LS_PARENT,
OI_LS_RENAME1,
OI_LS_RENAME2,
OI_LS_REFLINK_TARGET,
};
int ocfs2_dlm_init(struct ocfs2_super *osb);
void ocfs2_dlm_shutdown(struct ocfs2_super *osb, int hangup_pending);
void ocfs2_lock_res_init_once(struct ocfs2_lock_res *res);
void ocfs2_inode_lock_res_init(struct ocfs2_lock_res *res,
enum ocfs2_lock_type type,
unsigned int generation,
struct inode *inode);
void ocfs2_dentry_lock_res_init(struct ocfs2_dentry_lock *dl,
u64 parent, struct inode *inode);
struct ocfs2_file_private;
void ocfs2_file_lock_res_init(struct ocfs2_lock_res *lockres,
struct ocfs2_file_private *fp);
struct ocfs2_mem_dqinfo;
void ocfs2_qinfo_lock_res_init(struct ocfs2_lock_res *lockres,
struct ocfs2_mem_dqinfo *info);
void ocfs2_refcount_lock_res_init(struct ocfs2_lock_res *lockres,
struct ocfs2_super *osb, u64 ref_blkno,
unsigned int generation);
void ocfs2_lock_res_free(struct ocfs2_lock_res *res);
int ocfs2_create_new_inode_locks(struct inode *inode);
int ocfs2_drop_inode_locks(struct inode *inode);
int ocfs2_rw_lock(struct inode *inode, int write);
void ocfs2_rw_unlock(struct inode *inode, int write);
int ocfs2_open_lock(struct inode *inode);
int ocfs2_try_open_lock(struct inode *inode, int write);
void ocfs2_open_unlock(struct inode *inode);
int ocfs2_inode_lock_atime(struct inode *inode,
struct vfsmount *vfsmnt,
int *level);
int ocfs2_inode_lock_full_nested(struct inode *inode,
struct buffer_head **ret_bh,
int ex,
int arg_flags,
int subclass);
int ocfs2_inode_lock_with_page(struct inode *inode,
struct buffer_head **ret_bh,
int ex,
struct page *page);
/* Variants without special locking class or flags */
#define ocfs2_inode_lock_full(i, r, e, f)\
ocfs2_inode_lock_full_nested(i, r, e, f, OI_LS_NORMAL)
#define ocfs2_inode_lock_nested(i, b, e, s)\
ocfs2_inode_lock_full_nested(i, b, e, 0, s)
/* 99% of the time we don't want to supply any additional flags --
* those are for very specific cases only. */
#define ocfs2_inode_lock(i, b, e) ocfs2_inode_lock_full_nested(i, b, e, 0, OI_LS_NORMAL)
void ocfs2_inode_unlock(struct inode *inode,
int ex);
int ocfs2_super_lock(struct ocfs2_super *osb,
int ex);
void ocfs2_super_unlock(struct ocfs2_super *osb,
int ex);
int ocfs2_orphan_scan_lock(struct ocfs2_super *osb, u32 *seqno);
void ocfs2_orphan_scan_unlock(struct ocfs2_super *osb, u32 seqno);
int ocfs2_rename_lock(struct ocfs2_super *osb);
void ocfs2_rename_unlock(struct ocfs2_super *osb);
int ocfs2_nfs_sync_lock(struct ocfs2_super *osb, int ex);
void ocfs2_nfs_sync_unlock(struct ocfs2_super *osb, int ex);
int ocfs2_dentry_lock(struct dentry *dentry, int ex);
void ocfs2_dentry_unlock(struct dentry *dentry, int ex);
int ocfs2_file_lock(struct file *file, int ex, int trylock);
void ocfs2_file_unlock(struct file *file);
int ocfs2_qinfo_lock(struct ocfs2_mem_dqinfo *oinfo, int ex);
void ocfs2_qinfo_unlock(struct ocfs2_mem_dqinfo *oinfo, int ex);
struct ocfs2_refcount_tree;
int ocfs2_refcount_lock(struct ocfs2_refcount_tree *ref_tree, int ex);
void ocfs2_refcount_unlock(struct ocfs2_refcount_tree *ref_tree, int ex);
void ocfs2_mark_lockres_freeing(struct ocfs2_super *osb,
struct ocfs2_lock_res *lockres);
void ocfs2_simple_drop_lockres(struct ocfs2_super *osb,
struct ocfs2_lock_res *lockres);
/* for the downconvert thread */
void ocfs2_wake_downconvert_thread(struct ocfs2_super *osb);
struct ocfs2_dlm_debug *ocfs2_new_dlm_debug(void);
void ocfs2_put_dlm_debug(struct ocfs2_dlm_debug *dlm_debug);
/* To set the locking protocol on module initialization */
void ocfs2_set_locking_protocol(void);
/* The _tracker pair is used to avoid cluster recursive locking */
int ocfs2_inode_lock_tracker(struct inode *inode,
struct buffer_head **ret_bh,
int ex,
struct ocfs2_lock_holder *oh);
void ocfs2_inode_unlock_tracker(struct inode *inode,
int ex,
struct ocfs2_lock_holder *oh,
int had_lock);
#endif /* DLMGLUE_H */
| mkvdv/au-linux-kernel-autumn-2017 | linux/fs/ocfs2/dlmglue.h | C | gpl-3.0 | 6,469 | [
30522,
1013,
1008,
1011,
1008,
1011,
5549,
1024,
1039,
1025,
1039,
1011,
3937,
1011,
16396,
1024,
1022,
1025,
1011,
1008,
1011,
1008,
6819,
2213,
1024,
2053,
10288,
9739,
11927,
7875,
25430,
1027,
1022,
24529,
1027,
1022,
8541,
1027,
1014,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
<?php defined('BASEPATH') OR exit('No direct script access allowed'); ?>
<div class="container-fluid">
<div class="row">
<?php $this->load->view('templates/toolbars/computing-support/disposals.php'); ?>
<div class="col-lg-12">
<h1 class="page-header">Disposals</h1>
<p>Device added to disposals.</p>
<meta http-equiv="refresh" content="1; URL='/dashboard/computing-support/disposals/current'" />
<i class="fa fa-circle-o-notch fa-spin" aria-hidden="true"></i> Redirecting...
</div> <!-- END col-lg-12 -->
</div> <!-- END row -->
</div> <!-- END container-fluid -->
| East-Kent-Partnership/Intranet | dashboard/application/views/computing-support/disposals/created.php | PHP | mit | 647 | [
30522,
1026,
1029,
25718,
4225,
1006,
1005,
2918,
15069,
1005,
1007,
2030,
6164,
1006,
30524,
1005,
23561,
2015,
1013,
6994,
8237,
2015,
1013,
9798,
1011,
2490,
1013,
13148,
2015,
1012,
25718,
1005,
1007,
1025,
1029,
1028,
1026,
4487,
2615,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
# 1874 Nickel
## Shield
### Type 2 - No Rays
| isaacdagel/numisreg-db | united-states/nickels/shield/type-2/1874.md | Markdown | cc0-1.0 | 45 | [
30522,
1001,
7586,
15519,
1001,
1001,
6099,
1001,
1001,
1001,
2828,
1016,
1011,
2053,
9938,
102,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
/**
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0.
*/
#include <aws/kinesisanalytics/model/LambdaOutputUpdate.h>
#include <aws/core/utils/json/JsonSerializer.h>
#include <utility>
using namespace Aws::Utils::Json;
using namespace Aws::Utils;
namespace Aws
{
namespace KinesisAnalytics
{
namespace Model
{
LambdaOutputUpdate::LambdaOutputUpdate() :
m_resourceARNUpdateHasBeenSet(false),
m_roleARNUpdateHasBeenSet(false)
{
}
LambdaOutputUpdate::LambdaOutputUpdate(JsonView jsonValue) :
m_resourceARNUpdateHasBeenSet(false),
m_roleARNUpdateHasBeenSet(false)
{
*this = jsonValue;
}
LambdaOutputUpdate& LambdaOutputUpdate::operator =(JsonView jsonValue)
{
if(jsonValue.ValueExists("ResourceARNUpdate"))
{
m_resourceARNUpdate = jsonValue.GetString("ResourceARNUpdate");
m_resourceARNUpdateHasBeenSet = true;
}
if(jsonValue.ValueExists("RoleARNUpdate"))
{
m_roleARNUpdate = jsonValue.GetString("RoleARNUpdate");
m_roleARNUpdateHasBeenSet = true;
}
return *this;
}
JsonValue LambdaOutputUpdate::Jsonize() const
{
JsonValue payload;
if(m_resourceARNUpdateHasBeenSet)
{
payload.WithString("ResourceARNUpdate", m_resourceARNUpdate);
}
if(m_roleARNUpdateHasBeenSet)
{
payload.WithString("RoleARNUpdate", m_roleARNUpdate);
}
return payload;
}
} // namespace Model
} // namespace KinesisAnalytics
} // namespace Aws
| jt70471/aws-sdk-cpp | aws-cpp-sdk-kinesisanalytics/source/model/LambdaOutputUpdate.cpp | C++ | apache-2.0 | 1,459 | [
30522,
1013,
1008,
1008,
1008,
9385,
9733,
1012,
4012,
1010,
4297,
1012,
2030,
2049,
18460,
1012,
2035,
2916,
9235,
1012,
1008,
23772,
2595,
1011,
6105,
1011,
8909,
4765,
18095,
1024,
15895,
1011,
1016,
1012,
1014,
1012,
1008,
1013,
1001,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
/*
* TeleStax, Open Source Cloud Communications Copyright 2012.
* and individual contributors
* by the @authors tag. See the copyright.txt in the distribution for a
* full listing of individual contributors.
*
* This is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation; either version 2.1 of
* the License, or (at your option) any later version.
*
* This software is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this software; if not, write to the Free
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
*/
package org.restcomm.ss7.management.console;
/**
* @author sergey.povarnin
*/
public interface ShellServerMBean {
String getAddress();
void setAddress(String address);
int getPort();
void setPort(int port);
String getSecurityDomain();
void setSecurityDomain(String securityDomain);
int getQueueNumber();
}
| RestComm/jss7 | management/shell-server-impl/src/main/java/org/restcomm/ss7/management/console/ShellServerMBean.java | Java | agpl-3.0 | 1,338 | [
30522,
1013,
1008,
1008,
10093,
4355,
8528,
1010,
2330,
3120,
6112,
4806,
9385,
2262,
1012,
1008,
1998,
3265,
16884,
1008,
2011,
1996,
1030,
6048,
6415,
1012,
2156,
1996,
9385,
1012,
19067,
2102,
1999,
1996,
4353,
2005,
1037,
1008,
2440,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
/*
* Copyright 2016 Red Hat, Inc. and/or its affiliates.
*
* 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.
*/
package org.uberfire.ext.editor.commons.client.file.popups;
import javax.enterprise.context.Dependent;
import javax.inject.Inject;
import org.gwtbootstrap3.client.ui.ModalFooter;
import org.gwtbootstrap3.client.ui.constants.ButtonType;
import org.gwtbootstrap3.client.ui.constants.IconType;
import org.jboss.errai.common.client.dom.Div;
import org.jboss.errai.ui.client.local.api.IsElement;
import org.jboss.errai.ui.client.local.spi.TranslationService;
import org.jboss.errai.ui.shared.api.annotations.DataField;
import org.jboss.errai.ui.shared.api.annotations.Templated;
import org.uberfire.ext.editor.commons.client.file.popups.commons.ToggleCommentPresenter;
import org.uberfire.ext.editor.commons.client.resources.i18n.Constants;
import org.uberfire.ext.widgets.common.client.common.popups.BaseModal;
import org.uberfire.ext.widgets.common.client.common.popups.footers.GenericModalFooter;
import org.uberfire.mvp.Command;
@Dependent
@Templated
public class DeletePopUpView implements DeletePopUpPresenter.View,
IsElement {
@Inject
@DataField("body")
Div body;
@Inject
private TranslationService translationService;
private DeletePopUpPresenter presenter;
private BaseModal modal;
@Override
public void init(DeletePopUpPresenter presenter) {
this.presenter = presenter;
modalSetup();
setupComment();
}
@Override
public void show() {
modal.show();
}
@Override
public void hide() {
modal.hide();
}
private void modalSetup() {
this.modal = new CommonModalBuilder()
.addHeader(translate(Constants.DeletePopUpView_ConfirmDelete))
.addBody(body)
.addFooter(footer())
.build();
}
private ModalFooter footer() {
GenericModalFooter footer = new GenericModalFooter();
footer.addButton(translate(Constants.DeletePopUpView_Cancel),
cancelCommand(),
ButtonType.DEFAULT);
footer.addButton(translate(Constants.DeletePopUpView_Delete),
deleteCommand(),
IconType.REMOVE,
ButtonType.DANGER);
return footer;
}
private String translate(final String key) {
return translationService.format(key);
}
private Command deleteCommand() {
return () -> presenter.delete();
}
private Command cancelCommand() {
return () -> presenter.cancel();
}
private void setupComment() {
body.appendChild(toggleCommentPresenter().getViewElement());
}
private ToggleCommentPresenter toggleCommentPresenter() {
return presenter.getToggleCommentPresenter();
}
}
| ederign/uberfire | uberfire-extensions/uberfire-commons-editor/uberfire-commons-editor-client/src/main/java/org/uberfire/ext/editor/commons/client/file/popups/DeletePopUpView.java | Java | apache-2.0 | 3,430 | [
30522,
1013,
1008,
1008,
9385,
2355,
2417,
6045,
1010,
4297,
1012,
1998,
1013,
2030,
2049,
18460,
1012,
1008,
1008,
7000,
2104,
1996,
15895,
6105,
1010,
2544,
1016,
1012,
1014,
1006,
1996,
1000,
6105,
1000,
1007,
1025,
1008,
2017,
2089,
2... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
/*
* Copyright 2015 Red Hat, Inc. and/or its affiliates.
*
* 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.
*/
package org.jbpm.kie.services.test;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import java.util.ServiceLoader;
import org.jbpm.kie.services.api.DeploymentIdResolver;
import org.jbpm.runtime.manager.impl.filter.RegExRuntimeManagerIdFilter;
import org.junit.Test;
import org.kie.internal.runtime.manager.RuntimeManagerIdFilter;
public class RuntimeManagerIdentifierFilterTest {
private static final ServiceLoader<RuntimeManagerIdFilter> runtimeManagerIdFilters = ServiceLoader.load(RuntimeManagerIdFilter.class);
@Test
public void testNumberOfFilterImplementationsFound() {
assertNotNull(runtimeManagerIdFilters);
List<String> collected = new ArrayList<String>();
for (RuntimeManagerIdFilter filter : runtimeManagerIdFilters) {
collected.add(filter.getClass().getName());
}
assertEquals(2, collected.size());
assertTrue(collected.contains(RegExRuntimeManagerIdFilter.class.getName()));
assertTrue(collected.contains(DeploymentIdResolver.class.getName()));
}
@Test
public void testGAVFilteringLatest() {
assertNotNull(runtimeManagerIdFilters);
Collection<String> input = new ArrayList<String>();
input.add("org.jbpm:test:2.0");
input.add("org.jbpm:test:1.0");
input.add("org.jbpm:another:1.0");
ArrayList<String> collected = new ArrayList<String>();
String pattern = "org.jbpm:test:latest";
for (RuntimeManagerIdFilter filter : runtimeManagerIdFilters) {
collected.addAll(filter.filter(pattern, input));
}
assertEquals(1, collected.size());
assertEquals("org.jbpm:test:2.0", collected.get(0));
}
@Test
public void testRegExFilteringAll() {
assertNotNull(runtimeManagerIdFilters);
ArrayList<String> input = new ArrayList<String>();
input.add("org.jbpm:test:2.0");
input.add("org.jbpm:test:1.0");
input.add("org.jbpm:another:1.0");
ArrayList<String> collected = new ArrayList<String>();
String pattern = ".*";
for (RuntimeManagerIdFilter filter : runtimeManagerIdFilters) {
collected.addAll(filter.filter(pattern, input));
}
assertEquals(3, collected.size());
assertTrue(collected.contains(input.get(0)));
assertTrue(collected.contains(input.get(1)));
assertTrue(collected.contains(input.get(2)));
}
@Test
public void testRegExFilteringAllVersions() {
assertNotNull(runtimeManagerIdFilters);
ArrayList<String> input = new ArrayList<String>();
input.add("org.jbpm:test:2.0");
input.add("org.jbpm:test:1.0");
input.add("org.jbpm:another:1.0");
ArrayList<String> collected = new ArrayList<String>();
String pattern = "org.jbpm:test:.*";
for (RuntimeManagerIdFilter filter : runtimeManagerIdFilters) {
collected.addAll(filter.filter(pattern, input));
}
assertEquals(2, collected.size());
assertTrue(collected.contains(input.get(0)));
assertTrue(collected.contains(input.get(1)));
}
@Test
public void testRegExFilteringAllArtifactsAndVersions() {
assertNotNull(runtimeManagerIdFilters);
ArrayList<String> input = new ArrayList<String>();
input.add("org.jbpm:test:2.0");
input.add("org.jbpm:test:1.0");
input.add("org.jbpm:another:1.0");
ArrayList<String> collected = new ArrayList<String>();
String pattern = "org.jbpm:.*";
for (RuntimeManagerIdFilter filter : runtimeManagerIdFilters) {
collected.addAll(filter.filter(pattern, input));
}
assertEquals(3, collected.size());
assertTrue(collected.contains(input.get(0)));
assertTrue(collected.contains(input.get(1)));
assertTrue(collected.contains(input.get(2)));
}
@Test
public void testRegExFilteringAllArtifactsWithGivenVersions() {
assertNotNull(runtimeManagerIdFilters);
ArrayList<String> input = new ArrayList<String>();
input.add("org.jbpm:test:2.0");
input.add("org.jbpm:test:1.0");
input.add("org.jbpm:another:1.0");
ArrayList<String> collected = new ArrayList<String>();
String pattern = "org.jbpm:.*:1.0";
for (RuntimeManagerIdFilter filter : runtimeManagerIdFilters) {
collected.addAll(filter.filter(pattern, input));
}
assertEquals(2, collected.size());
assertTrue(collected.contains(input.get(1)));
assertTrue(collected.contains(input.get(2)));
}
}
| pleacu/jbpm | jbpm-services/jbpm-kie-services/src/test/java/org/jbpm/kie/services/test/RuntimeManagerIdentifierFilterTest.java | Java | apache-2.0 | 5,642 | [
30522,
1013,
1008,
1008,
9385,
2325,
2417,
6045,
1010,
4297,
1012,
1998,
1013,
2030,
2049,
18460,
1012,
1008,
1008,
7000,
2104,
1996,
15895,
6105,
1010,
2544,
1016,
1012,
1014,
1006,
1996,
1000,
6105,
1000,
1007,
1025,
1008,
2017,
2089,
2... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
<?php
/**
* @author Sandra Rono
*/
class Tutor_model extends CI_Model
{
public function __construct()
{
parent::__construct();
}
//list all tutors
public function list_tutors()
{
$query = $this->db->get('tutors');
//$result = array();
$result = $query->result_array();
return $result;
}
//get specific tutor
public function get_tutor($id)
{
$query = $this->db->get_where('tutors', array('staff_no' => $id));
return $query->row();
}
//create tutor
public function create()
{
$no = $this->input->post('staffno');
$passwd = md5('Tutor@'.$no);
//tutors info to be inserted in tutors table
$data = array(
'staff_no' => $no,
'fname' => $this->input->post('fname'),
'lname' => $this->input->post('lname'),
'dept' => $this->input->post('dept'));
//user data for login purposes
$u_data = array(
'username' => $no,
'passwd' => $passwd,
'level' => 'tutor');
$this->db->insert('tutors', $data); //create tutor
return $this->db->insert('users', $u_data);
}
//update tutor
public function update()
{
$id = $this->input->post('staff_no');
$data = array(
'fname' => $this->input->post('f_name'),
'lname' => $this->input->post('l_name'),
'dept' => $this->input->post('dept'));
$this->db->where('staff_no', $id);
return $this->db->update('tutors', $data);
}
}
?> | drizzy123/katepramas | application/models/tutor_model.php | PHP | gpl-2.0 | 1,364 | [
30522,
1026,
1029,
25718,
1013,
1008,
1008,
1008,
1030,
3166,
12834,
6902,
2080,
1008,
1013,
2465,
14924,
1035,
2944,
8908,
25022,
1035,
2944,
1063,
2270,
3853,
1035,
1035,
9570,
1006,
1007,
1063,
6687,
1024,
1024,
1035,
1035,
9570,
1006,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
namespace Magento\CatalogImportExport\Model\Import\Product;
use Magento\CatalogImportExport\Model\Import\Product;
use Magento\Framework\Validator\AbstractValidator;
use Magento\Catalog\Model\Product\Attribute\Backend\Sku;
/**
* Class Validator
*
* @api
* @since 100.0.2
*/
class Validator extends AbstractValidator implements RowValidatorInterface
{
/**
* @var RowValidatorInterface[]|AbstractValidator[]
*/
protected $validators = [];
/**
* @var \Magento\CatalogImportExport\Model\Import\Product
*/
protected $context;
/**
* @var \Magento\Framework\Stdlib\StringUtils
*/
protected $string;
/**
* @var array
*/
protected $_uniqueAttributes;
/**
* @var array
*/
protected $_rowData;
/**
* @var string|null
* @since 100.1.0
*/
protected $invalidAttribute;
/**
* @param \Magento\Framework\Stdlib\StringUtils $string
* @param RowValidatorInterface[] $validators
*/
public function __construct(
\Magento\Framework\Stdlib\StringUtils $string,
$validators = []
) {
$this->string = $string;
$this->validators = $validators;
}
/**
* Text validation
*
* @param mixed $attrCode
* @param string $type
* @return bool
*/
protected function textValidation($attrCode, $type)
{
$val = $this->string->cleanString($this->_rowData[$attrCode]);
if ($type == 'text') {
$valid = $this->string->strlen($val) < Product::DB_MAX_TEXT_LENGTH;
} else if ($attrCode == Product::COL_SKU) {
$valid = $this->string->strlen($val) <= SKU::SKU_MAX_LENGTH;
} else {
$valid = $this->string->strlen($val) < Product::DB_MAX_VARCHAR_LENGTH;
}
if (!$valid) {
$this->_addMessages([RowValidatorInterface::ERROR_EXCEEDED_MAX_LENGTH]);
}
return $valid;
}
/**
* Check if value is valid attribute option
*
* @param string $attrCode
* @param array $possibleOptions
* @param string $value
* @return bool
*/
private function validateOption($attrCode, $possibleOptions, $value)
{
if (!isset($possibleOptions[strtolower($value)])) {
$this->_addMessages(
[
sprintf(
$this->context->retrieveMessageTemplate(
RowValidatorInterface::ERROR_INVALID_ATTRIBUTE_OPTION
),
$attrCode
)
]
);
return false;
}
return true;
}
/**
* Numeric validation
*
* @param mixed $attrCode
* @param string $type
* @return bool
*/
protected function numericValidation($attrCode, $type)
{
$val = trim($this->_rowData[$attrCode]);
if ($type == 'int') {
$valid = (string)(int)$val === $val;
} else {
$valid = is_numeric($val);
}
if (!$valid) {
$this->_addMessages(
[
sprintf(
$this->context->retrieveMessageTemplate(RowValidatorInterface::ERROR_INVALID_ATTRIBUTE_TYPE),
$attrCode,
$type
)
]
);
}
return $valid;
}
/**
* Is required attribute valid
*
* @param string $attrCode
* @param array $attributeParams
* @param array $rowData
* @return bool
*/
public function isRequiredAttributeValid($attrCode, array $attributeParams, array $rowData)
{
$doCheck = false;
if ($attrCode == Product::COL_SKU) {
$doCheck = true;
} elseif ($attrCode == 'price') {
$doCheck = false;
} elseif ($attributeParams['is_required'] && $this->getRowScope($rowData) == Product::SCOPE_DEFAULT
&& $this->context->getBehavior() != \Magento\ImportExport\Model\Import::BEHAVIOR_DELETE
) {
$doCheck = true;
}
if ($doCheck === true) {
return isset($rowData[$attrCode])
&& strlen(trim($rowData[$attrCode]))
&& trim($rowData[$attrCode]) !== $this->context->getEmptyAttributeValueConstant();
}
return true;
}
/**
* Is attribute valid
*
* @param string $attrCode
* @param array $attrParams
* @param array $rowData
* @return bool
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
* @SuppressWarnings(PHPMD.NPathComplexity)
*/
public function isAttributeValid($attrCode, array $attrParams, array $rowData)
{
$this->_rowData = $rowData;
if (isset($rowData['product_type']) && !empty($attrParams['apply_to'])
&& !in_array($rowData['product_type'], $attrParams['apply_to'])
) {
return true;
}
if (!$this->isRequiredAttributeValid($attrCode, $attrParams, $rowData)) {
$valid = false;
$this->_addMessages(
[
sprintf(
$this->context->retrieveMessageTemplate(
RowValidatorInterface::ERROR_VALUE_IS_REQUIRED
),
$attrCode
)
]
);
return $valid;
}
if (!strlen(trim($rowData[$attrCode]))) {
return true;
}
if ($rowData[$attrCode] === $this->context->getEmptyAttributeValueConstant() && !$attrParams['is_required']) {
return true;
}
switch ($attrParams['type']) {
case 'varchar':
case 'text':
$valid = $this->textValidation($attrCode, $attrParams['type']);
break;
case 'decimal':
case 'int':
$valid = $this->numericValidation($attrCode, $attrParams['type']);
break;
case 'select':
case 'boolean':
$valid = $this->validateOption($attrCode, $attrParams['options'], $rowData[$attrCode]);
break;
case 'multiselect':
$values = $this->context->parseMultiselectValues($rowData[$attrCode]);
foreach ($values as $value) {
$valid = $this->validateOption($attrCode, $attrParams['options'], $value);
if (!$valid) {
break;
}
}
$uniqueValues = array_unique($values);
if (count($uniqueValues) != count($values)) {
$valid = false;
$this->_addMessages([RowValidatorInterface::ERROR_DUPLICATE_MULTISELECT_VALUES]);
}
break;
case 'datetime':
$val = trim($rowData[$attrCode]);
$valid = strtotime($val) !== false;
if (!$valid) {
$this->_addMessages([RowValidatorInterface::ERROR_INVALID_ATTRIBUTE_TYPE]);
}
break;
default:
$valid = true;
break;
}
if ($valid && !empty($attrParams['is_unique'])) {
if (isset($this->_uniqueAttributes[$attrCode][$rowData[$attrCode]])
&& ($this->_uniqueAttributes[$attrCode][$rowData[$attrCode]] != $rowData[Product::COL_SKU])) {
$this->_addMessages([RowValidatorInterface::ERROR_DUPLICATE_UNIQUE_ATTRIBUTE]);
return false;
}
$this->_uniqueAttributes[$attrCode][$rowData[$attrCode]] = $rowData[Product::COL_SKU];
}
if (!$valid) {
$this->setInvalidAttribute($attrCode);
}
return (bool)$valid;
}
/**
* Set invalid attribute
*
* @param string|null $attribute
* @return void
* @since 100.1.0
*/
protected function setInvalidAttribute($attribute)
{
$this->invalidAttribute = $attribute;
}
/**
* Get invalid attribute
*
* @return string
* @since 100.1.0
*/
public function getInvalidAttribute()
{
return $this->invalidAttribute;
}
/**
* Is valid attributes
*
* @return bool
* @SuppressWarnings(PHPMD.UnusedLocalVariable)
*/
protected function isValidAttributes()
{
$this->_clearMessages();
$this->setInvalidAttribute(null);
if (!isset($this->_rowData['product_type'])) {
return false;
}
$entityTypeModel = $this->context->retrieveProductTypeByName($this->_rowData['product_type']);
if ($entityTypeModel) {
foreach ($this->_rowData as $attrCode => $attrValue) {
$attrParams = $entityTypeModel->retrieveAttributeFromCache($attrCode);
if ($attrParams) {
$this->isAttributeValid($attrCode, $attrParams, $this->_rowData);
}
}
if ($this->getMessages()) {
return false;
}
}
return true;
}
/**
* @inheritdoc
*/
public function isValid($value)
{
$this->_rowData = $value;
$this->_clearMessages();
$returnValue = $this->isValidAttributes();
foreach ($this->validators as $validator) {
if (!$validator->isValid($value)) {
$returnValue = false;
$this->_addMessages($validator->getMessages());
}
}
return $returnValue;
}
/**
* Obtain scope of the row from row data.
*
* @param array $rowData
* @return int
*/
public function getRowScope(array $rowData)
{
if (empty($rowData[Product::COL_STORE])) {
return Product::SCOPE_DEFAULT;
}
return Product::SCOPE_STORE;
}
/**
* Init
*
* @param \Magento\CatalogImportExport\Model\Import\Product $context
* @return $this
*/
public function init($context)
{
$this->context = $context;
foreach ($this->validators as $validator) {
$validator->init($context);
}
}
}
| kunj1988/Magento2 | app/code/Magento/CatalogImportExport/Model/Import/Product/Validator.php | PHP | gpl-2.0 | 10,486 | [
30522,
1026,
1029,
25718,
1013,
1008,
1008,
1008,
9385,
1075,
17454,
13663,
1010,
4297,
1012,
2035,
2916,
9235,
1012,
1008,
2156,
24731,
1012,
19067,
2102,
2005,
6105,
4751,
1012,
1008,
1013,
3415,
15327,
17454,
13663,
1032,
12105,
5714,
64... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
define("resolver",
[],
function() {
"use strict";
/*
* This module defines a subclass of Ember.DefaultResolver that adds two
* important features:
*
* 1) The resolver makes the container aware of es6 modules via the AMD
* output. The loader's _seen is consulted so that classes can be
* resolved directly via the module loader, without needing a manual
* `import`.
* 2) is able provide injections to classes that implement `extend`
* (as is typical with Ember).
*/
function classFactory(klass) {
return {
create: function (injections) {
if (typeof klass.extend === 'function') {
return klass.extend(injections);
} else {
return klass;
}
}
};
}
var underscore = Ember.String.underscore;
var classify = Ember.String.classify;
var get = Ember.get;
function parseName(fullName) {
var nameParts = fullName.split(":"),
type = nameParts[0], fullNameWithoutType = nameParts[1],
name = fullNameWithoutType,
namespace = get(this, 'namespace'),
root = namespace;
return {
fullName: fullName,
type: type,
fullNameWithoutType: fullNameWithoutType,
name: name,
root: root,
resolveMethodName: "resolve" + classify(type)
};
}
function chooseModuleName(seen, moduleName) {
var underscoredModuleName = Ember.String.underscore(moduleName);
if (moduleName !== underscoredModuleName && seen[moduleName] && seen[underscoredModuleName]) {
throw new TypeError("Ambigous module names: `" + moduleName + "` and `" + underscoredModuleName + "`");
}
if (seen[moduleName]) {
return moduleName;
} else if (seen[underscoredModuleName]) {
return underscoredModuleName;
} else {
return moduleName;
}
}
function resolveOther(parsedName) {
var prefix = this.namespace.modulePrefix;
Ember.assert('module prefix must be defined', prefix);
var pluralizedType = parsedName.type + 's';
var name = parsedName.fullNameWithoutType;
var moduleName = prefix + '/' + pluralizedType + '/' + name;
// allow treat all dashed and all underscored as the same thing
// supports components with dashes and other stuff with underscores.
var normalizedModuleName = chooseModuleName(requirejs._eak_seen, moduleName);
if (requirejs._eak_seen[normalizedModuleName]) {
var module = require(normalizedModuleName, null, null, true /* force sync */);
if (module === undefined) {
throw new Error("Module: '" + name + "' was found but returned undefined. Did you forget to `export default`?");
}
if (Ember.ENV.LOG_MODULE_RESOLVER) {
Ember.Logger.info('hit', moduleName);
}
return module;
} else {
if (Ember.ENV.LOG_MODULE_RESOLVER) {
Ember.Logger.info('miss', moduleName);
}
return this._super(parsedName);
}
}
function resolveTemplate(parsedName) {
return Ember.TEMPLATES[parsedName.name] || Ember.TEMPLATES[Ember.String.underscore(parsedName.name)];
}
// Ember.DefaultResolver docs:
// https://github.com/emberjs/ember.js/blob/master/packages/ember-application/lib/system/resolver.js
var Resolver = Ember.DefaultResolver.extend({
resolveTemplate: resolveTemplate,
resolveOther: resolveOther,
parseName: parseName,
normalize: function(fullName) {
// replace `.` with `/` in order to make nested controllers work in the following cases
// 1. `needs: ['posts/post']`
// 2. `{{render "posts/post"}}`
// 3. `this.render('posts/post')` from Route
return Ember.String.dasherize(fullName.replace(/\./g, '/'));
}
});
return Resolver;
});
| bmac/aircheck | vendor/resolver.js | JavaScript | mit | 3,757 | [
30522,
9375,
1006,
1000,
10663,
2099,
1000,
1010,
1031,
1033,
1010,
3853,
1006,
1007,
1063,
1000,
2224,
9384,
1000,
1025,
1013,
1008,
1008,
2023,
11336,
11859,
1037,
4942,
26266,
1997,
7861,
5677,
1012,
12398,
6072,
4747,
6299,
2008,
9909,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
# SPDX-License-Identifier: Apache-2.0
"""
Contains common test fixtures used to run unit tests.
"""
import sys
# This is needed so Python can find test_tools on the path.
sys.path.append('../../..')
from test_tools.fixtures.common import *
| awsdocs/aws-doc-sdk-examples | python/example_code/apigateway/aws_service/test/conftest.py | Python | apache-2.0 | 311 | [
30522,
1001,
9385,
9733,
1012,
4012,
1010,
4297,
1012,
2030,
2049,
18460,
1012,
2035,
2916,
9235,
1012,
1001,
23772,
2595,
1011,
6105,
1011,
8909,
4765,
18095,
1024,
15895,
1011,
1016,
1012,
1014,
1000,
1000,
1000,
3397,
2691,
3231,
17407,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
//
// This file is part of Return To The Roots.
//
// Return To The Roots is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 2 of the License, or
// (at your option) any later version.
//
// Return To The Roots is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Return To The Roots. If not, see <http://www.gnu.org/licenses/>.
#include "rttrDefines.h" // IWYU pragma: keep
#include "LanGameInfo.h"
#include "s25util/Serializer.h"
bool LanGameInfo::Serialize(Serializer& serializer)
{
if(name.size() > 64)
name.resize(64);
if(map.size() > 64)
map.resize(64);
if(version.size() > 16)
version.resize(16);
serializer.PushString(name);
serializer.PushBool(hasPwd);
serializer.PushString(map);
serializer.PushUnsignedChar(curNumPlayers);
serializer.PushUnsignedChar(maxNumPlayers);
serializer.PushUnsignedShort(port);
serializer.PushBool(isIPv6);
serializer.PushString(version);
serializer.PushString(revision);
return true;
}
bool LanGameInfo::Deserialize(Serializer& serializer)
{
name = serializer.PopString();
hasPwd = serializer.PopBool();
map = serializer.PopString();
curNumPlayers = serializer.PopUnsignedChar();
maxNumPlayers = serializer.PopUnsignedChar();
port = serializer.PopUnsignedShort();
isIPv6 = serializer.PopBool();
version = serializer.PopString();
revision = serializer.PopString();
return true;
}
| stefson/s25client | libs/s25main/gameTypes/LanGameInfo.cpp | C++ | gpl-3.0 | 1,822 | [
30522,
1013,
1013,
1013,
1013,
2023,
5371,
2003,
2112,
1997,
2709,
2000,
1996,
6147,
1012,
1013,
1013,
1013,
1013,
2709,
2000,
1996,
6147,
2003,
2489,
4007,
1024,
2017,
2064,
2417,
2923,
3089,
8569,
2618,
2009,
1998,
1013,
2030,
19933,
10... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
/**
* @author mrdoob / http://mrdoob.com/
*/
var EventDispatcher=function(){};Object.assign(EventDispatcher.prototype,{addEventListener:function(i,t){void 0===this._listeners&&(this._listeners={});var e=this._listeners;void 0===e[i]&&(e[i]=[]),-1===e[i].indexOf(t)&&e[i].push(t)},hasEventListener:function(i,t){if(void 0===this._listeners)return!1;var e=this._listeners;return void 0!==e[i]&&-1!==e[i].indexOf(t)},removeEventListener:function(i,t){if(void 0!==this._listeners){var e=this._listeners[i];if(void 0!==e){var s=e.indexOf(t);-1!==s&&e.splice(s,1)}}},dispatchEvent:function(i){if(void 0!==this._listeners){var t=this._listeners[i.type];if(void 0!==t){i.target=this;var e=[],s=0,n=t.length;for(s=0;s<n;s++)e[s]=t[s];for(s=0;s<n;s++)e[s].call(this,i)}}}}); | cvazquezlos/LOGANALYZER | testloganalyzer-gui/documentation/js/libs/EventDispatcher.js | JavaScript | apache-2.0 | 767 | [
30522,
1013,
1008,
1008,
1008,
1030,
3166,
2720,
3527,
16429,
1013,
8299,
1024,
1013,
1013,
2720,
3527,
16429,
1012,
4012,
1013,
1008,
1013,
13075,
2724,
10521,
4502,
10649,
2121,
1027,
3853,
1006,
1007,
1063,
1065,
1025,
4874,
1012,
23911,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
<?php
namespace Livraria\Entity;
use Doctrine\ORM\Mapping as ORM;
use Doctrine\Common\Collections\ArrayCollection;
/**
* @ORM\Entity
* @ORM\Table(name="categorias")
* @ORM\Entity(repositoryClass="Livraria\Entity\CategoriaRepository")
*/
class Categoria {
public function __construct($options = null) {
Configurator::configure($this, $options);
$this->livros = new ArrayCollection();
}
/**
* @ORM\Id
* @ORM\Column(type="integer")
* @ORM\GeneratedValue
* @var int
*/
protected $id;
/**
* @ORM\Column(type="text")
* @var string
*/
protected $nome;
/**
* @ORM\OneToMany(targetEntity="Livraria\Entity\Livro", mappedBy="categoria")
* @var type
*/
protected $livros;
public function getId() {
return $this->id;
}
public function getNome() {
return $this->nome;
}
public function setId($id) {
$this->id = $id;
}
public function setNome($nome) {
$this->nome = $nome;
}
public function __toString() {
return $this->nome;
}
public function toArray(){
return array('id' => $this->getId(), 'nome' => $this->getNome() );
}
public function getLivros(){
return $this->livros;
}
}
| gilsonDNA/cursoZF2Basico | module/Livraria/src/Livraria/Entity/Categoria.php | PHP | bsd-3-clause | 1,326 | [
30522,
1026,
1029,
25718,
3415,
15327,
22135,
19848,
2401,
1032,
9178,
1025,
2224,
8998,
1032,
2030,
2213,
1032,
12375,
2004,
2030,
2213,
1025,
2224,
8998,
1032,
2691,
1032,
6407,
1032,
9140,
26895,
18491,
1025,
1013,
1008,
1008,
1008,
1030... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
//
// TestWindow.h
// test_jobQuestions
//
// Created by 张净南 on 2018/9/19.
// Copyright © 2018年 Jingnan Zhang. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface TestWindow : UIWindow
@end
| zxpLearnios/test_jobQuestions | test_jobQuestions/TestFolder/测试window/TestWindow.h | C | mit | 213 | [
30522,
1013,
1013,
1013,
1013,
3231,
11101,
5004,
1012,
1044,
1013,
1013,
3231,
1035,
3105,
15500,
8496,
1013,
1013,
1013,
1013,
2580,
2011,
100,
100,
1785,
2006,
2760,
1013,
1023,
1013,
2539,
1012,
1013,
1013,
9385,
1075,
2760,
1840,
215... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
/*
* Licensed to Elasticsearch under one or more contributor
* license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright
* ownership. Elasticsearch licenses this file to you 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.
*/
package org.elasticsearch.cluster.coordination;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.apache.logging.log4j.message.ParameterizedMessage;
import org.elasticsearch.cluster.coordination.Coordinator.Mode;
import org.elasticsearch.cluster.node.DiscoveryNode;
import org.elasticsearch.cluster.node.DiscoveryNodes;
import org.elasticsearch.common.io.stream.StreamInput;
import org.elasticsearch.common.io.stream.StreamOutput;
import org.elasticsearch.common.settings.Setting;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.common.unit.TimeValue;
import org.elasticsearch.common.util.concurrent.AbstractRunnable;
import org.elasticsearch.monitor.NodeHealthService;
import org.elasticsearch.monitor.StatusInfo;
import org.elasticsearch.threadpool.ThreadPool.Names;
import org.elasticsearch.transport.ConnectTransportException;
import org.elasticsearch.transport.Transport;
import org.elasticsearch.transport.TransportChannel;
import org.elasticsearch.transport.TransportConnectionListener;
import org.elasticsearch.transport.TransportException;
import org.elasticsearch.transport.TransportRequest;
import org.elasticsearch.transport.TransportRequestOptions;
import org.elasticsearch.transport.TransportRequestOptions.Type;
import org.elasticsearch.transport.TransportResponse;
import org.elasticsearch.transport.TransportResponse.Empty;
import org.elasticsearch.transport.TransportResponseHandler;
import org.elasticsearch.transport.TransportService;
import java.io.IOException;
import java.util.HashSet;
import java.util.Map;
import java.util.Objects;
import java.util.Set;
import java.util.function.BiConsumer;
import java.util.function.Consumer;
import java.util.function.Predicate;
import static org.elasticsearch.common.util.concurrent.ConcurrentCollections.newConcurrentMap;
import static org.elasticsearch.monitor.StatusInfo.Status.UNHEALTHY;
/**
* The FollowersChecker is responsible for allowing a leader to check that its followers are still connected and healthy. On deciding that a
* follower has failed the leader will remove it from the cluster. We are fairly lenient, possibly allowing multiple checks to fail before
* considering a follower to be faulty, to allow for a brief network partition or a long GC cycle to occur without triggering the removal of
* a node and the consequent shard reallocation.
*/
public class FollowersChecker {
private static final Logger logger = LogManager.getLogger(FollowersChecker.class);
public static final String FOLLOWER_CHECK_ACTION_NAME = "internal:coordination/fault_detection/follower_check";
// the time between checks sent to each node
public static final Setting<TimeValue> FOLLOWER_CHECK_INTERVAL_SETTING =
Setting.timeSetting("cluster.fault_detection.follower_check.interval",
TimeValue.timeValueMillis(1000), TimeValue.timeValueMillis(100), Setting.Property.NodeScope);
// the timeout for each check sent to each node
public static final Setting<TimeValue> FOLLOWER_CHECK_TIMEOUT_SETTING =
Setting.timeSetting("cluster.fault_detection.follower_check.timeout",
TimeValue.timeValueMillis(10000), TimeValue.timeValueMillis(1), Setting.Property.NodeScope);
// the number of failed checks that must happen before the follower is considered to have failed.
public static final Setting<Integer> FOLLOWER_CHECK_RETRY_COUNT_SETTING =
Setting.intSetting("cluster.fault_detection.follower_check.retry_count", 3, 1, Setting.Property.NodeScope);
private final TimeValue followerCheckInterval;
private final TimeValue followerCheckTimeout;
private final int followerCheckRetryCount;
private final BiConsumer<DiscoveryNode, String> onNodeFailure;
private final Consumer<FollowerCheckRequest> handleRequestAndUpdateState;
private final Object mutex = new Object(); // protects writes to this state; read access does not need sync
private final Map<DiscoveryNode, FollowerChecker> followerCheckers = newConcurrentMap();
private final Set<DiscoveryNode> faultyNodes = new HashSet<>();
private final TransportService transportService;
private final NodeHealthService nodeHealthService;
private volatile FastResponseState fastResponseState;
public FollowersChecker(Settings settings, TransportService transportService,
Consumer<FollowerCheckRequest> handleRequestAndUpdateState,
BiConsumer<DiscoveryNode, String> onNodeFailure, NodeHealthService nodeHealthService) {
this.transportService = transportService;
this.handleRequestAndUpdateState = handleRequestAndUpdateState;
this.onNodeFailure = onNodeFailure;
this.nodeHealthService = nodeHealthService;
followerCheckInterval = FOLLOWER_CHECK_INTERVAL_SETTING.get(settings);
followerCheckTimeout = FOLLOWER_CHECK_TIMEOUT_SETTING.get(settings);
followerCheckRetryCount = FOLLOWER_CHECK_RETRY_COUNT_SETTING.get(settings);
updateFastResponseState(0, Mode.CANDIDATE);
transportService.registerRequestHandler(FOLLOWER_CHECK_ACTION_NAME, Names.SAME, false, false, FollowerCheckRequest::new,
(request, transportChannel, task) -> handleFollowerCheck(request, transportChannel));
transportService.addConnectionListener(new TransportConnectionListener() {
@Override
public void onNodeDisconnected(DiscoveryNode node, Transport.Connection connection) {
handleDisconnectedNode(node);
}
});
}
/**
* Update the set of known nodes, starting to check any new ones and stopping checking any previously-known-but-now-unknown ones.
*/
public void setCurrentNodes(DiscoveryNodes discoveryNodes) {
synchronized (mutex) {
final Predicate<DiscoveryNode> isUnknownNode = n -> discoveryNodes.nodeExists(n) == false;
followerCheckers.keySet().removeIf(isUnknownNode);
faultyNodes.removeIf(isUnknownNode);
discoveryNodes.mastersFirstStream().forEach(discoveryNode -> {
if (discoveryNode.equals(discoveryNodes.getLocalNode()) == false
&& followerCheckers.containsKey(discoveryNode) == false
&& faultyNodes.contains(discoveryNode) == false) {
final FollowerChecker followerChecker = new FollowerChecker(discoveryNode);
followerCheckers.put(discoveryNode, followerChecker);
followerChecker.start();
}
});
}
}
/**
* Clear the set of known nodes, stopping all checks.
*/
public void clearCurrentNodes() {
setCurrentNodes(DiscoveryNodes.EMPTY_NODES);
}
/**
* The system is normally in a state in which every follower remains a follower of a stable leader in a single term for an extended
* period of time, and therefore our response to every follower check is the same. We handle this case with a single volatile read
* entirely on the network thread, and only if the fast path fails do we perform some work in the background, by notifying the
* FollowersChecker whenever our term or mode changes here.
*/
public void updateFastResponseState(final long term, final Mode mode) {
fastResponseState = new FastResponseState(term, mode);
}
private void handleFollowerCheck(FollowerCheckRequest request, TransportChannel transportChannel) throws IOException {
final StatusInfo statusInfo = nodeHealthService.getHealth();
if (statusInfo.getStatus() == UNHEALTHY) {
final String message
= "handleFollowerCheck: node is unhealthy [" + statusInfo.getInfo() + "], rejecting " + statusInfo.getInfo();
logger.debug(message);
throw new NodeHealthCheckFailureException(message);
}
final FastResponseState responder = this.fastResponseState;
if (responder.mode == Mode.FOLLOWER && responder.term == request.term) {
logger.trace("responding to {} on fast path", request);
transportChannel.sendResponse(Empty.INSTANCE);
return;
}
if (request.term < responder.term) {
throw new CoordinationStateRejectedException("rejecting " + request + " since local state is " + this);
}
transportService.getThreadPool().generic().execute(new AbstractRunnable() {
@Override
protected void doRun() throws IOException {
logger.trace("responding to {} on slow path", request);
try {
handleRequestAndUpdateState.accept(request);
} catch (Exception e) {
transportChannel.sendResponse(e);
return;
}
transportChannel.sendResponse(Empty.INSTANCE);
}
@Override
public void onFailure(Exception e) {
logger.debug(new ParameterizedMessage("exception while responding to {}", request), e);
}
@Override
public String toString() {
return "slow path response to " + request;
}
});
}
/**
* @return nodes in the current cluster state which have failed their follower checks.
*/
public Set<DiscoveryNode> getFaultyNodes() {
synchronized (mutex) {
return new HashSet<>(this.faultyNodes);
}
}
@Override
public String toString() {
return "FollowersChecker{" +
"followerCheckInterval=" + followerCheckInterval +
", followerCheckTimeout=" + followerCheckTimeout +
", followerCheckRetryCount=" + followerCheckRetryCount +
", followerCheckers=" + followerCheckers +
", faultyNodes=" + faultyNodes +
", fastResponseState=" + fastResponseState +
'}';
}
// For assertions
FastResponseState getFastResponseState() {
return fastResponseState;
}
// For assertions
Set<DiscoveryNode> getKnownFollowers() {
synchronized (mutex) {
final Set<DiscoveryNode> knownFollowers = new HashSet<>(faultyNodes);
knownFollowers.addAll(followerCheckers.keySet());
return knownFollowers;
}
}
private void handleDisconnectedNode(DiscoveryNode discoveryNode) {
FollowerChecker followerChecker = followerCheckers.get(discoveryNode);
if (followerChecker != null) {
followerChecker.failNode("disconnected");
}
}
static class FastResponseState {
final long term;
final Mode mode;
FastResponseState(final long term, final Mode mode) {
this.term = term;
this.mode = mode;
}
@Override
public String toString() {
return "FastResponseState{" +
"term=" + term +
", mode=" + mode +
'}';
}
}
/**
* A checker for an individual follower.
*/
private class FollowerChecker {
private final DiscoveryNode discoveryNode;
private int failureCountSinceLastSuccess;
FollowerChecker(DiscoveryNode discoveryNode) {
this.discoveryNode = discoveryNode;
}
private boolean running() {
return this == followerCheckers.get(discoveryNode);
}
void start() {
assert running();
handleWakeUp();
}
private void handleWakeUp() {
if (running() == false) {
logger.trace("handleWakeUp: not running");
return;
}
final FollowerCheckRequest request = new FollowerCheckRequest(fastResponseState.term, transportService.getLocalNode());
logger.trace("handleWakeUp: checking {} with {}", discoveryNode, request);
transportService.sendRequest(discoveryNode, FOLLOWER_CHECK_ACTION_NAME, request,
TransportRequestOptions.of(followerCheckTimeout, Type.PING),
new TransportResponseHandler.Empty() {
@Override
public void handleResponse(TransportResponse.Empty response) {
if (running() == false) {
logger.trace("{} no longer running", FollowerChecker.this);
return;
}
failureCountSinceLastSuccess = 0;
logger.trace("{} check successful", FollowerChecker.this);
scheduleNextWakeUp();
}
@Override
public void handleException(TransportException exp) {
if (running() == false) {
logger.debug(new ParameterizedMessage("{} no longer running", FollowerChecker.this), exp);
return;
}
failureCountSinceLastSuccess++;
final String reason;
if (exp instanceof ConnectTransportException
|| exp.getCause() instanceof ConnectTransportException) {
logger.debug(() -> new ParameterizedMessage("{} disconnected", FollowerChecker.this), exp);
reason = "disconnected";
} else if (exp.getCause() instanceof NodeHealthCheckFailureException) {
logger.debug(() -> new ParameterizedMessage("{} health check failed", FollowerChecker.this), exp);
reason = "health check failed";
} else if (failureCountSinceLastSuccess >= followerCheckRetryCount) {
logger.debug(() -> new ParameterizedMessage("{} failed too many times", FollowerChecker.this), exp);
reason = "followers check retry count exceeded";
} else {
logger.debug(() -> new ParameterizedMessage("{} failed, retrying", FollowerChecker.this), exp);
scheduleNextWakeUp();
return;
}
failNode(reason);
}
});
}
void failNode(String reason) {
transportService.getThreadPool().generic().execute(new Runnable() {
@Override
public void run() {
synchronized (mutex) {
if (running() == false) {
logger.trace("{} no longer running, not marking faulty", FollowerChecker.this);
return;
}
logger.debug("{} marking node as faulty", FollowerChecker.this);
faultyNodes.add(discoveryNode);
followerCheckers.remove(discoveryNode);
}
onNodeFailure.accept(discoveryNode, reason);
}
@Override
public String toString() {
return "detected failure of " + discoveryNode;
}
});
}
private void scheduleNextWakeUp() {
transportService.getThreadPool().schedule(new Runnable() {
@Override
public void run() {
handleWakeUp();
}
@Override
public String toString() {
return FollowerChecker.this + "::handleWakeUp";
}
}, followerCheckInterval, Names.SAME);
}
@Override
public String toString() {
return "FollowerChecker{" +
"discoveryNode=" + discoveryNode +
", failureCountSinceLastSuccess=" + failureCountSinceLastSuccess +
", [" + FOLLOWER_CHECK_RETRY_COUNT_SETTING.getKey() + "]=" + followerCheckRetryCount +
'}';
}
}
public static class FollowerCheckRequest extends TransportRequest {
private final long term;
private final DiscoveryNode sender;
public long getTerm() {
return term;
}
public DiscoveryNode getSender() {
return sender;
}
public FollowerCheckRequest(final long term, final DiscoveryNode sender) {
this.term = term;
this.sender = sender;
}
public FollowerCheckRequest(final StreamInput in) throws IOException {
super(in);
term = in.readLong();
sender = new DiscoveryNode(in);
}
@Override
public void writeTo(final StreamOutput out) throws IOException {
super.writeTo(out);
out.writeLong(term);
sender.writeTo(out);
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
FollowerCheckRequest that = (FollowerCheckRequest) o;
return term == that.term &&
Objects.equals(sender, that.sender);
}
@Override
public String toString() {
return "FollowerCheckRequest{" +
"term=" + term +
", sender=" + sender +
'}';
}
@Override
public int hashCode() {
return Objects.hash(term, sender);
}
}
}
| nknize/elasticsearch | server/src/main/java/org/elasticsearch/cluster/coordination/FollowersChecker.java | Java | apache-2.0 | 18,544 | [
30522,
1013,
1008,
1008,
7000,
2000,
21274,
17310,
11140,
2104,
2028,
2030,
2062,
12130,
1008,
6105,
10540,
1012,
2156,
1996,
5060,
5371,
5500,
2007,
1008,
2023,
2147,
2005,
3176,
2592,
4953,
9385,
1008,
6095,
1012,
21274,
17310,
11140,
159... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
/*******************************************************************************
* Copyright 2009 Regents of the University of Minnesota. All rights
* reserved.
* Copyright 2009 Mayo Foundation for Medical Education and Research.
* All rights reserved.
*
* This program is made available under the terms of the Eclipse
* Public License v1.0 which accompanies this distribution,
* and is available at http://www.eclipse.org/legal/epl-v10.html
*
* 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 INCLUDING, WITHOUT LIMITATION, ANY WARRANTIES OR CONDITIONS
* OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A
* PARTICULAR PURPOSE. See the License for the specific language
* governing permissions and limitations under the License.
*
* Contributors:
* Minnesota Supercomputing Institute - initial API and implementation
******************************************************************************/
package edu.umn.msi.tropix.persistence.service;
import javax.annotation.Nullable;
import edu.umn.msi.tropix.models.ITraqQuantitationAnalysis;
import edu.umn.msi.tropix.persistence.aop.Modifies;
import edu.umn.msi.tropix.persistence.aop.PersistenceMethod;
import edu.umn.msi.tropix.persistence.aop.Reads;
import edu.umn.msi.tropix.persistence.aop.UserId;
public interface ITraqQuantitationAnalysisService {
@PersistenceMethod
ITraqQuantitationAnalysis createQuantitationAnalysis(@UserId String userId, @Nullable @Modifies String destinationId, ITraqQuantitationAnalysis quantitationAnalysis, @Modifies String dataReportId, @Reads String[] inputRunIds, @Nullable @Reads String trainingId, @Modifies String outputFileId);
}
| jmchilton/TINT | projects/TropixPersistence/src/service-api/edu/umn/msi/tropix/persistence/service/ITraqQuantitationAnalysisService.java | Java | epl-1.0 | 1,827 | [
30522,
1013,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
100... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
import { HookContext, Application, createContext, getServiceOptions } from '@feathersjs/feathers';
import { NotFound, MethodNotAllowed, BadRequest } from '@feathersjs/errors';
import { createDebug } from '@feathersjs/commons';
import isEqual from 'lodash/isEqual';
import { CombinedChannel } from '../channels/channel/combined';
import { RealTimeConnection } from '../channels/channel/base';
const debug = createDebug('@feathersjs/transport-commons');
export const DEFAULT_PARAMS_POSITION = 1;
export const paramsPositions: { [key: string]: number } = {
find: 0,
update: 2,
patch: 2
};
export function normalizeError (e: any) {
const hasToJSON = typeof e.toJSON === 'function';
const result = hasToJSON ? e.toJSON() : {};
if (!hasToJSON) {
Object.getOwnPropertyNames(e).forEach(key => {
result[key] = e[key];
});
}
if (process.env.NODE_ENV === 'production') {
delete result.stack;
}
delete result.hook;
return result;
}
export function getDispatcher (emit: string, socketMap: WeakMap<RealTimeConnection, any>, socketKey?: any) {
return function (event: string, channel: CombinedChannel, context: HookContext, data?: any) {
debug(`Dispatching '${event}' to ${channel.length} connections`);
channel.connections.forEach(connection => {
// The reference between connection and socket is set in `app.setup`
const socket = socketKey ? connection[socketKey] : socketMap.get(connection);
if (socket) {
const eventName = `${context.path || ''} ${event}`.trim();
let result = channel.dataFor(connection) || context.dispatch || context.result;
// If we are getting events from an array but try to dispatch individual data
// try to get the individual item to dispatch from the correct index.
if (!Array.isArray(data) && Array.isArray(context.result) && Array.isArray(result)) {
result = context.result.find(resultData => isEqual(resultData, data));
}
debug(`Dispatching '${eventName}' to Socket ${socket.id} with`, result);
socket[emit](eventName, result);
}
});
};
}
export async function runMethod (app: Application, connection: RealTimeConnection, path: string, method: string, args: any[]) {
const trace = `method '${method}' on service '${path}'`;
const methodArgs = args.slice(0);
const callback = typeof methodArgs[methodArgs.length - 1] === 'function'
? methodArgs.pop() : function () {};
debug(`Running ${trace}`, connection, args);
const handleError = (error: any) => {
debug(`Error in ${trace}`, error);
callback(normalizeError(error));
};
try {
const lookup = app.lookup(path);
// No valid service was found throw a NotFound error
if (lookup === null) {
throw new NotFound(`Service '${path}' not found`);
}
const { service, params: route = {} } = lookup;
const { methods } = getServiceOptions(service);
// Only service methods are allowed
if (!methods.includes(method)) {
throw new MethodNotAllowed(`Method '${method}' not allowed on service '${path}'`);
}
const position = paramsPositions[method] !== undefined ? paramsPositions[method] : DEFAULT_PARAMS_POSITION;
const query = methodArgs[position] || {};
// `params` have to be re-mapped to the query and added with the route
const params = Object.assign({ query, route, connection }, connection);
// `params` is always the last parameter. Error if we got more arguments.
if (methodArgs.length > (position + 1)) {
throw new BadRequest(`Too many arguments for '${method}' method`);
}
methodArgs[position] = params;
const ctx = createContext(service, method);
const returnedCtx: HookContext = await (service as any)[method](...methodArgs, ctx);
const result = returnedCtx.dispatch || returnedCtx.result;
debug(`Returned successfully ${trace}`, result);
callback(null, result);
} catch (error: any) {
handleError(error);
}
}
| feathersjs/feathers | packages/transport-commons/src/socket/utils.ts | TypeScript | mit | 3,996 | [
30522,
12324,
1063,
8103,
8663,
18209,
1010,
4646,
1010,
3443,
8663,
18209,
1010,
4152,
2121,
7903,
8780,
16790,
2015,
1065,
2013,
1005,
1030,
12261,
22578,
1013,
12261,
1005,
1025,
12324,
1063,
2025,
14876,
8630,
1010,
4118,
17048,
8095,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
var playersController = exports; exports.constructor = function playersController(){};
var _ = require('lodash');
var players = require('../sonos/players');
playersController.list = function(req, res, next) {
players.client.find(function(err, players) {
if (err) {
return next(err);
}
res.send(players);
});
};
playersController.get = function(req, res, next) {
players.client.find(req.params.name, function(err, players) {
if (err) {
return next(err);
}
if (!players || players.length < 1) {
err = new Error('The requested player could not be found');
err.type = 'not found';
return next(err);
}
// only return the one item
res.send(players[0]);
});
};
playersController.queue = function(req, res, next) {
players.client.queue(req.params.name, req.query, function(err, queue) {
if (err) {
return next(err);
}
res.send({
roomName: req.params.name,
currentIndex: queue.currentIndex,
limit: queue.limit,
offset: queue.offset,
tracks: queue.tracks
});
});
};
playersController.clearQueue = function(req, res, next) {
players.client.clearQueue(req.params.name, function(err, queue) {
if (err) {
return next(err);
}
res.send({
roomName: req.params.name,
currentIndex: queue.currentIndex,
limit: queue.limit,
offset: queue.offset,
tracks: queue.tracks
});
});
};
playersController.playlists = function(req, res, next) {
players.client.playlists(req.params.name, function(err, playlists) {
if (err) {
return next(err);
}
res.send({
roomName: req.params.name,
playlists: playlists
});
});
};
playersController.action = function(req, res, next) {
var action = req.params.action;
var playerName = req.params.name;
var opts = _.extend({}, req.body, req.query);
players.client.action(playerName, action, opts, function(err, state) {
if (err) {
return next(err);
}
res.send(state);
});
};
| jeffandersen/sonos-rest-api | lib/controllers/players.js | JavaScript | mit | 2,043 | [
30522,
13075,
2867,
8663,
13181,
10820,
1027,
14338,
1025,
14338,
1012,
9570,
2953,
1027,
3853,
2867,
8663,
13181,
10820,
1006,
1007,
1063,
1065,
1025,
13075,
1035,
1027,
5478,
1006,
1005,
8840,
8883,
2232,
1005,
1007,
1025,
13075,
2867,
10... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
/*
* #%L
* GwtMaterial
* %%
* Copyright (C) 2015 - 2018 GwtMaterialDesign
* %%
* 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.
* #L%
*/
package gwt.material.design.incubator.client.keyboard.events;
import com.google.gwt.event.shared.EventHandler;
import com.google.gwt.event.shared.GwtEvent;
import com.google.gwt.event.shared.HasHandlers;
//@formatter:off
/**
* Executes the callback function on input change. Returns the current input’s string.
*
* @author kevzlou7979
*/
public class ChangeEvent extends GwtEvent<ChangeEvent.ChangeHandler> {
public static final Type<ChangeHandler> TYPE = new Type<>();
private String input;
public ChangeEvent(String input) {
this.input = input;
}
public static Type<ChangeHandler> getType() {
return TYPE;
}
public static void fire(HasHandlers source, String message) {
source.fireEvent(new ChangeEvent(message));
}
@Override
public Type<ChangeHandler> getAssociatedType() {
return TYPE;
}
@Override
protected void dispatch(ChangeHandler handler) {
handler.onChange(this);
}
public String getInput() {
return input;
}
public interface ChangeHandler extends EventHandler {
void onChange(ChangeEvent event);
}
}
| GwtMaterialDesign/gwt-material-addins | src/main/java/gwt/material/design/incubator/client/keyboard/events/ChangeEvent.java | Java | apache-2.0 | 1,811 | [
30522,
1013,
1008,
1008,
1001,
1003,
1048,
1008,
1043,
26677,
8585,
14482,
1008,
1003,
1003,
1008,
9385,
1006,
1039,
1007,
2325,
1011,
2760,
1043,
26677,
8585,
14482,
6155,
23773,
1008,
1003,
1003,
1008,
7000,
2104,
1996,
15895,
6105,
1010,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
package nachos.ag;
import java.util.Vector;
import nachos.machine.Lib;
import nachos.machine.Machine;
import nachos.threads.Communicator;
import nachos.threads.KThread;
import nachos.threads.RoundRobinScheduler;
import nachos.threads.ThreadedKernel;
/**
* <li>ThreadGrader2: <b>Communicator</b><br>
* <ol type=a>
* <li>Test ThreadGrader2.a: Tests your communicator
* <li>Test ThreadGrader2.b: Tests your communicator, with more
* speakers/listeners
* <li>Test ThreadGrader2.c: Tests your communicator, with more
* speakers/listneers, and transmits more messages
* </ol>
* </li>
*
* @author Isaac
*
*/
public class ThreadGrader2 extends BasicTestGrader
{
static int total = 0;
static int totalMax = 100;
static int count = 0;
static Vector<Integer> list = new Vector<Integer>();
public void run ()
{
assertTrue(ThreadedKernel.scheduler instanceof RoundRobinScheduler,
"this test requires roundrobin scheduler");
com = new Communicator();
/* Test ThreadGrader2.a: Tests your communicator */
total = 1;
count = 0;
list.clear();
forkNewThread(new a(111));
forkNewThread(new b());
while (count != total)
{
assertTrue(Machine.timer().getTime() < 2000,
"Too many ticks wasted on \nTest ThreadGrader2.a");
KThread.yield();
}
/*
* Test ThreadGrader2.b: Tests your communicator, with more
* speakers/listeners
*/
total = 2;
count = 0;
forkNewThread(new a(111));
forkNewThread(new a(222));
forkNewThread(new b());
forkNewThread(new b());
while (count != total)
{
assertTrue(Machine.timer().getTime() < 2000,
"Too many ticks wasted on \nTest ThreadGrader2.b");
KThread.yield();
}
/*
* Test ThreadGrader2.c: Tests your communicator, with more
* speakers/listneers, and transmits more messages
*/
total = 50;
count = 0;
int na = 0, nb = 0;
for (int i = 0; i < total * 2; ++i)
{
int tmp = Lib.random(2);
if (tmp == 0)
{
++na;
forkNewThread(new a(i));
}
else
{
++nb;
forkNewThread(new b());
}
}
if (na < nb)
{
for (int i = 0; i < nb - na; ++i)
forkNewThread(new a(i + total * 2));
}
else if (na > nb)
{
for (int i = 0; i < na - nb; ++i)
forkNewThread(new b());
}
while (count != total)
{
assertTrue(Machine.timer().getTime() < 10000,
"Too many ticks wasted on \nTest ThreadGrader2.c");
KThread.yield();
}
done();
}
private Communicator com = null;
private class a implements Runnable
{
int word;
public a (int word)
{
this.word = word;
}
public void run ()
{
list.add(word);
com.speak(word);
// System.out.println(KThread.currentThread() + " say " + word);
}
}
private class b implements Runnable
{
public void run ()
{
int w = com.listen();
assertTrue(list.contains(new Integer(w)), "unknown message received");
list.remove(new Integer(w));
// System.out.println(KThread.currentThread() + " listened "
// + com.listen());
++count;
}
}
}
| w1ndy/tripping-dangerzone | nachos/ag/ThreadGrader2.java | Java | mit | 3,254 | [
30522,
7427,
6583,
9905,
2015,
1012,
12943,
1025,
12324,
9262,
1012,
21183,
4014,
1012,
9207,
1025,
12324,
6583,
9905,
2015,
1012,
3698,
1012,
5622,
2497,
1025,
12324,
6583,
9905,
2015,
1012,
3698,
1012,
3698,
1025,
12324,
6583,
9905,
2015,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
/**
* Encodes and decodes to and from Base64 notation.
*
* <p>
* Change Log:
* </p>
* <ul>
* <li>v2.1 - Cleaned up javadoc comments and unused variables and methods. Added
* some convenience methods for reading and writing to and from files.</li>
* <li>v2.0.2 - Now specifies UTF-8 encoding in places where the code fails on systems
* with other encodings (like EBCDIC).</li>
* <li>v2.0.1 - Fixed an error when decoding a single byte, that is, when the
* encoded data was a single byte.</li>
* <li>v2.0 - I got rid of methods that used booleans to set options.
* Now everything is more consolidated and cleaner. The code now detects
* when data that's being decoded is gzip-compressed and will decompress it
* automatically. Generally things are cleaner. You'll probably have to
* change some method calls that you were making to support the new
* options format (<tt>int</tt>s that you "OR" together).</li>
* <li>v1.5.1 - Fixed bug when decompressing and decoding to a
* byte[] using <tt>decode( String s, boolean gzipCompressed )</tt>.
* Added the ability to "suspend" encoding in the Output Stream so
* you can turn on and off the encoding if you need to embed base64
* data in an otherwise "normal" stream (like an XML file).</li>
* <li>v1.5 - Output stream pases on flush() command but doesn't do anything itself.
* This helps when using GZIP streams.
* Added the ability to GZip-compress objects before encoding them.</li>
* <li>v1.4 - Added helper methods to read/write files.</li>
* <li>v1.3.6 - Fixed OutputStream.flush() so that 'position' is reset.</li>
* <li>v1.3.5 - Added flag to turn on and off line breaks. Fixed bug in input stream
* where last buffer being read, if not completely full, was not returned.</li>
* <li>v1.3.4 - Fixed when "improperly padded stream" error was thrown at the wrong time.</li>
* <li>v1.3.3 - Fixed I/O streams which were totally messed up.</li>
* </ul>
*
* <p>
* I am placing this code in the Public Domain. Do with it as you will.
* This software comes with no guarantees or warranties but with
* plenty of well-wishing instead!
* Please visit <a href="http://iharder.net/base64">http://iharder.net/base64</a>
* periodically to check for updates or to contribute improvements.
* </p>
*
* @author Robert Harder
* @author rob@iharder.net
* @version 2.1
*/
public class Base64
{
/* ******** P U B L I C F I E L D S ******** */
/** No options specified. Value is zero. */
public final static int NO_OPTIONS = 0;
/** Specify encoding. */
public final static int ENCODE = 1;
/** Specify decoding. */
public final static int DECODE = 0;
/** Specify that data should be gzip-compressed. */
public final static int GZIP = 2;
/** Don't break lines when encoding (violates strict Base64 specification) */
public final static int DONT_BREAK_LINES = 8;
/* ******** P R I V A T E F I E L D S ******** */
/** Maximum line length (76) of Base64 output. */
private final static int MAX_LINE_LENGTH = 76;
/** The equals sign (=) as a byte. */
private final static byte EQUALS_SIGN = (byte)'=';
/** The new line character (\n) as a byte. */
private final static byte NEW_LINE = (byte)'\n';
/** Preferred encoding. */
private final static String PREFERRED_ENCODING = "UTF-8";
/** The 64 valid Base64 values. */
private final static byte[] ALPHABET;
private final static byte[] _NATIVE_ALPHABET = /* May be something funny like EBCDIC */
{
(byte)'A', (byte)'B', (byte)'C', (byte)'D', (byte)'E', (byte)'F', (byte)'G',
(byte)'H', (byte)'I', (byte)'J', (byte)'K', (byte)'L', (byte)'M', (byte)'N',
(byte)'O', (byte)'P', (byte)'Q', (byte)'R', (byte)'S', (byte)'T', (byte)'U',
(byte)'V', (byte)'W', (byte)'X', (byte)'Y', (byte)'Z',
(byte)'a', (byte)'b', (byte)'c', (byte)'d', (byte)'e', (byte)'f', (byte)'g',
(byte)'h', (byte)'i', (byte)'j', (byte)'k', (byte)'l', (byte)'m', (byte)'n',
(byte)'o', (byte)'p', (byte)'q', (byte)'r', (byte)'s', (byte)'t', (byte)'u',
(byte)'v', (byte)'w', (byte)'x', (byte)'y', (byte)'z',
(byte)'0', (byte)'1', (byte)'2', (byte)'3', (byte)'4', (byte)'5',
(byte)'6', (byte)'7', (byte)'8', (byte)'9', (byte)'+', (byte)'/'
};
/** Determine which ALPHABET to use. */
static
{
byte[] __bytes;
try
{
__bytes = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".getBytes( PREFERRED_ENCODING );
} // end try
catch (java.io.UnsupportedEncodingException use)
{
__bytes = _NATIVE_ALPHABET; // Fall back to native encoding
} // end catch
ALPHABET = __bytes;
} // end static
/**
* Translates a Base64 value to either its 6-bit reconstruction value
* or a negative number indicating some other meaning.
**/
private final static byte[] DECODABET =
{
-9,-9,-9,-9,-9,-9,-9,-9,-9, // Decimal 0 - 8
-5,-5, // Whitespace: Tab and Linefeed
-9,-9, // Decimal 11 - 12
-5, // Whitespace: Carriage Return
-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9, // Decimal 14 - 26
-9,-9,-9,-9,-9, // Decimal 27 - 31
-5, // Whitespace: Space
-9,-9,-9,-9,-9,-9,-9,-9,-9,-9, // Decimal 33 - 42
62, // Plus sign at decimal 43
-9,-9,-9, // Decimal 44 - 46
63, // Slash at decimal 47
52,53,54,55,56,57,58,59,60,61, // Numbers zero through nine
-9,-9,-9, // Decimal 58 - 60
-1, // Equals sign at decimal 61
-9,-9,-9, // Decimal 62 - 64
0,1,2,3,4,5,6,7,8,9,10,11,12,13, // Letters 'A' through 'N'
14,15,16,17,18,19,20,21,22,23,24,25, // Letters 'O' through 'Z'
-9,-9,-9,-9,-9,-9, // Decimal 91 - 96
26,27,28,29,30,31,32,33,34,35,36,37,38, // Letters 'a' through 'm'
39,40,41,42,43,44,45,46,47,48,49,50,51, // Letters 'n' through 'z'
-9,-9,-9,-9 // Decimal 123 - 126
/*,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9, // Decimal 127 - 139
-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9, // Decimal 140 - 152
-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9, // Decimal 153 - 165
-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9, // Decimal 166 - 178
-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9, // Decimal 179 - 191
-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9, // Decimal 192 - 204
-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9, // Decimal 205 - 217
-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9, // Decimal 218 - 230
-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9, // Decimal 231 - 243
-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9 // Decimal 244 - 255 */
};
// I think I end up not using the BAD_ENCODING indicator.
//private final static byte BAD_ENCODING = -9; // Indicates error in encoding
private final static byte WHITE_SPACE_ENC = -5; // Indicates white space in encoding
private final static byte EQUALS_SIGN_ENC = -1; // Indicates equals sign in encoding
/** Defeats instantiation. */
private Base64(){}
/* ******** E N C O D I N G M E T H O D S ******** */
/**
* Encodes up to the first three bytes of array <var>threeBytes</var>
* and returns a four-byte array in Base64 notation.
* The actual number of significant bytes in your array is
* given by <var>numSigBytes</var>.
* The array <var>threeBytes</var> needs only be as big as
* <var>numSigBytes</var>.
* Code can reuse a byte array by passing a four-byte array as <var>b4</var>.
*
* @param b4 A reusable byte array to reduce array instantiation
* @param threeBytes the array to convert
* @param numSigBytes the number of significant bytes in your array
* @return four byte array in Base64 notation.
* @since 1.5.1
*/
private static byte[] encode3to4( byte[] b4, byte[] threeBytes, int numSigBytes )
{
encode3to4( threeBytes, 0, numSigBytes, b4, 0 );
return b4;
} // end encode3to4
/**
* Encodes up to three bytes of the array <var>source</var>
* and writes the resulting four Base64 bytes to <var>destination</var>.
* The source and destination arrays can be manipulated
* anywhere along their length by specifying
* <var>srcOffset</var> and <var>destOffset</var>.
* This method does not check to make sure your arrays
* are large enough to accomodate <var>srcOffset</var> + 3 for
* the <var>source</var> array or <var>destOffset</var> + 4 for
* the <var>destination</var> array.
* The actual number of significant bytes in your array is
* given by <var>numSigBytes</var>.
*
* @param source the array to convert
* @param srcOffset the index where conversion begins
* @param numSigBytes the number of significant bytes in your array
* @param destination the array to hold the conversion
* @param destOffset the index where output will be put
* @return the <var>destination</var> array
* @since 1.3
*/
private static byte[] encode3to4(
byte[] source, int srcOffset, int numSigBytes,
byte[] destination, int destOffset )
{
// 1 2 3
// 01234567890123456789012345678901 Bit position
// --------000000001111111122222222 Array position from threeBytes
// --------| || || || | Six bit groups to index ALPHABET
// >>18 >>12 >> 6 >> 0 Right shift necessary
// 0x3f 0x3f 0x3f Additional AND
// Create buffer with zero-padding if there are only one or two
// significant bytes passed in the array.
// We have to shift left 24 in order to flush out the 1's that appear
// when Java treats a value as negative that is cast from a byte to an int.
int inBuff = ( numSigBytes > 0 ? ((source[ srcOffset ] << 24) >>> 8) : 0 )
| ( numSigBytes > 1 ? ((source[ srcOffset + 1 ] << 24) >>> 16) : 0 )
| ( numSigBytes > 2 ? ((source[ srcOffset + 2 ] << 24) >>> 24) : 0 );
switch( numSigBytes )
{
case 3:
destination[ destOffset ] = ALPHABET[ (inBuff >>> 18) ];
destination[ destOffset + 1 ] = ALPHABET[ (inBuff >>> 12) & 0x3f ];
destination[ destOffset + 2 ] = ALPHABET[ (inBuff >>> 6) & 0x3f ];
destination[ destOffset + 3 ] = ALPHABET[ (inBuff ) & 0x3f ];
return destination;
case 2:
destination[ destOffset ] = ALPHABET[ (inBuff >>> 18) ];
destination[ destOffset + 1 ] = ALPHABET[ (inBuff >>> 12) & 0x3f ];
destination[ destOffset + 2 ] = ALPHABET[ (inBuff >>> 6) & 0x3f ];
destination[ destOffset + 3 ] = EQUALS_SIGN;
return destination;
case 1:
destination[ destOffset ] = ALPHABET[ (inBuff >>> 18) ];
destination[ destOffset + 1 ] = ALPHABET[ (inBuff >>> 12) & 0x3f ];
destination[ destOffset + 2 ] = EQUALS_SIGN;
destination[ destOffset + 3 ] = EQUALS_SIGN;
return destination;
default:
return destination;
} // end switch
} // end encode3to4
/**
* Serializes an object and returns the Base64-encoded
* version of that serialized object. If the object
* cannot be serialized or there is another error,
* the method will return <tt>null</tt>.
* The object is not GZip-compressed before being encoded.
*
* @param serializableObject The object to encode
* @return The Base64-encoded object
* @since 1.4
*/
public static String encodeObject( java.io.Serializable serializableObject )
{
return encodeObject( serializableObject, NO_OPTIONS );
} // end encodeObject
/**
* Serializes an object and returns the Base64-encoded
* version of that serialized object. If the object
* cannot be serialized or there is another error,
* the method will return <tt>null</tt>.
* <p>
* Valid options:<pre>
* GZIP: gzip-compresses object before encoding it.
* DONT_BREAK_LINES: don't break lines at 76 characters
* <i>Note: Technically, this makes your encoding non-compliant.</i>
* </pre>
* <p>
* Example: <code>encodeObject( myObj, Base64.GZIP )</code> or
* <p>
* Example: <code>encodeObject( myObj, Base64.GZIP | Base64.DONT_BREAK_LINES )</code>
*
* @param serializableObject The object to encode
* @param options Specified options
* @return The Base64-encoded object
* @see Base64#GZIP
* @see Base64#DONT_BREAK_LINES
* @since 2.0
*/
public static String encodeObject( java.io.Serializable serializableObject, int options )
{
// Streams
java.io.ByteArrayOutputStream baos = null;
java.io.OutputStream b64os = null;
java.io.ObjectOutputStream oos = null;
java.util.zip.GZIPOutputStream gzos = null;
// Isolate options
int gzip = (options & GZIP);
int dontBreakLines = (options & DONT_BREAK_LINES);
try
{
// ObjectOutputStream -> (GZIP) -> Base64 -> ByteArrayOutputStream
baos = new java.io.ByteArrayOutputStream();
b64os = new Base64.OutputStream( baos, ENCODE | dontBreakLines );
// GZip?
if( gzip == GZIP )
{
gzos = new java.util.zip.GZIPOutputStream( b64os );
oos = new java.io.ObjectOutputStream( gzos );
} // end if: gzip
else
oos = new java.io.ObjectOutputStream( b64os );
oos.writeObject( serializableObject );
} // end try
catch( java.io.IOException e )
{
e.printStackTrace();
return null;
} // end catch
finally
{
try{ oos.close(); } catch( Exception e ){}
try{ gzos.close(); } catch( Exception e ){}
try{ b64os.close(); } catch( Exception e ){}
try{ baos.close(); } catch( Exception e ){}
} // end finally
// Return value according to relevant encoding.
try
{
return new String( baos.toByteArray(), PREFERRED_ENCODING );
} // end try
catch (java.io.UnsupportedEncodingException uue)
{
return new String( baos.toByteArray() );
} // end catch
} // end encode
/**
* Encodes a byte array into Base64 notation.
* Does not GZip-compress data.
*
* @param source The data to convert
* @since 1.4
*/
public static String encodeBytes( byte[] source )
{
return encodeBytes( source, 0, source.length, NO_OPTIONS );
} // end encodeBytes
/**
* Encodes a byte array into Base64 notation.
* <p>
* Valid options:<pre>
* GZIP: gzip-compresses object before encoding it.
* DONT_BREAK_LINES: don't break lines at 76 characters
* <i>Note: Technically, this makes your encoding non-compliant.</i>
* </pre>
* <p>
* Example: <code>encodeBytes( myData, Base64.GZIP )</code> or
* <p>
* Example: <code>encodeBytes( myData, Base64.GZIP | Base64.DONT_BREAK_LINES )</code>
*
*
* @param source The data to convert
* @param options Specified options
* @see Base64#GZIP
* @see Base64#DONT_BREAK_LINES
* @since 2.0
*/
public static String encodeBytes( byte[] source, int options )
{
return encodeBytes( source, 0, source.length, options );
} // end encodeBytes
/**
* Encodes a byte array into Base64 notation.
* Does not GZip-compress data.
*
* @param source The data to convert
* @param off Offset in array where conversion should begin
* @param len Length of data to convert
* @since 1.4
*/
public static String encodeBytes( byte[] source, int off, int len )
{
return encodeBytes( source, off, len, NO_OPTIONS );
} // end encodeBytes
/**
* Encodes a byte array into Base64 notation.
* <p>
* Valid options:<pre>
* GZIP: gzip-compresses object before encoding it.
* DONT_BREAK_LINES: don't break lines at 76 characters
* <i>Note: Technically, this makes your encoding non-compliant.</i>
* </pre>
* <p>
* Example: <code>encodeBytes( myData, Base64.GZIP )</code> or
* <p>
* Example: <code>encodeBytes( myData, Base64.GZIP | Base64.DONT_BREAK_LINES )</code>
*
*
* @param source The data to convert
* @param off Offset in array where conversion should begin
* @param len Length of data to convert
* @param options Specified options
* @see Base64#GZIP
* @see Base64#DONT_BREAK_LINES
* @since 2.0
*/
public static String encodeBytes( byte[] source, int off, int len, int options )
{
// Isolate options
int dontBreakLines = ( options & DONT_BREAK_LINES );
int gzip = ( options & GZIP );
// Compress?
if( gzip == GZIP )
{
java.io.ByteArrayOutputStream baos = null;
java.util.zip.GZIPOutputStream gzos = null;
Base64.OutputStream b64os = null;
try
{
// GZip -> Base64 -> ByteArray
baos = new java.io.ByteArrayOutputStream();
b64os = new Base64.OutputStream( baos, ENCODE | dontBreakLines );
gzos = new java.util.zip.GZIPOutputStream( b64os );
gzos.write( source, off, len );
gzos.close();
} // end try
catch( java.io.IOException e )
{
e.printStackTrace();
return null;
} // end catch
finally
{
try{ gzos.close(); } catch( Exception e ){}
try{ b64os.close(); } catch( Exception e ){}
try{ baos.close(); } catch( Exception e ){}
} // end finally
// Return value according to relevant encoding.
try
{
return new String( baos.toByteArray(), PREFERRED_ENCODING );
} // end try
catch (java.io.UnsupportedEncodingException uue)
{
return new String( baos.toByteArray() );
} // end catch
} // end if: compress
// Else, don't compress. Better not to use streams at all then.
else
{
// Convert option to boolean in way that code likes it.
boolean breakLines = dontBreakLines == 0;
int len43 = len * 4 / 3;
byte[] outBuff = new byte[ ( len43 ) // Main 4:3
+ ( (len % 3) > 0 ? 4 : 0 ) // Account for padding
+ (breakLines ? ( len43 / MAX_LINE_LENGTH ) : 0) ]; // New lines
int d = 0;
int e = 0;
int len2 = len - 2;
int lineLength = 0;
for( ; d < len2; d+=3, e+=4 )
{
encode3to4( source, d+off, 3, outBuff, e );
lineLength += 4;
if( breakLines && lineLength == MAX_LINE_LENGTH )
{
outBuff[e+4] = NEW_LINE;
e++;
lineLength = 0;
} // end if: end of line
} // en dfor: each piece of array
if( d < len )
{
encode3to4( source, d+off, len - d, outBuff, e );
e += 4;
} // end if: some padding needed
// Return value according to relevant encoding.
try
{
return new String( outBuff, 0, e, PREFERRED_ENCODING );
} // end try
catch (java.io.UnsupportedEncodingException uue)
{
return new String( outBuff, 0, e );
} // end catch
} // end else: don't compress
} // end encodeBytes
/* ******** D E C O D I N G M E T H O D S ******** */
/**
* Decodes four bytes from array <var>source</var>
* and writes the resulting bytes (up to three of them)
* to <var>destination</var>.
* The source and destination arrays can be manipulated
* anywhere along their length by specifying
* <var>srcOffset</var> and <var>destOffset</var>.
* This method does not check to make sure your arrays
* are large enough to accomodate <var>srcOffset</var> + 4 for
* the <var>source</var> array or <var>destOffset</var> + 3 for
* the <var>destination</var> array.
* This method returns the actual number of bytes that
* were converted from the Base64 encoding.
*
*
* @param source the array to convert
* @param srcOffset the index where conversion begins
* @param destination the array to hold the conversion
* @param destOffset the index where output will be put
* @return the number of decoded bytes converted
* @since 1.3
*/
private static int decode4to3( byte[] source, int srcOffset, byte[] destination, int destOffset )
{
// Example: Dk==
if( source[ srcOffset + 2] == EQUALS_SIGN )
{
// Two ways to do the same thing. Don't know which way I like best.
//int outBuff = ( ( DECODABET[ source[ srcOffset ] ] << 24 ) >>> 6 )
// | ( ( DECODABET[ source[ srcOffset + 1] ] << 24 ) >>> 12 );
int outBuff = ( ( DECODABET[ source[ srcOffset ] ] & 0xFF ) << 18 )
| ( ( DECODABET[ source[ srcOffset + 1] ] & 0xFF ) << 12 );
destination[ destOffset ] = (byte)( outBuff >>> 16 );
return 1;
}
// Example: DkL=
else if( source[ srcOffset + 3 ] == EQUALS_SIGN )
{
// Two ways to do the same thing. Don't know which way I like best.
//int outBuff = ( ( DECODABET[ source[ srcOffset ] ] << 24 ) >>> 6 )
// | ( ( DECODABET[ source[ srcOffset + 1 ] ] << 24 ) >>> 12 )
// | ( ( DECODABET[ source[ srcOffset + 2 ] ] << 24 ) >>> 18 );
int outBuff = ( ( DECODABET[ source[ srcOffset ] ] & 0xFF ) << 18 )
| ( ( DECODABET[ source[ srcOffset + 1 ] ] & 0xFF ) << 12 )
| ( ( DECODABET[ source[ srcOffset + 2 ] ] & 0xFF ) << 6 );
destination[ destOffset ] = (byte)( outBuff >>> 16 );
destination[ destOffset + 1 ] = (byte)( outBuff >>> 8 );
return 2;
}
// Example: DkLE
else
{
try{
// Two ways to do the same thing. Don't know which way I like best.
//int outBuff = ( ( DECODABET[ source[ srcOffset ] ] << 24 ) >>> 6 )
// | ( ( DECODABET[ source[ srcOffset + 1 ] ] << 24 ) >>> 12 )
// | ( ( DECODABET[ source[ srcOffset + 2 ] ] << 24 ) >>> 18 )
// | ( ( DECODABET[ source[ srcOffset + 3 ] ] << 24 ) >>> 24 );
int outBuff = ( ( DECODABET[ source[ srcOffset ] ] & 0xFF ) << 18 )
| ( ( DECODABET[ source[ srcOffset + 1 ] ] & 0xFF ) << 12 )
| ( ( DECODABET[ source[ srcOffset + 2 ] ] & 0xFF ) << 6)
| ( ( DECODABET[ source[ srcOffset + 3 ] ] & 0xFF ) );
destination[ destOffset ] = (byte)( outBuff >> 16 );
destination[ destOffset + 1 ] = (byte)( outBuff >> 8 );
destination[ destOffset + 2 ] = (byte)( outBuff );
return 3;
}catch( Exception e){
System.out.println(""+source[srcOffset]+ ": " + ( DECODABET[ source[ srcOffset ] ] ) );
System.out.println(""+source[srcOffset+1]+ ": " + ( DECODABET[ source[ srcOffset + 1 ] ] ) );
System.out.println(""+source[srcOffset+2]+ ": " + ( DECODABET[ source[ srcOffset + 2 ] ] ) );
System.out.println(""+source[srcOffset+3]+ ": " + ( DECODABET[ source[ srcOffset + 3 ] ] ) );
return -1;
} //e nd catch
}
} // end decodeToBytes
/**
* Very low-level access to decoding ASCII characters in
* the form of a byte array. Does not support automatically
* gunzipping or any other "fancy" features.
*
* @param source The Base64 encoded data
* @param off The offset of where to begin decoding
* @param len The length of characters to decode
* @return decoded data
* @since 1.3
*/
public static byte[] decode( byte[] source, int off, int len )
{
int len34 = len * 3 / 4;
byte[] outBuff = new byte[ len34 ]; // Upper limit on size of output
int outBuffPosn = 0;
byte[] b4 = new byte[4];
int b4Posn = 0;
int i = 0;
byte sbiCrop = 0;
byte sbiDecode = 0;
for( i = off; i < off+len; i++ )
{
sbiCrop = (byte)(source[i] & 0x7f); // Only the low seven bits
sbiDecode = DECODABET[ sbiCrop ];
if( sbiDecode >= WHITE_SPACE_ENC ) // White space, Equals sign or better
{
if( sbiDecode >= EQUALS_SIGN_ENC )
{
b4[ b4Posn++ ] = sbiCrop;
if( b4Posn > 3 )
{
outBuffPosn += decode4to3( b4, 0, outBuff, outBuffPosn );
b4Posn = 0;
// If that was the equals sign, break out of 'for' loop
if( sbiCrop == EQUALS_SIGN )
break;
} // end if: quartet built
} // end if: equals sign or better
} // end if: white space, equals sign or better
else
{
//System.err.println( "Bad Base64 input character at " + i + ": " + source[i] + "(decimal)" );
return null;
} // end else:
} // each input character
byte[] out = new byte[ outBuffPosn ];
System.arraycopy( outBuff, 0, out, 0, outBuffPosn );
return out;
} // end decode
/**
* Decodes data from Base64 notation, automatically
* detecting gzip-compressed data and decompressing it.
*
* @param s the string to decode
* @return the decoded data
* @since 1.4
*/
public static byte[] decode( String s )
{
byte[] bytes;
try
{
bytes = s.getBytes( PREFERRED_ENCODING );
} // end try
catch( java.io.UnsupportedEncodingException uee )
{
bytes = s.getBytes();
} // end catch
//</change>
// Decode
bytes = decode( bytes, 0, bytes.length );
// Check to see if it's gzip-compressed
// GZIP Magic Two-Byte Number: 0x8b1f (35615)
if( bytes != null && bytes.length >= 4 )
{
int head = ((int)bytes[0] & 0xff) | ((bytes[1] << 8) & 0xff00);
if( java.util.zip.GZIPInputStream.GZIP_MAGIC == head )
{
java.io.ByteArrayInputStream bais = null;
java.util.zip.GZIPInputStream gzis = null;
java.io.ByteArrayOutputStream baos = null;
byte[] buffer = new byte[2048];
int length = 0;
try
{
baos = new java.io.ByteArrayOutputStream();
bais = new java.io.ByteArrayInputStream( bytes );
gzis = new java.util.zip.GZIPInputStream( bais );
while( ( length = gzis.read( buffer ) ) >= 0 )
{
baos.write(buffer,0,length);
} // end while: reading input
// No error? Get new bytes.
bytes = baos.toByteArray();
} // end try
catch( java.io.IOException e )
{
// Just return originally-decoded bytes
} // end catch
finally
{
try{ baos.close(); } catch( Exception e ){}
try{ gzis.close(); } catch( Exception e ){}
try{ bais.close(); } catch( Exception e ){}
} // end finally
} // end if: gzipped
} // end if: bytes.length >= 2
return bytes;
} // end decode
/**
* Attempts to decode Base64 data and deserialize a Java
* Object within. Returns <tt>null</tt> if there was an error.
*
* @param encodedObject The Base64 data to decode
* @return The decoded and deserialized object
* @since 1.5
*/
public static Object decodeToObject( String encodedObject )
{
// Decode and gunzip if necessary
byte[] objBytes = decode( encodedObject );
java.io.ByteArrayInputStream bais = null;
java.io.ObjectInputStream ois = null;
Object obj = null;
try
{
bais = new java.io.ByteArrayInputStream( objBytes );
ois = new java.io.ObjectInputStream( bais );
obj = ois.readObject();
} // end try
catch( java.io.IOException e )
{
e.printStackTrace();
obj = null;
} // end catch
catch( java.lang.ClassNotFoundException e )
{
e.printStackTrace();
obj = null;
} // end catch
finally
{
try{ bais.close(); } catch( Exception e ){}
try{ ois.close(); } catch( Exception e ){}
} // end finally
return obj;
} // end decodeObject
/**
* Convenience method for encoding data to a file.
*
* @param dataToEncode byte array of data to encode in base64 form
* @param filename Filename for saving encoded data
* @return <tt>true</tt> if successful, <tt>false</tt> otherwise
*
* @since 2.1
*/
public static boolean encodeToFile( byte[] dataToEncode, String filename )
{
boolean success = false;
Base64.OutputStream bos = null;
try
{
bos = new Base64.OutputStream(
new java.io.FileOutputStream( filename ), Base64.ENCODE );
bos.write( dataToEncode );
success = true;
} // end try
catch( java.io.IOException e )
{
success = false;
} // end catch: IOException
finally
{
try{ bos.close(); } catch( Exception e ){}
} // end finally
return success;
} // end encodeToFile
/**
* Convenience method for decoding data to a file.
*
* @param dataToDecode Base64-encoded data as a string
* @param filename Filename for saving decoded data
* @return <tt>true</tt> if successful, <tt>false</tt> otherwise
*
* @since 2.1
*/
public static boolean decodeToFile( String dataToDecode, String filename )
{
boolean success = false;
Base64.OutputStream bos = null;
try
{
bos = new Base64.OutputStream(
new java.io.FileOutputStream( filename ), Base64.DECODE );
bos.write( dataToDecode.getBytes( PREFERRED_ENCODING ) );
success = true;
} // end try
catch( java.io.IOException e )
{
success = false;
} // end catch: IOException
finally
{
try{ bos.close(); } catch( Exception e ){}
} // end finally
return success;
} // end decodeToFile
/**
* Convenience method for reading a base64-encoded
* file and decoding it.
*
* @param filename Filename for reading encoded data
* @return decoded byte array or null if unsuccessful
*
* @since 2.1
*/
public static byte[] decodeFromFile( String filename )
{
byte[] decodedData = null;
Base64.InputStream bis = null;
try
{
// Set up some useful variables
java.io.File file = new java.io.File( filename );
byte[] buffer = null;
int length = 0;
int numBytes = 0;
// Check for size of file
if( file.length() > Integer.MAX_VALUE )
{
System.err.println( "File is too big for this convenience method (" + file.length() + " bytes)." );
return null;
} // end if: file too big for int index
buffer = new byte[ (int)file.length() ];
// Open a stream
bis = new Base64.InputStream(
new java.io.BufferedInputStream(
new java.io.FileInputStream( file ) ), Base64.DECODE );
// Read until done
while( ( numBytes = bis.read( buffer, length, 4096 ) ) >= 0 )
length += numBytes;
// Save in a variable to return
decodedData = new byte[ length ];
System.arraycopy( buffer, 0, decodedData, 0, length );
} // end try
catch( java.io.IOException e )
{
System.err.println( "Error decoding from file " + filename );
} // end catch: IOException
finally
{
try{ bis.close(); } catch( Exception e) {}
} // end finally
return decodedData;
} // end decodeFromFile
/**
* Convenience method for reading a binary file
* and base64-encoding it.
*
* @param filename Filename for reading binary data
* @return base64-encoded string or null if unsuccessful
*
* @since 2.1
*/
public static String encodeFromFile( String filename )
{
String encodedData = null;
Base64.InputStream bis = null;
try
{
// Set up some useful variables
java.io.File file = new java.io.File( filename );
byte[] buffer = new byte[ (int)(file.length() * 1.4) ];
int length = 0;
int numBytes = 0;
// Open a stream
bis = new Base64.InputStream(
new java.io.BufferedInputStream(
new java.io.FileInputStream( file ) ), Base64.ENCODE );
// Read until done
while( ( numBytes = bis.read( buffer, length, 4096 ) ) >= 0 )
length += numBytes;
// Save in a variable to return
encodedData = new String( buffer, 0, length, Base64.PREFERRED_ENCODING );
} // end try
catch( java.io.IOException e )
{
System.err.println( "Error encoding from file " + filename );
} // end catch: IOException
finally
{
try{ bis.close(); } catch( Exception e) {}
} // end finally
return encodedData;
} // end encodeFromFile
/* ******** I N N E R C L A S S I N P U T S T R E A M ******** */
/**
* A {@link Base64.InputStream} will read data from another
* <tt>java.io.InputStream</tt>, given in the constructor,
* and encode/decode to/from Base64 notation on the fly.
*
* @see Base64
* @since 1.3
*/
public static class InputStream extends java.io.FilterInputStream
{
private boolean encode; // Encoding or decoding
private int position; // Current position in the buffer
private byte[] buffer; // Small buffer holding converted data
private int bufferLength; // Length of buffer (3 or 4)
private int numSigBytes; // Number of meaningful bytes in the buffer
private int lineLength;
private boolean breakLines; // Break lines at less than 80 characters
/**
* Constructs a {@link Base64.InputStream} in DECODE mode.
*
* @param in the <tt>java.io.InputStream</tt> from which to read data.
* @since 1.3
*/
public InputStream( java.io.InputStream in )
{
this( in, DECODE );
} // end constructor
/**
* Constructs a {@link Base64.InputStream} in
* either ENCODE or DECODE mode.
* <p>
* Valid options:<pre>
* ENCODE or DECODE: Encode or Decode as data is read.
* DONT_BREAK_LINES: don't break lines at 76 characters
* (only meaningful when encoding)
* <i>Note: Technically, this makes your encoding non-compliant.</i>
* </pre>
* <p>
* Example: <code>new Base64.InputStream( in, Base64.DECODE )</code>
*
*
* @param in the <tt>java.io.InputStream</tt> from which to read data.
* @param options Specified options
* @see Base64#ENCODE
* @see Base64#DECODE
* @see Base64#DONT_BREAK_LINES
* @since 2.0
*/
public InputStream( java.io.InputStream in, int options )
{
super( in );
this.breakLines = (options & DONT_BREAK_LINES) != DONT_BREAK_LINES;
this.encode = (options & ENCODE) == ENCODE;
this.bufferLength = encode ? 4 : 3;
this.buffer = new byte[ bufferLength ];
this.position = -1;
this.lineLength = 0;
} // end constructor
/**
* Reads enough of the input stream to convert
* to/from Base64 and returns the next byte.
*
* @return next byte
* @since 1.3
*/
public int read() throws java.io.IOException
{
// Do we need to get data?
if( position < 0 )
{
if( encode )
{
byte[] b3 = new byte[3];
int numBinaryBytes = 0;
for( int i = 0; i < 3; i++ )
{
try
{
int b = in.read();
// If end of stream, b is -1.
if( b >= 0 )
{
b3[i] = (byte)b;
numBinaryBytes++;
} // end if: not end of stream
} // end try: read
catch( java.io.IOException e )
{
// Only a problem if we got no data at all.
if( i == 0 )
throw e;
} // end catch
} // end for: each needed input byte
if( numBinaryBytes > 0 )
{
encode3to4( b3, 0, numBinaryBytes, buffer, 0 );
position = 0;
numSigBytes = 4;
} // end if: got data
else
{
return -1;
} // end else
} // end if: encoding
// Else decoding
else
{
byte[] b4 = new byte[4];
int i = 0;
for( i = 0; i < 4; i++ )
{
// Read four "meaningful" bytes:
int b = 0;
do{ b = in.read(); }
while( b >= 0 && DECODABET[ b & 0x7f ] <= WHITE_SPACE_ENC );
if( b < 0 )
break; // Reads a -1 if end of stream
b4[i] = (byte)b;
} // end for: each needed input byte
if( i == 4 )
{
numSigBytes = decode4to3( b4, 0, buffer, 0 );
position = 0;
} // end if: got four characters
else if( i == 0 ){
return -1;
} // end else if: also padded correctly
else
{
// Must have broken out from above.
throw new java.io.IOException( "Improperly padded Base64 input." );
} // end
} // end else: decode
} // end else: get data
// Got data?
if( position >= 0 )
{
// End of relevant data?
if( /*!encode &&*/ position >= numSigBytes )
return -1;
if( encode && breakLines && lineLength >= MAX_LINE_LENGTH )
{
lineLength = 0;
return '\n';
} // end if
else
{
lineLength++; // This isn't important when decoding
// but throwing an extra "if" seems
// just as wasteful.
int b = buffer[ position++ ];
if( position >= bufferLength )
position = -1;
return b & 0xFF; // This is how you "cast" a byte that's
// intended to be unsigned.
} // end else
} // end if: position >= 0
// Else error
else
{
// When JDK1.4 is more accepted, use an assertion here.
throw new java.io.IOException( "Error in Base64 code reading stream." );
} // end else
} // end read
/**
* Calls {@link #read()} repeatedly until the end of stream
* is reached or <var>len</var> bytes are read.
* Returns number of bytes read into array or -1 if
* end of stream is encountered.
*
* @param dest array to hold values
* @param off offset for array
* @param len max number of bytes to read into array
* @return bytes read into array or -1 if end of stream is encountered.
* @since 1.3
*/
public int read( byte[] dest, int off, int len ) throws java.io.IOException
{
int i;
int b;
for( i = 0; i < len; i++ )
{
b = read();
//if( b < 0 && i == 0 )
// return -1;
if( b >= 0 )
dest[off + i] = (byte)b;
else if( i == 0 )
return -1;
else
break; // Out of 'for' loop
} // end for: each byte read
return i;
} // end read
} // end inner class InputStream
/* ******** I N N E R C L A S S O U T P U T S T R E A M ******** */
/**
* A {@link Base64.OutputStream} will write data to another
* <tt>java.io.OutputStream</tt>, given in the constructor,
* and encode/decode to/from Base64 notation on the fly.
*
* @see Base64
* @since 1.3
*/
public static class OutputStream extends java.io.FilterOutputStream
{
private boolean encode;
private int position;
private byte[] buffer;
private int bufferLength;
private int lineLength;
private boolean breakLines;
private byte[] b4; // Scratch used in a few places
private boolean suspendEncoding;
/**
* Constructs a {@link Base64.OutputStream} in ENCODE mode.
*
* @param out the <tt>java.io.OutputStream</tt> to which data will be written.
* @since 1.3
*/
public OutputStream( java.io.OutputStream out )
{
this( out, ENCODE );
} // end constructor
/**
* Constructs a {@link Base64.OutputStream} in
* either ENCODE or DECODE mode.
* <p>
* Valid options:<pre>
* ENCODE or DECODE: Encode or Decode as data is read.
* DONT_BREAK_LINES: don't break lines at 76 characters
* (only meaningful when encoding)
* <i>Note: Technically, this makes your encoding non-compliant.</i>
* </pre>
* <p>
* Example: <code>new Base64.OutputStream( out, Base64.ENCODE )</code>
*
* @param out the <tt>java.io.OutputStream</tt> to which data will be written.
* @param options Specified options.
* @see Base64#ENCODE
* @see Base64#DECODE
* @see Base64#DONT_BREAK_LINES
* @since 1.3
*/
public OutputStream( java.io.OutputStream out, int options )
{
super( out );
this.breakLines = (options & DONT_BREAK_LINES) != DONT_BREAK_LINES;
this.encode = (options & ENCODE) == ENCODE;
this.bufferLength = encode ? 3 : 4;
this.buffer = new byte[ bufferLength ];
this.position = 0;
this.lineLength = 0;
this.suspendEncoding = false;
this.b4 = new byte[4];
} // end constructor
/**
* Writes the byte to the output stream after
* converting to/from Base64 notation.
* When encoding, bytes are buffered three
* at a time before the output stream actually
* gets a write() call.
* When decoding, bytes are buffered four
* at a time.
*
* @param theByte the byte to write
* @since 1.3
*/
public void write(int theByte) throws java.io.IOException
{
// Encoding suspended?
if( suspendEncoding )
{
super.out.write( theByte );
return;
} // end if: supsended
// Encode?
if( encode )
{
buffer[ position++ ] = (byte)theByte;
if( position >= bufferLength ) // Enough to encode.
{
out.write( encode3to4( b4, buffer, bufferLength ) );
lineLength += 4;
if( breakLines && lineLength >= MAX_LINE_LENGTH )
{
out.write( NEW_LINE );
lineLength = 0;
} // end if: end of line
position = 0;
} // end if: enough to output
} // end if: encoding
// Else, Decoding
else
{
// Meaningful Base64 character?
if( DECODABET[ theByte & 0x7f ] > WHITE_SPACE_ENC )
{
buffer[ position++ ] = (byte)theByte;
if( position >= bufferLength ) // Enough to output.
{
int len = Base64.decode4to3( buffer, 0, b4, 0 );
out.write( b4, 0, len );
//out.write( Base64.decode4to3( buffer ) );
position = 0;
} // end if: enough to output
} // end if: meaningful base64 character
else if( DECODABET[ theByte & 0x7f ] != WHITE_SPACE_ENC )
{
throw new java.io.IOException( "Invalid character in Base64 data." );
} // end else: not white space either
} // end else: decoding
} // end write
/**
* Calls {@link #write(int)} repeatedly until <var>len</var>
* bytes are written.
*
* @param theBytes array from which to read bytes
* @param off offset for array
* @param len max number of bytes to read into array
* @since 1.3
*/
public void write( byte[] theBytes, int off, int len ) throws java.io.IOException
{
// Encoding suspended?
if( suspendEncoding )
{
super.out.write( theBytes, off, len );
return;
} // end if: supsended
for( int i = 0; i < len; i++ )
{
write( theBytes[ off + i ] );
} // end for: each byte written
} // end write
/**
* Method added by PHIL. [Thanks, PHIL. -Rob]
* This pads the buffer without closing the stream.
*/
public void flushBase64() throws java.io.IOException
{
if( position > 0 )
{
if( encode )
{
out.write( encode3to4( b4, buffer, position ) );
position = 0;
} // end if: encoding
else
{
throw new java.io.IOException( "Base64 input not properly padded." );
} // end else: decoding
} // end if: buffer partially full
} // end flush
/**
* Flushes and closes (I think, in the superclass) the stream.
*
* @since 1.3
*/
public void close() throws java.io.IOException
{
// 1. Ensure that pending characters are written
flushBase64();
// 2. Actually close the stream
// Base class both flushes and closes.
super.close();
buffer = null;
out = null;
} // end close
/**
* Suspends encoding of the stream.
* May be helpful if you need to embed a piece of
* base640-encoded data in a stream.
*
* @since 1.5.1
*/
public void suspendEncoding() throws java.io.IOException
{
flushBase64();
this.suspendEncoding = true;
} // end suspendEncoding
/**
* Resumes encoding of the stream.
* May be helpful if you need to embed a piece of
* base640-encoded data in a stream.
*
* @since 1.5.1
*/
public void resumeEncoding()
{
this.suspendEncoding = false;
} // end resumeEncoding
} // end inner class OutputStream
} // end class Base64
| Chandrashar/jradius | applet/src/main/java/Base64.java | Java | lgpl-2.1 | 53,360 | [
30522,
1013,
1008,
1008,
1008,
4372,
23237,
1998,
21933,
6155,
2000,
1998,
2013,
2918,
21084,
14869,
1012,
1008,
1008,
1026,
1052,
1028,
1008,
2689,
8833,
1024,
1008,
1026,
1013,
1052,
1028,
1008,
1026,
17359,
1028,
1008,
1026,
5622,
1028,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
#include <iostream>
#include <future>
#include <signal.h>
#include <string.h>
#include <vector>
#include "BotHandler.h"
#include "BotService.h"
#include "config.h"
#include "ClientHandler.h"
#include "Net/TCPConnection.h"
#include "Net/TCPServer.h"
using namespace std;
using namespace hlt;
vector<ClientHandler::Ptr> clientHandlers;
vector<BotHandler::Ptr> botHandlers;
void removeBot(BotHandler::Ptr handler)
{
BotService::UnregisterBot(handler->getName());
auto iter = std::find(botHandlers.begin(), botHandlers.end(), handler);
if (iter != botHandlers.end())
botHandlers.erase(iter);
}
void registerBot(const BotHandler::EventArgument& arg, BotHandler::Ptr botHandler)
{
cout << "Trying to register new bot: " << arg["name"] << endl;
int result = BotService::RegisterBot(arg["name"], botHandler);
if (result == 0)
{
cout << "Registered new bot: " << arg["name"] << endl;
}
else
{
cout << "Couldn't register bot closing..." << endl;
botHandler->close();
removeBot(botHandler);
}
}
static void signalHandler(int signum)
{
// TODO Handle signals
}
int main(int argc, char** argv)
{
struct sigaction sa;
sa.sa_handler = signalHandler;
sigemptyset(&sa.sa_mask);
if (sigaction(SIGPIPE, &sa, NULL) == -1)
{
cout << "Couldn't set signal handler. Exiting..." << endl;
return 1;
}
TCPServer clientServer(string(CLIENT_PORT));
clientServer.getEventEmitter().on("connection",
[](const TCPServer::EventArgument& arg) {
cout << "New connection to client server!" << endl;
clientHandlers.push_back(ClientHandler::Ptr(
new ClientHandler(arg.connection)));
}
);
clientServer.start();
TCPServer spServer(string(SP_PORT));
spServer.getEventEmitter().on("connection",
[](const TCPServer::EventArgument& arg) {
cout << "New connection to bot server!" << endl;
BotHandler::Ptr botHandler(new BotHandler(arg.connection));
botHandlers.push_back(botHandler);
botHandler->getEventEmitter().on("close", std::bind(removeBot, botHandler));
botHandler->getEventEmitter().on("info", std::bind(registerBot, placeholders::_1, botHandler));
}
);
spServer.start();
while (1)
{
string in;
cin >> in;
// Possible UI here
}
return 0;
}
| mhalitk/RemoteBot | src/server.cpp | C++ | mit | 2,455 | [
30522,
1001,
2421,
1026,
16380,
25379,
1028,
1001,
2421,
1026,
2925,
1028,
1001,
2421,
1026,
4742,
1012,
1044,
1028,
1001,
2421,
1026,
5164,
1012,
1044,
1028,
1001,
2421,
1026,
9207,
30524,
2421,
1000,
7396,
11774,
3917,
1012,
1044,
1000,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
# Rotaliidae Ehrenberg, 1839 FAMILY
#### Status
ACCEPTED
#### According to
The Catalogue of Life, 3rd January 2011
#### Published in
null
#### Original name
null
### Remarks
null | mdoering/backbone | life/Protozoa/Granuloreticulosea/Foraminiferida/Rotaliidae/README.md | Markdown | apache-2.0 | 183 | [
30522,
1001,
18672,
11475,
6096,
15501,
7389,
4059,
1010,
10011,
2155,
1001,
1001,
1001,
1001,
3570,
3970,
1001,
1001,
1001,
1001,
2429,
2000,
1996,
10161,
1997,
2166,
1010,
3822,
2254,
2249,
1001,
1001,
1001,
1001,
2405,
1999,
19701,
1001,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
# -*- coding: utf-8 -*-
# Scrapy settings for DynamicItemsScrapy project
#
# For simplicity, this file contains only settings considered important or
# commonly used. You can find more settings consulting the documentation:
#
# http://doc.scrapy.org/en/latest/topics/settings.html
# http://scrapy.readthedocs.org/en/latest/topics/downloader-middleware.html
# http://scrapy.readthedocs.org/en/latest/topics/spider-middleware.html
BOT_NAME = 'DynamicItemsScrapy'
SPIDER_MODULES = ['DynamicItemsScrapy.spiders']
NEWSPIDER_MODULE = 'DynamicItemsScrapy.spiders'
# Crawl responsibly by identifying yourself (and your website) on the user-agent
#USER_AGENT = 'DynamicItemsScrapy (+http://www.yourdomain.com)'
# Configure maximum concurrent requests performed by Scrapy (default: 16)
#CONCURRENT_REQUESTS=32
# Configure a delay for requests for the same website (default: 0)
# See http://scrapy.readthedocs.org/en/latest/topics/settings.html#download-delay
# See also autothrottle settings and docs
#DOWNLOAD_DELAY=3
# The download delay setting will honor only one of:
#CONCURRENT_REQUESTS_PER_DOMAIN=16
#CONCURRENT_REQUESTS_PER_IP=16
# Disable cookies (enabled by default)
#COOKIES_ENABLED=False
# Disable Telnet Console (enabled by default)
#TELNETCONSOLE_ENABLED=False
# Override the default request headers:
#DEFAULT_REQUEST_HEADERS = {
# 'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8',
# 'Accept-Language': 'en',
#}
# Enable or disable spider middlewares
# See http://scrapy.readthedocs.org/en/latest/topics/spider-middleware.html
#SPIDER_MIDDLEWARES = {
# 'DynamicItemsScrapy.middlewares.MyCustomSpiderMiddleware': 543,
#}
# Enable or disable downloader middlewares
# See http://scrapy.readthedocs.org/en/latest/topics/downloader-middleware.html
#DOWNLOADER_MIDDLEWARES = {
# 'DynamicItemsScrapy.middlewares.MyCustomDownloaderMiddleware': 543,
#}
# Enable or disable extensions
# See http://scrapy.readthedocs.org/en/latest/topics/extensions.html
#EXTENSIONS = {
# 'scrapy.telnet.TelnetConsole': None,
#}
# Configure item pipelines
# See http://scrapy.readthedocs.org/en/latest/topics/item-pipeline.html
#ITEM_PIPELINES = {
# 'DynamicItemsScrapy.pipelines.SomePipeline': 300,
#}
# Enable and configure the AutoThrottle extension (disabled by default)
# See http://doc.scrapy.org/en/latest/topics/autothrottle.html
# NOTE: AutoThrottle will honour the standard settings for concurrency and delay
#AUTOTHROTTLE_ENABLED=True
# The initial download delay
#AUTOTHROTTLE_START_DELAY=5
# The maximum download delay to be set in case of high latencies
#AUTOTHROTTLE_MAX_DELAY=60
# Enable showing throttling stats for every response received:
#AUTOTHROTTLE_DEBUG=False
# Enable and configure HTTP caching (disabled by default)
# See http://scrapy.readthedocs.org/en/latest/topics/downloader-middleware.html#httpcache-middleware-settings
#HTTPCACHE_ENABLED=True
#HTTPCACHE_EXPIRATION_SECS=0
#HTTPCACHE_DIR='httpcache'
#HTTPCACHE_IGNORE_HTTP_CODES=[]
#HTTPCACHE_STORAGE='scrapy.extensions.httpcache.FilesystemCacheStorage'
| WilliamKinaan/ScrapyDynamicItems | DynamicItemsScrapy/DynamicItemsScrapy/settings.py | Python | apache-2.0 | 3,084 | [
30522,
1001,
1011,
1008,
1011,
16861,
1024,
21183,
2546,
1011,
1022,
1011,
1008,
1011,
1001,
15121,
2100,
10906,
2005,
8790,
4221,
5244,
11020,
2527,
7685,
2622,
1001,
1001,
2005,
17839,
1010,
2023,
5371,
3397,
2069,
10906,
2641,
2590,
2030... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
import doctest
import pytest
from datascience import predicates
from datascience import *
def test_both():
"""Both f and g."""
p = are.above(2) & are.below(4)
ps = [p(x) for x in range(1, 6)]
assert ps == [False, False, True, False, False]
def test_either():
"""Either f or g."""
p = are.above(3) | are.below(2)
ps = [p(x) for x in range(1, 6)]
assert ps == [True, False, False, True, True]
def test_equal_to():
"""Equal to y."""
p = are.equal_to(1)
ps = [p(x) for x in range(1, 6)]
assert ps == [True, False, False, False, False]
def test_above():
"""Greater than y."""
p = are.above(3)
ps = [p(x) for x in range(1, 6)]
assert ps == [False, False, False, True, True]
def test_below():
"""Less than y."""
p = are.not_below(4)
ps = [p(x) for x in range(1, 6)]
assert ps == [False, False, False, True, True]
def test_above_or_equal_to():
"""Greater than or equal to y."""
p = are.above_or_equal_to(4)
ps = [p(x) for x in range(1, 6)]
assert ps == [False, False, False, True, True]
def test_below_or_equal_to():
"""Less than or equal to y."""
p = are.not_below_or_equal_to(3)
ps = [p(x) for x in range(1, 6)]
assert ps == [False, False, False, True, True]
def test_strictly_between():
"""Greater than y and less than z."""
p = are.strictly_between(2, 4)
ps = [p(x) for x in range(1, 6)]
assert ps == [False, False, True, False, False]
def test_between():
"""Greater than or equal to y and less than z."""
p = are.between(3, 4)
ps = [p(x) for x in range(1, 6)]
assert ps == [False, False, True, False, False]
def test_between_or_equal_to():
"""Greater than or equal to y and less than or equal to z."""
p = are.between_or_equal_to(3, 3)
ps = [p(x) for x in range(1, 6)]
assert ps == [False, False, True, False, False]
############
# Doctests #
############
def test_doctests():
results = doctest.testmod(predicates,
optionflags=doctest.NORMALIZE_WHITESPACE)
assert results.failed == 0
| dsten/datascience | tests/test_predicates.py | Python | bsd-3-clause | 2,093 | [
30522,
12324,
9986,
22199,
12324,
1052,
17250,
3367,
2013,
2951,
11020,
13684,
12324,
3653,
16467,
2015,
2013,
2951,
11020,
13684,
12324,
1008,
13366,
3231,
1035,
2119,
1006,
1007,
1024,
1000,
1000,
1000,
30524,
1000,
1000,
1000,
1052,
1027,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
package com.github.visgeek.utils.collections;
import java.util.Iterator;
class LinqConcateIterator<T> implements Iterator<T> {
// コンストラクター
public LinqConcateIterator(Iterable<T> source, Iterable<? extends T> second) {
this.second = second;
this.itr = source.iterator();
this.isSwitched = false;
}
// フィールド
private final Iterable<? extends T> second;
private Iterator<? extends T> itr;
private boolean isSwitched;
// プロパティ
// メソッド
@Override
public boolean hasNext() {
boolean result = false;
result = this.itr.hasNext();
if (!this.isSwitched) {
if (!result) {
this.itr = this.second.iterator();
result = this.itr.hasNext();
this.isSwitched = true;
}
}
return result;
}
@Override
public T next() {
return this.itr.next();
}
// スタティックフィールド
// スタティックイニシャライザー
// スタティックメソッド
}
| visGeek/JavaVisGeekCollections | src/src/main/java/com/github/visgeek/utils/collections/LinqConcateIterator.java | Java | mit | 1,003 | [
30522,
7427,
4012,
1012,
21025,
2705,
12083,
1012,
25292,
18372,
2243,
1012,
21183,
12146,
1012,
6407,
1025,
12324,
9262,
1012,
21183,
4014,
1012,
2009,
6906,
4263,
1025,
2465,
11409,
4160,
8663,
16280,
21646,
8844,
1026,
1056,
1028,
22164,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
version https://git-lfs.github.com/spec/v1
oid sha256:42fcecf8fdabe110af986ac81bb56b598f5a3fa59c6d0c4cc8b80daa2dca0473
size 1121
| yogeshsaroya/new-cdnjs | ajax/libs/dojo/1.4.6/_base/_loader/hostenv_spidermonkey.js | JavaScript | mit | 129 | [
30522,
2544,
16770,
1024,
1013,
1013,
21025,
2102,
1011,
1048,
10343,
1012,
21025,
2705,
12083,
1012,
4012,
1013,
28699,
1013,
1058,
2487,
1051,
3593,
21146,
17788,
2575,
1024,
4413,
11329,
8586,
2546,
2620,
2546,
2850,
4783,
14526,
2692,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
<!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_22) on Sun Aug 26 15:15:31 EDT 2012 -->
<TITLE>
org.newdawn.slick.opengl.pbuffer (Slick Util - LWJGL Utilities extracted from Slick)
</TITLE>
<META NAME="date" CONTENT="2012-08-26">
<LINK REL ="stylesheet" TYPE="text/css" HREF="../../../../../stylesheet.css" TITLE="Style">
</HEAD>
<BODY BGCOLOR="white">
<FONT size="+1" CLASS="FrameTitleFont">
<A HREF="../../../../../org/newdawn/slick/opengl/pbuffer/package-summary.html" target="classFrame">org.newdawn.slick.opengl.pbuffer</A></FONT>
<TABLE BORDER="0" WIDTH="100%" SUMMARY="">
<TR>
<TD NOWRAP><FONT size="+1" CLASS="FrameHeadingFont">
Classes</FONT>
<FONT CLASS="FrameItemFont">
<BR>
<A HREF="FBOGraphics.html" title="class in org.newdawn.slick.opengl.pbuffer" target="classFrame">FBOGraphics</A>
<BR>
<A HREF="GraphicsFactory.html" title="class in org.newdawn.slick.opengl.pbuffer" target="classFrame">GraphicsFactory</A>
<BR>
<A HREF="PBufferGraphics.html" title="class in org.newdawn.slick.opengl.pbuffer" target="classFrame">PBufferGraphics</A>
<BR>
<A HREF="PBufferUniqueGraphics.html" title="class in org.newdawn.slick.opengl.pbuffer" target="classFrame">PBufferUniqueGraphics</A></FONT></TD>
</TR>
</TABLE>
</BODY>
</HTML>
| dxiao/PPBunnies | slick/trunk/Slick/javadoc-util/org/newdawn/slick/opengl/pbuffer/package-frame.html | HTML | mit | 1,406 | [
30522,
1026,
999,
9986,
13874,
16129,
2270,
1000,
1011,
1013,
1013,
1059,
2509,
2278,
1013,
1013,
26718,
2094,
16129,
1018,
1012,
5890,
17459,
1013,
1013,
4372,
1000,
1000,
8299,
1024,
1013,
1013,
7479,
1012,
1059,
2509,
1012,
8917,
1013,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
import unittest
import numpy as np
from bsym import ColourOperation, Configuration
from unittest.mock import patch
class ColourOperationTestCase( unittest.TestCase ):
"""Tests for colour operation methods"""
def test_symmetry_operation_is_initialised_from_a_matrix( self ):
matrix = np.array( [ [ 1, 0 ], [ 0, 1 ] ] )
mapping = [ { 1: 0, 0: 1 }, { 1: 1, 0: 0 } ]
co = ColourOperation( matrix, colour_mapping=mapping )
np.testing.assert_array_equal( co.matrix, matrix )
self.assertEqual( co.colour_mapping, mapping )
def test_from_vector( self ):
vector = [ 2, 3, 1 ]
mapping = [ { 1: 0, 0: 1 }, { 1: 1, 0: 0 }, { 1: 1, 0: 0 } ]
co = ColourOperation.from_vector( vector, mapping )
np.testing.assert_array_equal( co.matrix, np.array( [ [ 0, 0, 1 ], [ 1, 0, 0 ], [ 0, 1, 0 ] ] ) )
self.assertEqual( co.colour_mapping, mapping )
def test_from_vector_with_label( self ):
vector = [ 2, 3, 1 ]
mapping = [ { 1: 0, 0: 1 }, { 1: 1, 0: 0 } ]
label = 'A'
co = ColourOperation.from_vector( vector, mapping, label=label )
np.testing.assert_array_equal( co.matrix, np.array( [ [ 0, 0, 1 ], [ 1, 0, 0 ], [ 0, 1, 0 ] ] ) )
self.assertEqual( co.label, label )
self.assertEqual( co.colour_mapping, mapping )
def test_symmetry_operation_is_initialised_with_label( self ):
matrix = np.array( [ [ 1, 0 ], [ 0, 1 ] ] )
label = 'E'
mapping = [ { 1: 0, 0: 1 }, { 1: 1, 0: 0 } ]
co = ColourOperation( matrix, mapping, label=label )
self.assertEqual( co.label, label )
self.assertEqual( co.colour_mapping, mapping )
def test_from_vector_counting_from_zero( self ):
vector = [ 1, 2, 0 ]
mapping = [ { 1: 0, 0: 1 }, { 1: 1, 0: 0 } ]
co = ColourOperation.from_vector( vector, mapping, count_from_zero=True )
np.testing.assert_array_equal( co.matrix, np.array( [ [ 0, 0, 1 ], [ 1, 0, 0 ], [ 0, 1, 0 ] ] ) )
self.assertEqual( co.colour_mapping, mapping )
def test_operate_on( self ):
matrix = np.array( [ [ 0, 1, 0 ], [ 0, 0, 1 ], [ 1, 0, 0 ] ] )
colour_mapping = [ { 1:1, 2:2, 3:3 },
{ 1:2, 2:3, 3:1 },
{ 1:3, 2:2, 3:1 } ]
co = ColourOperation( matrix, colour_mapping )
configuration = Configuration( [ 1, 2, 3 ] )
co.operate_on( configuration )
np.testing.assert_array_equal( co.operate_on( configuration ).vector, np.array( [ 2, 1, 3 ] ) )
def test_mul( self ):
matrix_a = np.array( [ [ 1, 0 ], [ 0, 1 ] ] )
colour_mapping_a = [ { 0:1, 1:0 }, { 0:1, 1:0 } ]
matrix_b = np.array( [ [ 0, 1 ], [ 1, 0 ] ] )
colour_mapping_b = [ { 0:1, 1:0 }, { 0:1, 1:0 } ]
co_a = ColourOperation( matrix_a, colour_mapping_a )
co_b = ColourOperation( matrix_b, colour_mapping_b )
co_c = co_a * co_b
np.testing.assert_array_equal( co_c.matrix , np.array( [ [ 0, 1 ], [ 1, 0 ] ] ) )
self.assertEqual( co_c.colour_mapping, [ { 0:0, 1:1 }, { 0:0, 1:1 } ] )
if __name__ == '__main__':
unittest.main()
| bjmorgan/bsym | tests/unit_tests/test_colour_operation.py | Python | mit | 3,191 | [
30522,
12324,
3131,
22199,
12324,
16371,
8737,
2100,
2004,
27937,
2013,
18667,
24335,
12324,
6120,
25918,
3370,
1010,
9563,
2013,
3131,
22199,
1012,
12934,
12324,
8983,
2465,
6120,
25918,
3370,
22199,
18382,
1006,
3131,
22199,
1012,
3231,
183... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
<!DOCTYPE html>
<html xml:lang="en-GB" lang="en-GB" xmlns="http://www.w3.org/1999/xhtml">
<head lang="en-GB">
<title>Ross Gammon’s Family Tree - Events</title>
<meta charset="UTF-8" />
<meta name ="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=1" />
<meta name ="apple-mobile-web-app-capable" content="yes" />
<meta name="generator" content="Gramps 4.2.8 http://gramps-project.org/" />
<meta name="author" content="" />
<link href="../../../images/favicon2.ico" rel="shortcut icon" type="image/x-icon" />
<link href="../../../css/narrative-screen.css" media="screen" rel="stylesheet" type="text/css" />
<link href="../../../css/narrative-print.css" media="print" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="header">
<h1 id="SiteTitle">Ross Gammon’s Family Tree</h1>
</div>
<div class="wrapper" id="nav" role="navigation">
<div class="container">
<ul class="menu" id="dropmenu">
<li><a href="../../../individuals.html" title="Individuals">Individuals</a></li>
<li><a href="../../../index.html" title="Surnames">Surnames</a></li>
<li><a href="../../../families.html" title="Families">Families</a></li>
<li class = "CurrentSection"><a href="../../../events.html" title="Events">Events</a></li>
<li><a href="../../../places.html" title="Places">Places</a></li>
<li><a href="../../../sources.html" title="Sources">Sources</a></li>
<li><a href="../../../repositories.html" title="Repositories">Repositories</a></li>
<li><a href="../../../media.html" title="Media">Media</a></li>
<li><a href="../../../thumbnails.html" title="Thumbnails">Thumbnails</a></li>
</ul>
</div>
</div>
<div class="content" id="EventDetail">
<h3>Status</h3>
<table class="infolist eventlist">
<tbody>
<tr>
<td class="ColumnAttribute">Gramps ID</td>
<td class="ColumnGRAMPSID">E20263</td>
</tr>
<tr>
<td class="ColumnAttribute">Description</td>
<td class="ColumnColumnDescription">
MARRIED
</td>
</tr>
</tbody>
</table>
<div class="subsection" id="references">
<h4>References</h4>
<ol class="Col1" role="Volume-n-Page"type = 1>
<li>
<a href="../../../fam/b/4/d15f5fb8f5f4b6a6afbddf7514b.html">
Family of TREVAN, Thomas and WASLEY, Annie
<span class="grampsid"> [F0042]</span>
</a>
</li>
<li>
<a href="../../../ppl/2/f/d15f5fb8f45742b97260947e8f2.html">
TREVAN, Thomas
<span class="grampsid"> [I0149]</span>
</a>
</li>
<li>
<a href="../../../ppl/a/0/d15f5fb92243251c0879b74320a.html">
WASLEY, Annie
<span class="grampsid"> [I0167]</span>
</a>
</li>
</ol>
</div>
</div>
<div class="fullclear"></div>
<div id="footer">
<p id="createdate">
Generated by <a href="http://gramps-project.org/">Gramps</a> 4.2.8<br />Last change was the 2015-08-05 19:55:41<br />Created for <a href="../../../ppl/9/e/d15f5fb48902c4fc1b421d249e9.html">GAMMON, Francis</a>
</p>
<p id="copyright">
</p>
</div>
</body>
</html>
| RossGammon/the-gammons.net | RossFamilyTree/evt/f/9/d15f60b57f94c8fcd88266299f.html | HTML | gpl-3.0 | 3,066 | [
30522,
1026,
999,
9986,
13874,
16129,
1028,
1026,
16129,
20950,
1024,
11374,
1027,
1000,
4372,
1011,
16351,
1000,
11374,
1027,
1000,
4372,
1011,
16351,
1000,
20950,
3619,
1027,
1000,
8299,
1024,
1013,
1013,
7479,
1012,
1059,
2509,
1012,
891... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>mod-red: 57 s</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.6.1 / mod-red - 8.6.0</a></li>
</ul>
</div>
</div>
</div>
<div class="article">
<div class="row">
<div class="col-md-12">
<a href="../..">« Up</a>
<h1>
mod-red
<small>
8.6.0
<span class="label label-success">57 s</span>
</small>
</h1>
<p><em><script>document.write(moment("2020-06-28 21:12:27 +0000", "YYYY-MM-DD HH:mm:ss Z").fromNow());</script> (2020-06-28 21:12:27 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-threads base
base-unix base
camlp5 7.12 Preprocessor-pretty-printer of OCaml
conf-findutils 1 Virtual package relying on findutils
conf-m4 1 Virtual package relying on m4
coq 8.6.1 Formal proof management system.
num 0 The Num library for arbitrary-precision integer and rational arithmetic
ocaml 4.05.0 The OCaml compiler (virtual package)
ocaml-base-compiler 4.05.0 Official 4.05.0 release
ocaml-config 1 OCaml Switch Configuration
ocamlfind 1.8.1 A library manager for OCaml
# opam file:
opam-version: "2.0"
maintainer: "Hugo.Herbelin@inria.fr"
homepage: "https://github.com/coq-contribs/mod-red"
license: "GNU Lesser General Public License"
build: [make "-j%{jobs}%"]
install: [make "install"]
remove: ["rm" "-R" "%{lib}%/coq/user-contrib/ModRed"]
depends: [
"ocaml"
"coq" {>= "8.6" & < "8.7~"}
]
tags: [ "keyword: Algorithms" "keyword: Performance" "keyword: Computer Arithmetic" "keyword: Modular Reduction" "keyword: Optimization" "category: Mathematics/Arithmetic and Number Theory/Miscellaneous" "date: 2007-12; Updated in April 2009" ]
authors: [ "Luc Rutten" ]
bug-reports: "https://github.com/coq-contribs/mod-red/issues"
dev-repo: "git+https://github.com/coq-contribs/mod-red.git"
synopsis: "Efficient Reduction of Large Integers by Small Moduli"
description:
"Fast reduction of integers by moduli up to 2^(w-1), where w is a processor's word size."
flags: light-uninstall
url {
src: "https://github.com/coq-contribs/mod-red/archive/v8.6.0.tar.gz"
checksum: "md5=9ba9cc5fa8083b558fbcbd3000a691f5"
}
</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-mod-red.8.6.0 coq.8.6.1</code></dd>
<dt>Return code</dt>
<dd>0</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>true</code></dd>
<dt>Return code</dt>
<dd>0</dd>
</dl>
<h2>Install dependencies</h2>
<dl class="dl-horizontal">
<dt>Command</dt>
<dd><code>opam list; echo; ulimit -Sv 4000000; timeout 2h opam install -y --deps-only coq-mod-red.8.6.0 coq.8.6.1</code></dd>
<dt>Return code</dt>
<dd>0</dd>
<dt>Duration</dt>
<dd>5 s</dd>
</dl>
<h2>Install</h2>
<dl class="dl-horizontal">
<dt>Command</dt>
<dd><code>opam list; echo; ulimit -Sv 16000000; timeout 2h opam install -y -v coq-mod-red.8.6.0 coq.8.6.1</code></dd>
<dt>Return code</dt>
<dd>0</dd>
<dt>Duration</dt>
<dd>57 s</dd>
</dl>
<h2>Installation size</h2>
<p>Total: 2 M</p>
<ul>
<li>464 K <code>../ocaml-base-compiler.4.05.0/lib/coq/user-contrib/ModRed/multired2.vo</code></li>
<li>451 K <code>../ocaml-base-compiler.4.05.0/lib/coq/user-contrib/ModRed/multired2.glob</code></li>
<li>352 K <code>../ocaml-base-compiler.4.05.0/lib/coq/user-contrib/ModRed/multired.vo</code></li>
<li>316 K <code>../ocaml-base-compiler.4.05.0/lib/coq/user-contrib/ModRed/multired.glob</code></li>
<li>197 K <code>../ocaml-base-compiler.4.05.0/lib/coq/user-contrib/ModRed/modred.vo</code></li>
<li>181 K <code>../ocaml-base-compiler.4.05.0/lib/coq/user-contrib/ModRed/modred.glob</code></li>
<li>150 K <code>../ocaml-base-compiler.4.05.0/lib/coq/user-contrib/ModRed/preparation.glob</code></li>
<li>140 K <code>../ocaml-base-compiler.4.05.0/lib/coq/user-contrib/ModRed/preparation.vo</code></li>
<li>48 K <code>../ocaml-base-compiler.4.05.0/lib/coq/user-contrib/ModRed/multired2.v</code></li>
<li>45 K <code>../ocaml-base-compiler.4.05.0/lib/coq/user-contrib/ModRed/unsigned.vo</code></li>
<li>36 K <code>../ocaml-base-compiler.4.05.0/lib/coq/user-contrib/ModRed/multired.v</code></li>
<li>24 K <code>../ocaml-base-compiler.4.05.0/lib/coq/user-contrib/ModRed/modred.v</code></li>
<li>23 K <code>../ocaml-base-compiler.4.05.0/lib/coq/user-contrib/ModRed/preparation.v</code></li>
<li>23 K <code>../ocaml-base-compiler.4.05.0/lib/coq/user-contrib/ModRed/unsigned.glob</code></li>
<li>5 K <code>../ocaml-base-compiler.4.05.0/lib/coq/user-contrib/ModRed/unsigned.v</code></li>
</ul>
<h2>Uninstall</h2>
<dl class="dl-horizontal">
<dt>Command</dt>
<dd><code>opam remove -y coq-mod-red.8.6.0</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">
<small>Sources are on <a href="https://github.com/coq-bench">GitHub</a>. © Guillaume Claret.</small>
</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>
| coq-bench/coq-bench.github.io | clean/Linux-x86_64-4.05.0-2.0.6/released/8.6.1/mod-red/8.6.0.html | HTML | mit | 8,542 | [
30522,
1026,
999,
9986,
13874,
16129,
1028,
1026,
16129,
11374,
1027,
1000,
4372,
1000,
1028,
1026,
2132,
1028,
1026,
18804,
25869,
13462,
1027,
1000,
21183,
2546,
1011,
1022,
1000,
1028,
1026,
18804,
2171,
1027,
1000,
3193,
6442,
1000,
418... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
/*
This file is part of the OdinMS Maple Story Server
Copyright (C) 2008 Patrick Huy <patrick.huy@frz.cc>
Matthias Butz <matze@odinms.de>
Jan Christian Meyer <vimes@odinms.de>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
published by the Free Software Foundation version 3 as published by
the Free Software Foundation. You may not use, modify or distribute
this program under any other version of the GNU Affero General Public
License.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package server.maps;
import java.rmi.RemoteException;
import java.util.List;
import client.MapleCharacter;
import java.util.ArrayList;
import net.world.remote.WorldChannelInterface;
import server.TimerManager;
import tools.MaplePacketCreator;
/*
* MapleTVEffect
* @author MrXotic
*/
public class MapleTVEffect {
private List<String> message = new ArrayList<String>(5);
private MapleCharacter user;
private static boolean active;
private int type;
private MapleCharacter partner;
public MapleTVEffect(MapleCharacter user_, MapleCharacter partner_, List<String> msg, int type_) {
this.message = msg;
this.user = user_;
this.type = type_;
this.partner = partner_;
broadcastTV(true);
}
public static boolean isActive() {
return active;
}
private void setActive(boolean set) {
active = set;
}
private void broadcastTV(boolean active_) {
WorldChannelInterface wci = user.getClient().getChannelServer().getWorldInterface();
setActive(active_);
try {
if (active_) {
wci.broadcastMessage(null, MaplePacketCreator.enableTV().getBytes());
wci.broadcastMessage(null, MaplePacketCreator.sendTV(user, message, type <= 2 ? type : type - 3, partner).getBytes());
int delay = 15000;
if (type == 4) {
delay = 30000;
} else if (type == 5) {
delay = 60000;
}
TimerManager.getInstance().schedule(new Runnable() {
@Override
public void run() {
broadcastTV(false);
}
}, delay);
} else {
wci.broadcastMessage(null, MaplePacketCreator.removeTV().getBytes());
}
} catch (RemoteException re) {
user.getClient().getChannelServer().reconnectWorld();
}
}
}
| am910021/YuriMS | src/server/maps/MapleTVEffect.java | Java | gpl-3.0 | 2,984 | [
30522,
1013,
1008,
2023,
5371,
2003,
2112,
1997,
1996,
26195,
5244,
11035,
2466,
8241,
9385,
1006,
1039,
1007,
2263,
4754,
15876,
2100,
1026,
4754,
1012,
15876,
2100,
1030,
10424,
2480,
1012,
10507,
1028,
17885,
2021,
2480,
1026,
13523,
437... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you 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.
*/
package org.apache.ambari.shell.commands;
import static org.mockito.Matchers.anyString;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
import java.io.File;
import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
import org.apache.ambari.groovy.client.AmbariClient;
import org.apache.ambari.shell.completion.ConfigType;
import org.apache.ambari.shell.model.AmbariContext;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.InjectMocks;
import org.mockito.Mock;
import org.mockito.runners.MockitoJUnitRunner;
@RunWith(MockitoJUnitRunner.class)
public class ConfigCommandsTest {
private static final String CORE_SITE = "core-site";
@InjectMocks
private ConfigCommands configCommands;
@Mock
private AmbariClient client;
@Mock
private AmbariContext context;
@Test
public void testShowConfig() {
ConfigType configType = mock(ConfigType.class);
Map<String, Map<String, String>> mockResult = mock(Map.class);
when(configType.getName()).thenReturn(CORE_SITE);
when(client.getServiceConfigMap(anyString())).thenReturn(mockResult);
when(mockResult.get(CORE_SITE)).thenReturn(new HashMap<String, String>());
configCommands.showConfig(configType);
verify(client).getServiceConfigMap(CORE_SITE);
}
@Test
public void testSetConfigForFile() throws IOException {
ConfigType configType = mock(ConfigType.class);
File file = new File("src/test/resources/core-site.xml");
when(configType.getName()).thenReturn(CORE_SITE);
configCommands.setConfig(configType, "", file);
Map<String, String> config = new HashMap<String, String>();
config.put("fs.trash.interval", "350");
config.put("ipc.client.connection.maxidletime", "30000");
verify(client).modifyConfiguration(CORE_SITE, config);
}
@Test
public void testModifyConfig() throws IOException {
ConfigType configType = mock(ConfigType.class);
Map<String, Map<String, String>> mockResult = mock(Map.class);
Map<String, String> config = new HashMap<String, String>();
config.put("fs.trash.interval", "350");
config.put("ipc.client.connection.maxidletime", "30000");
when(configType.getName()).thenReturn(CORE_SITE);
when(mockResult.get(CORE_SITE)).thenReturn(config);
when(client.getServiceConfigMap(CORE_SITE)).thenReturn(mockResult);
configCommands.modifyConfig(configType, "fs.trash.interval", "510");
Map<String, String> config2 = new HashMap<String, String>();
config2.put("fs.trash.interval", "510");
config2.put("ipc.client.connection.maxidletime", "30000");
verify(client).modifyConfiguration(CORE_SITE, config2);
}
}
| radicalbit/ambari | ambari-shell/ambari-groovy-shell/src/test/java/org/apache/ambari/shell/commands/ConfigCommandsTest.java | Java | apache-2.0 | 3,539 | [
30522,
1013,
1008,
1008,
1008,
7000,
2000,
1996,
15895,
4007,
3192,
1006,
2004,
2546,
1007,
2104,
2028,
1008,
2030,
2062,
12130,
6105,
10540,
1012,
2156,
1996,
5060,
5371,
1008,
5500,
2007,
2023,
2147,
2005,
3176,
2592,
1008,
4953,
9385,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
<?php
namespace APM\AchatBundle\Tests\Controller;
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
class Service_apres_venteControllerTest extends WebTestCase
{
public function testCompleteScenario()
{
$client = static::createClient();
//run this client to a separate client
$client->insulate();
// Create a new entry in the database
$client->request('GET', '/apm/achat_service_apres_vente');
$crawler = $client->followRedirect();
$this->assertEquals(200, $client->getResponse()->getStatusCode(), "Unexpected HTTP status code for GET /apm/achat_groupe_index/");
$crawler = $client->click($crawler->selectLink('Create a new entry')->link());
// Fill in the form and submit it
$form = $crawler->selectButton('Create')->form();
$form['service_apres_vente[codeSav]'] = 'SAV125';
$client->submit($form);
$crawler = $client->followRedirect();
// Check data in the show view
$this->assertGreaterThan(0, $crawler->filter('td:contains("SAV125")')->count(), 'Missing element "SAV125"');
// Edit the entity from the show view
$crawler = $client->click($crawler->selectLink('Edit')->link());
$form = $crawler->selectButton('Update')->form(array(
'service_apres_vente[codeSav]' => 'SAV000'
));
$client->submit($form);
$crawler = $client->followRedirect();
// Check the element contains an attribute with value equals "TG000"
$this->assertGreaterThan(0, $crawler->filter('td:contains("SAV000")')->count(), 'Missing element [value="TG000"]');
// Delete the entity and redirect to the list
$client->submit($crawler->selectButton('Delete')->form());
$this->assertTrue($client->getResponse()->isRedirect('/apm/achat_service_apres_vente/'), 'The response is redirect not to /apm/achat_groupe_index');
$client->followRedirect();
// Check the entity has been delete on the list
$this->assertNotRegExp('/SAV000/', $client->getResponse()->getContent());
}
}
| yannicksade/SAV8817 | src/APM/AchatBundle/Tests/Controller/Service_apres_venteControllerTest.php | PHP | mit | 2,108 | [
30522,
1026,
1029,
25718,
3415,
15327,
9706,
2213,
1032,
9353,
12707,
27265,
2571,
1032,
5852,
1032,
11486,
1025,
2224,
25353,
2213,
14876,
4890,
1032,
14012,
1032,
7705,
27265,
2571,
1032,
3231,
1032,
4773,
22199,
18382,
1025,
2465,
2326,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
/*
* Copyright (c) 2002-2015, the original author or authors.
*
* This software is distributable under the BSD license. See the terms of the
* BSD license in the documentation provided with this software.
*
* http://www.opensource.org/licenses/bsd-license.php
*/
package jline.internal;
import java.util.ArrayList;
import java.util.List;
import static jline.internal.Preconditions.checkNotNull;
/**
* Manages the JLine shutdown-hook thread and tasks to execute on shutdown.
*
* @author <a href="mailto:jason@planet57.com">Jason Dillon</a>
* @since 2.7
*/
public class ShutdownHooks
{
public static final String JLINE_SHUTDOWNHOOK = "jline.shutdownhook";
private static final boolean enabled = Configuration.getBoolean(JLINE_SHUTDOWNHOOK, true);
private static final List<Task> tasks = new ArrayList<Task>();
private static Thread hook;
public static synchronized <T extends Task> T add(final T task) {
checkNotNull(task);
// If not enabled ignore
if (!enabled) {
Log.debug("Shutdown-hook is disabled; not installing: ", task);
return task;
}
// Install the hook thread if needed
if (hook == null) {
hook = addHook(new Thread("JLine Shutdown Hook")
{
@Override
public void run() {
runTasks();
}
});
}
// Track the task
Log.debug("Adding shutdown-hook task: ", task);
tasks.add(task);
return task;
}
private static synchronized void runTasks() {
Log.debug("Running all shutdown-hook tasks");
// Iterate through copy of tasks list
for (Task task : tasks.toArray(new Task[tasks.size()])) {
Log.debug("Running task: ", task);
try {
task.run();
}
catch (Throwable e) {
Log.warn("Task failed", e);
}
}
tasks.clear();
}
private static Thread addHook(final Thread thread) {
Log.debug("Registering shutdown-hook: ", thread);
try {
Runtime.getRuntime().addShutdownHook(thread);
}
catch (AbstractMethodError e) {
// JDK 1.3+ only method. Bummer.
Log.debug("Failed to register shutdown-hook", e);
}
return thread;
}
public static synchronized void remove(final Task task) {
checkNotNull(task);
// ignore if not enabled or hook never installed
if (!enabled || hook == null) {
return;
}
// Drop the task
tasks.remove(task);
// If there are no more tasks, then remove the hook thread
if (tasks.isEmpty()) {
removeHook(hook);
hook = null;
}
}
private static void removeHook(final Thread thread) {
Log.debug("Removing shutdown-hook: ", thread);
try {
Runtime.getRuntime().removeShutdownHook(thread);
}
catch (AbstractMethodError e) {
// JDK 1.3+ only method. Bummer.
Log.debug("Failed to remove shutdown-hook", e);
}
catch (IllegalStateException e) {
// The VM is shutting down, not a big deal; ignore
}
}
/**
* Essentially a {@link Runnable} which allows running to throw an exception.
*/
public static interface Task
{
void run() throws Exception;
}
} | kaulkie/jline2 | src/main/java/jline/internal/ShutdownHooks.java | Java | bsd-3-clause | 3,503 | [
30522,
1013,
1008,
1008,
9385,
1006,
1039,
1007,
2526,
30524,
18667,
2094,
6105,
1012,
2156,
1996,
3408,
1997,
1996,
1008,
18667,
2094,
6105,
1999,
1996,
12653,
3024,
2007,
2023,
4007,
1012,
1008,
1008,
8299,
1024,
1013,
1013,
7479,
1012,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
/*
+------------------------------------------------------------------------+
| Phalcon Framework |
+------------------------------------------------------------------------+
| Copyright (c) 2011-2014 Phalcon Team (http://www.phalconphp.com) |
+------------------------------------------------------------------------+
| This source file is subject to the New BSD License that is bundled |
| with this package in the file docs/LICENSE.txt. |
| |
| If you did not receive a copy of the license and are unable to |
| obtain it through the world-wide-web, please send an email |
| to license@phalconphp.com so we can send you a copy immediately. |
+------------------------------------------------------------------------+
| Authors: Andres Gutierrez <andres@phalconphp.com> |
| Eduar Carvajal <eduar@phalconphp.com> |
+------------------------------------------------------------------------+
*/
#ifndef PHALCON_FORMS_ELEMENT_SUBMIT_H
#define PHALCON_FORMS_ELEMENT_SUBMIT_H
#include "php_phalcon.h"
extern zend_class_entry *phalcon_forms_element_submit_ce;
PHALCON_INIT_CLASS(Phalcon_Forms_Element_Submit);
#endif /* PHALCON_FORMS_ELEMENT_SUBMIT_H */
| unisys12/phalcon-hhvm | ext/forms/element/submit.h | C | bsd-2-clause | 1,422 | [
30522,
1013,
1008,
1009,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
101... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
//
// DFTextImageUserLineCell.h
// DFTimelineView
//
// Created by Allen Zhong on 15/10/15.
// Copyright (c) 2015年 Datafans, Inc. All rights reserved.
//
#import "DFBaseUserLineCell.h"
#import "DFTextImageUserLineItem.h"
@interface DFTextImageUserLineCell : DFBaseUserLineCell
@end
| long0419/FBLeagueV2 | Pods/DFTimelineView/DFTimelineView/DFTimelineView/UserTimeline/View/DFTextImageUserLineCell.h | C | gpl-3.0 | 291 | [
30522,
1013,
1013,
1013,
1013,
1040,
6199,
10288,
3775,
26860,
20330,
4179,
29109,
2140,
1012,
1044,
1013,
1013,
1040,
6199,
14428,
4179,
8584,
1013,
1013,
1013,
1013,
2580,
2011,
5297,
1062,
19991,
2006,
2321,
1013,
2184,
1013,
2321,
1012,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
import Chip from '../../components/Chip'
import { vueTest } from '../utils'
describe('Chip', () => {
let vm
before((done) => {
vm = vueTest(Chip)
vm.$nextTick(done)
})
it('renders with text', () => {
const el = vm.$('#chip')
el.should.contain.text('Basic chip')
el.should.not.have.class('mdl-chip--contact')
el.should.not.have.class('mdl-chip--deletable')
})
it('renders with close button', () => {
const el = vm.$('#delete')
el.should.contain.text('Deletable chip')
el.should.not.have.class('mdl-chip--contact')
el.should.have.class('mdl-chip--deletable')
const action = vm.$('#delete .mdl-chip__action')
action.should.exist
action.should.have.text('cancel')
})
it('has custom icon', (done) => {
const action = vm.$('#delete .mdl-chip__action')
action.should.have.text('cancel')
vm.deleteIcon = 'star'
vm.nextTick()
.then(() => {
action.should.have.text('star')
})
.then(done, done)
})
it('emits close event', (done) => {
vm.deleted.should.be.false
const action = vm.$('#delete .mdl-chip__action')
action.click()
vm.nextTick()
.then(() => {
vm.deleted.should.be.true
vm.deleted = false
return vm.nextTick()
})
.then(done, done)
})
it('renders text inside circle', (done) => {
vm.$('#contact').should.have.class('mdl-chip--contact')
const el = vm.$('#contact .mdl-chip__contact')
el.should.contain.text(vm.contact)
el.should.not.have.class('mdl-chip--deletable')
vm.contact = 'A'
vm.nextTick()
.then(() => {
el.should.have.text('A')
})
.then(done, done)
})
it('renders image inside circle', () => {
vm.$('#image').should.have.class('mdl-chip--contact')
const el = vm.$('#image .mdl-chip__contact')
el.should.have.attr('src', 'https://getmdl.io/templates/dashboard/images/user.jpg')
el.should.not.have.class('mdl-chip--deletable')
})
})
| posva/vue-mdl | test/unit/specs/Chip.spec.js | JavaScript | mit | 1,991 | [
30522,
12324,
9090,
2013,
1005,
1012,
1012,
1013,
1012,
1012,
1013,
6177,
1013,
9090,
1005,
12324,
1063,
24728,
12870,
3367,
1065,
2013,
1005,
1012,
1012,
1013,
21183,
12146,
1005,
6235,
1006,
1005,
9090,
1005,
1010,
1006,
1007,
1027,
1028,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
// Copyright 2014 Google Inc. All Rights Reserved.
//
// 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.
package v1
import (
"reflect"
"time"
)
type CpuSpec struct {
Limit uint64 `json:"limit"`
MaxLimit uint64 `json:"max_limit"`
Mask string `json:"mask,omitempty"`
}
type MemorySpec struct {
// The amount of memory requested. Default is unlimited (-1).
// Units: bytes.
Limit uint64 `json:"limit,omitempty"`
// The amount of guaranteed memory. Default is 0.
// Units: bytes.
Reservation uint64 `json:"reservation,omitempty"`
// The amount of swap space requested. Default is unlimited (-1).
// Units: bytes.
SwapLimit uint64 `json:"swap_limit,omitempty"`
}
type ContainerSpec struct {
// Time at which the container was created.
CreationTime time.Time `json:"creation_time,omitempty"`
HasCpu bool `json:"has_cpu"`
Cpu CpuSpec `json:"cpu,omitempty"`
HasMemory bool `json:"has_memory"`
Memory MemorySpec `json:"memory,omitempty"`
HasNetwork bool `json:"has_network"`
HasFilesystem bool `json:"has_filesystem"`
// HasDiskIo when true, indicates that DiskIo stats will be available.
HasDiskIo bool `json:"has_diskio"`
}
// Container reference contains enough information to uniquely identify a container
type ContainerReference struct {
// The absolute name of the container. This is unique on the machine.
Name string `json:"name"`
// Other names by which the container is known within a certain namespace.
// This is unique within that namespace.
Aliases []string `json:"aliases,omitempty"`
// Namespace under which the aliases of a container are unique.
// An example of a namespace is "docker" for Docker containers.
Namespace string `json:"namespace,omitempty"`
}
// Sorts by container name.
type ContainerReferenceSlice []ContainerReference
func (self ContainerReferenceSlice) Len() int { return len(self) }
func (self ContainerReferenceSlice) Swap(i, j int) { self[i], self[j] = self[j], self[i] }
func (self ContainerReferenceSlice) Less(i, j int) bool { return self[i].Name < self[j].Name }
// ContainerInfoQuery is used when users check a container info from the REST api.
// It specifies how much data users want to get about a container
type ContainerInfoRequest struct {
// Max number of stats to return. Specify -1 for all stats currently available.
// If start and end time are specified this limit is ignored.
// Default: 60
NumStats int `json:"num_stats,omitempty"`
// Start time for which to query information.
// If ommitted, the beginning of time is assumed.
Start time.Time `json:"start,omitempty"`
// End time for which to query information.
// If ommitted, current time is assumed.
End time.Time `json:"end,omitempty"`
}
// Returns a ContainerInfoRequest with all default values specified.
func DefaultContainerInfoRequest() ContainerInfoRequest {
return ContainerInfoRequest{
NumStats: 60,
}
}
func (self *ContainerInfoRequest) Equals(other ContainerInfoRequest) bool {
return self.NumStats == other.NumStats &&
self.Start.Equal(other.Start) &&
self.End.Equal(other.End)
}
type ContainerInfo struct {
ContainerReference
// The direct subcontainers of the current container.
Subcontainers []ContainerReference `json:"subcontainers,omitempty"`
// The isolation used in the container.
Spec ContainerSpec `json:"spec,omitempty"`
// Historical statistics gathered from the container.
Stats []*ContainerStats `json:"stats,omitempty"`
}
// TODO(vmarmol): Refactor to not need this equality comparison.
// ContainerInfo may be (un)marshaled by json or other en/decoder. In that
// case, the Timestamp field in each stats/sample may not be precisely
// en/decoded. This will lead to small but acceptable differences between a
// ContainerInfo and its encode-then-decode version. Eq() is used to compare
// two ContainerInfo accepting small difference (<10ms) of Time fields.
func (self *ContainerInfo) Eq(b *ContainerInfo) bool {
// If both self and b are nil, then Eq() returns true
if self == nil {
return b == nil
}
if b == nil {
return self == nil
}
// For fields other than time.Time, we will compare them precisely.
// This would require that any slice should have same order.
if !reflect.DeepEqual(self.ContainerReference, b.ContainerReference) {
return false
}
if !reflect.DeepEqual(self.Subcontainers, b.Subcontainers) {
return false
}
if !self.Spec.Eq(&b.Spec) {
return false
}
for i, expectedStats := range b.Stats {
selfStats := self.Stats[i]
if !expectedStats.Eq(selfStats) {
return false
}
}
return true
}
func (self *ContainerSpec) Eq(b *ContainerSpec) bool {
// Creation within 1s of each other.
diff := self.CreationTime.Sub(b.CreationTime)
if (diff > time.Second) || (diff < -time.Second) {
return false
}
if self.HasCpu != b.HasCpu {
return false
}
if !reflect.DeepEqual(self.Cpu, b.Cpu) {
return false
}
if self.HasMemory != b.HasMemory {
return false
}
if !reflect.DeepEqual(self.Memory, b.Memory) {
return false
}
if self.HasNetwork != b.HasNetwork {
return false
}
if self.HasFilesystem != b.HasFilesystem {
return false
}
if self.HasDiskIo != b.HasDiskIo {
return false
}
return true
}
func (self *ContainerInfo) StatsAfter(ref time.Time) []*ContainerStats {
n := len(self.Stats) + 1
for i, s := range self.Stats {
if s.Timestamp.After(ref) {
n = i
break
}
}
if n > len(self.Stats) {
return nil
}
return self.Stats[n:]
}
func (self *ContainerInfo) StatsStartTime() time.Time {
var ret time.Time
for _, s := range self.Stats {
if s.Timestamp.Before(ret) || ret.IsZero() {
ret = s.Timestamp
}
}
return ret
}
func (self *ContainerInfo) StatsEndTime() time.Time {
var ret time.Time
for i := len(self.Stats) - 1; i >= 0; i-- {
s := self.Stats[i]
if s.Timestamp.After(ret) {
ret = s.Timestamp
}
}
return ret
}
// This mirrors kernel internal structure.
type LoadStats struct {
// Number of sleeping tasks.
NrSleeping uint64 `json:"nr_sleeping"`
// Number of running tasks.
NrRunning uint64 `json:"nr_running"`
// Number of tasks in stopped state
NrStopped uint64 `json:"nr_stopped"`
// Number of tasks in uninterruptible state
NrUninterruptible uint64 `json:"nr_uninterruptible"`
// Number of tasks waiting on IO
NrIoWait uint64 `json:"nr_io_wait"`
}
// CPU usage time statistics.
type CpuUsage struct {
// Total CPU usage.
// Units: nanoseconds
Total uint64 `json:"total"`
// Per CPU/core usage of the container.
// Unit: nanoseconds.
PerCpu []uint64 `json:"per_cpu_usage,omitempty"`
// Time spent in user space.
// Unit: nanoseconds
User uint64 `json:"user"`
// Time spent in kernel space.
// Unit: nanoseconds
System uint64 `json:"system"`
}
// All CPU usage metrics are cumulative from the creation of the container
type CpuStats struct {
Usage CpuUsage `json:"usage"`
// Smoothed average of number of runnable threads x 1000.
// We multiply by thousand to avoid using floats, but preserving precision.
// Load is smoothed over the last 10 seconds. Instantaneous value can be read
// from LoadStats.NrRunning.
LoadAverage int32 `json:"load_average"`
}
type PerDiskStats struct {
Major uint64 `json:"major"`
Minor uint64 `json:"minor"`
Stats map[string]uint64 `json:"stats"`
}
type DiskIoStats struct {
IoServiceBytes []PerDiskStats `json:"io_service_bytes,omitempty"`
IoServiced []PerDiskStats `json:"io_serviced,omitempty"`
IoQueued []PerDiskStats `json:"io_queued,omitempty"`
Sectors []PerDiskStats `json:"sectors,omitempty"`
IoServiceTime []PerDiskStats `json:"io_service_time,omitempty"`
IoWaitTime []PerDiskStats `json:"io_wait_time,omitempty"`
IoMerged []PerDiskStats `json:"io_merged,omitempty"`
IoTime []PerDiskStats `json:"io_time,omitempty"`
}
type MemoryStats struct {
// Current memory usage, this includes all memory regardless of when it was
// accessed.
// Units: Bytes.
Usage uint64 `json:"usage"`
// The amount of working set memory, this includes recently accessed memory,
// dirty memory, and kernel memory. Working set is <= "usage".
// Units: Bytes.
WorkingSet uint64 `json:"working_set"`
ContainerData MemoryStatsMemoryData `json:"container_data,omitempty"`
HierarchicalData MemoryStatsMemoryData `json:"hierarchical_data,omitempty"`
}
type MemoryStatsMemoryData struct {
Pgfault uint64 `json:"pgfault"`
Pgmajfault uint64 `json:"pgmajfault"`
}
type NetworkStats struct {
// Cumulative count of bytes received.
RxBytes uint64 `json:"rx_bytes"`
// Cumulative count of packets received.
RxPackets uint64 `json:"rx_packets"`
// Cumulative count of receive errors encountered.
RxErrors uint64 `json:"rx_errors"`
// Cumulative count of packets dropped while receiving.
RxDropped uint64 `json:"rx_dropped"`
// Cumulative count of bytes transmitted.
TxBytes uint64 `json:"tx_bytes"`
// Cumulative count of packets transmitted.
TxPackets uint64 `json:"tx_packets"`
// Cumulative count of transmit errors encountered.
TxErrors uint64 `json:"tx_errors"`
// Cumulative count of packets dropped while transmitting.
TxDropped uint64 `json:"tx_dropped"`
}
type FsStats struct {
// The block device name associated with the filesystem.
Device string `json:"device,omitempty"`
// Number of bytes that can be consumed by the container on this filesystem.
Limit uint64 `json:"capacity"`
// Number of bytes that is consumed by the container on this filesystem.
Usage uint64 `json:"usage"`
// Number of reads completed
// This is the total number of reads completed successfully.
ReadsCompleted uint64 `json:"reads_completed"`
// Number of reads merged
// Reads and writes which are adjacent to each other may be merged for
// efficiency. Thus two 4K reads may become one 8K read before it is
// ultimately handed to the disk, and so it will be counted (and queued)
// as only one I/O. This field lets you know how often this was done.
ReadsMerged uint64 `json:"reads_merged"`
// Number of sectors read
// This is the total number of sectors read successfully.
SectorsRead uint64 `json:"sectors_read"`
// Number of milliseconds spent reading
// This is the total number of milliseconds spent by all reads (as
// measured from __make_request() to end_that_request_last()).
ReadTime uint64 `json:"read_time"`
// Number of writes completed
// This is the total number of writes completed successfully.
WritesCompleted uint64 `json:"writes_completed"`
// Number of writes merged
// See the description of reads merged.
WritesMerged uint64 `json:"writes_merged"`
// Number of sectors written
// This is the total number of sectors written successfully.
SectorsWritten uint64 `json:"sectors_written"`
// Number of milliseconds spent writing
// This is the total number of milliseconds spent by all writes (as
// measured from __make_request() to end_that_request_last()).
WriteTime uint64 `json:"write_time"`
// Number of I/Os currently in progress
// The only field that should go to zero. Incremented as requests are
// given to appropriate struct request_queue and decremented as they finish.
IoInProgress uint64 `json:"io_in_progress"`
// Number of milliseconds spent doing I/Os
// This field increases so long as field 9 is nonzero.
IoTime uint64 `json:"io_time"`
// weighted number of milliseconds spent doing I/Os
// This field is incremented at each I/O start, I/O completion, I/O
// merge, or read of these stats by the number of I/Os in progress
// (field 9) times the number of milliseconds spent doing I/O since the
// last update of this field. This can provide an easy measure of both
// I/O completion time and the backlog that may be accumulating.
WeightedIoTime uint64 `json:"weighted_io_time"`
}
type ContainerStats struct {
// The time of this stat point.
Timestamp time.Time `json:"timestamp"`
Cpu CpuStats `json:"cpu,omitempty"`
DiskIo DiskIoStats `json:"diskio,omitempty"`
Memory MemoryStats `json:"memory,omitempty"`
Network NetworkStats `json:"network,omitempty"`
// Filesystem statistics
Filesystem []FsStats `json:"filesystem,omitempty"`
// Task load stats
TaskStats LoadStats `json:"task_stats,omitempty"`
}
func timeEq(t1, t2 time.Time, tolerance time.Duration) bool {
// t1 should not be later than t2
if t1.After(t2) {
t1, t2 = t2, t1
}
diff := t2.Sub(t1)
if diff <= tolerance {
return true
}
return false
}
func durationEq(a, b time.Duration, tolerance time.Duration) bool {
if a > b {
a, b = b, a
}
diff := a - b
if diff <= tolerance {
return true
}
return false
}
const (
// 10ms, i.e. 0.01s
timePrecision time.Duration = 10 * time.Millisecond
)
// This function is useful because we do not require precise time
// representation.
func (a *ContainerStats) Eq(b *ContainerStats) bool {
if !timeEq(a.Timestamp, b.Timestamp, timePrecision) {
return false
}
return a.StatsEq(b)
}
// Checks equality of the stats values.
func (a *ContainerStats) StatsEq(b *ContainerStats) bool {
// TODO(vmarmol): Consider using this through reflection.
if !reflect.DeepEqual(a.Cpu, b.Cpu) {
return false
}
if !reflect.DeepEqual(a.Memory, b.Memory) {
return false
}
if !reflect.DeepEqual(a.DiskIo, b.DiskIo) {
return false
}
if !reflect.DeepEqual(a.Network, b.Network) {
return false
}
if !reflect.DeepEqual(a.Filesystem, b.Filesystem) {
return false
}
return true
}
// Saturate CPU usage to 0.
func calculateCpuUsage(prev, cur uint64) uint64 {
if prev > cur {
return 0
}
return cur - prev
}
// Event contains information general to events such as the time at which they
// occurred, their specific type, and the actual event. Event types are
// differentiated by the EventType field of Event.
type Event struct {
// the absolute container name for which the event occurred
ContainerName string `json:"container_name"`
// the time at which the event occurred
Timestamp time.Time `json:"timestamp"`
// the type of event. EventType is an enumerated type
EventType EventType `json:"event_type"`
// the original event object and all of its extraneous data, ex. an
// OomInstance
EventData EventData `json:"event_data,omitempty"`
}
// EventType is an enumerated type which lists the categories under which
// events may fall. The Event field EventType is populated by this enum.
type EventType int
const (
EventOom EventType = iota
EventContainerCreation
EventContainerDeletion
)
// Extra information about an event. Only one type will be set.
type EventData struct {
// Information about a container creation event.
Created *CreatedEventData `json:"created,omitempty"`
// Information about an OOM event.
Oom *OomEventData `json:"oom,omitempty"`
}
// Information related to a container creation event.
type CreatedEventData struct {
// Spec of the container at creation.
Spec ContainerSpec `json:"spec"`
}
// Information related to an OOM kill instance
type OomEventData struct {
// process id of the killed process
Pid int `json:"pid"`
// The name of the killed process
ProcessName string `json:"process_name"`
}
| wattsteve/kubernetes-1 | Godeps/_workspace/src/github.com/google/cadvisor/info/v1/container.go | GO | apache-2.0 | 15,644 | [
30522,
1013,
1013,
9385,
2297,
8224,
4297,
1012,
2035,
2916,
9235,
1012,
1013,
1013,
1013,
1013,
7000,
2104,
1996,
15895,
6105,
1010,
2544,
1016,
1012,
1014,
1006,
1996,
1000,
6105,
1000,
1007,
1025,
1013,
1013,
2017,
2089,
2025,
2224,
20... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.