text
stringlengths
2
1.04M
meta
dict
/* * This file is programmatically sanitized for style: * astyle --style=1tbs -f -p -H -j -U t_go_generator.cc * * The output of astyle should not be taken unquestioningly, but it is a good * guide for ensuring uniformity and readability. */ #include <fstream> #include <iostream> #include <limits> #include <string> #include <vector> #include <stdlib.h> #include <sys/stat.h> #include <sys/types.h> #include <sstream> #include <algorithm> #include <clocale> #include "thrift/platform.h" #include "thrift/version.h" #include "thrift/generate/t_generator.h" using std::map; using std::ofstream; using std::ostringstream; using std::string; using std::stringstream; using std::vector; static const string endl = "\n"; // avoid ostream << std::endl flushes /** * A helper for automatically formatting the emitted Go code from the Thrift * IDL per the Go style guide. * * Returns: * - true, if the formatting process succeeded. * - false, if the formatting process failed, which means the basic output was * still generated. */ bool format_go_output(const string& file_path); const string DEFAULT_THRIFT_IMPORT = "git.apache.org/thrift.git/lib/go/thrift"; static std::string package_flag; /** * Go code generator. */ class t_go_generator : public t_generator { public: t_go_generator(t_program* program, const std::map<std::string, std::string>& parsed_options, const std::string& option_string) : t_generator(program) { (void)option_string; std::map<std::string, std::string>::const_iterator iter; gen_thrift_import_ = DEFAULT_THRIFT_IMPORT; gen_package_prefix_ = ""; package_flag = ""; read_write_private_ = false; legacy_context_ = false; ignore_initialisms_ = false; for( iter = parsed_options.begin(); iter != parsed_options.end(); ++iter) { if( iter->first.compare("package_prefix") == 0) { gen_package_prefix_ = (iter->second); } else if( iter->first.compare("thrift_import") == 0) { gen_thrift_import_ = (iter->second); } else if( iter->first.compare("package") == 0) { package_flag = (iter->second); } else if( iter->first.compare("read_write_private") == 0) { read_write_private_ = true; } else if( iter->first.compare("legacy_context") == 0) { legacy_context_ = true; } else if( iter->first.compare("ignore_initialisms") == 0) { ignore_initialisms_ = true; } else { throw "unknown option go:" + iter->first; } } out_dir_base_ = "gen-go"; } /** * Init and close methods */ void init_generator(); void close_generator(); /** * Program-level generation functions */ void generate_typedef(t_typedef* ttypedef); void generate_enum(t_enum* tenum); void generate_const(t_const* tconst); void generate_struct(t_struct* tstruct); void generate_xception(t_struct* txception); void generate_service(t_service* tservice); std::string render_const_value(t_type* type, t_const_value* value, const string& name); /** * Struct generation code */ void generate_go_struct(t_struct* tstruct, bool is_exception); void generate_go_struct_definition(std::ofstream& out, t_struct* tstruct, bool is_xception = false, bool is_result = false, bool is_args = false); void generate_go_struct_initializer(std::ofstream& out, t_struct* tstruct, bool is_args_or_result = false); void generate_isset_helpers(std::ofstream& out, t_struct* tstruct, const string& tstruct_name, bool is_result = false); void generate_countsetfields_helper(std::ofstream& out, t_struct* tstruct, const string& tstruct_name, bool is_result = false); void generate_go_struct_reader(std::ofstream& out, t_struct* tstruct, const string& tstruct_name, bool is_result = false); void generate_go_struct_writer(std::ofstream& out, t_struct* tstruct, const string& tstruct_name, bool is_result = false, bool uses_countsetfields = false); void generate_go_function_helpers(t_function* tfunction); void get_publicized_name_and_def_value(t_field* tfield, string* OUT_pub_name, t_const_value** OUT_def_value) const; /** * Service-level generation functions */ void generate_service_helpers(t_service* tservice); void generate_service_interface(t_service* tservice); void generate_service_client(t_service* tservice); void generate_service_remote(t_service* tservice); void generate_service_server(t_service* tservice); void generate_process_function(t_service* tservice, t_function* tfunction); /** * Serialization constructs */ void generate_deserialize_field(std::ofstream& out, t_field* tfield, bool declare, std::string prefix = "", bool inclass = false, bool coerceData = false, bool inkey = false, bool in_container = false); void generate_deserialize_struct(std::ofstream& out, t_struct* tstruct, bool is_pointer_field, bool declare, std::string prefix = ""); void generate_deserialize_container(std::ofstream& out, t_type* ttype, bool pointer_field, bool declare, std::string prefix = ""); void generate_deserialize_set_element(std::ofstream& out, t_set* tset, bool declare, std::string prefix = ""); void generate_deserialize_map_element(std::ofstream& out, t_map* tmap, bool declare, std::string prefix = ""); void generate_deserialize_list_element(std::ofstream& out, t_list* tlist, bool declare, std::string prefix = ""); void generate_serialize_field(std::ofstream& out, t_field* tfield, std::string prefix = "", bool inkey = false); void generate_serialize_struct(std::ofstream& out, t_struct* tstruct, std::string prefix = ""); void generate_serialize_container(std::ofstream& out, t_type* ttype, bool pointer_field, std::string prefix = ""); void generate_serialize_map_element(std::ofstream& out, t_map* tmap, std::string kiter, std::string viter); void generate_serialize_set_element(std::ofstream& out, t_set* tmap, std::string iter); void generate_serialize_list_element(std::ofstream& out, t_list* tlist, std::string iter); void generate_go_docstring(std::ofstream& out, t_struct* tstruct); void generate_go_docstring(std::ofstream& out, t_function* tfunction); void generate_go_docstring(std::ofstream& out, t_doc* tdoc, t_struct* tstruct, const char* subheader); void generate_go_docstring(std::ofstream& out, t_doc* tdoc); /** * Helper rendering functions */ std::string go_autogen_comment(); std::string go_package(); std::string go_imports_begin(bool consts); std::string go_imports_end(); std::string render_includes(bool consts); std::string render_included_programs(string& unused_protection); std::string render_import_protection(); std::string render_fastbinary_includes(); std::string declare_argument(t_field* tfield); std::string render_field_initial_value(t_field* tfield, const string& name, bool optional_field); std::string type_name(t_type* ttype); std::string module_name(t_type* ttype); std::string function_signature(t_function* tfunction, std::string prefix = ""); std::string function_signature_if(t_function* tfunction, std::string prefix = "", bool addError = false); std::string argument_list(t_struct* tstruct); std::string type_to_enum(t_type* ttype); std::string type_to_go_type(t_type* ttype); std::string type_to_go_type_with_opt(t_type* ttype, bool optional_field); std::string type_to_go_key_type(t_type* ttype); std::string type_to_spec_args(t_type* ttype); static std::string get_real_go_module(const t_program* program) { if (!package_flag.empty()) { return package_flag; } std::string real_module = program->get_namespace("go"); if (!real_module.empty()) { return real_module; } return lowercase(program->get_name()); } private: std::string gen_package_prefix_; std::string gen_thrift_import_; bool read_write_private_; bool legacy_context_; bool ignore_initialisms_; /** * File streams */ std::ofstream f_types_; std::string f_types_name_; std::ofstream f_consts_; std::string f_consts_name_; std::stringstream f_const_values_; std::string package_name_; std::string package_dir_; std::string read_method_name_; std::string write_method_name_; std::set<std::string> commonInitialisms; std::string camelcase(const std::string& value) const; void fix_common_initialism(std::string& value, int i) const; std::string publicize(const std::string& value, bool is_args_or_result = false) const; std::string privatize(const std::string& value) const; std::string new_prefix(const std::string& value) const; static std::string variable_name_to_go_name(const std::string& value); static bool is_pointer_field(t_field* tfield, bool in_container = false); static bool omit_initialization(t_field* tfield); }; // returns true if field initialization can be omitted since it has corresponding go type zero value // or default value is not set bool t_go_generator::omit_initialization(t_field* tfield) { t_const_value* value = tfield->get_value(); if (!value) { return true; } t_type* type = tfield->get_type()->get_true_type(); if (type->is_base_type()) { t_base_type::t_base tbase = ((t_base_type*)type)->get_base(); switch (tbase) { case t_base_type::TYPE_VOID: throw ""; case t_base_type::TYPE_STRING: if (type->is_binary()) { //[]byte are always inline return false; } // strings are pointers if has no default return value->get_string().empty(); case t_base_type::TYPE_BOOL: case t_base_type::TYPE_I8: case t_base_type::TYPE_I16: case t_base_type::TYPE_I32: case t_base_type::TYPE_I64: return value->get_integer() == 0; case t_base_type::TYPE_DOUBLE: if (value->get_type() == t_const_value::CV_INTEGER) { return value->get_integer() == 0; } else { return value->get_double() == 0.; } } } return false; } // Returns true if the type need a reference if used as optional without default static bool type_need_reference(t_type* type) { type = type->get_true_type(); if (type->is_map() || type->is_set() || type->is_list() || type->is_struct() || type->is_xception() || type->is_binary()) { return false; } return true; } // returns false if field could not use comparison to default value as !IsSet* bool t_go_generator::is_pointer_field(t_field* tfield, bool in_container_value) { (void)in_container_value; if (tfield->annotations_.count("cpp.ref") != 0) { return true; } t_type* type = tfield->get_type()->get_true_type(); // Structs in containers are pointers if (type->is_struct() || type->is_xception()) { return true; } if (!(tfield->get_req() == t_field::T_OPTIONAL)) { return false; } bool has_default = tfield->get_value(); if (type->is_base_type()) { t_base_type::t_base tbase = ((t_base_type*)type)->get_base(); switch (tbase) { case t_base_type::TYPE_VOID: throw ""; case t_base_type::TYPE_STRING: if (type->is_binary()) { //[]byte are always inline return false; } // strings are pointers if has no default return !has_default; case t_base_type::TYPE_BOOL: case t_base_type::TYPE_I8: case t_base_type::TYPE_I16: case t_base_type::TYPE_I32: case t_base_type::TYPE_I64: case t_base_type::TYPE_DOUBLE: return !has_default; } } else if (type->is_enum()) { return !has_default; } else if (type->is_struct() || type->is_xception()) { return true; } else if (type->is_map()) { return has_default; } else if (type->is_set()) { return has_default; } else if (type->is_list()) { return has_default; } else if (type->is_typedef()) { return has_default; } throw "INVALID TYPE IN type_to_go_type: " + type->get_name(); } std::string t_go_generator::camelcase(const std::string& value) const { std::string value2(value); std::setlocale(LC_ALL, "C"); // set locale to classic // Fix common initialism in first word fix_common_initialism(value2, 0); // as long as we are changing things, let's change _ followed by lowercase to // capital and fix common initialisms for (std::string::size_type i = 1; i < value2.size() - 1; ++i) { if (value2[i] == '_') { if (islower(value2[i + 1])) { value2.replace(i, 2, 1, toupper(value2[i + 1])); } if (i > static_cast<std::string::size_type>(std::numeric_limits<int>().max())) { throw "integer overflow in t_go_generator::camelcase, value = " + value; } fix_common_initialism(value2, static_cast<int>(i)); } } return value2; } // Checks to see if the word starting at i in value contains a common initialism // and if so replaces it with the upper case version of the word. void t_go_generator::fix_common_initialism(std::string& value, int i) const { if (!ignore_initialisms_) { size_t wordLen = value.find('_', i); if (wordLen != std::string::npos) { wordLen -= i; } std::string word = value.substr(i, wordLen); std::transform(word.begin(), word.end(), word.begin(), ::toupper); if (commonInitialisms.find(word) != commonInitialisms.end()) { value.replace(i, word.length(), word); } } } std::string t_go_generator::publicize(const std::string& value, bool is_args_or_result) const { if (value.size() <= 0) { return value; } std::string value2(value), prefix; string::size_type dot_pos = value.rfind('.'); if (dot_pos != string::npos) { prefix = value.substr(0, dot_pos + 1) + prefix; value2 = value.substr(dot_pos + 1); } if (!isupper(value2[0])) { value2[0] = toupper(value2[0]); } value2 = camelcase(value2); // final length before further checks, the string may become longer size_t len_before = value2.length(); // IDL identifiers may start with "New" which interferes with the CTOR pattern // Adding an extra underscore to all those identifiers solves this if ((len_before >= 3) && (value2.substr(0, 3) == "New")) { value2 += '_'; } // IDL identifiers may end with "Args"/"Result" which interferes with the implicit service // function structs // Adding another extra underscore to all those identifiers solves this // Suppress this check for the actual helper struct names if (!is_args_or_result) { bool ends_with_args = (len_before >= 4) && (value2.substr(len_before - 4, 4) == "Args"); bool ends_with_rslt = (len_before >= 6) && (value2.substr(len_before - 6, 6) == "Result"); if (ends_with_args || ends_with_rslt) { value2 += '_'; } } // Avoid naming collisions with other services if (is_args_or_result) { prefix += publicize(service_name_); } return prefix + value2; } std::string t_go_generator::new_prefix(const std::string& value) const { if (value.size() <= 0) { return value; } string::size_type dot_pos = value.rfind('.'); if (dot_pos != string::npos) { return value.substr(0, dot_pos + 1) + "New" + publicize(value.substr(dot_pos + 1)); } return "New" + publicize(value); } std::string t_go_generator::privatize(const std::string& value) const { if (value.size() <= 0) { return value; } std::string value2(value); if (!islower(value2[0])) { value2[0] = tolower(value2[0]); } value2 = camelcase(value2); return value2; } std::string t_go_generator::variable_name_to_go_name(const std::string& value) { if (value.size() <= 0) { return value; } std::string value2(value); std::transform(value2.begin(), value2.end(), value2.begin(), ::tolower); switch (value[0]) { case 'b': case 'B': if (value2 != "break") { return value; } break; case 'c': case 'C': if (value2 != "case" && value2 != "chan" && value2 != "const" && value2 != "continue") { return value; } break; case 'd': case 'D': if (value2 != "default" && value2 != "defer") { return value; } break; case 'e': case 'E': if (value2 != "else" && value2 != "error") { return value; } break; case 'f': case 'F': if (value2 != "fallthrough" && value2 != "for" && value2 != "func") { return value; } break; case 'g': case 'G': if (value2 != "go" && value2 != "goto") { return value; } break; case 'i': case 'I': if (value2 != "if" && value2 != "import" && value2 != "interface") { return value; } break; case 'm': case 'M': if (value2 != "map") { return value; } break; case 'p': case 'P': if (value2 != "package") { return value; } break; case 'r': case 'R': if (value2 != "range" && value2 != "return") { return value; } break; case 's': case 'S': if (value2 != "select" && value2 != "struct" && value2 != "switch") { return value; } break; case 't': case 'T': if (value2 != "type") { return value; } break; case 'v': case 'V': if (value2 != "var") { return value; } break; default: return value; } return value2 + "_a1"; } /** * Prepares for file generation by opening up the necessary file output * streams. * * @param tprogram The program to generate */ void t_go_generator::init_generator() { // Make output directory string module = get_real_go_module(program_); string target = module; package_dir_ = get_out_dir(); // This set is taken from https://github.com/golang/lint/blob/master/lint.go#L692 commonInitialisms.insert("API"); commonInitialisms.insert("ASCII"); commonInitialisms.insert("CPU"); commonInitialisms.insert("CSS"); commonInitialisms.insert("DNS"); commonInitialisms.insert("EOF"); commonInitialisms.insert("GUID"); commonInitialisms.insert("HTML"); commonInitialisms.insert("HTTP"); commonInitialisms.insert("HTTPS"); commonInitialisms.insert("ID"); commonInitialisms.insert("IP"); commonInitialisms.insert("JSON"); commonInitialisms.insert("LHS"); commonInitialisms.insert("QPS"); commonInitialisms.insert("RAM"); commonInitialisms.insert("RHS"); commonInitialisms.insert("RPC"); commonInitialisms.insert("SLA"); commonInitialisms.insert("SMTP"); commonInitialisms.insert("SSH"); commonInitialisms.insert("TCP"); commonInitialisms.insert("TLS"); commonInitialisms.insert("TTL"); commonInitialisms.insert("UDP"); commonInitialisms.insert("UI"); commonInitialisms.insert("UID"); commonInitialisms.insert("UUID"); commonInitialisms.insert("URI"); commonInitialisms.insert("URL"); commonInitialisms.insert("UTF8"); commonInitialisms.insert("VM"); commonInitialisms.insert("XML"); commonInitialisms.insert("XSRF"); commonInitialisms.insert("XSS"); // names of read and write methods if (read_write_private_) { read_method_name_ = "read"; write_method_name_ = "write"; } else { read_method_name_ = "Read"; write_method_name_ = "Write"; } while (true) { // TODO: Do better error checking here. MKDIR(package_dir_.c_str()); if (module.empty()) { break; } string::size_type pos = module.find('.'); if (pos == string::npos) { package_dir_ += "/"; package_dir_ += module; package_name_ = module; module.clear(); } else { package_dir_ += "/"; package_dir_ += module.substr(0, pos); module.erase(0, pos + 1); } } string::size_type loc; while ((loc = target.find(".")) != string::npos) { target.replace(loc, 1, 1, '/'); } // Make output files f_types_name_ = package_dir_ + "/" + program_name_ + ".go"; f_types_.open(f_types_name_.c_str()); f_consts_name_ = package_dir_ + "/" + program_name_ + "-consts.go"; f_consts_.open(f_consts_name_.c_str()); vector<t_service*> services = program_->get_services(); vector<t_service*>::iterator sv_iter; for (sv_iter = services.begin(); sv_iter != services.end(); ++sv_iter) { string service_dir = package_dir_ + "/" + underscore((*sv_iter)->get_name()) + "-remote"; MKDIR(service_dir.c_str()); } // Print header f_types_ << go_autogen_comment() << go_package() << render_includes(false); f_consts_ << go_autogen_comment() << go_package() << render_includes(true); f_const_values_ << endl << "func init() {" << endl; // Create file for the GoUnusedProtection__ variable string f_unused_prot_name_ = package_dir_ + "/" + "GoUnusedProtection__.go"; ofstream f_unused_prot_; f_unused_prot_.open(f_unused_prot_name_.c_str()); f_unused_prot_ << go_autogen_comment() << go_package() << render_import_protection(); f_unused_prot_.close(); } string t_go_generator::render_included_programs(string& unused_protection) { const vector<t_program*>& includes = program_->get_includes(); string result = ""; unused_protection = ""; string local_namespace = program_->get_namespace("go"); for (size_t i = 0; i < includes.size(); ++i) { if (!local_namespace.empty() && local_namespace == includes[i]->get_namespace("go")) { continue; } string go_module = get_real_go_module(includes[i]); size_t found = 0; for (size_t j = 0; j < go_module.size(); j++) { // Import statement uses slashes ('/') in namespace if (go_module[j] == '.') { go_module[j] = '/'; found = j + 1; } } result += "\t\"" + gen_package_prefix_ + go_module + "\"\n"; unused_protection += "var _ = " + go_module.substr(found) + ".GoUnusedProtection__\n"; } return result; } /** * Renders all the imports necessary for including another Thrift program. * If consts include the additional imports. */ string t_go_generator::render_includes(bool consts) { const vector<t_program*>& includes = program_->get_includes(); string result = ""; string unused_prot = ""; string local_namespace = program_->get_namespace("go"); for (size_t i = 0; i < includes.size(); ++i) { if (!local_namespace.empty() && local_namespace == includes[i]->get_namespace("go")) { continue; } string go_module = get_real_go_module(includes[i]); size_t found = 0; for (size_t j = 0; j < go_module.size(); j++) { // Import statement uses slashes ('/') in namespace if (go_module[j] == '.') { go_module[j] = '/'; found = j + 1; } } result += "\t\"" + gen_package_prefix_ + go_module + "\"\n"; unused_prot += "var _ = " + go_module.substr(found) + ".GoUnusedProtection__\n"; } if (includes.size() > 0) { result += "\n"; } return go_imports_begin(consts) + result + go_imports_end() + unused_prot; } string t_go_generator::render_import_protection() { return string("var GoUnusedProtection__ int;\n\n"); } /** * Renders all the imports necessary to use the accelerated TBinaryProtocol */ string t_go_generator::render_fastbinary_includes() { return ""; } /** * Autogen'd comment */ string t_go_generator::go_autogen_comment() { return std::string() + "// Autogenerated by Thrift Compiler (" + THRIFT_VERSION + ")\n" "// DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING\n\n"; } /** * Prints standard thrift package */ string t_go_generator::go_package() { return string("package ") + package_name_ + "\n\n"; } /** * Render the beginning of the import statement. * If consts include the additional imports. */ string t_go_generator::go_imports_begin(bool consts) { string extra; // If not writing constants, and there are enums, need extra imports. if (!consts && get_program()->get_enums().size() > 0) { extra += "\t\"database/sql/driver\"\n" "\t\"errors\"\n"; } if (legacy_context_) { extra += "\t\"golang.org/x/net/context\"\n"; } else { extra += "\t\"context\"\n"; } return string( "import (\n" "\t\"bytes\"\n" "\t\"reflect\"\n" + extra + "\t\"fmt\"\n" "\t\"" + gen_thrift_import_ + "\"\n"); } /** * End the import statement, include undscore-assignments * * These "_ =" prevent the go compiler complaining about unused imports. * This will have to do in lieu of more intelligent import statement construction */ string t_go_generator::go_imports_end() { return string( ")\n\n" "// (needed to ensure safety because of naive import list construction.)\n" "var _ = thrift.ZERO\n" "var _ = fmt.Printf\n" "var _ = context.Background\n" "var _ = reflect.DeepEqual\n" "var _ = bytes.Equal\n\n"); } /** * Closes the type files */ void t_go_generator::close_generator() { f_const_values_ << "}" << endl << endl; f_consts_ << f_const_values_.str(); // Close types and constants files f_consts_.close(); f_types_.close(); format_go_output(f_types_name_); format_go_output(f_consts_name_); } /** * Generates a typedef. * * @param ttypedef The type definition */ void t_go_generator::generate_typedef(t_typedef* ttypedef) { generate_go_docstring(f_types_, ttypedef); string new_type_name(publicize(ttypedef->get_symbolic())); string base_type(type_to_go_type(ttypedef->get_type())); if (base_type == new_type_name) { return; } f_types_ << "type " << new_type_name << " " << base_type << endl << endl; // Generate a convenience function that converts an instance of a type // (which may be a constant) into a pointer to an instance of a type. f_types_ << "func " << new_type_name << "Ptr(v " << new_type_name << ") *" << new_type_name << " { return &v }" << endl << endl; } /** * Generates code for an enumerated type. Done using a class to scope * the values. * * @param tenum The enumeration */ void t_go_generator::generate_enum(t_enum* tenum) { std::ostringstream to_string_mapping, from_string_mapping; std::string tenum_name(publicize(tenum->get_name())); generate_go_docstring(f_types_, tenum); f_types_ << "type " << tenum_name << " int64" << endl << "const (" << endl; to_string_mapping << indent() << "func (p " << tenum_name << ") String() string {" << endl; to_string_mapping << indent() << " switch p {" << endl; from_string_mapping << indent() << "func " << tenum_name << "FromString(s string) (" << tenum_name << ", error) {" << endl; from_string_mapping << indent() << " switch s {" << endl; vector<t_enum_value*> constants = tenum->get_constants(); vector<t_enum_value*>::iterator c_iter; int value = -1; for (c_iter = constants.begin(); c_iter != constants.end(); ++c_iter) { value = (*c_iter)->get_value(); string iter_std_name(escape_string((*c_iter)->get_name())); string iter_name((*c_iter)->get_name()); f_types_ << indent() << " " << tenum_name << "_" << iter_name << ' ' << tenum_name << " = " << value << endl; // Dictionaries to/from string names of enums to_string_mapping << indent() << " case " << tenum_name << "_" << iter_name << ": return \"" << iter_std_name << "\"" << endl; if (iter_std_name != escape_string(iter_name)) { from_string_mapping << indent() << " case \"" << iter_std_name << "\", \"" << escape_string(iter_name) << "\": return " << tenum_name << "_" << iter_name << ", nil " << endl; } else { from_string_mapping << indent() << " case \"" << iter_std_name << "\": return " << tenum_name << "_" << iter_name << ", nil " << endl; } } to_string_mapping << indent() << " }" << endl; to_string_mapping << indent() << " return \"<UNSET>\"" << endl; to_string_mapping << indent() << "}" << endl; from_string_mapping << indent() << " }" << endl; from_string_mapping << indent() << " return " << tenum_name << "(0)," << " fmt.Errorf(\"not a valid " << tenum_name << " string\")" << endl; from_string_mapping << indent() << "}" << endl; f_types_ << ")" << endl << endl << to_string_mapping.str() << endl << from_string_mapping.str() << endl << endl; // Generate a convenience function that converts an instance of an enum // (which may be a constant) into a pointer to an instance of that enum // type. f_types_ << "func " << tenum_name << "Ptr(v " << tenum_name << ") *" << tenum_name << " { return &v }" << endl << endl; // Generate MarshalText f_types_ << "func (p " << tenum_name << ") MarshalText() ([]byte, error) {" << endl; f_types_ << "return []byte(p.String()), nil" << endl; f_types_ << "}" << endl << endl; // Generate UnmarshalText f_types_ << "func (p *" << tenum_name << ") UnmarshalText(text []byte) error {" << endl; f_types_ << "q, err := " << tenum_name << "FromString(string(text))" << endl; f_types_ << "if (err != nil) {" << endl << "return err" << endl << "}" << endl; f_types_ << "*p = q" << endl; f_types_ << "return nil" << endl; f_types_ << "}" << endl << endl; // Generate Scan for sql.Scanner interface f_types_ << "func (p *" << tenum_name << ") Scan(value interface{}) error {" <<endl; f_types_ << "v, ok := value.(int64)" <<endl; f_types_ << "if !ok {" <<endl; f_types_ << "return errors.New(\"Scan value is not int64\")" <<endl; f_types_ << "}" <<endl; f_types_ << "*p = " << tenum_name << "(v)" << endl; f_types_ << "return nil" << endl; f_types_ << "}" << endl << endl; // Generate Value for driver.Valuer interface f_types_ << "func (p * " << tenum_name << ") Value() (driver.Value, error) {" <<endl; f_types_ << " if p == nil {" << endl; f_types_ << " return nil, nil" << endl; f_types_ << " }" << endl; f_types_ << "return int64(*p), nil" << endl; f_types_ << "}" << endl; } /** * Generate a constant value */ void t_go_generator::generate_const(t_const* tconst) { t_type* type = tconst->get_type(); string name = publicize(tconst->get_name()); t_const_value* value = tconst->get_value(); if (type->is_base_type() || type->is_enum()) { indent(f_consts_) << "const " << name << " = " << render_const_value(type, value, name) << endl; } else { f_const_values_ << indent() << name << " = " << render_const_value(type, value, name) << endl << endl; f_consts_ << indent() << "var " << name << " " << type_to_go_type(type) << endl; } } /** * Prints the value of a constant with the given type. Note that type checking * is NOT performed in this function as it is always run beforehand using the * validate_types method in main.cc */ string t_go_generator::render_const_value(t_type* type, t_const_value* value, const string& name) { type = get_true_type(type); std::ostringstream out; if (type->is_base_type()) { t_base_type::t_base tbase = ((t_base_type*)type)->get_base(); switch (tbase) { case t_base_type::TYPE_STRING: if (type->is_binary()) { out << "[]byte(\"" << get_escaped_string(value) << "\")"; } else { out << '"' << get_escaped_string(value) << '"'; } break; case t_base_type::TYPE_BOOL: out << (value->get_integer() > 0 ? "true" : "false"); break; case t_base_type::TYPE_I8: case t_base_type::TYPE_I16: case t_base_type::TYPE_I32: case t_base_type::TYPE_I64: out << value->get_integer(); break; case t_base_type::TYPE_DOUBLE: if (value->get_type() == t_const_value::CV_INTEGER) { out << value->get_integer(); } else { out << value->get_double(); } break; default: throw "compiler error: no const of base type " + t_base_type::t_base_name(tbase); } } else if (type->is_enum()) { indent(out) << value->get_integer(); } else if (type->is_struct() || type->is_xception()) { out << "&" << publicize(type_name(type)) << "{"; indent_up(); const vector<t_field*>& fields = ((t_struct*)type)->get_members(); vector<t_field*>::const_iterator f_iter; const map<t_const_value*, t_const_value*>& val = value->get_map(); map<t_const_value*, t_const_value*>::const_iterator v_iter; for (v_iter = val.begin(); v_iter != val.end(); ++v_iter) { t_type* field_type = NULL; for (f_iter = fields.begin(); f_iter != fields.end(); ++f_iter) { if ((*f_iter)->get_name() == v_iter->first->get_string()) { field_type = (*f_iter)->get_type(); } } if (field_type == NULL) { throw "type error: " + type->get_name() + " has no field " + v_iter->first->get_string(); } out << endl << indent() << publicize(v_iter->first->get_string()) << ": " << render_const_value(field_type, v_iter->second, name) << "," << endl; } indent_down(); out << "}"; } else if (type->is_map()) { t_type* ktype = ((t_map*)type)->get_key_type(); t_type* vtype = ((t_map*)type)->get_val_type(); const map<t_const_value*, t_const_value*>& val = value->get_map(); out << "map[" << type_to_go_type(ktype) << "]" << type_to_go_type(vtype) << "{" << endl; indent_up(); map<t_const_value*, t_const_value*>::const_iterator v_iter; for (v_iter = val.begin(); v_iter != val.end(); ++v_iter) { out << indent() << render_const_value(ktype, v_iter->first, name) << ": " << render_const_value(vtype, v_iter->second, name) << "," << endl; } indent_down(); out << indent() << "}"; } else if (type->is_list()) { t_type* etype = ((t_list*)type)->get_elem_type(); const vector<t_const_value*>& val = value->get_list(); out << "[]" << type_to_go_type(etype) << "{" << endl; indent_up(); vector<t_const_value*>::const_iterator v_iter; for (v_iter = val.begin(); v_iter != val.end(); ++v_iter) { out << indent() << render_const_value(etype, *v_iter, name) << ", "; } indent_down(); out << indent() << "}"; } else if (type->is_set()) { t_type* etype = ((t_set*)type)->get_elem_type(); const vector<t_const_value*>& val = value->get_list(); out << "[]" << type_to_go_key_type(etype) << "{" << endl; indent_up(); vector<t_const_value*>::const_iterator v_iter; for (v_iter = val.begin(); v_iter != val.end(); ++v_iter) { out << indent() << render_const_value(etype, *v_iter, name) << ", "; } indent_down(); out << indent() << "}"; } else { throw "CANNOT GENERATE CONSTANT FOR TYPE: " + type->get_name(); } return out.str(); } /** * Generates a go struct */ void t_go_generator::generate_struct(t_struct* tstruct) { generate_go_struct(tstruct, false); } /** * Generates a struct definition for a thrift exception. Basically the same * as a struct but extends the Exception class. * * @param txception The struct definition */ void t_go_generator::generate_xception(t_struct* txception) { generate_go_struct(txception, true); } /** * Generates a go struct */ void t_go_generator::generate_go_struct(t_struct* tstruct, bool is_exception) { generate_go_struct_definition(f_types_, tstruct, is_exception); } void t_go_generator::get_publicized_name_and_def_value(t_field* tfield, string* OUT_pub_name, t_const_value** OUT_def_value) const { const string base_field_name = tfield->get_name(); const string escaped_field_name = escape_string(base_field_name); *OUT_pub_name = publicize(escaped_field_name); *OUT_def_value = tfield->get_value(); } void t_go_generator::generate_go_struct_initializer(ofstream& out, t_struct* tstruct, bool is_args_or_result) { out << publicize(type_name(tstruct), is_args_or_result) << "{"; const vector<t_field*>& members = tstruct->get_members(); for (vector<t_field*>::const_iterator m_iter = members.begin(); m_iter != members.end(); ++m_iter) { bool pointer_field = is_pointer_field(*m_iter); string publicized_name; t_const_value* def_value; get_publicized_name_and_def_value(*m_iter, &publicized_name, &def_value); if (!pointer_field && def_value != NULL && !omit_initialization(*m_iter)) { out << endl << indent() << publicized_name << ": " << render_field_initial_value(*m_iter, (*m_iter)->get_name(), pointer_field) << "," << endl; } } out << "}" << endl; } /** * Generates a struct definition for a thrift data type. * * @param tstruct The struct definition */ void t_go_generator::generate_go_struct_definition(ofstream& out, t_struct* tstruct, bool is_exception, bool is_result, bool is_args) { const vector<t_field*>& members = tstruct->get_members(); const vector<t_field*>& sorted_members = tstruct->get_sorted_members(); vector<t_field*>::const_iterator m_iter; std::string tstruct_name(publicize(tstruct->get_name(), is_args || is_result)); generate_go_docstring(out, tstruct); out << indent() << "type " << tstruct_name << " struct {" << endl; /* Here we generate the structure specification for the fastbinary codec. These specifications have the following structure: thrift_spec -> tuple of item_spec item_spec -> nil | (tag, type_enum, name, spec_args, default) tag -> integer type_enum -> TType.I32 | TType.STRING | TType.STRUCT | ... name -> string_literal default -> nil # Handled by __init__ spec_args -> nil # For simple types | (type_enum, spec_args) # Value type for list/set | (type_enum, spec_args, type_enum, spec_args) # Key and value for map | (class_name, spec_args_ptr) # For struct/exception class_name -> identifier # Basically a pointer to the class spec_args_ptr -> expression # just class_name.spec_args TODO(dreiss): Consider making this work for structs with negative tags. */ // TODO(dreiss): Look into generating an empty tuple instead of nil // for structures with no members. // TODO(dreiss): Test encoding of structs where some inner structs // don't have thrift_spec. indent_up(); int num_setable = 0; if (sorted_members.empty() || (sorted_members[0]->get_key() >= 0)) { int sorted_keys_pos = 0; for (m_iter = sorted_members.begin(); m_iter != sorted_members.end(); ++m_iter) { // Set field to optional if field is union, this is so we can get a // pointer to the field. if (tstruct->is_union()) (*m_iter)->set_req(t_field::T_OPTIONAL); if (sorted_keys_pos != (*m_iter)->get_key()) { int first_unused = std::max(1, sorted_keys_pos++); while (sorted_keys_pos != (*m_iter)->get_key()) { ++sorted_keys_pos; } int last_unused = sorted_keys_pos - 1; if (first_unused < last_unused) { indent(out) << "// unused fields # " << first_unused << " to " << last_unused << endl; } else if (first_unused == last_unused) { indent(out) << "// unused field # " << first_unused << endl; } } t_type* fieldType = (*m_iter)->get_type(); string goType = type_to_go_type_with_opt(fieldType, is_pointer_field(*m_iter)); string gotag = "db:\"" + escape_string((*m_iter)->get_name()) + "\" "; if ((*m_iter)->get_req() == t_field::T_OPTIONAL) { gotag += "json:\"" + escape_string((*m_iter)->get_name()) + ",omitempty\""; } else { gotag += "json:\"" + escape_string((*m_iter)->get_name()) + "\""; } // Check for user override of db and json tags using "go.tag" std::map<string, string>::iterator it = (*m_iter)->annotations_.find("go.tag"); if (it != (*m_iter)->annotations_.end()) { gotag = it->second; } indent(out) << publicize((*m_iter)->get_name()) << " " << goType << " `thrift:\"" << escape_string((*m_iter)->get_name()) << "," << sorted_keys_pos; if ((*m_iter)->get_req() == t_field::T_REQUIRED) { out << ",required"; } out << "\" " << gotag << "`" << endl; sorted_keys_pos++; } } else { for (m_iter = members.begin(); m_iter != members.end(); ++m_iter) { // This fills in default values, as opposed to nulls out << indent() << publicize((*m_iter)->get_name()) << " " << type_to_go_type((*m_iter)->get_type()) << endl; } } indent_down(); out << indent() << "}" << endl << endl; out << indent() << "func New" << tstruct_name << "() *" << tstruct_name << " {" << endl; out << indent() << " return &"; generate_go_struct_initializer(out, tstruct, is_result || is_args); out << indent() << "}" << endl << endl; // Default values for optional fields for (m_iter = members.begin(); m_iter != members.end(); ++m_iter) { string publicized_name; t_const_value* def_value; get_publicized_name_and_def_value(*m_iter, &publicized_name, &def_value); t_type* fieldType = (*m_iter)->get_type(); string goType = type_to_go_type_with_opt(fieldType, false); string def_var_name = tstruct_name + "_" + publicized_name + "_DEFAULT"; if ((*m_iter)->get_req() == t_field::T_OPTIONAL || is_pointer_field(*m_iter)) { out << indent() << "var " << def_var_name << " " << goType; if (def_value != NULL) { out << " = " << render_const_value(fieldType, def_value, (*m_iter)->get_name()); } out << endl; } if (is_pointer_field(*m_iter)) { string goOptType = type_to_go_type_with_opt(fieldType, true); string maybepointer = goOptType != goType ? "*" : ""; out << indent() << "func (p *" << tstruct_name << ") Get" << publicized_name << "() " << goType << " {" << endl; out << indent() << " if !p.IsSet" << publicized_name << "() {" << endl; out << indent() << " return " << def_var_name << endl; out << indent() << " }" << endl; out << indent() << "return " << maybepointer << "p." << publicized_name << endl; out << indent() << "}" << endl; num_setable += 1; } else { out << endl; out << indent() << "func (p *" << tstruct_name << ") Get" << publicized_name << "() " << goType << " {" << endl; out << indent() << " return p." << publicized_name << endl; out << indent() << "}" << endl; } } if (tstruct->is_union() && num_setable > 0) { generate_countsetfields_helper(out, tstruct, tstruct_name, is_result); } generate_isset_helpers(out, tstruct, tstruct_name, is_result); generate_go_struct_reader(out, tstruct, tstruct_name, is_result); generate_go_struct_writer(out, tstruct, tstruct_name, is_result, num_setable > 0); out << indent() << "func (p *" << tstruct_name << ") String() string {" << endl; out << indent() << " if p == nil {" << endl; out << indent() << " return \"<nil>\"" << endl; out << indent() << " }" << endl; out << indent() << " return fmt.Sprintf(\"" << escape_string(tstruct_name) << "(%+v)\", *p)" << endl; out << indent() << "}" << endl << endl; if (is_exception) { out << indent() << "func (p *" << tstruct_name << ") Error() string {" << endl; out << indent() << " return p.String()" << endl; out << indent() << "}" << endl << endl; } } /** * Generates the IsSet helper methods for a struct */ void t_go_generator::generate_isset_helpers(ofstream& out, t_struct* tstruct, const string& tstruct_name, bool is_result) { (void)is_result; const vector<t_field*>& fields = tstruct->get_members(); vector<t_field*>::const_iterator f_iter; const string escaped_tstruct_name(escape_string(tstruct->get_name())); for (f_iter = fields.begin(); f_iter != fields.end(); ++f_iter) { const string field_name(publicize(escape_string((*f_iter)->get_name()))); if ((*f_iter)->get_req() == t_field::T_OPTIONAL || is_pointer_field(*f_iter)) { out << indent() << "func (p *" << tstruct_name << ") IsSet" << field_name << "() bool {" << endl; indent_up(); t_type* ttype = (*f_iter)->get_type()->get_true_type(); bool is_byteslice = ttype->is_binary(); bool compare_to_nil_only = ttype->is_set() || ttype->is_list() || ttype->is_map() || (is_byteslice && !(*f_iter)->get_value()); if (is_pointer_field(*f_iter) || compare_to_nil_only) { out << indent() << "return p." << field_name << " != nil" << endl; } else { string def_var_name = tstruct_name + "_" + field_name + "_DEFAULT"; if (is_byteslice) { out << indent() << "return !bytes.Equal(p." << field_name << ", " << def_var_name << ")" << endl; } else { out << indent() << "return p." << field_name << " != " << def_var_name << endl; } } indent_down(); out << indent() << "}" << endl << endl; } } } /** * Generates the CountSetFields helper method for a struct */ void t_go_generator::generate_countsetfields_helper(ofstream& out, t_struct* tstruct, const string& tstruct_name, bool is_result) { (void)is_result; const vector<t_field*>& fields = tstruct->get_members(); vector<t_field*>::const_iterator f_iter; const string escaped_tstruct_name(escape_string(tstruct->get_name())); out << indent() << "func (p *" << tstruct_name << ") CountSetFields" << tstruct_name << "() int {" << endl; indent_up(); out << indent() << "count := 0" << endl; for (f_iter = fields.begin(); f_iter != fields.end(); ++f_iter) { if ((*f_iter)->get_req() == t_field::T_REQUIRED) continue; t_type* type = (*f_iter)->get_type()->get_true_type(); if (!(is_pointer_field(*f_iter) || type->is_map() || type->is_set() || type->is_list())) continue; const string field_name(publicize(escape_string((*f_iter)->get_name()))); out << indent() << "if (p.IsSet" << field_name << "()) {" << endl; indent_up(); out << indent() << "count++" << endl; indent_down(); out << indent() << "}" << endl; } out << indent() << "return count" << endl << endl; indent_down(); out << indent() << "}" << endl << endl; } /** * Generates the read method for a struct */ void t_go_generator::generate_go_struct_reader(ofstream& out, t_struct* tstruct, const string& tstruct_name, bool is_result) { (void)is_result; const vector<t_field*>& fields = tstruct->get_members(); vector<t_field*>::const_iterator f_iter; string escaped_tstruct_name(escape_string(tstruct->get_name())); out << indent() << "func (p *" << tstruct_name << ") " << read_method_name_ << "(iprot thrift.TProtocol) error {" << endl; indent_up(); out << indent() << "if _, err := iprot.ReadStructBegin(); err != nil {" << endl; out << indent() << " return thrift.PrependError(fmt.Sprintf(\"%T read error: \", p), err)" << endl; out << indent() << "}" << endl << endl; // Required variables does not have IsSet functions, so we need tmp vars to check them. for (f_iter = fields.begin(); f_iter != fields.end(); ++f_iter) { if ((*f_iter)->get_req() == t_field::T_REQUIRED) { const string field_name(publicize(escape_string((*f_iter)->get_name()))); indent(out) << "var isset" << field_name << " bool = false;" << endl; } } out << endl; // Loop over reading in fields indent(out) << "for {" << endl; indent_up(); // Read beginning field marker out << indent() << "_, fieldTypeId, fieldId, err := iprot.ReadFieldBegin()" << endl; out << indent() << "if err != nil {" << endl; out << indent() << " return thrift.PrependError(fmt.Sprintf(" "\"%T field %d read error: \", p, fieldId), err)" << endl; out << indent() << "}" << endl; // Check for field STOP marker and break out << indent() << "if fieldTypeId == thrift.STOP { break; }" << endl; string thriftFieldTypeId; // Generate deserialization code for known cases int32_t field_id = -1; // Switch statement on the field we are reading, false if no fields present bool have_switch = !fields.empty(); if (have_switch) { indent(out) << "switch fieldId {" << endl; } // All the fields we know for (f_iter = fields.begin(); f_iter != fields.end(); ++f_iter) { field_id = (*f_iter)->get_key(); // if negative id, ensure we generate a valid method name string field_method_prefix("ReadField"); int32_t field_method_suffix = field_id; if (field_method_suffix < 0) { field_method_prefix += "_"; field_method_suffix *= -1; } out << indent() << "case " << field_id << ":" << endl; indent_up(); thriftFieldTypeId = type_to_enum((*f_iter)->get_type()); if (thriftFieldTypeId == "thrift.BINARY") { thriftFieldTypeId = "thrift.STRING"; } out << indent() << "if fieldTypeId == " << thriftFieldTypeId << " {" << endl; out << indent() << " if err := p." << field_method_prefix << field_method_suffix << "(iprot); err != nil {" << endl; out << indent() << " return err" << endl; out << indent() << " }" << endl; out << indent() << "} else {" << endl; out << indent() << " if err := iprot.Skip(fieldTypeId); err != nil {" << endl; out << indent() << " return err" << endl; out << indent() << " }" << endl; out << indent() << "}" << endl; // Mark required field as read if ((*f_iter)->get_req() == t_field::T_REQUIRED) { const string field_name(publicize(escape_string((*f_iter)->get_name()))); out << indent() << "isset" << field_name << " = true" << endl; } indent_down(); } // Begin switch default case if (have_switch) { out << indent() << "default:" << endl; indent_up(); } // Skip unknown fields in either case out << indent() << "if err := iprot.Skip(fieldTypeId); err != nil {" << endl; out << indent() << " return err" << endl; out << indent() << "}" << endl; // End switch default case if (have_switch) { indent_down(); out << indent() << "}" << endl; } // Read field end marker out << indent() << "if err := iprot.ReadFieldEnd(); err != nil {" << endl; out << indent() << " return err" << endl; out << indent() << "}" << endl; indent_down(); out << indent() << "}" << endl; out << indent() << "if err := iprot.ReadStructEnd(); err != nil {" << endl; out << indent() << " return thrift.PrependError(fmt.Sprintf(" "\"%T read struct end error: \", p), err)" << endl; out << indent() << "}" << endl; // Return error if any required fields are missing. for (f_iter = fields.begin(); f_iter != fields.end(); ++f_iter) { if ((*f_iter)->get_req() == t_field::T_REQUIRED) { const string field_name(publicize(escape_string((*f_iter)->get_name()))); out << indent() << "if !isset" << field_name << "{" << endl; out << indent() << " return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, " "fmt.Errorf(\"Required field " << field_name << " is not set\"));" << endl; out << indent() << "}" << endl; } } out << indent() << "return nil" << endl; indent_down(); out << indent() << "}" << endl << endl; for (f_iter = fields.begin(); f_iter != fields.end(); ++f_iter) { string field_type_name(publicize((*f_iter)->get_type()->get_name())); string field_name(publicize((*f_iter)->get_name())); string field_method_prefix("ReadField"); int32_t field_id = (*f_iter)->get_key(); int32_t field_method_suffix = field_id; if (field_method_suffix < 0) { field_method_prefix += "_"; field_method_suffix *= -1; } out << indent() << "func (p *" << tstruct_name << ") " << field_method_prefix << field_method_suffix << "(iprot thrift.TProtocol) error {" << endl; indent_up(); generate_deserialize_field(out, *f_iter, false, "p."); indent_down(); out << indent() << " return nil" << endl; out << indent() << "}" << endl << endl; } } void t_go_generator::generate_go_struct_writer(ofstream& out, t_struct* tstruct, const string& tstruct_name, bool is_result, bool uses_countsetfields) { (void)is_result; string name(tstruct->get_name()); const vector<t_field*>& fields = tstruct->get_sorted_members(); vector<t_field*>::const_iterator f_iter; indent(out) << "func (p *" << tstruct_name << ") " << write_method_name_ << "(oprot thrift.TProtocol) error {" << endl; indent_up(); if (tstruct->is_union() && uses_countsetfields) { std::string tstruct_name(publicize(tstruct->get_name())); out << indent() << "if c := p.CountSetFields" << tstruct_name << "(); c != 1 {" << endl << indent() << " return fmt.Errorf(\"%T write union: exactly one field must be set (%d set).\", p, c)" << endl << indent() << "}" << endl; } out << indent() << "if err := oprot.WriteStructBegin(\"" << name << "\"); err != nil {" << endl; out << indent() << " return thrift.PrependError(fmt.Sprintf(" "\"%T write struct begin error: \", p), err) }" << endl; string field_name; string escape_field_name; // t_const_value* field_default_value; t_field::e_req field_required; int32_t field_id = -1; out << indent() << "if p != nil {" << endl; indent_up(); for (f_iter = fields.begin(); f_iter != fields.end(); ++f_iter) { string field_method_prefix("writeField"); field_name = (*f_iter)->get_name(); escape_field_name = escape_string(field_name); field_id = (*f_iter)->get_key(); int32_t field_method_suffix = field_id; if (field_method_suffix < 0) { field_method_prefix += "_"; field_method_suffix *= -1; } out << indent() << "if err := p." << field_method_prefix << field_method_suffix << "(oprot); err != nil { return err }" << endl; } indent_down(); out << indent() << "}" << endl; // Write the struct map out << indent() << "if err := oprot.WriteFieldStop(); err != nil {" << endl; out << indent() << " return thrift.PrependError(\"write field stop error: \", err) }" << endl; out << indent() << "if err := oprot.WriteStructEnd(); err != nil {" << endl; out << indent() << " return thrift.PrependError(\"write struct stop error: \", err) }" << endl; out << indent() << "return nil" << endl; indent_down(); out << indent() << "}" << endl << endl; for (f_iter = fields.begin(); f_iter != fields.end(); ++f_iter) { string field_method_prefix("writeField"); field_id = (*f_iter)->get_key(); field_name = (*f_iter)->get_name(); escape_field_name = escape_string(field_name); // field_default_value = (*f_iter)->get_value(); field_required = (*f_iter)->get_req(); int32_t field_method_suffix = field_id; if (field_method_suffix < 0) { field_method_prefix += "_"; field_method_suffix *= -1; } out << indent() << "func (p *" << tstruct_name << ") " << field_method_prefix << field_method_suffix << "(oprot thrift.TProtocol) (err error) {" << endl; indent_up(); if (field_required == t_field::T_OPTIONAL) { out << indent() << "if p.IsSet" << publicize(field_name) << "() {" << endl; indent_up(); } out << indent() << "if err := oprot.WriteFieldBegin(\"" << escape_field_name << "\", " << type_to_enum((*f_iter)->get_type()) << ", " << field_id << "); err != nil {" << endl; out << indent() << " return thrift.PrependError(fmt.Sprintf(\"%T write field begin error " << field_id << ":" << escape_field_name << ": \", p), err) }" << endl; // Write field contents generate_serialize_field(out, *f_iter, "p."); // Write field closer out << indent() << "if err := oprot.WriteFieldEnd(); err != nil {" << endl; out << indent() << " return thrift.PrependError(fmt.Sprintf(\"%T write field end error " << field_id << ":" << escape_field_name << ": \", p), err) }" << endl; if (field_required == t_field::T_OPTIONAL) { indent_down(); out << indent() << "}" << endl; } indent_down(); out << indent() << " return err" << endl; out << indent() << "}" << endl << endl; } } /** * Generates a thrift service. * * @param tservice The service definition */ void t_go_generator::generate_service(t_service* tservice) { string test_suffix("_test"); string filename = lowercase(service_name_); string f_service_name; generate_service_interface(tservice); generate_service_client(tservice); generate_service_server(tservice); generate_service_helpers(tservice); generate_service_remote(tservice); f_types_ << endl; } /** * Generates helper functions for a service. * * @param tservice The service to generate a header definition for */ void t_go_generator::generate_service_helpers(t_service* tservice) { vector<t_function*> functions = tservice->get_functions(); vector<t_function*>::iterator f_iter; f_types_ << "// HELPER FUNCTIONS AND STRUCTURES" << endl << endl; for (f_iter = functions.begin(); f_iter != functions.end(); ++f_iter) { t_struct* ts = (*f_iter)->get_arglist(); generate_go_struct_definition(f_types_, ts, false, false, true); generate_go_function_helpers(*f_iter); } } /** * Generates a struct and helpers for a function. * * @param tfunction The function */ void t_go_generator::generate_go_function_helpers(t_function* tfunction) { if (!tfunction->is_oneway()) { t_struct result(program_, tfunction->get_name() + "_result"); t_field success(tfunction->get_returntype(), "success", 0); success.set_req(t_field::T_OPTIONAL); if (!tfunction->get_returntype()->is_void()) { result.append(&success); } t_struct* xs = tfunction->get_xceptions(); const vector<t_field*>& fields = xs->get_members(); vector<t_field*>::const_iterator f_iter; for (f_iter = fields.begin(); f_iter != fields.end(); ++f_iter) { t_field* f = *f_iter; f->set_req(t_field::T_OPTIONAL); result.append(f); } generate_go_struct_definition(f_types_, &result, false, true); } } /** * Generates a service interface definition. * * @param tservice The service to generate a header definition for */ void t_go_generator::generate_service_interface(t_service* tservice) { string extends = ""; string extends_if = ""; string serviceName(publicize(tservice->get_name())); string interfaceName = serviceName; if (tservice->get_extends() != NULL) { extends = type_name(tservice->get_extends()); size_t index = extends.rfind("."); if (index != string::npos) { extends_if = "\n" + indent() + " " + extends.substr(0, index + 1) + publicize(extends.substr(index + 1)) + "\n"; } else { extends_if = "\n" + indent() + publicize(extends) + "\n"; } } f_types_ << indent() << "type " << interfaceName << " interface {" << extends_if; indent_up(); generate_go_docstring(f_types_, tservice); vector<t_function*> functions = tservice->get_functions(); if (!functions.empty()) { f_types_ << endl; vector<t_function*>::iterator f_iter; for (f_iter = functions.begin(); f_iter != functions.end(); ++f_iter) { generate_go_docstring(f_types_, (*f_iter)); f_types_ << indent() << function_signature_if(*f_iter, "", true) << endl; } } indent_down(); f_types_ << indent() << "}" << endl << endl; } /** * Generates a service client definition. * * @param tservice The service to generate a server for. */ void t_go_generator::generate_service_client(t_service* tservice) { string extends = ""; string extends_field = ""; string extends_client = ""; string extends_client_new = ""; string serviceName(publicize(tservice->get_name())); if (tservice->get_extends() != NULL) { extends = type_name(tservice->get_extends()); size_t index = extends.rfind("."); if (index != string::npos) { extends_client = extends.substr(0, index + 1) + publicize(extends.substr(index + 1)) + "Client"; extends_client_new = extends.substr(0, index + 1) + "New" + publicize(extends.substr(index + 1)) + "Client"; } else { extends_client = publicize(extends) + "Client"; extends_client_new = "New" + extends_client; } } extends_field = extends_client.substr(extends_client.find(".") + 1); generate_go_docstring(f_types_, tservice); f_types_ << indent() << "type " << serviceName << "Client struct {" << endl; indent_up(); f_types_ << indent() << "c thrift.TClient" << endl; if (!extends_client.empty()) { f_types_ << indent() << "*" << extends_client << endl; } indent_down(); f_types_ << indent() << "}" << endl << endl; // Legacy constructor function f_types_ << indent() << "// Deprecated: Use New" << serviceName << " instead" << endl; f_types_ << indent() << "func New" << serviceName << "ClientFactory(t thrift.TTransport, f thrift.TProtocolFactory) *" << serviceName << "Client {" << endl; indent_up(); f_types_ << indent() << "return &" << serviceName << "Client"; if (!extends.empty()) { f_types_ << "{" << extends_field << ": " << extends_client_new << "Factory(t, f)}"; } else { indent_up(); f_types_ << "{" << endl; f_types_ << indent() << "c: thrift.NewTStandardClient(f.GetProtocol(t), f.GetProtocol(t))," << endl; indent_down(); f_types_ << indent() << "}" << endl; } indent_down(); f_types_ << indent() << "}" << endl << endl; // Legacy constructor function with custom input & output protocols f_types_ << indent() << "// Deprecated: Use New" << serviceName << " instead" << endl; f_types_ << indent() << "func New" << serviceName << "ClientProtocol(t thrift.TTransport, iprot thrift.TProtocol, oprot thrift.TProtocol) *" << serviceName << "Client {" << endl; indent_up(); f_types_ << indent() << "return &" << serviceName << "Client"; if (!extends.empty()) { f_types_ << "{" << extends_field << ": " << extends_client_new << "Protocol(t, iprot, oprot)}" << endl; } else { indent_up(); f_types_ << "{" << endl; f_types_ << indent() << "c: thrift.NewTStandardClient(iprot, oprot)," << endl; indent_down(); f_types_ << indent() << "}" << endl; } indent_down(); f_types_ << indent() << "}" << endl << endl; // Constructor function f_types_ << indent() << "func New" << serviceName << "Client(c thrift.TClient) *" << serviceName << "Client {" << endl; indent_up(); f_types_ << indent() << "return &" << serviceName << "Client{" << endl; indent_up(); f_types_ << indent() << "c: c," << endl; if (!extends.empty()) { f_types_ << indent() << extends_field << ": " << extends_client_new << "(c)," << endl; } indent_down(); f_types_ << indent() << "}" << endl; indent_down(); f_types_ << indent() << "}" << endl << endl; // Generate client method implementations vector<t_function*> functions = tservice->get_functions(); vector<t_function*>::const_iterator f_iter; for (f_iter = functions.begin(); f_iter != functions.end(); ++f_iter) { t_struct* arg_struct = (*f_iter)->get_arglist(); const vector<t_field*>& fields = arg_struct->get_members(); vector<t_field*>::const_iterator fld_iter; string funname = publicize((*f_iter)->get_name()); // Open function generate_go_docstring(f_types_, (*f_iter)); f_types_ << indent() << "func (p *" << serviceName << "Client) " << function_signature_if(*f_iter, "", true) << " {" << endl; indent_up(); std::string method = (*f_iter)->get_name(); std::string argsType = publicize(method + "_args", true); std::string argsName = tmp("_args"); f_types_ << indent() << "var " << argsName << " " << argsType << endl; for (fld_iter = fields.begin(); fld_iter != fields.end(); ++fld_iter) { f_types_ << indent() << argsName << "." << publicize((*fld_iter)->get_name()) << " = " << variable_name_to_go_name((*fld_iter)->get_name()) << endl; } if (!(*f_iter)->is_oneway()) { std::string resultName = tmp("_result"); std::string resultType = publicize(method + "_result", true); f_types_ << indent() << "var " << resultName << " " << resultType << endl; f_types_ << indent() << "if err = p.c.Call(ctx, \"" << method << "\", &" << argsName << ", &" << resultName << "); err != nil {" << endl; indent_up(); f_types_ << indent() << "return" << endl; indent_down(); f_types_ << indent() << "}" << endl; t_struct* xs = (*f_iter)->get_xceptions(); const std::vector<t_field*>& xceptions = xs->get_members(); vector<t_field*>::const_iterator x_iter; if (!xceptions.empty()) { f_types_ << indent() << "switch {" << endl; for (x_iter = xceptions.begin(); x_iter != xceptions.end(); ++x_iter) { const std::string pubname = publicize((*x_iter)->get_name()); const std::string field = resultName + "." + pubname; f_types_ << indent() << "case " << field << "!= nil:" << endl; indent_up(); if (!(*f_iter)->get_returntype()->is_void()) { f_types_ << indent() << "return r, " << field << endl; } else { f_types_ << indent() << "return "<< field << endl; } indent_down(); } f_types_ << indent() << "}" << endl << endl; } if (!(*f_iter)->get_returntype()->is_void()) { f_types_ << indent() << "return " << resultName << ".GetSuccess(), nil" << endl; } else { f_types_ << indent() << "return nil" << endl; } } else { // TODO: would be nice to not to duplicate the call generation f_types_ << indent() << "if err := p.c.Call(ctx, \"" << method << "\", &"<< argsName << ", nil); err != nil {" << endl; indent_up(); f_types_ << indent() << "return err" << endl; indent_down(); f_types_ << indent() << "}" << endl; f_types_ << indent() << "return nil" << endl; } indent_down(); f_types_ << "}" << endl << endl; } } /** * Generates a command line tool for making remote requests * * @param tservice The service to generate a remote for. */ void t_go_generator::generate_service_remote(t_service* tservice) { vector<t_function*> functions = tservice->get_functions(); t_service* parent = tservice->get_extends(); // collect inherited functions while (parent != NULL) { vector<t_function*> p_functions = parent->get_functions(); functions.insert(functions.end(), p_functions.begin(), p_functions.end()); parent = parent->get_extends(); } vector<t_function*>::iterator f_iter; string f_remote_name = package_dir_ + "/" + underscore(service_name_) + "-remote/" + underscore(service_name_) + "-remote.go"; ofstream f_remote; f_remote.open(f_remote_name.c_str()); string service_module = get_real_go_module(program_); string::size_type loc; while ((loc = service_module.find(".")) != string::npos) { service_module.replace(loc, 1, 1, '/'); } if (!gen_package_prefix_.empty()) { service_module = gen_package_prefix_ + service_module; } string unused_protection; string ctxPackage = "context"; if (legacy_context_) { ctxPackage = "golang.org/x/net/context"; } f_remote << go_autogen_comment(); f_remote << indent() << "package main" << endl << endl; f_remote << indent() << "import (" << endl; f_remote << indent() << " \"" << ctxPackage << "\"" << endl; f_remote << indent() << " \"flag\"" << endl; f_remote << indent() << " \"fmt\"" << endl; f_remote << indent() << " \"math\"" << endl; f_remote << indent() << " \"net\"" << endl; f_remote << indent() << " \"net/url\"" << endl; f_remote << indent() << " \"os\"" << endl; f_remote << indent() << " \"strconv\"" << endl; f_remote << indent() << " \"strings\"" << endl; f_remote << indent() << " \"" + gen_thrift_import_ + "\"" << endl; f_remote << indent() << render_included_programs(unused_protection); f_remote << indent() << " \"" << service_module << "\"" << endl; f_remote << indent() << ")" << endl; f_remote << indent() << endl; f_remote << indent() << unused_protection; // filled in render_included_programs() f_remote << indent() << endl; f_remote << indent() << "func Usage() {" << endl; f_remote << indent() << " fmt.Fprintln(os.Stderr, \"Usage of \", os.Args[0], \" " "[-h host:port] [-u url] [-f[ramed]] function [arg1 [arg2...]]:\")" << endl; f_remote << indent() << " flag.PrintDefaults()" << endl; f_remote << indent() << " fmt.Fprintln(os.Stderr, \"\\nFunctions:\")" << endl; for (f_iter = functions.begin(); f_iter != functions.end(); ++f_iter) { f_remote << " fmt.Fprintln(os.Stderr, \" " << (*f_iter)->get_returntype()->get_name() << " " << (*f_iter)->get_name() << "("; t_struct* arg_struct = (*f_iter)->get_arglist(); const std::vector<t_field*>& args = arg_struct->get_members(); vector<t_field*>::const_iterator a_iter; std::vector<t_field*>::size_type num_args = args.size(); bool first = true; for (std::vector<t_field*>::size_type i = 0; i < num_args; ++i) { if (first) { first = false; } else { f_remote << ", "; } f_remote << args[i]->get_type()->get_name() << " " << args[i]->get_name(); } f_remote << ")\")" << endl; } f_remote << indent() << " fmt.Fprintln(os.Stderr)" << endl; f_remote << indent() << " os.Exit(0)" << endl; f_remote << indent() << "}" << endl; f_remote << indent() << endl; f_remote << indent() << "func main() {" << endl; indent_up(); f_remote << indent() << "flag.Usage = Usage" << endl; f_remote << indent() << "var host string" << endl; f_remote << indent() << "var port int" << endl; f_remote << indent() << "var protocol string" << endl; f_remote << indent() << "var urlString string" << endl; f_remote << indent() << "var framed bool" << endl; f_remote << indent() << "var useHttp bool" << endl; f_remote << indent() << "var parsedUrl *url.URL" << endl; f_remote << indent() << "var trans thrift.TTransport" << endl; f_remote << indent() << "_ = strconv.Atoi" << endl; f_remote << indent() << "_ = math.Abs" << endl; f_remote << indent() << "flag.Usage = Usage" << endl; f_remote << indent() << "flag.StringVar(&host, \"h\", \"localhost\", \"Specify host and port\")" << endl; f_remote << indent() << "flag.IntVar(&port, \"p\", 9090, \"Specify port\")" << endl; f_remote << indent() << "flag.StringVar(&protocol, \"P\", \"binary\", \"" "Specify the protocol (binary, compact, simplejson, json)\")" << endl; f_remote << indent() << "flag.StringVar(&urlString, \"u\", \"\", \"Specify the url\")" << endl; f_remote << indent() << "flag.BoolVar(&framed, \"framed\", false, \"Use framed transport\")" << endl; f_remote << indent() << "flag.BoolVar(&useHttp, \"http\", false, \"Use http\")" << endl; f_remote << indent() << "flag.Parse()" << endl; f_remote << indent() << endl; f_remote << indent() << "if len(urlString) > 0 {" << endl; f_remote << indent() << " var err error" << endl; f_remote << indent() << " parsedUrl, err = url.Parse(urlString)" << endl; f_remote << indent() << " if err != nil {" << endl; f_remote << indent() << " fmt.Fprintln(os.Stderr, \"Error parsing URL: \", err)" << endl; f_remote << indent() << " flag.Usage()" << endl; f_remote << indent() << " }" << endl; f_remote << indent() << " host = parsedUrl.Host" << endl; f_remote << indent() << " useHttp = len(parsedUrl.Scheme) <= 0 || parsedUrl.Scheme == \"http\"" << endl; f_remote << indent() << "} else if useHttp {" << endl; f_remote << indent() << " _, err := url.Parse(fmt.Sprint(\"http://\", host, \":\", port))" << endl; f_remote << indent() << " if err != nil {" << endl; f_remote << indent() << " fmt.Fprintln(os.Stderr, \"Error parsing URL: \", err)" << endl; f_remote << indent() << " flag.Usage()" << endl; f_remote << indent() << " }" << endl; f_remote << indent() << "}" << endl; f_remote << indent() << endl; f_remote << indent() << "cmd := flag.Arg(0)" << endl; f_remote << indent() << "var err error" << endl; f_remote << indent() << "if useHttp {" << endl; f_remote << indent() << " trans, err = thrift.NewTHttpClient(parsedUrl.String())" << endl; f_remote << indent() << "} else {" << endl; f_remote << indent() << " portStr := fmt.Sprint(port)" << endl; f_remote << indent() << " if strings.Contains(host, \":\") {" << endl; f_remote << indent() << " host, portStr, err = net.SplitHostPort(host)" << endl; f_remote << indent() << " if err != nil {" << endl; f_remote << indent() << " fmt.Fprintln(os.Stderr, \"error with host:\", err)" << endl; f_remote << indent() << " os.Exit(1)" << endl; f_remote << indent() << " }" << endl; f_remote << indent() << " }" << endl; f_remote << indent() << " trans, err = thrift.NewTSocket(net.JoinHostPort(host, portStr))" << endl; f_remote << indent() << " if err != nil {" << endl; f_remote << indent() << " fmt.Fprintln(os.Stderr, \"error resolving address:\", err)" << endl; f_remote << indent() << " os.Exit(1)" << endl; f_remote << indent() << " }" << endl; f_remote << indent() << " if framed {" << endl; f_remote << indent() << " trans = thrift.NewTFramedTransport(trans)" << endl; f_remote << indent() << " }" << endl; f_remote << indent() << "}" << endl; f_remote << indent() << "if err != nil {" << endl; f_remote << indent() << " fmt.Fprintln(os.Stderr, \"Error creating transport\", err)" << endl; f_remote << indent() << " os.Exit(1)" << endl; f_remote << indent() << "}" << endl; f_remote << indent() << "defer trans.Close()" << endl; f_remote << indent() << "var protocolFactory thrift.TProtocolFactory" << endl; f_remote << indent() << "switch protocol {" << endl; f_remote << indent() << "case \"compact\":" << endl; f_remote << indent() << " protocolFactory = thrift.NewTCompactProtocolFactory()" << endl; f_remote << indent() << " break" << endl; f_remote << indent() << "case \"simplejson\":" << endl; f_remote << indent() << " protocolFactory = thrift.NewTSimpleJSONProtocolFactory()" << endl; f_remote << indent() << " break" << endl; f_remote << indent() << "case \"json\":" << endl; f_remote << indent() << " protocolFactory = thrift.NewTJSONProtocolFactory()" << endl; f_remote << indent() << " break" << endl; f_remote << indent() << "case \"binary\", \"\":" << endl; f_remote << indent() << " protocolFactory = thrift.NewTBinaryProtocolFactoryDefault()" << endl; f_remote << indent() << " break" << endl; f_remote << indent() << "default:" << endl; f_remote << indent() << " fmt.Fprintln(os.Stderr, \"Invalid protocol specified: \", protocol)" << endl; f_remote << indent() << " Usage()" << endl; f_remote << indent() << " os.Exit(1)" << endl; f_remote << indent() << "}" << endl; f_remote << indent() << "iprot := protocolFactory.GetProtocol(trans)" << endl; f_remote << indent() << "oprot := protocolFactory.GetProtocol(trans)" << endl; f_remote << indent() << "client := " << package_name_ << ".New" << publicize(service_name_) << "Client(thrift.NewTStandardClient(iprot, oprot))" << endl; f_remote << indent() << "if err := trans.Open(); err != nil {" << endl; f_remote << indent() << " fmt.Fprintln(os.Stderr, \"Error opening socket to \", " "host, \":\", port, \" \", err)" << endl; f_remote << indent() << " os.Exit(1)" << endl; f_remote << indent() << "}" << endl; f_remote << indent() << endl; f_remote << indent() << "switch cmd {" << endl; for (f_iter = functions.begin(); f_iter != functions.end(); ++f_iter) { t_struct* arg_struct = (*f_iter)->get_arglist(); const std::vector<t_field*>& args = arg_struct->get_members(); vector<t_field*>::const_iterator a_iter; std::vector<t_field*>::size_type num_args = args.size(); string funcName((*f_iter)->get_name()); string pubName(publicize(funcName)); string argumentsName(publicize(funcName + "_args", true)); f_remote << indent() << "case \"" << escape_string(funcName) << "\":" << endl; indent_up(); f_remote << indent() << "if flag.NArg() - 1 != " << num_args << " {" << endl; f_remote << indent() << " fmt.Fprintln(os.Stderr, \"" << escape_string(pubName) << " requires " << num_args << " args\")" << endl; f_remote << indent() << " flag.Usage()" << endl; f_remote << indent() << "}" << endl; for (std::vector<t_field*>::size_type i = 0; i < num_args; ++i) { std::vector<t_field*>::size_type flagArg = i + 1; t_type* the_type(args[i]->get_type()); t_type* the_type2(get_true_type(the_type)); if (the_type2->is_enum()) { f_remote << indent() << "tmp" << i << ", err := (strconv.Atoi(flag.Arg(" << flagArg << ")))" << endl; f_remote << indent() << "if err != nil {" << endl; f_remote << indent() << " Usage()" << endl; f_remote << indent() << " return" << endl; f_remote << indent() << "}" << endl; f_remote << indent() << "argvalue" << i << " := " << package_name_ << "." << publicize(the_type->get_name()) << "(tmp" << i << ")" << endl; } else if (the_type2->is_base_type()) { t_base_type::t_base e = ((t_base_type*)the_type2)->get_base(); string err(tmp("err")); switch (e) { case t_base_type::TYPE_VOID: break; case t_base_type::TYPE_STRING: if (the_type2->is_binary()) { f_remote << indent() << "argvalue" << i << " := []byte(flag.Arg(" << flagArg << "))" << endl; } else { f_remote << indent() << "argvalue" << i << " := flag.Arg(" << flagArg << ")" << endl; } break; case t_base_type::TYPE_BOOL: f_remote << indent() << "argvalue" << i << " := flag.Arg(" << flagArg << ") == \"true\"" << endl; break; case t_base_type::TYPE_I8: f_remote << indent() << "tmp" << i << ", " << err << " := (strconv.Atoi(flag.Arg(" << flagArg << ")))" << endl; f_remote << indent() << "if " << err << " != nil {" << endl; f_remote << indent() << " Usage()" << endl; f_remote << indent() << " return" << endl; f_remote << indent() << "}" << endl; f_remote << indent() << "argvalue" << i << " := int8(tmp" << i << ")" << endl; break; case t_base_type::TYPE_I16: f_remote << indent() << "tmp" << i << ", " << err << " := (strconv.Atoi(flag.Arg(" << flagArg << ")))" << endl; f_remote << indent() << "if " << err << " != nil {" << endl; f_remote << indent() << " Usage()" << endl; f_remote << indent() << " return" << endl; f_remote << indent() << "}" << endl; f_remote << indent() << "argvalue" << i << " := int16(tmp" << i << ")" << endl; break; case t_base_type::TYPE_I32: f_remote << indent() << "tmp" << i << ", " << err << " := (strconv.Atoi(flag.Arg(" << flagArg << ")))" << endl; f_remote << indent() << "if " << err << " != nil {" << endl; f_remote << indent() << " Usage()" << endl; f_remote << indent() << " return" << endl; f_remote << indent() << "}" << endl; f_remote << indent() << "argvalue" << i << " := int32(tmp" << i << ")" << endl; break; case t_base_type::TYPE_I64: f_remote << indent() << "argvalue" << i << ", " << err << " := (strconv.ParseInt(flag.Arg(" << flagArg << "), 10, 64))" << endl; f_remote << indent() << "if " << err << " != nil {" << endl; f_remote << indent() << " Usage()" << endl; f_remote << indent() << " return" << endl; f_remote << indent() << "}" << endl; break; case t_base_type::TYPE_DOUBLE: f_remote << indent() << "argvalue" << i << ", " << err << " := (strconv.ParseFloat(flag.Arg(" << flagArg << "), 64))" << endl; f_remote << indent() << "if " << err << " != nil {" << endl; f_remote << indent() << " Usage()" << endl; f_remote << indent() << " return" << endl; f_remote << indent() << "}" << endl; break; default: throw("Invalid base type in generate_service_remote"); } // f_remote << publicize(args[i]->get_name()) << "(strconv.Atoi(flag.Arg(" << flagArg << // ")))"; } else if (the_type2->is_struct()) { string arg(tmp("arg")); string mbTrans(tmp("mbTrans")); string err1(tmp("err")); string factory(tmp("factory")); string jsProt(tmp("jsProt")); string err2(tmp("err")); std::string tstruct_name(publicize(the_type->get_name())); std::string tstruct_module( module_name(the_type)); if(tstruct_module.empty()) { tstruct_module = package_name_; } f_remote << indent() << arg << " := flag.Arg(" << flagArg << ")" << endl; f_remote << indent() << mbTrans << " := thrift.NewTMemoryBufferLen(len(" << arg << "))" << endl; f_remote << indent() << "defer " << mbTrans << ".Close()" << endl; f_remote << indent() << "_, " << err1 << " := " << mbTrans << ".WriteString(" << arg << ")" << endl; f_remote << indent() << "if " << err1 << " != nil {" << endl; f_remote << indent() << " Usage()" << endl; f_remote << indent() << " return" << endl; f_remote << indent() << "}" << endl; f_remote << indent() << factory << " := thrift.NewTSimpleJSONProtocolFactory()" << endl; f_remote << indent() << jsProt << " := " << factory << ".GetProtocol(" << mbTrans << ")" << endl; f_remote << indent() << "argvalue" << i << " := " << tstruct_module << ".New" << tstruct_name << "()" << endl; f_remote << indent() << err2 << " := argvalue" << i << "." << read_method_name_ << "(" << jsProt << ")" << endl; f_remote << indent() << "if " << err2 << " != nil {" << endl; f_remote << indent() << " Usage()" << endl; f_remote << indent() << " return" << endl; f_remote << indent() << "}" << endl; } else if (the_type2->is_container() || the_type2->is_xception()) { string arg(tmp("arg")); string mbTrans(tmp("mbTrans")); string err1(tmp("err")); string factory(tmp("factory")); string jsProt(tmp("jsProt")); string err2(tmp("err")); std::string argName(publicize(args[i]->get_name())); f_remote << indent() << arg << " := flag.Arg(" << flagArg << ")" << endl; f_remote << indent() << mbTrans << " := thrift.NewTMemoryBufferLen(len(" << arg << "))" << endl; f_remote << indent() << "defer " << mbTrans << ".Close()" << endl; f_remote << indent() << "_, " << err1 << " := " << mbTrans << ".WriteString(" << arg << ")" << endl; f_remote << indent() << "if " << err1 << " != nil { " << endl; f_remote << indent() << " Usage()" << endl; f_remote << indent() << " return" << endl; f_remote << indent() << "}" << endl; f_remote << indent() << factory << " := thrift.NewTSimpleJSONProtocolFactory()" << endl; f_remote << indent() << jsProt << " := " << factory << ".GetProtocol(" << mbTrans << ")" << endl; f_remote << indent() << "containerStruct" << i << " := " << package_name_ << ".New" << argumentsName << "()" << endl; f_remote << indent() << err2 << " := containerStruct" << i << ".ReadField" << (i + 1) << "(" << jsProt << ")" << endl; f_remote << indent() << "if " << err2 << " != nil {" << endl; f_remote << indent() << " Usage()" << endl; f_remote << indent() << " return" << endl; f_remote << indent() << "}" << endl; f_remote << indent() << "argvalue" << i << " := containerStruct" << i << "." << argName << endl; } else { throw("Invalid argument type in generate_service_remote"); } if (the_type->is_typedef()) { std::string typedef_module( module_name(the_type)); if(typedef_module.empty()) { typedef_module = package_name_; } f_remote << indent() << "value" << i << " := " << typedef_module << "." << publicize(the_type->get_name()) << "(argvalue" << i << ")" << endl; } else { f_remote << indent() << "value" << i << " := argvalue" << i << endl; } } f_remote << indent() << "fmt.Print(client." << pubName << "("; bool argFirst = true; f_remote << "context.Background()"; for (std::vector<t_field*>::size_type i = 0; i < num_args; ++i) { if (argFirst) { argFirst = false; f_remote << ", "; } else { f_remote << ", "; } if (args[i]->get_type()->is_enum()) { f_remote << "value" << i; } else if (args[i]->get_type()->is_base_type()) { t_base_type::t_base e = ((t_base_type*)(args[i]->get_type()))->get_base(); switch (e) { case t_base_type::TYPE_VOID: break; case t_base_type::TYPE_STRING: case t_base_type::TYPE_BOOL: case t_base_type::TYPE_I8: case t_base_type::TYPE_I16: case t_base_type::TYPE_I32: case t_base_type::TYPE_I64: case t_base_type::TYPE_DOUBLE: f_remote << "value" << i; break; default: throw("Invalid base type in generate_service_remote"); } // f_remote << publicize(args[i]->get_name()) << "(strconv.Atoi(flag.Arg(" << flagArg << // ")))"; } else { f_remote << "value" << i; } } f_remote << "))" << endl; f_remote << indent() << "fmt.Print(\"\\n\")" << endl; f_remote << indent() << "break" << endl; indent_down(); } f_remote << indent() << "case \"\":" << endl; f_remote << indent() << " Usage()" << endl; f_remote << indent() << " break" << endl; f_remote << indent() << "default:" << endl; f_remote << indent() << " fmt.Fprintln(os.Stderr, \"Invalid function \", cmd)" << endl; f_remote << indent() << "}" << endl; indent_down(); f_remote << indent() << "}" << endl; // Close service file f_remote.close(); format_go_output(f_remote_name); #ifndef _MSC_VER // Make file executable, love that bitwise OR action chmod(f_remote_name.c_str(), S_IRUSR | S_IWUSR | S_IXUSR #ifndef _WIN32 | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH #endif ); #endif } /** * Generates a service server definition. * * @param tservice The service to generate a server for. */ void t_go_generator::generate_service_server(t_service* tservice) { // Generate the dispatch methods vector<t_function*> functions = tservice->get_functions(); vector<t_function*>::iterator f_iter; string extends = ""; string extends_processor = ""; string extends_processor_new = ""; string serviceName(publicize(tservice->get_name())); if (tservice->get_extends() != NULL) { extends = type_name(tservice->get_extends()); size_t index = extends.rfind("."); if (index != string::npos) { extends_processor = extends.substr(0, index + 1) + publicize(extends.substr(index + 1)) + "Processor"; extends_processor_new = extends.substr(0, index + 1) + "New" + publicize(extends.substr(index + 1)) + "Processor"; } else { extends_processor = publicize(extends) + "Processor"; extends_processor_new = "New" + extends_processor; } } string pServiceName(privatize(tservice->get_name())); // Generate the header portion string self(tmp("self")); if (extends_processor.empty()) { f_types_ << indent() << "type " << serviceName << "Processor struct {" << endl; f_types_ << indent() << " processorMap map[string]thrift.TProcessorFunction" << endl; f_types_ << indent() << " handler " << serviceName << endl; f_types_ << indent() << "}" << endl << endl; f_types_ << indent() << "func (p *" << serviceName << "Processor) AddToProcessorMap(key string, processor thrift.TProcessorFunction) {" << endl; f_types_ << indent() << " p.processorMap[key] = processor" << endl; f_types_ << indent() << "}" << endl << endl; f_types_ << indent() << "func (p *" << serviceName << "Processor) GetProcessorFunction(key string) " "(processor thrift.TProcessorFunction, ok bool) {" << endl; f_types_ << indent() << " processor, ok = p.processorMap[key]" << endl; f_types_ << indent() << " return processor, ok" << endl; f_types_ << indent() << "}" << endl << endl; f_types_ << indent() << "func (p *" << serviceName << "Processor) ProcessorMap() map[string]thrift.TProcessorFunction {" << endl; f_types_ << indent() << " return p.processorMap" << endl; f_types_ << indent() << "}" << endl << endl; f_types_ << indent() << "func New" << serviceName << "Processor(handler " << serviceName << ") *" << serviceName << "Processor {" << endl << endl; f_types_ << indent() << " " << self << " := &" << serviceName << "Processor{handler:handler, processorMap:make(map[string]thrift.TProcessorFunction)}" << endl; for (f_iter = functions.begin(); f_iter != functions.end(); ++f_iter) { string escapedFuncName(escape_string((*f_iter)->get_name())); f_types_ << indent() << " " << self << ".processorMap[\"" << escapedFuncName << "\"] = &" << pServiceName << "Processor" << publicize((*f_iter)->get_name()) << "{handler:handler}" << endl; } string x(tmp("x")); f_types_ << indent() << "return " << self << endl; f_types_ << indent() << "}" << endl << endl; f_types_ << indent() << "func (p *" << serviceName << "Processor) Process(ctx context.Context, iprot, oprot thrift.TProtocol) (success bool, err " "thrift.TException) {" << endl; f_types_ << indent() << " name, _, seqId, err := iprot.ReadMessageBegin()" << endl; f_types_ << indent() << " if err != nil { return false, err }" << endl; f_types_ << indent() << " if processor, ok := p.GetProcessorFunction(name); ok {" << endl; f_types_ << indent() << " return processor.Process(ctx, seqId, iprot, oprot)" << endl; f_types_ << indent() << " }" << endl; f_types_ << indent() << " iprot.Skip(thrift.STRUCT)" << endl; f_types_ << indent() << " iprot.ReadMessageEnd()" << endl; f_types_ << indent() << " " << x << " := thrift.NewTApplicationException(thrift.UNKNOWN_METHOD, \"Unknown function " "\" + name)" << endl; f_types_ << indent() << " oprot.WriteMessageBegin(name, thrift.EXCEPTION, seqId)" << endl; f_types_ << indent() << " " << x << ".Write(oprot)" << endl; f_types_ << indent() << " oprot.WriteMessageEnd()" << endl; f_types_ << indent() << " oprot.Flush()" << endl; f_types_ << indent() << " return false, " << x << endl; f_types_ << indent() << "" << endl; f_types_ << indent() << "}" << endl << endl; } else { f_types_ << indent() << "type " << serviceName << "Processor struct {" << endl; f_types_ << indent() << " *" << extends_processor << endl; f_types_ << indent() << "}" << endl << endl; f_types_ << indent() << "func New" << serviceName << "Processor(handler " << serviceName << ") *" << serviceName << "Processor {" << endl; f_types_ << indent() << " " << self << " := &" << serviceName << "Processor{" << extends_processor_new << "(handler)}" << endl; for (f_iter = functions.begin(); f_iter != functions.end(); ++f_iter) { string escapedFuncName(escape_string((*f_iter)->get_name())); f_types_ << indent() << " " << self << ".AddToProcessorMap(\"" << escapedFuncName << "\", &" << pServiceName << "Processor" << publicize((*f_iter)->get_name()) << "{handler:handler})" << endl; } f_types_ << indent() << " return " << self << endl; f_types_ << indent() << "}" << endl << endl; } // Generate the process subfunctions for (f_iter = functions.begin(); f_iter != functions.end(); ++f_iter) { generate_process_function(tservice, *f_iter); } f_types_ << endl; } /** * Generates a process function definition. * * @param tfunction The function to write a dispatcher for */ void t_go_generator::generate_process_function(t_service* tservice, t_function* tfunction) { // Open function string processorName = privatize(tservice->get_name()) + "Processor" + publicize(tfunction->get_name()); string argsname = publicize(tfunction->get_name() + "_args", true); string resultname = publicize(tfunction->get_name() + "_result", true); // t_struct* xs = tfunction->get_xceptions(); // const std::vector<t_field*>& xceptions = xs->get_members(); vector<t_field*>::const_iterator x_iter; f_types_ << indent() << "type " << processorName << " struct {" << endl; f_types_ << indent() << " handler " << publicize(tservice->get_name()) << endl; f_types_ << indent() << "}" << endl << endl; f_types_ << indent() << "func (p *" << processorName << ") Process(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol) (success bool, err " "thrift.TException) {" << endl; indent_up(); f_types_ << indent() << "args := " << argsname << "{}" << endl; f_types_ << indent() << "if err = args." << read_method_name_ << "(iprot); err != nil {" << endl; f_types_ << indent() << " iprot.ReadMessageEnd()" << endl; if (!tfunction->is_oneway()) { f_types_ << indent() << " x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err.Error())" << endl; f_types_ << indent() << " oprot.WriteMessageBegin(\"" << escape_string(tfunction->get_name()) << "\", thrift.EXCEPTION, seqId)" << endl; f_types_ << indent() << " x.Write(oprot)" << endl; f_types_ << indent() << " oprot.WriteMessageEnd()" << endl; f_types_ << indent() << " oprot.Flush()" << endl; } f_types_ << indent() << " return false, err" << endl; f_types_ << indent() << "}" << endl << endl; f_types_ << indent() << "iprot.ReadMessageEnd()" << endl; if (!tfunction->is_oneway()) { f_types_ << indent() << "result := " << resultname << "{}" << endl; } bool need_reference = type_need_reference(tfunction->get_returntype()); if (!tfunction->is_oneway() && !tfunction->get_returntype()->is_void()) { f_types_ << "var retval " << type_to_go_type(tfunction->get_returntype()) << endl; } f_types_ << indent() << "var err2 error" << endl; f_types_ << indent() << "if "; if (!tfunction->is_oneway()) { if (!tfunction->get_returntype()->is_void()) { f_types_ << "retval, "; } } // Generate the function call t_struct* arg_struct = tfunction->get_arglist(); const std::vector<t_field*>& fields = arg_struct->get_members(); vector<t_field*>::const_iterator f_iter; f_types_ << "err2 = p.handler." << publicize(tfunction->get_name()) << "("; bool first = true; f_types_ << "ctx"; for (f_iter = fields.begin(); f_iter != fields.end(); ++f_iter) { if (first) { first = false; f_types_ << ", "; } else { f_types_ << ", "; } f_types_ << "args." << publicize((*f_iter)->get_name()); } f_types_ << "); err2 != nil {" << endl; t_struct* exceptions = tfunction->get_xceptions(); const vector<t_field*>& x_fields = exceptions->get_members(); if (!x_fields.empty()) { f_types_ << indent() << "switch v := err2.(type) {" << endl; vector<t_field*>::const_iterator xf_iter; for (xf_iter = x_fields.begin(); xf_iter != x_fields.end(); ++xf_iter) { f_types_ << indent() << " case " << type_to_go_type(((*xf_iter)->get_type())) << ":" << endl; f_types_ << indent() << "result." << publicize((*xf_iter)->get_name()) << " = v" << endl; } f_types_ << indent() << " default:" << endl; } if (!tfunction->is_oneway()) { f_types_ << indent() << " x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, " "\"Internal error processing " << escape_string(tfunction->get_name()) << ": \" + err2.Error())" << endl; f_types_ << indent() << " oprot.WriteMessageBegin(\"" << escape_string(tfunction->get_name()) << "\", thrift.EXCEPTION, seqId)" << endl; f_types_ << indent() << " x.Write(oprot)" << endl; f_types_ << indent() << " oprot.WriteMessageEnd()" << endl; f_types_ << indent() << " oprot.Flush()" << endl; } f_types_ << indent() << " return true, err2" << endl; if (!x_fields.empty()) { f_types_ << indent() << "}" << endl; } f_types_ << indent() << "}"; // closes err2 != nil if (!tfunction->is_oneway()) { if (!tfunction->get_returntype()->is_void()) { f_types_ << " else {" << endl; // make sure we set Success retval only on success indent_up(); f_types_ << indent() << "result.Success = "; if (need_reference) { f_types_ << "&"; } f_types_ << "retval" << endl; indent_down(); f_types_ << "}" << endl; } else { f_types_ << endl; } f_types_ << indent() << "if err2 = oprot.WriteMessageBegin(\"" << escape_string(tfunction->get_name()) << "\", thrift.REPLY, seqId); err2 != nil {" << endl; f_types_ << indent() << " err = err2" << endl; f_types_ << indent() << "}" << endl; f_types_ << indent() << "if err2 = result." << write_method_name_ << "(oprot); err == nil && err2 != nil {" << endl; f_types_ << indent() << " err = err2" << endl; f_types_ << indent() << "}" << endl; f_types_ << indent() << "if err2 = oprot.WriteMessageEnd(); err == nil && err2 != nil {" << endl; f_types_ << indent() << " err = err2" << endl; f_types_ << indent() << "}" << endl; f_types_ << indent() << "if err2 = oprot.Flush(); err == nil && err2 != nil {" << endl; f_types_ << indent() << " err = err2" << endl; f_types_ << indent() << "}" << endl; f_types_ << indent() << "if err != nil {" << endl; f_types_ << indent() << " return" << endl; f_types_ << indent() << "}" << endl; f_types_ << indent() << "return true, err" << endl; } else { f_types_ << endl; f_types_ << indent() << "return true, nil" << endl; } indent_down(); f_types_ << indent() << "}" << endl << endl; } /** * Deserializes a field of any type. */ void t_go_generator::generate_deserialize_field(ofstream& out, t_field* tfield, bool declare, string prefix, bool inclass, bool coerceData, bool inkey, bool in_container_value) { (void)inclass; (void)coerceData; t_type* orig_type = tfield->get_type(); t_type* type = get_true_type(orig_type); string name(prefix + publicize(tfield->get_name())); if (type->is_void()) { throw "CANNOT GENERATE DESERIALIZE CODE FOR void TYPE: " + name; } if (type->is_struct() || type->is_xception()) { generate_deserialize_struct(out, (t_struct*)type, is_pointer_field(tfield, in_container_value), declare, name); } else if (type->is_container()) { generate_deserialize_container(out, orig_type, is_pointer_field(tfield), declare, name); } else if (type->is_base_type() || type->is_enum()) { if (declare) { string type_name = inkey ? type_to_go_key_type(tfield->get_type()) : type_to_go_type(tfield->get_type()); out << "var " << tfield->get_name() << " " << type_name << endl; } indent(out) << "if v, err := iprot."; if (type->is_base_type()) { t_base_type::t_base tbase = ((t_base_type*)type)->get_base(); switch (tbase) { case t_base_type::TYPE_VOID: throw "compiler error: cannot serialize void field in a struct: " + name; break; case t_base_type::TYPE_STRING: if (type->is_binary() && !inkey) { out << "ReadBinary()"; } else { out << "ReadString()"; } break; case t_base_type::TYPE_BOOL: out << "ReadBool()"; break; case t_base_type::TYPE_I8: out << "ReadByte()"; break; case t_base_type::TYPE_I16: out << "ReadI16()"; break; case t_base_type::TYPE_I32: out << "ReadI32()"; break; case t_base_type::TYPE_I64: out << "ReadI64()"; break; case t_base_type::TYPE_DOUBLE: out << "ReadDouble()"; break; default: throw "compiler error: no Go name for base type " + t_base_type::t_base_name(tbase); } } else if (type->is_enum()) { out << "ReadI32()"; } out << "; err != nil {" << endl; out << indent() << "return thrift.PrependError(\"error reading field " << tfield->get_key() << ": \", err)" << endl; out << "} else {" << endl; string wrap; if (type->is_enum() || orig_type->is_typedef()) { wrap = publicize(type_name(orig_type)); } else if (((t_base_type*)type)->get_base() == t_base_type::TYPE_I8) { wrap = "int8"; } string maybe_address = (is_pointer_field(tfield) ? "&" : ""); if (wrap == "") { indent(out) << name << " = " << maybe_address << "v" << endl; } else { indent(out) << "temp := " << wrap << "(v)" << endl; indent(out) << name << " = " << maybe_address << "temp" << endl; } out << "}" << endl; } else { throw "INVALID TYPE IN generate_deserialize_field '" + type->get_name() + "' for field '" + tfield->get_name() + "'"; } } /** * Generates an unserializer for a struct, calling read() */ void t_go_generator::generate_deserialize_struct(ofstream& out, t_struct* tstruct, bool pointer_field, bool declare, string prefix) { string eq(declare ? " := " : " = "); out << indent() << prefix << eq << (pointer_field ? "&" : ""); generate_go_struct_initializer(out, tstruct); out << indent() << "if err := " << prefix << "." << read_method_name_ << "(iprot); err != nil {" << endl; out << indent() << " return thrift.PrependError(fmt.Sprintf(\"%T error reading struct: \", " << prefix << "), err)" << endl; out << indent() << "}" << endl; } /** * Serialize a container by writing out the header followed by * data and then a footer. */ void t_go_generator::generate_deserialize_container(ofstream& out, t_type* orig_type, bool pointer_field, bool declare, string prefix) { t_type* ttype = get_true_type(orig_type); string eq(" = "); if (declare) { eq = " := "; } // Declare variables, read header if (ttype->is_map()) { out << indent() << "_, _, size, err := iprot.ReadMapBegin()" << endl; out << indent() << "if err != nil {" << endl; out << indent() << " return thrift.PrependError(\"error reading map begin: \", err)" << endl; out << indent() << "}" << endl; out << indent() << "tMap := make(" << type_to_go_type(orig_type) << ", size)" << endl; out << indent() << prefix << eq << " " << (pointer_field ? "&" : "") << "tMap" << endl; } else if (ttype->is_set()) { out << indent() << "_, size, err := iprot.ReadSetBegin()" << endl; out << indent() << "if err != nil {" << endl; out << indent() << " return thrift.PrependError(\"error reading set begin: \", err)" << endl; out << indent() << "}" << endl; out << indent() << "tSet := make(" << type_to_go_type(orig_type) << ", 0, size)" << endl; out << indent() << prefix << eq << " " << (pointer_field ? "&" : "") << "tSet" << endl; } else if (ttype->is_list()) { out << indent() << "_, size, err := iprot.ReadListBegin()" << endl; out << indent() << "if err != nil {" << endl; out << indent() << " return thrift.PrependError(\"error reading list begin: \", err)" << endl; out << indent() << "}" << endl; out << indent() << "tSlice := make(" << type_to_go_type(orig_type) << ", 0, size)" << endl; out << indent() << prefix << eq << " " << (pointer_field ? "&" : "") << "tSlice" << endl; } else { throw "INVALID TYPE IN generate_deserialize_container '" + ttype->get_name() + "' for prefix '" + prefix + "'"; } // For loop iterates over elements out << indent() << "for i := 0; i < size; i ++ {" << endl; indent_up(); if (pointer_field) { prefix = "(*" + prefix + ")"; } if (ttype->is_map()) { generate_deserialize_map_element(out, (t_map*)ttype, declare, prefix); } else if (ttype->is_set()) { generate_deserialize_set_element(out, (t_set*)ttype, declare, prefix); } else if (ttype->is_list()) { generate_deserialize_list_element(out, (t_list*)ttype, declare, prefix); } indent_down(); out << indent() << "}" << endl; // Read container end if (ttype->is_map()) { out << indent() << "if err := iprot.ReadMapEnd(); err != nil {" << endl; out << indent() << " return thrift.PrependError(\"error reading map end: \", err)" << endl; out << indent() << "}" << endl; } else if (ttype->is_set()) { out << indent() << "if err := iprot.ReadSetEnd(); err != nil {" << endl; out << indent() << " return thrift.PrependError(\"error reading set end: \", err)" << endl; out << indent() << "}" << endl; } else if (ttype->is_list()) { out << indent() << "if err := iprot.ReadListEnd(); err != nil {" << endl; out << indent() << " return thrift.PrependError(\"error reading list end: \", err)" << endl; out << indent() << "}" << endl; } } /** * Generates code to deserialize a map */ void t_go_generator::generate_deserialize_map_element(ofstream& out, t_map* tmap, bool declare, string prefix) { (void)declare; string key = tmp("_key"); string val = tmp("_val"); t_field fkey(tmap->get_key_type(), key); t_field fval(tmap->get_val_type(), val); fkey.set_req(t_field::T_OPT_IN_REQ_OUT); fval.set_req(t_field::T_OPT_IN_REQ_OUT); generate_deserialize_field(out, &fkey, true, "", false, false, true); generate_deserialize_field(out, &fval, true, "", false, false, false, true); indent(out) << prefix << "[" << key << "] = " << val << endl; } /** * Write a set element */ void t_go_generator::generate_deserialize_set_element(ofstream& out, t_set* tset, bool declare, string prefix) { (void)declare; string elem = tmp("_elem"); t_field felem(tset->get_elem_type(), elem); felem.set_req(t_field::T_OPT_IN_REQ_OUT); generate_deserialize_field(out, &felem, true, "", false, false, false, true); indent(out) << prefix << " = append(" << prefix << ", " << elem << ")" << endl; } /** * Write a list element */ void t_go_generator::generate_deserialize_list_element(ofstream& out, t_list* tlist, bool declare, string prefix) { (void)declare; string elem = tmp("_elem"); t_field felem(((t_list*)tlist)->get_elem_type(), elem); felem.set_req(t_field::T_OPT_IN_REQ_OUT); generate_deserialize_field(out, &felem, true, "", false, false, false, true); indent(out) << prefix << " = append(" << prefix << ", " << elem << ")" << endl; } /** * Serializes a field of any type. * * @param tfield The field to serialize * @param prefix Name to prepend to field name */ void t_go_generator::generate_serialize_field(ofstream& out, t_field* tfield, string prefix, bool inkey) { t_type* type = get_true_type(tfield->get_type()); string name(prefix + publicize(tfield->get_name())); // Do nothing for void types if (type->is_void()) { throw "compiler error: cannot generate serialize for void type: " + name; } if (type->is_struct() || type->is_xception()) { generate_serialize_struct(out, (t_struct*)type, name); } else if (type->is_container()) { generate_serialize_container(out, type, is_pointer_field(tfield), name); } else if (type->is_base_type() || type->is_enum()) { indent(out) << "if err := oprot."; if (is_pointer_field(tfield)) { name = "*" + name; } if (type->is_base_type()) { t_base_type::t_base tbase = ((t_base_type*)type)->get_base(); switch (tbase) { case t_base_type::TYPE_VOID: throw "compiler error: cannot serialize void field in a struct: " + name; break; case t_base_type::TYPE_STRING: if (type->is_binary() && !inkey) { out << "WriteBinary(" << name << ")"; } else { out << "WriteString(string(" << name << "))"; } break; case t_base_type::TYPE_BOOL: out << "WriteBool(bool(" << name << "))"; break; case t_base_type::TYPE_I8: out << "WriteByte(int8(" << name << "))"; break; case t_base_type::TYPE_I16: out << "WriteI16(int16(" << name << "))"; break; case t_base_type::TYPE_I32: out << "WriteI32(int32(" << name << "))"; break; case t_base_type::TYPE_I64: out << "WriteI64(int64(" << name << "))"; break; case t_base_type::TYPE_DOUBLE: out << "WriteDouble(float64(" << name << "))"; break; default: throw "compiler error: no Go name for base type " + t_base_type::t_base_name(tbase); } } else if (type->is_enum()) { out << "WriteI32(int32(" << name << "))"; } out << "; err != nil {" << endl; out << indent() << "return thrift.PrependError(fmt.Sprintf(\"%T." << escape_string(tfield->get_name()) << " (" << tfield->get_key() << ") field write error: \", p), err) }" << endl; } else { throw "compiler error: Invalid type in generate_serialize_field '" + type->get_name() + "' for field '" + name + "'"; } } /** * Serializes all the members of a struct. * * @param tstruct The struct to serialize * @param prefix String prefix to attach to all fields */ void t_go_generator::generate_serialize_struct(ofstream& out, t_struct* tstruct, string prefix) { (void)tstruct; out << indent() << "if err := " << prefix << "." << write_method_name_ << "(oprot); err != nil {" << endl; out << indent() << " return thrift.PrependError(fmt.Sprintf(\"%T error writing struct: \", " << prefix << "), err)" << endl; out << indent() << "}" << endl; } void t_go_generator::generate_serialize_container(ofstream& out, t_type* ttype, bool pointer_field, string prefix) { if (pointer_field) { prefix = "*" + prefix; } if (ttype->is_map()) { out << indent() << "if err := oprot.WriteMapBegin(" << type_to_enum(((t_map*)ttype)->get_key_type()) << ", " << type_to_enum(((t_map*)ttype)->get_val_type()) << ", " << "len(" << prefix << ")); err != nil {" << endl; out << indent() << " return thrift.PrependError(\"error writing map begin: \", err)" << endl; out << indent() << "}" << endl; } else if (ttype->is_set()) { out << indent() << "if err := oprot.WriteSetBegin(" << type_to_enum(((t_set*)ttype)->get_elem_type()) << ", " << "len(" << prefix << ")); err != nil {" << endl; out << indent() << " return thrift.PrependError(\"error writing set begin: \", err)" << endl; out << indent() << "}" << endl; } else if (ttype->is_list()) { out << indent() << "if err := oprot.WriteListBegin(" << type_to_enum(((t_list*)ttype)->get_elem_type()) << ", " << "len(" << prefix << ")); err != nil {" << endl; out << indent() << " return thrift.PrependError(\"error writing list begin: \", err)" << endl; out << indent() << "}" << endl; } else { throw "compiler error: Invalid type in generate_serialize_container '" + ttype->get_name() + "' for prefix '" + prefix + "'"; } if (ttype->is_map()) { t_map* tmap = (t_map*)ttype; out << indent() << "for k, v := range " << prefix << " {" << endl; indent_up(); generate_serialize_map_element(out, tmap, "k", "v"); indent_down(); indent(out) << "}" << endl; } else if (ttype->is_set()) { t_set* tset = (t_set*)ttype; out << indent() << "for i := 0; i<len(" << prefix << "); i++ {" << endl; out << indent() << " for j := i+1; j<len(" << prefix << "); j++ {" << endl; out << indent() << " if reflect.DeepEqual(" << prefix << "[i]," << prefix << "[j]) { " << endl; out << indent() << " return thrift.PrependError(\"\", fmt.Errorf(\"%T error writing set field: slice is not unique\", " << prefix << "[i]))" << endl; out << indent() << " }" << endl; out << indent() << " }" << endl; out << indent() << "}" << endl; out << indent() << "for _, v := range " << prefix << " {" << endl; indent_up(); generate_serialize_set_element(out, tset, "v"); indent_down(); indent(out) << "}" << endl; } else if (ttype->is_list()) { t_list* tlist = (t_list*)ttype; out << indent() << "for _, v := range " << prefix << " {" << endl; indent_up(); generate_serialize_list_element(out, tlist, "v"); indent_down(); indent(out) << "}" << endl; } if (ttype->is_map()) { out << indent() << "if err := oprot.WriteMapEnd(); err != nil {" << endl; out << indent() << " return thrift.PrependError(\"error writing map end: \", err)" << endl; out << indent() << "}" << endl; } else if (ttype->is_set()) { out << indent() << "if err := oprot.WriteSetEnd(); err != nil {" << endl; out << indent() << " return thrift.PrependError(\"error writing set end: \", err)" << endl; out << indent() << "}" << endl; } else if (ttype->is_list()) { out << indent() << "if err := oprot.WriteListEnd(); err != nil {" << endl; out << indent() << " return thrift.PrependError(\"error writing list end: \", err)" << endl; out << indent() << "}" << endl; } } /** * Serializes the members of a map. * */ void t_go_generator::generate_serialize_map_element(ofstream& out, t_map* tmap, string kiter, string viter) { t_field kfield(tmap->get_key_type(), ""); t_field vfield(tmap->get_val_type(), ""); kfield.set_req(t_field::T_OPT_IN_REQ_OUT); vfield.set_req(t_field::T_OPT_IN_REQ_OUT); generate_serialize_field(out, &kfield, kiter, true); generate_serialize_field(out, &vfield, viter); } /** * Serializes the members of a set. */ void t_go_generator::generate_serialize_set_element(ofstream& out, t_set* tset, string prefix) { t_field efield(tset->get_elem_type(), ""); efield.set_req(t_field::T_OPT_IN_REQ_OUT); generate_serialize_field(out, &efield, prefix); } /** * Serializes the members of a list. */ void t_go_generator::generate_serialize_list_element(ofstream& out, t_list* tlist, string prefix) { t_field efield(tlist->get_elem_type(), ""); efield.set_req(t_field::T_OPT_IN_REQ_OUT); generate_serialize_field(out, &efield, prefix); } /** * Generates the docstring for a given struct. */ void t_go_generator::generate_go_docstring(ofstream& out, t_struct* tstruct) { generate_go_docstring(out, tstruct, tstruct, "Attributes"); } /** * Generates the docstring for a given function. */ void t_go_generator::generate_go_docstring(ofstream& out, t_function* tfunction) { generate_go_docstring(out, tfunction, tfunction->get_arglist(), "Parameters"); } /** * Generates the docstring for a struct or function. */ void t_go_generator::generate_go_docstring(ofstream& out, t_doc* tdoc, t_struct* tstruct, const char* subheader) { bool has_doc = false; stringstream ss; if (tdoc->has_doc()) { has_doc = true; ss << tdoc->get_doc(); } const vector<t_field*>& fields = tstruct->get_members(); if (fields.size() > 0) { if (has_doc) { ss << endl; } has_doc = true; ss << subheader << ":\n"; vector<t_field*>::const_iterator p_iter; for (p_iter = fields.begin(); p_iter != fields.end(); ++p_iter) { t_field* p = *p_iter; ss << " - " << publicize(p->get_name()); if (p->has_doc()) { ss << ": " << p->get_doc(); } else { ss << endl; } } } if (has_doc) { generate_docstring_comment(out, "", "// ", ss.str(), ""); } } /** * Generates the docstring for a generic object. */ void t_go_generator::generate_go_docstring(ofstream& out, t_doc* tdoc) { if (tdoc->has_doc()) { generate_docstring_comment(out, "", "//", tdoc->get_doc(), ""); } } /** * Declares an argument, which may include initialization as necessary. * * @param tfield The field */ string t_go_generator::declare_argument(t_field* tfield) { std::ostringstream result; result << publicize(tfield->get_name()) << "="; if (tfield->get_value() != NULL) { result << "thrift_spec[" << tfield->get_key() << "][4]"; } else { result << "nil"; } return result.str(); } /** * Renders a struct field initial value. * * @param tfield The field, which must have `tfield->get_value() != NULL` */ string t_go_generator::render_field_initial_value(t_field* tfield, const string& name, bool optional_field) { t_type* type = get_true_type(tfield->get_type()); if (optional_field) { // The caller will make a second pass for optional fields, // assigning the result of render_const_value to "*field_name". It // is maddening that Go syntax does not allow for a type-agnostic // way to initialize a pointer to a const value, but so it goes. // The alternative would be to write type specific functions that // convert from const values to pointer types, but given the lack // of overloading it would be messy. return "new(" + type_to_go_type(tfield->get_type()) + ")"; } else { return render_const_value(type, tfield->get_value(), name); } } /** * Renders a function signature of the form 'type name(args)' * * @param tfunction Function definition * @return String of rendered function definition */ string t_go_generator::function_signature(t_function* tfunction, string prefix) { // TODO(mcslee): Nitpicky, no ',' if argument_list is empty return publicize(prefix + tfunction->get_name()) + "(" + argument_list(tfunction->get_arglist()) + ")"; } /** * Renders an interface function signature of the form 'type name(args)' * * @param tfunction Function definition * @return String of rendered function definition */ string t_go_generator::function_signature_if(t_function* tfunction, string prefix, bool addError) { string signature = publicize(prefix + tfunction->get_name()) + "("; signature += "ctx context.Context"; if (!tfunction->get_arglist()->get_members().empty()) { signature += ", " + argument_list(tfunction->get_arglist()); } signature += ") ("; t_type* ret = tfunction->get_returntype(); t_struct* exceptions = tfunction->get_xceptions(); string errs = argument_list(exceptions); if (!ret->is_void()) { signature += "r " + type_to_go_type(ret); if (addError || errs.size() == 0) { signature += ", "; } } if (addError) { signature += "err error"; } signature += ")"; return signature; } /** * Renders a field list */ string t_go_generator::argument_list(t_struct* tstruct) { string result = ""; const vector<t_field*>& fields = tstruct->get_members(); vector<t_field*>::const_iterator f_iter; bool first = true; for (f_iter = fields.begin(); f_iter != fields.end(); ++f_iter) { if (first) { first = false; } else { result += ", "; } result += variable_name_to_go_name((*f_iter)->get_name()) + " " + type_to_go_type((*f_iter)->get_type()); } return result; } string t_go_generator::type_name(t_type* ttype) { string module( module_name(ttype)); if( ! module.empty()) { return module + "." + ttype->get_name(); } return ttype->get_name(); } string t_go_generator::module_name(t_type* ttype) { t_program* program = ttype->get_program(); if (program != NULL && program != program_) { if (program->get_namespace("go").empty() || program_->get_namespace("go").empty() || program->get_namespace("go") != program_->get_namespace("go")) { string module(get_real_go_module(program)); // for namespaced includes, only keep part after dot. size_t dot = module.rfind('.'); if (dot != string::npos) { module = module.substr(dot + 1); } return module; } } return ""; } /** * Converts the parse type to a go tyoe */ string t_go_generator::type_to_enum(t_type* type) { type = get_true_type(type); if (type->is_base_type()) { t_base_type::t_base tbase = ((t_base_type*)type)->get_base(); switch (tbase) { case t_base_type::TYPE_VOID: throw "NO T_VOID CONSTRUCT"; case t_base_type::TYPE_STRING: /* this is wrong, binary is still a string type internally if (type->is_binary()) { return "thrift.BINARY"; } */ return "thrift.STRING"; case t_base_type::TYPE_BOOL: return "thrift.BOOL"; case t_base_type::TYPE_I8: return "thrift.BYTE"; case t_base_type::TYPE_I16: return "thrift.I16"; case t_base_type::TYPE_I32: return "thrift.I32"; case t_base_type::TYPE_I64: return "thrift.I64"; case t_base_type::TYPE_DOUBLE: return "thrift.DOUBLE"; } } else if (type->is_enum()) { return "thrift.I32"; } else if (type->is_struct() || type->is_xception()) { return "thrift.STRUCT"; } else if (type->is_map()) { return "thrift.MAP"; } else if (type->is_set()) { return "thrift.SET"; } else if (type->is_list()) { return "thrift.LIST"; } throw "INVALID TYPE IN type_to_enum: " + type->get_name(); } /** * Converts the parse type to a go map type, will throw an exception if it will * not produce a valid go map type. */ string t_go_generator::type_to_go_key_type(t_type* type) { t_type* resolved_type = type; while (resolved_type->is_typedef()) { resolved_type = ((t_typedef*)resolved_type)->get_type()->get_true_type(); } if (resolved_type->is_map() || resolved_type->is_list() || resolved_type->is_set()) { throw "Cannot produce a valid type for a Go map key: " + type_to_go_type(type) + " - aborting."; } if (resolved_type->is_binary()) return "string"; return type_to_go_type(type); } /** * Converts the parse type to a go type */ string t_go_generator::type_to_go_type(t_type* type) { return type_to_go_type_with_opt(type, false); } /** * Converts the parse type to a go type, taking into account whether the field * associated with the type is T_OPTIONAL. */ string t_go_generator::type_to_go_type_with_opt(t_type* type, bool optional_field) { string maybe_pointer(optional_field ? "*" : ""); if (type->is_typedef() && ((t_typedef*)type)->is_forward_typedef()) { type = ((t_typedef*)type)->get_true_type(); } if (type->is_base_type()) { t_base_type::t_base tbase = ((t_base_type*)type)->get_base(); switch (tbase) { case t_base_type::TYPE_VOID: throw ""; case t_base_type::TYPE_STRING: if (type->is_binary()) { return maybe_pointer + "[]byte"; } return maybe_pointer + "string"; case t_base_type::TYPE_BOOL: return maybe_pointer + "bool"; case t_base_type::TYPE_I8: return maybe_pointer + "int8"; case t_base_type::TYPE_I16: return maybe_pointer + "int16"; case t_base_type::TYPE_I32: return maybe_pointer + "int32"; case t_base_type::TYPE_I64: return maybe_pointer + "int64"; case t_base_type::TYPE_DOUBLE: return maybe_pointer + "float64"; } } else if (type->is_enum()) { return maybe_pointer + publicize(type_name(type)); } else if (type->is_struct() || type->is_xception()) { return "*" + publicize(type_name(type)); } else if (type->is_map()) { t_map* t = (t_map*)type; string keyType = type_to_go_key_type(t->get_key_type()); string valueType = type_to_go_type(t->get_val_type()); return maybe_pointer + string("map[") + keyType + "]" + valueType; } else if (type->is_set()) { t_set* t = (t_set*)type; string elemType = type_to_go_type(t->get_elem_type()); return maybe_pointer + string("[]") + elemType; } else if (type->is_list()) { t_list* t = (t_list*)type; string elemType = type_to_go_type(t->get_elem_type()); return maybe_pointer + string("[]") + elemType; } else if (type->is_typedef()) { return maybe_pointer + publicize(type_name(type)); } throw "INVALID TYPE IN type_to_go_type: " + type->get_name(); } /** See the comment inside generate_go_struct_definition for what this is. */ string t_go_generator::type_to_spec_args(t_type* ttype) { while (ttype->is_typedef()) { ttype = ((t_typedef*)ttype)->get_type(); } if (ttype->is_base_type() || ttype->is_enum()) { return "nil"; } else if (ttype->is_struct() || ttype->is_xception()) { return "(" + type_name(ttype) + ", " + type_name(ttype) + ".thrift_spec)"; } else if (ttype->is_map()) { return "(" + type_to_enum(((t_map*)ttype)->get_key_type()) + "," + type_to_spec_args(((t_map*)ttype)->get_key_type()) + "," + type_to_enum(((t_map*)ttype)->get_val_type()) + "," + type_to_spec_args(((t_map*)ttype)->get_val_type()) + ")"; } else if (ttype->is_set()) { return "(" + type_to_enum(((t_set*)ttype)->get_elem_type()) + "," + type_to_spec_args(((t_set*)ttype)->get_elem_type()) + ")"; } else if (ttype->is_list()) { return "(" + type_to_enum(((t_list*)ttype)->get_elem_type()) + "," + type_to_spec_args(((t_list*)ttype)->get_elem_type()) + ")"; } throw "INVALID TYPE IN type_to_spec_args: " + ttype->get_name(); } bool format_go_output(const string& file_path) { // formatting via gofmt deactivated due to THRIFT-3893 // Please look at the ticket and make sure you fully understand all the implications // before submitting a patch that enables this feature again. Thank you. (void) file_path; return false; /* const string command = "gofmt -w " + file_path; if (system(command.c_str()) == 0) { return true; } fprintf(stderr, "WARNING - Running '%s' failed.\n", command.c_str()); return false; */ } THRIFT_REGISTER_GENERATOR(go, "Go", " package_prefix= Package prefix for generated files.\n" \ " thrift_import= Override thrift package import path (default:" + DEFAULT_THRIFT_IMPORT + ")\n" \ " package= Package name (default: inferred from thrift file name)\n" \ " ignore_initialisms\n" " Disable automatic spelling correction of initialisms (e.g. \"URL\")\n" \ " read_write_private\n" " Make read/write methods private, default is public Read/Write\n" \ " legacy_context\n" " Use legacy x/net/context instead of context in go<1.7.\n")
{ "content_hash": "46e4c335dcb4cd41ff6ce1d96f4f9e8a", "timestamp": "", "source": "github", "line_count": 3622, "max_line_length": 158, "avg_line_length": 36.65571507454445, "alnum_prop": 0.539139997137843, "repo_name": "tanmaykm/thrift", "id": "6cce32bcc4b0132db7690cbb61bdae24b31e1f88", "size": "133570", "binary": false, "copies": "1", "ref": "refs/heads/julia1.0-thrift-0.11.0", "path": "compiler/cpp/src/thrift/generate/t_go_generator.cc", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "ActionScript", "bytes": "75532" }, { "name": "Batchfile", "bytes": "5757" }, { "name": "C", "bytes": "668655" }, { "name": "C#", "bytes": "361020" }, { "name": "C++", "bytes": "3630837" }, { "name": "CMake", "bytes": "80383" }, { "name": "D", "bytes": "643127" }, { "name": "Emacs Lisp", "bytes": "5361" }, { "name": "Erlang", "bytes": "221621" }, { "name": "Go", "bytes": "446224" }, { "name": "HTML", "bytes": "21823" }, { "name": "Haskell", "bytes": "103804" }, { "name": "Haxe", "bytes": "304443" }, { "name": "Java", "bytes": "946101" }, { "name": "JavaScript", "bytes": "324391" }, { "name": "Lex", "bytes": "15613" }, { "name": "Lua", "bytes": "48477" }, { "name": "M4", "bytes": "135256" }, { "name": "Makefile", "bytes": "157408" }, { "name": "OCaml", "bytes": "39241" }, { "name": "Objective-C", "bytes": "129885" }, { "name": "PHP", "bytes": "277093" }, { "name": "Pascal", "bytes": "386113" }, { "name": "Perl", "bytes": "115220" }, { "name": "Python", "bytes": "308361" }, { "name": "Ruby", "bytes": "385732" }, { "name": "Shell", "bytes": "26909" }, { "name": "Smalltalk", "bytes": "22944" }, { "name": "Thrift", "bytes": "307024" }, { "name": "Vim script", "bytes": "2843" }, { "name": "Yacc", "bytes": "31745" } ], "symlink_target": "" }
@implementation PDDataSource - (id)init { self = [super init]; if (self) { _energyEnhancer = @"Spinach"; _energyEnhancer2 = @"Mushroom"; _energyEnhancer3 = @"Potion"; _enhancers = @[@"Spinach", @"Mushroom", @"Potion", @"Star", @"Flower", @"Shell", @"Berry"]; } return self; } @end
{ "content_hash": "271ba20118b4e584d6556d1cffdf80ad", "timestamp": "", "source": "github", "line_count": 16, "max_line_length": 99, "avg_line_length": 21.25, "alnum_prop": 0.5264705882352941, "repo_name": "MosheBerman/demo-passing-data", "id": "d9fd66cd4b3ab29dc3a9c35392a85e48602a7161", "size": "509", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "PassingData/PDDataSource.m", "mode": "33188", "license": "mit", "language": [ { "name": "Objective-C", "bytes": "5097" } ], "symlink_target": "" }
#ifndef BONES_CORE_ROOT_MANAGER_H_ #define BONES_CORE_ROOT_MANAGER_H_ #include "root.h" #include <vector> namespace bones { class Root; class RootManager { public: ~RootManager(); Root * getRoot(int index) const; size_t getRootCount() const; void add(Root * root); void remove(Root * root); void remove(); void update(); private: std::vector<RefPtr<Root>> roots_; }; } #endif
{ "content_hash": "bce50ee920970e2cb5e0917e3c48a5b8", "timestamp": "", "source": "github", "line_count": 33, "max_line_length": 37, "avg_line_length": 12.696969696969697, "alnum_prop": 0.6443914081145584, "repo_name": "bonescreater/bones", "id": "437e131a5898c9d96587e170e02d3392bebd47b7", "size": "421", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "bones/core/root_manager.h", "mode": "33188", "license": "mit", "language": [ { "name": "Assembly", "bytes": "10259" }, { "name": "C", "bytes": "1315840" }, { "name": "C++", "bytes": "10469870" }, { "name": "CMake", "bytes": "15980" }, { "name": "CSS", "bytes": "481" }, { "name": "Lua", "bytes": "24909" }, { "name": "Makefile", "bytes": "6894" }, { "name": "Objective-C", "bytes": "1852" }, { "name": "Objective-C++", "bytes": "13202" } ], "symlink_target": "" }
package com.thirdpart.widget; import android.R.integer; import android.content.Context; import android.graphics.Canvas; import android.graphics.Color; import android.graphics.DashPathEffect; import android.graphics.Paint; import android.graphics.Path; import android.graphics.PathEffect; import android.util.AttributeSet; import android.view.View; public class LineStroke extends View{ public LineStroke(Context context, AttributeSet attrs) { super(context, attrs); // TODO Auto-generated constructor stub setLayerType(View.LAYER_TYPE_SOFTWARE, null); } @Override protected void onDraw(Canvas canvas) { // TODO Auto-generated method stub super.onDraw(canvas); Paint paint = new Paint(); paint.setStyle(Paint.Style.STROKE); paint.setColor(Color.rgb(0x00, 0x8b, 0x00)); int w = getWidth(); int sepcW = 8; int count = 2 * w /sepcW; for (int i = 0; i < count; i+=2) { int end = (i+1) * sepcW; if (end<=w) { // canvas.restore(); canvas.drawLine( i*sepcW,0, end, 1, paint); // canvas.save(); }else { break; } } } }
{ "content_hash": "396f1d8a750471472357da4908b37a3a", "timestamp": "", "source": "github", "line_count": 46, "max_line_length": 57, "avg_line_length": 26.76086956521739, "alnum_prop": 0.6125101543460602, "repo_name": "cdut007/PMS_TASK", "id": "5200dca8d31b31fa8a64a26adf23e142155e981c", "size": "1231", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "TaskTrackerPMS/src/com/thirdpart/widget/LineStroke.java", "mode": "33188", "license": "mit", "language": [ { "name": "Java", "bytes": "1033339" } ], "symlink_target": "" }
<div data-element="editor-languages" ng-controller="Umbraco.Editors.Languages.OverviewController as vm" class="clearfix"> <umb-editor-view footer="false"> <umb-editor-header name="vm.page.name" name-locked="true" hide-icon="true" hide-description="true" hide-alias="true"> </umb-editor-header> <umb-editor-container> <umb-load-indicator ng-if="vm.loading"></umb-load-indicator> <umb-editor-sub-header> <umb-editor-sub-header-content-left> <umb-button button-style="success" type="button" action="vm.addLanguage()" label-key="languages_addLanguage"> </umb-button> </umb-editor-sub-header-content-left> </umb-editor-sub-header> <table class="table table-hover" ng-if="!vm.loading"> <thead> <tr> <th><localize key="general_language">Language</localize></th> <th>ISO</th> <th><localize key="general_default">Default</localize></th> <th><localize key="general_mandatory">Mandatory</localize></th> <th>Fallback</th> </tr> </thead> <tbody> <tr ng-repeat="language in vm.languages track by language.id" ng-click="vm.editLanguage(language)" style="cursor: pointer;"> <td> <i class="icon-globe" style="color: #BBBABF; margin-right: 5px;"></i> <span ng-class="{'bold': language.isDefault}">{{ language.name }}</span> </td> <td> <span>{{ language.culture }}</span> </td> <td> <umb-checkmark ng-if="language.isDefault" checked="language.isDefault" size="xs"> </umb-checkmark> </td> <td> <umb-checkmark ng-if="language.isMandatory" checked="language.isMandatory" size="xs"> </umb-checkmark> </td> <td> <span ng-if="language.fallbackLanguageId">{{vm.getLanguageById(language.fallbackLanguageId).name}}</span> <span ng-if="!language.fallbackLanguageId">(none)</span> </td> <td style="text-align: right;"> <umb-button ng-if="!language.isDefault" type="button" size="xxs" button-style="danger" state="language.deleteButtonState" action="vm.deleteLanguage(language, $event)" label-key="general_delete"> </umb-button> </td> </tr> </tbody> </table> </umb-editor-container> </umb-editor-view> </div>
{ "content_hash": "0cade4a9c7e35a13720162e4a7fef3b2", "timestamp": "", "source": "github", "line_count": 81, "max_line_length": 144, "avg_line_length": 44.901234567901234, "alnum_prop": 0.39318119329117407, "repo_name": "elmahio/elmah.io.umbraco", "id": "15a9c84367dde75849de33d3bc0a2300ac84f3fb", "size": "3637", "binary": false, "copies": "1", "ref": "refs/heads/main", "path": "samples/Elmah.Io.Umbraco.Example/Umbraco/Views/languages/overview.html", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "C#", "bytes": "4305" }, { "name": "PowerShell", "bytes": "2068" } ], "symlink_target": "" }
class AddIndexToDictionaries < ActiveRecord::Migration def change add_index :dictionaries, :name, :unique => true end end
{ "content_hash": "2533bf0373ad8e9c95c29b1dd589d72c", "timestamp": "", "source": "github", "line_count": 5, "max_line_length": 54, "avg_line_length": 26, "alnum_prop": 0.7461538461538462, "repo_name": "gwinbleidd/parser", "id": "6858272732d7dbf0e79b3552f66d26b50ebbb5a1", "size": "130", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "db/migrate/20150406122200_add_index_to_dictionaries.rb", "mode": "33188", "license": "mit", "language": [ { "name": "Batchfile", "bytes": "312" }, { "name": "Ruby", "bytes": "49324" } ], "symlink_target": "" }
<?php namespace OCP\Files\Mount; /** * Interface IMountManager * * Manages all mounted storages in the system * @since 8.2.0 */ interface IMountManager { /** * Add a new mount * * @param \OCP\Files\Mount\IMountPoint $mount * @since 8.2.0 */ public function addMount(IMountPoint $mount); /** * Remove a mount * * @param string $mountPoint * @since 8.2.0 */ public function removeMount($mountPoint); /** * Change the location of a mount * * @param string $mountPoint * @param string $target * @since 8.2.0 */ public function moveMount($mountPoint, $target); /** * Find the mount for $path * * @param string $path * @return \OCP\Files\Mount\IMountPoint * @since 8.2.0 */ public function find($path); /** * Find all mounts in $path * * @param string $path * @return \OCP\Files\Mount\IMountPoint[] * @since 8.2.0 */ public function findIn($path); /** * Remove all registered mounts * * @since 8.2.0 */ public function clear(); /** * Find mounts by storage id * * @param string $id * @return \OCP\Files\Mount\IMountPoint[] * @since 8.2.0 */ public function findByStorageId($id); /** * @return \OCP\Files\Mount\IMountPoint[] * @since 8.2.0 */ public function getAll(); /** * Find mounts by numeric storage id * * @param int $id * @return \OCP\Files\Mount\IMountPoint[] * @since 8.2.0 */ public function findByNumericId($id); }
{ "content_hash": "cc0a0f37bcd4c4ec3f1f2bd1ecc3375a", "timestamp": "", "source": "github", "line_count": 87, "max_line_length": 49, "avg_line_length": 16.655172413793103, "alnum_prop": 0.621808143547274, "repo_name": "phil-davis/core", "id": "79a1cec2164b4bb56d35e7c413c90380dc642341", "size": "2239", "binary": false, "copies": "5", "ref": "refs/heads/master", "path": "lib/public/Files/Mount/IMountManager.php", "mode": "33188", "license": "mit", "language": [ { "name": "Dockerfile", "bytes": "262" }, { "name": "Makefile", "bytes": "473" }, { "name": "Shell", "bytes": "8644" } ], "symlink_target": "" }
action="$1" shift extra_args="$*" project_dir=$(dirname $(dirname $(readlink -f $0))) cd $project_dir [ -e .env ] && . .env run_ansible() { playbook="$1" ./scripts/update-secrets.sh cd ansible ansible-playbook plays/$playbook.yml $extra_args cd .. } migrate_db() { python manage.py makemigrations --noinput --exit && \ python manage.py migrate --noinput } make_messages() { cd dz python ../manage.py makemessages -l en -l ru -l sl cd .. } compile_messages() { cd dz python ../manage.py compilemessages cd .. } run_linters() { flake8 && \ sass-lint -v -q && \ eslint dz/assets webpack.config.babel.js } set -x case "$action" in lang) make_messages ;; prod) run_linters # Compile and bundle production javascript and css: npm run makeprod ;; devel) pip -q install -r requirements/devel.txt migrate_db compile_messages npm run makedevel ;; test) # We do not let django create test database for security reasons. # Database is created manually by ansible, and here we supply the # `--keep` option telling django to skip creating and dropping. python manage.py check && \ python manage.py test --keep --reverse --failfast --verbosity 2 $extra_args ;; coverage) coverage run --source=. --omit='*/bot/*' manage.py test -k $extra_args coverage report ;; lint) run_linters ;; liveserver) TEST_LIVESERVER=1 python manage.py test --keep --liveserver=0.0.0.0:8000 --tag liveserver $extra_args ;; setup-devel|backup-db|build-bot|install-bot|install-web) run_ansible $action ;; prepare) migrate_db compile_messages # Use `-v0` to silence verbose whitenoise messages: python manage.py collectstatic --noinput -v0 ;; *) set +x echo "usage: $0 ACTION|PLAYBOOK" echo " ACTIONS: prepare prod devel lang test lint coverage liveserver" echo " PLAYBOOKS: setup-devel backup-db build-bot install-bot install-web" exit 1 esac
{ "content_hash": "0a3777b1963ef57ee35c3d82cc3fe687", "timestamp": "", "source": "github", "line_count": 93, "max_line_length": 105, "avg_line_length": 21.602150537634408, "alnum_prop": 0.649079143852663, "repo_name": "ivandeex/dz", "id": "9a105abaff5051362a360196ba7a80191df4e031", "size": "2021", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "scripts/make.sh", "mode": "33261", "license": "mit", "language": [ { "name": "CSS", "bytes": "216611" }, { "name": "HTML", "bytes": "34476" }, { "name": "JavaScript", "bytes": "10185" }, { "name": "PowerShell", "bytes": "305" }, { "name": "Python", "bytes": "174484" }, { "name": "Shell", "bytes": "2755" } ], "symlink_target": "" }
#include <stdio.h> #include "as.h" #include "safe-ctype.h" #include "subsegs.h" #include "symcat.h" #include "opcodes/fr30-desc.h" #include "opcodes/fr30-opc.h" #include "cgen.h" /* Structure to hold all of the different components describing an individual instruction. */ typedef struct { const CGEN_INSN * insn; const CGEN_INSN * orig_insn; CGEN_FIELDS fields; #if CGEN_INT_INSN_P CGEN_INSN_INT buffer [1]; #define INSN_VALUE(buf) (*(buf)) #else unsigned char buffer [CGEN_MAX_INSN_SIZE]; #define INSN_VALUE(buf) (buf) #endif char * addr; fragS * frag; int num_fixups; fixS * fixups [GAS_CGEN_MAX_FIXUPS]; int indices [MAX_OPERAND_INSTANCES]; } fr30_insn; const char comment_chars[] = ";"; const char line_comment_chars[] = "#"; const char line_separator_chars[] = "|"; const char EXP_CHARS[] = "eE"; const char FLT_CHARS[] = "dD"; #define FR30_SHORTOPTS "" const char * md_shortopts = FR30_SHORTOPTS; struct option md_longopts[] = { {NULL, no_argument, NULL, 0} }; size_t md_longopts_size = sizeof (md_longopts); int md_parse_option (c, arg) int c ATTRIBUTE_UNUSED; char *arg ATTRIBUTE_UNUSED; { switch (c) { default: return 0; } return 1; } void md_show_usage (stream) FILE * stream; { fprintf (stream, _(" FR30 specific command line options:\n")); } /* The target specific pseudo-ops which we support. */ const pseudo_typeS md_pseudo_table[] = { { "word", cons, 4 }, { NULL, NULL, 0 } }; void md_begin () { /* Initialize the `cgen' interface. */ /* Set the machine number and endian. */ gas_cgen_cpu_desc = fr30_cgen_cpu_open (CGEN_CPU_OPEN_MACHS, 0, CGEN_CPU_OPEN_ENDIAN, CGEN_ENDIAN_BIG, CGEN_CPU_OPEN_END); fr30_cgen_init_asm (gas_cgen_cpu_desc); /* This is a callback from cgen to gas to parse operands. */ cgen_set_parse_operand_fn (gas_cgen_cpu_desc, gas_cgen_parse_operand); } void md_assemble (str) char *str; { static int last_insn_had_delay_slot = 0; fr30_insn insn; char *errmsg; /* Initialize GAS's cgen interface for a new instruction. */ gas_cgen_init_parse (); insn.insn = fr30_cgen_assemble_insn (gas_cgen_cpu_desc, str, & insn.fields, insn.buffer, & errmsg); if (!insn.insn) { as_bad (errmsg); return; } /* Doesn't really matter what we pass for RELAX_P here. */ gas_cgen_finish_insn (insn.insn, insn.buffer, CGEN_FIELDS_BITSIZE (& insn.fields), 1, NULL); /* Warn about invalid insns in delay slots. */ if (last_insn_had_delay_slot && CGEN_INSN_ATTR_VALUE (insn.insn, CGEN_INSN_NOT_IN_DELAY_SLOT)) as_warn (_("Instruction %s not allowed in a delay slot."), CGEN_INSN_NAME (insn.insn)); last_insn_had_delay_slot = CGEN_INSN_ATTR_VALUE (insn.insn, CGEN_INSN_DELAY_SLOT); } /* The syntax in the manual says constants begin with '#'. We just ignore it. */ void md_operand (expressionP) expressionS * expressionP; { if (* input_line_pointer == '#') { input_line_pointer ++; expression (expressionP); } } valueT md_section_align (segment, size) segT segment; valueT size; { int align = bfd_get_section_alignment (stdoutput, segment); return ((size + (1 << align) - 1) & (-1 << align)); } symbolS * md_undefined_symbol (name) char *name ATTRIBUTE_UNUSED; { return 0; } /* Interface to relax_segment. */ /* FIXME: Build table by hand, get it working, then machine generate. */ const relax_typeS md_relax_table[] = { /* The fields are: 1) most positive reach of this state, 2) most negative reach of this state, 3) how many bytes this mode will add to the size of the current frag 4) which index into the table to try if we can't fit into this one. */ /* The first entry must be unused because an `rlx_more' value of zero ends each list. */ {1, 1, 0, 0}, /* The displacement used by GAS is from the end of the 2 byte insn, so we subtract 2 from the following. */ /* 16 bit insn, 8 bit disp -> 10 bit range. This doesn't handle a branch in the right slot at the border: the "& -4" isn't taken into account. It's not important enough to complicate things over it, so we subtract an extra 2 (or + 2 in -ve case). */ {511 - 2 - 2, -512 - 2 + 2, 0, 2 }, /* 32 bit insn, 24 bit disp -> 26 bit range. */ {0x2000000 - 1 - 2, -0x2000000 - 2, 2, 0 }, /* Same thing, but with leading nop for alignment. */ {0x2000000 - 1 - 2, -0x2000000 - 2, 4, 0 } }; /* Return an initial guess of the length by which a fragment must grow to hold a branch to reach its destination. Also updates fr_type/fr_subtype as necessary. Called just before doing relaxation. Any symbol that is now undefined will not become defined. The guess for fr_var is ACTUALLY the growth beyond fr_fix. Whatever we do to grow fr_fix or fr_var contributes to our returned value. Although it may not be explicit in the frag, pretend fr_var starts with a 0 value. */ int md_estimate_size_before_relax (fragP, segment) fragS * fragP; segT segment; { /* The only thing we have to handle here are symbols outside of the current segment. They may be undefined or in a different segment in which case linker scripts may place them anywhere. However, we can't finish the fragment here and emit the reloc as insn alignment requirements may move the insn about. */ if (S_GET_SEGMENT (fragP->fr_symbol) != segment) { /* The symbol is undefined in this segment. Change the relaxation subtype to the max allowable and leave all further handling to md_convert_frag. */ fragP->fr_subtype = 2; { const CGEN_INSN * insn; int i; /* Update the recorded insn. Fortunately we don't have to look very far. FIXME: Change this to record in the instruction the next higher relaxable insn to use. */ for (i = 0, insn = fragP->fr_cgen.insn; i < 4; i++, insn++) { if ((strcmp (CGEN_INSN_MNEMONIC (insn), CGEN_INSN_MNEMONIC (fragP->fr_cgen.insn)) == 0) && CGEN_INSN_ATTR_VALUE (insn, CGEN_INSN_RELAXED)) break; } if (i == 4) abort (); fragP->fr_cgen.insn = insn; return 2; } } /* Return the size of the variable part of the frag. */ return md_relax_table[fragP->fr_subtype].rlx_length; } /* *fragP has been relaxed to its final size, and now needs to have the bytes inside it modified to conform to the new size. Called after relaxation is finished. fragP->fr_type == rs_machine_dependent. fragP->fr_subtype is the subtype of what the address relaxed to. */ void md_convert_frag (abfd, sec, fragP) bfd *abfd ATTRIBUTE_UNUSED; segT sec ATTRIBUTE_UNUSED; fragS *fragP ATTRIBUTE_UNUSED; { } /* Functions concerning relocs. */ /* The location from which a PC relative jump should be calculated, given a PC relative reloc. */ long md_pcrel_from_section (fixP, sec) fixS * fixP; segT sec; { if (fixP->fx_addsy != (symbolS *) NULL && (! S_IS_DEFINED (fixP->fx_addsy) || S_GET_SEGMENT (fixP->fx_addsy) != sec)) { /* The symbol is undefined (or is defined but not in this section). Let the linker figure it out. */ return 0; } return (fixP->fx_frag->fr_address + fixP->fx_where) & ~1; } /* Return the bfd reloc type for OPERAND of INSN at fixup FIXP. Returns BFD_RELOC_NONE if no reloc type can be found. *FIXP may be modified if desired. */ bfd_reloc_code_real_type md_cgen_lookup_reloc (insn, operand, fixP) const CGEN_INSN *insn ATTRIBUTE_UNUSED; const CGEN_OPERAND *operand; fixS *fixP; { switch (operand->type) { case FR30_OPERAND_LABEL9: fixP->fx_pcrel = 1; return BFD_RELOC_FR30_9_PCREL; case FR30_OPERAND_LABEL12: fixP->fx_pcrel = 1; return BFD_RELOC_FR30_12_PCREL; case FR30_OPERAND_DISP10: return BFD_RELOC_FR30_10_IN_8; case FR30_OPERAND_DISP9: return BFD_RELOC_FR30_9_IN_8; case FR30_OPERAND_DISP8: return BFD_RELOC_FR30_8_IN_8; case FR30_OPERAND_UDISP6: return BFD_RELOC_FR30_6_IN_4; case FR30_OPERAND_I8: return BFD_RELOC_8; case FR30_OPERAND_I32: return BFD_RELOC_FR30_48; case FR30_OPERAND_I20: return BFD_RELOC_FR30_20; default : /* avoid -Wall warning */ break; } return BFD_RELOC_NONE; } /* Write a value out to the object file, using the appropriate endianness. */ void md_number_to_chars (buf, val, n) char * buf; valueT val; int n; { number_to_chars_bigendian (buf, val, n); } /* Turn a string in input_line_pointer into a floating point constant of type type, and store the appropriate bytes in *litP. The number of LITTLENUMS emitted is stored in *sizeP . An error message is returned, or NULL on OK. */ /* Equal to MAX_PRECISION in atof-ieee.c */ #define MAX_LITTLENUMS 6 char * md_atof (type, litP, sizeP) char type; char * litP; int * sizeP; { int i; int prec; LITTLENUM_TYPE words [MAX_LITTLENUMS]; char * t; switch (type) { case 'f': case 'F': case 's': case 'S': prec = 2; break; case 'd': case 'D': case 'r': case 'R': prec = 4; break; /* FIXME: Some targets allow other format chars for bigger sizes here. */ default: * sizeP = 0; return _("Bad call to md_atof()"); } t = atof_ieee (input_line_pointer, type, words); if (t) input_line_pointer = t; * sizeP = prec * sizeof (LITTLENUM_TYPE); for (i = 0; i < prec; i++) { md_number_to_chars (litP, (valueT) words[i], sizeof (LITTLENUM_TYPE)); litP += sizeof (LITTLENUM_TYPE); } return 0; } /* Worker function for fr30_is_colon_insn(). */ static char restore_colon PARAMS ((int)); static char restore_colon (advance_i_l_p_by) int advance_i_l_p_by; { char c; /* Restore the colon, and advance input_line_pointer to the end of the new symbol. */ * input_line_pointer = ':'; input_line_pointer += advance_i_l_p_by; c = * input_line_pointer; * input_line_pointer = 0; return c; } /* Determines if the symbol starting at START and ending in a colon that was at the location pointed to by INPUT_LINE_POINTER (but which has now been replaced bu a NUL) is in fact an LDI:8, LDI:20, LDI:32, CALL:D. JMP:D, RET:D or Bcc:D instruction. If it is, then it restores the colon, advances INPUT_LINE_POINTER to the real end of the instruction/symbol, and returns the character that really terminated the symbol. Otherwise it returns 0. */ char fr30_is_colon_insn (start) char * start; { char * i_l_p = input_line_pointer; /* Check to see if the symbol parsed so far is 'ldi' */ if ( (start[0] != 'l' && start[0] != 'L') || (start[1] != 'd' && start[1] != 'D') || (start[2] != 'i' && start[2] != 'I') || start[3] != 0) { /* Nope - check to see a 'd' follows the colon. */ if ( (i_l_p[1] == 'd' || i_l_p[1] == 'D') && (i_l_p[2] == ' ' || i_l_p[2] == '\t' || i_l_p[2] == '\n')) { /* Yup - it might be delay slot instruction. */ int i; static char * delay_insns [] = { "call", "jmp", "ret", "bra", "bno", "beq", "bne", "bc", "bnc", "bn", "bp", "bv", "bnv", "blt", "bge", "ble", "bgt", "bls", "bhi" }; for (i = sizeof (delay_insns) / sizeof (delay_insns[0]); i--;) { char * insn = delay_insns[i]; int len = strlen (insn); if (start [len] != 0) continue; while (len --) if (TOLOWER (start [len]) != insn [len]) break; if (len == -1) return restore_colon (1); } } /* Nope - it is a normal label. */ return 0; } /* Check to see if the text following the colon is '8' */ if (i_l_p[1] == '8' && (i_l_p[2] == ' ' || i_l_p[2] == '\t')) return restore_colon (2); /* Check to see if the text following the colon is '20' */ else if (i_l_p[1] == '2' && i_l_p[2] =='0' && (i_l_p[3] == ' ' || i_l_p[3] == '\t')) return restore_colon (3); /* Check to see if the text following the colon is '32' */ else if (i_l_p[1] == '3' && i_l_p[2] =='2' && (i_l_p[3] == ' ' || i_l_p[3] == '\t')) return restore_colon (3); return 0; } bfd_boolean fr30_fix_adjustable (fixP) fixS * fixP; { /* We need the symbol name for the VTABLE entries */ if (fixP->fx_r_type == BFD_RELOC_VTABLE_INHERIT || fixP->fx_r_type == BFD_RELOC_VTABLE_ENTRY) return 0; return 1; }
{ "content_hash": "b1531922b58264ee563bad7170fb9cec", "timestamp": "", "source": "github", "line_count": 480, "max_line_length": 86, "avg_line_length": 26.33125, "alnum_prop": 0.6105704565234591, "repo_name": "shaotuanchen/sunflower_exp", "id": "34c9f42e4bb9c25f17943d7b4d3a151d843427c0", "size": "13516", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "tools/source/binutils-2.16.1/gas/config/tc-fr30.c", "mode": "33188", "license": "bsd-3-clause", "language": [ { "name": "Assembly", "bytes": "459993" }, { "name": "Awk", "bytes": "6562" }, { "name": "Batchfile", "bytes": "9028" }, { "name": "C", "bytes": "50326113" }, { "name": "C++", "bytes": "2040239" }, { "name": "CSS", "bytes": "2355" }, { "name": "Clarion", "bytes": "2484" }, { "name": "Coq", "bytes": "61440" }, { "name": "DIGITAL Command Language", "bytes": "69150" }, { "name": "Emacs Lisp", "bytes": "186910" }, { "name": "Fortran", "bytes": "5364" }, { "name": "HTML", "bytes": "2171356" }, { "name": "JavaScript", "bytes": "27164" }, { "name": "Logos", "bytes": "159114" }, { "name": "M", "bytes": "109006" }, { "name": "M4", "bytes": "100614" }, { "name": "Makefile", "bytes": "5409865" }, { "name": "Mercury", "bytes": "702" }, { "name": "Module Management System", "bytes": "56956" }, { "name": "OCaml", "bytes": "253115" }, { "name": "Objective-C", "bytes": "57800" }, { "name": "Papyrus", "bytes": "3298" }, { "name": "Perl", "bytes": "70992" }, { "name": "Perl 6", "bytes": "693" }, { "name": "PostScript", "bytes": "3440120" }, { "name": "Python", "bytes": "40729" }, { "name": "Redcode", "bytes": "1140" }, { "name": "Roff", "bytes": "3794721" }, { "name": "SAS", "bytes": "56770" }, { "name": "SRecode Template", "bytes": "540157" }, { "name": "Shell", "bytes": "1560436" }, { "name": "Smalltalk", "bytes": "10124" }, { "name": "Standard ML", "bytes": "1212" }, { "name": "TeX", "bytes": "385584" }, { "name": "WebAssembly", "bytes": "52904" }, { "name": "Yacc", "bytes": "510934" } ], "symlink_target": "" }
<?php // ####################### SET PHP ENVIRONMENT ########################### error_reporting(E_ALL & ~E_NOTICE); // #################### DEFINE IMPORTANT CONSTANTS ####################### define('GET_EDIT_TEMPLATES', 'newpm,insertpm,showpm'); define('THIS_SCRIPT', 'private'); define('CSRF_PROTECTION', true); // ################### PRE-CACHE TEMPLATES AND DATA ###################### // get special phrase groups $phrasegroups = array( 'messaging', 'posting', 'postbit', 'pm', 'reputationlevel', 'user' ); // get special data templates from the datastore $specialtemplates = array( 'smiliecache', 'bbcodecache', 'banemail', 'noavatarperms', ); // pre-cache templates used by all actions $globaltemplates = array( 'USERCP_SHELL', 'usercp_nav_folderbit' ); // pre-cache templates used by specific actions $actiontemplates = array( 'editfolders' => array( 'pm_editfolders', 'pm_editfolderbit', ), 'emptyfolder' => array( 'pm_emptyfolder', ), 'showpm' => array( 'pm_showpm', 'pm_messagelistbit_user', 'postbit', 'postbit_wrapper', 'postbit_onlinestatus', 'postbit_reputation', 'bbcode_code', 'bbcode_html', 'bbcode_php', 'bbcode_quote', 'bbcode_video', 'im_aim', 'im_icq', 'im_msn', 'im_yahoo', 'im_skype', 'pm_quickreply' ), 'newpm' => array( 'pm_newpm', ), 'managepm' => array( 'pm_movepm', ), 'trackpm' => array( 'pm_trackpm', 'pm_receipts', 'pm_receiptsbit', ), 'messagelist' => array( 'pm_messagelist', 'pm_messagelist_periodgroup', 'pm_messagelistbit', 'pm_messagelistbit_user', 'pm_messagelistbit_ignore', 'pm_filter', 'forumdisplay_sortarrow' ), 'report' => array( 'newpost_usernamecode', 'reportitem' ), 'showhistory' => array( 'postbit', 'postbit_wrapper', 'postbit_onlinestatus', 'postbit_reputation', 'bbcode_code', 'bbcode_html', 'bbcode_php', 'bbcode_quote', 'bbcode_video', 'im_aim', 'im_icq', 'im_msn', 'im_yahoo', 'im_skype', 'pm_quickreply', 'pm_nomessagehistory' ) ); $actiontemplates['insertpm'] =& $actiontemplates['newpm']; // ################## SETUP PROPER NO DO TEMPLATES ####################### if (empty($_REQUEST['do'])) { $temppmid = ($temppmid = intval($_REQUEST['pmid'])) < 0 ? 0 : $temppmid; if ($temppmid > 0) { $actiontemplates['none'] =& $actiontemplates['showpm']; } else { $actiontemplates['none'] =& $actiontemplates['messagelist']; } } // ######################### REQUIRE BACK-END ############################ require_once('./global.php'); require_once(DIR . '/includes/functions_user.php'); require_once(DIR . '/includes/functions_misc.php'); // ####################################################################### // ######################## START MAIN SCRIPT ############################ // ####################################################################### // ###################### Start pm code parse ####################### function parse_pm_bbcode($bbcode, $smilies = true) { global $vbulletin; require_once(DIR . '/includes/class_bbcode.php'); $bbcode_parser = new vB_BbCodeParser($vbulletin, fetch_tag_list()); return $bbcode_parser->parse($bbcode, 'privatemessage', $smilies); } // ###################### Start pm update counters ####################### // update the pm counters for $vbulletin->userinfo function build_pm_counters() { global $vbulletin; $pmcount = $vbulletin->db->query_first(" SELECT COUNT(pmid) AS pmtotal, SUM(IF(messageread = 0 AND folderid >= 0, 1, 0)) AS pmunread FROM " . TABLE_PREFIX . "pm AS pm WHERE pm.userid = " . $vbulletin->userinfo['userid'] . " "); $pmcount['pmtotal'] = intval($pmcount['pmtotal']); $pmcount['pmunread'] = intval($pmcount['pmunread']); if ($vbulletin->userinfo['pmtotal'] != $pmcount['pmtotal'] OR $vbulletin->userinfo['pmunread'] != $pmcount['pmunread']) { // init user data manager $userdata =& datamanager_init('User', $vbulletin, ERRTYPE_STANDARD); $userdata->set_existing($vbulletin->userinfo); $userdata->set('pmtotal', $pmcount['pmtotal']); $userdata->set('pmunread', $pmcount['pmunread']); $userdata->save(); } } // ############################### initialisation ############################### if (!$vbulletin->options['enablepms']) { eval(standard_error(fetch_error('pm_adminoff'))); } // the following is the check for actions which allow creation of new pms if ($permissions['pmquota'] < 1 OR !$vbulletin->userinfo['receivepm']) { $show['createpms'] = false; } // check permission to use private messaging if (($permissions['pmquota'] < 1 AND (!$vbulletin->userinfo['pmtotal'] OR in_array($_REQUEST['do'], array('insertpm', 'newpm')))) OR !$vbulletin->userinfo['userid']) { print_no_permission(); } if (!$vbulletin->userinfo['receivepm'] AND in_array($_REQUEST['do'], array('insertpm', 'newpm'))) { eval(standard_error(fetch_error('pm_turnedoff'))); } // start navbar $navbits = array( 'usercp.php' . $vbulletin->session->vars['sessionurl_q'] => $vbphrase['user_control_panel'], 'private.php' . $vbulletin->session->vars['sessionurl_q'] => $vbphrase['private_messages'] ); // select correct part of forumjump $navpopup = array( 'id' => 'pm_navpopup', 'title' => $vbphrase['private_messages'], 'link' => 'private.php' . $vbulletin->session->vars['sessionurl_q'], ); construct_quick_nav($navpopup); $onload = ''; $show['trackpm'] = $cantrackpm = $permissions['pmpermissions'] & $vbulletin->bf_ugp_pmpermissions['cantrackpm']; $includecss = array(); $vbulletin->input->clean_gpc('r', 'pmid', TYPE_UINT); // ############################### default do value ############################### if (empty($_REQUEST['do'])) { if (!$vbulletin->GPC['pmid']) { $_REQUEST['do'] = 'messagelist'; } else { $_REQUEST['do'] = 'showpm'; } } ($hook = vBulletinHook::fetch_hook('private_start')) ? eval($hook) : false; // ############################### start update folders ############################### // update the user's custom pm folders if ($_POST['do'] == 'updatefolders') { $vbulletin->input->clean_gpc('p', 'folder', TYPE_ARRAY_NOHTML); if (!empty($vbulletin->GPC['folder'])) { $oldpmfolders = unserialize($vbulletin->userinfo['pmfolders']); $pmfolders = array(); $updatefolders = array(); foreach ($vbulletin->GPC['folder'] AS $folderid => $foldername) { $folderid = intval($folderid); if ($foldername != '') { $pmfolders["$folderid"] = $foldername; } else if (isset($oldpmfolders["$folderid"])) { $updatefolders[] = $folderid; } } if (!empty($updatefolders)) { $db->query_write("UPDATE " . TABLE_PREFIX . "pm SET folderid=0 WHERE userid=" . $vbulletin->userinfo['userid'] . " AND folderid IN(" . implode(', ', $updatefolders) . ")"); } require_once(DIR . '/includes/functions_databuild.php'); if (!empty($pmfolders)) { natcasesort($pmfolders); } build_usertextfields('pmfolders', iif(empty($pmfolders), '', serialize($pmfolders)), $vbulletin->userinfo['userid']); } ($hook = vBulletinHook::fetch_hook('private_updatefolders')) ? eval($hook) : false; $itemtype = $vbphrase['private_message']; $itemtypes = $vbphrase['private_messages']; eval(print_standard_redirect('foldersedited')); } // ############################### start empty folders ############################### if ($_REQUEST['do'] == 'emptyfolder') { $vbulletin->input->clean_gpc('r', 'folderid', TYPE_INT); $folderid = $vbulletin->GPC['folderid']; // generate navbar $navbits[''] = $vbphrase['confirm_deletion']; $pmfolders = array('0' => $vbphrase['inbox'], '-1' => $vbphrase['sent_items']); if (!empty($vbulletin->userinfo['pmfolders'])) { $pmfolders = $pmfolders + unserialize($vbulletin->userinfo['pmfolders']); } if (!isset($pmfolders["{$vbulletin->GPC['folderid']}"])) { eval(standard_error(fetch_error('invalidid', $vbphrase['folder'], $vbulletin->options['contactuslink']))); } $folder = $pmfolders["{$vbulletin->GPC['folderid']}"]; $dateline = TIMENOW; ($hook = vBulletinHook::fetch_hook('private_emptyfolder')) ? eval($hook) : false; $page_templater = vB_Template::create('pm_emptyfolder'); $page_templater->register('dateline', $dateline); $page_templater->register('folder', $folder); $page_templater->register('folderid', $folderid); } // ############################### start confirm empty folders ############################### if ($_POST['do'] == 'confirmemptyfolder') { // confirmation page $vbulletin->input->clean_array_gpc('p', array( 'folderid' => TYPE_INT, 'dateline' => TYPE_UNIXTIME, )); $deletepms = array(); // get pms $pms = $db->query_read_slave(" SELECT pmid FROM " . TABLE_PREFIX . "pm AS pm LEFT JOIN " . TABLE_PREFIX . "pmtext AS pmtext USING (pmtextid) WHERE folderid = " . $vbulletin->GPC['folderid'] . " AND userid = " . $vbulletin->userinfo['userid'] . " AND dateline < " . $vbulletin->GPC['dateline'] ); while ($pm = $db->fetch_array($pms)) { $deletepms[] = $pm['pmid']; } if (!empty($deletepms)) { // remove pms and receipts! $db->query_write("DELETE FROM " . TABLE_PREFIX . "pm WHERE pmid IN (" . implode(',', $deletepms) . ")"); $db->query_write("DELETE FROM " . TABLE_PREFIX . "pmreceipt WHERE pmid IN (" . implode(',', $deletepms) . ")"); build_pm_counters(); } ($hook = vBulletinHook::fetch_hook('private_confirmemptyfolder')) ? eval($hook) : false; $vbulletin->url = 'private.php?' . $vbulletin->session->vars['sessionurl']; eval(print_standard_redirect('pm_messagesdeleted')); } // ############################### start edit folders ############################### // edit the user's custom pm folders if ($_REQUEST['do'] == 'editfolders') { if (!isset($pmfolders)) { $pmfolders = unserialize($vbulletin->userinfo['pmfolders']); } $folderjump = construct_folder_jump(); ($hook = vBulletinHook::fetch_hook('private_editfolders_start')) ? eval($hook) : false; $usedids = array(); $editfolderbits = ''; $show['messagecount'] = true; if (!empty($pmfolders)) { $show['customfolders'] = true; foreach ($pmfolders AS $folderid => $foldername) { $usedids[] = $folderid; $foldertotal = intval($messagecounters["$folderid"]); ($hook = vBulletinHook::fetch_hook('private_editfolders_bit')) ? eval($hook) : false; $templater = vB_Template::create('pm_editfolderbit'); $templater->register('folderid', $folderid); $templater->register('foldername', $foldername); $templater->register('foldertotal', $foldertotal); $editfolderbits .= $templater->render(); } } else { $show['customfolders'] = false; } $show['messagecount'] = false; // build the inputs for new folders $addfolderbits = ''; $donefolders = 0; $folderid = 0; $foldername = ''; $foldertotal = 0; while ($donefolders < 3) { $folderid ++; if (in_array($folderid, $usedids)) { continue; } else { $donefolders++; ($hook = vBulletinHook::fetch_hook('private_editfolders_bit')) ? eval($hook) : false; $templater = vB_Template::create('pm_editfolderbit'); $templater->register('folderid', $folderid); $templater->register('foldername', $foldername); $templater->register('foldertotal', $foldertotal); $addfolderbits .= $templater->render(); } } $inboxtotal = intval($messagecounters[0]); $sentitemstotal = intval($messagecounters['-1']); // generate navbar $navbits[''] = $vbphrase['edit_folders']; $page_templater = vB_Template::create('pm_editfolders'); $page_templater->register('addfolderbits', $addfolderbits); $page_templater->register('editfolderbits', $editfolderbits); $page_templater->register('inboxtotal', $inboxtotal); $page_templater->register('sentitemstotal', $sentitemstotal); } // ############################### delete pm receipt ############################### // delete one or more pm receipts if ($_POST['do'] == 'deletepmreceipt') { $vbulletin->input->clean_gpc('p', 'receipt', TYPE_ARRAY_UINT); if (empty($vbulletin->GPC['receipt'])) { eval(standard_error(fetch_error('invalidid', $vbphrase['private_message_receipt'], $vbulletin->options['contactuslink']))); } ($hook = vBulletinHook::fetch_hook('private_deletepmreceipt')) ? eval($hook) : false; $db->query_write("DELETE FROM " . TABLE_PREFIX . "pmreceipt WHERE userid=" . $vbulletin->userinfo['userid'] . " AND pmid IN(". implode(', ', $vbulletin->GPC['receipt']) . ")"); if ($db->affected_rows() == 0) { eval(standard_error(fetch_error('invalidid', $vbphrase['private_message_receipt'], $vbulletin->options['contactuslink']))); } else { eval(print_standard_redirect('pm_receiptsdeleted')); } } // ############################### start deny receipt ############################### // set a receipt as denied if ($_REQUEST['do'] == 'dopmreceipt') { $vbulletin->input->clean_array_gpc('r', array( 'pmid' => TYPE_UINT, 'confirm' => TYPE_BOOL, 'type' => TYPE_NOHTML, )); if (!$vbulletin->GPC['confirm'] AND ($permissions['pmpermissions'] & $vbulletin->bf_ugp_pmpermissions['candenypmreceipts'])) { $receiptSql = "UPDATE " . TABLE_PREFIX . "pmreceipt SET readtime = 0, denied = 1 WHERE touserid = " . $vbulletin->userinfo['userid'] . " AND pmid = " . $vbulletin->GPC['pmid']; } else { $receiptSql = "UPDATE " . TABLE_PREFIX . "pmreceipt SET readtime = " . TIMENOW . ", denied = 0 WHERE touserid = " . $vbulletin->userinfo['userid'] . " AND pmid = " . $vbulletin->GPC['pmid']; } ($hook = vBulletinHook::fetch_hook('private_dopmreceipt')) ? eval($hook) : false; $db->query_write($receiptSql); if ($vbulletin->GPC['type'] == 'img') { header('Content-type: image/gif'); readfile(DIR . '/' . $vbulletin->options['cleargifurl']); } else { ?> <html xmlns="http://www.w3.org/1999/xhtml"><head><title><?php echo $vbulletin->options['bbtitle']; ?></title><style type="text/css"><?php echo $style['css']; ?></style></head><body> <script type="text/javascript"> self.close(); </script> </body></html> <?php } flush(); exit; } // ############################### start pm receipt tracking ############################### // message receipt tracking if ($_REQUEST['do'] == 'trackpm') { if (!$cantrackpm) { print_no_permission(); } $vbulletin->input->clean_array_gpc('r', array( 'pagenumber' => TYPE_UINT, 'type' => TYPE_NOHTML )); switch ($vbulletin->GPC['type']) { case 'confirmed': case 'unconfirmed': break; default: $vbulletin->GPC['type'] = ''; $vbulletin->GPC['pagenumber'] = 1; } $perpage = $vbulletin->options['pmperpage']; if (!$vbulletin->GPC['pagenumber']) { $vbulletin->GPC['pagenumber'] = 1; } $startat = ($vbulletin->GPC['pagenumber'] - 1) * $perpage; ($hook = vBulletinHook::fetch_hook('private_trackpm_start')) ? eval($hook) : false; $confirmedreceipts = ''; if (!$vbulletin->GPC['type'] OR $vbulletin->GPC['type'] == 'confirmed') { $pmreceipts = $db->query_read_slave(" SELECT SQL_CALC_FOUND_ROWS pmreceipt.*, pmreceipt.pmid AS receiptid FROM " . TABLE_PREFIX . "pmreceipt AS pmreceipt WHERE pmreceipt.userid = " . $vbulletin->userinfo['userid'] . " AND pmreceipt.readtime <> 0 ORDER BY pmreceipt.sendtime DESC LIMIT $startat, $perpage "); list($readtotal) = $db->query_first_slave("SELECT FOUND_ROWS()", DBARRAY_NUM); $counter = 1; if ($readtotal) { $show['readpm'] = true; $tabletitle = $vbphrase['confirmed_private_message_receipts']; $tableid = 'pmreceipts_read'; $collapseobj_tableid =& $vbcollapse["collapseobj_$tableid"]; $collapseimg_tableid =& $vbcollapse["collapseimg_$tableid"]; $receiptbits = ''; while ($receipt = $db->fetch_array($pmreceipts)) { $receipt['send_date'] = vbdate($vbulletin->options['dateformat'], $receipt['sendtime'], true); $receipt['send_time'] = vbdate($vbulletin->options['timeformat'], $receipt['sendtime']); $receipt['read_date'] = vbdate($vbulletin->options['dateformat'], $receipt['readtime'], true); $receipt['read_time'] = vbdate($vbulletin->options['timeformat'], $receipt['readtime']); $receiptinfo = array( 'userid' => $receipt['touserid'], 'username' => $receipt['tousername'], ); ($hook = vBulletinHook::fetch_hook('private_trackpm_receiptbit')) ? eval($hook) : false; $templater = vB_Template::create('pm_receiptsbit'); $templater->register('receipt', $receipt); $receiptbits .= $templater->render(); } $confirmed_pagenav = construct_page_nav($vbulletin->GPC['pagenumber'], $perpage, $readtotal, "private.php?" . $vbulletin->session->vars['sessionurl'] . "do=trackpm&amp;type=confirmed" ); $templater = vB_Template::create('pm_receipts'); $templater->register('collapseimg_tableid', $collapseimg_tableid); $templater->register('collapseobj_tableid', $collapseobj_tableid); $templater->register('startreceipt', vb_number_format($startat + 1)); $templater->register('endreceipt', vb_number_format(($vbulletin->GPC['pagenumber'] * $perpage) > $readtotal ? $readtotal : ($vbulletin->GPC['pagenumber'] * $perpage))); $templater->register('numreceipts', vb_number_format($readtotal)); $templater->register('receiptbits', $receiptbits); $templater->register('tableid', $tableid); $templater->register('tabletitle', $tabletitle); $templater->register('counter', $counter++); $confirmedreceipts = $templater->render(); } } $unconfirmedreceipts = ''; if (!$vbulletin->GPC['type'] OR $vbulletin->GPC['type'] == 'unconfirmed') { $pmreceipts = $db->query_read_slave(" SELECT SQL_CALC_FOUND_ROWS pmreceipt.*, pmreceipt.pmid AS receiptid FROM " . TABLE_PREFIX . "pmreceipt AS pmreceipt WHERE pmreceipt.userid = " . $vbulletin->userinfo['userid'] . " AND pmreceipt.readtime = 0 ORDER BY pmreceipt.sendtime DESC LIMIT $startat, $perpage "); list($unreadtotal) = $db->query_first_slave("SELECT FOUND_ROWS()", DBARRAY_NUM); if ($unreadtotal) { $show['readpm'] = false; $tabletitle = $vbphrase['unconfirmed_private_message_receipts']; $tableid = 'pmreceipts_unread'; $collapseobj_tableid =& $vbcollapse["collapseobj_$tableid"]; $collapseimg_tableid =& $vbcollapse["collapseimg_$tableid"]; $receiptbits = ''; while ($receipt = $db->fetch_array($pmreceipts)) { $receipt['send_date'] = vbdate($vbulletin->options['dateformat'], $receipt['sendtime'], true); $receipt['send_time'] = vbdate($vbulletin->options['timeformat'], $receipt['sendtime']); $receipt['read_date'] = vbdate($vbulletin->options['dateformat'], $receipt['readtime'], true); $receipt['read_time'] = vbdate($vbulletin->options['timeformat'], $receipt['readtime']); $receiptinfo = array( 'userid' => $receipt['touserid'], 'username' => $receipt['tousername'], ); ($hook = vBulletinHook::fetch_hook('private_trackpm_receiptbit')) ? eval($hook) : false; $templater = vB_Template::create('pm_receiptsbit'); $templater->register('receipt', $receipt); $receiptbits .= $templater->render(); } $unconfirmed_pagenav = construct_page_nav($vbulletin->GPC['pagenumber'], $perpage, $unreadtotal, "private.php?" . $vbulletin->session->vars['sessionurl'] . "do=trackpm&amp;type=unconfirmed" ); $templater = vB_Template::create('pm_receipts'); $templater->register('collapseimg_tableid', $collapseimg_tableid); $templater->register('collapseobj_tableid', $collapseobj_tableid); $templater->register('startreceipt', vb_number_format($startat + 1)); $templater->register('endreceipt', vb_number_format(($vbulletin->GPC['pagenumber'] * $perpage) > $unreadtotal ? $unreadtotal : ($vbulletin->GPC['pagenumber'] * $perpage))); $templater->register('numreceipts', vb_number_format($unreadtotal)); $templater->register('receiptbits', $receiptbits); $templater->register('tableid', $tableid); $templater->register('tabletitle', $tabletitle); $templater->register('counter', $counter); $unconfirmedreceipts = $templater->render(); } } $folderjump = construct_folder_jump(); // generate navbar $navbits[''] = $vbphrase['message_tracking']; $show['receipts'] = ($confirmedreceipts != '' OR $unconfirmedreceipts != ''); $page_templater = vB_Template::create('pm_trackpm'); $page_templater->register('confirmedreceipts', $confirmedreceipts); $page_templater->register('confirmed_pagenav', $confirmed_pagenav); $page_templater->register('unconfirmedreceipts', $unconfirmedreceipts); $page_templater->register('unconfirmed_pagenav', $unconfirmed_pagenav); } // ############################### start move pms ############################### if ($_POST['do'] == 'movepm') { $vbulletin->input->clean_array_gpc('p', array( 'folderid' => TYPE_INT, 'messageids' => TYPE_STR, )); $vbulletin->GPC['messageids'] = @unserialize(verify_client_string($vbulletin->GPC['messageids'])); if (!is_array($vbulletin->GPC['messageids']) OR empty($vbulletin->GPC['messageids'])) { eval(standard_error(fetch_error('invalidid', $vbphrase['private_message'], $vbulletin->options['contactuslink']))); } $pmids = array(); foreach ($vbulletin->GPC['messageids'] AS $pmid) { $id = intval($pmid); $pmids["$id"] = $id; } ($hook = vBulletinHook::fetch_hook('private_movepm')) ? eval($hook) : false; $db->query_write("UPDATE " . TABLE_PREFIX . "pm SET folderid=" . $vbulletin->GPC['folderid'] . " WHERE userid=" . $vbulletin->userinfo['userid'] . " AND folderid<>-1 AND pmid IN(" . implode(', ', $pmids) . ")"); $vbulletin->url = 'private.php?' . $vbulletin->session->vars['sessionurl'] . 'folderid=' . $vbulletin->GPC['folderid']; // deselect messages setcookie('vbulletin_inlinepm', '', TIMENOW - 3600, '/'); eval(print_standard_redirect('pm_messagesmoved')); } // ############################### start pm manager ############################### // actions for moving pms between folders, and deleting pms if ($_POST['do'] == 'managepm') { $vbulletin->input->clean_array_gpc('p', array( 'folderid' => TYPE_INT, 'dowhat' => TYPE_NOHTML, 'pm' => TYPE_ARRAY_UINT, )); // get cookie $vbulletin->input->clean_array_gpc('c', array( 'vbulletin_inlinepm' => TYPE_STR, )); // get selected via post $messageids = array(); foreach (array_keys($vbulletin->GPC['pm']) AS $pmid) { $pmid = intval($pmid); $messageids["$pmid"] = $pmid; } unset($pmid); // get selected via cookie if (!empty($vbulletin->GPC['vbulletin_inlinepm'])) { $cookielist = explode('-', $vbulletin->GPC['vbulletin_inlinepm']); $cookielist = $vbulletin->input->clean($cookielist, TYPE_ARRAY_UINT); $messageids = array_unique(array_merge($messageids, $cookielist)); } // check that we have an array to work with if (empty($messageids)) { eval(standard_error(fetch_error('no_private_messages_selected'))); } ($hook = vBulletinHook::fetch_hook('private_managepm_start')) ? eval($hook) : false; // now switch the $dowhat... switch($vbulletin->GPC['dowhat']) { // ***************************** // deselect all messages case 'clear': setcookie('vbulletin_inlinepm', '', TIMENOW - 3600, '/'); eval(print_standard_redirect('pm_allmessagesdeselected')); break; // ***************************** // move messages to a new folder case 'move': $totalmessages = sizeof($messageids); $messageids = sign_client_string(serialize($messageids)); $folderoptions = construct_folder_jump(0, 0, array($vbulletin->GPC['folderid'], -1)); switch ($vbulletin->GPC['folderid']) { case -1: $fromfolder = $vbphrase['sent_items']; break; case 0: $fromfolder = $vbphrase['inbox']; break; default: { $folders = unserialize($vbulletin->userinfo['pmfolders']); $fromfolder = $folders["{$vbulletin->GPC['folderid']}"]; } } ($hook = vBulletinHook::fetch_hook('private_managepm_move')) ? eval($hook) : false; if ($folderoptions) { $page_templater = vB_Template::create('pm_movepm'); $page_templater->register('folderoptions', $folderoptions); $page_templater->register('fromfolder', $fromfolder); $page_templater->register('messageids', $messageids); $page_templater->register('totalmessages', $totalmessages); } else { eval(standard_error(fetch_error('pm_nofolders', $vbulletin->options['bburl'], $vbulletin->session->vars['sessionurl']))); } break; // ***************************** // mark messages as unread case 'unread': $db->query_write("UPDATE " . TABLE_PREFIX . "pm SET messageread=0 WHERE userid=" . $vbulletin->userinfo['userid'] . " AND pmid IN (" . implode(', ', $messageids) . ")"); build_pm_counters(); $readunread = $vbphrase['unread_date']; ($hook = vBulletinHook::fetch_hook('private_managepm_unread')) ? eval($hook) : false; // deselect messages setcookie('vbulletin_inlinepm', '', TIMENOW - 3600, '/'); eval(print_standard_redirect('pm_messagesmarkedas')); break; // ***************************** // mark messages as read case 'read': $db->query_write("UPDATE " . TABLE_PREFIX . "pm SET messageread=1 WHERE messageread=0 AND userid=" . $vbulletin->userinfo['userid'] . " AND pmid IN (" . implode(', ', $messageids) . ")"); build_pm_counters(); $readunread = $vbphrase['read']; ($hook = vBulletinHook::fetch_hook('private_managepm_read')) ? eval($hook) : false; // deselect messages setcookie('vbulletin_inlinepm', '', TIMENOW - 3600, '/'); eval(print_standard_redirect('pm_messagesmarkedas')); break; // ***************************** // download as XML case 'xml': $_REQUEST['do'] = 'downloadpm'; break; // ***************************** // download as CSV case 'csv': $_REQUEST['do'] = 'downloadpm'; break; // ***************************** // download as TEXT case 'txt': $_REQUEST['do'] = 'downloadpm'; break; // ***************************** // delete messages completely case 'delete': $pmids = array(); $textids = array(); // get the pmid and pmtext id of messages to be deleted $pms = $db->query_read_slave(" SELECT pmid FROM " . TABLE_PREFIX . "pm WHERE userid = " . $vbulletin->userinfo['userid'] . " AND pmid IN(" . implode(', ', $messageids) . ") "); // check to see that we still have some ids to work with if ($db->num_rows($pms) == 0) { eval(standard_error(fetch_error('invalidid', $vbphrase['private_message'], $vbulletin->options['contactuslink']))); } // build the final array of pmids to work with while ($pm = $db->fetch_array($pms)) { $pmids[] = $pm['pmid']; } // delete from the pm table using the results from above $deletePmSql = "DELETE FROM " . TABLE_PREFIX . "pm WHERE pmid IN(" . implode(', ', $pmids) . ")"; $db->query_write($deletePmSql); // deselect messages setcookie('vbulletin_inlinepm', '', TIMENOW - 3600, '/'); build_pm_counters(); ($hook = vBulletinHook::fetch_hook('private_managepm_delete')) ? eval($hook) : false; // all done, redirect... $vbulletin->url = 'private.php?' . $vbulletin->session->vars['sessionurl'] . 'folderid=' . $vbulletin->GPC['folderid']; eval(print_standard_redirect('pm_messagesdeleted')); break; // ***************************** // unknown action specified default: $handled_do = false; ($hook = vBulletinHook::fetch_hook('private_managepm_action_switch')) ? eval($hook) : false; if (!$handled_do) { eval(standard_error(fetch_error('invalidid', $vbphrase['action'], $vbulletin->options['contactuslink']))); } break; } } // ############################### start download pm ############################### // downloads selected private messages to a file type of user's choice if ($_REQUEST['do'] == 'downloadpm') { if (($current_memory_limit = ini_size_to_bytes(@ini_get('memory_limit'))) < 128 * 1024 * 1024 AND $current_memory_limit > 0) { @ini_set('memory_limit', 128 * 1024 * 1024); } $vbulletin->input->clean_gpc('r', 'dowhat', TYPE_NOHTML); require_once(DIR . '/includes/functions_file.php'); function fetch_touser_string($pm) { global $vbulletin; $cclist = array(); $bcclist = array(); $ccrecipients = ''; $touser = unserialize($pm['touser']); foreach($touser AS $key => $item) { if (is_array($item)) { foreach($item AS $subkey => $subitem) { $username = $subitem; $userid = $subkey; if ($key == 'bcc') { $bcclist[] = $username; } else { $cclist[] = $username; } } } else { $username = $item; $userid = $key; $cclist[] = $username; } } if (!empty($cclist)) { $ccrecipients = implode("\r\n", $cclist); } if ($pm['folder'] == -1) { if (!empty($bcclist)) { $ccrecipients = implode("\r\n", array_unique(array_merge($cclist, $bcclist))); } } else { $ccrecipients = implode("\r\n", array_unique(array_merge($cclist, array("{$vbulletin->userinfo['username']}")))); } return $ccrecipients; } // set sql condition for selected messages if (is_array($messageids)) { $sql = 'AND pm.pmid IN(' . implode(', ', $messageids) . ')'; } // set blank sql condition (get all user's messages) else { $sql = ''; } // query the specified messages $pms = $db->query_read_slave(" SELECT dateline AS datestamp, folderid AS folder, title, fromusername AS fromuser, fromuserid, touserarray AS touser, message FROM " . TABLE_PREFIX . "pm AS pm LEFT JOIN " . TABLE_PREFIX . "pmtext AS pmtext ON(pmtext.pmtextid = pm.pmtextid) WHERE pm.userid = " . $vbulletin->userinfo['userid'] . " $sql ORDER BY folderid, dateline "); // check to see that we have some messages to work with if (!$db->num_rows($pms)) { eval(standard_error(fetch_error('no_pm_to_download'))); } // get folder names the easy way... construct_folder_jump(); ($hook = vBulletinHook::fetch_hook('private_downloadpm_start')) ? eval($hook) : false; // do the business... switch ($vbulletin->GPC['dowhat']) { // ***************************** // download as XML case 'xml': $pmfolders = array(); while ($pm = $db->fetch_array($pms)) { $pmfolders["$pm[folder]"][] = $pm; } unset($pm); $db->free_result($pms); require_once(DIR . '/includes/class_xml.php'); $xml = new vB_XML_Builder($vbulletin); $xml->add_group('privatemessages'); foreach ($pmfolders AS $folder => $messages) { $foldername =& $foldernames["$folder"]; $xml->add_group('folder', array('name' => $foldername)); foreach ($messages AS $pm) { $pm['datestamp'] = vbdate('Y-m-d H:i', $pm['datestamp'], false, false); $pm['touser'] = fetch_touser_string($pm); $pm['folder'] = $foldernames["$pm[folder]"]; $pm['message'] = preg_replace("/(\r\n|\r|\n)/s", "\r\n", $pm['message']); $pm['message'] = fetch_censored_text($pm['message']); unset($pm['folder']); ($hook = vBulletinHook::fetch_hook('private_downloadpm_bit')) ? eval($hook) : false; $xml->add_group('privatemessage'); foreach ($pm AS $key => $val) { $xml->add_tag($key, $val); } $xml->close_group(); } $xml->close_group(); } $xml->close_group(); $doc = "<?xml version=\"1.0\" encoding=\"" . vB_Template_Runtime::fetchStyleVar('charset') . "\"?>\r\n\r\n"; $doc .= "<!-- " . $vbulletin->options['bbtitle'] . ';' . $vbulletin->options['bburl'] . " -->\r\n"; // replace --/---/... with underscores for valid XML comments $doc .= '<!-- ' . construct_phrase($vbphrase['private_message_dump_for_user_x_y'], preg_replace('#(-(?=-)|(?<=-)-)#', '_', $vbulletin->userinfo['username']), vbdate($vbulletin->options['dateformat'] . ' ' . $vbulletin->options['timeformat'], TIMENOW)) . " -->\r\n\r\n"; $doc .= $xml->output(); $xml = null; // download the file file_download($doc, str_replace(array('\\', '/'), '-', "$vbphrase[dump_privatemessages]-" . $vbulletin->userinfo['username'] . "-" . vbdate($vbulletin->options['dateformat'], TIMENOW) . '.xml'), 'text/xml'); break; // ***************************** // download as CSV case 'csv': // column headers $csv = "$vbphrase[date],$vbphrase[folder],$vbphrase[title],$vbphrase[dump_from],$vbphrase[dump_to],$vbphrase[message]\r\n"; while ($pm = $db->fetch_array($pms)) { $csvpm = array(); $csvpm['datestamp'] = vbdate('Y-m-d H:i', $pm['datestamp'], false, false); $csvpm['folder'] = $foldernames["$pm[folder]"]; $csvpm['title'] = unhtmlspecialchars($pm['title']); $csvpm['fromuser'] = $pm['fromuser']; $csvpm['touser'] = fetch_touser_string($pm); $csvpm['message'] = preg_replace("/(\r\n|\r|\n)/s", "\r\n", $pm['message']); $csvpm['message'] = fetch_censored_text($pm['message']); ($hook = vBulletinHook::fetch_hook('private_downloadpm_bit')) ? eval($hook) : false; // make values safe foreach ($csvpm AS $key => $val) { $csvpm["$key"] = '"' . str_replace('"', '""', $val) . '"'; } // output the message row $csv .= implode(',', $csvpm) . "\r\n"; } unset($pm, $csvpm); $db->free_result($pms); // download the file file_download($csv, str_replace(array('\\', '/'), '-', "$vbphrase[dump_privatemessages]-" . $vbulletin->userinfo['username'] . "-" . vbdate($vbulletin->options['dateformat'], TIMENOW) . '.csv'), 'text/x-csv'); break; // ***************************** // download as TEXT case 'txt': $pmfolders = array(); while ($pm = $db->fetch_array($pms)) { $pmfolders["$pm[folder]"][] = $pm; } unset($pm); $db->free_result($pms); $txt = $vbulletin->options['bbtitle'] . ';' . $vbulletin->options['bburl'] . "\r\n"; $txt .= construct_phrase($vbphrase['private_message_dump_for_user_x_y'], $vbulletin->userinfo['username'], vbdate($vbulletin->options['dateformat'] . ' ' . $vbulletin->options['timeformat'], TIMENOW)) . " -->\r\n\r\n"; foreach ($pmfolders AS $folder => $messages) { $foldername =& $foldernames["$folder"]; $txt .= "################################################################################\r\n"; $txt .= "$vbphrase[folder] :\t$foldername\r\n"; $txt .= "################################################################################\r\n\r\n"; foreach ($messages AS $pm) { // turn all single \n into \r\n $pm['message'] = preg_replace("/(\r\n|\r|\n)/s", "\r\n", $pm['message']); $pm['message'] = fetch_censored_text($pm['message']); ($hook = vBulletinHook::fetch_hook('private_downloadpm_bit')) ? eval($hook) : false; $txt .= "================================================================================\r\n"; $txt .= "$vbphrase[dump_from] :\t$pm[fromuser]\r\n"; $txt .= "$vbphrase[dump_to] :\t" . fetch_touser_string($pm) . "\r\n"; $txt .= "$vbphrase[date] :\t" . vbdate('Y-m-d H:i', $pm['datestamp'], false, false) . "\r\n"; $txt .= "$vbphrase[title] :\t" . unhtmlspecialchars($pm['title']) . "\r\n"; $txt .= "--------------------------------------------------------------------------------\r\n"; $txt .= "$pm[message]\r\n\r\n"; } } // download the file file_download($txt, str_replace(array('\\', '/'), '-', "$vbphrase[dump_privatemessages]-" . $vbulletin->userinfo['username'] . "-" . vbdate($vbulletin->options['dateformat'], TIMENOW) . '.txt'), 'text/plain'); break; // ***************************** // unknown download format default: eval(standard_error(fetch_error('invalidid', $vbphrase['file_type'], $vbulletin->options['contactuslink']))); break; } } // ############################### start insert pm ############################### // either insert a pm into the database, or process the preview and fall back to newpm if ($_POST['do'] == 'insertpm') { $vbulletin->input->clean_array_gpc('p', array( 'wysiwyg' => TYPE_BOOL, 'title' => TYPE_NOHTML, 'message' => TYPE_STR, 'parseurl' => TYPE_BOOL, 'savecopy' => TYPE_BOOL, 'signature' => TYPE_BOOL, 'disablesmilies' => TYPE_BOOL, 'receipt' => TYPE_BOOL, 'preview' => TYPE_STR, 'recipients' => TYPE_STR, 'bccrecipients' => TYPE_STR, 'iconid' => TYPE_UINT, 'forward' => TYPE_BOOL, 'folderid' => TYPE_INT, 'sendanyway' => TYPE_BOOL, )); if ($permissions['pmquota'] < 1) { print_no_permission(); } else if (!$vbulletin->userinfo['receivepm']) { eval(standard_error(fetch_error('pm_turnedoff'))); } if (fetch_privatemessage_throttle_reached($vbulletin->userinfo['userid'])) { eval(standard_error(fetch_error('pm_throttle_reached', $vbulletin->userinfo['permissions']['pmthrottlequantity'], $vbulletin->options['pmthrottleperiod']))); } // include useful functions require_once(DIR . '/includes/functions_newpost.php'); // unwysiwygify the incoming data if ($vbulletin->GPC['wysiwyg']) { require_once(DIR . '/includes/functions_wysiwyg.php'); $vbulletin->GPC['message'] = convert_wysiwyg_html_to_bbcode($vbulletin->GPC['message'], $vbulletin->options['privallowhtml']); } // parse URLs in message text if ($vbulletin->options['privallowbbcode'] AND $vbulletin->GPC['parseurl']) { $vbulletin->GPC['message'] = convert_url_to_bbcode($vbulletin->GPC['message']); } $pm['message'] =& $vbulletin->GPC['message']; $pm['title'] =& $vbulletin->GPC['title']; $pm['parseurl'] =& $vbulletin->GPC['parseurl']; $pm['savecopy'] =& $vbulletin->GPC['savecopy']; $pm['signature'] =& $vbulletin->GPC['signature']; $pm['disablesmilies'] =& $vbulletin->GPC['disablesmilies']; $pm['sendanyway'] =& $vbulletin->GPC['sendanyway']; $pm['receipt'] =& $vbulletin->GPC['receipt']; $pm['recipients'] =& $vbulletin->GPC['recipients']; $pm['bccrecipients'] =& $vbulletin->GPC['bccrecipients']; $pm['pmid'] =& $vbulletin->GPC['pmid']; $pm['iconid'] =& $vbulletin->GPC['iconid']; $pm['forward'] =& $vbulletin->GPC['forward']; $pm['folderid'] =& $vbulletin->GPC['folderid']; // ************************************************************* // PROCESS THE MESSAGE AND INSERT IT INTO THE DATABASE $errors = array(); // catches errors if ($vbulletin->userinfo['pmtotal'] > $permissions['pmquota'] OR ($vbulletin->userinfo['pmtotal'] == $permissions['pmquota'] AND $pm['savecopy'])) { $errors[] = fetch_error('yourpmquotaexceeded'); } // create the DM to do error checking and insert the new PM $pmdm =& datamanager_init('PM', $vbulletin, ERRTYPE_ARRAY); $pmdm->set_info('savecopy', $pm['savecopy']); $pmdm->set_info('receipt', $pm['receipt']); $pmdm->set_info('cantrackpm', $cantrackpm); $pmdm->set_info('forward', $pm['forward']); $pmdm->set_info('bccrecipients', $pm['bccrecipients']); if ($vbulletin->userinfo['permissions']['adminpermissions'] & $vbulletin->bf_ugp_adminpermissions['cancontrolpanel']) { $pmdm->overridequota = true; } $pmdm->set('fromuserid', $vbulletin->userinfo['userid']); $pmdm->set('fromusername', $vbulletin->userinfo['username']); $pmdm->setr('title', $pm['title']); $pmdm->set_recipients($pm['recipients'], $permissions, 'cc'); $pmdm->set_recipients($pm['bccrecipients'], $permissions, 'bcc'); $pmdm->setr('message', $pm['message']); $pmdm->setr('iconid', $pm['iconid']); $pmdm->set('dateline', TIMENOW); $pmdm->setr('showsignature', $pm['signature']); $pmdm->set('allowsmilie', $pm['disablesmilies'] ? 0 : 1); if (!$pm['forward']) { $pmdm->set_info('parentpmid', $pm['pmid']); } $pmdm->set_info('replypmid', $pm['pmid']); ($hook = vBulletinHook::fetch_hook('private_insertpm_process')) ? eval($hook) : false; $pmdm->pre_save(); // deal with user using receivepmbuddies sending to non-buddies if ($vbulletin->userinfo['receivepmbuddies'] AND is_array($pmdm->info['recipients'])) { $users_not_on_list = array(); // get a list of super mod groups $smod_groups = array(); foreach ($vbulletin->usergroupcache AS $ugid => $groupinfo) { if ($groupinfo['adminpermissions'] & $vbulletin->bf_ugp_adminpermissions['ismoderator']) { // super mod group $smod_groups[] = $ugid; } } // now filter out all moderators (and super mods) from the list of recipients // to check against the buddy list $check_recipients = $pmdm->info['recipients']; $mods = $db->query_read_slave(" SELECT user.userid FROM " . TABLE_PREFIX . "user AS user LEFT JOIN " . TABLE_PREFIX . "moderator AS moderator ON (moderator.userid = user.userid) WHERE user.userid IN (" . implode(',', array_keys($check_recipients)) . ") AND ((moderator.userid IS NOT NULL AND moderator.forumid <> -1) " . (!empty($smod_groups) ? "OR user.usergroupid IN (" . implode(',', $smod_groups) . ")" : '') . " ) "); while ($mod = $db->fetch_array($mods)) { unset($check_recipients["$mod[userid]"]); } if (!empty($check_recipients)) { // filter those on our buddy list out $users = $db->query_read_slave(" SELECT userlist.relationid FROM " . TABLE_PREFIX . "userlist AS userlist WHERE userid = " . $vbulletin->userinfo['userid'] . " AND userlist.relationid IN(" . implode(array_keys($check_recipients), ',') . ") AND type = 'buddy' "); while ($user = $db->fetch_array($users)) { unset($check_recipients["$user[relationid]"]); } } // what's left must be those who are neither mods or on our buddy list foreach ($check_recipients AS $userid => $user) { $users_not_on_list["$userid"] = $user['username']; } if (!empty($users_not_on_list) AND (!$vbulletin->GPC['sendanyway'] OR !empty($errors))) { $users = ''; foreach ($users_not_on_list AS $userid => $username) { $users .= "<li><a href=\"" . fetch_seo_url('member', array('userid' => $userid, 'username' => $username)) . "\" target=\"profile\">$username</a></li>"; } $pmdm->error('pm_non_contacts_cant_reply', $users, $vbulletin->input->fetch_relpath()); } } // check for message flooding if ($vbulletin->options['pmfloodtime'] > 0 AND !$vbulletin->GPC['preview']) { if (!($permissions['adminpermissions'] & $vbulletin->bf_ugp_adminpermissions['cancontrolpanel']) AND !can_moderate()) { $floodcheck = $db->query_first(" SELECT pmtextid, title, dateline FROM " . TABLE_PREFIX . "pmtext AS pmtext WHERE fromuserid = " . $vbulletin->userinfo['userid'] . " ORDER BY dateline DESC "); if (($timepassed = TIMENOW - $floodcheck['dateline']) < $vbulletin->options['pmfloodtime']) { $errors[] = fetch_error('pmfloodcheck', $vbulletin->options['pmfloodtime'], ($vbulletin->options['pmfloodtime'] - $timepassed)); } } } // process errors if there are any $errors = array_merge($errors, $pmdm->errors); if (!empty($errors)) { define('PMPREVIEW', 1); $preview = construct_errors($errors); // this will take the preview's place $_REQUEST['do'] = 'newpm'; } else if ($vbulletin->GPC['preview'] != '') { define('PMPREVIEW', 1); $foruminfo = array( 'forumid' => 'privatemessage', 'allowicons' => $vbulletin->options['privallowicons'] ); $preview = process_post_preview($pm); $_REQUEST['do'] = 'newpm'; } else { // everything's good! $pmdm->save(); // force pm counters to be rebuilt $vbulletin->userinfo['pmunread'] = -1; build_pm_counters(); ($hook = vBulletinHook::fetch_hook('private_insertpm_complete')) ? eval($hook) : false; $vbulletin->url = 'private.php' . $vbulletin->session->vars['sessionurl_q']; eval(print_standard_redirect('pm_messagesent')); } } // ############################### start new pm ############################### // form for creating a new private message if ($_REQUEST['do'] == 'newpm') { if ($permissions['pmquota'] < 1) { print_no_permission(); } else if (!$vbulletin->userinfo['receivepm']) { eval(standard_error(fetch_error('pm_turnedoff'))); } if (fetch_privatemessage_throttle_reached($vbulletin->userinfo['userid'])) { eval(standard_error(fetch_error('pm_throttle_reached', $vbulletin->userinfo['permissions']['pmthrottlequantity'], $vbulletin->options['pmthrottleperiod']))); } require_once(DIR . '/includes/functions_newpost.php'); ($hook = vBulletinHook::fetch_hook('private_newpm_start')) ? eval($hook) : false; // do initial checkboxes $checked = array(); $signaturechecked = iif($vbulletin->userinfo['signature'] != '', 'checked="checked"'); $checked['savecopy'] = $vbulletin->userinfo['pmdefaultsavecopy']; $show['receivepmbuddies'] = $vbulletin->userinfo['receivepmbuddies']; // setup for preview display if (defined('PMPREVIEW')) { $postpreview =& $preview; $pm['recipients'] =& htmlspecialchars_uni($pm['recipients']); if (!empty($pm['bccrecipients'])) { $pm['bccrecipients'] =& htmlspecialchars_uni($pm['bccrecipients']); } else { $show['bcclink'] = true; } $pm['message'] = htmlspecialchars_uni($pm['message']); construct_checkboxes($pm); } else { $vbulletin->input->clean_array_gpc('r', array( 'stripquote' => TYPE_BOOL, 'forward' => TYPE_BOOL, 'userid' => TYPE_NOCLEAN, )); // set up for PM reply / forward if ($vbulletin->GPC['pmid']) { if($pm = $vbulletin->db->query_first_slave(" SELECT pm.*, pmtext.* FROM " . TABLE_PREFIX . "pm AS pm LEFT JOIN " . TABLE_PREFIX . "pmtext AS pmtext ON(pmtext.pmtextid = pm.pmtextid) WHERE pm.userid=" . $vbulletin->userinfo['userid'] . " AND pm.pmid=" . $vbulletin->GPC['pmid'] . " ")) { $pm = fetch_privatemessage_reply($pm); } } else { //set up for standard new PM // insert username(s) of specified recipients if ($vbulletin->GPC['userid']) { $recipients = array(); if (is_array($vbulletin->GPC['userid'])) { foreach ($vbulletin->GPC['userid'] AS $recipient) { $recipients[] = intval($recipient); } } else { $recipients[] = intval($vbulletin->GPC['userid']); } $users = $db->query_read_slave(" SELECT usertextfield.*, user.*, userlist.type FROM " . TABLE_PREFIX . "user AS user LEFT JOIN " . TABLE_PREFIX . "usertextfield AS usertextfield ON(usertextfield.userid=user.userid) LEFT JOIN " . TABLE_PREFIX . "userlist AS userlist ON(user.userid = userlist.userid AND userlist.relationid = " . $vbulletin->userinfo['userid'] . " AND userlist.type = 'buddy') WHERE user.userid IN(" . implode(', ', $recipients) . ") "); $recipients = array(); while ($user = $db->fetch_array($users)) { $user = array_merge($user , convert_bits_to_array($user['options'] , $vbulletin->bf_misc_useroptions)); cache_permissions($user, false); if (!($vbulletin->userinfo['permissions']['adminpermissions'] & $vbulletin->bf_ugp_adminpermissions['cancontrolpanel']) AND (!$user['receivepm'] OR !$user['permissions']['pmquota'] OR ($user['receivepmbuddies'] AND !can_moderate() AND $user['type'] != 'buddy') )) { eval(standard_error(fetch_error('pmrecipturnedoff', $user['username']))); } $recipients[] = $user['username']; } if (empty($recipients)) { $pm['recipients'] = ''; } else { $pm['recipients'] = implode(' ; ', $recipients); } } ($hook = vBulletinHook::fetch_hook('private_newpm_blank')) ? eval($hook) : false; } construct_checkboxes(array( 'savecopy' => $vbulletin->userinfo['pmdefaultsavecopy'], 'parseurl' => true, 'signature' => iif($vbulletin->userinfo['signature'] !== '', true) )); $show['bcclink'] = true; } $folderjump = construct_folder_jump(0, $pm['folderid']); $posticons = construct_icons($pm['iconid'], $vbulletin->options['privallowicons']); require_once(DIR . '/includes/functions_editor.php'); $editorid = construct_edit_toolbar( $pm['message'], 0, 'privatemessage', $vbulletin->options['privallowsmilies'] ? 1 : 0, true, false, 'fe', '', array(), 'forum' ); // generate navbar if ($pm['pmid']) { $navbits['private.php?' . $vbulletin->session->vars['sessionurl'] . "folderid=$pm[folderid]"] = $foldernames["$pm[folderid]"]; $navbits['private.php?' . $vbulletin->session->vars['sessionurl'] . "do=showpm&amp;pmid=$pm[pmid]"] = $pm['title']; $navbits[''] = iif($pm['forward'], $vbphrase['forward_message'], $vbphrase['reply_to_private_message']); } else { $navbits[''] = $vbphrase['post_new_private_message']; } $show['sendmax'] = iif($permissions['pmsendmax'], true, false); $show['sendmultiple'] = ($permissions['pmsendmax'] != 1); $show['parseurl'] = $vbulletin->options['privallowbbcode']; // build forum rules $bbcodeon = iif($vbulletin->options['privallowbbcode'], $vbphrase['on'], $vbphrase['off']); $imgcodeon = iif($vbulletin->options['privallowbbimagecode'], $vbphrase['on'], $vbphrase['off']); $htmlcodeon = iif($vbulletin->options['privallowhtml'], $vbphrase['on'], $vbphrase['off']); $smilieson = iif($vbulletin->options['privallowsmilies'], $vbphrase['on'], $vbphrase['off']); // only show posting code allowances in forum rules template $show['codeonly'] = true; $templater = vB_Template::create('forumrules'); $templater->register('bbcodeon', $bbcodeon); $templater->register('can', $can); $templater->register('htmlcodeon', $htmlcodeon); $templater->register('imgcodeon', $imgcodeon); $templater->register('smilieson', $smilieson); $forumrules = $templater->render(); $page_templater = vB_Template::create('pm_newpm'); $page_templater->register('anywaychecked', $anywaychecked); $page_templater->register('checked', $checked); $page_templater->register('disablesmiliesoption', $disablesmiliesoption); $page_templater->register('editorid', $editorid); $page_templater->register('forumrules', $forumrules); $page_templater->register('messagearea', $messagearea); $page_templater->register('permissions', $permissions); $page_templater->register('pm', $pm); $page_templater->register('posticons', $posticons); $page_templater->register('postpreview', $postpreview); $page_templater->register('selectedicon', $selectedicon); } // ############################### start show pm ############################### // show a private message if ($_REQUEST['do'] == 'showpm') { require_once(DIR . '/includes/class_postbit.php'); require_once(DIR . '/includes/functions_bigthree.php'); $vbulletin->input->clean_array_gpc('r', array( 'pmid' => TYPE_UINT, 'showhistory' => TYPE_BOOL )); ($hook = vBulletinHook::fetch_hook('private_showpm_start')) ? eval($hook) : false; $pm = $db->query_first_slave(" SELECT pm.*, pmtext.*, " . iif($vbulletin->options['privallowicons'], "icon.title AS icontitle, icon.iconpath,") . " IF(ISNULL(pmreceipt.pmid), 0, 1) AS receipt, pmreceipt.readtime, pmreceipt.denied, sigpic.userid AS sigpic, sigpic.dateline AS sigpicdateline, sigpic.width AS sigpicwidth, sigpic.height AS sigpicheight FROM " . TABLE_PREFIX . "pm AS pm LEFT JOIN " . TABLE_PREFIX . "pmtext AS pmtext ON(pmtext.pmtextid = pm.pmtextid) " . iif($vbulletin->options['privallowicons'], "LEFT JOIN " . TABLE_PREFIX . "icon AS icon ON(icon.iconid = pmtext.iconid)") . " LEFT JOIN " . TABLE_PREFIX . "pmreceipt AS pmreceipt ON(pmreceipt.pmid = pm.pmid) LEFT JOIN " . TABLE_PREFIX . "sigpic AS sigpic ON(sigpic.userid = pmtext.fromuserid) WHERE pm.userid=" . $vbulletin->userinfo['userid'] . " AND pm.pmid=" . $vbulletin->GPC['pmid'] . " "); if (!$pm) { eval(standard_error(fetch_error('invalidid', $vbphrase['private_message'], $vbulletin->options['contactuslink']))); } $folderjump = construct_folder_jump(0, $pm['folderid']); // do read receipt $show['receiptprompt'] = $show['receiptpopup'] = false; if ($pm['receipt'] == 1 AND $pm['readtime'] == 0 AND $pm['denied'] == 0) { if ($permissions['pmpermissions'] & $vbulletin->bf_ugp_pmpermissions['candenypmreceipts']) { // set it to denied just now as some people might have ad blocking that stops the popup appearing $show['receiptprompt'] = $show['receiptpopup'] = true; $receipt_question_js = addslashes_js(construct_phrase($vbphrase['x_has_requested_a_read_receipt'], unhtmlspecialchars($pm['fromusername'])), '"'); $db->shutdown_query("UPDATE " . TABLE_PREFIX . "pmreceipt SET denied = 1 WHERE pmid = $pm[pmid]"); } else { // they can't deny pm receipts so do not show a popup or prompt $db->shutdown_query("UPDATE " . TABLE_PREFIX . "pmreceipt SET readtime = " . TIMENOW . " WHERE pmid = $pm[pmid]"); } } else if ($pm['receipt'] == 1 AND $pm['denied'] == 1) { $show['receiptprompt'] = true; } $postbit_factory = new vB_Postbit_Factory(); $postbit_factory->registry =& $vbulletin; $postbit_factory->cache = array(); $postbit_factory->bbcode_parser = new vB_BbCodeParser($vbulletin, fetch_tag_list()); $postbit_obj =& $postbit_factory->fetch_postbit('pm'); $pm_postbit = $pm; $postbit = $postbit_obj->construct_postbit($pm_postbit); // update message to show read if ($pm['messageread'] == 0) { $db->shutdown_query("UPDATE " . TABLE_PREFIX . "pm SET messageread=1 WHERE userid=" . $vbulletin->userinfo['userid'] . " AND pmid=$pm[pmid]"); if ($pm['folderid'] >= 0) { $userdm =& datamanager_init('User', $vbulletin, ERRTYPE_SILENT); $userdm->set_existing($vbulletin->userinfo); $userdm->set('pmunread', 'IF(pmunread >= 1, pmunread - 1, 0)', false); $userdm->save(true, true); unset($userdm); } } $cclist = array(); $bcclist = array(); $ccrecipients = ''; $bccrecipients = ''; $touser = unserialize($pm['touserarray']); if (!is_array($touser)) { $touser = array(); } foreach($touser AS $key => $item) { if (is_array($item)) { foreach($item AS $subkey => $subitem) { $userinfo = array( 'userid' => $subkey, 'username' => $subitem, ); $templater = vB_Template::create('pm_messagelistbit_user'); $templater->register('userinfo', $userinfo); ${$key . 'list'}[] = $templater->render(); } } else { $userinfo = array( 'username' => $item, 'userid' => $key, ); $templater = vB_Template::create('pm_messagelistbit_user'); $templater->register('userinfo', $userinfo); $bcclist[] = $templater->render(); } } if (count($cclist) > 1 OR (is_array($touser['cc']) AND !in_array($vbulletin->userinfo['username'], $touser['cc'])) OR ($vbulletin->userinfo['userid'] == $pm['fromuserid'] AND $pm['folderid'] == -1)) { if (!empty($cclist)) { $ccrecipients = implode("\r\n", $cclist); } if (!empty($bcclist) AND $vbulletin->userinfo['userid'] == $pm['fromuserid'] AND $pm['folderid'] == -1) { if (empty($cclist) AND count($bcclist == 1)) { $ccrecipients = implode("\r\n", $bcclist); } else { $bccrecipients = implode("\r\n", $bcclist); } } $show['recipients'] = true; } $show['quickreply'] = ($permissions['pmquota'] AND $vbulletin->userinfo['receivepm'] AND !fetch_privatemessage_throttle_reached($vbulletin->userinfo['userid'])); $recipient = $db->query_first(" SELECT usertextfield.*, user.*, userlist.type FROM " . TABLE_PREFIX . "user AS user LEFT JOIN " . TABLE_PREFIX . "usertextfield AS usertextfield ON(usertextfield.userid=user.userid) LEFT JOIN " . TABLE_PREFIX . "userlist AS userlist ON(user.userid = userlist.userid AND userlist.relationid = " . $vbulletin->userinfo['userid'] . " AND userlist.type = 'buddy') WHERE user.userid = " . intval($pm['fromuserid']) ); if (!empty($recipient)) { $recipient = array_merge($recipient , convert_bits_to_array($recipient['options'] , $vbulletin->bf_misc_useroptions)); cache_permissions($recipient, false); if (!($vbulletin->userinfo['permissions']['adminpermissions'] & $vbulletin->bf_ugp_adminpermissions['cancontrolpanel']) AND (!$recipient['receivepm'] OR !$recipient['permissions']['pmquota'] OR ($recipient['receivepmbuddies'] AND !can_moderate() AND $recipient['type'] != 'buddy') )) { $show['quickreply'] = false; } } if ($vbulletin->GPC['showhistory'] AND $pm['parentpmid']) { $threadresult = $vbulletin->db->query_read_slave(" SELECT pm.*, pmtext.* FROM " . TABLE_PREFIX . "pm AS pm INNER JOIN " . TABLE_PREFIX . "pmtext AS pmtext ON(pmtext.pmtextid = pm.pmtextid) WHERE (pm.parentpmid=" . $pm['parentpmid'] . " OR pm.pmid = " . $pm['parentpmid'] . ") AND pm.pmid != " . $pm['pmid'] . " AND pm.userid=" . $vbulletin->userinfo['userid'] . " AND pmtext.dateline < " . $pm['dateline'] . " ORDER BY pmtext.dateline DESC "); if ($vbulletin->db->num_rows($threadresult)) { $threadpms = ''; while ($threadpm = $vbulletin->db->fetch_array($threadresult)) { $postbit_factory = new vB_Postbit_Factory(); $postbit_factory->registry =& $vbulletin; $postbit_factory->cache = array(); $postbit_factory->bbcode_parser = new vB_BbCodeParser($vbulletin, fetch_tag_list()); $postbit_obj =& $postbit_factory->fetch_postbit('pm'); $threadpms .= $postbit_obj->construct_postbit($threadpm); } } } // generate navbar $navbits['private.php?' . $vbulletin->session->vars['sessionurl'] . "folderid=$pm[folderid]"] = $foldernames["{$pm['folderid']}"]; $navbits[''] = $pm['title']; $pm['original_title'] = $pm['title']; if ($show['quickreply']) { // get pm info require_once(DIR . '/includes/functions_newpost.php'); $pm = fetch_privatemessage_reply($pm); // create quick reply editor require_once(DIR . '/includes/functions_editor.php'); $editorid = construct_edit_toolbar( $pm['message'], false, 'privatemessage', $vbulletin->options['privallowsmilies'], true, false, 'qr_pm' ); $pm['savecopy'] = $vbulletin->userinfo['pmdefaultsavecopy']; } $includecss['postbit'] = 'postbit.css'; $page_templater = vB_Template::create('pm_showpm'); $page_templater->register('allowed_bbcode', $allowed_bbcode); $page_templater->register('bccrecipients', $bccrecipients); $page_templater->register('ccrecipients', $ccrecipients); $page_templater->register('editorid', $editorid); $page_templater->register('messagearea', $messagearea); $page_templater->register('pm', $pm); $page_templater->register('postbit', $postbit); $page_templater->register('receipt_question_js', $receipt_question_js); $page_templater->register('threadpms', $threadpms); $page_templater->register('vBeditTemplate', $vBeditTemplate); } // ############################# start pm message history ############################# if ($_REQUEST['do'] == 'showhistory') { require_once(DIR . '/includes/class_postbit.php'); require_once(DIR . '/includes/functions_bigthree.php'); $vbulletin->input->clean_gpc('r', array( 'pmid' => TYPE_UINT )); require_once(DIR . '/includes/class_xml.php'); $xml = new vB_AJAX_XML_Builder($vbulletin, 'text/xml'); $xml->add_group('response'); if ($vbulletin->userinfo['userid'] AND $vbulletin->GPC['pmid']) { $pm = $db->query_first_slave(" SELECT pm.parentpmid, pmtext.dateline FROM " . TABLE_PREFIX . "pm AS pm INNER JOIN " . TABLE_PREFIX . "pmtext AS pmtext ON(pmtext.pmtextid = pm.pmtextid) WHERE pm.userid=" . $vbulletin->userinfo['userid'] . " AND pm.pmid=" . $vbulletin->GPC['pmid'] . " "); } if (empty($pm)) { $xml->add_tag('error', 1); } else { $threadresult = $vbulletin->db->query_read_slave(" SELECT pm.*, pmtext.* FROM " . TABLE_PREFIX . "pm AS pm INNER JOIN " . TABLE_PREFIX . "pmtext AS pmtext ON(pmtext.pmtextid = pm.pmtextid) WHERE (pm.parentpmid=" . $pm['parentpmid'] . " OR pm.pmid = " . $pm['parentpmid'] . ") AND pm.pmid != " . $vbulletin->GPC['pmid'] . " AND pm.userid=" . $vbulletin->userinfo['userid'] . " AND pmtext.dateline < " . intval($pm['dateline']) . " ORDER BY pmtext.dateline DESC "); if ($vbulletin->db->num_rows($threadresult)) { $threadpms = ''; while ($threadpm = $vbulletin->db->fetch_array($threadresult)) { $postbit_factory = new vB_Postbit_Factory(); $postbit_factory->registry =& $vbulletin; $postbit_factory->cache = array(); $postbit_factory->bbcode_parser = new vB_BbCodeParser($vbulletin, fetch_tag_list()); $postbit_obj =& $postbit_factory->fetch_postbit('pm'); $threadpms .= $postbit_obj->construct_postbit($threadpm); } } else { $threadpms = vB_Template::create('pm_nomessagehistory')->render(); } $xml->add_tag('html', process_replacement_vars($threadpms)); } $xml->close_group(); $xml->print_xml(true); } // ############################### start pm folder view ############################### if ($_REQUEST['do'] == 'messagelist') { $vbulletin->input->clean_array_gpc('r', array( 'folderid' => TYPE_INT, 'perpage' => TYPE_UINT, 'pagenumber' => TYPE_UINT, )); ($hook = vBulletinHook::fetch_hook('private_messagelist_start')) ? eval($hook) : false; $folderid = $vbulletin->GPC['folderid']; $folderjump = construct_folder_jump(0, $vbulletin->GPC['folderid'], false, '', true); $foldername = $foldernames["{$vbulletin->GPC['folderid']}"]['name']; // count receipts $receipts = $db->query_first_slave(" SELECT SUM(IF(readtime <> 0, 1, 0)) AS confirmed, SUM(IF(readtime = 0, 1, 0)) AS unconfirmed FROM " . TABLE_PREFIX . "pmreceipt WHERE userid = " . $vbulletin->userinfo['userid'] ); // get ignored users $ignoreusers = preg_split('#\s+#s', $vbulletin->userinfo['ignorelist'], -1, PREG_SPLIT_NO_EMPTY); $totalmessages = intval($messagecounters["{$vbulletin->GPC['folderid']}"]); // build pm counters bar, folder is 100 if we have no quota so red shows on the main bar $tdwidth = array(); $tdwidth['folder'] = ($permissions['pmquota'] ? ceil($totalmessages / $permissions['pmquota'] * 100) : 100); $tdwidth['total'] = ($permissions['pmquota'] ? ceil($vbulletin->userinfo['pmtotal'] / $permissions['pmquota'] * 100) - $tdwidth['folder'] : 0); $tdwidth['quota'] = 100 - $tdwidth['folder'] - $tdwidth['total']; $show['thisfoldertotal'] = iif($tdwidth['folder'], true, false); $show['allfolderstotal'] = iif($tdwidth['total'], true, false); $show['pmicons'] = iif($vbulletin->options['privallowicons'], true, false); // build navbar $navbits[''] = $foldernames["{$vbulletin->GPC['folderid']}"]['name']; if ($totalmessages == 0) { $show['messagelist'] = false; } else { $show['messagelist'] = true; $vbulletin->input->clean_array_gpc('r', array( 'sort' => TYPE_NOHTML, 'order' => TYPE_NOHTML, 'searchtitle' => TYPE_NOHTML, 'searchuser' => TYPE_NOHTML, 'startdate' => TYPE_UNIXTIME, 'enddate' => TYPE_UNIXTIME, 'searchread' => TYPE_UINT )); $search = array( 'sort' => (('sender' == $vbulletin->GPC['sort']) ? 'sender' : (('title' == $vbulletin->GPC['sort']) ? 'title' : 'date')), 'order' => (($vbulletin->GPC['order'] == 'asc') ? 'asc' : 'desc'), 'searchtitle'=> $vbulletin->GPC['searchtitle'], 'searchuser' => $vbulletin->GPC['searchuser'], 'startdate' => $vbulletin->GPC['startdate'], 'enddate' => $vbulletin->GPC['enddate'], 'read' => $vbulletin->GPC['searchread'] ); // make enddate inclusive $search['enddate'] = ($search['enddate'] ? ($search['enddate'] + 86400) : 0); $show['openfilter'] = ($search['searchtitle'] OR $search['searchuser'] OR $search['startdate'] OR $search['enddate']); $sortfield = (('sender' == $search['sort']) ? 'pmtext.fromusername' : (('title' == $search['sort'] ? 'pmtext.title' : 'pmtext.dateline'))); $desc = ($search['order'] == 'desc'); ($hook = vBulletinHook::fetch_hook('private_messagelist_filter')) ? eval($hook) : false; // get a sensible value for $perpage sanitize_pageresults($totalmessages, $vbulletin->GPC['pagenumber'], $vbulletin->GPC['perpage'], $vbulletin->options['pmmaxperpage'], $vbulletin->options['pmperpage']); // work out the $startat value $startat = ($vbulletin->GPC['pagenumber'] - 1) * $vbulletin->GPC['perpage']; $perpage = $vbulletin->GPC['perpage']; $pagenumber = $vbulletin->GPC['pagenumber']; // array to store private messages in period groups $pm_period_groups = array(); $need_sql_calc_rows = ($search['searchtitle'] OR $search['searchuser'] OR $search['startdate'] OR $search['enddate'] OR $search['read']); $readstatus = array(0 => '', 1 => '= 0', 2 => '> 0', 3 => '< 2', 4 => '= 2'); $readstatus = ($search['read'] == 0 ? '' : 'AND pm.messageread ' . $readstatus[$search['read']]); // query private messages $pms = $db->query_read_slave(" SELECT " . ($need_sql_calc_rows ? 'SQL_CALC_FOUND_ROWS' : '') . " pm.*, pmtext.* " . iif($vbulletin->options['privallowicons'], ", icon.title AS icontitle, icon.iconpath") . " FROM " . TABLE_PREFIX . "pm AS pm LEFT JOIN " . TABLE_PREFIX . "pmtext AS pmtext ON(pmtext.pmtextid = pm.pmtextid) " . iif($vbulletin->options['privallowicons'], "LEFT JOIN " . TABLE_PREFIX . "icon AS icon ON(icon.iconid = pmtext.iconid)") . " WHERE pm.userid=" . $vbulletin->userinfo['userid'] . " AND pm.folderid=" . $vbulletin->GPC['folderid'] . ($search['searchtitle'] ? " AND pmtext.title LIKE '%" . $vbulletin->db->escape_string($search['searchtitle']) . "%'" : '') . ($search['searchuser'] ? " AND pmtext.fromusername LIKE '%" . $vbulletin->db->escape_string($search['searchuser']) . "%'" : '') . ($search['startdate'] ? " AND pmtext.dateline >= $search[startdate]" : '') . ($search['enddate'] ? " AND pmtext.dateline <= $search[enddate]" : '') . " $readstatus ORDER BY $sortfield " . ($desc ? 'DESC' : 'ASC') . " LIMIT $startat, " . $vbulletin->GPC['perpage'] . " "); while ($pm = $db->fetch_array($pms)) { if ('title' == $search['sort']) { $pm_period_groups[ fetch_char_group($pm['title']) ]["$pm[pmid]"] = $pm; } else if ('sender' == $search['sort']) { $pm_period_groups["$pm[fromusername]"]["$pm[pmid]"] = $pm; } else { $pm_period_groups[ fetch_period_group($pm['dateline']) ]["$pm[pmid]"] = $pm; } } $db->free_result($pms); // ensure other group is last if (isset($pm_period_groups['other'])) { $pm_period_groups = ($desc) ? array_merge($pm_period_groups, array('other' => $pm_period_groups['other'])) : array_merge(array('other' => $pm_period_groups['other']), $pm_period_groups); } // display returned messages $show['pmcheckbox'] = true; require_once(DIR . '/includes/functions_bigthree.php'); foreach ($pm_period_groups AS $groupid => $pms) { if (('date' == $search['sort']) AND preg_match('#^(\d+)_([a-z]+)_ago$#i', $groupid, $matches)) { $groupname = construct_phrase($vbphrase["x_$matches[2]_ago"], $matches[1]); } else if ('title' == $search['sort'] OR 'date' == $search['sort']) { if (('older' == $groupid) AND (sizeof($pm_period_groups) == 1)) { $groupid = 'old_messages'; } $groupname = $vbphrase["$groupid"]; } else { $groupname = $groupid; } $groupid = $vbulletin->GPC['folderid'] . '_' . $groupid; $collapseobj_groupid =& $vbcollapse["collapseobj_pmf$groupid"]; $collapseimg_groupid =& $vbcollapse["collapseimg_pmf$groupid"]; $messagesingroup = sizeof($pms); $messagelistbits = ''; foreach ($pms AS $pmid => $pm) { if (in_array($pm['fromuserid'], $ignoreusers)) { // from user is on Ignore List $templater = vB_Template::create('pm_messagelistbit_ignore'); $templater->register('groupid', $groupid); $templater->register('pm', $pm); $templater->register('pmid', $pmid); $messagelistbits .= $templater->render(); } else { switch($pm['messageread']) { case 0: // unread $pm['statusicon'] = 'new'; break; case 1: // read $pm['statusicon'] = 'old'; break; case 2: // replied to $pm['statusicon'] = 'replied'; break; case 3: // forwarded $pm['statusicon'] = 'forwarded'; break; } $pm['senddate'] = vbdate($vbulletin->options['dateformat'], $pm['dateline']); $pm['sendtime'] = vbdate($vbulletin->options['timeformat'], $pm['dateline']); // get userbit if ($vbulletin->GPC['folderid'] == -1) { $users = unserialize($pm['touserarray']); $touser = array(); $tousers = array(); if (!empty($users)) { foreach ($users AS $key => $item) { if (is_array($item)) { foreach($item AS $subkey => $subitem) { $touser["$subkey"] = $subitem; } } else { $touser["$key"] = $item; } } uasort($touser, 'strnatcasecmp'); } foreach ($touser AS $userid => $username) { $userinfo = array( 'userid' => $userid, 'username' => $username, ); $templater = vB_Template::create('pm_messagelistbit_user'); $templater->register('userinfo', $userinfo); $tousers[] = $templater->render(); } $userbit = implode("\r\n", $tousers); } else { $userinfo = array( 'userid' => $pm['fromuserid'], 'username' => $pm['fromusername'], ); $templater = vB_Template::create('pm_messagelistbit_user'); $templater->register('userinfo', $userinfo); $userbit = $templater->render(); } $show['pmicon'] = iif($pm['iconpath'], true, false); $show['unread'] = iif(!$pm['messageread'], true, false); ($hook = vBulletinHook::fetch_hook('private_messagelist_messagebit')) ? eval($hook) : false; $templater = vB_Template::create('pm_messagelistbit'); $templater->register('groupid', $groupid); $templater->register('pm', $pm); $templater->register('pmid', $pmid); $templater->register('userbit', $userbit); $messagelistbits .= $templater->render(); } } // free up memory not required any more unset($pm_period_groups["$groupid"]); ($hook = vBulletinHook::fetch_hook('private_messagelist_period')) ? eval($hook) : false; // build group template $templater = vB_Template::create('pm_messagelist_periodgroup'); $templater->register('collapseimg_groupid', $collapseimg_groupid); $templater->register('collapseobj_groupid', $collapseobj_groupid); $templater->register('groupid', $groupid); $templater->register('groupname', $groupname); $templater->register('messagelistbits', $messagelistbits); $templater->register('messagesingroup', $messagesingroup); $messagelist_periodgroups .= $templater->render(); } if ($desc) { unset($search['order']); } $sorturl = urlimplode($search); // build pagenav if ($need_sql_calc_rows) { list($totalmessages) = $vbulletin->db->query_first_slave("SELECT FOUND_ROWS()", DBARRAY_NUM); } $pagenav = construct_page_nav($pagenumber, $perpage, $totalmessages, 'private.php?' . $vbulletin->session->vars['sessionurl'] . 'folderid=' . $vbulletin->GPC['folderid'] . '&amp;pp=' . $vbulletin->GPC['perpage'] . '&amp;' . $sorturl); $sortfield = $search['sort']; unset($search['sort']); $sorturl = 'private.php?' . $vbulletin->session->vars['sessionurl'] . 'folderid=' . $vbulletin->GPC['folderid'] . ($searchurl = urlimplode($search) ? '&amp;' . $searchurl : ''); $oppositesort = $desc ? 'asc' : 'desc'; $orderlinks = array( 'date' => $sorturl . '&amp;sort=date' . ($sortfield == 'date' ? '&amp;order=' . $oppositesort : ''), 'title' => $sorturl . '&amp;sort=title' . ($sortfield == 'title' ? '&amp;order=' . $oppositesort : '&amp;order=asc'), 'sender' => $sorturl . '&amp;sort=sender' . ($sortfield == 'sender' ? '&amp;order=' . $oppositesort : '&amp;order=asc') ); $templater = vB_Template::create('forumdisplay_sortarrow'); $templater->register('oppositesort', $oppositesort); $sortarrow["$sortfield"] = $templater->render(); // values for filters $startdate = fetch_datearray_from_timestamp(($search['startdate'] ? $search['startdate'] : strtotime('last month', TIMENOW))); $enddate = fetch_datearray_from_timestamp(($search['enddate'] ? $search['enddate'] : TIMENOW)); $startmonth[$startdate[month]] = 'selected="selected"'; $endmonth[$enddate[month]] = 'selected="selected"'; $readselection[$search['read']] = 'selected="selected"'; $templater = vB_Template::create('pm_filter'); $templater->register('enddate', $enddate); $templater->register('endmonth', $endmonth); $templater->register('order', $order); $templater->register('pagenumber', $pagenumber); $templater->register('perpage', $perpage); $templater->register('readselection', $readselection); $templater->register('search', $search); $templater->register('sortfield', $sortfield); $templater->register('startdate', $startdate); $templater->register('startmonth', $startmonth); $sortfilter = $templater->render(); } if ($vbulletin->GPC['folderid'] == -1) { $show['sentto'] = true; $show['movetofolder'] = false; } else { $show['sentto'] = false; $show['movetofolder'] = true; } $startmessage = vb_number_format($startat + 1); $endmessage = vb_number_format(($pagenumber * $perpage) > $totalmessages ? $totalmessages : ($pagenumber * $perpage)); $totalmessages = vb_number_format($totalmessages); $pmtotal = vb_number_format($vbulletin->userinfo['pmtotal']); $pmquota = vb_number_format($vbulletin->userinfo['permissions']['pmquota']); $includecss['datepicker'] = 'datepicker.css'; $page_templater = vB_Template::create('pm_messagelist'); $page_templater->register('folderid', $folderid); $page_templater->register('folderjump', $folderjump); $page_templater->register('foldername', $foldername); $page_templater->register('forumjump', $forumjump); $page_templater->register('gobutton', $gobutton); $page_templater->register('messagelist_periodgroups', $messagelist_periodgroups); $page_templater->register('orderlinks', $orderlinks); $page_templater->register('pagenav', $pagenav); $page_templater->register('pagenumber', $pagenumber); $page_templater->register('permissions', $permissions); $page_templater->register('perpage', $perpage); $page_templater->register('pmquota', $pmquota); $page_templater->register('pmtotal', $pmtotal); $page_templater->register('receipts', $receipts); $page_templater->register('sortarrow', $sortarrow); $page_templater->register('sortfilter', $sortfilter); $page_templater->register('tdwidth', $tdwidth); $page_templater->register('totalmessages', $totalmessages); $page_templater->register('startmessage', $startmessage); $page_templater->register('endmessage', $endmessage); } // ############################### start pm reporting ############################### if ($_REQUEST['do'] == 'report' OR $_POST['do'] == 'sendemail') { $reportthread = ($rpforumid = $vbulletin->options['rpforumid'] AND $rpforuminfo = fetch_foruminfo($rpforumid)); $reportemail = ($vbulletin->options['enableemail'] AND $vbulletin->options['rpemail']); if (!$reportthread AND !$reportemail) { eval(standard_error(fetch_error('emaildisabled'))); } $vbulletin->input->clean_gpc('r', 'pmid', TYPE_UINT); $pminfo = $db->query_first_slave(" SELECT pm.*, pmtext.* FROM " . TABLE_PREFIX . "pm AS pm LEFT JOIN " . TABLE_PREFIX . "pmtext AS pmtext ON(pmtext.pmtextid = pm.pmtextid) WHERE pm.userid=" . $vbulletin->userinfo['userid'] . " AND pm.pmid=" . $vbulletin->GPC['pmid'] . " "); if (!$pminfo) { eval(standard_error(fetch_error('invalidid', $vbphrase['private_message'], $vbulletin->options['contactuslink']))); } require_once(DIR . '/includes/class_reportitem.php'); $reportobj = new vB_ReportItem_PrivateMessage($vbulletin); $reportobj->set_extrainfo('pm', $pminfo); $perform_floodcheck = $reportobj->need_floodcheck(); if ($perform_floodcheck) { $reportobj->perform_floodcheck_precommit(); } ($hook = vBulletinHook::fetch_hook('report_start')) ? eval($hook) : false; if ($_REQUEST['do'] == 'report') { // draw nav bar $navbits = array( 'usercp.php' . $vbulletin->session->vars['sessionurl_q'] => $vbphrase['user_control_panel'], 'private.php' . $vbulletin->session->vars['sessionurl_q'] => $vbphrase['private_messages'], '' => $vbphrase['report_bad_private_message'] ); $usernamecode = vB_Template::create('newpost_usernamecode')->render(); $navbits = construct_navbits($navbits); $navbar = render_navbar_template($navbits); $url =& $vbulletin->url; ($hook = vBulletinHook::fetch_hook('report_form_start')) ? eval($hook) : false; $forminfo = $reportobj->set_forminfo($pminfo); $templater = vB_Template::create('reportitem'); $templater->register_page_templates(); $templater->register('forminfo', $forminfo); $templater->register('navbar', $navbar); $templater->register('url', $url); $templater->register('usernamecode', $usernamecode); print_output($templater->render()); } if ($_POST['do'] == 'sendemail') { $vbulletin->input->clean_array_gpc('p', array( 'reason' => TYPE_STR, )); if ($vbulletin->GPC['reason'] == '') { eval(standard_error(fetch_error('noreason'))); } $reportobj->do_report($vbulletin->GPC['reason'], $pminfo); $url =& $vbulletin->url; eval(print_standard_redirect('redirect_reportthanks')); } } // ############################################################################# if (!empty($page_templater)) { // draw cp nav bar construct_usercp_nav($page_templater->get_template_name()); // build navbar $navbits = construct_navbits($navbits); $navbar = render_navbar_template($navbits); ($hook = vBulletinHook::fetch_hook('private_complete')) ? eval($hook) : false; $includecss['private'] = 'private.css'; if (!$vbulletin->options['storecssasfile']) { $includecss = implode(',', $includecss); } // print page $templater = vB_Template::create('USERCP_SHELL'); $templater->register_page_templates(); $templater->register('includecss', $includecss); $templater->register('cpnav', $cpnav); $templater->register('HTML', $page_templater->render()); $templater->register('navbar', $navbar); $templater->register('navclass', $navclass); $templater->register('onload', $onload); $templater->register('pagetitle', $pagetitle); $templater->register('template_hook', $template_hook); print_output($templater->render()); } /*======================================================================*\ || #################################################################### || # || # CVS: $RCSfile$ - $Revision: 37230 $ || #################################################################### \*======================================================================*/ ?>
{ "content_hash": "29b06a104a1926ceb75d163e427ae8e7", "timestamp": "", "source": "github", "line_count": 2349, "max_line_length": 272, "avg_line_length": 34.371647509578544, "alnum_prop": 0.5902971302592304, "repo_name": "jessadayim/findtheroom", "id": "381e6fb8b6057ea4dfe56580030c7bc678ca96a6", "size": "81443", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "web/forum/upload/private.php", "mode": "33188", "license": "mit", "language": [ { "name": "JavaScript", "bytes": "1540091" }, { "name": "PHP", "bytes": "12404723" }, { "name": "Shell", "bytes": "2194" } ], "symlink_target": "" }
package org.apache.ignite.loadtests.communication; import java.io.IOException; import java.time.Instant; import java.util.ArrayList; import java.util.Collection; import java.util.Map; import java.util.Random; import java.util.UUID; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.CountDownLatch; import java.util.concurrent.Semaphore; import java.util.concurrent.ThreadLocalRandom; import java.util.concurrent.atomic.LongAdder; import org.apache.ignite.IgniteCheckedException; import org.apache.ignite.cluster.ClusterNode; import org.apache.ignite.internal.IgniteInterruptedCheckedException; import org.apache.ignite.internal.IgniteKernal; import org.apache.ignite.internal.managers.communication.GridIoManager; import org.apache.ignite.internal.managers.communication.GridMessageListener; import org.apache.ignite.internal.managers.discovery.GridDiscoveryManager; import org.apache.ignite.internal.util.IgniteUtils; import org.apache.ignite.internal.util.typedef.F; import org.apache.ignite.internal.util.typedef.G; import org.apache.ignite.internal.util.typedef.X; import org.apache.ignite.internal.util.typedef.internal.U; import org.apache.ignite.lang.IgniteUuid; import org.apache.ignite.loadtests.util.GridCumulativeAverage; import org.jetbrains.annotations.Nullable; import static java.util.concurrent.TimeUnit.MILLISECONDS; import static org.apache.ignite.internal.managers.communication.GridIoPolicy.PUBLIC_POOL; import static org.apache.ignite.testframework.GridLoadTestUtils.appendLineToFile; import static org.apache.ignite.testframework.GridLoadTestUtils.startDaemon; /** * By default this benchmarks uses original Ignite configuration * with message dispatching from NIO threads. * * By changing {@link #DFLT_CONFIG} constant you can use ForkJoin thread pool instead of JDK default. * * Note that you should run 2 processes of this test to get it running. */ public class GridIoManagerBenchmark { /** */ public static final String DFLT_CONFIG = "modules/tests/config/io-manager-benchmark.xml"; /** */ private static final int DFLT_THREADS = 2; /** */ private static final long WARM_UP_DUR = 30 * 1000; /** */ private static final Semaphore sem = new Semaphore(10 * 1024); /** */ public static final int TEST_TOPIC = 1; /** */ private static final LongAdder msgCntr = new LongAdder(); /** */ private static final Map<IgniteUuid, CountDownLatch> latches = new ConcurrentHashMap<>(); /** */ private static final byte[][] arrs; /** */ private static boolean testHeavyMsgs; /** */ private static boolean testLatency; /** * */ static { ThreadLocalRandom rnd = ThreadLocalRandom.current(); arrs = new byte[64][]; for (int i = 0; i < arrs.length; i++) { byte[] arr = new byte[rnd.nextInt(4096, 8192)]; for (int j = 0; j < arr.length; j++) arr[j] = (byte)rnd.nextInt(0, 127); arrs[i] = arr; } } /** * @param args Command line arguments. */ public static void main(String[] args) { int threads = args.length > 0 ? Integer.parseInt(args[0]) : DFLT_THREADS; int duration = args.length > 1 ? Integer.parseInt(args[1]) : 0; String outputFilename = args.length > 2 ? args[2] : null; String path = args.length > 3 ? args[3] : DFLT_CONFIG; testHeavyMsgs = args.length > 4 && "true".equalsIgnoreCase(args[4]); testLatency = args.length > 5 && "true".equalsIgnoreCase(args[5]); // threads = 128; // testLatency = true; // testHeavyMsgs = true; X.println("Config: " + path); X.println("Test heavy messages: " + testHeavyMsgs); X.println("Test latency: " + testLatency); X.println("Threads: " + threads); X.println("Duration: " + duration); X.println("Output file name: " + outputFilename); IgniteKernal g = (IgniteKernal)G.start(path); if (g.localNode().order() > 1) { try { sendMessages(g, threads, duration, outputFilename); } finally { G.stopAll(false); } } else receiveMessages(g); } /** * @param g Kernal. * @param threads Number of send threads. * @param duration Test duration. * @param outputFilename Output file name. */ private static void sendMessages(IgniteKernal g, int threads, int duration, @Nullable final String outputFilename) { X.println(">>> Sending messages."); g.context().io().addMessageListener(TEST_TOPIC, new SenderMessageListener()); Thread collector = startDaemon(new Runnable() { @Override public void run() { final long initTs = System.currentTimeMillis(); long ts = initTs; long queries = msgCntr.sum(); GridCumulativeAverage qpsAvg = new GridCumulativeAverage(); try { while (!Thread.currentThread().isInterrupted()) { U.sleep(10000); long newTs = System.currentTimeMillis(); long newQueries = msgCntr.sum(); long executed = newQueries - queries; long time = newTs - ts; long qps = executed * 1000 / time; boolean recordAvg = ts - initTs > WARM_UP_DUR; if (recordAvg) qpsAvg.update(qps); X.println("Communication benchmark [qps=" + qps + (recordAvg ? ", qpsAvg=" + qpsAvg : "") + ", executed=" + executed + ", time=" + time + ']'); ts = newTs; queries = newQueries; } } catch (IgniteInterruptedCheckedException ignored) { // No-op. } X.println("Average QPS: " + qpsAvg); if (outputFilename != null) { try { X.println("Saving results to output file: " + outputFilename); appendLineToFile(outputFilename, "%s,%d", IgniteUtils.LONG_DATE_FMT.format( Instant.now()), qpsAvg.get()); } catch (IOException e) { X.println("Failed to record results to a file: " + e.getMessage()); } } } }); Collection<SendThread> sndThreads = new ArrayList<>(threads); for (int i = 0; i < threads; i++) { SendThread t = new SendThread(g); sndThreads.add(t); t.start(); } try { U.sleep(duration > 0 ? duration * 1000 + WARM_UP_DUR : Long.MAX_VALUE); } catch (IgniteInterruptedCheckedException ignored) { // No-op. } collector.interrupt(); for (SendThread t : sndThreads) t.interrupt(); } /** * @param g Kernal. */ private static void receiveMessages(final IgniteKernal g) { X.println(">>> Receiving messages."); final GridIoManager io = g.context().io(); GridMessageListener lsnr = new GridMessageListener() { private ClusterNode node; @Override public void onMessage(UUID nodeId, Object msg, byte plc) { if (node == null) node = g.context().discovery().node(nodeId); GridTestMessage testMsg = ((GridTestMessage)msg); testMsg.bytes(null); try { io.sendToCustomTopic(node, TEST_TOPIC, testMsg, PUBLIC_POOL); } catch (IgniteCheckedException e) { e.printStackTrace(); } } }; io.addMessageListener(TEST_TOPIC, lsnr); } /** * */ private static class SendThread extends Thread { /** */ private final IgniteKernal g; /** * @param g Kernal. */ SendThread(IgniteKernal g) { this.g = g; } /** {@inheritDoc} */ @Override public void run() { try { ClusterNode dst = awaitOther(g.context().discovery()); GridIoManager io = g.context().io(); Random rnd = ThreadLocalRandom.current(); IgniteUuid msgId = IgniteUuid.randomUuid(); while (!Thread.interrupted()) { CountDownLatch latch = null; if (testLatency) latches.put(msgId, latch = new CountDownLatch(1)); else sem.acquire(); io.sendToCustomTopic( dst, TEST_TOPIC, new GridTestMessage(msgId, testHeavyMsgs ? arrs[rnd.nextInt(arrs.length)] : null), PUBLIC_POOL); if (testLatency && !latch.await(1000, MILLISECONDS)) throw new RuntimeException("Failed to await latch."); } } catch (IgniteCheckedException e) { e.printStackTrace(); } catch (InterruptedException ignored) { // No-op. } } /** * @param disc Discovery. * @return Second node in the topology. * @throws InterruptedException If interrupted. */ @SuppressWarnings("BusyWait") private ClusterNode awaitOther(final GridDiscoveryManager disc) throws InterruptedException { while (disc.allNodes().size() < 2) Thread.sleep(1000); for (ClusterNode node : disc.allNodes()) if (!F.eqNodes(node, disc.localNode())) return node; assert false; return null; } } /** * */ private static class SenderMessageListener implements GridMessageListener { /** {@inheritDoc} */ @Override public void onMessage(UUID nodeId, Object msg, byte plc) { msgCntr.increment(); if (testLatency) latches.get(((GridTestMessage)msg).id()).countDown(); else sem.release(); } } }
{ "content_hash": "ea56d20abc5a7bb38f2223bd1e4df3cc", "timestamp": "", "source": "github", "line_count": 331, "max_line_length": 120, "avg_line_length": 31.92749244712991, "alnum_prop": 0.557437547312642, "repo_name": "NSAmelchev/ignite", "id": "0ab8246fccc01489a8bc0a4236259c6dadbfb223", "size": "11370", "binary": false, "copies": "5", "ref": "refs/heads/master", "path": "modules/core/src/test/java/org/apache/ignite/loadtests/communication/GridIoManagerBenchmark.java", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Batchfile", "bytes": "54788" }, { "name": "C", "bytes": "7601" }, { "name": "C#", "bytes": "7740054" }, { "name": "C++", "bytes": "4487801" }, { "name": "CMake", "bytes": "54473" }, { "name": "Dockerfile", "bytes": "11909" }, { "name": "FreeMarker", "bytes": "15591" }, { "name": "HTML", "bytes": "14341" }, { "name": "Java", "bytes": "50117357" }, { "name": "JavaScript", "bytes": "1085" }, { "name": "Jinja", "bytes": "32958" }, { "name": "Makefile", "bytes": "932" }, { "name": "PHP", "bytes": "11079" }, { "name": "PowerShell", "bytes": "9247" }, { "name": "Python", "bytes": "330115" }, { "name": "Scala", "bytes": "425434" }, { "name": "Shell", "bytes": "311510" } ], "symlink_target": "" }
#region License // Copyright (c) 2007 - 2014, Northwestern University, Vladimir Kleper, Skip Talbot // and Pattanasak Mongkolwat. // All rights reserved. // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are met: // // Redistributions of source code must retain the above copyright notice, // this list of conditions and the following disclaimer. // // Redistributions in binary form must reproduce the above copyright notice, // this list of conditions and the following disclaimer in the documentation // and/or other materials provided with the distribution. // // Neither the name of the National Cancer Institute nor Northwestern University // nor the names of its contributors may be used to endorse or promote products // derived from this software without specific prior written permission. // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND // ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED // WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE // DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE // FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL // DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR // SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER // CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, // OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #endregion using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyCompany("ClearCanvas Inc.")] [assembly: AssemblyProduct("ClearCanvas Workstation")] [assembly: AssemblyVersion("1.5.10851.32944")] [assembly: AssemblyFileVersion("1.5.10851.32944")] [assembly: ClearCanvas.Common.Plugin] [assembly: AssemblyTitle("WinForms")] [assembly: AssemblyDescription("")] [assembly: AssemblyCopyright("Copyright (c) 2007-2014")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] [assembly: ComVisible(false)]
{ "content_hash": "887ef15a021befc6e36756fa9ea89ac5", "timestamp": "", "source": "github", "line_count": 48, "max_line_length": 83, "avg_line_length": 48.4375, "alnum_prop": 0.7772043010752688, "repo_name": "NCIP/annotation-and-image-markup", "id": "4849fe5fb766bff653a7e193912d53ebb5e2c3f6", "size": "2327", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "AimPlugin4.5/SearchComponent/View/WinForms/Properties/AssemblyInfo.cs", "mode": "33188", "license": "bsd-3-clause", "language": [ { "name": "C", "bytes": "31363450" }, { "name": "C#", "bytes": "5152916" }, { "name": "C++", "bytes": "148605530" }, { "name": "CSS", "bytes": "85406" }, { "name": "Java", "bytes": "2039090" }, { "name": "Objective-C", "bytes": "381107" }, { "name": "Perl", "bytes": "502054" }, { "name": "Shell", "bytes": "11832" }, { "name": "Tcl", "bytes": "30867" } ], "symlink_target": "" }
package edu.usc.corral.db.sqlite; import edu.usc.corral.db.sql.SQLSiteDAO; public class SQLiteSiteDAO extends SQLSiteDAO { public SQLiteSiteDAO(SQLiteDatabase db) { super(db); } }
{ "content_hash": "d9587bc6e052578a9f9d03ae3dcb5492", "timestamp": "", "source": "github", "line_count": 12, "max_line_length": 45, "avg_line_length": 15.75, "alnum_prop": 0.7566137566137566, "repo_name": "juve/corral", "id": "a263736c9f754e47adc40cfc003a5d04aa457fa8", "size": "816", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "src/edu/usc/corral/db/sqlite/SQLiteSiteDAO.java", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Java", "bytes": "376989" }, { "name": "PHP", "bytes": "5974" }, { "name": "Shell", "bytes": "22566" } ], "symlink_target": "" }
import copy import collections from nose.tools import assert_equal, assert_raises, assert_true from voluptuous import ( Schema, Required, Optional, Extra, Invalid, In, Remove, Literal, Url, MultipleInvalid, LiteralInvalid, NotIn, Match, Email, Replace, Range, Coerce, All, Any, Length, FqdnUrl, ALLOW_EXTRA, PREVENT_EXTRA, validate, ExactSequence, Equal, Unordered, Number, Maybe, Datetime, Date ) from voluptuous.humanize import humanize_error from voluptuous.util import to_utf8_py2, u def test_exact_sequence(): schema = Schema(ExactSequence([int, int])) try: schema([1, 2, 3]) except Invalid: assert True else: assert False, "Did not raise Invalid" assert_equal(schema([1, 2]), [1, 2]) def test_required(): """Verify that Required works.""" schema = Schema({Required('q'): 1}) # Can't use nose's raises (because we need to access the raised # exception, nor assert_raises which fails with Python 2.6.9. try: schema({}) except Invalid as e: assert_equal(str(e), "required key not provided @ data['q']") else: assert False, "Did not raise Invalid" def test_extra_with_required(): """Verify that Required does not break Extra.""" schema = Schema({Required('toaster'): str, Extra: object}) r = schema({'toaster': 'blue', 'another_valid_key': 'another_valid_value'}) assert_equal( r, {'toaster': 'blue', 'another_valid_key': 'another_valid_value'}) def test_iterate_candidates(): """Verify that the order for iterating over mapping candidates is right.""" schema = { "toaster": str, Extra: object, } # toaster should be first. from voluptuous.schema_builder import _iterate_mapping_candidates assert_equal(_iterate_mapping_candidates(schema)[0][0], 'toaster') def test_in(): """Verify that In works.""" schema = Schema({"color": In(frozenset(["blue", "red", "yellow"]))}) schema({"color": "blue"}) def test_not_in(): """Verify that NotIn works.""" schema = Schema({"color": NotIn(frozenset(["blue", "red", "yellow"]))}) schema({"color": "orange"}) try: schema({"color": "blue"}) except Invalid as e: assert_equal(str(e), "value is not allowed for dictionary value @ data['color']") else: assert False, "Did not raise NotInInvalid" def test_remove(): """Verify that Remove works.""" # remove dict keys schema = Schema({"weight": int, Remove("color"): str, Remove("amount"): int}) out_ = schema({"weight": 10, "color": "red", "amount": 1}) assert "color" not in out_ and "amount" not in out_ # remove keys by type schema = Schema({"weight": float, "amount": int, # remvove str keys with int values Remove(str): int, # keep str keys with str values str: str}) out_ = schema({"weight": 73.4, "condition": "new", "amount": 5, "left": 2}) # amount should stay since it's defined # other string keys with int values will be removed assert "amount" in out_ and "left" not in out_ # string keys with string values will stay assert "condition" in out_ # remove value from list schema = Schema([Remove(1), int]) out_ = schema([1, 2, 3, 4, 1, 5, 6, 1, 1, 1]) assert_equal(out_, [2, 3, 4, 5, 6]) # remove values from list by type schema = Schema([1.0, Remove(float), int]) out_ = schema([1, 2, 1.0, 2.0, 3.0, 4]) assert_equal(out_, [1, 2, 1.0, 4]) def test_extra_empty_errors(): schema = Schema({'a': {Extra: object}}, required=True) schema({'a': {}}) def test_literal(): """ test with Literal """ schema = Schema([Literal({"a": 1}), Literal({"b": 1})]) schema([{"a": 1}]) schema([{"b": 1}]) schema([{"a": 1}, {"b": 1}]) try: schema([{"c": 1}]) except Invalid as e: assert_equal(str(e), "{'c': 1} not match for {'b': 1} @ data[0]") else: assert False, "Did not raise Invalid" schema = Schema(Literal({"a": 1})) try: schema({"b": 1}) except MultipleInvalid as e: assert_equal(str(e), "{'b': 1} not match for {'a': 1}") assert_equal(len(e.errors), 1) assert_equal(type(e.errors[0]), LiteralInvalid) else: assert False, "Did not raise Invalid" def test_email_validation(): """ test with valid email """ schema = Schema({"email": Email()}) out_ = schema({"email": "[email protected]"}) assert '[email protected]"', out_.get("url") def test_email_validation_with_none(): """ test with invalid None Email""" schema = Schema({"email": Email()}) try: schema({"email": None}) except MultipleInvalid as e: assert_equal(str(e), "expected an Email for dictionary value @ data['email']") else: assert False, "Did not raise Invalid for None url" def test_email_validation_with_empty_string(): """ test with empty string Email""" schema = Schema({"email": Email()}) try: schema({"email": ''}) except MultipleInvalid as e: assert_equal(str(e), "expected an Email for dictionary value @ data['email']") else: assert False, "Did not raise Invalid for empty string url" def test_email_validation_without_host(): """ test with empty host name in email """ schema = Schema({"email": Email()}) try: schema({"email": '[email protected]'}) except MultipleInvalid as e: assert_equal(str(e), "expected an Email for dictionary value @ data['email']") else: assert False, "Did not raise Invalid for empty string url" def test_fqdn_url_validation(): """ test with valid fully qualified domain name url """ schema = Schema({"url": FqdnUrl()}) out_ = schema({"url": "http://example.com/"}) assert 'http://example.com/', out_.get("url") def test_fqdn_url_without_domain_name(): """ test with invalid fully qualified domain name url """ schema = Schema({"url": FqdnUrl()}) try: schema({"url": "http://localhost/"}) except MultipleInvalid as e: assert_equal(str(e), "expected a Fully qualified domain name URL for dictionary value @ data['url']") else: assert False, "Did not raise Invalid for None url" def test_fqdnurl_validation_with_none(): """ test with invalid None FQDN url""" schema = Schema({"url": FqdnUrl()}) try: schema({"url": None}) except MultipleInvalid as e: assert_equal(str(e), "expected a Fully qualified domain name URL for dictionary value @ data['url']") else: assert False, "Did not raise Invalid for None url" def test_fqdnurl_validation_with_empty_string(): """ test with empty string FQDN URL """ schema = Schema({"url": FqdnUrl()}) try: schema({"url": ''}) except MultipleInvalid as e: assert_equal(str(e), "expected a Fully qualified domain name URL for dictionary value @ data['url']") else: assert False, "Did not raise Invalid for empty string url" def test_fqdnurl_validation_without_host(): """ test with empty host FQDN URL """ schema = Schema({"url": FqdnUrl()}) try: schema({"url": 'http://'}) except MultipleInvalid as e: assert_equal(str(e), "expected a Fully qualified domain name URL for dictionary value @ data['url']") else: assert False, "Did not raise Invalid for empty string url" def test_url_validation(): """ test with valid URL """ schema = Schema({"url": Url()}) out_ = schema({"url": "http://example.com/"}) assert 'http://example.com/', out_.get("url") def test_url_validation_with_none(): """ test with invalid None url""" schema = Schema({"url": Url()}) try: schema({"url": None}) except MultipleInvalid as e: assert_equal(str(e), "expected a URL for dictionary value @ data['url']") else: assert False, "Did not raise Invalid for None url" def test_url_validation_with_empty_string(): """ test with empty string URL """ schema = Schema({"url": Url()}) try: schema({"url": ''}) except MultipleInvalid as e: assert_equal(str(e), "expected a URL for dictionary value @ data['url']") else: assert False, "Did not raise Invalid for empty string url" def test_url_validation_without_host(): """ test with empty host URL """ schema = Schema({"url": Url()}) try: schema({"url": 'http://'}) except MultipleInvalid as e: assert_equal(str(e), "expected a URL for dictionary value @ data['url']") else: assert False, "Did not raise Invalid for empty string url" def test_copy_dict_undefined(): """ test with a copied dictionary """ fields = { Required("foo"): int } copied_fields = copy.deepcopy(fields) schema = Schema(copied_fields) # This used to raise a `TypeError` because the instance of `Undefined` # was a copy, so object comparison would not work correctly. try: schema({"foo": "bar"}) except Exception as e: assert isinstance(e, MultipleInvalid) def test_sorting(): """ Expect alphabetic sorting """ foo = Required('foo') bar = Required('bar') items = [foo, bar] expected = [bar, foo] result = sorted(items) assert result == expected def test_schema_extend(): """Verify that Schema.extend copies schema keys from both.""" base = Schema({'a': int}, required=True) extension = {'b': str} extended = base.extend(extension) assert base.schema == {'a': int} assert extension == {'b': str} assert extended.schema == {'a': int, 'b': str} assert extended.required == base.required assert extended.extra == base.extra def test_schema_extend_overrides(): """Verify that Schema.extend can override required/extra parameters.""" base = Schema({'a': int}, required=True) extended = base.extend({'b': str}, required=False, extra=ALLOW_EXTRA) assert base.required is True assert base.extra == PREVENT_EXTRA assert extended.required is False assert extended.extra == ALLOW_EXTRA def test_schema_extend_key_swap(): """Verify that Schema.extend can replace keys, even when different markers are used""" base = Schema({Optional('a'): int}) extension = {Required('a'): int} extended = base.extend(extension) assert_equal(len(base.schema), 1) assert_true(isinstance(list(base.schema)[0], Optional)) assert_equal(len(extended.schema), 1) assert_true((list(extended.schema)[0], Required)) def test_subschema_extension(): """Verify that Schema.extend adds and replaces keys in a subschema""" base = Schema({'a': {'b': int, 'c': float}}) extension = {'d': str, 'a': {'b': str, 'e': int}} extended = base.extend(extension) assert_equal(base.schema, {'a': {'b': int, 'c': float}}) assert_equal(extension, {'d': str, 'a': {'b': str, 'e': int}}) assert_equal(extended.schema, {'a': {'b': str, 'c': float, 'e': int}, 'd': str}) def test_repr(): """Verify that __repr__ returns valid Python expressions""" match = Match('a pattern', msg='message') replace = Replace('you', 'I', msg='you and I') range_ = Range(min=0, max=42, min_included=False, max_included=False, msg='number not in range') coerce_ = Coerce(int, msg="moo") all_ = All('10', Coerce(int), msg='all msg') maybe_int = Maybe(int) assert_equal(repr(match), "Match('a pattern', msg='message')") assert_equal(repr(replace), "Replace('you', 'I', msg='you and I')") assert_equal( repr(range_), "Range(min=0, max=42, min_included=False, max_included=False, msg='number not in range')" ) assert_equal(repr(coerce_), "Coerce(int, msg='moo')") assert_equal(repr(all_), "All('10', Coerce(int, msg=None), msg='all msg')") assert_equal(repr(maybe_int), "Maybe(%s)" % str(int)) def test_list_validation_messages(): """ Make sure useful error messages are available """ def is_even(value): if value % 2: raise Invalid('%i is not even' % value) return value schema = Schema(dict(even_numbers=[All(int, is_even)])) try: schema(dict(even_numbers=[3])) except Invalid as e: assert_equal(len(e.errors), 1, e.errors) assert_equal(str(e.errors[0]), "3 is not even @ data['even_numbers'][0]") assert_equal(str(e), "3 is not even @ data['even_numbers'][0]") else: assert False, "Did not raise Invalid" def test_nested_multiple_validation_errors(): """ Make sure useful error messages are available """ def is_even(value): if value % 2: raise Invalid('%i is not even' % value) return value schema = Schema(dict(even_numbers=All([All(int, is_even)], Length(min=1)))) try: schema(dict(even_numbers=[3])) except Invalid as e: assert_equal(len(e.errors), 1, e.errors) assert_equal(str(e.errors[0]), "3 is not even @ data['even_numbers'][0]") assert_equal(str(e), "3 is not even @ data['even_numbers'][0]") else: assert False, "Did not raise Invalid" def test_humanize_error(): data = { 'a': 'not an int', 'b': [123] } schema = Schema({ 'a': int, 'b': [str] }) try: schema(data) except MultipleInvalid as e: assert_equal( humanize_error(data, e), "expected int for dictionary value @ data['a']. Got 'not an int'\n" "expected str @ data['b'][0]. Got 123" ) else: assert False, 'Did not raise MultipleInvalid' def test_fix_157(): s = Schema(All([Any('one', 'two', 'three')]), Length(min=1)) assert_equal(['one'], s(['one'])) assert_raises(MultipleInvalid, s, ['four']) def test_range_exlcudes_nan(): s = Schema(Range(min=0, max=10)) assert_raises(MultipleInvalid, s, float('nan')) def test_equal(): s = Schema(Equal(1)) s(1) assert_raises(Invalid, s, 2) s = Schema(Equal('foo')) s('foo') assert_raises(Invalid, s, 'bar') s = Schema(Equal([1, 2])) s([1, 2]) assert_raises(Invalid, s, []) assert_raises(Invalid, s, [1, 2, 3]) # Evaluates exactly, not through validators s = Schema(Equal(str)) assert_raises(Invalid, s, 'foo') def test_unordered(): # Any order is OK s = Schema(Unordered([2, 1])) s([2, 1]) s([1, 2]) # Amount of errors is OK assert_raises(Invalid, s, [2, 0]) assert_raises(MultipleInvalid, s, [0, 0]) # Different length is NOK assert_raises(Invalid, s, [1]) assert_raises(Invalid, s, [1, 2, 0]) assert_raises(MultipleInvalid, s, [1, 2, 0, 0]) # Other type than list or tuple is NOK assert_raises(Invalid, s, 'foo') assert_raises(Invalid, s, 10) # Validators are evaluated through as schemas s = Schema(Unordered([int, str])) s([1, '2']) s(['1', 2]) s = Schema(Unordered([{'foo': int}, []])) s([{'foo': 3}, []]) # Most accurate validators must be positioned on left s = Schema(Unordered([int, 3])) assert_raises(Invalid, s, [3, 2]) s = Schema(Unordered([3, int])) s([3, 2]) def test_maybe(): assert_raises(TypeError, Maybe, lambda x: x) s = Schema(Maybe(int)) assert s(1) == 1 assert s(None) is None assert_raises(Invalid, s, 'foo') def test_empty_list_as_exact(): s = Schema([]) assert_raises(Invalid, s, [1]) s([]) def test_empty_dict_as_exact(): # {} always evaluates as {} s = Schema({}) assert_raises(Invalid, s, {'extra': 1}) s = Schema({}, extra=ALLOW_EXTRA) # this should not be used assert_raises(Invalid, s, {'extra': 1}) # {...} evaluates as Schema({...}) s = Schema({'foo': int}) assert_raises(Invalid, s, {'foo': 1, 'extra': 1}) s = Schema({'foo': int}, extra=ALLOW_EXTRA) s({'foo': 1, 'extra': 1}) # dict matches {} or {...} s = Schema(dict) s({'extra': 1}) s({}) s = Schema(dict, extra=PREVENT_EXTRA) s({'extra': 1}) s({}) # nested {} evaluate as {} s = Schema({ 'inner': {} }, extra=ALLOW_EXTRA) assert_raises(Invalid, s, {'inner': {'extra': 1}}) s({}) s = Schema({ 'inner': Schema({}, extra=ALLOW_EXTRA) }) assert_raises(Invalid, s, {'inner': {'extra': 1}}) s({}) def test_schema_decorator_match_with_args(): @validate(int) def fn(arg): return arg fn(1) def test_schema_decorator_unmatch_with_args(): @validate(int) def fn(arg): return arg assert_raises(Invalid, fn, 1.0) def test_schema_decorator_match_with_kwargs(): @validate(arg=int) def fn(arg): return arg fn(1) def test_schema_decorator_unmatch_with_kwargs(): @validate(arg=int) def fn(arg): return arg assert_raises(Invalid, fn, 1.0) def test_schema_decorator_match_return_with_args(): @validate(int, __return__=int) def fn(arg): return arg fn(1) def test_schema_decorator_unmatch_return_with_args(): @validate(int, __return__=int) def fn(arg): return "hello" assert_raises(Invalid, fn, 1) def test_schema_decorator_match_return_with_kwargs(): @validate(arg=int, __return__=int) def fn(arg): return arg fn(1) def test_schema_decorator_unmatch_return_with_kwargs(): @validate(arg=int, __return__=int) def fn(arg): return "hello" assert_raises(Invalid, fn, 1) def test_schema_decorator_return_only_match(): @validate(__return__=int) def fn(arg): return arg fn(1) def test_schema_decorator_return_only_unmatch(): @validate(__return__=int) def fn(arg): return "hello" assert_raises(Invalid, fn, 1) def test_unicode_key_is_converted_to_utf8_when_in_marker(): """Verify that when using unicode key the 'u' prefix is not thrown in the exception""" schema = Schema({Required(u('q')): 1}) # Can't use nose's raises (because we need to access the raised # exception, nor assert_raises which fails with Python 2.6.9. try: schema({}) except Invalid as e: assert_equal(str(e), "required key not provided @ data['q']") def test_number_validation_with_string(): """ test with Number with string""" schema = Schema({"number": Number(precision=6, scale=2)}) try: schema({"number": 'teststr'}) except MultipleInvalid as e: assert_equal(str(e), "Value must be a number enclosed with string for dictionary value @ data['number']") else: assert False, "Did not raise Invalid for String" def test_unicode_key_is_converted_to_utf8_when_plain_text(): key = u('q') schema = Schema({key: int}) # Can't use nose's raises (because we need to access the raised # exception, nor assert_raises which fails with Python 2.6.9. try: schema({key: 'will fail'}) except Invalid as e: assert_equal(str(e), "expected int for dictionary value @ data['q']") def test_number_validation_with_invalid_precision_invalid_scale(): """ test with Number with invalid precision and scale""" schema = Schema({"number": Number(precision=6, scale=2)}) try: schema({"number": '123456.712'}) except MultipleInvalid as e: assert_equal(str(e), "Precision must be equal to 6, and Scale must be equal to 2 for dictionary value @ data['number']") else: assert False, "Did not raise Invalid for String" def test_number_validation_with_valid_precision_scale_yield_decimal_true(): """ test with Number with valid precision and scale""" schema = Schema({"number": Number(precision=6, scale=2, yield_decimal=True)}) out_ = schema({"number": '1234.00'}) assert_equal(float(out_.get("number")), 1234.00) def test_number_when_precision_scale_none_yield_decimal_true(): """ test with Number with no precision and scale""" schema = Schema({"number": Number(yield_decimal=True)}) out_ = schema({"number": '12345678901234'}) assert_equal(out_.get("number"), 12345678901234) def test_number_when_precision_none_n_valid_scale_case1_yield_decimal_true(): """ test with Number with no precision and valid scale case 1""" schema = Schema({"number": Number(scale=2, yield_decimal=True)}) out_ = schema({"number": '123456789.34'}) assert_equal(float(out_.get("number")), 123456789.34) def test_number_when_precision_none_n_valid_scale_case2_yield_decimal_true(): """ test with Number with no precision and valid scale case 2 with zero in decimal part""" schema = Schema({"number": Number(scale=2, yield_decimal=True)}) out_ = schema({"number": '123456789012.00'}) assert_equal(float(out_.get("number")), 123456789012.00) def test_to_utf8(): s = u('hello') assert_true(isinstance(to_utf8_py2(s), str)) def test_number_when_precision_none_n_invalid_scale_yield_decimal_true(): """ test with Number with no precision and invalid scale""" schema = Schema({"number": Number(scale=2, yield_decimal=True)}) try: schema({"number": '12345678901.234'}) except MultipleInvalid as e: assert_equal(str(e), "Scale must be equal to 2 for dictionary value @ data['number']") else: assert False, "Did not raise Invalid for String" def test_number_when_valid_precision_n_scale_none_yield_decimal_true(): """ test with Number with no precision and valid scale""" schema = Schema({"number": Number(precision=14, yield_decimal=True)}) out_ = schema({"number": '1234567.8901234'}) assert_equal(float(out_.get("number")), 1234567.8901234) def test_number_when_invalid_precision_n_scale_none_yield_decimal_true(): """ test with Number with no precision and invalid scale""" schema = Schema({"number": Number(precision=14, yield_decimal=True)}) try: schema({"number": '12345674.8901234'}) except MultipleInvalid as e: assert_equal(str(e), "Precision must be equal to 14 for dictionary value @ data['number']") else: assert False, "Did not raise Invalid for String" def test_number_validation_with_valid_precision_scale_yield_decimal_false(): """ test with Number with valid precision, scale and no yield_decimal""" schema = Schema({"number": Number(precision=6, scale=2, yield_decimal=False)}) out_ = schema({"number": '1234.00'}) assert_equal(out_.get("number"), '1234.00') def test_named_tuples_validate_as_tuples(): NT = collections.namedtuple('NT', ['a', 'b']) nt = NT(1, 2) t = (1, 2) Schema((int, int))(nt) Schema((int, int))(t) Schema(NT(int, int))(nt) Schema(NT(int, int))(t) def test_datetime(): schema = Schema({"datetime": Datetime()}) schema({"datetime": "2016-10-24T14:01:57.102152Z"}) assert_raises(MultipleInvalid, schema, {"datetime": "2016-10-24T14:01:57"}) def test_date(): schema = Schema({"date": Date()}) schema({"date": "2016-10-24"}) assert_raises(MultipleInvalid, schema, {"date": "2016-10-2"}) assert_raises(MultipleInvalid, schema, {"date": "2016-10-24Z"}) def test_ordered_dict(): if not hasattr(collections, 'OrderedDict'): # collections.OrderedDict was added in Python2.7; only run if present return schema = Schema({Number(): Number()}) # x, y pairs (for interpolation or something) data = collections.OrderedDict([(5.0, 3.7), (24.0, 8.7), (43.0, 1.5), (62.0, 2.1), (71.5, 6.7), (90.5, 4.1), (109.0, 3.9)]) out = schema(data) assert isinstance(out, collections.OrderedDict), 'Collection is no longer ordered' assert data.keys() == out.keys(), 'Order is not consistent'
{ "content_hash": "603925de09f9d0f92e54bfba6933d271", "timestamp": "", "source": "github", "line_count": 785, "max_line_length": 120, "avg_line_length": 30.947770700636944, "alnum_prop": 0.5983782003786944, "repo_name": "SimplyKnownAsG/voluptuous", "id": "6b320ef2ee3d1898467f318f9f9dfeb22f641079", "size": "24294", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "voluptuous/tests/tests.py", "mode": "33188", "license": "bsd-3-clause", "language": [ { "name": "Python", "bytes": "100571" }, { "name": "Shell", "bytes": "1758" } ], "symlink_target": "" }
<?xml version="1.0" encoding="UTF-8"?> <project version="4"> <component name="ProjectTasksOptions"> <TaskOptions isEnabled="true"> <option name="arguments" value="--no-color $FileName$" /> <option name="checkSyntaxErrors" value="true" /> <option name="description" value="Compiles .less files into .css files" /> <option name="exitCodeBehavior" value="ERROR" /> <option name="fileExtension" value="less" /> <option name="immediateSync" value="true" /> <option name="name" value="Less" /> <option name="output" value="$FileParentDir$/assets/css/$FileNameWithoutExtension$.css " /> <option name="outputFilters"> <array> <FilterInfo> <option name="description" value="lessc error format" /> <option name="name" value="lessc" /> <option name="regExp" value="$MESSAGE$$FILE_PATH$?:$LINE$:$COLUMN$" /> </FilterInfo> </array> </option> <option name="outputFromStdout" value="true" /> <option name="passParentEnvs" value="true" /> <option name="program" value="$USER_HOME$/AppData/Roaming/npm/lessc.cmd" /> <option name="scopeName" value="Project Files" /> <option name="trackOnlyRoot" value="true" /> <option name="workingDir" value="$FileDir$" /> <envs /> </TaskOptions> </component> </project>
{ "content_hash": "9c3f39ea51797a09b61c62e01d53c2a6", "timestamp": "", "source": "github", "line_count": 31, "max_line_length": 97, "avg_line_length": 44.32258064516129, "alnum_prop": 0.6135371179039302, "repo_name": "SebastianCorrea96/SebastianCorrea96.github.io", "id": "d7750ffa19b63e1da2d8a1ff57e29846dba2ca4d", "size": "1374", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": ".idea/watcherTasks.xml", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "CSS", "bytes": "134485" }, { "name": "HTML", "bytes": "11703" }, { "name": "JavaScript", "bytes": "43232" }, { "name": "PHP", "bytes": "1097" } ], "symlink_target": "" }
<%# Copyright 2013-2018 the original author or authors from the JHipster project. This file is part of the JHipster project, see http://www.jhipster.tech/ for more information. 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 <%=packageName%>.security.jwt; import <%=packageName%>.security.AuthoritiesConstants; import <%=packageName%>.security.DomainUser; import io.github.jhipster.config.JHipsterProperties; import io.jsonwebtoken.Jwts; import io.jsonwebtoken.SignatureAlgorithm; import org.junit.Before; import org.junit.Test; import org.mockito.Mockito; import org.springframework.security.authentication.UsernamePasswordAuthenticationToken; import org.springframework.security.core.Authentication; import org.springframework.security.core.GrantedAuthority; import org.springframework.security.core.authority.SimpleGrantedAuthority; import org.springframework.test.util.ReflectionTestUtils; import java.util.ArrayList; import java.util.Collection; import java.util.Date; import static org.assertj.core.api.Assertions.assertThat; public class TokenProviderTest { private final String secretKey = "e5c9ee274ae87bc031adda32e27fa98b9290da83"; private final long ONE_MINUTE = 60000; private JHipsterProperties jHipsterProperties; private TokenProvider tokenProvider; @Before public void setup() { jHipsterProperties = Mockito.mock(JHipsterProperties.class); tokenProvider = new TokenProvider(jHipsterProperties); ReflectionTestUtils.setField(tokenProvider, "secretKey", secretKey); ReflectionTestUtils.setField(tokenProvider, "tokenValidityInMilliseconds", ONE_MINUTE); } @Test public void testReturnFalseWhenJWThasInvalidSignature() { boolean isTokenValid = tokenProvider.validateToken(createTokenWithDifferentSignature()); assertThat(isTokenValid).isEqualTo(false); } @Test public void testReturnFalseWhenJWTisMalformed() { Authentication authentication = createAuthentication(); String token = tokenProvider.createToken(authentication, false); String invalidToken = token.substring(1); boolean isTokenValid = tokenProvider.validateToken(invalidToken); assertThat(isTokenValid).isEqualTo(false); } @Test public void testReturnFalseWhenJWTisExpired() { ReflectionTestUtils.setField(tokenProvider, "tokenValidityInMilliseconds", -ONE_MINUTE); Authentication authentication = createAuthentication(); String token = tokenProvider.createToken(authentication, false); boolean isTokenValid = tokenProvider.validateToken(token); assertThat(isTokenValid).isEqualTo(false); } @Test public void testReturnFalseWhenJWTisUnsupported() { String unsupportedToken = createUnsupportedToken(); boolean isTokenValid = tokenProvider.validateToken(unsupportedToken); assertThat(isTokenValid).isEqualTo(false); } @Test public void testReturnFalseWhenJWTisInvalid() { boolean isTokenValid = tokenProvider.validateToken(""); assertThat(isTokenValid).isEqualTo(false); } private Authentication createAuthentication() { Collection<GrantedAuthority> authorities = new ArrayList<>(); authorities.add(new SimpleGrantedAuthority(AuthoritiesConstants.ANONYMOUS)); DomainUser user = new DomainUser(null, "anonymous", "none", authorities, null); return new UsernamePasswordAuthenticationToken(user, "anonymous", authorities); } private String createUnsupportedToken() { return Jwts.builder() .setPayload("payload") .signWith(SignatureAlgorithm.HS512, secretKey) .compact(); } private String createTokenWithDifferentSignature() { return Jwts.builder() .setSubject("anonymous") .signWith(SignatureAlgorithm.HS512, "e5c9ee274ae87bc031adda32e27fa98b9290da90") .setExpiration(new Date(new Date().getTime() + ONE_MINUTE)) .compact(); } }
{ "content_hash": "cb6283e05a57e8171a1678a9e69ff2c2", "timestamp": "", "source": "github", "line_count": 122, "max_line_length": 96, "avg_line_length": 37.18032786885246, "alnum_prop": 0.7442680776014109, "repo_name": "gzsombor/generator-jhipster", "id": "67f6e0ae6aee401dfc2a1091b1e8302b69af6ccc", "size": "4536", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "generators/server/templates/src/test/java/package/security/jwt/_TokenProviderTest.java", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Batchfile", "bytes": "5006" }, { "name": "CSS", "bytes": "87823" }, { "name": "Gherkin", "bytes": "175" }, { "name": "HTML", "bytes": "439866" }, { "name": "Java", "bytes": "1080189" }, { "name": "JavaScript", "bytes": "1348897" }, { "name": "Scala", "bytes": "7783" }, { "name": "Shell", "bytes": "37802" }, { "name": "TypeScript", "bytes": "630905" } ], "symlink_target": "" }
namespace base { const SyncSocket::Handle SyncSocket::kInvalidHandle = kInvalidPlatformFile; SyncSocket::SyncSocket() = default; SyncSocket::SyncSocket(Handle handle) : handle_(handle) {} SyncSocket::SyncSocket(ScopedHandle handle) : handle_(std::move(handle)) {} SyncSocket::~SyncSocket() = default; SyncSocket::ScopedHandle SyncSocket::Take() { return std::move(handle_); } CancelableSyncSocket::CancelableSyncSocket() = default; CancelableSyncSocket::CancelableSyncSocket(Handle handle) : SyncSocket(handle) {} CancelableSyncSocket::CancelableSyncSocket(ScopedHandle handle) : SyncSocket(std::move(handle)) {} } // namespace base
{ "content_hash": "f970f2e82e2d6680f6543a08f7ab8ed1", "timestamp": "", "source": "github", "line_count": 25, "max_line_length": 75, "avg_line_length": 26.16, "alnum_prop": 0.7599388379204893, "repo_name": "nwjs/chromium.src", "id": "8ed46ae811c08e1257dcb54f39b5405b08f4d702", "size": "829", "binary": false, "copies": "10", "ref": "refs/heads/nw70", "path": "base/sync_socket.cc", "mode": "33188", "license": "bsd-3-clause", "language": [], "symlink_target": "" }
import {SelectorMatcher} from "angular2/src/core/compiler/selector"; import {CssSelector} from "angular2/src/core/compiler/selector"; import {StringWrapper, Math} from 'angular2/src/facade/lang'; import {ListWrapper} from 'angular2/src/facade/collection'; import {getIntParameter, bindAction} from 'angular2/src/test_lib/benchmark_util'; import {BrowserDomAdapter} from 'angular2/src/dom/browser_adapter'; export function main() { BrowserDomAdapter.makeCurrent(); var count = getIntParameter('selectors'); var fixedMatcher; var fixedSelectorStrings = []; var fixedSelectors = []; for (var i=0; i<count; i++) { ListWrapper.push(fixedSelectorStrings, randomSelector()); } for (var i=0; i<count; i++) { ListWrapper.push(fixedSelectors, CssSelector.parse(fixedSelectorStrings[i])); } fixedMatcher = new SelectorMatcher(); for (var i=0; i<count; i++) { fixedMatcher.addSelectable(fixedSelectors[i], i); } function parse() { var result = []; for (var i=0; i<count; i++) { ListWrapper.push(result, CssSelector.parse(fixedSelectorStrings[i])); } return result; } function addSelectable() { var matcher = new SelectorMatcher(); for (var i=0; i<count; i++) { matcher.addSelectable(fixedSelectors[i], i); } return matcher; } function match() { var matchCount = 0; for (var i=0; i<count; i++) { fixedMatcher.match(fixedSelectors[i], (selector, selected) => { matchCount += selected; }); } return matchCount; } bindAction('#parse', parse); bindAction('#addSelectable', addSelectable); bindAction('#match', match); } function randomSelector() { var res = randomStr(5); for (var i=0; i<3; i++) { res += '.'+randomStr(5); } for (var i=0; i<3; i++) { res += '['+randomStr(3)+'='+randomStr(6)+']'; } return res; } function randomStr(len){ var s = ''; while (s.length < len) { s += randomChar(); } return s; } function randomChar(){ var n = randomNum(62); if(n<10) return n.toString(); //1-10 if(n<36) return StringWrapper.fromCharCode(n+55); //A-Z return StringWrapper.fromCharCode(n+61); //a-z } function randomNum(max) { return Math.floor(Math.random() * max); }
{ "content_hash": "a70a35048f80e49033354ab4abe32e62", "timestamp": "", "source": "github", "line_count": 85, "max_line_length": 81, "avg_line_length": 26.270588235294117, "alnum_prop": 0.6502463054187192, "repo_name": "caitp/angular", "id": "846b1885fedb83b29adc0037e96d919c24d3629d", "size": "2233", "binary": false, "copies": "3", "ref": "refs/heads/master", "path": "modules/benchmarks/src/compiler/selector_benchmark.js", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Dart", "bytes": "98005" }, { "name": "HTML", "bytes": "26516" }, { "name": "JavaScript", "bytes": "285774" }, { "name": "Shell", "bytes": "11168" } ], "symlink_target": "" }
// ---------------------- // xTask Framework // ---------------------- // Copyright (c) Jeremy W. Kuhne. All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for full license information. namespace XTask.Tests.Logging { using System; using FluentAssertions; using NSubstitute; using XTask.Logging; using Xunit; public class AggregatedLoggerTests { public abstract class TestLogger : Logger { protected override void WriteInternal(WriteStyle style, string value) { this.TestWriteInternal(style, value); } public void TestWriteInternal(WriteStyle style, string value) { } } [Fact] public void NullConstructorShouldThrow() { Action action = () => new AggregatedLogger(null); action.Should().Throw<ArgumentNullException>(); } [Fact] public void EmptyArrayShouldNotThow() { AggregatedLogger logger = new AggregatedLogger(new ILogger[0]); logger.Write("Foo"); } [Fact] public void AllLoggersShouldLog() { TestLogger loggerOne = Substitute.ForPartsOf<TestLogger>(); TestLogger loggerTwo = Substitute.ForPartsOf<TestLogger>(); AggregatedLogger logger = new AggregatedLogger(loggerOne, loggerTwo); logger.Write("Foo"); ITable table = Table.Create(1); logger.Write(table); loggerOne.Received(1).TestWriteInternal(WriteStyle.Current, "Foo"); loggerTwo.Received(1).TestWriteInternal(WriteStyle.Current, "Foo"); loggerOne.Received(1).Write(table); loggerTwo.Received(1).Write(table); } } }
{ "content_hash": "023970144b64530f5809006e371b0103", "timestamp": "", "source": "github", "line_count": 61, "max_line_length": 101, "avg_line_length": 30.131147540983605, "alnum_prop": 0.5826985854189336, "repo_name": "JeremyKuhne/XTask", "id": "ba7f2b13829219d94e41808d738476844613dbf5", "size": "1840", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "src/Tests/Logging/AggregatedLoggerTests.cs", "mode": "33188", "license": "mit", "language": [ { "name": "C#", "bytes": "590914" } ], "symlink_target": "" }
 namespace WhoSol.Contracts { public class BootstrapperStartInfo { public string ServiceName { get; set; } public string[] Dependencies { get; set; } public string LogFile { get; set; } public bool ConsoleLog { get; set; } public bool EventLog { get; set; } public string ServiceDescription { get; set; } public string ServiceDisplayName { get; set; } } }
{ "content_hash": "8a2388d6712bb40701206277fffe46af", "timestamp": "", "source": "github", "line_count": 20, "max_line_length": 54, "avg_line_length": 21.55, "alnum_prop": 0.6078886310904872, "repo_name": "whosol/AppBootstrap", "id": "d329d05a1e3ff880702578f8c4e90f2a2a56f350", "size": "433", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "WhoSol.Contracts/BootstrapperStartInfo.cs", "mode": "33188", "license": "mit", "language": [ { "name": "C#", "bytes": "77155" } ], "symlink_target": "" }
import unittest from django.test import TestCase from django.test.client import Client from django.contrib.auth.models import User from django.core.urlresolvers import reverse from onadata.apps.main.views import profile class TestUserProfile(TestCase): def setup(self): self.client = Client() self.assertEqual(len(User.objects.all()), 0) def _login_user_and_profile(self, extra_post_data={}): post_data = { 'username': 'bob', 'first_name': 'edu', 'last_name': 'edu', 'password1': 'bobbobll', 'password2': 'bobbobll', } url = '/fieldsight/activaterole/MTA2/Qk0ReAETfwvKzLlA3C3S5CA5aXCcnIeG/' post_data = dict(post_data.items() + extra_post_data.items()) self.response = self.client.post(url, post_data) try: self.user = User.objects.get(username=post_data['username']) except User.DoesNotExist: pass def test_create_user_with_given_name(self): self._login_user_and_profile() self.assertEqual(self.response.status_code, 302) self.assertEqual(self.user.username, 'bob') # def test_create_user_profile_for_user(self): # self._login_user_and_profile() # self.assertEqual(self.response.status_code, 302) # user_profile = self.user.profile # self.assertEqual(user_profile.city, 'Bobville') # self.assertTrue(hasattr(user_profile, 'metadata')) def test_disallow_non_alpha_numeric(self): invalid_usernames = [ 'b ob', 'b.o.b.', 'b-ob', 'b!', '@bob', '[email protected]', 'bob$', 'b&o&b', 'bob?', '#bob', '(bob)', 'b*ob', '%s % bob', ] users_before = User.objects.count() for username in invalid_usernames: self._login_user_and_profile({'username': username}) self.assertEqual(User.objects.count(), users_before) # def test_disallow_reserved_name(self): # users_before = User.objects.count() # self._login_user_and_profile({'username': 'admin'}) # self.assertEqual(User.objects.count(), users_before) # def test_404_if_user_does_not_exist(self): # response = self.client.get(reverse(profile, # kwargs={'username': 'nonuser'})) # self.assertEqual(response.status_code, 404) # @unittest.skip("We don't use twitter in kobocat tests") # def test_show_single_at_sign_in_twitter_link(self): # self._login_user_and_profile() # response = self.client.get( # reverse(profile, kwargs={ # 'username': "bob" # })) # self.assertContains(response, ">@boberama") # # add the @ sign # self.user.profile.twitter = "@boberama" # self.user.profile.save() # response = self.client.get( # reverse(profile, kwargs={ # 'username': "bob" # })) # self.assertContains(response, ">@boberama")
{ "content_hash": "ee68b3b3f5671990e9ad00e3f8607fe7", "timestamp": "", "source": "github", "line_count": 91, "max_line_length": 79, "avg_line_length": 34.7032967032967, "alnum_prop": 0.5595313489550349, "repo_name": "awemulya/fieldsight-kobocat", "id": "a924d9c7b32847e14dd7894b8d2f406387b7b23b", "size": "3158", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "onadata/apps/fieldsight/tests/test_user_profile.py", "mode": "33188", "license": "bsd-2-clause", "language": [ { "name": "CSS", "bytes": "70153" }, { "name": "Dockerfile", "bytes": "2462" }, { "name": "HTML", "bytes": "1488442" }, { "name": "JavaScript", "bytes": "674757" }, { "name": "Makefile", "bytes": "2286" }, { "name": "Python", "bytes": "5340355" }, { "name": "Shell", "bytes": "16493" } ], "symlink_target": "" }
package com.google.cloud.teleport.v2.templates; import com.google.cloud.teleport.metadata.Template; import com.google.cloud.teleport.metadata.TemplateCategory; import com.google.cloud.teleport.metadata.TemplateParameter; import com.google.cloud.teleport.v2.cdc.sources.DataStreamIO; import com.google.cloud.teleport.v2.io.CdcJdbcIO; import com.google.cloud.teleport.v2.templates.DataStreamToSQL.Options; import com.google.cloud.teleport.v2.transforms.CreateDml; import com.google.cloud.teleport.v2.transforms.ProcessDml; import com.google.cloud.teleport.v2.values.DmlInfo; import com.google.cloud.teleport.v2.values.FailsafeElement; import com.google.common.base.Splitter; import java.sql.SQLException; import java.util.HashMap; import java.util.Map; import org.apache.beam.sdk.Pipeline; import org.apache.beam.sdk.PipelineResult; import org.apache.beam.sdk.options.Default; import org.apache.beam.sdk.options.PipelineOptions; import org.apache.beam.sdk.options.PipelineOptionsFactory; import org.apache.beam.sdk.options.StreamingOptions; import org.apache.beam.sdk.values.KV; import org.apache.beam.sdk.values.PCollection; import org.slf4j.Logger; import org.slf4j.LoggerFactory; /** * This pipeline ingests DataStream data from GCS. The data is then cleaned and converted from JSON * objects into DML statements. The DML is applied to the desired target database, which can be one * of MySQL or POstgreSQL. Replication maintains a 1:1 match between source and target by default. * No DDL is supported in the current version of this pipeline. * * <p>NOTE: Future versiosn will support: Pub/Sub, GCS, or Kafka as per DataStream * * <p>Example Usage: TODO: FIX EXMAPLE USAGE * * <pre> * mvn compile exec:java \ * -Dexec.mainClass=com.google.cloud.teleport.templates.${PIPELINE_NAME} \ * -Dexec.cleanupDaemonThreads=false \ * -Dexec.args=" \ * --project=${PROJECT_ID} \ * --stagingLocation=gs://${PROJECT_ID}/dataflow/pipelines/${PIPELINE_FOLDER}/staging \ * --tempLocation=gs://${PROJECT_ID}/dataflow/pipelines/${PIPELINE_FOLDER}/temp \ * --templateLocation=gs://$BUCKET_NAME/templates/${PIPELINE_NAME}.json \ * --gcsPubSubSubscription="projects/<project-id>/subscriptions/<subscription-name>" \ * --inputFilePattern=${GCS_AVRO_FILE_PATTERN} \ * --outputProjectId=${OUTPUT_PROJECT_ID} \ * --runner=(DirectRunner|DataflowRunner)" * * OPTIONAL Dataflow Params: * --autoscalingAlgorithm=THROUGHPUT_BASED \ * --numWorkers=2 \ * --maxNumWorkers=10 \ * --workerMachineType=n1-highcpu-4 \ * </pre> */ @Template( name = "Cloud_Datastream_to_SQL", category = TemplateCategory.STREAMING, displayName = "Datastream to SQL", description = "Streaming pipeline. Ingests messages from a stream in Cloud Datastream, transforms them, and writes them to a set of pre-defined Postgres tables.", optionsClass = Options.class, flexContainerName = "datastream-to-sql", contactInformation = "https://cloud.google.com/support") public class DataStreamToSQL { private static final Logger LOG = LoggerFactory.getLogger(DataStreamToSQL.class); private static final String AVRO_SUFFIX = "avro"; private static final String JSON_SUFFIX = "json"; /** * Options supported by the pipeline. * * <p>Inherits standard configuration options. */ public interface Options extends PipelineOptions, StreamingOptions { @TemplateParameter.Text( order = 1, description = "File location for Datastream file input in Cloud Storage.", helpText = "This is the file location for Datastream file input in Cloud Storage. Normally, this will be gs://${BUCKET}/${ROOT_PATH}/.") String getInputFilePattern(); void setInputFilePattern(String value); @TemplateParameter.PubsubSubscription( order = 2, optional = true, description = "The Pub/Sub subscription being used in a Cloud Storage notification policy.", helpText = "The Pub/Sub subscription being used in a Cloud Storage notification policy. " + "The name should be in the format of projects/<project-id>/subscriptions/<subscription-name>.") String getGcsPubSubSubscription(); void setGcsPubSubSubscription(String value); @TemplateParameter.Enum( order = 3, enumOptions = {"avro", "json"}, optional = true, description = "Datastream output file format (avro/json).", helpText = "This is the format of the output file produced by Datastream. by default this will be avro.") @Default.String("avro") String getInputFileFormat(); void setInputFileFormat(String value); @TemplateParameter.Text( order = 4, optional = true, description = "Name or template for the stream to poll for schema information.", helpText = "This is the name or template for the stream to poll for schema information. Default is {_metadata_stream}. The default value is enough under most conditions.") String getStreamName(); void setStreamName(String value); @TemplateParameter.DateTime( order = 5, optional = true, description = "The starting DateTime used to fetch from Cloud Storage " + "(https://tools.ietf.org/html/rfc3339).", helpText = "The starting DateTime used to fetch from Cloud Storage " + "(https://tools.ietf.org/html/rfc3339).") @Default.String("1970-01-01T00:00:00.00Z") String getRfcStartDateTime(); void setRfcStartDateTime(String value); // DataStream API Root Url (only used for testing) @TemplateParameter.Text( order = 6, optional = true, description = "Datastream API Root URL (only required for testing)", helpText = "Datastream API Root URL") @Default.String("https://datastream.googleapis.com/") String getDataStreamRootUrl(); void setDataStreamRootUrl(String value); // SQL Connection Parameters @TemplateParameter.Enum( order = 7, optional = true, enumOptions = {"postgres", "mysql"}, description = "SQL Database Type (postgres or mysql).", helpText = "The database type to write to (for example, Postgres).") @Default.String("postgres") String getDatabaseType(); void setDatabaseType(String value); @TemplateParameter.Text( order = 8, description = "Database Host to connect on.", helpText = "Database Host to connect on.") String getDatabaseHost(); void setDatabaseHost(String value); @TemplateParameter.Text( order = 9, optional = true, description = "Database Port to connect on.", helpText = "Database Port to connect on (default 5432).") @Default.String("5432") String getDatabasePort(); void setDatabasePort(String value); @TemplateParameter.Text( order = 10, description = "Database User to connect with.", helpText = "Database User to connect with.") String getDatabaseUser(); void setDatabaseUser(String value); @TemplateParameter.Password( order = 11, description = "Database Password for given user.", helpText = "Database Password for given user.") String getDatabasePassword(); void setDatabasePassword(String value); @TemplateParameter.Text( order = 12, optional = true, description = "SQL Database Name.", helpText = "The database name to connect to.") @Default.String("postgres") String getDatabaseName(); void setDatabaseName(String value); @TemplateParameter.Text( order = 13, optional = true, description = "A map of key/values used to dictate schema name changes", helpText = "A map of key/values used to dictate schema name changes (ie. old_name:new_name,CaseError:case_error)") @Default.String("") String getSchemaMap(); void setSchemaMap(String value); @TemplateParameter.Text( order = 14, optional = true, description = "Custom connection string.", helpText = "Optional connection string which will be used instead of the default database string.") @Default.String("") String getCustomConnectionString(); void setCustomConnectionString(String value); } /** * Main entry point for executing the pipeline. * * @param args The command-line arguments to the pipeline. */ public static void main(String[] args) { LOG.info("Starting Datastream to SQL"); Options options = PipelineOptionsFactory.fromArgs(args).withValidation().as(Options.class); options.setStreaming(true); run(options); } /** * Build the DataSourceConfiguration for the target SQL database. Using the pipeline options, * determine the database type and create the correct jdbc connection for the requested DB. * * @param options The execution parameters to the pipeline. */ public static CdcJdbcIO.DataSourceConfiguration getDataSourceConfiguration(Options options) { String jdbcDriverName; String jdbcDriverConnectionString; switch (options.getDatabaseType()) { case "postgres": jdbcDriverName = "org.postgresql.Driver"; jdbcDriverConnectionString = String.format( "jdbc:postgresql://%s:%s/%s", options.getDatabaseHost(), options.getDatabasePort(), options.getDatabaseName()); break; case "mysql": jdbcDriverName = "com.mysql.cj.jdbc.Driver"; jdbcDriverConnectionString = String.format( "jdbc:mysql://%s:%s/%s", options.getDatabaseHost(), options.getDatabasePort(), options.getDatabaseName()); break; default: throw new IllegalArgumentException( String.format("Database Type %s is not supported.", options.getDatabaseType())); } if (!options.getCustomConnectionString().isEmpty()) { jdbcDriverConnectionString = options.getCustomConnectionString(); } CdcJdbcIO.DataSourceConfiguration dataSourceConfiguration = CdcJdbcIO.DataSourceConfiguration.create(jdbcDriverName, jdbcDriverConnectionString) .withUsername(options.getDatabaseUser()) .withPassword(options.getDatabasePassword()) .withMaxIdleConnections(new Integer(0)); return dataSourceConfiguration; } /** * Validate the options supplied match expected values. We will also validate that connectivity is * working correctly for the target SQL database. * * @param options The execution parameters to the pipeline. * @param dataSourceConfiguration The JDBC datasource configuration. */ public static void validateOptions( Options options, CdcJdbcIO.DataSourceConfiguration dataSourceConfiguration) { try { if (options.getDatabaseHost() != null) { dataSourceConfiguration.buildDatasource().getConnection().close(); } } catch (SQLException e) { throw new IllegalArgumentException(e); } } /** Parse the SchemaMap config which allows key:value pairs of column naming configs. */ public static Map<String, String> parseSchemaMap(String schemaMapString) { if (schemaMapString == null || schemaMapString.equals("")) { return new HashMap<>(); } return Splitter.on(",").withKeyValueSeparator(":").split(schemaMapString); } /** * Runs the pipeline with the supplied options. * * @param options The execution parameters to the pipeline. * @return The result of the pipeline execution. */ public static PipelineResult run(Options options) { /* * Stages: * 1) Ingest and Normalize Data to FailsafeElement with JSON Strings * 2) Write JSON Strings to SQL DML Objects * 3) Filter stale rows using stateful PK transform * 4) Write DML statements to SQL Database via jdbc */ Pipeline pipeline = Pipeline.create(options); CdcJdbcIO.DataSourceConfiguration dataSourceConfiguration = getDataSourceConfiguration(options); validateOptions(options, dataSourceConfiguration); Map<String, String> schemaMap = parseSchemaMap(options.getSchemaMap()); /* * Stage 1: Ingest and Normalize Data to FailsafeElement with JSON Strings * a) Read DataStream data from GCS into JSON String FailsafeElements (datastreamJsonRecords) */ PCollection<FailsafeElement<String, String>> datastreamJsonRecords = pipeline.apply( new DataStreamIO( options.getStreamName(), options.getInputFilePattern(), options.getInputFileFormat(), options.getGcsPubSubSubscription(), options.getRfcStartDateTime()) .withLowercaseSourceColumns() .withRenameColumnValue("_metadata_row_id", "rowid") .withHashRowId()); /* * Stage 2: Write JSON Strings to SQL Insert Strings * a) Convert JSON String FailsafeElements to TableRow's (tableRowRecords) * Stage 3) Filter stale rows using stateful PK transform */ PCollection<KV<String, DmlInfo>> dmlStatements = datastreamJsonRecords .apply("Format to DML", CreateDml.of(dataSourceConfiguration).withSchemaMap(schemaMap)) .apply("DML Stateful Processing", ProcessDml.statefulOrderByPK()); /* * Stage 4: Write Inserts to CloudSQL */ dmlStatements.apply( "Write to SQL", CdcJdbcIO.<KV<String, DmlInfo>>write() .withDataSourceConfiguration(dataSourceConfiguration) .withStatementFormatter( new CdcJdbcIO.StatementFormatter<KV<String, DmlInfo>>() { public String formatStatement(KV<String, DmlInfo> element) { LOG.debug("Executing SQL: {}", element.getValue().getDmlSql()); return element.getValue().getDmlSql(); } })); // Execute the pipeline and return the result. return pipeline.run(); } }
{ "content_hash": "3b8d60877960ff6086a05f30ceb06fb0", "timestamp": "", "source": "github", "line_count": 375, "max_line_length": 172, "avg_line_length": 37.72266666666667, "alnum_prop": 0.67990951505726, "repo_name": "GoogleCloudPlatform/DataflowTemplates", "id": "7fbb65298113a669687ab8b0dfca07f86ec324e7", "size": "14741", "binary": false, "copies": "1", "ref": "refs/heads/main", "path": "v2/datastream-to-sql/src/main/java/com/google/cloud/teleport/v2/templates/DataStreamToSQL.java", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Dockerfile", "bytes": "925" }, { "name": "Go", "bytes": "27054" }, { "name": "Java", "bytes": "7597644" }, { "name": "JavaScript", "bytes": "16798" }, { "name": "PureBasic", "bytes": "35" }, { "name": "Python", "bytes": "10437" } ], "symlink_target": "" }
"""Django settings for FinSL-signbank, base settings shared by all settings files.""" from __future__ import unicode_literals from __future__ import print_function import os import sys from django.utils.translation import ugettext_lazy as _ try: # settings_secret.py is imported in this settings file, you should put the sensitive information in that file. from signbank.settings.settings_secret import * except ImportError: print('Unable to import settings_secret.py. Create one from settings_secret.py.template.', file=sys.stderr) # Unable to import SECRET_KEY from settings_secret. SECRET_KEY = 'INSERT_$$$$_YOUR_%%%%_SECRET_@@@@_KEY_%%%%%%_HERE' # Absolute path to the base directory of the application. BASE_DIR = os.path.abspath(os.path.dirname(os.path.dirname(__file__))) # Path to the project directory. PROJECT_DIR = os.path.dirname(BASE_DIR) # Sets the field to automatically use for model primary key DEFAULT_AUTO_FIELD = 'django.db.models.AutoField' # A list in the same format as ADMINS that specifies who should get broken link notifications # when BrokenLinkEmailsMiddleware is enabled. ADMINS are set in secret_settings. try: MANAGERS = ADMINS except NameError: MANAGERS = (("", ""),) #: A string representing the time zone for this installation. TIME_ZONE = 'Europe/Helsinki' #: A string representing the language code for this installation. This should be in standard language ID format. #: For example, U.S. English is "en-us". LANGUAGE_CODE = 'fi' # The ID, as an integer, of the current site in the django_site database table. SITE_ID = 1 #: A boolean that specifies whether Django's translation system should be enabled. USE_I18N = True #: A boolean that specifies if localized formatting of data will be enabled by default or not. USE_L10N = True #: A boolean that specifies if datetimes will be timezone-aware by default or not. USE_TZ = True #: A list of all available languages. #: The list is a list of two-tuples in the format (language code, language name) - for example, ('ja', 'Japanese'). LANGUAGES = ( ('fi', _('Finnish')), ('en', _('English')), ) # URL to use when referring to static files located in STATIC_ROOT. # Example: "/static/" or "http://static.example.com/" STATIC_URL = '/static/' #: The list of finder backends that know how to find static files in various locations. STATICFILES_FINDERS = ( 'django.contrib.staticfiles.finders.FileSystemFinder', 'django.contrib.staticfiles.finders.AppDirectoriesFinder', ) #: A list of middleware classes to use. The order of middleware classes is critical! MIDDLEWARE = [ # If want to use some of the HTTPS settings in secret_settings, enable SecurityMiddleware #'django.middleware.security.SecurityMiddleware', 'django.contrib.sessions.middleware.SessionMiddleware', 'django.middleware.locale.LocaleMiddleware', 'django.middleware.common.CommonMiddleware', 'django.middleware.csrf.CsrfViewMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware', 'django.contrib.messages.middleware.MessageMiddleware', 'django.middleware.clickjacking.XFrameOptionsMiddleware', 'reversion.middleware.RevisionMiddleware', ] TEMPLATES = [ { 'BACKEND': 'django.template.backends.django.DjangoTemplates', 'DIRS': [ # insert your TEMPLATE_DIRS here os.path.join(PROJECT_DIR, 'templates'), ], 'APP_DIRS': True, 'OPTIONS': { 'context_processors': [ # Insert your TEMPLATE_CONTEXT_PROCESSORS here 'django.template.context_processors.debug', 'django.template.context_processors.request', 'django.contrib.auth.context_processors.auth', 'django.contrib.messages.context_processors.messages', 'django.template.context_processors.i18n', 'django.template.context_processors.media', 'django.template.context_processors.static', 'django.template.context_processors.tz', 'django.template.context_processors.csrf', ], }, }, ] #: A list of authentication backend classes (as strings) to use when attempting to authenticate a user. AUTHENTICATION_BACKENDS = ( "django.contrib.auth.backends.ModelBackend", "guardian.backends.ObjectPermissionBackend", ) # A list of IP addresses, as strings: Allow the debug() context processor to add some variables to the template context. INTERNAL_IPS = ('127.0.0.1',) # A string representing the full Python import path to your root URLconf. For example: "mydjangoapps.urls". ROOT_URLCONF = 'signbank.urls' # The full Python path of the WSGI application object that Django's built-in servers (e.g. runserver) will use. WSGI_APPLICATION = 'signbank.wsgi.application' #: A list of strings designating all applications that are enabled in this Django installation. #: Dotted Python path to: an application configuration class (preferred), or a package containing an application. #: The order of the apps matter! INSTALLED_APPS = ( 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.sites', 'django.contrib.messages', 'modeltranslation', 'django.contrib.admin', 'django.contrib.admindocs', 'django.contrib.staticfiles', 'bootstrap3', 'django_summernote', 'signbank.dictionary', 'django.contrib.flatpages', 'signbank.contentpages', 'signbank.video', 'reversion', 'tagging', 'django_comments', 'guardian', 'notifications', 'django.contrib.sitemaps', ) ABSOLUTE_URL_OVERRIDES = { #: Allow using admin change url for notifications. 'auth.user': lambda user: "/admin/auth/user/%s/change/" % user.id, } #: Location for upload of videos relative to MEDIA_ROOT, videos are stored here prior to copying over to the main #: storage location VIDEO_UPLOAD_LOCATION = "upload" #: How many days a user has until activation time expires. Django-registration related setting. ACCOUNT_ACTIVATION_DAYS = 7 #: A boolean indicating whether registration of new accounts is currently permitted. REGISTRATION_OPEN = True #: The URL where requests are redirected after login when the contrib.auth.login view gets no next parameter. LOGIN_REDIRECT_URL = '/' # For django-tagging: force tags to be lowercase. FORCE_LOWERCASE_TAGS = True import mimetypes mimetypes.add_type("video/mp4", ".mov", True) mimetypes.add_type("video/webm", ".webm", True)
{ "content_hash": "e07e16ae455870909778bc1693d7c970", "timestamp": "", "source": "github", "line_count": 167, "max_line_length": 120, "avg_line_length": 39.10179640718563, "alnum_prop": 0.7134762633996937, "repo_name": "Signbank/FinSL-signbank", "id": "1339410ffe0fa10aa46c79c519e9a589e678e815", "size": "6555", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "signbank/settings/base.py", "mode": "33188", "license": "bsd-3-clause", "language": [ { "name": "CSS", "bytes": "12092" }, { "name": "HTML", "bytes": "176387" }, { "name": "JavaScript", "bytes": "52483" }, { "name": "Python", "bytes": "325852" } ], "symlink_target": "" }
static int check_failures = 0; #define CHECK(cond) do { \ if (!(cond)) { \ puts("Check failed: " #cond); \ ++check_failures; \ } \ } while (0) // We need to do some "namespace" magic to be able to include both <asm/stat.h> // and <sys/stat.h>, which normally are mutually exclusive. // This is currently the only reason why this test has to be compiled as // C++ code. namespace linux_syscall_support { #include <asm/stat.h> } #include <sys/stat.h> namespace linux_syscall_support { // Define kernel data structures as known to glibc #include <asm/poll.h> #include <asm/posix_types.h> #include <asm/types.h> #include <errno.h> #include <linux/types.h> #include <linux/unistd.h> #include <signal.h> #include <sys/socket.h> #include <sys/statfs.h> #include <sys/types.h> #include <unistd.h> // Set by the signal handler to show that we received a signal static int signaled; static void CheckStructures() { puts("CheckStructures..."); // Compare sizes of the kernel structures. This will allow us to // catch cases where linux_syscall_support.h defined structures that // are obviously different from the ones the kernel expects. This is // a little complicated, because glibc often deliberately defines // incompatible versions. We address this issue on a case-by-case // basis by including the appropriate linux-specific header files // within our own namespace, instead of within the global // namespace. Occasionally, this requires careful sorting of header // files, too (e.g. in the case of "stat.h"). And we provide cleanup // where necessary (e.g. in the case of "struct statfs"). This is // far from perfect, but in the worst case, it'll lead to false // error messages that need to be fixed manually. Unfortunately, // there are a small number of data structures (e.g "struct // kernel_old_sigaction") that we cannot test at all, as glibc does // not have any definitions for them. CHECK(sizeof(struct iovec) == sizeof(struct kernel_iovec)); CHECK(sizeof(struct msghdr) == sizeof(struct kernel_msghdr)); CHECK(sizeof(struct pollfd) == sizeof(struct kernel_pollfd)); CHECK(sizeof(struct rlimit) == sizeof(struct kernel_rlimit)); CHECK(sizeof(struct rusage) == sizeof(struct kernel_rusage)); CHECK(sizeof(struct sigaction) == sizeof(struct kernel_sigaction) // glibc defines an excessively large sigset_t. Compensate for it: + sizeof(((struct sigaction *)0)->sa_mask) - KERNEL_NSIG/8 #ifdef __mips__ + 2*sizeof(int) #endif ); CHECK(sizeof(struct sockaddr) == sizeof(struct kernel_sockaddr)); CHECK(sizeof(struct stat) == sizeof(struct kernel_stat)); CHECK(sizeof(struct statfs) == sizeof(struct kernel_statfs) #ifdef __USE_FILE_OFFSET64 // glibc sometimes defines 64-bit wide fields in "struct statfs" // even though this is just the 32-bit version of the structure. + 5*(sizeof(((struct statfs *)0)->f_blocks) - sizeof(unsigned)) #endif ); CHECK(sizeof(struct timespec) == sizeof(struct kernel_timespec)); #if !defined(__x86_64__) && !defined(__aarch64__) CHECK(sizeof(struct stat64) == sizeof(struct kernel_stat64)); CHECK(sizeof(struct statfs64) == sizeof(struct kernel_statfs64)); #endif } #ifdef __mips__ #define ZERO_SIGACT { 0 } #else #define ZERO_SIGACT { { 0 } } #endif static void SigHandler(int signum) { if (signaled) { // Caller will report an error, as we cannot do so from a signal handler signaled = -1; } else { signaled = signum; } return; } static void SigAction(int signum, siginfo_t *si, void *arg) { SigHandler(signum); } static void Sigaction() { puts("Sigaction..."); #if defined(__aarch64__) const size_t kSigsetSize = sizeof(struct kernel_sigset_t); #endif int signum = SIGPWR; for (int info = 0; info < 2; info++) { signaled = 0; struct kernel_sigaction sa = ZERO_SIGACT, old, orig; #if defined(__aarch64__) CHECK(!sys_rt_sigaction(signum, NULL, &orig, kSigsetSize)); #else CHECK(!sys_sigaction(signum, NULL, &orig)); #endif if (info) { sa.sa_sigaction_ = SigAction; } else { sa.sa_handler_ = SigHandler; } sa.sa_flags = SA_RESETHAND | SA_RESTART | (info ? SA_SIGINFO : 0); CHECK(!sys_sigemptyset(&sa.sa_mask)); #if defined(__aarch64__) CHECK(!sys_rt_sigaction(signum, &sa, &old, kSigsetSize)); #else CHECK(!sys_sigaction(signum, &sa, &old)); #endif CHECK(!memcmp(&old, &orig, sizeof(struct kernel_sigaction))); #if defined(__aarch64__) CHECK(!sys_rt_sigaction(signum, NULL, &old, kSigsetSize)); #else CHECK(!sys_sigaction(signum, NULL, &old)); #endif #if defined(__i386__) || defined(__x86_64__) old.sa_restorer = sa.sa_restorer; old.sa_flags &= ~SA_RESTORER; #endif CHECK(!memcmp(&old, &sa, sizeof(struct kernel_sigaction))); struct kernel_sigset_t pending; #if defined(__aarch64__) CHECK(!sys_rt_sigpending(&pending, kSigsetSize)); #else CHECK(!sys_sigpending(&pending)); #endif CHECK(!sys_sigismember(&pending, signum)); struct kernel_sigset_t mask, oldmask; CHECK(!sys_sigemptyset(&mask)); CHECK(!sys_sigaddset(&mask, signum)); CHECK(!sys_sigprocmask(SIG_BLOCK, &mask, &oldmask)); CHECK(!sys_kill(sys_getpid(), signum)); #if defined(__aarch64__) CHECK(!sys_rt_sigpending(&pending, kSigsetSize)); #else CHECK(!sys_sigpending(&pending)); #endif CHECK(sys_sigismember(&pending, signum)); CHECK(!signaled); CHECK(!sys_sigfillset(&mask)); CHECK(!sys_sigdelset(&mask, signum)); #if defined(__aarch64__) CHECK(sys_rt_sigsuspend(&mask, kSigsetSize) == -1); #else CHECK(sys_sigsuspend(&mask) == -1); #endif CHECK(signaled == signum); #if defined(__aarch64__) CHECK(!sys_rt_sigaction(signum, &orig, NULL, kSigsetSize)); #else CHECK(!sys_sigaction(signum, &orig, NULL)); #endif CHECK(!sys_sigprocmask(SIG_SETMASK, &oldmask, NULL)); } } static void OldSigaction() { #if defined(__i386__) || defined(__ARM_ARCH_3__) || defined(__PPC__) || \ (defined(__mips__) && _MIPS_SIM == _MIPS_SIM_ABI32) puts("OldSigaction..."); int signum = SIGPWR; for (int info = 0; info < 2; info++) { signaled = 0; struct kernel_old_sigaction sa = ZERO_SIGACT, old, orig; CHECK(!sys__sigaction(signum, NULL, &orig)); if (info) { sa.sa_sigaction_ = SigAction; } else { sa.sa_handler_ = SigHandler; } sa.sa_flags = SA_RESETHAND | SA_RESTART | (info ? SA_SIGINFO : 0); memset(&sa.sa_mask, 0, sizeof(sa.sa_mask)); CHECK(!sys__sigaction(signum, &sa, &old)); CHECK(!memcmp(&old, &orig, sizeof(struct kernel_old_sigaction))); CHECK(!sys__sigaction(signum, NULL, &old)); #ifndef __mips__ old.sa_restorer = sa.sa_restorer; #endif CHECK(!memcmp(&old, &sa, sizeof(struct kernel_old_sigaction))); unsigned long pending; CHECK(!sys__sigpending(&pending)); CHECK(!(pending & (1UL << (signum - 1)))); unsigned long mask, oldmask; mask = 1 << (signum - 1); CHECK(!sys__sigprocmask(SIG_BLOCK, &mask, &oldmask)); CHECK(!sys_kill(sys_getpid(), signum)); CHECK(!sys__sigpending(&pending)); CHECK(pending & (1UL << (signum - 1))); CHECK(!signaled); mask = ~mask; CHECK(sys__sigsuspend( #ifndef __PPC__ &mask, 0, #endif mask) == -1); CHECK(signaled == signum); CHECK(!sys__sigaction(signum, &orig, NULL)); CHECK(!sys__sigprocmask(SIG_SETMASK, &oldmask, NULL)); } #endif } template<class A, class B>static void AlmostEquals(A a, B b) { double d = 0.0 + a - b; if (d < 0) { d = -d; } double avg = a/2.0 + b/2.0; if (avg < 4096) { // Round up to a minimum size. Otherwise, even minute changes could // trigger a false positive. avg = 4096; } // Check that a and b are within one percent of each other. CHECK(d / avg < 0.01); } static void StatFs() { puts("StatFs..."); struct statfs64 libc_statfs; struct kernel_statfs kernel_statfs; CHECK(!statfs64("/", &libc_statfs)); CHECK(!sys_statfs("/", &kernel_statfs)); CHECK(libc_statfs.f_type == kernel_statfs.f_type); CHECK(libc_statfs.f_bsize == kernel_statfs.f_bsize); CHECK(libc_statfs.f_blocks == kernel_statfs.f_blocks); AlmostEquals(libc_statfs.f_bfree, kernel_statfs.f_bfree); AlmostEquals(libc_statfs.f_bavail, kernel_statfs.f_bavail); CHECK(libc_statfs.f_files == kernel_statfs.f_files); AlmostEquals(libc_statfs.f_ffree, kernel_statfs.f_ffree); CHECK(libc_statfs.f_fsid.__val[0] == kernel_statfs.f_fsid.val[0]); CHECK(libc_statfs.f_fsid.__val[1] == kernel_statfs.f_fsid.val[1]); CHECK(libc_statfs.f_namelen == kernel_statfs.f_namelen); } static void StatFs64() { #if defined(__i386__) || defined(__ARM_ARCH_3__) || \ (defined(__mips__) && _MIPS_SIM != _MIPS_SIM_ABI64) puts("StatFs64..."); struct statfs64 libc_statfs; struct kernel_statfs64 kernel_statfs; CHECK(!statfs64("/", &libc_statfs)); CHECK(!sys_statfs64("/", &kernel_statfs)); CHECK(libc_statfs.f_type == kernel_statfs.f_type); CHECK(libc_statfs.f_bsize == kernel_statfs.f_bsize); CHECK(libc_statfs.f_blocks == kernel_statfs.f_blocks); AlmostEquals(libc_statfs.f_bfree, kernel_statfs.f_bfree); AlmostEquals(libc_statfs.f_bavail, kernel_statfs.f_bavail); CHECK(libc_statfs.f_files == kernel_statfs.f_files); AlmostEquals(libc_statfs.f_ffree, kernel_statfs.f_ffree); CHECK(libc_statfs.f_fsid.__val[0] == kernel_statfs.f_fsid.val[0]); CHECK(libc_statfs.f_fsid.__val[1] == kernel_statfs.f_fsid.val[1]); CHECK(libc_statfs.f_namelen == kernel_statfs.f_namelen); #endif } static void Stat() { static const char * const entries[] = { "/dev/null", "/bin/sh", "/", NULL }; puts("Stat..."); for (int i = 0; entries[i]; i++) { struct ::stat64 libc_stat; struct kernel_stat kernel_stat; CHECK(!::stat64(entries[i], &libc_stat)); CHECK(!sys_stat(entries[i], &kernel_stat)); // CHECK(libc_stat.st_dev == kernel_stat.st_dev); CHECK(libc_stat.st_ino == kernel_stat.st_ino); CHECK(libc_stat.st_mode == kernel_stat.st_mode); CHECK(libc_stat.st_nlink == kernel_stat.st_nlink); CHECK(libc_stat.st_uid == kernel_stat.st_uid); CHECK(libc_stat.st_gid == kernel_stat.st_gid); CHECK(libc_stat.st_rdev == kernel_stat.st_rdev); CHECK(libc_stat.st_size == kernel_stat.st_size); #if !defined(__i386__) && !defined(__ARM_ARCH_3__) && !defined(__PPC__) && \ !(defined(__mips__) && _MIPS_SIM != _MIPS_SIM_ABI64) CHECK(libc_stat.st_blksize == kernel_stat.st_blksize); CHECK(libc_stat.st_blocks == kernel_stat.st_blocks); #endif CHECK(libc_stat.st_atime == kernel_stat.st_atime_); CHECK(libc_stat.st_mtime == kernel_stat.st_mtime_); CHECK(libc_stat.st_ctime == kernel_stat.st_ctime_); } } static void Stat64() { #if defined(__i386__) || defined(__ARM_ARCH_3__) || defined(__PPC__) || \ (defined(__mips__) && _MIPS_SIM != _MIPS_SIM_ABI64) puts("Stat64..."); static const char * const entries[] = { "/dev/null", "/bin/sh", "/", NULL }; for (int i = 0; entries[i]; i++) { struct ::stat64 libc_stat; struct kernel_stat64 kernel_stat; CHECK(!::stat64(entries[i], &libc_stat)); CHECK(!sys_stat64(entries[i], &kernel_stat)); CHECK(libc_stat.st_dev == kernel_stat.st_dev); CHECK(libc_stat.st_ino == kernel_stat.st_ino); CHECK(libc_stat.st_mode == kernel_stat.st_mode); CHECK(libc_stat.st_nlink == kernel_stat.st_nlink); CHECK(libc_stat.st_uid == kernel_stat.st_uid); CHECK(libc_stat.st_gid == kernel_stat.st_gid); CHECK(libc_stat.st_rdev == kernel_stat.st_rdev); CHECK(libc_stat.st_size == kernel_stat.st_size); CHECK(libc_stat.st_blksize == kernel_stat.st_blksize); CHECK(libc_stat.st_blocks == kernel_stat.st_blocks); CHECK(libc_stat.st_atime == kernel_stat.st_atime_); CHECK(libc_stat.st_mtime == kernel_stat.st_mtime_); CHECK(libc_stat.st_ctime == kernel_stat.st_ctime_); } #endif } } // namespace int main(int argc, char *argv[]) { linux_syscall_support::CheckStructures(); linux_syscall_support::Sigaction(); linux_syscall_support::OldSigaction(); linux_syscall_support::StatFs(); linux_syscall_support::StatFs64(); linux_syscall_support::Stat(); linux_syscall_support::Stat64(); if (check_failures == 0) puts("PASS"); else puts("FAIL"); return check_failures; }
{ "content_hash": "68c821d8d9b80cbfe77e431758c4dec3", "timestamp": "", "source": "github", "line_count": 345, "max_line_length": 79, "avg_line_length": 37.344927536231886, "alnum_prop": 0.6248059608817138, "repo_name": "madscientist/google-coredumper", "id": "8c54a1cdeb09d2f4e3025827943b0d9a1dbe11ba", "size": "14733", "binary": false, "copies": "2", "ref": "refs/heads/master", "path": "src/linux_syscall_support_unittest.cc", "mode": "33188", "license": "bsd-3-clause", "language": [ { "name": "C", "bytes": "396337" }, { "name": "C++", "bytes": "14733" }, { "name": "M4", "bytes": "2113" }, { "name": "Makefile", "bytes": "62259" }, { "name": "Shell", "bytes": "400761" } ], "symlink_target": "" }
import remoteFileObjToLocal from '@uppy/utils/lib/remoteFileObjToLocal' export default class SharedHandler { constructor (plugin) { this.plugin = plugin this.filterItems = this.filterItems.bind(this) this.toggleCheckbox = this.toggleCheckbox.bind(this) this.recordShiftKeyPress = this.recordShiftKeyPress.bind(this) this.isChecked = this.isChecked.bind(this) this.loaderWrapper = this.loaderWrapper.bind(this) } filterItems (items) { const state = this.plugin.getPluginState() if (!state.filterInput || state.filterInput === '') { return items } return items.filter((folder) => { return folder.name.toLowerCase().indexOf(state.filterInput.toLowerCase()) !== -1 }) } recordShiftKeyPress (e) { this.isShiftKeyPressed = e.shiftKey } /** * Toggles file/folder checkbox to on/off state while updating files list. * * Note that some extra complexity comes from supporting shift+click to * toggle multiple checkboxes at once, which is done by getting all files * in between last checked file and current one. */ toggleCheckbox (e, file) { e.stopPropagation() e.preventDefault() e.currentTarget.focus() const { folders, files } = this.plugin.getPluginState() const items = this.filterItems(folders.concat(files)) // Shift-clicking selects a single consecutive list of items // starting at the previous click and deselects everything else. if (this.lastCheckbox && this.isShiftKeyPressed) { const prevIndex = items.indexOf(this.lastCheckbox) const currentIndex = items.indexOf(file) const currentSelection = (prevIndex < currentIndex) ? items.slice(prevIndex, currentIndex + 1) : items.slice(currentIndex, prevIndex + 1) const reducedCurrentSelection = [] // Check restrictions on each file in currentSelection, // reduce it to only contain files that pass restrictions for (const item of currentSelection) { const { uppy } = this.plugin const restrictionError = uppy.validateRestrictions( remoteFileObjToLocal(item), [...uppy.getFiles(), ...reducedCurrentSelection], ) if (!restrictionError) { reducedCurrentSelection.push(item) } else { uppy.info({ message: restrictionError.message }, 'error', uppy.opts.infoTimeout) } } this.plugin.setPluginState({ currentSelection: reducedCurrentSelection }) return } this.lastCheckbox = file const { currentSelection } = this.plugin.getPluginState() if (this.isChecked(file)) { this.plugin.setPluginState({ currentSelection: currentSelection.filter((item) => item.id !== file.id), }) } else { this.plugin.setPluginState({ currentSelection: currentSelection.concat([file]), }) } } isChecked (file) { const { currentSelection } = this.plugin.getPluginState() // comparing id instead of the file object, because the reference to the object // changes when we switch folders, and the file list is updated return currentSelection.some((item) => item.id === file.id) } loaderWrapper (promise, then, catch_) { promise .then((result) => { this.plugin.setPluginState({ loading: false }) then(result) }).catch((err) => { this.plugin.setPluginState({ loading: false }) catch_(err) }) this.plugin.setPluginState({ loading: true }) } }
{ "content_hash": "a50b886ecc20f0dd0c010a350f32ec07", "timestamp": "", "source": "github", "line_count": 100, "max_line_length": 90, "avg_line_length": 35.01, "alnum_prop": 0.6663810339902885, "repo_name": "transloadit/uppy", "id": "e7af174116c3641fef01789c1a3830c382f6117c", "size": "3501", "binary": false, "copies": "1", "ref": "refs/heads/main", "path": "packages/@uppy/provider-views/src/SharedHandler.js", "mode": "33188", "license": "mit", "language": [ { "name": "CSS", "bytes": "2099" }, { "name": "Dockerfile", "bytes": "1212" }, { "name": "EJS", "bytes": "43788" }, { "name": "HTML", "bytes": "20350" }, { "name": "JavaScript", "bytes": "1520664" }, { "name": "Makefile", "bytes": "2843" }, { "name": "SCSS", "bytes": "134981" }, { "name": "Shell", "bytes": "8188" }, { "name": "Svelte", "bytes": "4994" }, { "name": "TypeScript", "bytes": "63616" }, { "name": "Vue", "bytes": "383" } ], "symlink_target": "" }
define(function (require) { var settings = require("settings"); var updateBPM = function (args) { var bpm = parseInt(args.bpm, 10); var newBPM; if (isNaN(bpm)) newBPM = settings.bpmDefault; else if (bpm < settings.bpmMinimum) newBPM = settings.bpmMinimum; else if (bpm > settings.bpmMaximum) newBPM = settings.bpmMaximum; else newBPM = bpm; this.scheduler.setBPM(newBPM); }; return updateBPM; });
{ "content_hash": "6dc18dedcb8a9eabdf2fcb570a624bcd", "timestamp": "", "source": "github", "line_count": 21, "max_line_length": 37, "avg_line_length": 20.523809523809526, "alnum_prop": 0.6774941995359629, "repo_name": "stuartkeith/webaudiosequencer", "id": "e0eb2d596d4ad1087147363fee9b4eeb59080ccc", "size": "431", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "source/javascript/commands/updateBPM.js", "mode": "33188", "license": "mit", "language": [ { "name": "CSS", "bytes": "20946" }, { "name": "HTML", "bytes": "5726" }, { "name": "JavaScript", "bytes": "322703" } ], "symlink_target": "" }
from . import animator from . import movingfft from . import widgets
{ "content_hash": "83be7d64c4f8390e54dfb6676935c707", "timestamp": "", "source": "github", "line_count": 3, "max_line_length": 23, "avg_line_length": 23, "alnum_prop": 0.782608695652174, "repo_name": "twoodford/audiovisualizer", "id": "c2ff3144d26107e81f19ad76d0a1a4b3504b36a0", "size": "589", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "audiovisualizer/__init__.py", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Python", "bytes": "18901" } ], "symlink_target": "" }
module RailsDatatables def datatable(columns, opts={}) sort_by = opts[:sort_by] || nil additional_data = opts[:additional_data] || {} search = opts[:search].present? ? opts[:search].to_s : "true" search_label = opts[:search_label] || "Search" processing = opts[:processing] || "Processing" persist_state = opts[:persist_state].present? ? opts[:persist_state].to_s : "true" table_dom_id = opts[:table_dom_id] ? "##{opts[:table_dom_id]}" : ".datatable" per_page = opts[:per_page] || opts[:display_length]|| 25 no_records_message = opts[:no_records_message] || nil auto_width = opts[:auto_width].present? ? opts[:auto_width].to_s : "true" row_callback = opts[:row_callback] || nil append = opts[:append] || nil ajax_source = opts[:ajax_source] || nil server_side = opts[:ajax_source].present? additional_data_string = "" additional_data.each_pair do |name,value| additional_data_string = additional_data_string + ", " if !additional_data_string.blank? && value additional_data_string = additional_data_string + "{'name': '#{name}', 'value':'#{value}'}" if value end %Q{ <script type="text/javascript"> $(function() { $('#{table_dom_id}').dataTable({ "oLanguage": { "sSearch": "#{search_label}", #{"'sZeroRecords': '#{no_records_message}'," if no_records_message} "sProcessing": '#{processing}' }, "sPaginationType": "full_numbers", "iDisplayLength": #{per_page}, "bProcessing": true, "bServerSide": #{server_side}, "bLengthChange": false, "bStateSave": #{persist_state}, "bFilter": #{search}, "bAutoWidth": #{auto_width}, #{"'aaSorting': [#{sort_by}]," if sort_by} #{"'sAjaxSource': '#{ajax_source}'," if ajax_source} "aoColumns": [ #{formatted_columns(columns)} ], #{"'fnRowCallback': function( nRow, aData, iDisplayIndex ) { #{row_callback} }," if row_callback} "fnServerData": function ( sSource, aoData, fnCallback ) { aoData.push( #{additional_data_string} ); $.getJSON( sSource, aoData, function (json) { fnCallback(json); } ); } })#{append}; }); </script> } end private def formatted_columns(columns) i = 0 columns.map {|c| i += 1 if c.nil? or c.empty? "null" else searchable = c[:searchable].to_s.present? ? c[:searchable].to_s : "true" sortable = c[:sortable].to_s.present? ? c[:sortable].to_s : "true" "{ 'sType': '#{c[:type] || "string"}', 'bSortable':#{sortable}, 'bSearchable':#{searchable} #{",'sClass':'#{c[:class]}'" if c[:class]} }" end }.join(",") end end
{ "content_hash": "16af2c2dcce683d8f5de075e35284079", "timestamp": "", "source": "github", "line_count": 81, "max_line_length": 106, "avg_line_length": 35.876543209876544, "alnum_prop": 0.5399174122505161, "repo_name": "phronos/rails_datatables", "id": "68bc52d9b82b5bc5f95af8a9aab27b1df48b734e", "size": "2906", "binary": false, "copies": "4", "ref": "refs/heads/master", "path": "lib/rails_datatables.rb", "mode": "33188", "license": "mit", "language": [ { "name": "Ruby", "bytes": "3245" } ], "symlink_target": "" }
""" Script to run benchmarks (used by regression tests) """ import os import os.path import sys import csv from LogManager import LoggingManager def printf(format, *args): sys.stdout.write(format % args) _log = LoggingManager.get_logger(__name__) def isexec (fpath): if fpath == None: return False return os.path.isfile(fpath) and os.access(fpath, os.X_OK) def which(program): fpath, fname = os.path.split(program) if fpath: if isexec (program): return program else: for path in os.environ["PATH"].split(os.pathsep): exe_file = os.path.join(path, program) if isexec (exe_file): return exe_file return None def parseArgs (argv): import argparse as a p = a.ArgumentParser (description='Benchmark Runner') p.add_argument ('--cpu', metavar='CPU', type=int, help='CPU limit', default=60) p.add_argument ('--mem', metavar='MEM', type=int, help='Memory limit (MB)', default=512) p.add_argument ('file', nargs='+', help='Benchmark files') p.add_argument ('--prefix', default='BRUNCH_STAT', help='Prefix for stats') p.add_argument ('--format', required=True, help='Fields') p.add_argument ('--out', metavar='DIR', default="out", help='Output directory') if '-h' in argv or '--help' in argv: p.print_help () p.exit (0) try: k = argv.index ('--') except ValueError: p.error ("No '--' argument") args = p.parse_args (argv[:k]) args.tool_args = argv[k+1:] # include date in output directory # import datetime as dt # dt = dt.datetime.now ().strftime ('%d_%m_%Y-t%H-%M-%S') # args.out = '{out}.{dt}'.format (out=args.out, dt=dt) return args def collectStats (stats, file): f = open (file, 'r') for line in f: if not line.startswith ('BRUNCH_STAT'): continue fld = line.split (' ') stats [fld[1]] = fld[2].strip () f.close () return stats def statsHeader (stats_file, flds): with open (stats_file, 'w') as sf: writer = csv.writer (sf) writer.writerow (flds) def statsLine (stats_file, fmt, stats): line = list() for fld in fmt: if fld in stats: line.append (str (stats [fld])) else: line.append (None) with open (stats_file, 'a') as sf: writer = csv.writer (sf) writer.writerow (line) cpuTotal = 0.0 def runTool (tool_args, f, out, cpu, mem, fmt): global cpuTotal import resource as r def set_limits (): if mem > 0: mem_bytes = mem * 1024 * 1024 r.setrlimit (r.RLIMIT_AS, [mem_bytes, mem_bytes]) if cpu > 0: r.setrlimit (r.RLIMIT_CPU, [cpu, cpu]) fmt_tool_args = [v.format(f=f) for v in tool_args] fmt_tool_args[0] = which (fmt_tool_args[0]) fmt_tool_args.append(f) base = os.path.basename (f) #outfile = os.path.join (out, base + '.stdout') errfile = os.path.join (out, base + '.stderr') import subprocess as sub _log.info(base) p = sub.Popen (fmt_tool_args, shell=False, stdout=sub.PIPE, stderr=sub.STDOUT, preexec_fn=set_limits) #stdout=open(outfile, 'w'), stderr=open(errfile, 'w'), result, _ = p.communicate () cpuUsage = r.getrusage (r.RUSAGE_CHILDREN).ru_utime stats = dict() stats['File'] = f stats['base'] = base stats['Status'] = p.returncode stats['Cpu'] = '{0:.3f}'.format (cpuUsage - cpuTotal) if "UNSAT" in result: stats['Result'] = "UNSAT" elif "SAT" in result: stats['Result'] = "SAT" elif "UNKNOWN" in result: stats['Result'] = "UNKNOWN" else: _log.error(base) f = open(errfile,"w") f.write(result) stats['Result'] = "ERR" cpuTotal = cpuUsage #stats = collectStats (stats, outfile) #stats = collectStats (stats, errfile) statsLine (os.path.join (out, 'stats'), fmt, stats) def main (argv): args = parseArgs (argv[1:]) if not os.path.exists (args.out): os.mkdir (args.out) fmt = args.format.split (':') statsHeader (os.path.join (args.out, 'stats'), fmt) global cpuTotal import resource as r cpuTotal = r.getrusage (r.RUSAGE_CHILDREN).ru_utime for f in args.file: runTool (args.tool_args, f, args.out, cpu=args.cpu, mem=args.mem, fmt=fmt) return 0 if __name__ == '__main__': sys.exit (main (sys.argv))
{ "content_hash": "773405931d27a3c55ff6541881237599", "timestamp": "", "source": "github", "line_count": 171, "max_line_length": 68, "avg_line_length": 27.280701754385966, "alnum_prop": 0.5592711682743837, "repo_name": "sav-tools/covenant", "id": "1a50fd35406fe0a005a7dc367e0b64072e649352", "size": "4688", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "py/brunch.py", "mode": "33261", "license": "mit", "language": [ { "name": "C++", "bytes": "158639" }, { "name": "CMake", "bytes": "2938" }, { "name": "Python", "bytes": "30915" } ], "symlink_target": "" }
/*! core engine; version: 20130725 */ ;(function($) { "use strict"; var version = '20130725'; $.fn.cycle = function( options ) { // fix mistakes with the ready state var o; if ( this.length === 0 && !$.isReady ) { o = { s: this.selector, c: this.context }; $.fn.cycle.log('requeuing slideshow (dom not ready)'); $(function() { $( o.s, o.c ).cycle(options); }); return this; } return this.each(function() { var data, opts, shortName, val; var container = $(this); var log = $.fn.cycle.log; if ( container.data('cycle.opts') ) return; // already initialized if ( container.data('cycle-log') === false || ( options && options.log === false ) || ( opts && opts.log === false) ) { log = $.noop; } log('--c2 init--'); data = container.data(); for (var p in data) { // allow props to be accessed sans 'cycle' prefix and log the overrides if (data.hasOwnProperty(p) && /^cycle[A-Z]+/.test(p) ) { val = data[p]; shortName = p.match(/^cycle(.*)/)[1].replace(/^[A-Z]/, lowerCase); log(shortName+':', val, '('+typeof val +')'); data[shortName] = val; } } opts = $.extend( {}, $.fn.cycle.defaults, data, options || {}); opts.timeoutId = 0; opts.paused = opts.paused || false; // #57 opts.container = container; opts._maxZ = opts.maxZ; opts.API = $.extend ( { _container: container }, $.fn.cycle.API ); opts.API.log = log; opts.API.trigger = function( eventName, args ) { opts.container.trigger( eventName, args ); return opts.API; }; container.data( 'cycle.opts', opts ); container.data( 'cycle.API', opts.API ); // opportunity for plugins to modify opts and API opts.API.trigger('cycle-bootstrap', [ opts, opts.API ]); opts.API.addInitialSlides(); opts.API.preInitSlideshow(); if ( opts.slides.length ) opts.API.initSlideshow(); }); }; $.fn.cycle.API = { opts: function() { return this._container.data( 'cycle.opts' ); }, addInitialSlides: function() { var opts = this.opts(); var slides = opts.slides; opts.slideCount = 0; opts.slides = $(); // empty set // add slides that already exist slides = slides.jquery ? slides : opts.container.find( slides ); if ( opts.random ) { slides.sort(function() {return Math.random() - 0.5;}); } opts.API.add( slides ); }, preInitSlideshow: function() { var opts = this.opts(); opts.API.trigger('cycle-pre-initialize', [ opts ]); var tx = $.fn.cycle.transitions[opts.fx]; if (tx && $.isFunction(tx.preInit)) tx.preInit( opts ); opts._preInitialized = true; }, postInitSlideshow: function() { var opts = this.opts(); opts.API.trigger('cycle-post-initialize', [ opts ]); var tx = $.fn.cycle.transitions[opts.fx]; if (tx && $.isFunction(tx.postInit)) tx.postInit( opts ); }, initSlideshow: function() { var opts = this.opts(); var pauseObj = opts.container; var slideOpts; opts.API.calcFirstSlide(); if ( opts.container.css('position') == 'static' ) opts.container.css('position', 'relative'); $(opts.slides[opts.currSlide]).css('opacity',1).show(); opts.API.stackSlides( opts.slides[opts.currSlide], opts.slides[opts.nextSlide], !opts.reverse ); if ( opts.pauseOnHover ) { // allow pauseOnHover to specify an element if ( opts.pauseOnHover !== true ) pauseObj = $( opts.pauseOnHover ); pauseObj.hover( function(){ opts.API.pause( true ); }, function(){ opts.API.resume( true ); } ); } // stage initial transition if ( opts.timeout ) { slideOpts = opts.API.getSlideOpts( opts.nextSlide ); opts.API.queueTransition( slideOpts, slideOpts.timeout + opts.delay ); } opts._initialized = true; opts.API.updateView( true ); opts.API.trigger('cycle-initialized', [ opts ]); opts.API.postInitSlideshow(); }, pause: function( hover ) { var opts = this.opts(), slideOpts = opts.API.getSlideOpts(), alreadyPaused = opts.hoverPaused || opts.paused; if ( hover ) opts.hoverPaused = true; else opts.paused = true; if ( ! alreadyPaused ) { opts.container.addClass('cycle-paused'); opts.API.trigger('cycle-paused', [ opts ]).log('cycle-paused'); if ( slideOpts.timeout ) { clearTimeout( opts.timeoutId ); opts.timeoutId = 0; // determine how much time is left for the current slide opts._remainingTimeout -= ( $.now() - opts._lastQueue ); if ( opts._remainingTimeout < 0 || isNaN(opts._remainingTimeout) ) opts._remainingTimeout = undefined; } } }, resume: function( hover ) { var opts = this.opts(), alreadyResumed = !opts.hoverPaused && !opts.paused, remaining; if ( hover ) opts.hoverPaused = false; else opts.paused = false; if ( ! alreadyResumed ) { opts.container.removeClass('cycle-paused'); // #gh-230; if an animation is in progress then don't queue a new transition; it will // happen naturally if ( opts.slides.filter(':animated').length === 0 ) opts.API.queueTransition( opts.API.getSlideOpts(), opts._remainingTimeout ); opts.API.trigger('cycle-resumed', [ opts, opts._remainingTimeout ] ).log('cycle-resumed'); } }, add: function( slides, prepend ) { var opts = this.opts(); var oldSlideCount = opts.slideCount; var startSlideshow = false; var len; if ( $.type(slides) == 'string') slides = $.trim( slides ); $( slides ).each(function(i) { var slideOpts; var slide = $(this); if ( prepend ) opts.container.prepend( slide ); else opts.container.append( slide ); opts.slideCount++; slideOpts = opts.API.buildSlideOpts( slide ); if ( prepend ) opts.slides = $( slide ).add( opts.slides ); else opts.slides = opts.slides.add( slide ); opts.API.initSlide( slideOpts, slide, --opts._maxZ ); slide.data('cycle.opts', slideOpts); opts.API.trigger('cycle-slide-added', [ opts, slideOpts, slide ]); }); opts.API.updateView( true ); startSlideshow = opts._preInitialized && (oldSlideCount < 2 && opts.slideCount >= 1); if ( startSlideshow ) { if ( !opts._initialized ) opts.API.initSlideshow(); else if ( opts.timeout ) { len = opts.slides.length; opts.nextSlide = opts.reverse ? len - 1 : 1; if ( !opts.timeoutId ) { opts.API.queueTransition( opts ); } } } }, calcFirstSlide: function() { var opts = this.opts(); var firstSlideIndex; firstSlideIndex = parseInt( opts.startingSlide || 0, 10 ); if (firstSlideIndex >= opts.slides.length || firstSlideIndex < 0) firstSlideIndex = 0; opts.currSlide = firstSlideIndex; if ( opts.reverse ) { opts.nextSlide = firstSlideIndex - 1; if (opts.nextSlide < 0) opts.nextSlide = opts.slides.length - 1; } else { opts.nextSlide = firstSlideIndex + 1; if (opts.nextSlide == opts.slides.length) opts.nextSlide = 0; } }, calcNextSlide: function() { var opts = this.opts(); var roll; if ( opts.reverse ) { roll = (opts.nextSlide - 1) < 0; opts.nextSlide = roll ? opts.slideCount - 1 : opts.nextSlide-1; opts.currSlide = roll ? 0 : opts.nextSlide+1; } else { roll = (opts.nextSlide + 1) == opts.slides.length; opts.nextSlide = roll ? 0 : opts.nextSlide+1; opts.currSlide = roll ? opts.slides.length-1 : opts.nextSlide-1; } }, calcTx: function( slideOpts, manual ) { var opts = slideOpts; var tx; if ( manual && opts.manualFx ) tx = $.fn.cycle.transitions[opts.manualFx]; if ( !tx ) tx = $.fn.cycle.transitions[opts.fx]; if (!tx) { tx = $.fn.cycle.transitions.fade; opts.API.log('Transition "' + opts.fx + '" not found. Using fade.'); } return tx; }, prepareTx: function( manual, fwd ) { var opts = this.opts(); var after, curr, next, slideOpts, tx; if ( opts.slideCount < 2 ) { opts.timeoutId = 0; return; } if ( manual && ( !opts.busy || opts.manualTrump ) ) { opts.API.stopTransition(); opts.busy = false; clearTimeout(opts.timeoutId); opts.timeoutId = 0; } if ( opts.busy ) return; if ( opts.timeoutId === 0 && !manual ) return; curr = opts.slides[opts.currSlide]; next = opts.slides[opts.nextSlide]; slideOpts = opts.API.getSlideOpts( opts.nextSlide ); tx = opts.API.calcTx( slideOpts, manual ); opts._tx = tx; if ( manual && slideOpts.manualSpeed !== undefined ) slideOpts.speed = slideOpts.manualSpeed; // if ( opts.nextSlide === opts.currSlide ) // opts.API.calcNextSlide(); // ensure that: // 1. advancing to a different slide // 2. this is either a manual event (prev/next, pager, cmd) or // a timer event and slideshow is not paused if ( opts.nextSlide != opts.currSlide && (manual || (!opts.paused && !opts.hoverPaused && opts.timeout) )) { // #62 opts.API.trigger('cycle-before', [ slideOpts, curr, next, fwd ]); if ( tx.before ) tx.before( slideOpts, curr, next, fwd ); after = function() { opts.busy = false; // #76; bail if slideshow has been destroyed if (! opts.container.data( 'cycle.opts' ) ) return; if (tx.after) tx.after( slideOpts, curr, next, fwd ); opts.API.trigger('cycle-after', [ slideOpts, curr, next, fwd ]); opts.API.queueTransition( slideOpts); opts.API.updateView( true ); }; opts.busy = true; if (tx.transition) tx.transition(slideOpts, curr, next, fwd, after); else opts.API.doTransition( slideOpts, curr, next, fwd, after); opts.API.calcNextSlide(); opts.API.updateView(); } else { opts.API.queueTransition( slideOpts ); } }, // perform the actual animation doTransition: function( slideOpts, currEl, nextEl, fwd, callback) { var opts = slideOpts; var curr = $(currEl), next = $(nextEl); var fn = function() { // make sure animIn has something so that callback doesn't trigger immediately next.animate(opts.animIn || { opacity: 1}, opts.speed, opts.easeIn || opts.easing, callback); }; next.css(opts.cssBefore || {}); curr.animate(opts.animOut || {}, opts.speed, opts.easeOut || opts.easing, function() { curr.css(opts.cssAfter || {}); if (!opts.sync) { fn(); } }); if (opts.sync) { fn(); } }, queueTransition: function( slideOpts, specificTimeout ) { var opts = this.opts(); var timeout = specificTimeout !== undefined ? specificTimeout : slideOpts.timeout; if (opts.nextSlide === 0 && --opts.loop === 0) { opts.API.log('terminating; loop=0'); opts.timeout = 0; if ( timeout ) { setTimeout(function() { opts.API.trigger('cycle-finished', [ opts ]); }, timeout); } else { opts.API.trigger('cycle-finished', [ opts ]); } // reset nextSlide opts.nextSlide = opts.currSlide; return; } if ( timeout ) { opts._lastQueue = $.now(); if ( specificTimeout === undefined ) opts._remainingTimeout = slideOpts.timeout; if ( !opts.paused && ! opts.hoverPaused ) { opts.timeoutId = setTimeout(function() { opts.API.prepareTx( false, !opts.reverse ); }, timeout ); } } }, stopTransition: function() { var opts = this.opts(); if ( opts.slides.filter(':animated').length ) { opts.slides.stop(false, true); opts.API.trigger('cycle-transition-stopped', [ opts ]); } if ( opts._tx && opts._tx.stopTransition ) opts._tx.stopTransition( opts ); }, // advance slide forward or back advanceSlide: function( val ) { var opts = this.opts(); clearTimeout(opts.timeoutId); opts.timeoutId = 0; opts.nextSlide = opts.currSlide + val; if (opts.nextSlide < 0) opts.nextSlide = opts.slides.length - 1; else if (opts.nextSlide >= opts.slides.length) opts.nextSlide = 0; opts.API.prepareTx( true, val >= 0 ); return false; }, buildSlideOpts: function( slide ) { var opts = this.opts(); var val, shortName; var slideOpts = slide.data() || {}; for (var p in slideOpts) { // allow props to be accessed sans 'cycle' prefix and log the overrides if (slideOpts.hasOwnProperty(p) && /^cycle[A-Z]+/.test(p) ) { val = slideOpts[p]; shortName = p.match(/^cycle(.*)/)[1].replace(/^[A-Z]/, lowerCase); opts.API.log('['+(opts.slideCount-1)+']', shortName+':', val, '('+typeof val +')'); slideOpts[shortName] = val; } } slideOpts = $.extend( {}, $.fn.cycle.defaults, opts, slideOpts ); slideOpts.slideNum = opts.slideCount; try { // these props should always be read from the master state object delete slideOpts.API; delete slideOpts.slideCount; delete slideOpts.currSlide; delete slideOpts.nextSlide; delete slideOpts.slides; } catch(e) { // no op } return slideOpts; }, getSlideOpts: function( index ) { var opts = this.opts(); if ( index === undefined ) index = opts.currSlide; var slide = opts.slides[index]; var slideOpts = $(slide).data('cycle.opts'); return $.extend( {}, opts, slideOpts ); }, initSlide: function( slideOpts, slide, suggestedZindex ) { var opts = this.opts(); slide.css( slideOpts.slideCss || {} ); if ( suggestedZindex > 0 ) slide.css( 'zIndex', suggestedZindex ); // ensure that speed settings are sane if ( isNaN( slideOpts.speed ) ) slideOpts.speed = $.fx.speeds[slideOpts.speed] || $.fx.speeds._default; if ( !slideOpts.sync ) slideOpts.speed = slideOpts.speed / 2; slide.addClass( opts.slideClass ); }, updateView: function( isAfter ) { var opts = this.opts(); if ( !opts._initialized ) return; var slideOpts = opts.API.getSlideOpts(); var currSlide = opts.slides[ opts.currSlide ]; if ( ! isAfter ) { opts.API.trigger('cycle-update-view-before', [ opts, slideOpts, currSlide ]); if ( opts.updateView < 0 ) return; } if ( opts.slideActiveClass ) { opts.slides.removeClass( opts.slideActiveClass ) .eq( opts.currSlide ).addClass( opts.slideActiveClass ); } if ( isAfter && opts.hideNonActive ) opts.slides.filter( ':not(.' + opts.slideActiveClass + ')' ).hide(); opts.API.trigger('cycle-update-view', [ opts, slideOpts, currSlide, isAfter ]); opts.API.trigger('cycle-update-view-after', [ opts, slideOpts, currSlide ]); }, getComponent: function( name ) { var opts = this.opts(); var selector = opts[name]; if (typeof selector === 'string') { // if selector is a child, sibling combinator, adjancent selector then use find, otherwise query full dom return (/^\s*[\>|\+|~]/).test( selector ) ? opts.container.find( selector ) : $( selector ); } if (selector.jquery) return selector; return $(selector); }, stackSlides: function( curr, next, fwd ) { var opts = this.opts(); if ( !curr ) { curr = opts.slides[opts.currSlide]; next = opts.slides[opts.nextSlide]; fwd = !opts.reverse; } // reset the zIndex for the common case: // curr slide on top, next slide beneath, and the rest in order to be shown $(curr).css('zIndex', opts.maxZ); var i; var z = opts.maxZ - 2; var len = opts.slideCount; if (fwd) { for ( i = opts.currSlide + 1; i < len; i++ ) $( opts.slides[i] ).css( 'zIndex', z-- ); for ( i = 0; i < opts.currSlide; i++ ) $( opts.slides[i] ).css( 'zIndex', z-- ); } else { for ( i = opts.currSlide - 1; i >= 0; i-- ) $( opts.slides[i] ).css( 'zIndex', z-- ); for ( i = len - 1; i > opts.currSlide; i-- ) $( opts.slides[i] ).css( 'zIndex', z-- ); } $(next).css('zIndex', opts.maxZ - 1); }, getSlideIndex: function( el ) { return this.opts().slides.index( el ); } }; // API // default logger $.fn.cycle.log = function log() { /*global console:true */ if (window.console && console.log) console.log('[cycle2] ' + Array.prototype.join.call(arguments, ' ') ); }; $.fn.cycle.version = function() { return 'Cycle2: ' + version; }; // helper functions function lowerCase(s) { return (s || '').toLowerCase(); } // expose transition object $.fn.cycle.transitions = { custom: { }, none: { before: function( opts, curr, next, fwd ) { opts.API.stackSlides( next, curr, fwd ); opts.cssBefore = { opacity: 1, display: 'block' }; } }, fade: { before: function( opts, curr, next, fwd ) { var css = opts.API.getSlideOpts( opts.nextSlide ).slideCss || {}; opts.API.stackSlides( curr, next, fwd ); opts.cssBefore = $.extend(css, { opacity: 0, display: 'block' }); opts.animIn = { opacity: 1 }; opts.animOut = { opacity: 0 }; } }, fadeout: { before: function( opts , curr, next, fwd ) { var css = opts.API.getSlideOpts( opts.nextSlide ).slideCss || {}; opts.API.stackSlides( curr, next, fwd ); opts.cssBefore = $.extend(css, { opacity: 1, display: 'block' }); opts.animOut = { opacity: 0 }; } }, scrollHorz: { before: function( opts, curr, next, fwd ) { opts.API.stackSlides( curr, next, fwd ); var w = opts.container.css('overflow','hidden').width(); opts.cssBefore = { left: fwd ? w : - w, top: 0, opacity: 1, display: 'block' }; opts.cssAfter = { zIndex: opts._maxZ - 2, left: 0 }; opts.animIn = { left: 0 }; opts.animOut = { left: fwd ? -w : w }; } } }; // @see: http://jquery.malsup.com/cycle2/api $.fn.cycle.defaults = { allowWrap: true, autoSelector: '.cycle-slideshow[data-cycle-auto-init!=false]', delay: 0, easing: null, fx: 'fade', hideNonActive: true, loop: 0, manualFx: undefined, manualSpeed: undefined, manualTrump: true, maxZ: 100, pauseOnHover: false, reverse: false, slideActiveClass: 'cycle-slide-active', slideClass: 'cycle-slide', slideCss: { position: 'absolute', top: 0, left: 0 }, slides: '> img', speed: 500, startingSlide: 0, sync: true, timeout: 4000, updateView: -1 }; // automatically find and run slideshows $(document).ready(function() { $( $.fn.cycle.defaults.autoSelector ).cycle(); }); })(jQuery); /*! Cycle2 autoheight plugin; Copyright (c) M.Alsup, 2012; version: 20130304 */ (function($) { "use strict"; $.extend($.fn.cycle.defaults, { autoHeight: 0 // setting this option to false disables autoHeight logic }); $(document).on( 'cycle-initialized', function( e, opts ) { var autoHeight = opts.autoHeight; var t = $.type( autoHeight ); var resizeThrottle = null; var ratio; if ( t !== 'string' && t !== 'number' ) return; // bind events opts.container.on( 'cycle-slide-added cycle-slide-removed', initAutoHeight ); opts.container.on( 'cycle-destroyed', onDestroy ); if ( autoHeight == 'container' ) { opts.container.on( 'cycle-before', onBefore ); } else if ( t === 'string' && /\d+\:\d+/.test( autoHeight ) ) { // use ratio ratio = autoHeight.match(/(\d+)\:(\d+)/); ratio = ratio[1] / ratio[2]; opts._autoHeightRatio = ratio; } // if autoHeight is a number then we don't need to recalculate the sentinel // index on resize if ( t !== 'number' ) { // bind unique resize handler per slideshow (so it can be 'off-ed' in onDestroy) opts._autoHeightOnResize = function () { clearTimeout( resizeThrottle ); resizeThrottle = setTimeout( onResize, 50 ); }; $(window).on( 'resize orientationchange', opts._autoHeightOnResize ); } setTimeout( onResize, 30 ); function onResize() { initAutoHeight( e, opts ); } }); function initAutoHeight( e, opts ) { var clone, height, sentinelIndex; var autoHeight = opts.autoHeight; if ( autoHeight == 'container' ) { height = $( opts.slides[ opts.currSlide ] ).outerHeight(); opts.container.height( height ); } else if ( opts._autoHeightRatio ) { opts.container.height( opts.container.width() / opts._autoHeightRatio ); } else if ( autoHeight === 'calc' || ( $.type( autoHeight ) == 'number' && autoHeight >= 0 ) ) { if ( autoHeight === 'calc' ) sentinelIndex = calcSentinelIndex( e, opts ); else if ( autoHeight >= opts.slides.length ) sentinelIndex = 0; else sentinelIndex = autoHeight; // only recreate sentinel if index is different if ( sentinelIndex == opts._sentinelIndex ) return; opts._sentinelIndex = sentinelIndex; if ( opts._sentinel ) opts._sentinel.remove(); // clone existing slide as sentinel clone = $( opts.slides[ sentinelIndex ].cloneNode(true) ); // #50; remove special attributes from cloned content clone.removeAttr( 'id name rel' ).find( '[id],[name],[rel]' ).removeAttr( 'id name rel' ); clone.css({ position: 'static', visibility: 'hidden', display: 'block' }).prependTo( opts.container ).addClass('cycle-sentinel cycle-slide').removeClass('cycle-slide-active'); clone.find( '*' ).css( 'visibility', 'hidden' ); opts._sentinel = clone; } } function calcSentinelIndex( e, opts ) { var index = 0, max = -1; // calculate tallest slide index opts.slides.each(function(i) { var h = $(this).height(); if ( h > max ) { max = h; index = i; } }); return index; } function onBefore( e, opts, outgoing, incoming, forward ) { var h = $(incoming).outerHeight(); var duration = opts.sync ? opts.speed / 2 : opts.speed; opts.container.animate( { height: h }, duration ); } function onDestroy( e, opts ) { if ( opts._autoHeightOnResize ) { $(window).off( 'resize orientationchange', opts._autoHeightOnResize ); opts._autoHeightOnResize = null; } opts.container.off( 'cycle-slide-added cycle-slide-removed', initAutoHeight ); opts.container.off( 'cycle-destroyed', onDestroy ); opts.container.off( 'cycle-before', onBefore ); if ( opts._sentinel ) { opts._sentinel.remove(); opts._sentinel = null; } } })(jQuery); /*! caption plugin for Cycle2; version: 20130306 */ (function($) { "use strict"; $.extend($.fn.cycle.defaults, { caption: '> .cycle-caption', captionTemplate: '{{slideNum}} / {{slideCount}}', overlay: '> .cycle-overlay', overlayTemplate: '<div>{{title}}</div><div>{{desc}}</div>', captionModule: 'caption' }); $(document).on( 'cycle-update-view', function( e, opts, slideOpts, currSlide ) { if ( opts.captionModule !== 'caption' ) return; var el; $.each(['caption','overlay'], function() { var name = this; var template = slideOpts[name+'Template']; var el = opts.API.getComponent( name ); if( el.length && template ) { el.html( opts.API.tmpl( template, slideOpts, opts, currSlide ) ); el.show(); } else { el.hide(); } }); }); $(document).on( 'cycle-destroyed', function( e, opts ) { var el; $.each(['caption','overlay'], function() { var name = this, template = opts[name+'Template']; if ( opts[name] && template ) { el = opts.API.getComponent( 'caption' ); el.empty(); } }); }); })(jQuery); /*! command plugin for Cycle2; version: 20130707 */ (function($) { "use strict"; var c2 = $.fn.cycle; $.fn.cycle = function( options ) { var cmd, cmdFn, opts; var args = $.makeArray( arguments ); if ( $.type( options ) == 'number' ) { return this.cycle( 'goto', options ); } if ( $.type( options ) == 'string' ) { return this.each(function() { var cmdArgs; cmd = options; opts = $(this).data('cycle.opts'); if ( opts === undefined ) { c2.log('slideshow must be initialized before sending commands; "' + cmd + '" ignored'); return; } else { cmd = cmd == 'goto' ? 'jump' : cmd; // issue #3; change 'goto' to 'jump' internally cmdFn = opts.API[ cmd ]; if ( $.isFunction( cmdFn )) { cmdArgs = $.makeArray( args ); cmdArgs.shift(); return cmdFn.apply( opts.API, cmdArgs ); } else { c2.log( 'unknown command: ', cmd ); } } }); } else { return c2.apply( this, arguments ); } }; // copy props $.extend( $.fn.cycle, c2 ); $.extend( c2.API, { next: function() { var opts = this.opts(); if ( opts.busy && ! opts.manualTrump ) return; var count = opts.reverse ? -1 : 1; if ( opts.allowWrap === false && ( opts.currSlide + count ) >= opts.slideCount ) return; opts.API.advanceSlide( count ); opts.API.trigger('cycle-next', [ opts ]).log('cycle-next'); }, prev: function() { var opts = this.opts(); if ( opts.busy && ! opts.manualTrump ) return; var count = opts.reverse ? 1 : -1; if ( opts.allowWrap === false && ( opts.currSlide + count ) < 0 ) return; opts.API.advanceSlide( count ); opts.API.trigger('cycle-prev', [ opts ]).log('cycle-prev'); }, destroy: function() { this.stop(); //#204 var opts = this.opts(); var clean = $.isFunction( $._data ) ? $._data : $.noop; // hack for #184 and #201 clearTimeout(opts.timeoutId); opts.timeoutId = 0; opts.API.stop(); opts.API.trigger( 'cycle-destroyed', [ opts ] ).log('cycle-destroyed'); opts.container.removeData(); clean( opts.container[0], 'parsedAttrs', false ); // #75; remove inline styles if ( ! opts.retainStylesOnDestroy ) { opts.container.removeAttr( 'style' ); opts.slides.removeAttr( 'style' ); opts.slides.removeClass( opts.slideActiveClass ); } opts.slides.each(function() { $(this).removeData(); clean( this, 'parsedAttrs', false ); }); }, jump: function( index ) { // go to the requested slide var fwd; var opts = this.opts(); if ( opts.busy && ! opts.manualTrump ) return; var num = parseInt( index, 10 ); if (isNaN(num) || num < 0 || num >= opts.slides.length) { opts.API.log('goto: invalid slide index: ' + num); return; } if (num == opts.currSlide) { opts.API.log('goto: skipping, already on slide', num); return; } opts.nextSlide = num; clearTimeout(opts.timeoutId); opts.timeoutId = 0; opts.API.log('goto: ', num, ' (zero-index)'); fwd = opts.currSlide < opts.nextSlide; opts.API.prepareTx( true, fwd ); }, stop: function() { var opts = this.opts(); var pauseObj = opts.container; clearTimeout(opts.timeoutId); opts.timeoutId = 0; opts.API.stopTransition(); if ( opts.pauseOnHover ) { if ( opts.pauseOnHover !== true ) pauseObj = $( opts.pauseOnHover ); pauseObj.off('mouseenter mouseleave'); } opts.API.trigger('cycle-stopped', [ opts ]).log('cycle-stopped'); }, reinit: function() { var opts = this.opts(); opts.API.destroy(); opts.container.cycle(); }, remove: function( index ) { var opts = this.opts(); var slide, slideToRemove, slides = [], slideNum = 1; for ( var i=0; i < opts.slides.length; i++ ) { slide = opts.slides[i]; if ( i == index ) { slideToRemove = slide; } else { slides.push( slide ); $( slide ).data('cycle.opts').slideNum = slideNum; slideNum++; } } if ( slideToRemove ) { opts.slides = $( slides ); opts.slideCount--; $( slideToRemove ).remove(); if (index == opts.currSlide) opts.API.advanceSlide( 1 ); else if ( index < opts.currSlide ) opts.currSlide--; else opts.currSlide++; opts.API.trigger('cycle-slide-removed', [ opts, index, slideToRemove ]).log('cycle-slide-removed'); opts.API.updateView(); } } }); // listen for clicks on elements with data-cycle-cmd attribute $(document).on('click.cycle', '[data-cycle-cmd]', function(e) { // issue cycle command e.preventDefault(); var el = $(this); var command = el.data('cycle-cmd'); var context = el.data('cycle-context') || '.cycle-slideshow'; $(context).cycle(command, el.data('cycle-arg')); }); })(jQuery); /*! hash plugin for Cycle2; version: 20130725 */ (function($) { "use strict"; $(document).on( 'cycle-pre-initialize', function( e, opts ) { onHashChange( opts, true ); opts._onHashChange = function() { onHashChange( opts, false ); }; $( window ).on( 'hashchange', opts._onHashChange); }); $(document).on( 'cycle-update-view', function( e, opts, slideOpts ) { if ( slideOpts.hash && ( '#' + slideOpts.hash ) != window.location.hash ) { opts._hashFence = true; window.location.hash = slideOpts.hash; } }); $(document).on( 'cycle-destroyed', function( e, opts) { if ( opts._onHashChange ) { $( window ).off( 'hashchange', opts._onHashChange ); } }); function onHashChange( opts, setStartingSlide ) { var hash; if ( opts._hashFence ) { opts._hashFence = false; return; } hash = window.location.hash.substring(1); opts.slides.each(function(i) { if ( $(this).data( 'cycle-hash' ) == hash ) { if ( setStartingSlide === true ) { opts.startingSlide = i; } else { opts.nextSlide = i; opts.API.prepareTx( true, false ); } return false; } }); } })(jQuery); /*! loader plugin for Cycle2; version: 20130307 */ (function($) { "use strict"; $.extend($.fn.cycle.defaults, { loader: false }); $(document).on( 'cycle-bootstrap', function( e, opts ) { var addFn; if ( !opts.loader ) return; // override API.add for this slideshow addFn = opts.API.add; opts.API.add = add; function add( slides, prepend ) { var slideArr = []; if ( $.type( slides ) == 'string' ) slides = $.trim( slides ); else if ( $.type( slides) === 'array' ) { for (var i=0; i < slides.length; i++ ) slides[i] = $(slides[i])[0]; } slides = $( slides ); var slideCount = slides.length; if ( ! slideCount ) return; slides.hide().appendTo('body').each(function(i) { // appendTo fixes #56 var count = 0; var slide = $(this); var images = slide.is('img') ? slide : slide.find('img'); slide.data('index', i); // allow some images to be marked as unimportant (and filter out images w/o src value) images = images.filter(':not(.cycle-loader-ignore)').filter(':not([src=""])'); if ( ! images.length ) { --slideCount; slideArr.push( slide ); return; } count = images.length; images.each(function() { // add images that are already loaded if ( this.complete ) { imageLoaded(); } else { $(this).load(function() { imageLoaded(); }).error(function() { if ( --count === 0 ) { // ignore this slide opts.API.log('slide skipped; img not loaded:', this.src); if ( --slideCount === 0 && opts.loader == 'wait') { addFn.apply( opts.API, [ slideArr, prepend ] ); } } }); } }); function imageLoaded() { if ( --count === 0 ) { --slideCount; addSlide( slide ); } } }); if ( slideCount ) opts.container.addClass('cycle-loading'); function addSlide( slide ) { var curr; if ( opts.loader == 'wait' ) { slideArr.push( slide ); if ( slideCount === 0 ) { // #59; sort slides into original markup order slideArr.sort( sorter ); addFn.apply( opts.API, [ slideArr, prepend ] ); opts.container.removeClass('cycle-loading'); } } else { curr = $(opts.slides[opts.currSlide]); addFn.apply( opts.API, [ slide, prepend ] ); curr.show(); opts.container.removeClass('cycle-loading'); } } function sorter(a, b) { return a.data('index') - b.data('index'); } } }); })(jQuery); /*! pager plugin for Cycle2; version: 20130525 */ (function($) { "use strict"; $.extend($.fn.cycle.defaults, { pager: '> .cycle-pager', pagerActiveClass: 'cycle-pager-active', pagerEvent: 'click.cycle', pagerTemplate: '<span>&bull;</span>' }); $(document).on( 'cycle-bootstrap', function( e, opts, API ) { // add method to API API.buildPagerLink = buildPagerLink; }); $(document).on( 'cycle-slide-added', function( e, opts, slideOpts, slideAdded ) { if ( opts.pager ) { opts.API.buildPagerLink ( opts, slideOpts, slideAdded ); opts.API.page = page; } }); $(document).on( 'cycle-slide-removed', function( e, opts, index, slideRemoved ) { if ( opts.pager ) { var pagers = opts.API.getComponent( 'pager' ); pagers.each(function() { var pager = $(this); $( pager.children()[index] ).remove(); }); } }); $(document).on( 'cycle-update-view', function( e, opts, slideOpts ) { var pagers; if ( opts.pager ) { pagers = opts.API.getComponent( 'pager' ); pagers.each(function() { $(this).children().removeClass( opts.pagerActiveClass ) .eq( opts.currSlide ).addClass( opts.pagerActiveClass ); }); } }); $(document).on( 'cycle-destroyed', function( e, opts ) { var pager = opts.API.getComponent( 'pager' ); if ( pager ) { pager.children().off( opts.pagerEvent ); // #202 if ( opts.pagerTemplate ) pager.empty(); } }); function buildPagerLink( opts, slideOpts, slide ) { var pagerLink; var pagers = opts.API.getComponent( 'pager' ); pagers.each(function() { var pager = $(this); if ( slideOpts.pagerTemplate ) { var markup = opts.API.tmpl( slideOpts.pagerTemplate, slideOpts, opts, slide[0] ); pagerLink = $( markup ).appendTo( pager ); } else { pagerLink = pager.children().eq( opts.slideCount - 1 ); } pagerLink.on( opts.pagerEvent, function(e) { e.preventDefault(); opts.API.page( pager, e.currentTarget); }); }); } function page( pager, target ) { /*jshint validthis:true */ var opts = this.opts(); if ( opts.busy && ! opts.manualTrump ) return; var index = pager.children().index( target ); var nextSlide = index; var fwd = opts.currSlide < nextSlide; if (opts.currSlide == nextSlide) { return; // no op, clicked pager for the currently displayed slide } opts.nextSlide = nextSlide; opts.API.prepareTx( true, fwd ); opts.API.trigger('cycle-pager-activated', [opts, pager, target ]); } })(jQuery); /*! prevnext plugin for Cycle2; version: 20130709 */ (function($) { "use strict"; $.extend($.fn.cycle.defaults, { next: '> .cycle-next', nextEvent: 'click.cycle', disabledClass: 'disabled', prev: '> .cycle-prev', prevEvent: 'click.cycle', swipe: false }); $(document).on( 'cycle-initialized', function( e, opts ) { opts.API.getComponent( 'next' ).on( opts.nextEvent, function(e) { e.preventDefault(); opts.API.next(); }); opts.API.getComponent( 'prev' ).on( opts.prevEvent, function(e) { e.preventDefault(); opts.API.prev(); }); if ( opts.swipe ) { var nextEvent = opts.swipeVert ? 'swipeUp.cycle' : 'swipeLeft.cycle swipeleft.cycle'; var prevEvent = opts.swipeVert ? 'swipeDown.cycle' : 'swipeRight.cycle swiperight.cycle'; opts.container.on( nextEvent, function(e) { opts.API.next(); }); opts.container.on( prevEvent, function() { opts.API.prev(); }); } }); $(document).on( 'cycle-update-view', function( e, opts, slideOpts, currSlide ) { if ( opts.allowWrap ) return; var cls = opts.disabledClass; var next = opts.API.getComponent( 'next' ); var prev = opts.API.getComponent( 'prev' ); var prevBoundry = opts._prevBoundry || 0; var nextBoundry = (opts._nextBoundry !== undefined)?opts._nextBoundry:opts.slideCount - 1; if ( opts.currSlide == nextBoundry ) next.addClass( cls ).prop( 'disabled', true ); else next.removeClass( cls ).prop( 'disabled', false ); if ( opts.currSlide === prevBoundry ) prev.addClass( cls ).prop( 'disabled', true ); else prev.removeClass( cls ).prop( 'disabled', false ); }); $(document).on( 'cycle-destroyed', function( e, opts ) { opts.API.getComponent( 'prev' ).off( opts.nextEvent ); opts.API.getComponent( 'next' ).off( opts.prevEvent ); opts.container.off( 'swipeleft.cycle swiperight.cycle swipeLeft.cycle swipeRight.cycle swipeUp.cycle swipeDown.cycle' ); }); })(jQuery); /*! progressive loader plugin for Cycle2; version: 20130315 */ (function($) { "use strict"; $.extend($.fn.cycle.defaults, { progressive: false }); $(document).on( 'cycle-pre-initialize', function( e, opts ) { if ( !opts.progressive ) return; var API = opts.API; var nextFn = API.next; var prevFn = API.prev; var prepareTxFn = API.prepareTx; var type = $.type( opts.progressive ); var slides, scriptEl; if ( type == 'array' ) { slides = opts.progressive; } else if ($.isFunction( opts.progressive ) ) { slides = opts.progressive( opts ); } else if ( type == 'string' ) { scriptEl = $( opts.progressive ); slides = $.trim( scriptEl.html() ); if ( !slides ) return; // is it json array? if ( /^(\[)/.test( slides ) ) { try { slides = $.parseJSON( slides ); } catch(err) { API.log( 'error parsing progressive slides', err ); return; } } else { // plain text, split on delimeter slides = slides.split( new RegExp( scriptEl.data('cycle-split') || '\n') ); // #95; look for empty slide if ( ! slides[ slides.length - 1 ] ) slides.pop(); } } if ( prepareTxFn ) { API.prepareTx = function( manual, fwd ) { var index, slide; if ( manual || slides.length === 0 ) { prepareTxFn.apply( opts.API, [ manual, fwd ] ); return; } if ( fwd && opts.currSlide == ( opts.slideCount-1) ) { slide = slides[ 0 ]; slides = slides.slice( 1 ); opts.container.one('cycle-slide-added', function(e, opts ) { setTimeout(function() { opts.API.advanceSlide( 1 ); },50); }); opts.API.add( slide ); } else if ( !fwd && opts.currSlide === 0 ) { index = slides.length-1; slide = slides[ index ]; slides = slides.slice( 0, index ); opts.container.one('cycle-slide-added', function(e, opts ) { setTimeout(function() { opts.currSlide = 1; opts.API.advanceSlide( -1 ); },50); }); opts.API.add( slide, true ); } else { prepareTxFn.apply( opts.API, [ manual, fwd ] ); } }; } if ( nextFn ) { API.next = function() { var opts = this.opts(); if ( slides.length && opts.currSlide == ( opts.slideCount - 1 ) ) { var slide = slides[ 0 ]; slides = slides.slice( 1 ); opts.container.one('cycle-slide-added', function(e, opts ) { nextFn.apply( opts.API ); opts.container.removeClass('cycle-loading'); }); opts.container.addClass('cycle-loading'); opts.API.add( slide ); } else { nextFn.apply( opts.API ); } }; } if ( prevFn ) { API.prev = function() { var opts = this.opts(); if ( slides.length && opts.currSlide === 0 ) { var index = slides.length-1; var slide = slides[ index ]; slides = slides.slice( 0, index ); opts.container.one('cycle-slide-added', function(e, opts ) { opts.currSlide = 1; opts.API.advanceSlide( -1 ); opts.container.removeClass('cycle-loading'); }); opts.container.addClass('cycle-loading'); opts.API.add( slide, true ); } else { prevFn.apply( opts.API ); } }; } }); })(jQuery); /*! tmpl plugin for Cycle2; version: 20121227 */ (function($) { "use strict"; $.extend($.fn.cycle.defaults, { tmplRegex: '{{((.)?.*?)}}' }); $.extend($.fn.cycle.API, { tmpl: function( str, opts /*, ... */) { var regex = new RegExp( opts.tmplRegex || $.fn.cycle.defaults.tmplRegex, 'g' ); var args = $.makeArray( arguments ); args.shift(); return str.replace(regex, function(_, str) { var i, j, obj, prop, names = str.split('.'); for (i=0; i < args.length; i++) { obj = args[i]; if ( ! obj ) continue; if (names.length > 1) { prop = obj; for (j=0; j < names.length; j++) { obj = prop; prop = prop[ names[j] ] || str; } } else { prop = obj[str]; } if ($.isFunction(prop)) return prop.apply(obj, args); if (prop !== undefined && prop !== null && prop != str) return prop; } return str; }); } }); })(jQuery);
{ "content_hash": "a4e640254c831ed26f33fc385e96cb99", "timestamp": "", "source": "github", "line_count": 1504, "max_line_length": 124, "avg_line_length": 31.465425531914892, "alnum_prop": 0.5062547544586257, "repo_name": "jhernani/laurente_goj_godez_canete", "id": "381011b80507b353d3876e4e5977c2a5e7da7f26", "size": "47452", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "assets/js/jquery.cycle2.js", "mode": "33261", "license": "mit", "language": [ { "name": "ApacheConf", "bytes": "372" }, { "name": "CSS", "bytes": "739550" }, { "name": "HTML", "bytes": "3420" }, { "name": "JavaScript", "bytes": "669886" }, { "name": "PHP", "bytes": "7811060" } ], "symlink_target": "" }
package org.onvif.ver10.schema; import java.util.ArrayList; import java.util.List; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlAnyElement; import javax.xml.bind.annotation.XmlType; import org.apache.commons.lang3.builder.ToStringBuilder; import org.apache.cxf.xjc.runtime.JAXBToStringStyle; import org.w3c.dom.Element; /** * <p>Java class for PTZStatusFilterOptionsExtension complex type. * * <p>The following schema fragment specifies the expected content contained within this class. * * <pre> * &lt;complexType name="PTZStatusFilterOptionsExtension"&gt; * &lt;complexContent&gt; * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType"&gt; * &lt;sequence&gt; * &lt;any processContents='lax' namespace='http://www.onvif.org/ver10/schema' maxOccurs="unbounded" minOccurs="0"/&gt; * &lt;/sequence&gt; * &lt;/restriction&gt; * &lt;/complexContent&gt; * &lt;/complexType&gt; * </pre> * * */ @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "PTZStatusFilterOptionsExtension", propOrder = { "any" }) public class PTZStatusFilterOptionsExtension { @XmlAnyElement(lax = true) protected List<java.lang.Object> any; /** * Gets the value of the any property. * * <p> * This accessor method returns a reference to the live list, * not a snapshot. Therefore any modification you make to the * returned list will be present inside the JAXB object. * This is why there is not a <CODE>set</CODE> method for the any property. * * <p> * For example, to add a new item, do as follows: * <pre> * getAny().add(newItem); * </pre> * * * <p> * Objects of the following type(s) are allowed in the list * {@link Element } * {@link java.lang.Object } * * */ public List<java.lang.Object> getAny() { if (any == null) { any = new ArrayList<java.lang.Object>(); } return this.any; } /** * Generates a String representation of the contents of this type. * This is an extension method, produced by the 'ts' xjc plugin * */ @Override public String toString() { return ToStringBuilder.reflectionToString(this, JAXBToStringStyle.DEFAULT_STYLE); } }
{ "content_hash": "2cd830bd4e566b8bd734296c7cf6aff7", "timestamp": "", "source": "github", "line_count": 83, "max_line_length": 127, "avg_line_length": 29, "alnum_prop": 0.6547569588699627, "repo_name": "fpompermaier/onvif", "id": "9d8b37747d83dbdfbba461ee18c5558739252382", "size": "2407", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "onvif-ws-client/src/main/java/org/onvif/ver10/schema/PTZStatusFilterOptionsExtension.java", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Java", "bytes": "5555048" } ], "symlink_target": "" }
<PurchaseOrder xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://localhost:8080/source/schemas/poSource/xsd/purchaseOrder.xsd"> <Reference>LSMITH-20021009123337323PDT</Reference> <Actions> <Action> <User>KPARTNER</User> </Action> </Actions> <Reject/> <Requestor>Lindsey G. Smith</Requestor> <User>LSMITH</User> <CostCenter>R20</CostCenter> <ShippingInstructions> <name>Lindsey G. Smith</name> <address>200 Oracle Parkway Redwood Shores CA 94065 USA</address> <telephone>650 506 7200</telephone> </ShippingInstructions> <SpecialInstructions>COD</SpecialInstructions> <LineItems> <LineItem ItemNumber="1"> <Description>Peeping Tom</Description> <Part Id="37429142929" UnitPrice="39.95" Quantity="1"/> </LineItem> <LineItem ItemNumber="2"> <Description>The 39 Steps</Description> <Part Id="37429135228" UnitPrice="39.95" Quantity="3"/> </LineItem> <LineItem ItemNumber="3"> <Description>Walkabout</Description> <Part Id="37429123225" UnitPrice="29.99" Quantity="3"/> </LineItem> <LineItem ItemNumber="4"> <Description>Under the Roofs of Paris</Description> <Part Id="37429168929" UnitPrice="29.95" Quantity="3"/> </LineItem> <LineItem ItemNumber="5"> <Description>Shock Corridor</Description> <Part Id="37429125922" UnitPrice="29.95" Quantity="2"/> </LineItem> <LineItem ItemNumber="6"> <Description>In the Mood for Love</Description> <Part Id="715515012928" UnitPrice="39.95" Quantity="1"/> </LineItem> <LineItem ItemNumber="7"> <Description>The Blob</Description> <Part Id="715515011129" UnitPrice="39.95" Quantity="4"/> </LineItem> <LineItem ItemNumber="8"> <Description>Time Bandits</Description> <Part Id="715515010122" UnitPrice="39.95" Quantity="1"/> </LineItem> <LineItem ItemNumber="9"> <Description>Black Narcissus</Description> <Part Id="37429152126" UnitPrice="39.95" Quantity="4"/> </LineItem> <LineItem ItemNumber="10"> <Description>Hearts and Minds</Description> <Part Id="37429166321" UnitPrice="39.95" Quantity="1"/> </LineItem> <LineItem ItemNumber="11"> <Description>The Lady Eve</Description> <Part Id="715515011624" UnitPrice="39.95" Quantity="2"/> </LineItem> <LineItem ItemNumber="12"> <Description>Written on the Wind</Description> <Part Id="715515011525" UnitPrice="29.95" Quantity="2"/> </LineItem> <LineItem ItemNumber="13"> <Description>The Third Man</Description> <Part Id="37429141625" UnitPrice="39.95" Quantity="3"/> </LineItem> <LineItem ItemNumber="14"> <Description>Orphic Trilogy </Description> <Part Id="37429148327" UnitPrice="79.95" Quantity="2"/> </LineItem> <LineItem ItemNumber="15"> <Description>Getrud</Description> <Part Id="37429158524" UnitPrice="0.0" Quantity="1"/> </LineItem> <LineItem ItemNumber="16"> <Description>Wild Strawberries</Description> <Part Id="37429162422" UnitPrice="39.95" Quantity="4"/> </LineItem> <LineItem ItemNumber="17"> <Description>Hearts and Minds</Description> <Part Id="37429166321" UnitPrice="39.95" Quantity="2"/> </LineItem> <LineItem ItemNumber="18"> <Description>This is Spinal Tap</Description> <Part Id="715515009126" UnitPrice="39.95" Quantity="1"/> </LineItem> <LineItem ItemNumber="19"> <Description>The 39 Steps</Description> <Part Id="37429135228" UnitPrice="39.95" Quantity="1"/> </LineItem> <LineItem ItemNumber="20"> <Description>Fiend without a Face</Description> <Part Id="715515011327" UnitPrice="39.95" Quantity="4"/> </LineItem> <LineItem ItemNumber="21"> <Description>The Rock</Description> <Part Id="786936150421" UnitPrice="49.95" Quantity="3"/> </LineItem> <LineItem ItemNumber="22"> <Description>Cleo from 5 to 7</Description> <Part Id="37429149027" UnitPrice="29.95" Quantity="1"/> </LineItem> <LineItem ItemNumber="23"> <Description>High and Low</Description> <Part Id="37429130322" UnitPrice="39.95" Quantity="1"/> </LineItem> <LineItem ItemNumber="24"> <Description>Carnival of Souls</Description> <Part Id="715515010221" UnitPrice="39.95" Quantity="2"/> </LineItem> </LineItems> </PurchaseOrder>
{ "content_hash": "50e15a9c736db7a3c7307be0f39f307c", "timestamp": "", "source": "github", "line_count": 121, "max_line_length": 169, "avg_line_length": 40.15702479338843, "alnum_prop": 0.6056801811072237, "repo_name": "kengardiner/db-sample-schemas", "id": "8aa847b7617798c4bd1b183827c620ea46a57211", "size": "4859", "binary": false, "copies": "3", "ref": "refs/heads/master", "path": "order_entry/2002/Aug/LSMITH-20021009123337323PDT.xml", "mode": "33188", "license": "mit", "language": [ { "name": "HTML", "bytes": "5392" }, { "name": "PLSQL", "bytes": "202125" }, { "name": "SQLPL", "bytes": "787683" }, { "name": "XSLT", "bytes": "14419" } ], "symlink_target": "" }
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <!-- NewPage --> <html lang="en"> <head> <!-- Generated by javadoc (1.8.0_45) on Sat Sep 19 17:53:03 EDT 2015 --> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>Uses of Interface com.thinkaurelius.titan.graphdb.tinkerpop.optimize.MultiQueriable (Titan 1.0.0 API)</title> <meta name="date" content="2015-09-19"> <link rel="stylesheet" type="text/css" href="../../../../../../../stylesheet.css" title="Style"> <script type="text/javascript" src="../../../../../../../script.js"></script> </head> <body> <script type="text/javascript"><!-- try { if (location.href.indexOf('is-external=true') == -1) { parent.document.title="Uses of Interface com.thinkaurelius.titan.graphdb.tinkerpop.optimize.MultiQueriable (Titan 1.0.0 API)"; } } catch(err) { } //--> </script> <noscript> <div>JavaScript is disabled on your browser.</div> </noscript> <!-- ========= START OF TOP NAVBAR ======= --> <div class="topNav"><a name="navbar.top"> <!-- --> </a> <div class="skipNav"><a href="#skip.navbar.top" title="Skip navigation links">Skip navigation links</a></div> <a name="navbar.top.firstrow"> <!-- --> </a> <ul class="navList" title="Navigation"> <li><a href="../../../../../../../overview-summary.html">Overview</a></li> <li><a href="../package-summary.html">Package</a></li> <li><a href="../../../../../../../com/thinkaurelius/titan/graphdb/tinkerpop/optimize/MultiQueriable.html" title="interface in com.thinkaurelius.titan.graphdb.tinkerpop.optimize">Class</a></li> <li class="navBarCell1Rev">Use</li> <li><a href="../package-tree.html">Tree</a></li> <li><a href="../../../../../../../deprecated-list.html">Deprecated</a></li> <li><a href="../../../../../../../index-all.html">Index</a></li> <li><a href="../../../../../../../help-doc.html">Help</a></li> </ul> </div> <div class="subNav"> <ul class="navList"> <li>Prev</li> <li>Next</li> </ul> <ul class="navList"> <li><a href="../../../../../../../index.html?com/thinkaurelius/titan/graphdb/tinkerpop/optimize/class-use/MultiQueriable.html" target="_top">Frames</a></li> <li><a href="MultiQueriable.html" target="_top">No&nbsp;Frames</a></li> </ul> <ul class="navList" id="allclasses_navbar_top"> <li><a href="../../../../../../../allclasses-noframe.html">All&nbsp;Classes</a></li> </ul> <div> <script type="text/javascript"><!-- allClassesLink = document.getElementById("allclasses_navbar_top"); if(window==top) { allClassesLink.style.display = "block"; } else { allClassesLink.style.display = "none"; } //--> </script> </div> <a name="skip.navbar.top"> <!-- --> </a></div> <!-- ========= END OF TOP NAVBAR ========= --> <div class="header"> <h2 title="Uses of Interface com.thinkaurelius.titan.graphdb.tinkerpop.optimize.MultiQueriable" class="title">Uses of Interface<br>com.thinkaurelius.titan.graphdb.tinkerpop.optimize.MultiQueriable</h2> </div> <div class="classUseContainer"> <ul class="blockList"> <li class="blockList"> <table class="useSummary" border="0" cellpadding="3" cellspacing="0" summary="Use table, listing packages, and an explanation"> <caption><span>Packages that use <a href="../../../../../../../com/thinkaurelius/titan/graphdb/tinkerpop/optimize/MultiQueriable.html" title="interface in com.thinkaurelius.titan.graphdb.tinkerpop.optimize">MultiQueriable</a></span><span class="tabEnd">&nbsp;</span></caption> <tr> <th class="colFirst" scope="col">Package</th> <th class="colLast" scope="col">Description</th> </tr> <tbody> <tr class="altColor"> <td class="colFirst"><a href="#com.thinkaurelius.titan.graphdb.tinkerpop.optimize">com.thinkaurelius.titan.graphdb.tinkerpop.optimize</a></td> <td class="colLast">&nbsp;</td> </tr> </tbody> </table> </li> <li class="blockList"> <ul class="blockList"> <li class="blockList"><a name="com.thinkaurelius.titan.graphdb.tinkerpop.optimize"> <!-- --> </a> <h3>Uses of <a href="../../../../../../../com/thinkaurelius/titan/graphdb/tinkerpop/optimize/MultiQueriable.html" title="interface in com.thinkaurelius.titan.graphdb.tinkerpop.optimize">MultiQueriable</a> in <a href="../../../../../../../com/thinkaurelius/titan/graphdb/tinkerpop/optimize/package-summary.html">com.thinkaurelius.titan.graphdb.tinkerpop.optimize</a></h3> <table class="useSummary" border="0" cellpadding="3" cellspacing="0" summary="Use table, listing classes, and an explanation"> <caption><span>Classes in <a href="../../../../../../../com/thinkaurelius/titan/graphdb/tinkerpop/optimize/package-summary.html">com.thinkaurelius.titan.graphdb.tinkerpop.optimize</a> that implement <a href="../../../../../../../com/thinkaurelius/titan/graphdb/tinkerpop/optimize/MultiQueriable.html" title="interface in com.thinkaurelius.titan.graphdb.tinkerpop.optimize">MultiQueriable</a></span><span class="tabEnd">&nbsp;</span></caption> <tr> <th class="colFirst" scope="col">Modifier and Type</th> <th class="colLast" scope="col">Class and Description</th> </tr> <tbody> <tr class="altColor"> <td class="colFirst"><code>class&nbsp;</code></td> <td class="colLast"><code><span class="memberNameLink"><a href="../../../../../../../com/thinkaurelius/titan/graphdb/tinkerpop/optimize/TitanPropertiesStep.html" title="class in com.thinkaurelius.titan.graphdb.tinkerpop.optimize">TitanPropertiesStep</a>&lt;E&gt;</span></code>&nbsp;</td> </tr> <tr class="rowColor"> <td class="colFirst"><code>class&nbsp;</code></td> <td class="colLast"><code><span class="memberNameLink"><a href="../../../../../../../com/thinkaurelius/titan/graphdb/tinkerpop/optimize/TitanVertexStep.html" title="class in com.thinkaurelius.titan.graphdb.tinkerpop.optimize">TitanVertexStep</a>&lt;E extends org.apache.tinkerpop.gremlin.structure.Element&gt;</span></code>&nbsp;</td> </tr> </tbody> </table> </li> </ul> </li> </ul> </div> <!-- ======= START OF BOTTOM NAVBAR ====== --> <div class="bottomNav"><a name="navbar.bottom"> <!-- --> </a> <div class="skipNav"><a href="#skip.navbar.bottom" title="Skip navigation links">Skip navigation links</a></div> <a name="navbar.bottom.firstrow"> <!-- --> </a> <ul class="navList" title="Navigation"> <li><a href="../../../../../../../overview-summary.html">Overview</a></li> <li><a href="../package-summary.html">Package</a></li> <li><a href="../../../../../../../com/thinkaurelius/titan/graphdb/tinkerpop/optimize/MultiQueriable.html" title="interface in com.thinkaurelius.titan.graphdb.tinkerpop.optimize">Class</a></li> <li class="navBarCell1Rev">Use</li> <li><a href="../package-tree.html">Tree</a></li> <li><a href="../../../../../../../deprecated-list.html">Deprecated</a></li> <li><a href="../../../../../../../index-all.html">Index</a></li> <li><a href="../../../../../../../help-doc.html">Help</a></li> </ul> </div> <div class="subNav"> <ul class="navList"> <li>Prev</li> <li>Next</li> </ul> <ul class="navList"> <li><a href="../../../../../../../index.html?com/thinkaurelius/titan/graphdb/tinkerpop/optimize/class-use/MultiQueriable.html" target="_top">Frames</a></li> <li><a href="MultiQueriable.html" target="_top">No&nbsp;Frames</a></li> </ul> <ul class="navList" id="allclasses_navbar_bottom"> <li><a href="../../../../../../../allclasses-noframe.html">All&nbsp;Classes</a></li> </ul> <div> <script type="text/javascript"><!-- allClassesLink = document.getElementById("allclasses_navbar_bottom"); if(window==top) { allClassesLink.style.display = "block"; } else { allClassesLink.style.display = "none"; } //--> </script> </div> <a name="skip.navbar.bottom"> <!-- --> </a></div> <!-- ======== END OF BOTTOM NAVBAR ======= --> <p class="legalCopy"><small>Copyright &#169; 2012&#x2013;2015. All rights reserved.</small></p> </body> </html>
{ "content_hash": "df39d3467e4da8ce2c6d93300b8d225f", "timestamp": "", "source": "github", "line_count": 170, "max_line_length": 442, "avg_line_length": 45.61764705882353, "alnum_prop": 0.6548033526756931, "repo_name": "nelmiux/CarnotKE", "id": "e04a92da478f8a2d00cec8cc0fc663892f19887f", "size": "7755", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "jyhton/extlibs/titan-1.0.0-hadoop1/javadocs/com/thinkaurelius/titan/graphdb/tinkerpop/optimize/class-use/MultiQueriable.html", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "ANTLR", "bytes": "1605" }, { "name": "Batchfile", "bytes": "23996" }, { "name": "C", "bytes": "2514" }, { "name": "CSS", "bytes": "83366" }, { "name": "GAP", "bytes": "129850" }, { "name": "Groff", "bytes": "42" }, { "name": "HTML", "bytes": "12867403" }, { "name": "Java", "bytes": "16007057" }, { "name": "JavaScript", "bytes": "11934" }, { "name": "Makefile", "bytes": "2261" }, { "name": "PLSQL", "bytes": "45772" }, { "name": "Perl", "bytes": "9821" }, { "name": "Python", "bytes": "41375827" }, { "name": "R", "bytes": "2740" }, { "name": "Shell", "bytes": "70220" }, { "name": "Visual Basic", "bytes": "962" }, { "name": "XSLT", "bytes": "218435" } ], "symlink_target": "" }
package project.fantalk.api.fanfou; import java.text.ParsePosition; import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.Date; import java.util.List; import java.util.Locale; import org.json.JSONArray; import org.json.JSONException; import org.json.JSONObject; import project.fantalk.api.Utils; import project.fantalk.api.fanfou.domain.Message; import project.fantalk.api.fanfou.domain.Notification; import project.fantalk.api.fanfou.domain.Status; import project.fantalk.api.fanfou.domain.Trends; import project.fantalk.api.fanfou.domain.User; /** * @author mcxiaoke JSON数据解析工具类 */ public final class Parser { /** * @param data * @return 解析User */ public static User parseUser(String data) { return User.parse(data); } /** * @param data * @return 解析Status */ public static Status parseStatus(String data) { return Status.parse(data); } /** * @param data * @return 解析Message */ public static Message parseMessage(String data) { return Message.parse(data); } /** * @param data * @return 解析私信收件箱 */ public static List<Message> parseDirectMessages(String data) { return parseMessages(data); } /** * @param data * @return 解析私信发件箱 */ public static List<Message> parseDirectMessagesSent(String data) { return parseMessages(data); } /** * @param data * @return 解析Friends */ public static List<String> parseFriends(String data) { return parseIDs(data); } /** * @param data * @return 解析Followers */ public static List<String> parsefollowers(String data) { return parseIDs(data); } /** * @param data * @return 解析收藏列表 */ public static List<Status> parseFavorites(String data) { return parseStatuses(data); } public static List<Status> parsePublicSearch(String data) { return parseStatuses(data); } /** * @param data * @return 解析时间线 */ public static List<Status> parseTimeline(String data) { return parseStatuses(data); } /** * @param data * @return 解析消息列表 */ public static List<Status> parseStatuses(String data) { List<Status> statuses = new ArrayList<Status>(); try { JSONArray a = new JSONArray(data); // if(a==null){ // return null; // } for (int i = 0; i < a.length(); i++) { JSONObject o = a.getJSONObject(i); Status status = Status.parse(o); statuses.add(status); } // return statuses; } catch (JSONException e) { // return null; } return statuses; } /** * @param data * @return 解析私信列表 */ public static List<Message> parseMessages(String data) { List<Message> messages = new ArrayList<Message>(); try { JSONArray a = new JSONArray(data); // if(a==null){ // return null; // } for (int i = 0; i < a.length(); i++) { JSONObject o = a.getJSONObject(i); Message message = Message.parse(o); messages.add(message); } // return messages; } catch (JSONException e) { // return null; } return messages; } /** * @param data * @return 解析ID列表 */ public static List<String> parseIDs(String data) { List<String> ids = new ArrayList<String>(); try { JSONArray a = new JSONArray(data); // if(a==null){ // return null; // } for (int i = 0; i < a.length(); i++) { String id = a.getString(i); ids.add(id); } // return ids; } catch (JSONException e) { // return null; } return ids; } /** * 解析用户列表 * @param data * @return */ public static List<User> parseUsers(String data) { List<User> users = new ArrayList<User>(); try { JSONArray a = new JSONArray(data); // if(a==null){ // return null; // } for (int i = 0; i < a.length(); i++) { JSONObject o = a.getJSONObject(i); User user = User.parse(o); users.add(user); } // return users; } catch (JSONException e) { // return null; } return users; } /** * @param s 代表饭否日期和时间的字符串 * @return 字符串解析为对应的Date类实例 */ public static Date parseDate(String s) { // Fanfou Date String example --> "Mon Dec 13 03:10:21 +0000 2010" final String fanfouDateString = "EEE MMM dd HH:mm:ss Z yyyy"; final SimpleDateFormat FANFOU_DATE_FORMAT = new SimpleDateFormat( fanfouDateString, Locale.US); final ParsePosition position = new ParsePosition(0);// 这个如果放在方法外面的话,必须每次重置Index为0 Date date = FANFOU_DATE_FORMAT.parse(s, position); return date; } public static List<Trends> parseTrends(String data) throws JSONException { if (Utils.isEmpty(data)) { return null; } List<Trends> list = new ArrayList<Trends>(); JSONObject o = new JSONObject(data); JSONArray jsonArray = o.getJSONArray("trends"); for (int i = 0; i < jsonArray.length(); ++i) { JSONObject jsonObject = jsonArray.getJSONObject(i); Trends trends = new Trends(); trends.setName(jsonObject.getString("name")); trends.setQueryWord(jsonObject.getString("query")); trends.setUrl(jsonObject.getString("url")); list.add(trends); } return list; } public static Notification parseNotification(String data) throws JSONException { Notification notification = new Notification(); JSONObject o = new JSONObject(data); notification.setMentions(o.getString("mentions")); notification.setDirect_messages(o.getString("direct_messages")); notification.setFriend_requests(o.getString("friend_requests")); return notification; } }
{ "content_hash": "4467ac8347acbe8f6c419037c201bd3f", "timestamp": "", "source": "github", "line_count": 235, "max_line_length": 89, "avg_line_length": 26.43404255319149, "alnum_prop": 0.5695428203477141, "repo_name": "cndoublehero/FanTalk", "id": "6ed0caee2809605353b534705a7aa6a9733b466d", "size": "6430", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "src/project/fantalk/api/fanfou/Parser.java", "mode": "33188", "license": "mit", "language": [ { "name": "Java", "bytes": "243732" } ], "symlink_target": "" }
package me.ilbba.blog.util; import java.util.ArrayList; import java.util.List; /** * 类型枚举类 * * @author liangbo * @date 2016/4/1 22:45 */ public class TypeEnum { /** * 内容表可以扩展出来的类型 * * post(文章) draft(草稿) page(页面) link(链接) attachment(文件) */ public enum ContentType { post("post"), page("page"), draft("draft"), attachment("attachment"); private String value; ContentType(String value) { this.value = value; } public String getValue() { return value; } public void setValue(String value) { this.value = value; } } /** * 项目表里的类型 * * category(分类) tag(标签) link_category(链接分类) */ public enum TermType { category("category"), tag("tag"); private String value; TermType(String value) { this.value = value; } public String getValue() { return value; } public void setValue(String value) { this.value = value; } public static List<String> getAllTermType() { List<String> typeList = new ArrayList<>(); for(TermType type : TermType.values()) { typeList.add(type.getValue()); } return typeList; } } /** * 评论类型 * */ public enum CommentType { comment("comment"), reply("reply"); private String value; CommentType(String value) { this.value = value; } public String getValue() { return value; } public void setValue(String value) { this.value = value; } } /** * 链接类型 */ public enum LinkType { menu_link("menu_link"), friendly_link("friendly_link"); private String value; LinkType(String value) { this.value = value; } public String getValue() { return value; } public void setValue(String value) { this.value = value; } } }
{ "content_hash": "7528685b00e222d87c6880abc0f06e9f", "timestamp": "", "source": "github", "line_count": 111, "max_line_length": 78, "avg_line_length": 19.243243243243242, "alnum_prop": 0.4948501872659176, "repo_name": "amuguelove/blog", "id": "23fa46e0bab21cdfb3bc58971b3a097a8bfc26b1", "size": "2236", "binary": false, "copies": "1", "ref": "refs/heads/version_1.1.0", "path": "src/main/java/me/ilbba/blog/util/TypeEnum.java", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "CSS", "bytes": "289604" }, { "name": "FreeMarker", "bytes": "2966" }, { "name": "HTML", "bytes": "356593" }, { "name": "Java", "bytes": "65599" }, { "name": "JavaScript", "bytes": "647231" }, { "name": "PHP", "bytes": "2157" } ], "symlink_target": "" }
import os from flask import Flask from flask_sqlalchemy import SQLAlchemy app = Flask(__name__) db = SQLAlchemy(app) # Set secret key for sessions app.secret_key = os.environ.get('SECRET_KEY') import calm_temple_8514.index
{ "content_hash": "977456f10a219c71e46847ac68ae3d35", "timestamp": "", "source": "github", "line_count": 11, "max_line_length": 45, "avg_line_length": 20.545454545454547, "alnum_prop": 0.7566371681415929, "repo_name": "LauriKauhanen/calm-temple-8514", "id": "fb81bfd8132a11b2fa3c26edaf1e174cbbeea7e9", "size": "241", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "calm_temple_8514/__init__.py", "mode": "33188", "license": "mit", "language": [ { "name": "CSS", "bytes": "5315" }, { "name": "HTML", "bytes": "8192" }, { "name": "JavaScript", "bytes": "1313" }, { "name": "Python", "bytes": "10761" } ], "symlink_target": "" }
server-http: server-http.c gcc server-http.c -o server-http web-get: webget.c gcc webget.c -o webget server-tcp: server-tcp.c gcc server-tcp.c -o server-tcp client-tcp: client-tcp.c gcc client-tcp.c -o client-tcp server-udp: server-udp.c gcc server-udp.c -o server-udp client-udp: client-udp.c gcc client-udp.c -o client-udp clean: @rm server-tcp client-tcp server-udp client-udp
{ "content_hash": "39ff7121871fa19197b63c08e34a5709", "timestamp": "", "source": "github", "line_count": 21, "max_line_length": 48, "avg_line_length": 18.761904761904763, "alnum_prop": 0.7284263959390863, "repo_name": "zhangwei1984/adv-net-samples", "id": "468b93877e221840d3f1806d4317d32b1bbda435", "size": "394", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "sockets/Makefile", "mode": "33188", "license": "mit", "language": [ { "name": "C", "bytes": "148159" }, { "name": "C++", "bytes": "1053" }, { "name": "HTML", "bytes": "110" }, { "name": "Makefile", "bytes": "3476" }, { "name": "Shell", "bytes": "419" } ], "symlink_target": "" }
class AuthTokenVerifier attr_reader :errors def initialize(token, member) @token = token @errors = [] @member = member end def verify if no_matching_authentication @errors << I18n.t('confirmation_mailer.follow_up_page.account_not_found') else check_authentication end self end def authentication @authentication ||= @member.authentication end def success? @errors.empty? end private def no_matching_authentication authentication.nil? || authentication.token != @token end def check_authentication if authentication.confirmed_at @errors << I18n.t('confirmation_mailer.follow_up_page.account_already_confirmed') else authentication.update(confirmed_at: Time.now) end end end
{ "content_hash": "9d1e37b89096be2cbabefed45f35ad38", "timestamp": "", "source": "github", "line_count": 41, "max_line_length": 87, "avg_line_length": 19.146341463414632, "alnum_prop": 0.6840764331210191, "repo_name": "SumOfUs/Champaign", "id": "fe1166a019d207377e950a1fe0a1b8412c343fee", "size": "816", "binary": false, "copies": "1", "ref": "refs/heads/development", "path": "app/services/auth_token_verifier.rb", "mode": "33188", "license": "mit", "language": [ { "name": "CSS", "bytes": "9404" }, { "name": "Dockerfile", "bytes": "254" }, { "name": "HTML", "bytes": "584586" }, { "name": "JavaScript", "bytes": "467169" }, { "name": "Liquid", "bytes": "42808" }, { "name": "Procfile", "bytes": "87" }, { "name": "Ruby", "bytes": "1656000" }, { "name": "SCSS", "bytes": "87041" }, { "name": "Shell", "bytes": "5335" }, { "name": "Slim", "bytes": "141763" }, { "name": "TypeScript", "bytes": "68833" } ], "symlink_target": "" }
#ifndef SHADOWFLARE_MPQ_API_INCLUDED #define SHADOWFLARE_MPQ_API_INCLUDED #include <windows.h> #ifndef SFMPQ_STATIC #ifdef SFMPQAPI_EXPORTS #define SFMPQAPI __declspec(dllexport) #else #define SFMPQAPI __declspec(dllimport) #endif #else #define SFMPQAPI #endif #ifdef __cplusplus extern "C" { #endif typedef struct { WORD Major; WORD Minor; WORD Revision; WORD Subrevision; } SFMPQVERSION; // MpqInitialize does nothing. It is only provided for // compatibility with MPQ archivers that use lmpqapi. BOOL SFMPQAPI WINAPI MpqInitialize(); LPCSTR SFMPQAPI WINAPI MpqGetVersionString(); float SFMPQAPI WINAPI MpqGetVersion(); void SFMPQAPI WINAPI SFMpqDestroy(); // This no longer needs to be called. It is only provided for compatibility with older versions void SFMPQAPI WINAPI AboutSFMpq(); // Displays an about page in a web browser (this has only been tested in Internet Explorer). This is only for the dll version of SFmpq // SFMpqGetVersionString2's return value is the required length of the buffer plus // the terminating null, so use SFMpqGetVersionString2(0, 0); to get the length. LPCSTR SFMPQAPI WINAPI SFMpqGetVersionString(); DWORD SFMPQAPI WINAPI SFMpqGetVersionString2(LPSTR lpBuffer, DWORD dwBufferLength); SFMPQVERSION SFMPQAPI WINAPI SFMpqGetVersion(); // Returns 0 if the dll version is equal to the version your program was compiled // with, 1 if the dll is newer, -1 if the dll is older. long SFMPQAPI __inline SFMpqCompareVersion(); // General error codes #define MPQ_ERROR_MPQ_INVALID 0x85200065 #define MPQ_ERROR_FILE_NOT_FOUND 0x85200066 #define MPQ_ERROR_DISK_FULL 0x85200068 //Physical write file to MPQ failed #define MPQ_ERROR_HASH_TABLE_FULL 0x85200069 #define MPQ_ERROR_ALREADY_EXISTS 0x8520006A #define MPQ_ERROR_BAD_OPEN_MODE 0x8520006C //When MOAU_READ_ONLY is used without MOAU_OPEN_EXISTING #define MPQ_ERROR_COMPACT_ERROR 0x85300001 // MpqOpenArchiveForUpdate flags #define MOAU_CREATE_NEW 0x00 //If archive does not exist, it will be created. If it exists, the function will fail #define MOAU_CREATE_ALWAYS 0x08 //Will always create a new archive #define MOAU_OPEN_EXISTING 0x04 //If archive exists, it will be opened. If it does not exist, the function will fail #define MOAU_OPEN_ALWAYS 0x20 //If archive exists, it will be opened. If it does not exist, it will be created #define MOAU_READ_ONLY 0x10 //Must be used with MOAU_OPEN_EXISTING. Archive will be opened without write access #define MOAU_MAINTAIN_ATTRIBUTES 0x02 //Will be used in a future version to create the (attributes) file #define MOAU_MAINTAIN_LISTFILE 0x01 //Creates and maintains a list of files in archive when they are added, replaced, or deleted // MpqOpenArchiveForUpdateEx constants #define DEFAULT_BLOCK_SIZE 3 // 512 << number = block size #define USE_DEFAULT_BLOCK_SIZE 0xFFFFFFFF // Use default block size that is defined internally // MpqAddFileToArchive flags #define MAFA_EXISTS 0x80000000 //This flag will be added if not present #define MAFA_UNKNOWN40000000 0x40000000 //Unknown flag #define MAFA_MODCRYPTKEY 0x00020000 //Used with MAFA_ENCRYPT. Uses an encryption key based on file position and size #define MAFA_ENCRYPT 0x00010000 //Encrypts the file. The file is still accessible when using this, so the use of this has depreciated #define MAFA_COMPRESS 0x00000200 //File is to be compressed when added. This is used for most of the compression methods #define MAFA_COMPRESS2 0x00000100 //File is compressed with standard compression only (was used in Diablo 1) #define MAFA_REPLACE_EXISTING 0x00000001 //If file already exists, it will be replaced // MpqAddFileToArchiveEx compression flags #define MAFA_COMPRESS_STANDARD 0x08 //Standard PKWare DCL compression #define MAFA_COMPRESS_DEFLATE 0x02 //ZLib's deflate compression #define MAFA_COMPRESS_WAVE 0x81 //Standard wave compression #define MAFA_COMPRESS_WAVE2 0x41 //Unused wave compression // Flags for individual compression types used for wave compression #define MAFA_COMPRESS_WAVECOMP1 0x80 //Main compressor for standard wave compression #define MAFA_COMPRESS_WAVECOMP2 0x40 //Main compressor for unused wave compression #define MAFA_COMPRESS_WAVECOMP3 0x01 //Secondary compressor for wave compression // ZLib deflate compression level constants (used with MpqAddFileToArchiveEx and MpqAddFileFromBufferEx) #define Z_NO_COMPRESSION 0 #define Z_BEST_SPEED 1 #define Z_BEST_COMPRESSION 9 #define Z_DEFAULT_COMPRESSION (-1) //Default level is 6 with current ZLib version // MpqAddWaveToArchive quality flags #define MAWA_QUALITY_HIGH 1 //Higher compression, lower quality #define MAWA_QUALITY_MEDIUM 0 //Medium compression, medium quality #define MAWA_QUALITY_LOW 2 //Lower compression, higher quality // SFileGetFileInfo flags #define SFILE_INFO_BLOCK_SIZE 0x01 //Block size in MPQ #define SFILE_INFO_HASH_TABLE_SIZE 0x02 //Hash table size in MPQ #define SFILE_INFO_NUM_FILES 0x03 //Number of files in MPQ #define SFILE_INFO_TYPE 0x04 //Is MPQHANDLE a file or an MPQ? #define SFILE_INFO_SIZE 0x05 //Size of MPQ or uncompressed file #define SFILE_INFO_COMPRESSED_SIZE 0x06 //Size of compressed file #define SFILE_INFO_FLAGS 0x07 //File flags (compressed, etc.), file attributes if a file not in an archive #define SFILE_INFO_PARENT 0x08 //Handle of MPQ that file is in #define SFILE_INFO_POSITION 0x09 //Position of file pointer in files #define SFILE_INFO_LOCALEID 0x0A //Locale ID of file in MPQ #define SFILE_INFO_PRIORITY 0x0B //Priority of open MPQ #define SFILE_INFO_HASH_INDEX 0x0C //Hash table index of file in MPQ #define SFILE_INFO_BLOCK_INDEX 0x0D //Block table index of file in MPQ // Return values of SFileGetFileInfo when SFILE_INFO_TYPE flag is used #define SFILE_TYPE_MPQ 0x01 #define SFILE_TYPE_FILE 0x02 // SFileListFiles flags #define SFILE_LIST_MEMORY_LIST 0x01 // Specifies that lpFilelists is a file list from memory, rather than being a list of file lists #define SFILE_LIST_ONLY_KNOWN 0x02 // Only list files that the function finds a name for #define SFILE_LIST_ONLY_UNKNOWN 0x04 // Only list files that the function does not find a name for // SFileOpenArchive flags #define SFILE_OPEN_HARD_DISK_FILE 0x0000 //Open archive without regard to the drive type it resides on #define SFILE_OPEN_CD_ROM_FILE 0x0001 //Open the archive only if it is on a CD-ROM #define SFILE_OPEN_ALLOW_WRITE 0x8000 //Open file with write access // SFileOpenFileEx search scopes #define SFILE_SEARCH_CURRENT_ONLY 0x00 //Used with SFileOpenFileEx; only the archive with the handle specified will be searched for the file #define SFILE_SEARCH_ALL_OPEN 0x01 //SFileOpenFileEx will look through all open archives for the file. This flag also allows files outside the archive to be used typedef HANDLE MPQHANDLE; struct FILELISTENTRY { DWORD dwFileExists; // Nonzero if this entry is used LCID lcLocale; // Locale ID of file DWORD dwCompressedSize; // Compressed size of file DWORD dwFullSize; // Uncompressed size of file DWORD dwFlags; // Flags for file char szFileName[260]; }; struct MPQARCHIVE; struct MPQFILE; struct MPQHEADER; struct BLOCKTABLEENTRY; struct HASHTABLEENTRY; struct MPQHEADER { DWORD dwMPQID; //"MPQ\x1A" for mpq's, "BN3\x1A" for bncache.dat DWORD dwHeaderSize; // Size of this header DWORD dwMPQSize; //The size of the mpq archive WORD wUnused0C; // Seems to always be 0 WORD wBlockSize; // Size of blocks in files equals 512 << wBlockSize DWORD dwHashTableOffset; // Offset to hash table DWORD dwBlockTableOffset; // Offset to block table DWORD dwHashTableSize; // Number of entries in hash table DWORD dwBlockTableSize; // Number of entries in block table }; //Archive handles may be typecasted to this struct so you can access //some of the archive's properties and the decrypted hash table and //block table directly. This struct is based on Storm's internal //struct for archive handles. struct MPQARCHIVE { // Arranged according to priority with lowest priority first MPQARCHIVE * lpNextArc; //0// Pointer to the next MPQARCHIVE struct. Pointer to addresses of first and last archives if last archive MPQARCHIVE * lpPrevArc; //4// Pointer to the previous MPQARCHIVE struct. 0xEAFC5E23 if first archive char szFileName[260]; //8// Filename of the archive HANDLE hFile; //10C// The archive's file handle DWORD dwFlags1; //110// Some flags, bit 0 seems to be set when opening an archive from a hard drive if bit 1 in the flags for SFileOpenArchive is set, bit 1 (0 based) seems to be set when opening an archive from a CD DWORD dwPriority; //114// Priority of the archive set when calling SFileOpenArchive MPQFILE * lpLastReadFile; //118// Pointer to the last read file's MPQFILE struct. This is cleared when finished reading a block DWORD dwUnk; //11C// Seems to always be 0 DWORD dwBlockSize; //120// Size of file blocks in bytes BYTE * lpLastReadBlock; //124// Pointer to the read buffer for archive. This is cleared when finished reading a block DWORD dwBufferSize; //128// Size of the read buffer for archive. This is cleared when finished reading a block DWORD dwMPQStart; //12C// The starting offset of the archive DWORD dwMPQEnd; //130// The ending offset of the archive MPQHEADER * lpMPQHeader; //134// Pointer to the archive header BLOCKTABLEENTRY * lpBlockTable; //138// Pointer to the start of the block table HASHTABLEENTRY * lpHashTable; //13C// Pointer to the start of the hash table DWORD dwReadOffset; //140// Offset to the data for a file DWORD dwRefCount; //144// Count of references to this open archive. This is incremented for each file opened from the archive, and decremented for each file closed // Extra struct members used by SFmpq MPQHEADER MpqHeader; DWORD dwFlags; //The only flags that should be changed are MOAU_MAINTAIN_LISTFILE and MOAU_MAINTAIN_ATTRIBUTES, changing any others can have unpredictable effects LPSTR lpFileName; DWORD dwExtraFlags; }; //Handles to files in the archive may be typecasted to this struct //so you can access some of the file's properties directly. This //struct is based on Storm's internal struct for file handles. struct MPQFILE { MPQFILE * lpNextFile; //0// Pointer to the next MPQFILE struct. Pointer to addresses of first and last files if last file MPQFILE * lpPrevFile; //4// Pointer to the previous MPQFILE struct. 0xEAFC5E13 if first file char szFileName[260]; //8// Filename of the file HANDLE hFile; //10C// Always INVALID_HANDLE_VALUE for files in MPQ archives. For files not in MPQ archives, this is the file handle for the file and the rest of this struct is filled with zeros except for dwRefCount MPQARCHIVE * lpParentArc; //110// Pointer to the MPQARCHIVE struct of the archive in which the file is contained BLOCKTABLEENTRY * lpBlockEntry; //114// Pointer to the file's block table entry DWORD dwCryptKey; //118// Decryption key for the file DWORD dwFilePointer; //11C// Position of file pointer in the file DWORD dwUnk; //120// Seems to always be 0 DWORD dwBlockCount; //124// Number of blocks in file DWORD * lpdwBlockOffsets; //128// Offsets to blocks in file. There are 1 more of these than the number of blocks. The values for this are set after the first read DWORD dwReadStarted; //12C// Set to 1 after first read BOOL bStreaming; //130// 1 when streaming a WAVE BYTE * lpLastReadBlock; //134// Pointer to the read buffer for file. This starts at the position specified in the last SFileSetFilePointer call. This is cleared when SFileSetFilePointer is called or when finished reading the block DWORD dwBytesRead; //138// Total bytes read from the current block in the open file. This is cleared when SFileSetFilePointer is called or when finished reading the block DWORD dwBufferSize; //13C// Size of the read buffer for file. This is cleared when SFileSetFilePointer is called or when finished reading the block DWORD dwRefCount; //140// Count of references to this open file // Extra struct members used by SFmpq HASHTABLEENTRY *lpHashEntry; LPSTR lpFileName; }; struct BLOCKTABLEENTRY { DWORD dwFileOffset; // Offset to file DWORD dwCompressedSize; // Compressed size of file DWORD dwFullSize; // Uncompressed size of file DWORD dwFlags; // Flags for file }; struct HASHTABLEENTRY { DWORD dwNameHashA; // First name hash of file DWORD dwNameHashB; // Second name hash of file LCID lcLocale; // Locale ID of file DWORD dwBlockTableIndex; // Index to the block table entry for the file }; // Defines for backward compatibility with old lmpqapi function names #define MpqAddFileToArcive MpqAddFileToArchive #define MpqOpenArchive SFileOpenArchive #define MpqOpenFileEx SFileOpenFileEx #define MpqGetFileSize SFileGetFileSize #define MpqReadFile SFileReadFile #define MpqCloseFile SFileCloseFile #define MpqCloseArchive SFileCloseArchive // Storm functions implemented by this library BOOL SFMPQAPI WINAPI SFileOpenArchive(LPCSTR lpFileName, DWORD dwPriority, DWORD dwFlags, MPQHANDLE *hMPQ); BOOL SFMPQAPI WINAPI SFileCloseArchive(MPQHANDLE hMPQ); BOOL SFMPQAPI WINAPI SFileOpenFileAsArchive(MPQHANDLE hSourceMPQ, LPCSTR lpFileName, DWORD dwPriority, DWORD dwFlags, MPQHANDLE *hMPQ); BOOL SFMPQAPI WINAPI SFileGetArchiveName(MPQHANDLE hMPQ, LPSTR lpBuffer, DWORD dwBufferLength); BOOL SFMPQAPI WINAPI SFileOpenFile(LPCSTR lpFileName, MPQHANDLE *hFile); BOOL SFMPQAPI WINAPI SFileOpenFileEx(MPQHANDLE hMPQ, LPCSTR lpFileName, DWORD dwSearchScope, MPQHANDLE *hFile); BOOL SFMPQAPI WINAPI SFileCloseFile(MPQHANDLE hFile); DWORD SFMPQAPI WINAPI SFileGetFileSize(MPQHANDLE hFile, LPDWORD lpFileSizeHigh); BOOL SFMPQAPI WINAPI SFileGetFileArchive(MPQHANDLE hFile, MPQHANDLE *hMPQ); BOOL SFMPQAPI WINAPI SFileGetFileName(MPQHANDLE hFile, LPSTR lpBuffer, DWORD dwBufferLength); DWORD SFMPQAPI WINAPI SFileSetFilePointer(MPQHANDLE hFile, LONG lDistanceToMove, PLONG lplDistanceToMoveHigh, DWORD dwMoveMethod); BOOL SFMPQAPI WINAPI SFileReadFile(MPQHANDLE hFile, LPVOID lpBuffer, DWORD nNumberOfBytesToRead, LPDWORD lpNumberOfBytesRead, LPOVERLAPPED lpOverlapped); LCID SFMPQAPI WINAPI SFileSetLocale(LCID nNewLocale); BOOL SFMPQAPI WINAPI SFileGetBasePath(LPCSTR lpBuffer, DWORD dwBufferLength); BOOL SFMPQAPI WINAPI SFileSetBasePath(LPCSTR lpNewBasePath); // Extra storm-related functions DWORD SFMPQAPI WINAPI SFileGetFileInfo(MPQHANDLE hFile, DWORD dwInfoType); BOOL SFMPQAPI WINAPI SFileSetArchivePriority(MPQHANDLE hMPQ, DWORD dwPriority); DWORD SFMPQAPI WINAPI SFileFindMpqHeader(HANDLE hFile); BOOL SFMPQAPI WINAPI SFileListFiles(MPQHANDLE hMPQ, LPCSTR lpFileLists, FILELISTENTRY *lpListBuffer, DWORD dwFlags); // Archive editing functions implemented by this library MPQHANDLE SFMPQAPI WINAPI MpqOpenArchiveForUpdate(LPCSTR lpFileName, DWORD dwFlags, DWORD dwMaximumFilesInArchive); DWORD SFMPQAPI WINAPI MpqCloseUpdatedArchive(MPQHANDLE hMPQ, DWORD dwUnknown2); BOOL SFMPQAPI WINAPI MpqAddFileToArchive(MPQHANDLE hMPQ, LPCSTR lpSourceFileName, LPCSTR lpDestFileName, DWORD dwFlags); BOOL SFMPQAPI WINAPI MpqAddWaveToArchive(MPQHANDLE hMPQ, LPCSTR lpSourceFileName, LPCSTR lpDestFileName, DWORD dwFlags, DWORD dwQuality); BOOL SFMPQAPI WINAPI MpqRenameFile(MPQHANDLE hMPQ, LPCSTR lpcOldFileName, LPCSTR lpcNewFileName); BOOL SFMPQAPI WINAPI MpqDeleteFile(MPQHANDLE hMPQ, LPCSTR lpFileName); BOOL SFMPQAPI WINAPI MpqCompactArchive(MPQHANDLE hMPQ); // Extra archive editing functions MPQHANDLE SFMPQAPI WINAPI MpqOpenArchiveForUpdateEx(LPCSTR lpFileName, DWORD dwFlags, DWORD dwMaximumFilesInArchive, DWORD dwBlockSize); BOOL SFMPQAPI WINAPI MpqAddFileToArchiveEx(MPQHANDLE hMPQ, LPCSTR lpSourceFileName, LPCSTR lpDestFileName, DWORD dwFlags, DWORD dwCompressionType, DWORD dwCompressLevel); BOOL SFMPQAPI WINAPI MpqAddFileFromBufferEx(MPQHANDLE hMPQ, LPVOID lpBuffer, DWORD dwLength, LPCSTR lpFileName, DWORD dwFlags, DWORD dwCompressionType, DWORD dwCompressLevel); BOOL SFMPQAPI WINAPI MpqAddFileFromBuffer(MPQHANDLE hMPQ, LPVOID lpBuffer, DWORD dwLength, LPCSTR lpFileName, DWORD dwFlags); BOOL SFMPQAPI WINAPI MpqAddWaveFromBuffer(MPQHANDLE hMPQ, LPVOID lpBuffer, DWORD dwLength, LPCSTR lpFileName, DWORD dwFlags, DWORD dwQuality); BOOL SFMPQAPI WINAPI MpqRenameAndSetFileLocale(MPQHANDLE hMPQ, LPCSTR lpcOldFileName, LPCSTR lpcNewFileName, LCID nOldLocale, LCID nNewLocale); BOOL SFMPQAPI WINAPI MpqDeleteFileWithLocale(MPQHANDLE hMPQ, LPCSTR lpFileName, LCID nLocale); BOOL SFMPQAPI WINAPI MpqSetFileLocale(MPQHANDLE hMPQ, LPCSTR lpFileName, LCID nOldLocale, LCID nNewLocale); // These functions do nothing. They are only provided for // compatibility with MPQ extractors that use storm. BOOL SFMPQAPI WINAPI SFileDestroy(); void SFMPQAPI WINAPI StormDestroy(); #ifdef __cplusplus }; // extern "C" #endif #endif
{ "content_hash": "14cbca1936ede4e7c6a1e44398902f38", "timestamp": "", "source": "github", "line_count": 300, "max_line_length": 231, "avg_line_length": 56.91, "alnum_prop": 0.7770163415919874, "repo_name": "actboy168/wc3mapmax", "id": "7fe313d3438da68c84fbc662c45a5cf7fa50a59e", "size": "24198", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "src/Wc3MapMax++/SFmpqapi.h", "mode": "33188", "license": "mit", "language": [ { "name": "C", "bytes": "93582" }, { "name": "C++", "bytes": "526172" }, { "name": "Objective-C", "bytes": "72180" }, { "name": "Objective-J", "bytes": "1175093" } ], "symlink_target": "" }
<?php namespace WalmartApiClient\Entity\Collection; /** * @SuppressWarnings(PHPMD) */ class AbstractCollectionTest extends \PHPUnit_Framework_TestCase { /** * @test * @covers WalmartApiClient\Entity\Collection\AbstractCollection::__construct */ public function testConstruct() { $collection = new ProductCollection(); $this->assertTrue($collection instanceof \WalmartApiClient\Entity\Collection\AbstractCollectionInterface); $this->assertTrue($collection->getAll() === []); } /** * @test * @covers WalmartApiClient\Entity\Collection\AbstractCollection::__construct */ public function testConstructWithElements() { $product = new \WalmartApiClient\Entity\Product(['itemId' => 1]); $collection = new ProductCollection([$product]); $this->assertTrue($collection instanceof \WalmartApiClient\Entity\Collection\AbstractCollectionInterface); $this->assertTrue($collection->getFirst() === $product); } /** * @test * @covers WalmartApiClient\Entity\Collection\AbstractCollection::__construct */ public function testConstructWithParams() { $product = new \WalmartApiClient\Entity\Product(['itemId' => 1]); $collection = new ProductCollection([$product], ['query' => 'search']); $this->assertTrue($collection instanceof \WalmartApiClient\Entity\Collection\AbstractCollectionInterface); $this->assertTrue($collection->getFirst() === $product); $this->assertTrue($collection->getQuery() === 'search'); } /** * @test * @covers WalmartApiClient\Entity\Collection\AbstractCollection::add */ public function testAdd() { $product = new \WalmartApiClient\Entity\Product(['itemId' => 1]); $collection = new ProductCollection(); $collection->add($product); $this->assertTrue($collection->getFirst() === $product); } /** * @test * @covers WalmartApiClient\Entity\Collection\AbstractCollection::addMany */ public function testAddMany() { $product1 = new \WalmartApiClient\Entity\Product(['itemId' => 1]); $product2 = new \WalmartApiClient\Entity\Product(['itemId' => 2]); $collection = new ProductCollection(); $collection->addMany([$product1, $product2]); $this->assertTrue($collection->getAll() === [spl_object_hash($product1) => $product1, spl_object_hash($product2) => $product2]); } /** * @test * @covers WalmartApiClient\Entity\Collection\AbstractCollection::getAll */ public function testGetAll() { $product1 = new \WalmartApiClient\Entity\Product(['itemId' => 1]); $product2 = new \WalmartApiClient\Entity\Product(['itemId' => 2]); $collection = new ProductCollection([$product1, $product2]); $this->assertTrue($collection->getAll() === [spl_object_hash($product1) => $product1, spl_object_hash($product2) => $product2]); } /** * @test * @covers WalmartApiClient\Entity\Collection\AbstractCollection::getFirst */ public function testGetFirst() { $product1 = new \WalmartApiClient\Entity\Product(['itemId' => 1]); $product2 = new \WalmartApiClient\Entity\Product(['itemId' => 2]); $collection = new ProductCollection([$product1, $product2]); $this->assertTrue($collection->getFirst() === $product1); } /** * @test * @covers WalmartApiClient\Entity\Collection\AbstractCollection::clear */ public function testClear() { $product = new \WalmartApiClient\Entity\Product(['itemId' => 1]); $collection = new ProductCollection([$product]); $collection->clear(); $this->assertTrue($collection->getAll() === []); } /** * @test * @covers WalmartApiClient\Entity\Collection\AbstractCollection::remove */ public function testRemove() { $product1 = new \WalmartApiClient\Entity\Product(['itemId' => 1]); $product2 = new \WalmartApiClient\Entity\Product(['itemId' => 2]); $collection = new ProductCollection([$product1, $product2]); $collection->remove($product1); $this->assertTrue($collection->getFirst() === $product2); } /** * @test * @covers WalmartApiClient\Entity\Collection\AbstractCollection::count */ public function testCount() { $product1 = new \WalmartApiClient\Entity\Product(['itemId' => 1]); $product2 = new \WalmartApiClient\Entity\Product(['itemId' => 2]); $collection = new ProductCollection([$product1, $product2]); $this->assertTrue(count($collection) == 2); } /** * @test * @covers WalmartApiClient\Entity\Collection\AbstractCollection::merge */ public function testMerge() { $product1 = new \WalmartApiClient\Entity\Product(['itemId' => 1]); $product2 = new \WalmartApiClient\Entity\Product(['itemId' => 2]); $product3 = new \WalmartApiClient\Entity\Product(['itemId' => 3]); $product4 = new \WalmartApiClient\Entity\Product(['itemId' => 4]); $collection1 = new ProductCollection([$product1, $product2]); $collection2 = new ProductCollection([$product3, $product4]); $collection1->merge($collection2); $items = $collection1->getAll(); $this->assertTrue(count($collection1) == 4); $this->assertTrue(array_pop($items) == $product4); } /** * @test * @covers WalmartApiClient\Entity\Collection\AbstractCollection::toArray */ public function testToArray() { $product1 = new \WalmartApiClient\Entity\Product(['itemId' => 1]); $product2 = new \WalmartApiClient\Entity\Product(['itemId' => 2]); $collection = new ProductCollection([$product1, $product2]); $array = $collection->toArray(); $this->assertTrue($array[0]['itemId'] === 1); $this->assertTrue($array[1]['itemId'] === 2); } }
{ "content_hash": "ec4199524f18e14c7b570887a5ecda41", "timestamp": "", "source": "github", "line_count": 190, "max_line_length": 136, "avg_line_length": 32.11578947368421, "alnum_prop": 0.6184857423795477, "repo_name": "Gadoma/walmart-api-php-client", "id": "7357dbbfeab42d0c9e31a357f44ee24f76654e4c", "size": "6310", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "tests/WalmartApiClient/Entity/Collection/AbstractCollectionTest.php", "mode": "33188", "license": "mit", "language": [ { "name": "PHP", "bytes": "145440" } ], "symlink_target": "" }
// // CVKHierarchySearcher.h // CVKHierarchySearcher // // Created by Romans Karpelcevs on 12/10/14. // Copyright (c) 2014 Romans Karpelcevs. All rights reserved. // #import <UIKit/UIKit.h> @interface CVKHierarchySearcher : NSObject /** * 顶层controller */ @property (nonatomic, readonly) UIViewController *topmostViewController; /** * 顶层controller(不包含modal出的controller) */ @property (nonatomic, readonly) UIViewController *topmostNonModalViewController; /** * 顶层navigationController */ @property (nonatomic, readonly) UINavigationController *topmostNavigationController; @end
{ "content_hash": "96e261eac6a330bacbf8baa4db1798cc", "timestamp": "", "source": "github", "line_count": 31, "max_line_length": 84, "avg_line_length": 19.258064516129032, "alnum_prop": 0.7537688442211056, "repo_name": "YANGWW-512113110/JWCategory", "id": "e0277229878024339d95d1d7204f0fbb57b7d5a2", "size": "619", "binary": false, "copies": "3", "ref": "refs/heads/master", "path": "JWCategory/CVKHierarchySearcher.h", "mode": "33188", "license": "mit", "language": [ { "name": "Objective-C", "bytes": "58599" }, { "name": "Ruby", "bytes": "891" } ], "symlink_target": "" }
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <title>表单设计器 - 清单</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/> <meta http-equiv="X-UA-Compatible" content="IE=Edge,chrome=1" > <link rel="stylesheet" href="../style/main.style.css"> <script type="text/javascript" src="../../dialogs/internal.js"></script> </head> <body> <div class="well"> <div class="control-group"> <button type="button" onclick="mmDialog.exec('text');" class="btn green btn-small">单行输入框</button> <button type="button" onclick="mmDialog.exec('textarea');" class="btn green btn-small">多行输入框</button> <button type="button" onclick="mmDialog.exec('select');" class="btn green btn-small">下拉菜单</button> <button type="button" onclick="mmDialog.exec('radios');" class="btn green btn-small">单选框</button> <button type="button" onclick="mmDialog.exec('checkboxs');" class="btn green btn-small">复选框</button> </div> <div class="control-group"> <button type="button" onclick="mmDialog.exec('label');" class="btn green btn-small">标签</button> <button type="button" onclick="mmDialog.exec('button');" class="btn green btn-small">按钮</button> <button type="button" onclick="mmDialog.exec('signature');" class="btn green btn-small">签章</button> <button type="button" onclick="mmDialog.exec('fileup');" class="btn green btn-small">上传附件</button> </div> <div class="control-group"> <button type="button" onclick="mmDialog.exec('children_formlink');" class="btn green btn-small">列表控件</button> </div> </div> <script type="text/javascript"> var mmDialog = { exec : function (method) { editor.execCommand(method); dialog.close(true); } }; </script> </body> </html>
{ "content_hash": "9c4cb3142be0795aff8818c93557489c", "timestamp": "", "source": "github", "line_count": 41, "max_line_length": 117, "avg_line_length": 45.36585365853659, "alnum_prop": 0.6483870967741936, "repo_name": "ppcxy/cyfm", "id": "8ff1ea7e5f5dfd692f997b40416db8300c5483c2", "size": "1942", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "cyfm-web/src/main/webapp/static/plugins/ueditor/formdesign/html/main.html", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Batchfile", "bytes": "3657" }, { "name": "CSS", "bytes": "1520036" }, { "name": "FreeMarker", "bytes": "228" }, { "name": "HTML", "bytes": "746677" }, { "name": "Java", "bytes": "2051822" }, { "name": "JavaScript", "bytes": "14509647" }, { "name": "Scala", "bytes": "2405" }, { "name": "Shell", "bytes": "2809" }, { "name": "TSQL", "bytes": "52431" } ], "symlink_target": "" }
/* Listing 47-10 */ /* binary_sems.c Implement a binary semaphore protocol using System V semaphores. */ #include <sys/types.h> #include <sys/sem.h> #include "semun.h" /* Definition of semun union */ #include "binary_sems.h" Boolean bsUseSemUndo = FALSE; Boolean bsRetryOnEintr = TRUE; int /* Initialize semaphore to 1 (i.e., "available") */ initSemAvailable(int semId, int semNum) { union semun arg; arg.val = 1; return semctl(semId, semNum, SETVAL, arg); } int /* Initialize semaphore to 0 (i.e., "in use") */ initSemInUse(int semId, int semNum) { union semun arg; arg.val = 0; return semctl(semId, semNum, SETVAL, arg); } /* Reserve semaphore (blocking), return 0 on success, or -1 with 'errno' set to EINTR if operation was interrupted by a signal handler */ int /* Reserve semaphore - decrement it by 1 */ reserveSem(int semId, int semNum) { struct sembuf sops; sops.sem_num = semNum; sops.sem_op = -1; sops.sem_flg = bsUseSemUndo ? SEM_UNDO : 0; while (semop(semId, &sops, 1) == -1) if (errno != EINTR || !bsRetryOnEintr) return -1; return 0; } int /* Release semaphore - increment it by 1 */ releaseSem(int semId, int semNum) { struct sembuf sops; sops.sem_num = semNum; sops.sem_op = 1; sops.sem_flg = bsUseSemUndo ? SEM_UNDO : 0; return semop(semId, &sops, 1); }
{ "content_hash": "793ae6077e3fca5050a06d933a9aa14c", "timestamp": "", "source": "github", "line_count": 64, "max_line_length": 75, "avg_line_length": 23.1875, "alnum_prop": 0.601078167115903, "repo_name": "andrestc/linux-prog", "id": "c85b80ced87bce283754837c2595ae64255b792b", "size": "2167", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "lib/binary_sems.c", "mode": "33188", "license": "mit", "language": [ { "name": "C", "bytes": "117066" }, { "name": "C++", "bytes": "1333" }, { "name": "Makefile", "bytes": "2369" }, { "name": "Shell", "bytes": "1356" } ], "symlink_target": "" }
package org.limmen.mystart.importer; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertNotNull; import static org.junit.jupiter.api.Assertions.assertTrue; import java.io.File; import java.io.FileNotFoundException; import java.io.IOException; import java.util.Set; import org.junit.jupiter.api.Test; import org.limmen.mystart.Link; public class FireFoxParserTest { private final Parser fixture = new FireFoxParser(); @Test public void parse() throws FileNotFoundException, IOException { File path = new File(System.getProperty("user.dir"), "src"); path = new File(path, "test"); path = new File(path, "resources"); Set<Link> links = fixture.parse(new ParseContext(null, path.getAbsolutePath() + "/places.sqlite", "/places.sqlite")); assertNotNull(links); assertTrue(links.size() == 1); Link link = links.iterator().next(); assertEquals("http://example.com", link.getUrl()); assertEquals("Example Domain", link.getTitle()); assertEquals("Some Description On This Url", link.getDescription()); } }
{ "content_hash": "49a8f392588f7eb16fe7a23894236a3c", "timestamp": "", "source": "github", "line_count": 37, "max_line_length": 122, "avg_line_length": 31.135135135135137, "alnum_prop": 0.7083333333333334, "repo_name": "IvoLimmen/mystart", "id": "b19be9a94d98a734f86a3a2a2154f812df52d796", "size": "1152", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "bookmarkimporter/firefox/src/test/java/org/limmen/mystart/importer/FireFoxParserTest.java", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "CSS", "bytes": "97468" }, { "name": "HTML", "bytes": "1699" }, { "name": "Java", "bytes": "203122" }, { "name": "JavaScript", "bytes": "128" }, { "name": "Shell", "bytes": "1132" } ], "symlink_target": "" }
package com.helger.graph.impl; import java.util.function.Consumer; import javax.annotation.Nonnull; import javax.annotation.Nullable; import javax.annotation.concurrent.NotThreadSafe; import com.helger.commons.ValueEnforcer; import com.helger.commons.annotation.ReturnsMutableCopy; import com.helger.commons.collection.CollectionHelper; import com.helger.commons.collection.impl.CommonsArrayList; import com.helger.commons.collection.impl.CommonsLinkedHashMap; import com.helger.commons.collection.impl.CommonsLinkedHashSet; import com.helger.commons.collection.impl.ICommonsList; import com.helger.commons.collection.impl.ICommonsOrderedMap; import com.helger.commons.collection.impl.ICommonsOrderedSet; import com.helger.commons.collection.impl.ICommonsSet; import com.helger.commons.state.EChange; import com.helger.commons.state.ETriState; import com.helger.graph.IMutableDirectedGraph; import com.helger.graph.IMutableDirectedGraphNode; import com.helger.graph.IMutableDirectedGraphObjectFactory; import com.helger.graph.IMutableDirectedGraphRelation; import com.helger.graph.iterate.DirectedGraphIteratorForward; import com.helger.matrix.Matrix; /** * A simple graph object that bidirectionally links graph nodes. * * @author Philip Helger */ @NotThreadSafe public class DirectedGraph extends AbstractBaseGraph <IMutableDirectedGraphNode, IMutableDirectedGraphRelation> implements IMutableDirectedGraph { private final IMutableDirectedGraphObjectFactory m_aFactory; private ETriState m_eCacheHasCycles = ETriState.UNDEFINED; public DirectedGraph (@Nullable final String sID, @Nonnull final IMutableDirectedGraphObjectFactory aFactory) { super (sID); ValueEnforcer.notNull (aFactory, "Factory"); m_aFactory = aFactory; } public final boolean isDirected () { return true; } private void _invalidateCache () { // Reset the "has cycles" cached value m_eCacheHasCycles = ETriState.UNDEFINED; } @Nonnull public IMutableDirectedGraphNode createNode () { // Create node with new ID final IMutableDirectedGraphNode aNode = m_aFactory.createNode (); if (addNode (aNode).isUnchanged ()) throw new IllegalStateException ("The ID factory created the ID '" + aNode.getID () + "' that is already in use"); return aNode; } @Nullable public IMutableDirectedGraphNode createNode (@Nullable final String sID) { final IMutableDirectedGraphNode aNode = m_aFactory.createNode (sID); return addNode (aNode).isChanged () ? aNode : null; } @Nonnull public EChange addNode (@Nonnull final IMutableDirectedGraphNode aNode) { ValueEnforcer.notNull (aNode, "Node"); if (!isChangingConnectedObjectsAllowed () && aNode.hasRelations ()) throw new IllegalArgumentException ("The node to be added already has incoming and/or outgoing relations and this is not allowed!"); final String sID = aNode.getID (); if (m_aNodes.containsKey (sID)) return EChange.UNCHANGED; m_aNodes.put (sID, aNode); _invalidateCache (); return EChange.CHANGED; } @Nonnull public EChange removeNode (@Nonnull final IMutableDirectedGraphNode aNode) { ValueEnforcer.notNull (aNode, "Node"); if (!isChangingConnectedObjectsAllowed () && aNode.hasRelations ()) throw new IllegalArgumentException ("The node to be removed already has incoming and/or outgoing relations and this is not allowed!"); if (m_aNodes.remove (aNode.getID ()) == null) return EChange.UNCHANGED; _invalidateCache (); return EChange.CHANGED; } @Nonnull public EChange removeNodeAndAllRelations (@Nonnull final IMutableDirectedGraphNode aNode) { ValueEnforcer.notNull (aNode, "Node"); if (!m_aNodes.containsKey (aNode.getID ())) return EChange.UNCHANGED; // Remove all affected relations from all nodes for (final IMutableDirectedGraphRelation aRelation : aNode.getAllOutgoingRelations ()) aRelation.getTo ().removeIncomingRelation (aRelation); for (final IMutableDirectedGraphRelation aRelation : aNode.getAllIncomingRelations ()) aRelation.getFrom ().removeOutgoingRelation (aRelation); aNode.removeAllRelations (); if (removeNode (aNode).isUnchanged ()) throw new IllegalStateException ("Inconsistency removing node and all relations"); return EChange.CHANGED; } @Nonnull private IMutableDirectedGraphRelation _connect (@Nonnull final IMutableDirectedGraphRelation aRelation) { aRelation.getFrom ().addOutgoingRelation (aRelation); aRelation.getTo ().addIncomingRelation (aRelation); _invalidateCache (); return aRelation; } @Nonnull public IMutableDirectedGraphRelation createRelation (@Nonnull final IMutableDirectedGraphNode aFrom, @Nonnull final IMutableDirectedGraphNode aTo) { return _connect (m_aFactory.createRelation (aFrom, aTo)); } @Nonnull public IMutableDirectedGraphRelation createRelation (@Nullable final String sID, @Nonnull final IMutableDirectedGraphNode aFrom, @Nonnull final IMutableDirectedGraphNode aTo) { return _connect (m_aFactory.createRelation (sID, aFrom, aTo)); } @Nonnull public EChange removeRelation (@Nullable final IMutableDirectedGraphRelation aRelation) { EChange ret = EChange.UNCHANGED; if (aRelation != null) { ret = ret.or (aRelation.getFrom ().removeOutgoingRelation (aRelation)); ret = ret.or (aRelation.getTo ().removeIncomingRelation (aRelation)); if (ret.isChanged ()) _invalidateCache (); } return ret; } @Nonnull public IMutableDirectedGraphNode getSingleStartNode () { final ICommonsSet <IMutableDirectedGraphNode> aStartNodes = getAllStartNodes (); if (aStartNodes.size () > 1) throw new IllegalStateException ("Graph has more than one starting node"); if (aStartNodes.isEmpty ()) throw new IllegalStateException ("Graph has no starting node"); return CollectionHelper.getFirstElement (aStartNodes); } @Nonnull @ReturnsMutableCopy public ICommonsSet <IMutableDirectedGraphNode> getAllStartNodes () { return CollectionHelper.newSet (m_aNodes.values (), x -> !x.hasIncomingRelations ()); } @Nonnull public IMutableDirectedGraphNode getSingleEndNode () { final ICommonsSet <IMutableDirectedGraphNode> aEndNodes = getAllEndNodes (); if (aEndNodes.size () > 1) throw new IllegalStateException ("Graph has more than one ending node"); if (aEndNodes.isEmpty ()) throw new IllegalStateException ("Graph has no ending node"); return CollectionHelper.getFirstElement (aEndNodes); } @Nonnull @ReturnsMutableCopy public ICommonsSet <IMutableDirectedGraphNode> getAllEndNodes () { return CollectionHelper.newSet (m_aNodes.values (), x -> !x.hasOutgoingRelations ()); } @Nonnull @ReturnsMutableCopy public ICommonsOrderedMap <String, IMutableDirectedGraphRelation> getAllRelations () { final ICommonsOrderedMap <String, IMutableDirectedGraphRelation> ret = new CommonsLinkedHashMap <> (); for (final IMutableDirectedGraphNode aNode : m_aNodes.values ()) aNode.forEachRelation (x -> ret.put (x.getID (), x)); return ret; } @Nonnull @ReturnsMutableCopy public ICommonsList <IMutableDirectedGraphRelation> getAllRelationObjs () { final ICommonsList <IMutableDirectedGraphRelation> ret = new CommonsArrayList <> (); for (final IMutableDirectedGraphNode aNode : m_aNodes.values ()) aNode.forEachRelation (ret::add); return ret; } @Nonnull @ReturnsMutableCopy public ICommonsOrderedSet <String> getAllRelationIDs () { final ICommonsOrderedSet <String> ret = new CommonsLinkedHashSet <> (); for (final IMutableDirectedGraphNode aNode : m_aNodes.values ()) ret.addAll (aNode.getAllRelationIDs ()); return ret; } public void forEachRelation (@Nonnull final Consumer <? super IMutableDirectedGraphRelation> aConsumer) { ValueEnforcer.notNull (aConsumer, "Consumer"); for (final IMutableDirectedGraphNode aNode : m_aNodes.values ()) { // Use only the outgoings, because the incomings are outgoing somewhere // else aNode.forEachOutgoingRelation (aConsumer); } } @Nonnull public EChange removeAll () { if (m_aNodes.removeAll ().isUnchanged ()) return EChange.UNCHANGED; _invalidateCache (); return EChange.CHANGED; } public boolean containsCycles () { // Use cached result? if (m_eCacheHasCycles.isUndefined ()) { m_eCacheHasCycles = ETriState.FALSE; // Check all nodes, in case we a small cycle and a set of other nodes (see // test case testCycles2) for (final IMutableDirectedGraphNode aCurNode : m_aNodes.values ()) { final DirectedGraphIteratorForward it = new DirectedGraphIteratorForward (aCurNode); while (it.hasNext () && !it.hasCycles ()) it.next (); if (it.hasCycles ()) { m_eCacheHasCycles = ETriState.TRUE; break; } } } // cannot be undefined here return m_eCacheHasCycles.getAsBooleanValue (true); } @Override public boolean isSelfContained () { for (final IMutableDirectedGraphNode aNode : m_aNodes.values ()) { for (final IMutableDirectedGraphRelation aRelation : aNode.getAllIncomingRelations ()) if (!m_aNodes.containsKey (aRelation.getFromID ())) return false; for (final IMutableDirectedGraphRelation aRelation : aNode.getAllOutgoingRelations ()) if (!m_aNodes.containsKey (aRelation.getToID ())) return false; } return true; } @Nonnull public Matrix createIncidenceMatrix () { final int nNodeCount = getNodeCount (); final Matrix ret = new Matrix (nNodeCount, nNodeCount, 0); final IMutableDirectedGraphNode [] aNodes = m_aNodes.values ().toArray (new IMutableDirectedGraphNode [nNodeCount]); for (int nRow = 0; nRow < nNodeCount; ++nRow) { final IMutableDirectedGraphNode aNodeRow = aNodes[nRow]; for (int nCol = 0; nCol < nNodeCount; ++nCol) if (nRow != nCol) if (aNodeRow.isToNode (aNodes[nCol])) { ret.set (nRow, nCol, 1); ret.set (nCol, nRow, -1); } } return ret; } @Override public boolean equals (final Object o) { return super.equals (o); } @Override public int hashCode () { return super.hashCode (); } }
{ "content_hash": "0600e580fab482cbe2e95ba3a730caa7", "timestamp": "", "source": "github", "line_count": 324, "max_line_length": 140, "avg_line_length": 32.873456790123456, "alnum_prop": 0.7053797765468032, "repo_name": "phax/ph-commons", "id": "c9e066b7abb6015e565addf7679480c556a7134a", "size": "11305", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "ph-graph/src/main/java/com/helger/graph/impl/DirectedGraph.java", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "CSS", "bytes": "221283" }, { "name": "Java", "bytes": "11003809" }, { "name": "XSLT", "bytes": "3137" } ], "symlink_target": "" }
package gospy import ( "errors" "fmt" "github.com/cfmobile/gmock" "reflect" ) type ArgList []interface{} type CallList []ArgList type GoSpy struct { calls CallList mock *gmock.GMock } func Spy(targetFuncPtr interface{}) *GoSpy { spy := createSpy(targetFuncPtr) defaultFn := spy.getDefaultFn() spy.setTargetFn(defaultFn) return spy } func SpyAndFake(targetFuncPtr interface{}) *GoSpy { return SpyAndFakeWithReturn(targetFuncPtr) //nil fakeReturnValues will create default } func SpyAndFakeWithReturn(targetFuncPtr interface{}, fakeReturnValues ...interface{}) *GoSpy { spy := createSpy(targetFuncPtr) fakeReturnFn := spy.getFnWithReturnValues(fakeReturnValues) spy.setTargetFn(fakeReturnFn) return spy } func SpyAndFakeWithFunc(targetFuncPtr interface{}, mockFunc interface{}) *GoSpy { spy := createSpy(targetFuncPtr) if err := mockFuncIsValid(targetFuncPtr, mockFunc); err != nil { panic(err.Error()) } fakeFuncFn := spy.getFnWithMockFunc(mockFunc) spy.setTargetFn(fakeFuncFn) return spy } func (self *GoSpy) Called() bool { return self.CallCount() > 0 } func (self *GoSpy) CallCount() int { return len(self.calls) } func (self *GoSpy) Calls() CallList { return self.calls } func (self *GoSpy) ArgsForCall(callIndex uint) ArgList { return self.calls[callIndex] } func (self *GoSpy) Reset() { self.calls = nil } func (self *GoSpy) Restore() { self.mock.Restore() } func (self *GoSpy) setTargetFn(fn func(args []reflect.Value) []reflect.Value) { targetType := self.mock.GetTarget().Type() wrapperFn := func(args []reflect.Value) []reflect.Value { self.storeCall(args) return reflect.MakeFunc(targetType, fn).Call(args) } targetFn := reflect.MakeFunc(targetType, wrapperFn) self.mock.Replace(targetFn.Interface()) } func (self *GoSpy) storeCall(arguments []reflect.Value) { var call ArgList for _, arg := range arguments { call = append(call, arg.Interface()) } self.calls = append(self.calls, call) } func (self *GoSpy) getDefaultFn() func(args []reflect.Value) []reflect.Value { return self.mock.GetOriginal().Call } func (self *GoSpy) getFnWithReturnValues(fakeReturnValues []interface{}) func(args []reflect.Value) []reflect.Value { targetType := self.mock.GetTarget().Type() // Gets the expected number of return values from the target var numReturnValues = targetType.NumOut() if fakeReturnValues != nil && numReturnValues != len(fakeReturnValues) { panic("Invalid number of return values. Either specify the exact number of return values or none for defaults") } res := make([]reflect.Value, 0) // Builds slice of return values, if required for i := 0; i < numReturnValues; i++ { returnItem := reflect.New(targetType.Out(i)) var returnElem = returnItem.Elem() // Gets value for return from fakeReturnValues, or leaves default constructed value if not available if fakeReturnValues != nil && fakeReturnValues[i] != nil { returnElem.Set(reflect.ValueOf(fakeReturnValues[i])) } res = append(res, returnElem) } return func([]reflect.Value) []reflect.Value { return res } } func (self *GoSpy) getFnWithMockFunc(mockFunc interface{}) func(args []reflect.Value) []reflect.Value { return reflect.ValueOf(mockFunc).Call } func createSpy(targetFuncPtr interface{}) *GoSpy { if err := targetIsValid(targetFuncPtr); err != nil { panic(err.Error()) } spy := &GoSpy{calls: nil, mock: gmock.CreateMockWithTarget(targetFuncPtr)} return spy } func targetIsValid(target interface{}) error { if target == nil { return errors.New("Target function can't be nil") } // Target has to be a ptr to a function targetValue := reflect.ValueOf(target) isFuncPtr := targetValue.Kind() == reflect.Ptr && targetValue.Elem().Kind() == reflect.Func if !isFuncPtr { return errors.New(fmt.Sprintf("Spy target has to be the pointer to a Func variable [type: %+v]", targetValue.Kind())) } return nil } func mockFuncIsValid(target interface{}, mockFunc interface{}) error { if mockFunc == nil { return errors.New("Fake function can't be nil") } targetType := reflect.ValueOf(target).Type().Elem() // target is a *func() mockFuncType := reflect.ValueOf(mockFunc).Type() if targetType != mockFuncType { return errors.New(fmt.Sprintf("Fake function has to have the same signature as the target [target: %+v, mock: %+v]", targetType, mockFuncType)) } return nil }
{ "content_hash": "b825e1e5851efa50aade469e1618c644", "timestamp": "", "source": "github", "line_count": 171, "max_line_length": 145, "avg_line_length": 25.573099415204677, "alnum_prop": 0.7212439972558884, "repo_name": "cfmobile/gospy", "id": "4c976ac6e71354a14af87150aa61e1dac3ad1a88", "size": "4373", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "gospy.go", "mode": "33188", "license": "bsd-3-clause", "language": [ { "name": "Go", "bytes": "21009" } ], "symlink_target": "" }
// // Copyright 2018 SenX S.A.S. // // 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 io.warp10.script.functions; import io.warp10.script.NamedWarpScriptFunction; import io.warp10.script.WarpScriptStackFunction; import io.warp10.script.WarpScriptException; import io.warp10.script.WarpScriptStack; import org.bouncycastle.util.encoders.Hex; import com.google.common.io.BaseEncoding; import java.nio.charset.StandardCharsets; /** * Decode a String in base64 and immediately encode it as Hexadecimal */ public class B64TOHEX extends NamedWarpScriptFunction implements WarpScriptStackFunction { public B64TOHEX(String name) { super(name); } @Override public Object apply(WarpScriptStack stack) throws WarpScriptException { Object o = stack.pop(); if (!(o instanceof String)) { throw new WarpScriptException(getName() + " operates on a String."); } stack.push(new String(Hex.encode(BaseEncoding.base64().decode(o.toString())), StandardCharsets.UTF_8)); return stack; } }
{ "content_hash": "7a02fe0f6cdd5ba5f019f8b6a53a9ec9", "timestamp": "", "source": "github", "line_count": 51, "max_line_length": 107, "avg_line_length": 30.80392156862745, "alnum_prop": 0.732017823042648, "repo_name": "hbs/warp10-platform", "id": "bdb3329d48f9e7ad4e86f0bc02fe8aa9afecaeca", "size": "1571", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "warp10/src/main/java/io/warp10/script/functions/B64TOHEX.java", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Java", "bytes": "5465364" }, { "name": "JavaScript", "bytes": "959" }, { "name": "Python", "bytes": "22264" }, { "name": "Shell", "bytes": "30391" }, { "name": "Thrift", "bytes": "19972" } ], "symlink_target": "" }
body{padding-top:50px;padding-bottom:20px} .panel-heading a:after{font-family:'Glyphicons Halflings';content:"\e114";float:right;color:grey} .panel-heading a.collapsed:after{content:"\e080"} #node-to-load{font-size:2em} #node-to-load input{width:2.5em;text-align:left}
{ "content_hash": "bca74a71b32d1a6b39406b61d857ddf3", "timestamp": "", "source": "github", "line_count": 5, "max_line_length": 97, "avg_line_length": 53.6, "alnum_prop": 0.7761194029850746, "repo_name": "legovaer/headless-drupal-angular", "id": "f29d46ec8df4ae3a39f8577b6864219a3bcb0fa2", "size": "268", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "styles/css/app.min.css", "mode": "33261", "license": "mit", "language": [ { "name": "CSS", "bytes": "437" }, { "name": "HTML", "bytes": "3959" }, { "name": "JavaScript", "bytes": "8246" } ], "symlink_target": "" }
function [accuracy, sumCM, runTime] = ABClassify(numLearns) format long; format compact; load partitions; numClasses = length(getlevels(fileClassLabel)); ABCM = zeros(numClasses, numClasses, cvParts.NumTestSets); runTime = zeros(2,cvParts.NumTestSets); allClassLabelDouble = mat2cell(Y,repmat(1997,1,100)); ABModel = cell(cvParts.NumTestSets,1); for i=1:cvParts.NumTestSets [trainX, trainY, testX, testY] = ... getPartitions(allFeatures, allClassLabelDouble, cvParts, i); display(['Training model for ' num2str(i) ' th fold validation']); [ABModel{i}, trainTime] = getABModel(trainX, trainY,numLearns); %high cost makes stricter classification over wider margin save(['AB' num2str(numLearns)]); display(['Testing model for ' num2str(i) ' th fold validation']); [ABCM(:,:,i), testTime] = getABConfMat(ABModel{i}, testX, testY); runTime(:,i) = [trainTime;testTime]; end sumCM = sum(ABCM,3) accuracy = sum(diag(sumCM))/sum(sum(sumCM)) sumRT = sum(runTime,2) end
{ "content_hash": "6071d39cd1a9c8a68d11a3aa1e2c0651", "timestamp": "", "source": "github", "line_count": 32, "max_line_length": 124, "avg_line_length": 32.0625, "alnum_prop": 0.6978557504873294, "repo_name": "rohit21122012/Acoustic-Scenes", "id": "cfb48551320d53d5bd41d689fac5bc50a07d706f", "size": "1026", "binary": false, "copies": "2", "ref": "refs/heads/master", "path": "2ABClassify/ABClassify.m", "mode": "33188", "license": "mit", "language": [ { "name": "C", "bytes": "71688" }, { "name": "C++", "bytes": "96257" }, { "name": "HTML", "bytes": "79050" }, { "name": "Java", "bytes": "100815" }, { "name": "M", "bytes": "2338" }, { "name": "Makefile", "bytes": "3593" }, { "name": "Matlab", "bytes": "29203" }, { "name": "Python", "bytes": "41996" }, { "name": "Shell", "bytes": "8469" } ], "symlink_target": "" }
ACCEPTED #### According to The Catalogue of Life, 3rd January 2011 #### Published in Folia geobot. phytotax. 21(2): 211 (1986) #### Original name Logilvia Vezda ### Remarks null
{ "content_hash": "8e379dd36456ca3c7ae90fb52bbcd347", "timestamp": "", "source": "github", "line_count": 13, "max_line_length": 41, "avg_line_length": 13.923076923076923, "alnum_prop": 0.7016574585635359, "repo_name": "mdoering/backbone", "id": "dfc3a188117639b61336af317f4c7587f0792e26", "size": "217", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "life/Fungi/Ascomycota/Lecanoromycetes/Lecanorales/Pilocarpaceae/Logilvia/README.md", "mode": "33188", "license": "apache-2.0", "language": [], "symlink_target": "" }
""" :author: David Siroky ([email protected]) :license: MIT License (see LICENSE.txt or U{http://www.opensource.org/licenses/mit-license.php}) Picklers must have functions C{loads()}, C{dumps()} and base exception C{PickleError}. """ import traceback import pickle import threading import uuid import warnings import logging import time import sys from binascii import b2a_hex from snakemq.message import Message ############################################################################### ############################################################################### # constants ############################################################################### REQUEST_PREFIX = b"rpcreq" REPLY_PREFIX = b"rpcrep" METHOD_RPC_AS_SIGNAL_ATTR = "__snakemw_rpc_as_signal" # TODO differ between traceback and exception format REMOTE_TRACEBACK_ATTR = "__remote_traceback__" ############################################################################### ############################################################################### # exceptions and warnings ############################################################################### class Error(Exception): pass class NoInstanceError(Error): """ requested object not found """ pass class NoMethodError(Error): """ requested method not found """ pass class SignalCallWarning(Warning): """ signal method called normally or regular method called as signal """ pass class CallError(Error): pass class NotConnected(CallError): """ timeouted call - peer is not connected in the time of the call """ pass class PartialCall(CallError): """ tiemouted call - client did send a request but peer disconnected before proper response """ pass ############################################################################### ############################################################################### # functions ############################################################################### def as_signal(method): """ Decorate method as a signal on the server side. On the client side it must be marked with L{RpcInstProxy.as_signal} method. This decorator must be "on top" because it marks the method with a special attribute. If the method is "overdecorated" then the attribute will not be visible. """ setattr(method, METHOD_RPC_AS_SIGNAL_ATTR, True) return method # for better mock patching get_time = time.time ############################################################################### ############################################################################### # server ############################################################################### class RpcServer(object): """ Registering and unregistering objects is NOT thread safe. Methods of registered objects are called in a different thread other than the link loop. """ def __init__(self, receive_hook, pickler=pickle): self.log = logging.getLogger("snakemq.rpc.server") self.receive_hook = receive_hook self.pickler = pickler receive_hook.register(REQUEST_PREFIX, self.on_recv) self.instances = {} #: transfer call exception back to client (only for non-signal calls) self.transfer_exceptions = True ###################################################### def register_object(self, instance, name): self.instances[name] = instance ###################################################### def unregister_object(self, name): del self.instances[name] ###################################################### def get_registered_objects(self): return self.instances ###################################################### def on_recv(self, dummy_conn_id, ident, message): try: params = self.pickler.loads(message.data[len(REQUEST_PREFIX):]) except self.pickler.PickleError as exc: self.log.error("on_recv unpickle: %r" % exc) return cmd = params["command"] if cmd in ("call", "signal"): # method must not block link loop thr = threading.Thread(target=self.call_method, name="mqrpc_call;%s;%s" % (params["object"], params["method"]), args=(ident, params)) thr.setDaemon(True) thr.start() ###################################################### def call_method(self, ident, params): # TODO timeout for reply is_call = params["command"] == "call" is_signal = params["command"] == "signal" if __debug__: command = params["command"] if is_call: self.log.debug("%s method ident=%r obj=%r method=%r req_id=%r" % (command, ident, params["object"], params["method"], b2a_hex(params["req_id"]))) else: self.log.debug("%s method ident=%r obj=%r method=%r" % (command, ident, params["object"], params["method"] )) transfer_exception = is_call try: objname = params["object"] try: instance = self.instances[objname] except KeyError: raise NoInstanceError(objname) try: method = getattr(instance, params["method"]) except AttributeError: raise NoMethodError(params["method"]) has_signal_attr = hasattr(method, METHOD_RPC_AS_SIGNAL_ATTR) if ((is_signal and not has_signal_attr) or (is_call and has_signal_attr)): warnings.warn("wrong command match for %r" % method, SignalCallWarning) transfer_exception = not has_signal_attr ret = method(*params["args"], **params["kwargs"]) # signals have no return value if is_call: self.send_return(ident, params["req_id"], ret) except Exception as exc: if self.transfer_exceptions and transfer_exception: self.send_exception(ident, params["req_id"], exc) else: raise ###################################################### def send_exception(self, ident, req_id, exc): if __debug__: self.log.debug("send_exception ident=%r" % ident) exc_type, exc_value, exc_traceback = sys.exc_info() if exc_traceback is None: exc_format = "" else: exc_format = "".join(traceback.format_exception(exc_type, exc_value, exc_traceback)) data = {"req_id": req_id, "ok": False, "exception": exc, "exception_format": exc_format} try: self.send(ident, data) except self.pickler.PickleError: # raise the original exception and not the pickler's raise exc ###################################################### def send_return(self, ident, req_id, res): if __debug__: self.log.debug("send_return ident=%r req_id=%r" % (ident, b2a_hex(req_id))) data = {"ok": True, "return": res, "req_id": req_id} self.send(ident, data) ###################################################### def send(self, ident, data): try: data = self.pickler.dumps(data) except TypeError as exc: # TypeError is raised if the object is unpickable raise self.pickler.PickleError(exc) message = Message(data=REPLY_PREFIX + data) self.receive_hook.messaging.send_message(ident, message) ############################################################################### ############################################################################### # client ############################################################################### class RemoteMethod(object): def __init__(self, iproxy, name): self.iproxy = iproxy self.name = name self.call_timeout = None self.signal_timeout = None ###################################################### def __call__(self, *args, **kwargs): # pylint: disable=W0212 if self.signal_timeout is None: command = "call" else: command = "signal" try: params = { "command": command, "object": self.iproxy._name, "method": self.name, "args": args, "kwargs": kwargs } ident = self.iproxy._remote_ident return self.iproxy._client.remote_request(ident, self, params) except CallError: raise except Exception as exc: ehandler = self.iproxy._client.exception_handler if ehandler is None: raise else: ehandler(exc) ###################################################### def as_signal(self, timeout=0): """ Mark the method as a signal method and set timeout. Setting timeout to None marks the method back as regular. :param timeout: in seconds """ self.signal_timeout = timeout ###################################################### def set_timeout(self, timeout): """ Timeout of a regular (not signal) method call. :param timeout: in seconds """ self.call_timeout = timeout ###################################################### def clone(self): method = RemoteMethod(self.iproxy, self.name) method.call_timeout = self.call_timeout method.signal_timeout = self.signal_timeout return method ######################################################################### ######################################################################### class RpcInstProxy(object): def __init__(self, client, remote_ident, name): self._client = client self._remote_ident = remote_ident self._name = name self._methods = {} client.log.debug("new proxy %r" % self) ###################################################### def __getattr__(self, name): with self._client.lock: method = self._methods.get(name) if method is None: self._client.log.debug("new method %r name=%r" % (self, name)) method = RemoteMethod(self, name) self._methods[name] = method return method ###################################################### def __repr__(self): return ("<%s 0x%x remote_ident=%r name=%r>" % (self.__class__.__name__, id(self), self._remote_ident, self._name)) ######################################################################### ######################################################################### class Wait(object): # helper for condition.wait() with reducing timeout # raises exception if the timeout is exceeded def __init__(self, client, timeout, remote_ident, req_id): self.client = client self.timeout = timeout self.remote_ident = remote_ident self.req_id = req_id def __call__(self, exc): if self.timeout is None: self.client.cond.wait() else: assert self.timeout > 0 start_time = get_time() self.client.cond.wait(self.timeout) self.timeout -= get_time() - start_time if self.timeout <= 0: self.client.waiting_for_result.discard(self.req_id) raise exc ######################################################################### ######################################################################### class RpcClient(object): def __init__(self, receive_hook, pickler=pickle): self.log = logging.getLogger("snakemq.rpc.client") self.receive_hook = receive_hook self.pickler = pickler self.method_proxies = {} self.exception_handler = None self.results = {} #: req_id: result self.waiting_for_result = set() # req_ids self.lock = threading.Lock() self.cond = threading.Condition(self.lock) self.connected = {} #: remote_ident:bool receive_hook.register(REPLY_PREFIX, self.on_recv) receive_hook.messaging.on_connect.add(self.on_connect) receive_hook.messaging.on_disconnect.add(self.on_disconnect) ###################################################### def send_params(self, remote_ident, params, ttl): raw = self.pickler.dumps(params) message = Message(data=REQUEST_PREFIX + raw, ttl=ttl) self.receive_hook.messaging.send_message(remote_ident, message) ###################################################### def store_result(self, result): req_id = result["req_id"] try: self.waiting_for_result.remove(req_id) except KeyError: # this result is no longer needed pass else: self.results[req_id] = result ###################################################### def get_result(self, req_id): assert req_id not in self.waiting_for_result return self.results.pop(req_id) ###################################################### def on_connect(self, dummy_conn_id, ident): with self.cond: self.connected[ident] = True self.cond.notify_all() ###################################################### def on_disconnect(self, dummy_conn_id, ident): with self.cond: self.connected[ident] = False self.cond.notify_all() ###################################################### def on_recv(self, dummy_conn_id, dummy_ident, message): res = self.pickler.loads(message.data[len(REPLY_PREFIX):]) if __debug__: self.log.debug("reply req_id=%r" % b2a_hex(res["req_id"])) with self.cond: self.store_result(res) self.cond.notify_all() ###################################################### def call_regular(self, remote_ident, method, params): req_id = params.get("req_id") if req_id is None: req_id = bytes(uuid.uuid4().bytes) params["req_id"] = req_id if __debug__: self.log.debug("call_regular ident=%r obj=%r method=%r req_id=%s" % (remote_ident, params["object"], params["method"], b2a_hex(req_id))) wait = Wait(self, method.call_timeout, remote_ident, req_id) # repeat request until it is replied with self.cond: while True: # TODO check also message send failure (disconnect before msg dispatch) # for both with-timeout and without-timeout calls if self.connected.get(remote_ident): self.waiting_for_result.add(req_id) self.send_params(remote_ident, params, 0) while ((req_id not in self.results) and self.connected.get(remote_ident)): wait(PartialCall) if self.connected.get(remote_ident): res = self.get_result(req_id) break else: # "if" for this "else" serves 2 purposes # - if the first "if" in the loop fails then this will # fail as well - peer is not connected, nothing was sent # - if params were sent and then peer disconnected wait(NotConnected) # for signal from connect/di if res["ok"]: return res["return"] else: self.raise_remote_exception(res["exception"], res["exception_format"]) ###################################################### def call_signal(self, remote_ident, method, params): if __debug__: self.log.debug("call_signal ident=%r obj=%r method=%r" % (remote_ident, params["object"], params["method"])) self.send_params(remote_ident, params, method.signal_timeout) ###################################################### def remote_request(self, remote_ident, method, params): if method.signal_timeout is None: return self.call_regular(remote_ident, method, params) else: self.call_signal(remote_ident, method, params) return None ###################################################### def raise_remote_exception(self, exc, traceb): setattr(exc, REMOTE_TRACEBACK_ATTR, traceb) raise exc ###################################################### def get_proxy(self, remote_ident, name): """ :return: instance registered with register_object() """ return RpcInstProxy(self, remote_ident, name)
{ "content_hash": "406506f8b2798aacaee5fba0c1652db1", "timestamp": "", "source": "github", "line_count": 492, "max_line_length": 87, "avg_line_length": 34.959349593495936, "alnum_prop": 0.4669186046511628, "repo_name": "dsiroky/snakemq", "id": "754360b78f6566a00c5a5bc24d56cf5b30885c20", "size": "17224", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "snakemq/rpc.py", "mode": "33188", "license": "mit", "language": [ { "name": "Python", "bytes": "172714" }, { "name": "Shell", "bytes": "373" } ], "symlink_target": "" }
package model import ( "net/http" "regexp" ) const ( GroupSourceLdap GroupSource = "ldap" GroupSourceCustom GroupSource = "custom" GroupNameMaxLength = 64 GroupSourceMaxLength = 64 GroupDisplayNameMaxLength = 128 GroupDescriptionMaxLength = 1024 GroupRemoteIDMaxLength = 48 ) type GroupSource string var allGroupSources = []GroupSource{ GroupSourceLdap, GroupSourceCustom, } var groupSourcesRequiringRemoteID = []GroupSource{ GroupSourceLdap, } type Group struct { Id string `json:"id"` Name *string `json:"name,omitempty"` DisplayName string `json:"display_name"` Description string `json:"description"` Source GroupSource `json:"source"` RemoteId *string `json:"remote_id"` CreateAt int64 `json:"create_at"` UpdateAt int64 `json:"update_at"` DeleteAt int64 `json:"delete_at"` HasSyncables bool `db:"-" json:"has_syncables"` MemberCount *int `db:"-" json:"member_count,omitempty"` AllowReference bool `json:"allow_reference"` } type GroupWithUserIds struct { Group UserIds []string `json:"user_ids"` } type GroupWithSchemeAdmin struct { Group SchemeAdmin *bool `db:"SyncableSchemeAdmin" json:"scheme_admin,omitempty"` } type GroupsAssociatedToChannelWithSchemeAdmin struct { ChannelId string `json:"channel_id"` Group SchemeAdmin *bool `db:"SyncableSchemeAdmin" json:"scheme_admin,omitempty"` } type GroupsAssociatedToChannel struct { ChannelId string `json:"channel_id"` Groups []*GroupWithSchemeAdmin `json:"groups"` } type GroupPatch struct { Name *string `json:"name"` DisplayName *string `json:"display_name"` Description *string `json:"description"` AllowReference *bool `json:"allow_reference"` // For security reasons (including preventing unintended LDAP group synchronization) do no allow a Group's RemoteId or Source field to be // included in patches. } type LdapGroupSearchOpts struct { Q string IsLinked *bool IsConfigured *bool } type GroupSearchOpts struct { Q string NotAssociatedToTeam string NotAssociatedToChannel string IncludeMemberCount bool FilterAllowReference bool PageOpts *PageOpts Since int64 Source GroupSource // FilterParentTeamPermitted filters the groups to the intersect of the // set associated to the parent team and those returned by the query. // If the parent team is not group-constrained or if NotAssociatedToChannel // is not set then this option is ignored. FilterParentTeamPermitted bool // FilterHasMember filters the groups to the intersect of the // set returned by the query and those that have the given user as a member. FilterHasMember string } type GetGroupOpts struct { IncludeMemberCount bool } type PageOpts struct { Page int PerPage int } type GroupStats struct { GroupID string `json:"group_id"` TotalMemberCount int64 `json:"total_member_count"` } type GroupModifyMembers struct { UserIds []string `json:"user_ids"` } func (group *Group) Patch(patch *GroupPatch) { if patch.Name != nil { group.Name = patch.Name } if patch.DisplayName != nil { group.DisplayName = *patch.DisplayName } if patch.Description != nil { group.Description = *patch.Description } if patch.AllowReference != nil { group.AllowReference = *patch.AllowReference } } func (group *Group) IsValidForCreate() *AppError { err := group.IsValidName() if err != nil { return err } if l := len(group.DisplayName); l == 0 || l > GroupDisplayNameMaxLength { return NewAppError("Group.IsValidForCreate", "model.group.display_name.app_error", map[string]interface{}{"GroupDisplayNameMaxLength": GroupDisplayNameMaxLength}, "", http.StatusBadRequest) } if len(group.Description) > GroupDescriptionMaxLength { return NewAppError("Group.IsValidForCreate", "model.group.description.app_error", map[string]interface{}{"GroupDescriptionMaxLength": GroupDescriptionMaxLength}, "", http.StatusBadRequest) } isValidSource := false for _, groupSource := range allGroupSources { if group.Source == groupSource { isValidSource = true break } } if !isValidSource { return NewAppError("Group.IsValidForCreate", "model.group.source.app_error", nil, "", http.StatusBadRequest) } if (group.GetRemoteId() == "" && group.requiresRemoteId()) || len(group.GetRemoteId()) > GroupRemoteIDMaxLength { return NewAppError("Group.IsValidForCreate", "model.group.remote_id.app_error", nil, "", http.StatusBadRequest) } return nil } func (group *Group) requiresRemoteId() bool { for _, groupSource := range groupSourcesRequiringRemoteID { if groupSource == group.Source { return true } } return false } func (group *Group) IsValidForUpdate() *AppError { if !IsValidId(group.Id) { return NewAppError("Group.IsValidForUpdate", "app.group.id.app_error", nil, "", http.StatusBadRequest) } if group.CreateAt == 0 { return NewAppError("Group.IsValidForUpdate", "model.group.create_at.app_error", nil, "", http.StatusBadRequest) } if group.UpdateAt == 0 { return NewAppError("Group.IsValidForUpdate", "model.group.update_at.app_error", nil, "", http.StatusBadRequest) } if err := group.IsValidForCreate(); err != nil { return err } return nil } var validGroupnameChars = regexp.MustCompile(`^[a-z0-9\.\-_]+$`) func (group *Group) IsValidName() *AppError { if group.Name == nil { if group.AllowReference { return NewAppError("Group.IsValidName", "model.group.name.app_error", map[string]interface{}{"GroupNameMaxLength": GroupNameMaxLength}, "", http.StatusBadRequest) } } else { if l := len(*group.Name); l == 0 || l > GroupNameMaxLength { return NewAppError("Group.IsValidName", "model.group.name.invalid_length.app_error", map[string]interface{}{"GroupNameMaxLength": GroupNameMaxLength}, "", http.StatusBadRequest) } if !validGroupnameChars.MatchString(*group.Name) { return NewAppError("Group.IsValidName", "model.group.name.invalid_chars.app_error", nil, "", http.StatusBadRequest) } } return nil } func (group *Group) GetName() string { if group.Name == nil { return "" } return *group.Name } func (group *Group) GetRemoteId() string { if group.RemoteId == nil { return "" } return *group.RemoteId } type GroupsWithCount struct { Groups []*Group `json:"groups"` TotalCount int64 `json:"total_count"` }
{ "content_hash": "4803e8ecde360fe867fcb11b584fde9e", "timestamp": "", "source": "github", "line_count": 228, "max_line_length": 191, "avg_line_length": 28.50438596491228, "alnum_prop": 0.7044160640098477, "repo_name": "42wim/matterircd", "id": "428c431a676d230ec236b459b804a734cd965795", "size": "6612", "binary": false, "copies": "2", "ref": "refs/heads/master", "path": "vendor/github.com/mattermost/mattermost-server/v6/model/group.go", "mode": "33188", "license": "mit", "language": [ { "name": "Dockerfile", "bytes": "438" }, { "name": "Go", "bytes": "207511" } ], "symlink_target": "" }
/* ___ _ ___ _ _ *\ ** / __| |/ (_) | | The SKilL Generator ** ** \__ \ ' <| | | |__ (c) 2013 University of Stuttgart ** ** |___/_|\_\_|_|____| see LICENSE ** \* */ package de.ust.skill.parser import java.io.File import scala.collection.JavaConversions._ import scala.language.implicitConversions import org.junit.runner.RunWith import org.scalatest.FunSuite import org.scalatest.junit.JUnitRunner @RunWith(classOf[JUnitRunner]) class ParserTest extends FunSuite { implicit private def basePath(path : String) : File = new File("src/test/resources"+path); private def check(filename : String) = { assert(0 != Parser.process(filename).size) } test("good hints") { check("/hints.skill") } test("bad hints") { intercept[IllegalArgumentException] { check("/badHints.skill") } } test("restrictions") { val e = intercept[de.ust.skill.ir.ParseException] { check("/restrictions.skill") } assert("notahint() is either not supported or an invalid restriction name" === e.getMessage()) } test("test")(check("/test.skill")) test("test2")(check("/test2.skill")) test("test3")(check("/test3.skill")) test("test4")(check("/test4.skill")) test("example1")(check("/example1.skill")) test("example2a")(check("/example2a.skill")) test("example2b")(check("/example2b.skill")) test("unicode")(check("/unicode.skill")) test("empty")(assert(0 === Parser.process("/empty.skill").size)) test("type ordered IR") { val IR = Parser.process("/typeOrderIR.skill") val order = IR.map(_.getSkillName).mkString("") assert(order == "abdc" || order == "acbd", order + " is not in type order!") } test("regression: casing of user types") { val ir = Parser.process("/regressionCasing.skill") assert(2 === ir.size) // note: this is a valid test, because IR has to be in type order assert(ir.get(0).getSkillName === "message") assert(ir.get(1).getSkillName === "datedmessage") } test("regression: report missing types") { val e = intercept[de.ust.skill.ir.ParseException] { check("/failures/missingTypeCausedBySpelling.skill") } assert("""The type "MessSage" is unknown! Known types are: message, datedmessage""" === e.getMessage()) } }
{ "content_hash": "3a7011d40e6cb5942ee281fba0a477de", "timestamp": "", "source": "github", "line_count": 60, "max_line_length": 110, "avg_line_length": 40.71666666666667, "alnum_prop": 0.5931232091690545, "repo_name": "XyzNobody/skill", "id": "e98063d5d8a82f21f284a9b72350dd200cd1566c", "size": "2443", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "src/test/scala/de/ust/skill/parser/ParserTest.scala", "mode": "33188", "license": "bsd-3-clause", "language": [ { "name": "Java", "bytes": "27143" }, { "name": "Scala", "bytes": "403623" } ], "symlink_target": "" }
'use strict'; const arrayFrom = require('./util').arrayFrom; /** * [reduce description] * @param {Array|Iterable} iterable Array, iterator, or anything with a compliant `Symbol.iterator` or `@@iterator` property * @param {function} reducer Reducer that takes the same argument profile as Array#reduce * @param {Promise|Any} initVal? initial value (could be promise or value) * @return {Promise} Promise that resolves to the result */ function reduce(iterable, reducer, initVal) { let array = arrayFrom(iterable), offset = 0; if (arguments.length < 3) { initVal = array[0]; array = array.slice(1); offset = 1; } return array.reduce(function(prevResults, pOrV, i, array) { return prevResults.then(function(results) { return Promise.resolve(pOrV).then(val => reducer(results, val, i + offset, array)); }); }, Promise.resolve(initVal)); } module.exports = reduce;
{ "content_hash": "2508509c4f1a67ff7874e0edaedf8e64", "timestamp": "", "source": "github", "line_count": 26, "max_line_length": 125, "avg_line_length": 35.34615384615385, "alnum_prop": 0.6833514689880305, "repo_name": "jaawerth/swear", "id": "7ecad81d2f4bf88131383061e7dcd94fcacbd6f2", "size": "919", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "src/reduce.js", "mode": "33188", "license": "mit", "language": [ { "name": "JavaScript", "bytes": "14518" } ], "symlink_target": "" }
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <!-- NewPage --> <html lang="en"> <head> <!-- Generated by javadoc (1.8.0_111) on Thu Nov 02 14:33:41 CDT 2017 --> <title>Uses of Class lx4p.LXHueInterface</title> <meta name="date" content="2017-11-02"> <link rel="stylesheet" type="text/css" href="../../stylesheet.css" title="Style"> <script type="text/javascript" src="../../script.js"></script> </head> <body> <script type="text/javascript"><!-- try { if (location.href.indexOf('is-external=true') == -1) { parent.document.title="Uses of Class lx4p.LXHueInterface"; } } catch(err) { } //--> </script> <noscript> <div>JavaScript is disabled on your browser.</div> </noscript> <!-- ========= START OF TOP NAVBAR ======= --> <div class="topNav"><a name="navbar.top"> <!-- --> </a> <div class="skipNav"><a href="#skip.navbar.top" title="Skip navigation links">Skip navigation links</a></div> <a name="navbar.top.firstrow"> <!-- --> </a> <ul class="navList" title="Navigation"> <li><a href="../../lx4p/package-summary.html">Package</a></li> <li><a href="../../lx4p/LXHueInterface.html" title="class in lx4p">Class</a></li> <li class="navBarCell1Rev">Use</li> <li><a href="../package-tree.html">Tree</a></li> <li><a href="../../deprecated-list.html">Deprecated</a></li> <li><a href="../../index-files/index-1.html">Index</a></li> <li><a href="../../help-doc.html">Help</a></li> </ul> </div> <div class="subNav"> <ul class="navList"> <li>Prev</li> <li>Next</li> </ul> <ul class="navList"> <li><a href="../../index.html?lx4p/class-use/LXHueInterface.html" target="_top">Frames</a></li> <li><a href="LXHueInterface.html" target="_top">No&nbsp;Frames</a></li> </ul> <ul class="navList" id="allclasses_navbar_top"> <li><a href="../../allclasses-noframe.html">All&nbsp;Classes</a></li> </ul> <div> <script type="text/javascript"><!-- allClassesLink = document.getElementById("allclasses_navbar_top"); if(window==top) { allClassesLink.style.display = "block"; } else { allClassesLink.style.display = "none"; } //--> </script> </div> <a name="skip.navbar.top"> <!-- --> </a></div> <!-- ========= END OF TOP NAVBAR ========= --> <div class="header"> <h2 title="Uses of Class lx4p.LXHueInterface" class="title">Uses of Class<br>lx4p.LXHueInterface</h2> </div> <div class="classUseContainer">No usage of lx4p.LXHueInterface</div> <!-- ======= START OF BOTTOM NAVBAR ====== --> <div class="bottomNav"><a name="navbar.bottom"> <!-- --> </a> <div class="skipNav"><a href="#skip.navbar.bottom" title="Skip navigation links">Skip navigation links</a></div> <a name="navbar.bottom.firstrow"> <!-- --> </a> <ul class="navList" title="Navigation"> <li><a href="../../lx4p/package-summary.html">Package</a></li> <li><a href="../../lx4p/LXHueInterface.html" title="class in lx4p">Class</a></li> <li class="navBarCell1Rev">Use</li> <li><a href="../package-tree.html">Tree</a></li> <li><a href="../../deprecated-list.html">Deprecated</a></li> <li><a href="../../index-files/index-1.html">Index</a></li> <li><a href="../../help-doc.html">Help</a></li> </ul> </div> <div class="subNav"> <ul class="navList"> <li>Prev</li> <li>Next</li> </ul> <ul class="navList"> <li><a href="../../index.html?lx4p/class-use/LXHueInterface.html" target="_top">Frames</a></li> <li><a href="LXHueInterface.html" target="_top">No&nbsp;Frames</a></li> </ul> <ul class="navList" id="allclasses_navbar_bottom"> <li><a href="../../allclasses-noframe.html">All&nbsp;Classes</a></li> </ul> <div> <script type="text/javascript"><!-- allClassesLink = document.getElementById("allclasses_navbar_bottom"); if(window==top) { allClassesLink.style.display = "block"; } else { allClassesLink.style.display = "none"; } //--> </script> </div> <a name="skip.navbar.bottom"> <!-- --> </a></div> <!-- ======== END OF BOTTOM NAVBAR ======= --> </body> </html>
{ "content_hash": "f7339e3b88379f88d2dfa6d941f33f33", "timestamp": "", "source": "github", "line_count": 122, "max_line_length": 112, "avg_line_length": 32.31147540983606, "alnum_prop": 0.6212582445459158, "repo_name": "claudeheintz/LXforProcessing", "id": "c737ef957fcd9450e72d2605e7f510405636bd0d", "size": "3942", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "reference/lx4p/class-use/LXHueInterface.html", "mode": "33188", "license": "bsd-3-clause", "language": [ { "name": "CSS", "bytes": "11139" }, { "name": "HTML", "bytes": "1058091" }, { "name": "Java", "bytes": "190570" }, { "name": "JavaScript", "bytes": "827" } ], "symlink_target": "" }
<?php use Illuminate\Database\Migrations\Migration; use Illuminate\Database\Schema\Blueprint; use Illuminate\Support\Facades\Schema; class AddLastUsedAtToTagsTable extends Migration { use SchemaBuilder; /** * Run the migrations. * * @return void */ public function up() { Schema::table('tags', function (Blueprint $table) { $table->timestampTz('last_used_at')->nullable(); }); $sql = ' UPDATE tags SET last_used_at = greatest( (select max(microblogs.created_at) from microblog_tags join microblogs on microblogs.id = microblog_tags.microblog_id where microblog_tags.tag_id = tags.id), (select max(topics.created_at) from topic_tags join topics on topics.id = topic_tags.topic_id where topic_tags.tag_id = tags.id), (select max(jobs.created_at) from job_tags join jobs on jobs.id = job_tags.job_id where job_tags.tag_id = tags.id) )'; $this->db->statement($sql); } /** * Reverse the migrations. * * @return void */ public function down() { Schema::table('tags', function (Blueprint $table) { $table->dropColumn('last_used_at'); }); } }
{ "content_hash": "27530a872e3562bdad45f931c9021927", "timestamp": "", "source": "github", "line_count": 58, "max_line_length": 60, "avg_line_length": 24.93103448275862, "alnum_prop": 0.5228215767634855, "repo_name": "adam-boduch/coyote", "id": "4552dc480c85e236acae31fe61d857059f429bd5", "size": "1446", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "database/migrations/2020_11_19_162847_add_last_used_at_to_tags_table.php", "mode": "33188", "license": "mit", "language": [ { "name": "Blade", "bytes": "37238" }, { "name": "Dockerfile", "bytes": "4379" }, { "name": "JavaScript", "bytes": "87084" }, { "name": "Makefile", "bytes": "2139" }, { "name": "PHP", "bytes": "2218890" }, { "name": "SCSS", "bytes": "113210" }, { "name": "Shell", "bytes": "1351" }, { "name": "Twig", "bytes": "271846" }, { "name": "TypeScript", "bytes": "100831" }, { "name": "Vue", "bytes": "232480" } ], "symlink_target": "" }
/** * @module Sysmanager */ /** * Panelwidget which lists all sysmanager modules * * @class SysmanagerModules * @namespace Todoyu.Ext.sysmanager.PanelWidget */ Todoyu.Ext.sysmanager.PanelWidget.SysmanagerModules = { /** * Reference to extension * * @property ext * @type Object */ ext: Todoyu.Ext.sysmanager, /** * @property list * @type Element */ list: null, /** * Initialize sysmanager modules widget * * @method init */ init: function() { this.list = $('sysmanager-modules'); }, /** * Load and activate given module * * @method module * @param {String} module */ module: function(module) { this.ext.loadModule(module); this.activate(module); }, /** * Activate given module * * @method activate * @param {String} module */ activate: function(module) { var current = this.getActive(); if( current ) { current.removeClassName('active'); } this.setActive(module); }, /** * Get currently activated module option * * @method getActive * @return Element */ getActive: function() { return this.list.down('li.active'); }, /** * Set given module option active * * @method setActive * @param {String} module */ setActive: function(module) { this.list.down('li.' + module).addClassName('active'); } };
{ "content_hash": "401eb970fcb2404c9c309d6e3b4cdea8", "timestamp": "", "source": "github", "line_count": 95, "max_line_length": 56, "avg_line_length": 14, "alnum_prop": 0.6233082706766917, "repo_name": "JoAutomation/todo-for-you", "id": "e9af109bc1befe8c7a59b5704cf4cf498ca0dee3", "size": "2147", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "ext/sysmanager/asset/js/PanelWidgetSysmanagerModules.js", "mode": "33188", "license": "mit", "language": [ { "name": "CSS", "bytes": "302967" }, { "name": "JavaScript", "bytes": "1840518" }, { "name": "PHP", "bytes": "4705200" } ], "symlink_target": "" }
from django.template.defaulttags import register import pytz import json @register.filter def get_item(dictionary, key): return dictionary.get(key)
{ "content_hash": "fc59701d852146d231c89bc1d2c114d4", "timestamp": "", "source": "github", "line_count": 8, "max_line_length": 48, "avg_line_length": 19.25, "alnum_prop": 0.7922077922077922, "repo_name": "FabianWe/foodle", "id": "7046b60d0eae28130c8e2ab173a744a992892026", "size": "1306", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "foodle/foodle_polls/filters.py", "mode": "33188", "license": "mit", "language": [ { "name": "CSS", "bytes": "1392" }, { "name": "HTML", "bytes": "32514" }, { "name": "JavaScript", "bytes": "23028" }, { "name": "Python", "bytes": "71358" }, { "name": "Shell", "bytes": "342" } ], "symlink_target": "" }
<?php return [ [ "./tests/vulntestsuite/CWE_862_Fopen__GET__ternary_white_list__fopen.php", [] ], [ "./tests/vulntestsuite/CWE_862_Fopen__GET__whitelist_using_array__fopen.php", [] ], [ "./tests/vulntestsuite/CWE_862_Fopen__POST__ternary_white_list__fopen.php", [] ], [ "./tests/vulntestsuite/CWE_862_Fopen__POST__whitelist_using_array__fopen.php", [] ], [ "./tests/vulntestsuite/CWE_862_Fopen__SESSION__ternary_white_list__fopen.php", [] ], [ "./tests/vulntestsuite/CWE_862_Fopen__SESSION__whitelist_using_array__fopen.php", [] ], [ "./tests/vulntestsuite/CWE_862_Fopen__array-GET__ternary_white_list__fopen.php", [] ], [ "./tests/vulntestsuite/CWE_862_Fopen__array-GET__whitelist_using_array__fopen.php", [] ], [ "./tests/vulntestsuite/CWE_862_Fopen__backticks__ternary_white_list__fopen.php", [] ], [ "./tests/vulntestsuite/CWE_862_Fopen__backticks__whitelist_using_array__fopen.php", [] ], [ "./tests/vulntestsuite/CWE_862_Fopen__exec__ternary_white_list__fopen.php", [] ], [ "./tests/vulntestsuite/CWE_862_Fopen__exec__whitelist_using_array__fopen.php", [] ], [ "./tests/vulntestsuite/CWE_862_Fopen__fopen__ternary_white_list__fopen.php", [] ], [ "./tests/vulntestsuite/CWE_862_Fopen__fopen__whitelist_using_array__fopen.php", [] ], [ "./tests/vulntestsuite/CWE_862_Fopen__object-Array__ternary_white_list__fopen.php", [] ], [ "./tests/vulntestsuite/CWE_862_Fopen__object-Array__whitelist_using_array__fopen.php", [] ], [ "./tests/vulntestsuite/CWE_862_Fopen__object-classicGet__ternary_white_list__fopen.php", [] ], [ "./tests/vulntestsuite/CWE_862_Fopen__object-classicGet__whitelist_using_array__fopen.php", [] ], [ "./tests/vulntestsuite/CWE_862_Fopen__object-directGet__ternary_white_list__fopen.php", [] ], [ "./tests/vulntestsuite/CWE_862_Fopen__object-directGet__whitelist_using_array__fopen.php", [] ], [ "./tests/vulntestsuite/CWE_862_Fopen__object-indexArray__ternary_white_list__fopen.php", [] ], [ "./tests/vulntestsuite/CWE_862_Fopen__object-indexArray__whitelist_using_array__fopen.php", [] ], [ "./tests/vulntestsuite/CWE_862_Fopen__popen__ternary_white_list__fopen.php", [] ], [ "./tests/vulntestsuite/CWE_862_Fopen__popen__whitelist_using_array__fopen.php", [] ], [ "./tests/vulntestsuite/CWE_862_Fopen__proc_open__ternary_white_list__fopen.php", [] ], [ "./tests/vulntestsuite/CWE_862_Fopen__proc_open__whitelist_using_array__fopen.php", [] ], [ "./tests/vulntestsuite/CWE_862_Fopen__shell_exec__ternary_white_list__fopen.php", [] ], [ "./tests/vulntestsuite/CWE_862_Fopen__shell_exec__whitelist_using_array__fopen.php", [] ], [ "./tests/vulntestsuite/CWE_862_Fopen__system__ternary_white_list__fopen.php", [] ], [ "./tests/vulntestsuite/CWE_862_Fopen__system__whitelist_using_array__fopen.php", [] ], [ "./tests/vulntestsuite/CWE_862_Fopen__GET__func_preg_replace__fopen.php", [["\$tainted", "48", "idor"]] ], [ "./tests/vulntestsuite/CWE_862_Fopen__GET__no_sanitizing__fopen.php", [["\$tainted", "46", "idor"]] ], [ "./tests/vulntestsuite/CWE_862_Fopen__POST__func_preg_replace__fopen.php", [["\$tainted", "48", "idor"]] ], [ "./tests/vulntestsuite/CWE_862_Fopen__POST__no_sanitizing__fopen.php", [["\$tainted", "46", "idor"]] ], [ "./tests/vulntestsuite/CWE_862_Fopen__backticks__func_preg_replace__fopen.php", [["\$tainted", "48", "idor"]] ], [ "./tests/vulntestsuite/CWE_862_Fopen__backticks__no_sanitizing__fopen.php", [["\$tainted", "46", "idor"]] ], [ "./tests/vulntestsuite/CWE_862_Fopen__exec__func_preg_replace__fopen.php", [["\$tainted", "51", "idor"]] ], [ "./tests/vulntestsuite/CWE_862_Fopen__exec__no_sanitizing__fopen.php", [["\$tainted", "49", "idor"]] ], [ "./tests/vulntestsuite/CWE_862_Fopen__fopen__func_preg_replace__fopen.php", [["\$tainted", "57", "idor"]] ], [ "./tests/vulntestsuite/CWE_862_Fopen__fopen__no_sanitizing__fopen.php", [["\$tainted", "49", "idor"]] ], [ "./tests/vulntestsuite/CWE_862_Fopen__object-Array__func_preg_replace__fopen.php", [["\$tainted", "66", "idor"]] ], [ "./tests/vulntestsuite/CWE_862_Fopen__object-Array__no_sanitizing__fopen.php", [["\$tainted", "64", "idor"]] ], [ "./tests/vulntestsuite/CWE_862_Fopen__object-classicGet__func_preg_replace__fopen.php", [["\$tainted", "63", "idor"]] ], [ "./tests/vulntestsuite/CWE_862_Fopen__object-classicGet__no_sanitizing__fopen.php", [["\$tainted", "61", "idor"]] ], [ "./tests/vulntestsuite/CWE_862_Fopen__object-directGet__func_preg_replace__fopen.php", [["\$tainted", "57", "idor"]] ], [ "./tests/vulntestsuite/CWE_862_Fopen__object-directGet__no_sanitizing__fopen.php", [["\$tainted", "55", "idor"]] ], [ "./tests/vulntestsuite/CWE_862_Fopen__object-indexArray__func_preg_replace__fopen.php", [["\$tainted", "66", "idor"]] ], [ "./tests/vulntestsuite/CWE_862_Fopen__object-indexArray__no_sanitizing__fopen.php", [["\$tainted", "64", "idor"]] ], [ "./tests/vulntestsuite/CWE_862_Fopen__popen__func_preg_replace__fopen.php", [["\$tainted", "50", "idor"]] ], [ "./tests/vulntestsuite/CWE_862_Fopen__popen__no_sanitizing__fopen.php", [["\$tainted", "47", "idor"]] ], [ "./tests/vulntestsuite/CWE_862_Fopen__proc_open__func_preg_replace__fopen.php", [["\$tainted", "60", "idor"]] ], [ "./tests/vulntestsuite/CWE_862_Fopen__proc_open__no_sanitizing__fopen.php", [["\$tainted", "55", "idor"]] ], [ "./tests/vulntestsuite/CWE_862_Fopen__shell_exec__func_preg_replace__fopen.php", [["\$tainted", "48", "idor"]] ], [ "./tests/vulntestsuite/CWE_862_Fopen__shell_exec__no_sanitizing__fopen.php", [["\$tainted", "46", "idor"]] ], [ "./tests/vulntestsuite/CWE_862_Fopen__system__func_preg_replace__fopen.php", [["\$tainted", "48", "idor"]] ], [ "./tests/vulntestsuite/CWE_862_Fopen__system__no_sanitizing__fopen.php", [["\$tainted", "46", "idor"]] ], [ "./tests/vulntestsuite/CWE_862_Fopen__unserialize__func_preg_replace__fopen.php", [["\$string", "46", "code_injection"], ["\$tainted", "50", "idor"]] ], [ "./tests/vulntestsuite/CWE_862_Fopen__unserialize__no_sanitizing__fopen.php", [["\$string", "46", "code_injection"], ["\$tainted", "47", "idor"]] ], [ "./tests/vulntestsuite/CWE_862_SQL__GET__CAST-cast_int__non_prepared_query-right_verification.php", [] ], [ "./tests/vulntestsuite/CWE_862_SQL__GET__CAST-cast_int__prepared_query-right_verification.php", [] ], [ "./tests/vulntestsuite/CWE_862_SQL__GET__ESAPI__non_prepared_query-right_verification.php", [] ], [ "./tests/vulntestsuite/CWE_862_SQL__GET__ESAPI__prepared_query-no_right_verification.php", [] ], [ "./tests/vulntestsuite/CWE_862_SQL__GET__ESAPI__prepared_query-right_verification.php", [] ], [ "./tests/vulntestsuite/CWE_862_SQL__GET__ESAPI__select_from_where-interpretation_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_862_SQL__GET__Indirect_reference__non_prepared_query-right_verification.php", [] ], [ "./tests/vulntestsuite/CWE_862_SQL__GET__Indirect_reference__prepared_query-no_right_verification.php", [] ], [ "./tests/vulntestsuite/CWE_862_SQL__GET__Indirect_reference__prepared_query-right_verification.php", [] ], [ "./tests/vulntestsuite/CWE_862_SQL__GET__Indirect_reference__select_from_where-interpretation_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_862_SQL__GET__ternary_white_list__non_prepared_query-right_verification.php", [] ], [ "./tests/vulntestsuite/CWE_862_SQL__GET__ternary_white_list__prepared_query-no_right_verification.php", [] ], [ "./tests/vulntestsuite/CWE_862_SQL__GET__ternary_white_list__prepared_query-right_verification.php", [] ], [ "./tests/vulntestsuite/CWE_862_SQL__GET__ternary_white_list__select_from_where-interpretation_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_862_SQL__GET__whitelist_using_array__non_prepared_query-right_verification.php", [] ], [ "./tests/vulntestsuite/CWE_862_SQL__GET__whitelist_using_array__prepared_query-no_right_verification.php", [] ], [ "./tests/vulntestsuite/CWE_862_SQL__GET__whitelist_using_array__prepared_query-right_verification.php", [] ], [ "./tests/vulntestsuite/CWE_862_SQL__GET__whitelist_using_array__select_from_where-interpretation_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_862_SQL__POST__CAST-cast_int__non_prepared_query-right_verification.php", [] ], [ "./tests/vulntestsuite/CWE_862_SQL__POST__CAST-cast_int__prepared_query-right_verification.php", [] ], [ "./tests/vulntestsuite/CWE_862_SQL__POST__ESAPI__non_prepared_query-right_verification.php", [] ], [ "./tests/vulntestsuite/CWE_862_SQL__POST__ESAPI__prepared_query-no_right_verification.php", [] ], [ "./tests/vulntestsuite/CWE_862_SQL__POST__ESAPI__prepared_query-right_verification.php", [] ], [ "./tests/vulntestsuite/CWE_862_SQL__POST__ESAPI__select_from_where-interpretation_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_862_SQL__POST__Indirect_reference__non_prepared_query-right_verification.php", [] ], [ "./tests/vulntestsuite/CWE_862_SQL__POST__Indirect_reference__prepared_query-no_right_verification.php", [] ], [ "./tests/vulntestsuite/CWE_862_SQL__POST__Indirect_reference__prepared_query-right_verification.php", [] ], [ "./tests/vulntestsuite/CWE_862_SQL__POST__Indirect_reference__select_from_where-interpretation_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_862_SQL__POST__ternary_white_list__non_prepared_query-right_verification.php", [] ], [ "./tests/vulntestsuite/CWE_862_SQL__POST__ternary_white_list__prepared_query-no_right_verification.php", [] ], [ "./tests/vulntestsuite/CWE_862_SQL__POST__ternary_white_list__prepared_query-right_verification.php", [] ], [ "./tests/vulntestsuite/CWE_862_SQL__POST__ternary_white_list__select_from_where-interpretation_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_862_SQL__POST__whitelist_using_array__non_prepared_query-right_verification.php", [] ], [ "./tests/vulntestsuite/CWE_862_SQL__POST__whitelist_using_array__prepared_query-no_right_verification.php", [] ], [ "./tests/vulntestsuite/CWE_862_SQL__POST__whitelist_using_array__prepared_query-right_verification.php", [] ], [ "./tests/vulntestsuite/CWE_862_SQL__POST__whitelist_using_array__select_from_where-interpretation_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_862_SQL__SESSION__CAST-cast_int__non_prepared_query-right_verification.php", [] ], [ "./tests/vulntestsuite/CWE_862_SQL__SESSION__CAST-cast_int__prepared_query-right_verification.php", [] ], [ "./tests/vulntestsuite/CWE_862_SQL__SESSION__ESAPI__non_prepared_query-right_verification.php", [] ], [ "./tests/vulntestsuite/CWE_862_SQL__SESSION__ESAPI__prepared_query-no_right_verification.php", [] ], [ "./tests/vulntestsuite/CWE_862_SQL__SESSION__ESAPI__prepared_query-right_verification.php", [] ], [ "./tests/vulntestsuite/CWE_862_SQL__SESSION__ESAPI__select_from_where-interpretation_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_862_SQL__SESSION__Indirect_reference__non_prepared_query-right_verification.php", [] ], [ "./tests/vulntestsuite/CWE_862_SQL__SESSION__Indirect_reference__prepared_query-no_right_verification.php", [] ], [ "./tests/vulntestsuite/CWE_862_SQL__SESSION__Indirect_reference__prepared_query-right_verification.php", [] ], [ "./tests/vulntestsuite/CWE_862_SQL__SESSION__Indirect_reference__select_from_where-interpretation_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_862_SQL__SESSION__ternary_white_list__non_prepared_query-right_verification.php", [] ], [ "./tests/vulntestsuite/CWE_862_SQL__SESSION__ternary_white_list__prepared_query-no_right_verification.php", [] ], [ "./tests/vulntestsuite/CWE_862_SQL__SESSION__ternary_white_list__prepared_query-right_verification.php", [] ], [ "./tests/vulntestsuite/CWE_862_SQL__SESSION__ternary_white_list__select_from_where-interpretation_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_862_SQL__SESSION__whitelist_using_array__non_prepared_query-right_verification.php", [] ], [ "./tests/vulntestsuite/CWE_862_SQL__SESSION__whitelist_using_array__prepared_query-no_right_verification.php", [] ], [ "./tests/vulntestsuite/CWE_862_SQL__SESSION__whitelist_using_array__prepared_query-right_verification.php", [] ], [ "./tests/vulntestsuite/CWE_862_SQL__SESSION__whitelist_using_array__select_from_where-interpretation_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_862_SQL__array-GET__CAST-cast_int__non_prepared_query-right_verification.php", [] ], [ "./tests/vulntestsuite/CWE_862_SQL__array-GET__CAST-cast_int__prepared_query-right_verification.php", [] ], [ "./tests/vulntestsuite/CWE_862_SQL__array-GET__ESAPI__non_prepared_query-right_verification.php", [] ], [ "./tests/vulntestsuite/CWE_862_SQL__array-GET__ESAPI__prepared_query-no_right_verification.php", [] ], [ "./tests/vulntestsuite/CWE_862_SQL__array-GET__ESAPI__prepared_query-right_verification.php", [] ], [ "./tests/vulntestsuite/CWE_862_SQL__array-GET__ESAPI__select_from_where-interpretation_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_862_SQL__array-GET__Indirect_reference__non_prepared_query-right_verification.php", [] ], [ "./tests/vulntestsuite/CWE_862_SQL__array-GET__Indirect_reference__prepared_query-no_right_verification.php", [] ], [ "./tests/vulntestsuite/CWE_862_SQL__array-GET__Indirect_reference__prepared_query-right_verification.php", [] ], [ "./tests/vulntestsuite/CWE_862_SQL__array-GET__Indirect_reference__select_from_where-interpretation_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_862_SQL__array-GET__ternary_white_list__non_prepared_query-right_verification.php", [] ], [ "./tests/vulntestsuite/CWE_862_SQL__array-GET__ternary_white_list__prepared_query-no_right_verification.php", [] ], [ "./tests/vulntestsuite/CWE_862_SQL__array-GET__ternary_white_list__prepared_query-right_verification.php", [] ], [ "./tests/vulntestsuite/CWE_862_SQL__array-GET__ternary_white_list__select_from_where-interpretation_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_862_SQL__array-GET__whitelist_using_array__non_prepared_query-right_verification.php", [] ], [ "./tests/vulntestsuite/CWE_862_SQL__array-GET__whitelist_using_array__prepared_query-no_right_verification.php", [] ], [ "./tests/vulntestsuite/CWE_862_SQL__array-GET__whitelist_using_array__prepared_query-right_verification.php", [] ], [ "./tests/vulntestsuite/CWE_862_SQL__array-GET__whitelist_using_array__select_from_where-interpretation_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_862_SQL__backticks__CAST-cast_int__non_prepared_query-right_verification.php", [] ], [ "./tests/vulntestsuite/CWE_862_SQL__backticks__CAST-cast_int__prepared_query-right_verification.php", [] ], [ "./tests/vulntestsuite/CWE_862_SQL__backticks__ESAPI__non_prepared_query-right_verification.php", [] ], [ "./tests/vulntestsuite/CWE_862_SQL__backticks__ESAPI__prepared_query-no_right_verification.php", [] ], [ "./tests/vulntestsuite/CWE_862_SQL__backticks__ESAPI__prepared_query-right_verification.php", [] ], [ "./tests/vulntestsuite/CWE_862_SQL__backticks__ESAPI__select_from_where-interpretation_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_862_SQL__backticks__Indirect_reference__non_prepared_query-right_verification.php", [] ], [ "./tests/vulntestsuite/CWE_862_SQL__backticks__Indirect_reference__prepared_query-no_right_verification.php", [] ], [ "./tests/vulntestsuite/CWE_862_SQL__backticks__Indirect_reference__prepared_query-right_verification.php", [] ], [ "./tests/vulntestsuite/CWE_862_SQL__backticks__Indirect_reference__select_from_where-interpretation_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_862_SQL__backticks__ternary_white_list__non_prepared_query-right_verification.php", [] ], [ "./tests/vulntestsuite/CWE_862_SQL__backticks__ternary_white_list__prepared_query-no_right_verification.php", [] ], [ "./tests/vulntestsuite/CWE_862_SQL__backticks__ternary_white_list__prepared_query-right_verification.php", [] ], [ "./tests/vulntestsuite/CWE_862_SQL__backticks__ternary_white_list__select_from_where-interpretation_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_862_SQL__backticks__whitelist_using_array__non_prepared_query-right_verification.php", [] ], [ "./tests/vulntestsuite/CWE_862_SQL__backticks__whitelist_using_array__prepared_query-no_right_verification.php", [] ], [ "./tests/vulntestsuite/CWE_862_SQL__backticks__whitelist_using_array__prepared_query-right_verification.php", [] ], [ "./tests/vulntestsuite/CWE_862_SQL__backticks__whitelist_using_array__select_from_where-interpretation_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_862_SQL__exec__CAST-cast_int__non_prepared_query-right_verification.php", [] ], [ "./tests/vulntestsuite/CWE_862_SQL__exec__CAST-cast_int__prepared_query-right_verification.php", [] ], [ "./tests/vulntestsuite/CWE_862_SQL__exec__ESAPI__non_prepared_query-right_verification.php", [] ], [ "./tests/vulntestsuite/CWE_862_SQL__exec__ESAPI__prepared_query-no_right_verification.php", [] ], [ "./tests/vulntestsuite/CWE_862_SQL__exec__ESAPI__prepared_query-right_verification.php", [] ], [ "./tests/vulntestsuite/CWE_862_SQL__exec__ESAPI__select_from_where-interpretation_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_862_SQL__exec__Indirect_reference__non_prepared_query-right_verification.php", [] ], [ "./tests/vulntestsuite/CWE_862_SQL__exec__Indirect_reference__prepared_query-no_right_verification.php", [] ], [ "./tests/vulntestsuite/CWE_862_SQL__exec__Indirect_reference__prepared_query-right_verification.php", [] ], [ "./tests/vulntestsuite/CWE_862_SQL__exec__Indirect_reference__select_from_where-interpretation_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_862_SQL__exec__ternary_white_list__non_prepared_query-right_verification.php", [] ], [ "./tests/vulntestsuite/CWE_862_SQL__exec__ternary_white_list__prepared_query-no_right_verification.php", [] ], [ "./tests/vulntestsuite/CWE_862_SQL__exec__ternary_white_list__prepared_query-right_verification.php", [] ], [ "./tests/vulntestsuite/CWE_862_SQL__exec__ternary_white_list__select_from_where-interpretation_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_862_SQL__exec__whitelist_using_array__non_prepared_query-right_verification.php", [] ], [ "./tests/vulntestsuite/CWE_862_SQL__exec__whitelist_using_array__prepared_query-no_right_verification.php", [] ], [ "./tests/vulntestsuite/CWE_862_SQL__exec__whitelist_using_array__prepared_query-right_verification.php", [] ], [ "./tests/vulntestsuite/CWE_862_SQL__exec__whitelist_using_array__select_from_where-interpretation_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_862_SQL__fopen__CAST-cast_int__non_prepared_query-right_verification.php", [] ], [ "./tests/vulntestsuite/CWE_862_SQL__fopen__CAST-cast_int__prepared_query-right_verification.php", [] ], [ "./tests/vulntestsuite/CWE_862_SQL__fopen__ESAPI__non_prepared_query-right_verification.php", [] ], [ "./tests/vulntestsuite/CWE_862_SQL__fopen__ESAPI__prepared_query-no_right_verification.php", [] ], [ "./tests/vulntestsuite/CWE_862_SQL__fopen__ESAPI__prepared_query-right_verification.php", [] ], [ "./tests/vulntestsuite/CWE_862_SQL__fopen__ESAPI__select_from_where-interpretation_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_862_SQL__fopen__Indirect_reference__non_prepared_query-right_verification.php", [] ], [ "./tests/vulntestsuite/CWE_862_SQL__fopen__Indirect_reference__prepared_query-no_right_verification.php", [] ], [ "./tests/vulntestsuite/CWE_862_SQL__fopen__Indirect_reference__prepared_query-right_verification.php", [] ], [ "./tests/vulntestsuite/CWE_862_SQL__fopen__Indirect_reference__select_from_where-interpretation_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_862_SQL__fopen__ternary_white_list__non_prepared_query-right_verification.php", [] ], [ "./tests/vulntestsuite/CWE_862_SQL__fopen__ternary_white_list__prepared_query-no_right_verification.php", [] ], [ "./tests/vulntestsuite/CWE_862_SQL__fopen__ternary_white_list__prepared_query-right_verification.php", [] ], [ "./tests/vulntestsuite/CWE_862_SQL__fopen__ternary_white_list__select_from_where-interpretation_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_862_SQL__fopen__whitelist_using_array__non_prepared_query-right_verification.php", [] ], [ "./tests/vulntestsuite/CWE_862_SQL__fopen__whitelist_using_array__prepared_query-no_right_verification.php", [] ], [ "./tests/vulntestsuite/CWE_862_SQL__fopen__whitelist_using_array__prepared_query-right_verification.php", [] ], [ "./tests/vulntestsuite/CWE_862_SQL__fopen__whitelist_using_array__select_from_where-interpretation_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_862_SQL__object-Array__CAST-cast_int__non_prepared_query-right_verification.php", [] ], [ "./tests/vulntestsuite/CWE_862_SQL__object-Array__CAST-cast_int__prepared_query-right_verification.php", [] ], [ "./tests/vulntestsuite/CWE_862_SQL__object-Array__ESAPI__non_prepared_query-right_verification.php", [] ], [ "./tests/vulntestsuite/CWE_862_SQL__object-Array__ESAPI__prepared_query-no_right_verification.php", [] ], [ "./tests/vulntestsuite/CWE_862_SQL__object-Array__ESAPI__prepared_query-right_verification.php", [] ], [ "./tests/vulntestsuite/CWE_862_SQL__object-Array__ESAPI__select_from_where-interpretation_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_862_SQL__object-Array__Indirect_reference__non_prepared_query-right_verification.php", [] ], [ "./tests/vulntestsuite/CWE_862_SQL__object-Array__Indirect_reference__prepared_query-no_right_verification.php", [] ], [ "./tests/vulntestsuite/CWE_862_SQL__object-Array__Indirect_reference__prepared_query-right_verification.php", [] ], [ "./tests/vulntestsuite/CWE_862_SQL__object-Array__Indirect_reference__select_from_where-interpretation_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_862_SQL__object-Array__ternary_white_list__non_prepared_query-right_verification.php", [] ], [ "./tests/vulntestsuite/CWE_862_SQL__object-Array__ternary_white_list__prepared_query-no_right_verification.php", [] ], [ "./tests/vulntestsuite/CWE_862_SQL__object-Array__ternary_white_list__prepared_query-right_verification.php", [] ], [ "./tests/vulntestsuite/CWE_862_SQL__object-Array__ternary_white_list__select_from_where-interpretation_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_862_SQL__object-Array__whitelist_using_array__non_prepared_query-right_verification.php", [] ], [ "./tests/vulntestsuite/CWE_862_SQL__object-Array__whitelist_using_array__prepared_query-no_right_verification.php", [] ], [ "./tests/vulntestsuite/CWE_862_SQL__object-Array__whitelist_using_array__prepared_query-right_verification.php", [] ], [ "./tests/vulntestsuite/CWE_862_SQL__object-Array__whitelist_using_array__select_from_where-interpretation_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_862_SQL__object-classicGet__CAST-cast_int__non_prepared_query-right_verification.php", [] ], [ "./tests/vulntestsuite/CWE_862_SQL__object-classicGet__CAST-cast_int__prepared_query-right_verification.php", [] ], [ "./tests/vulntestsuite/CWE_862_SQL__object-classicGet__ESAPI__non_prepared_query-right_verification.php", [] ], [ "./tests/vulntestsuite/CWE_862_SQL__object-classicGet__ESAPI__prepared_query-no_right_verification.php", [] ], [ "./tests/vulntestsuite/CWE_862_SQL__object-classicGet__ESAPI__prepared_query-right_verification.php", [] ], [ "./tests/vulntestsuite/CWE_862_SQL__object-classicGet__ESAPI__select_from_where-interpretation_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_862_SQL__object-classicGet__Indirect_reference__non_prepared_query-right_verification.php", [] ], [ "./tests/vulntestsuite/CWE_862_SQL__object-classicGet__Indirect_reference__prepared_query-no_right_verification.php", [] ], [ "./tests/vulntestsuite/CWE_862_SQL__object-classicGet__Indirect_reference__prepared_query-right_verification.php", [] ], [ "./tests/vulntestsuite/CWE_862_SQL__object-classicGet__Indirect_reference__select_from_where-interpretation_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_862_SQL__object-classicGet__ternary_white_list__non_prepared_query-right_verification.php", [] ], [ "./tests/vulntestsuite/CWE_862_SQL__object-classicGet__ternary_white_list__prepared_query-no_right_verification.php", [] ], [ "./tests/vulntestsuite/CWE_862_SQL__object-classicGet__ternary_white_list__prepared_query-right_verification.php", [] ], [ "./tests/vulntestsuite/CWE_862_SQL__object-classicGet__ternary_white_list__select_from_where-interpretation_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_862_SQL__object-classicGet__whitelist_using_array__non_prepared_query-right_verification.php", [] ], [ "./tests/vulntestsuite/CWE_862_SQL__object-classicGet__whitelist_using_array__prepared_query-no_right_verification.php", [] ], [ "./tests/vulntestsuite/CWE_862_SQL__object-classicGet__whitelist_using_array__prepared_query-right_verification.php", [] ], [ "./tests/vulntestsuite/CWE_862_SQL__object-classicGet__whitelist_using_array__select_from_where-interpretation_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_862_SQL__object-directGet__CAST-cast_int__non_prepared_query-right_verification.php", [] ], [ "./tests/vulntestsuite/CWE_862_SQL__object-directGet__CAST-cast_int__prepared_query-right_verification.php", [] ], [ "./tests/vulntestsuite/CWE_862_SQL__object-directGet__ESAPI__non_prepared_query-right_verification.php", [] ], [ "./tests/vulntestsuite/CWE_862_SQL__object-directGet__ESAPI__prepared_query-no_right_verification.php", [] ], [ "./tests/vulntestsuite/CWE_862_SQL__object-directGet__ESAPI__prepared_query-right_verification.php", [] ], [ "./tests/vulntestsuite/CWE_862_SQL__object-directGet__ESAPI__select_from_where-interpretation_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_862_SQL__object-directGet__Indirect_reference__non_prepared_query-right_verification.php", [] ], [ "./tests/vulntestsuite/CWE_862_SQL__object-directGet__Indirect_reference__prepared_query-no_right_verification.php", [] ], [ "./tests/vulntestsuite/CWE_862_SQL__object-directGet__Indirect_reference__prepared_query-right_verification.php", [] ], [ "./tests/vulntestsuite/CWE_862_SQL__object-directGet__Indirect_reference__select_from_where-interpretation_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_862_SQL__object-directGet__ternary_white_list__non_prepared_query-right_verification.php", [] ], [ "./tests/vulntestsuite/CWE_862_SQL__object-directGet__ternary_white_list__prepared_query-no_right_verification.php", [] ], [ "./tests/vulntestsuite/CWE_862_SQL__object-directGet__ternary_white_list__prepared_query-right_verification.php", [] ], [ "./tests/vulntestsuite/CWE_862_SQL__object-directGet__ternary_white_list__select_from_where-interpretation_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_862_SQL__object-directGet__whitelist_using_array__non_prepared_query-right_verification.php", [] ], [ "./tests/vulntestsuite/CWE_862_SQL__object-directGet__whitelist_using_array__prepared_query-no_right_verification.php", [] ], [ "./tests/vulntestsuite/CWE_862_SQL__object-directGet__whitelist_using_array__prepared_query-right_verification.php", [] ], [ "./tests/vulntestsuite/CWE_862_SQL__object-directGet__whitelist_using_array__select_from_where-interpretation_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_862_SQL__object-indexArray__CAST-cast_int__non_prepared_query-right_verification.php", [] ], [ "./tests/vulntestsuite/CWE_862_SQL__object-indexArray__CAST-cast_int__prepared_query-right_verification.php", [] ], [ "./tests/vulntestsuite/CWE_862_SQL__object-indexArray__ESAPI__non_prepared_query-right_verification.php", [] ], [ "./tests/vulntestsuite/CWE_862_SQL__object-indexArray__ESAPI__prepared_query-no_right_verification.php", [] ], [ "./tests/vulntestsuite/CWE_862_SQL__object-indexArray__ESAPI__prepared_query-right_verification.php", [] ], [ "./tests/vulntestsuite/CWE_862_SQL__object-indexArray__ESAPI__select_from_where-interpretation_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_862_SQL__object-indexArray__Indirect_reference__non_prepared_query-right_verification.php", [] ], [ "./tests/vulntestsuite/CWE_862_SQL__object-indexArray__Indirect_reference__prepared_query-no_right_verification.php", [] ], [ "./tests/vulntestsuite/CWE_862_SQL__object-indexArray__Indirect_reference__prepared_query-right_verification.php", [] ], [ "./tests/vulntestsuite/CWE_862_SQL__object-indexArray__Indirect_reference__select_from_where-interpretation_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_862_SQL__object-indexArray__ternary_white_list__non_prepared_query-right_verification.php", [] ], [ "./tests/vulntestsuite/CWE_862_SQL__object-indexArray__ternary_white_list__prepared_query-no_right_verification.php", [] ], [ "./tests/vulntestsuite/CWE_862_SQL__object-indexArray__ternary_white_list__prepared_query-right_verification.php", [] ], [ "./tests/vulntestsuite/CWE_862_SQL__object-indexArray__ternary_white_list__select_from_where-interpretation_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_862_SQL__object-indexArray__whitelist_using_array__non_prepared_query-right_verification.php", [] ], [ "./tests/vulntestsuite/CWE_862_SQL__object-indexArray__whitelist_using_array__prepared_query-no_right_verification.php", [] ], [ "./tests/vulntestsuite/CWE_862_SQL__object-indexArray__whitelist_using_array__prepared_query-right_verification.php", [] ], [ "./tests/vulntestsuite/CWE_862_SQL__object-indexArray__whitelist_using_array__select_from_where-interpretation_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_862_SQL__popen__CAST-cast_int__non_prepared_query-right_verification.php", [] ], [ "./tests/vulntestsuite/CWE_862_SQL__popen__CAST-cast_int__prepared_query-right_verification.php", [] ], [ "./tests/vulntestsuite/CWE_862_SQL__popen__ESAPI__non_prepared_query-right_verification.php", [] ], [ "./tests/vulntestsuite/CWE_862_SQL__popen__ESAPI__prepared_query-no_right_verification.php", [] ], [ "./tests/vulntestsuite/CWE_862_SQL__popen__ESAPI__prepared_query-right_verification.php", [] ], [ "./tests/vulntestsuite/CWE_862_SQL__popen__ESAPI__select_from_where-interpretation_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_862_SQL__popen__Indirect_reference__non_prepared_query-right_verification.php", [] ], [ "./tests/vulntestsuite/CWE_862_SQL__popen__Indirect_reference__prepared_query-no_right_verification.php", [] ], [ "./tests/vulntestsuite/CWE_862_SQL__popen__Indirect_reference__prepared_query-right_verification.php", [] ], [ "./tests/vulntestsuite/CWE_862_SQL__popen__Indirect_reference__select_from_where-interpretation_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_862_SQL__popen__ternary_white_list__non_prepared_query-right_verification.php", [] ], [ "./tests/vulntestsuite/CWE_862_SQL__popen__ternary_white_list__prepared_query-no_right_verification.php", [] ], [ "./tests/vulntestsuite/CWE_862_SQL__popen__ternary_white_list__prepared_query-right_verification.php", [] ], [ "./tests/vulntestsuite/CWE_862_SQL__popen__ternary_white_list__select_from_where-interpretation_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_862_SQL__popen__whitelist_using_array__non_prepared_query-right_verification.php", [] ], [ "./tests/vulntestsuite/CWE_862_SQL__popen__whitelist_using_array__prepared_query-no_right_verification.php", [] ], [ "./tests/vulntestsuite/CWE_862_SQL__popen__whitelist_using_array__prepared_query-right_verification.php", [] ], [ "./tests/vulntestsuite/CWE_862_SQL__popen__whitelist_using_array__select_from_where-interpretation_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_862_SQL__proc_open__CAST-cast_int__non_prepared_query-right_verification.php", [] ], [ "./tests/vulntestsuite/CWE_862_SQL__proc_open__CAST-cast_int__prepared_query-right_verification.php", [] ], [ "./tests/vulntestsuite/CWE_862_SQL__proc_open__ESAPI__non_prepared_query-right_verification.php", [] ], [ "./tests/vulntestsuite/CWE_862_SQL__proc_open__ESAPI__prepared_query-no_right_verification.php", [] ], [ "./tests/vulntestsuite/CWE_862_SQL__proc_open__ESAPI__prepared_query-right_verification.php", [] ], [ "./tests/vulntestsuite/CWE_862_SQL__proc_open__ESAPI__select_from_where-interpretation_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_862_SQL__proc_open__Indirect_reference__non_prepared_query-right_verification.php", [] ], [ "./tests/vulntestsuite/CWE_862_SQL__proc_open__Indirect_reference__prepared_query-no_right_verification.php", [] ], [ "./tests/vulntestsuite/CWE_862_SQL__proc_open__Indirect_reference__prepared_query-right_verification.php", [] ], [ "./tests/vulntestsuite/CWE_862_SQL__proc_open__Indirect_reference__select_from_where-interpretation_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_862_SQL__proc_open__ternary_white_list__non_prepared_query-right_verification.php", [] ], [ "./tests/vulntestsuite/CWE_862_SQL__proc_open__ternary_white_list__prepared_query-no_right_verification.php", [] ], [ "./tests/vulntestsuite/CWE_862_SQL__proc_open__ternary_white_list__prepared_query-right_verification.php", [] ], [ "./tests/vulntestsuite/CWE_862_SQL__proc_open__ternary_white_list__select_from_where-interpretation_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_862_SQL__proc_open__whitelist_using_array__non_prepared_query-right_verification.php", [] ], [ "./tests/vulntestsuite/CWE_862_SQL__proc_open__whitelist_using_array__prepared_query-no_right_verification.php", [] ], [ "./tests/vulntestsuite/CWE_862_SQL__proc_open__whitelist_using_array__prepared_query-right_verification.php", [] ], [ "./tests/vulntestsuite/CWE_862_SQL__proc_open__whitelist_using_array__select_from_where-interpretation_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_862_SQL__shell_exec__CAST-cast_int__non_prepared_query-right_verification.php", [] ], [ "./tests/vulntestsuite/CWE_862_SQL__shell_exec__CAST-cast_int__prepared_query-right_verification.php", [] ], [ "./tests/vulntestsuite/CWE_862_SQL__shell_exec__ESAPI__non_prepared_query-right_verification.php", [] ], [ "./tests/vulntestsuite/CWE_862_SQL__shell_exec__ESAPI__prepared_query-no_right_verification.php", [] ], [ "./tests/vulntestsuite/CWE_862_SQL__shell_exec__ESAPI__prepared_query-right_verification.php", [] ], [ "./tests/vulntestsuite/CWE_862_SQL__shell_exec__ESAPI__select_from_where-interpretation_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_862_SQL__shell_exec__Indirect_reference__non_prepared_query-right_verification.php", [] ], [ "./tests/vulntestsuite/CWE_862_SQL__shell_exec__Indirect_reference__prepared_query-no_right_verification.php", [] ], [ "./tests/vulntestsuite/CWE_862_SQL__shell_exec__Indirect_reference__prepared_query-right_verification.php", [] ], [ "./tests/vulntestsuite/CWE_862_SQL__shell_exec__Indirect_reference__select_from_where-interpretation_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_862_SQL__shell_exec__ternary_white_list__non_prepared_query-right_verification.php", [] ], [ "./tests/vulntestsuite/CWE_862_SQL__shell_exec__ternary_white_list__prepared_query-no_right_verification.php", [] ], [ "./tests/vulntestsuite/CWE_862_SQL__shell_exec__ternary_white_list__prepared_query-right_verification.php", [] ], [ "./tests/vulntestsuite/CWE_862_SQL__shell_exec__ternary_white_list__select_from_where-interpretation_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_862_SQL__shell_exec__whitelist_using_array__non_prepared_query-right_verification.php", [] ], [ "./tests/vulntestsuite/CWE_862_SQL__shell_exec__whitelist_using_array__prepared_query-no_right_verification.php", [] ], [ "./tests/vulntestsuite/CWE_862_SQL__shell_exec__whitelist_using_array__prepared_query-right_verification.php", [] ], [ "./tests/vulntestsuite/CWE_862_SQL__shell_exec__whitelist_using_array__select_from_where-interpretation_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_862_SQL__system__CAST-cast_int__non_prepared_query-right_verification.php", [] ], [ "./tests/vulntestsuite/CWE_862_SQL__system__CAST-cast_int__prepared_query-right_verification.php", [] ], [ "./tests/vulntestsuite/CWE_862_SQL__system__ESAPI__non_prepared_query-right_verification.php", [] ], [ "./tests/vulntestsuite/CWE_862_SQL__system__ESAPI__prepared_query-no_right_verification.php", [] ], [ "./tests/vulntestsuite/CWE_862_SQL__system__ESAPI__prepared_query-right_verification.php", [] ], [ "./tests/vulntestsuite/CWE_862_SQL__system__ESAPI__select_from_where-interpretation_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_862_SQL__system__Indirect_reference__non_prepared_query-right_verification.php", [] ], [ "./tests/vulntestsuite/CWE_862_SQL__system__Indirect_reference__prepared_query-no_right_verification.php", [] ], [ "./tests/vulntestsuite/CWE_862_SQL__system__Indirect_reference__prepared_query-right_verification.php", [] ], [ "./tests/vulntestsuite/CWE_862_SQL__system__Indirect_reference__select_from_where-interpretation_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_862_SQL__system__ternary_white_list__non_prepared_query-right_verification.php", [] ], [ "./tests/vulntestsuite/CWE_862_SQL__system__ternary_white_list__prepared_query-no_right_verification.php", [] ], [ "./tests/vulntestsuite/CWE_862_SQL__system__ternary_white_list__prepared_query-right_verification.php", [] ], [ "./tests/vulntestsuite/CWE_862_SQL__system__ternary_white_list__select_from_where-interpretation_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_862_SQL__system__whitelist_using_array__non_prepared_query-right_verification.php", [] ], [ "./tests/vulntestsuite/CWE_862_SQL__system__whitelist_using_array__prepared_query-no_right_verification.php", [] ], [ "./tests/vulntestsuite/CWE_862_SQL__system__whitelist_using_array__prepared_query-right_verification.php", [] ], [ "./tests/vulntestsuite/CWE_862_SQL__system__whitelist_using_array__select_from_where-interpretation_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_862_SQL__unserialize__ESAPI__non_prepared_query-right_verification.php", [["\$string", "46", "code_injection"]] ], [ "./tests/vulntestsuite/CWE_862_SQL__unserialize__ESAPI__prepared_query-no_right_verification.php", [["\$string", "46", "code_injection"]] ], [ "./tests/vulntestsuite/CWE_862_SQL__unserialize__ESAPI__prepared_query-right_verification.php", [["\$string", "46", "code_injection"]] ], [ "./tests/vulntestsuite/CWE_862_SQL__unserialize__ESAPI__select_from_where-interpretation_simple_quote.php", [["\$string", "46", "code_injection"]] ], [ "./tests/vulntestsuite/CWE_862_SQL__unserialize__Indirect_reference__non_prepared_query-right_verification.php", [["\$string", "46", "code_injection"]] ], [ "./tests/vulntestsuite/CWE_862_SQL__unserialize__Indirect_reference__prepared_query-no_right_verification.php", [["\$string", "46", "code_injection"]] ], [ "./tests/vulntestsuite/CWE_862_SQL__unserialize__Indirect_reference__prepared_query-right_verification.php", [["\$string", "46", "code_injection"]] ], [ "./tests/vulntestsuite/CWE_862_SQL__unserialize__Indirect_reference__select_from_where-interpretation_simple_quote.php", [["\$string", "46", "code_injection"]] ], [ "./tests/vulntestsuite/CWE_862_SQL__unserialize__ternary_white_list__non_prepared_query-right_verification.php", [["\$string", "46", "code_injection"]] ], [ "./tests/vulntestsuite/CWE_862_SQL__unserialize__ternary_white_list__prepared_query-no_right_verification.php", [["\$string", "46", "code_injection"]] ], [ "./tests/vulntestsuite/CWE_862_SQL__unserialize__ternary_white_list__prepared_query-right_verification.php", [["\$string", "46", "code_injection"]] ], [ "./tests/vulntestsuite/CWE_862_SQL__unserialize__ternary_white_list__select_from_where-interpretation_simple_quote.php", [["\$string", "46", "code_injection"]] ], [ "./tests/vulntestsuite/CWE_862_SQL__unserialize__whitelist_using_array__non_prepared_query-right_verification.php", [["\$string", "46", "code_injection"]] ], [ "./tests/vulntestsuite/CWE_862_SQL__unserialize__whitelist_using_array__prepared_query-no_right_verification.php", [["\$string", "46", "code_injection"]] ], [ "./tests/vulntestsuite/CWE_862_SQL__unserialize__whitelist_using_array__prepared_query-right_verification.php", [["\$string", "46", "code_injection"]] ], [ "./tests/vulntestsuite/CWE_862_SQL__unserialize__whitelist_using_array__select_from_where-interpretation_simple_quote.php", [["\$string", "46", "code_injection"]] ], [ "./tests/vulntestsuite/CWE_862_SQL__GET__CAST-cast_int__prepared_query-no_right_verification.php", [] ], [ "./tests/vulntestsuite/CWE_862_SQL__GET__CAST-cast_int__select_from_where-interpretation_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_862_SQL__POST__CAST-cast_int__prepared_query-no_right_verification.php", [] ], [ "./tests/vulntestsuite/CWE_862_SQL__POST__CAST-cast_int__select_from_where-interpretation_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_862_SQL__SESSION__CAST-cast_int__prepared_query-no_right_verification.php", [] ], [ "./tests/vulntestsuite/CWE_862_SQL__SESSION__CAST-cast_int__select_from_where-interpretation_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_862_SQL__array-GET__CAST-cast_int__prepared_query-no_right_verification.php", [] ], [ "./tests/vulntestsuite/CWE_862_SQL__array-GET__CAST-cast_int__select_from_where-interpretation_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_862_SQL__backticks__CAST-cast_int__prepared_query-no_right_verification.php", [] ], [ "./tests/vulntestsuite/CWE_862_SQL__backticks__CAST-cast_int__select_from_where-interpretation_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_862_SQL__exec__CAST-cast_int__prepared_query-no_right_verification.php", [] ], [ "./tests/vulntestsuite/CWE_862_SQL__exec__CAST-cast_int__select_from_where-interpretation_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_862_SQL__fopen__CAST-cast_int__prepared_query-no_right_verification.php", [] ], [ "./tests/vulntestsuite/CWE_862_SQL__fopen__CAST-cast_int__select_from_where-interpretation_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_862_SQL__object-Array__CAST-cast_int__prepared_query-no_right_verification.php", [] ], [ "./tests/vulntestsuite/CWE_862_SQL__object-Array__CAST-cast_int__select_from_where-interpretation_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_862_SQL__object-classicGet__CAST-cast_int__prepared_query-no_right_verification.php", [] ], [ "./tests/vulntestsuite/CWE_862_SQL__object-classicGet__CAST-cast_int__select_from_where-interpretation_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_862_SQL__object-directGet__CAST-cast_int__prepared_query-no_right_verification.php", [] ], [ "./tests/vulntestsuite/CWE_862_SQL__object-directGet__CAST-cast_int__select_from_where-interpretation_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_862_SQL__object-indexArray__CAST-cast_int__prepared_query-no_right_verification.php", [] ], [ "./tests/vulntestsuite/CWE_862_SQL__object-indexArray__CAST-cast_int__select_from_where-interpretation_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_862_SQL__popen__CAST-cast_int__prepared_query-no_right_verification.php", [] ], [ "./tests/vulntestsuite/CWE_862_SQL__popen__CAST-cast_int__select_from_where-interpretation_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_862_SQL__proc_open__CAST-cast_int__prepared_query-no_right_verification.php", [] ], [ "./tests/vulntestsuite/CWE_862_SQL__proc_open__CAST-cast_int__select_from_where-interpretation_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_862_SQL__shell_exec__CAST-cast_int__prepared_query-no_right_verification.php", [] ], [ "./tests/vulntestsuite/CWE_862_SQL__shell_exec__CAST-cast_int__select_from_where-interpretation_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_862_SQL__system__CAST-cast_int__prepared_query-no_right_verification.php", [] ], [ "./tests/vulntestsuite/CWE_862_SQL__system__CAST-cast_int__select_from_where-interpretation_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_862_SQL__unserialize__CAST-cast_int__prepared_query-no_right_verification.php", [["\$string", "46", "code_injection"]] ], [ "./tests/vulntestsuite/CWE_862_SQL__unserialize__CAST-cast_int__select_from_where-interpretation_simple_quote.php", [["\$string", "46", "code_injection"]] ], [ "./tests/vulntestsuite/CWE_862_XPath__GET__CAST-cast_int__concatenation-right_verification.php", [] ], [ "./tests/vulntestsuite/CWE_862_XPath__GET__ternary_white_list__concatenation-right_verification.php", [] ], [ "./tests/vulntestsuite/CWE_862_XPath__GET__ternary_white_list__username_at-concatenation_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_862_XPath__GET__whitelist_using_array__concatenation-right_verification.php", [] ], [ "./tests/vulntestsuite/CWE_862_XPath__GET__whitelist_using_array__username_at-concatenation_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_862_XPath__POST__CAST-cast_int__concatenation-right_verification.php", [] ], [ "./tests/vulntestsuite/CWE_862_XPath__POST__ternary_white_list__concatenation-right_verification.php", [] ], [ "./tests/vulntestsuite/CWE_862_XPath__POST__ternary_white_list__username_at-concatenation_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_862_XPath__POST__whitelist_using_array__concatenation-right_verification.php", [] ], [ "./tests/vulntestsuite/CWE_862_XPath__POST__whitelist_using_array__username_at-concatenation_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_862_XPath__SESSION__CAST-cast_int__concatenation-right_verification.php", [] ], [ "./tests/vulntestsuite/CWE_862_XPath__SESSION__ternary_white_list__concatenation-right_verification.php", [] ], [ "./tests/vulntestsuite/CWE_862_XPath__SESSION__ternary_white_list__username_at-concatenation_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_862_XPath__SESSION__whitelist_using_array__concatenation-right_verification.php", [] ], [ "./tests/vulntestsuite/CWE_862_XPath__SESSION__whitelist_using_array__username_at-concatenation_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_862_XPath__array-GET__CAST-cast_int__concatenation-right_verification.php", [] ], [ "./tests/vulntestsuite/CWE_862_XPath__array-GET__ternary_white_list__concatenation-right_verification.php", [] ], [ "./tests/vulntestsuite/CWE_862_XPath__array-GET__ternary_white_list__username_at-concatenation_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_862_XPath__array-GET__whitelist_using_array__concatenation-right_verification.php", [] ], [ "./tests/vulntestsuite/CWE_862_XPath__array-GET__whitelist_using_array__username_at-concatenation_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_862_XPath__backticks__CAST-cast_int__concatenation-right_verification.php", [] ], [ "./tests/vulntestsuite/CWE_862_XPath__backticks__ternary_white_list__concatenation-right_verification.php", [] ], [ "./tests/vulntestsuite/CWE_862_XPath__backticks__ternary_white_list__username_at-concatenation_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_862_XPath__backticks__whitelist_using_array__concatenation-right_verification.php", [] ], [ "./tests/vulntestsuite/CWE_862_XPath__backticks__whitelist_using_array__username_at-concatenation_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_862_XPath__exec__CAST-cast_int__concatenation-right_verification.php", [] ], [ "./tests/vulntestsuite/CWE_862_XPath__exec__ternary_white_list__concatenation-right_verification.php", [] ], [ "./tests/vulntestsuite/CWE_862_XPath__exec__ternary_white_list__username_at-concatenation_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_862_XPath__exec__whitelist_using_array__concatenation-right_verification.php", [] ], [ "./tests/vulntestsuite/CWE_862_XPath__exec__whitelist_using_array__username_at-concatenation_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_862_XPath__fopen__CAST-cast_int__concatenation-right_verification.php", [] ], [ "./tests/vulntestsuite/CWE_862_XPath__fopen__ternary_white_list__concatenation-right_verification.php", [] ], [ "./tests/vulntestsuite/CWE_862_XPath__fopen__ternary_white_list__username_at-concatenation_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_862_XPath__fopen__whitelist_using_array__concatenation-right_verification.php", [] ], [ "./tests/vulntestsuite/CWE_862_XPath__fopen__whitelist_using_array__username_at-concatenation_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_862_XPath__object-Array__CAST-cast_int__concatenation-right_verification.php", [] ], [ "./tests/vulntestsuite/CWE_862_XPath__object-Array__ternary_white_list__concatenation-right_verification.php", [] ], [ "./tests/vulntestsuite/CWE_862_XPath__object-Array__ternary_white_list__username_at-concatenation_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_862_XPath__object-Array__whitelist_using_array__concatenation-right_verification.php", [] ], [ "./tests/vulntestsuite/CWE_862_XPath__object-Array__whitelist_using_array__username_at-concatenation_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_862_XPath__object-classicGet__CAST-cast_int__concatenation-right_verification.php", [] ], [ "./tests/vulntestsuite/CWE_862_XPath__object-classicGet__ternary_white_list__concatenation-right_verification.php", [] ], [ "./tests/vulntestsuite/CWE_862_XPath__object-classicGet__ternary_white_list__username_at-concatenation_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_862_XPath__object-classicGet__whitelist_using_array__concatenation-right_verification.php", [] ], [ "./tests/vulntestsuite/CWE_862_XPath__object-classicGet__whitelist_using_array__username_at-concatenation_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_862_XPath__object-directGet__CAST-cast_int__concatenation-right_verification.php", [] ], [ "./tests/vulntestsuite/CWE_862_XPath__object-directGet__ternary_white_list__concatenation-right_verification.php", [] ], [ "./tests/vulntestsuite/CWE_862_XPath__object-directGet__ternary_white_list__username_at-concatenation_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_862_XPath__object-directGet__whitelist_using_array__concatenation-right_verification.php", [] ], [ "./tests/vulntestsuite/CWE_862_XPath__object-directGet__whitelist_using_array__username_at-concatenation_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_862_XPath__object-indexArray__CAST-cast_int__concatenation-right_verification.php", [] ], [ "./tests/vulntestsuite/CWE_862_XPath__object-indexArray__ternary_white_list__concatenation-right_verification.php", [] ], [ "./tests/vulntestsuite/CWE_862_XPath__object-indexArray__ternary_white_list__username_at-concatenation_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_862_XPath__object-indexArray__whitelist_using_array__concatenation-right_verification.php", [] ], [ "./tests/vulntestsuite/CWE_862_XPath__object-indexArray__whitelist_using_array__username_at-concatenation_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_862_XPath__popen__CAST-cast_int__concatenation-right_verification.php", [] ], [ "./tests/vulntestsuite/CWE_862_XPath__popen__ternary_white_list__concatenation-right_verification.php", [] ], [ "./tests/vulntestsuite/CWE_862_XPath__popen__ternary_white_list__username_at-concatenation_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_862_XPath__popen__whitelist_using_array__concatenation-right_verification.php", [] ], [ "./tests/vulntestsuite/CWE_862_XPath__popen__whitelist_using_array__username_at-concatenation_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_862_XPath__proc_open__CAST-cast_int__concatenation-right_verification.php", [] ], [ "./tests/vulntestsuite/CWE_862_XPath__proc_open__ternary_white_list__concatenation-right_verification.php", [] ], [ "./tests/vulntestsuite/CWE_862_XPath__proc_open__ternary_white_list__username_at-concatenation_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_862_XPath__proc_open__whitelist_using_array__concatenation-right_verification.php", [] ], [ "./tests/vulntestsuite/CWE_862_XPath__proc_open__whitelist_using_array__username_at-concatenation_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_862_XPath__shell_exec__CAST-cast_int__concatenation-right_verification.php", [] ], [ "./tests/vulntestsuite/CWE_862_XPath__shell_exec__ternary_white_list__concatenation-right_verification.php", [] ], [ "./tests/vulntestsuite/CWE_862_XPath__shell_exec__ternary_white_list__username_at-concatenation_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_862_XPath__shell_exec__whitelist_using_array__concatenation-right_verification.php", [] ], [ "./tests/vulntestsuite/CWE_862_XPath__shell_exec__whitelist_using_array__username_at-concatenation_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_862_XPath__system__CAST-cast_int__concatenation-right_verification.php", [] ], [ "./tests/vulntestsuite/CWE_862_XPath__system__ternary_white_list__concatenation-right_verification.php", [] ], [ "./tests/vulntestsuite/CWE_862_XPath__system__ternary_white_list__username_at-concatenation_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_862_XPath__system__whitelist_using_array__concatenation-right_verification.php", [] ], [ "./tests/vulntestsuite/CWE_862_XPath__system__whitelist_using_array__username_at-concatenation_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_862_XPath__unserialize__CAST-cast_int__concatenation-right_verification.php", [["\$string", "46", "code_injection"]] ], [ "./tests/vulntestsuite/CWE_862_XPath__unserialize__ternary_white_list__concatenation-right_verification.php", [["\$string", "46", "code_injection"]] ], [ "./tests/vulntestsuite/CWE_862_XPath__unserialize__ternary_white_list__username_at-concatenation_simple_quote.php", [["\$string", "46", "code_injection"]] ], [ "./tests/vulntestsuite/CWE_862_XPath__unserialize__whitelist_using_array__concatenation-right_verification.php", [["\$string", "46", "code_injection"]] ], [ "./tests/vulntestsuite/CWE_862_XPath__unserialize__whitelist_using_array__username_at-concatenation_simple_quote.php", [["\$string", "46", "code_injection"]] ], [ "./tests/vulntestsuite/CWE_78__GET__CAST-func_settype_int__find_size-concatenation_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_78__GET__CAST-func_settype_int__find_size-interpretation_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_78__GET__func_FILTER-CLEANING-magic_quotes_filter__cat-interpretation_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_78__GET__func_FILTER-VALIDATION-number_float_filter__find_size-concatenation_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_78__GET__ternary_white_list__find_size-interpretation_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_78__POST__CAST-cast_float__find_size-sprintf_%s_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_78__POST__CAST-cast_int__find_size-sprintf_%s_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_78__POST__CAST-cast_int_sort_of2__find_size-concatenation_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_78__POST__CAST-func_settype_float__find_size-concatenation_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_78__POST__func_FILTER-CLEANING-number_int_filter__find_size-sprintf_%s_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_78__POST__func_FILTER-VALIDATION-number_float_filter__find_size-interpretation_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_78__POST__func_FILTER-VALIDATION-number_int_filter__find_size-interpretation_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_78__POST__func_FILTER-VALIDATION-number_int_filter__find_size-sprintf_%s_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_78__POST__func_htmlentities__cat-interpretation_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_78__POST__func_intval__find_size-concatenation_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_78__POST__func_preg_match-letters_numbers__cat-concatenation_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_78__POST__func_preg_match-letters_numbers__cat-interpretation_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_78__POST__func_preg_match-letters_numbers__cat-sprintf_%s_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_78__POST__func_preg_match-letters_numbers__ls-concatenation_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_78__POST__func_preg_match-only_numbers__find_size-interpretation_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_78__POST__func_preg_replace__ls-sprintf_%s_simple_quote.php", [["\$query", "49", "command_injection"]] ], [ "./tests/vulntestsuite/CWE_78__POST__ternary_white_list__find_size-concatenation_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_78__SESSION__func_FILTER-CLEANING-number_float_filter__find_size-concatenation_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_78__SESSION__func_FILTER-CLEANING-number_float_filter__find_size-interpretation_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_78__SESSION__func_FILTER-VALIDATION-number_float_filter__find_size-interpretation_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_78__SESSION__func_addslashes__ls-concatenation_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_78__SESSION__func_floatval__find_size-interpretation_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_78__SESSION__func_htmlspecialchars__cat-sprintf_%s_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_78__SESSION__func_intval__find_size-sprintf_%s_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_78__SESSION__func_preg_match-letters_numbers__ls-interpretation_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_78__SESSION__func_preg_match-letters_numbers__ls-sprintf_%s_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_78__SESSION__func_preg_replace__cat-interpretation_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_78__SESSION__ternary_white_list__cat-interpretation_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_78__SESSION__whitelist_using_array__ls-interpretation_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_78__array-GET__CAST-cast_int_sort_of2__find_size-interpretation_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_78__array-GET__CAST-cast_int_sort_of__find_size-interpretation_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_78__array-GET__CAST-cast_int_sort_of__find_size-sprintf_%s_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_78__array-GET__CAST-func_settype_float__find_size-interpretation_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_78__array-GET__func_FILTER-CLEANING-magic_quotes_filter__cat-sprintf_%s_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_78__array-GET__func_intval__find_size-sprintf_%s_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_78__array-GET__func_mysql_real_escape_string__find_size-concatenation_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_78__array-GET__func_mysql_real_escape_string__find_size-sprintf_%s_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_78__array-GET__func_preg_replace__cat-sprintf_%s_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_78__array-GET__whitelist_using_array__cat-concatenation_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_78__array-GET__whitelist_using_array__find_size-concatenation_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_78__backticks__CAST-func_settype_int__find_size-interpretation_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_78__backticks__func_FILTER-CLEANING-magic_quotes_filter__ls-concatenation_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_78__backticks__func_FILTER-CLEANING-magic_quotes_filter__ls-sprintf_%s_simple_quote.php", [["\$query", "51", "command_injection"]] ], [ "./tests/vulntestsuite/CWE_78__backticks__func_htmlspecialchars__cat-interpretation_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_78__backticks__func_htmlspecialchars__ls-concatenation_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_78__backticks__func_preg_match-only_numbers__find_size-concatenation_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_78__backticks__func_preg_replace2__ls-concatenation_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_78__backticks__func_preg_replace__cat-concatenation_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_78__backticks__ternary_white_list__ls-concatenation_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_78__backticks__ternary_white_list__ls-sprintf_%s_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_78__backticks__whitelist_using_array__ls-sprintf_%s_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_78__exec__CAST-cast_int__find_size-interpretation_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_78__exec__func_FILTER-VALIDATION-number_float_filter__find_size-concatenation_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_78__exec__func_addslashes__ls-concatenation_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_78__exec__func_htmlspecialchars__cat-interpretation_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_78__exec__whitelist_using_array__cat-interpretation_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_78__exec__whitelist_using_array__ls-sprintf_%s_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_78__fopen__CAST-cast_int__find_size-concatenation_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_78__fopen__CAST-cast_int_sort_of2__find_size-concatenation_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_78__fopen__CAST-cast_int_sort_of__find_size-sprintf_%s_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_78__fopen__func_FILTER-CLEANING-magic_quotes_filter__ls-interpretation_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_78__fopen__func_addslashes__cat-concatenation_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_78__fopen__func_floatval__find_size-concatenation_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_78__fopen__func_htmlentities__cat-concatenation_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_78__fopen__func_preg_match-letters_numbers__cat-interpretation_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_78__fopen__func_preg_replace2__cat-interpretation_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_78__fopen__ternary_white_list__find_size-concatenation_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_78__fopen__whitelist_using_array__find_size-sprintf_%s_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_78__object-Array__CAST-func_settype_float__find_size-concatenation_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_78__object-Array__func_FILTER-CLEANING-number_int_filter__find_size-interpretation_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_78__object-Array__func_escapeshellarg__cat-interpretation_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_78__object-Array__func_htmlentities__ls-concatenation_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_78__object-Array__func_preg_match-only_letters__cat-sprintf_%s_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_78__object-Array__func_preg_match-only_letters__ls-concatenation_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_78__object-Array__func_preg_match-only_numbers__find_size-concatenation_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_78__object-Array__func_preg_match-only_numbers__find_size-interpretation_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_78__object-Array__func_preg_replace__cat-sprintf_%s_simple_quote.php", [["\$query", "67", "command_injection"]] ], [ "./tests/vulntestsuite/CWE_78__object-Array__ternary_white_list__cat-sprintf_%s_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_78__object-Array__whitelist_using_array__cat-sprintf_%s_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_78__object-Array__whitelist_using_array__find_size-sprintf_%s_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_78__object-classicGet__func_FILTER-VALIDATION-number_int_filter__find_size-sprintf_%s_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_78__object-classicGet__func_htmlentities__cat-concatenation_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_78__object-classicGet__func_htmlentities__ls-sprintf_%s_simple_quote.php", [["\$query", "64", "command_injection"]] ], [ "./tests/vulntestsuite/CWE_78__object-classicGet__func_htmlspecialchars__cat-concatenation_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_78__object-classicGet__func_htmlspecialchars__cat-interpretation_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_78__object-classicGet__func_htmlspecialchars__cat-sprintf_%s_simple_quote.php", [["\$query", "64", "command_injection"]] ], [ "./tests/vulntestsuite/CWE_78__object-classicGet__func_preg_match-only_letters__ls-concatenation_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_78__object-classicGet__func_preg_match-only_numbers__find_size-interpretation_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_78__object-classicGet__func_preg_replace__ls-sprintf_%s_simple_quote.php", [["\$query", "64", "command_injection"]] ], [ "./tests/vulntestsuite/CWE_78__object-classicGet__ternary_white_list__cat-concatenation_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_78__object-classicGet__ternary_white_list__cat-interpretation_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_78__object-classicGet__whitelist_using_array__find_size-interpretation_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_78__object-directGet__CAST-cast_int__find_size-concatenation_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_78__object-directGet__func_FILTER-CLEANING-number_int_filter__find_size-interpretation_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_78__object-directGet__func_addslashes__ls-concatenation_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_78__object-directGet__func_addslashes__ls-sprintf_%s_simple_quote.php", [["\$query", "58", "command_injection"]] ], [ "./tests/vulntestsuite/CWE_78__object-directGet__func_escapeshellarg__cat-sprintf_%s_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_78__object-directGet__func_intval__find_size-interpretation_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_78__object-directGet__func_mysql_real_escape_string__find_size-sprintf_%s_simple_quote.php", [["\$query", "58", "command_injection"]] ], [ "./tests/vulntestsuite/CWE_78__object-directGet__func_preg_match-letters_numbers__cat-concatenation_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_78__object-directGet__func_preg_match-only_letters__ls-sprintf_%s_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_78__object-directGet__func_preg_replace__ls-concatenation_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_78__object-directGet__ternary_white_list__cat-interpretation_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_78__object-directGet__ternary_white_list__ls-sprintf_%s_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_78__object-directGet__whitelist_using_array__cat-concatenation_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_78__object-directGet__whitelist_using_array__cat-sprintf_%s_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_78__object-directGet__whitelist_using_array__ls-concatenation_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_78__object-indexArray__CAST-cast_int__find_size-interpretation_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_78__object-indexArray__CAST-cast_int_sort_of__find_size-sprintf_%s_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_78__object-indexArray__CAST-func_settype_int__find_size-concatenation_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_78__object-indexArray__func_FILTER-CLEANING-magic_quotes_filter__cat-sprintf_%s_simple_quote.php", [["\$query", "69", "command_injection"]] ], [ "./tests/vulntestsuite/CWE_78__object-indexArray__func_FILTER-VALIDATION-number_float_filter__find_size-sprintf_%s_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_78__object-indexArray__func_addslashes__ls-interpretation_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_78__object-indexArray__func_escapeshellarg__cat-sprintf_%s_simple_quote.php", [["\$query", "69", "command_injection"]] ], [ "./tests/vulntestsuite/CWE_78__object-indexArray__func_floatval__find_size-interpretation_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_78__object-indexArray__func_htmlspecialchars__cat-concatenation_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_78__object-indexArray__func_htmlspecialchars__ls-interpretation_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_78__object-indexArray__func_htmlspecialchars__ls-sprintf_%s_simple_quote.php", [["\$query", "67", "command_injection"]] ], [ "./tests/vulntestsuite/CWE_78__object-indexArray__func_intval__find_size-interpretation_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_78__object-indexArray__func_preg_replace2__ls-sprintf_%s_simple_quote.php", [["\$query", "67", "command_injection"]] ], [ "./tests/vulntestsuite/CWE_78__object-indexArray__ternary_white_list__cat-sprintf_%s_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_78__object-indexArray__ternary_white_list__ls-concatenation_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_78__object-indexArray__whitelist_using_array__cat-concatenation_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_78__object-indexArray__whitelist_using_array__find_size-sprintf_%s_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_78__object-indexArray__whitelist_using_array__ls-interpretation_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_78__popen__CAST-cast_int_sort_of__find_size-concatenation_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_78__popen__CAST-cast_int_sort_of__find_size-interpretation_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_78__popen__func_FILTER-CLEANING-magic_quotes_filter__ls-concatenation_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_78__popen__func_FILTER-CLEANING-number_float_filter__find_size-interpretation_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_78__popen__func_FILTER-CLEANING-number_float_filter__find_size-sprintf_%s_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_78__popen__func_FILTER-VALIDATION-number_float_filter__find_size-interpretation_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_78__popen__func_escapeshellarg__cat-interpretation_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_78__popen__func_floatval__find_size-concatenation_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_78__popen__func_intval__find_size-concatenation_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_78__popen__func_intval__find_size-sprintf_%s_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_78__popen__func_preg_match-only_letters__ls-concatenation_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_78__popen__func_preg_replace2__cat-sprintf_%s_simple_quote.php", [["\$query", "51", "command_injection"]] ], [ "./tests/vulntestsuite/CWE_78__popen__ternary_white_list__find_size-sprintf_%s_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_78__popen__whitelist_using_array__ls-interpretation_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_78__proc_open__CAST-cast_int__find_size-concatenation_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_78__proc_open__CAST-func_settype_float__find_size-concatenation_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_78__proc_open__func_FILTER-CLEANING-number_float_filter__find_size-sprintf_%s_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_78__proc_open__func_FILTER-CLEANING-number_int_filter__find_size-sprintf_%s_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_78__proc_open__func_FILTER-VALIDATION-number_int_filter__find_size-concatenation_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_78__proc_open__func_escapeshellarg__cat-sprintf_%s_simple_quote.php", [["\$query", "63", "command_injection"]] ], [ "./tests/vulntestsuite/CWE_78__proc_open__func_escapeshellarg__ls-sprintf_%s_simple_quote.php", [["\$query", "63", "command_injection"]] ], [ "./tests/vulntestsuite/CWE_78__proc_open__func_mysql_real_escape_string__find_size-concatenation_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_78__proc_open__func_preg_match-letters_numbers__ls-sprintf_%s_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_78__proc_open__func_preg_replace__ls-interpretation_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_78__proc_open__func_preg_replace__ls-sprintf_%s_simple_quote.php", [["\$query", "61", "command_injection"]] ], [ "./tests/vulntestsuite/CWE_78__proc_open__whitelist_using_array__ls-sprintf_%s_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_78__shell_exec__CAST-cast_int_sort_of__find_size-interpretation_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_78__shell_exec__func_FILTER-VALIDATION-number_float_filter__find_size-concatenation_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_78__shell_exec__func_FILTER-VALIDATION-number_int_filter__find_size-concatenation_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_78__shell_exec__func_FILTER-VALIDATION-number_int_filter__find_size-interpretation_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_78__shell_exec__func_escapeshellarg__ls-sprintf_%s_simple_quote.php", [["\$query", "51", "command_injection"]] ], [ "./tests/vulntestsuite/CWE_78__shell_exec__func_htmlentities__cat-concatenation_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_78__shell_exec__func_htmlentities__ls-interpretation_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_78__shell_exec__func_htmlspecialchars__cat-sprintf_%s_simple_quote.php", [["\$query", "49", "command_injection"]] ], [ "./tests/vulntestsuite/CWE_78__shell_exec__func_preg_match-only_letters__ls-sprintf_%s_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_78__shell_exec__func_preg_replace2__ls-sprintf_%s_simple_quote.php", [["\$query", "49", "command_injection"]] ], [ "./tests/vulntestsuite/CWE_78__shell_exec__ternary_white_list__cat-sprintf_%s_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_78__shell_exec__ternary_white_list__ls-sprintf_%s_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_78__shell_exec__whitelist_using_array__find_size-concatenation_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_78__shell_exec__whitelist_using_array__find_size-sprintf_%s_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_78__shell_exec__whitelist_using_array__ls-interpretation_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_78__system__CAST-func_settype_float__find_size-concatenation_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_78__system__CAST-func_settype_int__find_size-sprintf_%s_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_78__system__func_FILTER-CLEANING-magic_quotes_filter__ls-sprintf_%s_simple_quote.php", [["\$query", "51", "command_injection"]] ], [ "./tests/vulntestsuite/CWE_78__system__func_addslashes__cat-interpretation_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_78__system__func_escapeshellarg__cat-interpretation_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_78__system__func_htmlentities__cat-concatenation_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_78__system__func_mysql_real_escape_string__find_size-sprintf_%s_simple_quote.php", [["\$query", "49", "command_injection"]] ], [ "./tests/vulntestsuite/CWE_78__system__func_preg_match-only_letters__cat-interpretation_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_78__system__func_preg_match-only_letters__cat-sprintf_%s_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_78__system__func_preg_match-only_letters__ls-concatenation_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_78__system__func_preg_match-only_letters__ls-sprintf_%s_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_78__system__func_preg_replace2__cat-interpretation_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_78__system__func_preg_replace2__ls-sprintf_%s_simple_quote.php", [["\$query", "49", "command_injection"]] ], [ "./tests/vulntestsuite/CWE_78__system__func_preg_replace__cat-concatenation_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_78__system__func_preg_replace__ls-concatenation_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_78__system__whitelist_using_array__cat-concatenation_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_78__GET__no_sanitizing__ls-sprintf_%s_simple_quote.php", [["\$query", "49", "command_injection"]] ], [ "./tests/vulntestsuite/CWE_78__POST__func_preg_match-no_filtering__ls-sprintf_%s_simple_quote.php", [["\$query", "54", "command_injection"]] ], [ "./tests/vulntestsuite/CWE_78__backticks__func_FILTER-CLEANING-email_filter__ls-concatenation_simple_quote.php", [["\$query", "54", "command_injection"]] ], [ "./tests/vulntestsuite/CWE_78__backticks__no_sanitizing__find_size-concatenation_simple_quote.php", [["\$query", "49", "command_injection"]] ], [ "./tests/vulntestsuite/CWE_78__exec__func_FILTER-CLEANING-email_filter__cat-interpretation_simple_quote.php", [["\$query", "57", "command_injection"]] ], [ "./tests/vulntestsuite/CWE_78__fopen__func_FILTER-CLEANING-email_filter__ls-sprintf_%s_simple_quote.php", [["\$query", "63", "command_injection"]] ], [ "./tests/vulntestsuite/CWE_78__fopen__func_preg_match-no_filtering__cat-interpretation_simple_quote.php", [["\$query", "63", "command_injection"]] ], [ "./tests/vulntestsuite/CWE_78__fopen__func_preg_match-no_filtering__ls-interpretation_simple_quote.php", [["\$query", "63", "command_injection"]] ], [ "./tests/vulntestsuite/CWE_78__fopen__func_preg_match-no_filtering__ls-sprintf_%s_simple_quote.php", [["\$query", "63", "command_injection"]] ], [ "./tests/vulntestsuite/CWE_78__fopen__no_sanitizing__find_size-concatenation_simple_quote.php", [["\$query", "58", "command_injection"]] ], [ "./tests/vulntestsuite/CWE_78__object-classicGet__func_FILTER-CLEANING-email_filter__cat-sprintf_%s_simple_quote.php", [["\$query", "69", "command_injection"]] ], [ "./tests/vulntestsuite/CWE_78__object-directGet__func_preg_match-no_filtering__cat-concatenation_simple_quote.php", [["\$query", "63", "command_injection"]] ], [ "./tests/vulntestsuite/CWE_78__object-indexArray__func_FILTER-CLEANING-email_filter__cat-sprintf_%s_simple_quote.php", [["\$query", "72", "command_injection"]] ], [ "./tests/vulntestsuite/CWE_78__object-indexArray__func_preg_match-no_filtering__ls-sprintf_%s_simple_quote.php", [["\$query", "72", "command_injection"]] ], [ "./tests/vulntestsuite/CWE_78__popen__func_FILTER-CLEANING-email_filter__cat-interpretation_simple_quote.php", [["\$query", "56", "command_injection"]] ], [ "./tests/vulntestsuite/CWE_78__popen__func_FILTER-CLEANING-email_filter__ls-sprintf_%s_simple_quote.php", [["\$query", "56", "command_injection"]] ], [ "./tests/vulntestsuite/CWE_78__popen__func_preg_match-no_filtering__ls-interpretation_simple_quote.php", [["\$query", "56", "command_injection"]] ], [ "./tests/vulntestsuite/CWE_78__popen__func_preg_match-no_filtering__ls-sprintf_%s_simple_quote.php", [["\$query", "56", "command_injection"]] ], [ "./tests/vulntestsuite/CWE_78__popen__no_sanitizing__cat-interpretation_simple_quote.php", [["\$query", "51", "command_injection"]] ], [ "./tests/vulntestsuite/CWE_78__proc_open__func_FILTER-CLEANING-email_filter__ls-interpretation_simple_quote.php", [["\$query", "66", "command_injection"]] ], [ "./tests/vulntestsuite/CWE_78__proc_open__func_preg_match-no_filtering__cat-concatenation_simple_quote.php", [["\$query", "66", "command_injection"]] ], [ "./tests/vulntestsuite/CWE_78__proc_open__func_preg_match-no_filtering__ls-concatenation_simple_quote.php", [["\$query", "66", "command_injection"]] ], [ "./tests/vulntestsuite/CWE_78__proc_open__func_preg_match-no_filtering__ls-sprintf_%s_simple_quote.php", [["\$query", "66", "command_injection"]] ], [ "./tests/vulntestsuite/CWE_78__proc_open__no_sanitizing__ls-concatenation_simple_quote.php", [["\$query", "61", "command_injection"]] ], [ "./tests/vulntestsuite/CWE_78__shell_exec__func_FILTER-CLEANING-email_filter__ls-sprintf_%s_simple_quote.php", [["\$query", "54", "command_injection"]] ], [ "./tests/vulntestsuite/CWE_78__shell_exec__func_preg_match-no_filtering__ls-sprintf_%s_simple_quote.php", [["\$query", "54", "command_injection"]] ], [ "./tests/vulntestsuite/CWE_78__system__func_FILTER-CLEANING-email_filter__cat-sprintf_%s_simple_quote.php", [["\$query", "54", "command_injection"]] ], [ "./tests/vulntestsuite/CWE_78__unserialize__func_FILTER-CLEANING-full_special_chars_filter__cat-sprintf_%s_simple_quote.php", [["\$string", "45", "code_injection"], ["\$query", "53", "command_injection"]] ], [ "./tests/vulntestsuite/CWE_78__unserialize__func_FILTER-CLEANING-special_chars_filter__cat-interpretation_simple_quote.php", [["\$string", "45", "code_injection"]] ], [ "./tests/vulntestsuite/CWE_78__unserialize__func_FILTER-VALIDATION-email_filter__cat-concatenation_simple_quote.php", [["\$string", "45", "code_injection"], ["\$query", "55", "command_injection"]] ], [ "./tests/vulntestsuite/CWE_78__unserialize__no_sanitizing__cat-sprintf_%s_simple_quote.php", [["\$string", "45", "code_injection"], ["\$query", "51", "command_injection"]] ], [ "./tests/vulntestsuite/CWE_78__unserialize__no_sanitizing__find_size-concatenation_simple_quote.php", [["\$string", "45", "code_injection"], ["\$query", "51", "command_injection"]] ], [ "./tests/vulntestsuite/CWE_78__unserialize__no_sanitizing__find_size-sprintf_%s_simple_quote.php", [["\$string", "45", "code_injection"], ["\$query", "51", "command_injection"]] ], [ "./tests/vulntestsuite/CWE_89__GET__CAST-cast_float_sort_of__multiple_select-sprintf_%u_simple_quote.php", [["\$data", "57", "xss"]] ], [ "./tests/vulntestsuite/CWE_89__GET__CAST-cast_int__multiple_AS-sprintf_%u_simple_quote.php", [["\$data", "57", "xss"]] ], [ "./tests/vulntestsuite/CWE_89__GET__CAST-cast_int__multiple_select-sprintf_%u_simple_quote.php", [["\$data", "57", "xss"]] ], [ "./tests/vulntestsuite/CWE_89__GET__CAST-cast_int_sort_of2__multiple_select-interpretation_simple_quote.php", [["\$data", "57", "xss"]] ], [ "./tests/vulntestsuite/CWE_89__GET__CAST-func_settype_float__multiple_select-sprintf_%d.php", [["\$data", "60", "xss"]] ], [ "./tests/vulntestsuite/CWE_89__GET__CAST-func_settype_float__select_from_where-sprintf_%s_simple_quote.php", [["\$data", "61", "xss"]] ], [ "./tests/vulntestsuite/CWE_89__GET__func_FILTER-CLEANING-number_int_filter__select_from_where-sprintf_%u.php", [["\$data", "62", "xss"]] ], [ "./tests/vulntestsuite/CWE_89__GET__func_FILTER-VALIDATION-number_int_filter__multiple_AS-sprintf_%u.php", [["\$data", "61", "xss"]] ], [ "./tests/vulntestsuite/CWE_89__GET__func_intval__multiple_AS-sprintf_%d_simple_quote.php", [["\$data", "57", "xss"]] ], [ "./tests/vulntestsuite/CWE_89__GET__func_intval__select_from_where-sprintf_%d.php", [["\$data", "57", "xss"]] ], [ "./tests/vulntestsuite/CWE_89__GET__ternary_white_list__select_from_where-sprintf_%u.php", [["\$data", "57", "xss"]] ], [ "./tests/vulntestsuite/CWE_89__POST__CAST-cast_float_sort_of__multiple_select-interpretation_simple_quote.php", [["\$data", "57", "xss"]] ], [ "./tests/vulntestsuite/CWE_89__POST__CAST-cast_int__multiple_AS-concatenation.php", [["\$data", "57", "xss"]] ], [ "./tests/vulntestsuite/CWE_89__POST__CAST-cast_int__multiple_AS-sprintf_%d.php", [["\$data", "57", "xss"]] ], [ "./tests/vulntestsuite/CWE_89__POST__CAST-cast_int__multiple_select-concatenation.php", [["\$data", "57", "xss"]] ], [ "./tests/vulntestsuite/CWE_89__POST__CAST-cast_int_sort_of__multiple_select-interpretation.php", [["\$data", "57", "xss"]] ], [ "./tests/vulntestsuite/CWE_89__POST__CAST-func_settype_float__select_from_where-sprintf_%s_simple_quote.php", [["\$data", "61", "xss"]] ], [ "./tests/vulntestsuite/CWE_89__POST__func_FILTER-CLEANING-number_int_filter__select_from_where-sprintf_%d.php", [["\$data", "62", "xss"]] ], [ "./tests/vulntestsuite/CWE_89__POST__func_FILTER-VALIDATION-number_int_filter__select_from_where-sprintf_%s_simple_quote.php", [["\$data", "61", "xss"]] ], [ "./tests/vulntestsuite/CWE_89__POST__func_floatval__select_from_where-sprintf_%s_simple_quote.php", [["\$data", "57", "xss"]] ], [ "./tests/vulntestsuite/CWE_89__POST__func_preg_match-only_numbers__select_from_where-concatenation.php", [["\$data", "62", "xss"]] ], [ "./tests/vulntestsuite/CWE_89__SESSION__CAST-cast_int_sort_of2__multiple_select-sprintf_%u_simple_quote.php", [["\$data", "57", "xss"]] ], [ "./tests/vulntestsuite/CWE_89__SESSION__CAST-cast_int_sort_of__multiple_AS-concatenation_simple_quote.php", [["\$data", "57", "xss"]] ], [ "./tests/vulntestsuite/CWE_89__SESSION__CAST-cast_int_sort_of__select_from_where-sprintf_%u.php", [["\$data", "57", "xss"]] ], [ "./tests/vulntestsuite/CWE_89__SESSION__func_FILTER-CLEANING-number_int_filter__multiple_AS-sprintf_%d.php", [["\$data", "62", "xss"]] ], [ "./tests/vulntestsuite/CWE_89__SESSION__func_FILTER-CLEANING-number_int_filter__multiple_AS-sprintf_%s_simple_quote.php", [["\$data", "62", "xss"]] ], [ "./tests/vulntestsuite/CWE_89__SESSION__func_FILTER-CLEANING-number_int_filter__multiple_select-sprintf_%d.php", [["\$data", "62", "xss"]] ], [ "./tests/vulntestsuite/CWE_89__SESSION__func_FILTER-VALIDATION-number_float_filter__multiple_AS-sprintf_%s_simple_quote.php", [["\$data", "61", "xss"]] ], [ "./tests/vulntestsuite/CWE_89__SESSION__func_FILTER-VALIDATION-number_int_filter__select_from_where-concatenation.php", [["\$data", "61", "xss"]] ], [ "./tests/vulntestsuite/CWE_89__SESSION__func_floatval__multiple_select-concatenation_simple_quote.php", [["\$data", "57", "xss"]] ], [ "./tests/vulntestsuite/CWE_89__SESSION__func_floatval__select_from_where-sprintf_%d.php", [["\$data", "57", "xss"]] ], [ "./tests/vulntestsuite/CWE_89__SESSION__ternary_white_list__multiple_select-concatenation.php", [["\$data", "57", "xss"]] ], [ "./tests/vulntestsuite/CWE_89__SESSION__whitelist_using_array_from__select_from-sprintf_%s_simple_quote.php", [["\$data", "62", "xss"]] ], [ "./tests/vulntestsuite/CWE_89__array-GET__CAST-cast_float_sort_of__multiple_select-interpretation.php", [["\$data", "61", "xss"]] ], [ "./tests/vulntestsuite/CWE_89__array-GET__CAST-cast_float_sort_of__select_from_where-concatenation_simple_quote.php", [["\$data", "61", "xss"]] ], [ "./tests/vulntestsuite/CWE_89__array-GET__CAST-cast_int__multiple_AS-concatenation.php", [["\$data", "61", "xss"]] ], [ "./tests/vulntestsuite/CWE_89__array-GET__CAST-cast_int_sort_of2__multiple_AS-sprintf_%u_simple_quote.php", [["\$data", "61", "xss"]] ], [ "./tests/vulntestsuite/CWE_89__array-GET__CAST-cast_int_sort_of__multiple_AS-sprintf_%u_simple_quote.php", [["\$data", "61", "xss"]] ], [ "./tests/vulntestsuite/CWE_89__array-GET__CAST-func_settype_float__multiple_AS-sprintf_%s_simple_quote.php", [["\$data", "65", "xss"]] ], [ "./tests/vulntestsuite/CWE_89__array-GET__func_FILTER-VALIDATION-number_int_filter__select_from_where-sprintf_%s_simple_quote.php", [["\$data", "65", "xss"]] ], [ "./tests/vulntestsuite/CWE_89__array-GET__func_floatval__multiple_select-interpretation_simple_quote.php", [["\$data", "61", "xss"]] ], [ "./tests/vulntestsuite/CWE_89__array-GET__func_htmlentities__join-concatenation_simple_quote.php", [["\$data", "61", "xss"]] ], [ "./tests/vulntestsuite/CWE_89__array-GET__func_intval__multiple_select-sprintf_%u.php", [["\$data", "61", "xss"]] ], [ "./tests/vulntestsuite/CWE_89__array-GET__func_intval__select_from_where-concatenation.php", [["\$data", "61", "xss"]] ], [ "./tests/vulntestsuite/CWE_89__backticks__CAST-cast_int_sort_of__multiple_AS-concatenation.php", [["\$data", "57", "xss"]] ], [ "./tests/vulntestsuite/CWE_89__backticks__func_FILTER-CLEANING-number_float_filter__multiple_select-concatenation_simple_quote.php", [["\$data", "62", "xss"]] ], [ "./tests/vulntestsuite/CWE_89__backticks__func_FILTER-CLEANING-number_int_filter__select_from_where-sprintf_%d.php", [["\$data", "62", "xss"]] ], [ "./tests/vulntestsuite/CWE_89__backticks__func_FILTER-VALIDATION-number_int_filter__multiple_AS-concatenation.php", [["\$data", "61", "xss"]] ], [ "./tests/vulntestsuite/CWE_89__backticks__func_floatval__multiple_select-sprintf_%u_simple_quote.php", [["\$data", "57", "xss"]] ], [ "./tests/vulntestsuite/CWE_89__backticks__func_htmlspecialchars__join-concatenation_simple_quote.php", [["\$data", "57", "xss"]] ], [ "./tests/vulntestsuite/CWE_89__backticks__func_mysql_real_escape_string__multiple_AS-sprintf_%s_simple_quote.php", [["\$query", "49", "sql_injection"], ["\$data", "57", "xss"]] ], [ "./tests/vulntestsuite/CWE_89__backticks__func_preg_match-only_numbers__select_from_where-sprintf_%u_simple_quote.php", [["\$data", "62", "xss"]] ], [ "./tests/vulntestsuite/CWE_89__backticks__whitelist_using_array__join-interpretation_simple_quote.php", [["\$data", "62", "xss"]] ], [ "./tests/vulntestsuite/CWE_89__exec__CAST-cast_int__multiple_AS-sprintf_%u.php", [["\$data", "60", "xss"]] ], [ "./tests/vulntestsuite/CWE_89__exec__CAST-func_settype_int__multiple_select-sprintf_%u_simple_quote.php", [["\$data", "64", "xss"]] ], [ "./tests/vulntestsuite/CWE_89__exec__func_FILTER-CLEANING-number_int_filter__select_from_where-sprintf_%u_simple_quote.php", [["\$data", "65", "xss"]] ], [ "./tests/vulntestsuite/CWE_89__exec__func_floatval__multiple_select-sprintf_%u.php", [["\$data", "60", "xss"]] ], [ "./tests/vulntestsuite/CWE_89__exec__func_intval__select_from_where-concatenation.php", [["\$data", "60", "xss"]] ], [ "./tests/vulntestsuite/CWE_89__exec__func_mysql_real_escape_string__multiple_select-sprintf_%d.php", [["\$query", "52", "sql_injection"], ["\$data", "60", "xss"]] ], [ "./tests/vulntestsuite/CWE_89__exec__whitelist_using_array__multiple_AS-sprintf_%u_simple_quote.php", [["\$data", "65", "xss"]] ], [ "./tests/vulntestsuite/CWE_89__fopen__CAST-cast_float__multiple_select-concatenation.php", [["\$data", "66", "xss"]] ], [ "./tests/vulntestsuite/CWE_89__fopen__CAST-cast_int_sort_of2__select_from_where-sprintf_%u_simple_quote.php", [["\$data", "66", "xss"]] ], [ "./tests/vulntestsuite/CWE_89__fopen__func_FILTER-VALIDATION-number_float_filter__multiple_AS-concatenation.php", [["\$data", "70", "xss"]] ], [ "./tests/vulntestsuite/CWE_89__fopen__func_FILTER-VALIDATION-number_float_filter__multiple_select-sprintf_%s_simple_quote.php", [["\$data", "70", "xss"]] ], [ "./tests/vulntestsuite/CWE_89__fopen__func_preg_replace__select_from-sprintf_%s_simple_quote.php", [["\$query", "58", "sql_injection"], ["\$data", "66", "xss"]] ], [ "./tests/vulntestsuite/CWE_89__fopen__ternary_white_list__multiple_AS-sprintf_%u.php", [["\$data", "66", "xss"]] ], [ "./tests/vulntestsuite/CWE_89__fopen__ternary_white_list__select_from_where-concatenation.php", [["\$data", "66", "xss"]] ], [ "./tests/vulntestsuite/CWE_89__fopen__whitelist_using_array__multiple_select-sprintf_%u_simple_quote.php", [["\$data", "71", "xss"]] ], [ "./tests/vulntestsuite/CWE_89__object-Array__CAST-cast_int__multiple_select-concatenation_simple_quote.php", [["\$data", "75", "xss"]] ], [ "./tests/vulntestsuite/CWE_89__object-Array__CAST-cast_int__multiple_select-sprintf_%d.php", [["\$data", "75", "xss"]] ], [ "./tests/vulntestsuite/CWE_89__object-Array__CAST-cast_int_sort_of__multiple_AS-sprintf_%d.php", [["\$data", "75", "xss"]] ], [ "./tests/vulntestsuite/CWE_89__object-Array__CAST-cast_int_sort_of__select_from_where-sprintf_%s_simple_quote.php", [["\$data", "75", "xss"]] ], [ "./tests/vulntestsuite/CWE_89__object-Array__CAST-func_settype_float__multiple_AS-sprintf_%u.php", [["\$data", "79", "xss"]] ], [ "./tests/vulntestsuite/CWE_89__object-Array__CAST-func_settype_float__select_from_where-sprintf_%u_simple_quote.php", [["\$data", "79", "xss"]] ], [ "./tests/vulntestsuite/CWE_89__object-Array__func_FILTER-CLEANING-magic_quotes_filter__join-sprintf_%s_simple_quote.php", [["\$query", "69", "sql_injection"], ["\$data", "77", "xss"]] ], [ "./tests/vulntestsuite/CWE_89__object-Array__func_FILTER-CLEANING-number_float_filter__multiple_AS-sprintf_%u.php", [["\$data", "80", "xss"]] ], [ "./tests/vulntestsuite/CWE_89__object-Array__func_floatval__multiple_AS-sprintf_%d_simple_quote.php", [["\$data", "75", "xss"]] ], [ "./tests/vulntestsuite/CWE_89__object-Array__func_floatval__multiple_select-concatenation_simple_quote.php", [["\$data", "75", "xss"]] ], [ "./tests/vulntestsuite/CWE_89__object-Array__func_floatval__multiple_select-sprintf_%d.php", [["\$data", "75", "xss"]] ], [ "./tests/vulntestsuite/CWE_89__object-Array__func_floatval__select_from_where-interpretation.php", [["\$data", "75", "xss"]] ], [ "./tests/vulntestsuite/CWE_89__object-Array__func_intval__multiple_AS-sprintf_%u_simple_quote.php", [["\$data", "75", "xss"]] ], [ "./tests/vulntestsuite/CWE_89__object-classicGet__CAST-cast_float__multiple_AS-interpretation.php", [["\$data", "72", "xss"]] ], [ "./tests/vulntestsuite/CWE_89__object-classicGet__CAST-cast_int__select_from_where-sprintf_%u.php", [["\$data", "72", "xss"]] ], [ "./tests/vulntestsuite/CWE_89__object-classicGet__CAST-func_settype_float__multiple_AS-interpretation.php", [["\$data", "76", "xss"]] ], [ "./tests/vulntestsuite/CWE_89__object-classicGet__CAST-func_settype_int__multiple_AS-sprintf_%u_simple_quote.php", [["\$data", "76", "xss"]] ], [ "./tests/vulntestsuite/CWE_89__object-classicGet__CAST-func_settype_int__multiple_select-concatenation.php", [["\$data", "76", "xss"]] ], [ "./tests/vulntestsuite/CWE_89__object-classicGet__CAST-func_settype_int__select_from_where-sprintf_%d.php", [["\$data", "76", "xss"]] ], [ "./tests/vulntestsuite/CWE_89__object-classicGet__func_FILTER-CLEANING-number_int_filter__multiple_select-concatenation.php", [["\$data", "77", "xss"]] ], [ "./tests/vulntestsuite/CWE_89__object-classicGet__func_FILTER-VALIDATION-number_float_filter__multiple_select-concatenation_simple_quote.php", [["\$data", "76", "xss"]] ], [ "./tests/vulntestsuite/CWE_89__object-classicGet__func_FILTER-VALIDATION-number_float_filter__multiple_select-interpretation.php", [["\$data", "76", "xss"]] ], [ "./tests/vulntestsuite/CWE_89__object-classicGet__func_floatval__multiple_select-sprintf_%d.php", [["\$data", "72", "xss"]] ], [ "./tests/vulntestsuite/CWE_89__object-classicGet__func_htmlentities__join-sprintf_%s_simple_quote.php", [["\$query", "64", "sql_injection"], ["\$data", "72", "xss"]] ], [ "./tests/vulntestsuite/CWE_89__object-classicGet__func_preg_match-only_numbers__multiple_AS-interpretation.php", [["\$data", "77", "xss"]] ], [ "./tests/vulntestsuite/CWE_89__object-classicGet__func_preg_match-only_numbers__multiple_select-interpretation.php", [["\$data", "77", "xss"]] ], [ "./tests/vulntestsuite/CWE_89__object-classicGet__ternary_white_list__join-sprintf_%s_simple_quote.php", [["\$data", "72", "xss"]] ], [ "./tests/vulntestsuite/CWE_89__object-classicGet__ternary_white_list__select_from-interpretation_simple_quote.php", [["\$data", "72", "xss"]] ], [ "./tests/vulntestsuite/CWE_89__object-directGet__CAST-cast_float_sort_of__select_from_where-concatenation.php", [["\$data", "66", "xss"]] ], [ "./tests/vulntestsuite/CWE_89__object-directGet__CAST-cast_int__multiple_select-sprintf_%u_simple_quote.php", [["\$data", "66", "xss"]] ], [ "./tests/vulntestsuite/CWE_89__object-directGet__CAST-cast_int_sort_of2__multiple_select-sprintf_%u_simple_quote.php", [["\$data", "66", "xss"]] ], [ "./tests/vulntestsuite/CWE_89__object-directGet__CAST-cast_int_sort_of__multiple_select-sprintf_%u.php", [["\$data", "66", "xss"]] ], [ "./tests/vulntestsuite/CWE_89__object-directGet__func_FILTER-CLEANING-number_float_filter__select_from_where-concatenation.php", [["\$data", "71", "xss"]] ], [ "./tests/vulntestsuite/CWE_89__object-directGet__func_FILTER-VALIDATION-number_int_filter__multiple_select-interpretation_simple_quote.php", [["\$data", "70", "xss"]] ], [ "./tests/vulntestsuite/CWE_89__object-directGet__func_mysql_real_escape_string__multiple_select-sprintf_%u_simple_quote.php", [["\$query", "58", "sql_injection"], ["\$data", "66", "xss"]] ], [ "./tests/vulntestsuite/CWE_89__object-directGet__func_mysql_real_escape_string__select_from_where-sprintf_%s_simple_quote.php", [["\$query", "58", "sql_injection"], ["\$data", "66", "xss"]] ], [ "./tests/vulntestsuite/CWE_89__object-indexArray__CAST-cast_float_sort_of__multiple_select-interpretation_simple_quote.php", [["\$data", "75", "xss"]] ], [ "./tests/vulntestsuite/CWE_89__object-indexArray__CAST-cast_int__multiple_select-sprintf_%d_simple_quote.php", [["\$data", "75", "xss"]] ], [ "./tests/vulntestsuite/CWE_89__object-indexArray__CAST-cast_int_sort_of__multiple_select-sprintf_%s_simple_quote.php", [["\$data", "75", "xss"]] ], [ "./tests/vulntestsuite/CWE_89__object-indexArray__CAST-func_settype_float__multiple_AS-interpretation_simple_quote.php", [["\$data", "79", "xss"]] ], [ "./tests/vulntestsuite/CWE_89__object-indexArray__func_FILTER-VALIDATION-number_float_filter__select_from_where-sprintf_%s_simple_quote.php", [["\$data", "79", "xss"]] ], [ "./tests/vulntestsuite/CWE_89__object-indexArray__func_preg_match-only_numbers__multiple_select-sprintf_%d_simple_quote.php", [["\$data", "80", "xss"]] ], [ "./tests/vulntestsuite/CWE_89__object-indexArray__whitelist_using_array__join-interpretation_simple_quote.php", [["\$data", "80", "xss"]] ], [ "./tests/vulntestsuite/CWE_89__object-indexArray__whitelist_using_array__select_from-interpretation_simple_quote.php", [["\$data", "80", "xss"]] ], [ "./tests/vulntestsuite/CWE_89__popen__CAST-cast_float__multiple_select-sprintf_%d_simple_quote.php", [["\$data", "59", "xss"]] ], [ "./tests/vulntestsuite/CWE_89__popen__CAST-cast_float__select_from_where-sprintf_%d_simple_quote.php", [["\$data", "59", "xss"]] ], [ "./tests/vulntestsuite/CWE_89__popen__CAST-func_settype_int__multiple_select-concatenation_simple_quote.php", [["\$data", "63", "xss"]] ], [ "./tests/vulntestsuite/CWE_89__popen__func_FILTER-CLEANING-number_float_filter__select_from_where-interpretation.php", [["\$data", "64", "xss"]] ], [ "./tests/vulntestsuite/CWE_89__popen__func_floatval__multiple_select-concatenation.php", [["\$data", "59", "xss"]] ], [ "./tests/vulntestsuite/CWE_89__popen__func_intval__select_from_where-concatenation.php", [["\$data", "59", "xss"]] ], [ "./tests/vulntestsuite/CWE_89__popen__func_mysql_real_escape_string__multiple_AS-sprintf_%d.php", [["\$query", "51", "sql_injection"], ["\$data", "59", "xss"]] ], [ "./tests/vulntestsuite/CWE_89__popen__ternary_white_list__multiple_AS-concatenation_simple_quote.php", [["\$data", "59", "xss"]] ], [ "./tests/vulntestsuite/CWE_89__popen__ternary_white_list__multiple_select-sprintf_%u.php", [["\$data", "59", "xss"]] ], [ "./tests/vulntestsuite/CWE_89__proc_open__CAST-cast_float__multiple_select-concatenation.php", [["\$data", "69", "xss"]] ], [ "./tests/vulntestsuite/CWE_89__proc_open__CAST-cast_float_sort_of__multiple_select-sprintf_%s_simple_quote.php", [["\$data", "69", "xss"]] ], [ "./tests/vulntestsuite/CWE_89__proc_open__CAST-cast_int__select_from_where-interpretation.php", [["\$data", "69", "xss"]] ], [ "./tests/vulntestsuite/CWE_89__proc_open__CAST-cast_int_sort_of2__multiple_select-sprintf_%d.php", [["\$data", "69", "xss"]] ], [ "./tests/vulntestsuite/CWE_89__proc_open__CAST-cast_int_sort_of__multiple_AS-sprintf_%s_simple_quote.php", [["\$data", "69", "xss"]] ], [ "./tests/vulntestsuite/CWE_89__proc_open__func_FILTER-VALIDATION-number_float_filter__select_from_where-interpretation.php", [["\$data", "73", "xss"]] ], [ "./tests/vulntestsuite/CWE_89__proc_open__func_intval__select_from_where-concatenation.php", [["\$data", "69", "xss"]] ], [ "./tests/vulntestsuite/CWE_89__proc_open__func_intval__select_from_where-sprintf_%d_simple_quote.php", [["\$data", "69", "xss"]] ], [ "./tests/vulntestsuite/CWE_89__proc_open__func_preg_match-only_numbers__select_from_where-concatenation.php", [["\$data", "74", "xss"]] ], [ "./tests/vulntestsuite/CWE_89__proc_open__whitelist_using_array__multiple_AS-sprintf_%d_simple_quote.php", [["\$data", "74", "xss"]] ], [ "./tests/vulntestsuite/CWE_89__proc_open__whitelist_using_array__select_from_where-sprintf_%d.php", [["\$data", "74", "xss"]] ], [ "./tests/vulntestsuite/CWE_89__shell_exec__CAST-cast_float_sort_of__multiple_select-sprintf_%d.php", [["\$data", "57", "xss"]] ], [ "./tests/vulntestsuite/CWE_89__shell_exec__CAST-cast_int_sort_of2__multiple_AS-sprintf_%u.php", [["\$data", "57", "xss"]] ], [ "./tests/vulntestsuite/CWE_89__shell_exec__CAST-cast_int_sort_of__select_from_where-interpretation_simple_quote.php", [["\$data", "57", "xss"]] ], [ "./tests/vulntestsuite/CWE_89__shell_exec__func_FILTER-CLEANING-number_float_filter__multiple_AS-interpretation.php", [["\$data", "62", "xss"]] ], [ "./tests/vulntestsuite/CWE_89__shell_exec__func_FILTER-CLEANING-number_int_filter__multiple_select-sprintf_%d.php", [["\$data", "62", "xss"]] ], [ "./tests/vulntestsuite/CWE_89__shell_exec__func_FILTER-VALIDATION-number_float_filter__multiple_AS-sprintf_%s_simple_quote.php", [["\$data", "61", "xss"]] ], [ "./tests/vulntestsuite/CWE_89__shell_exec__func_FILTER-VALIDATION-number_int_filter__multiple_select-sprintf_%u.php", [["\$data", "61", "xss"]] ], [ "./tests/vulntestsuite/CWE_89__shell_exec__func_intval__multiple_AS-sprintf_%d_simple_quote.php", [["\$data", "57", "xss"]] ], [ "./tests/vulntestsuite/CWE_89__shell_exec__ternary_white_list__select_from_where-sprintf_%d_simple_quote.php", [["\$data", "57", "xss"]] ], [ "./tests/vulntestsuite/CWE_89__shell_exec__whitelist_using_array__multiple_select-sprintf_%d.php", [["\$data", "62", "xss"]] ], [ "./tests/vulntestsuite/CWE_89__system__CAST-cast_float__multiple_AS-interpretation_simple_quote.php", [["\$data", "57", "xss"]] ], [ "./tests/vulntestsuite/CWE_89__system__CAST-func_settype_float__multiple_select-sprintf_%u_simple_quote.php", [["\$data", "61", "xss"]] ], [ "./tests/vulntestsuite/CWE_89__system__CAST-func_settype_float__select_from_where-interpretation_simple_quote.php", [["\$data", "61", "xss"]] ], [ "./tests/vulntestsuite/CWE_89__system__func_FILTER-CLEANING-magic_quotes_filter__select_from-concatenation_simple_quote.php", [["\$data", "59", "xss"]] ], [ "./tests/vulntestsuite/CWE_89__system__func_FILTER-VALIDATION-number_float_filter__multiple_AS-sprintf_%d.php", [["\$data", "61", "xss"]] ], [ "./tests/vulntestsuite/CWE_89__system__func_preg_match-only_numbers__select_from_where-sprintf_%u_simple_quote.php", [["\$data", "62", "xss"]] ], [ "./tests/vulntestsuite/CWE_89__system__func_preg_replace2__join-concatenation_simple_quote.php", [["\$data", "57", "xss"]] ], [ "./tests/vulntestsuite/CWE_89__system__ternary_white_list__multiple_select-sprintf_%d_simple_quote.php", [["\$data", "57", "xss"]] ], [ "./tests/vulntestsuite/CWE_89__system__ternary_white_list__multiple_select-sprintf_%u.php", [["\$data", "57", "xss"]] ], [ "./tests/vulntestsuite/CWE_89__system__whitelist_using_array__multiple_AS-sprintf_%s_simple_quote.php", [["\$data", "62", "xss"]] ], [ "./tests/vulntestsuite/CWE_89__system__whitelist_using_array__multiple_select-sprintf_%d_simple_quote.php", [["\$data", "62", "xss"]] ], [ "./tests/vulntestsuite/CWE_89__unserialize__CAST-cast_float_sort_of__multiple_AS-sprintf_%u.php", [["\$data", "60", "xss"]] ], [ "./tests/vulntestsuite/CWE_89__unserialize__CAST-cast_int__multiple_AS-interpretation.php", [["\$data", "60", "xss"]] ], [ "./tests/vulntestsuite/CWE_89__unserialize__CAST-cast_int__multiple_AS-sprintf_%u_simple_quote.php", [["\$data", "60", "xss"]] ], [ "./tests/vulntestsuite/CWE_89__unserialize__CAST-func_settype_float__multiple_select-concatenation.php", [["\$data", "64", "xss"]] ], [ "./tests/vulntestsuite/CWE_89__unserialize__func_FILTER-CLEANING-number_float_filter__select_from_where-sprintf_%d.php", [["\$data", "65", "xss"]] ], [ "./tests/vulntestsuite/CWE_89__unserialize__func_FILTER-CLEANING-number_int_filter__multiple_AS-sprintf_%s_simple_quote.php", [["\$data", "65", "xss"]] ], [ "./tests/vulntestsuite/CWE_89__unserialize__func_FILTER-CLEANING-number_int_filter__select_from_where-concatenation_simple_quote.php", [["\$data", "65", "xss"]] ], [ "./tests/vulntestsuite/CWE_89__unserialize__func_FILTER-VALIDATION-number_int_filter__multiple_select-interpretation.php", [["\$data", "64", "xss"]] ], [ "./tests/vulntestsuite/CWE_89__unserialize__func_floatval__multiple_AS-sprintf_%s_simple_quote.php", [["\$data", "60", "xss"]] ], [ "./tests/vulntestsuite/CWE_89__unserialize__func_intval__multiple_select-sprintf_%u.php", [["\$data", "60", "xss"]] ], [ "./tests/vulntestsuite/CWE_89__unserialize__func_intval__select_from_where-sprintf_%u.php", [["\$data", "60", "xss"]] ], [ "./tests/vulntestsuite/CWE_89__unserialize__func_preg_match-only_letters__select_from-interpretation_simple_quote.php", [["\$data", "65", "xss"]] ], [ "./tests/vulntestsuite/CWE_89__unserialize__func_preg_match-only_numbers__multiple_select-concatenation.php", [["\$data", "65", "xss"]] ], [ "./tests/vulntestsuite/CWE_89__unserialize__ternary_white_list__select_from_where-sprintf_%u.php", [["\$data", "60", "xss"]] ], [ "./tests/vulntestsuite/CWE_89__unserialize__whitelist_using_array__multiple_select-sprintf_%s_simple_quote.php", [["\$data", "65", "xss"]] ], [ "./tests/vulntestsuite/CWE_89__GET__no_sanitizing__join-sprintf_%s_simple_quote.php", [["\$query", "49", "xss"], ["\$query", "49", "sql_injection"], ["\$data", "58", "xss"]] ], [ "./tests/vulntestsuite/CWE_89__GET__no_sanitizing__multiple_AS-interpretation.php", [["\$query", "49", "xss"], ["\$query", "49", "sql_injection"], ["\$data", "58", "xss"]] ], [ "./tests/vulntestsuite/CWE_89__backticks__func_preg_match-no_filtering__join-concatenation_simple_quote.php", [["\$query", "54", "xss"], ["\$query", "54", "sql_injection"], ["\$data", "63", "xss"]] ], [ "./tests/vulntestsuite/CWE_89__exec__func_FILTER-CLEANING-email_filter__select_from-concatenation_simple_quote.php", [["\$query", "57", "xss"], ["\$query", "57", "sql_injection"], ["\$data", "66", "xss"]] ], [ "./tests/vulntestsuite/CWE_89__exec__no_sanitizing__multiple_AS-concatenation_simple_quote.php", [["\$query", "52", "xss"], ["\$query", "52", "sql_injection"], ["\$data", "61", "xss"]] ], [ "./tests/vulntestsuite/CWE_89__exec__no_sanitizing__multiple_select-interpretation_simple_quote.php", [["\$query", "52", "xss"], ["\$query", "52", "sql_injection"], ["\$data", "61", "xss"]] ], [ "./tests/vulntestsuite/CWE_89__object-directGet__func_FILTER-CLEANING-email_filter__join-interpretation_simple_quote.php", [["\$query", "63", "xss"], ["\$query", "63", "sql_injection"], ["\$data", "72", "xss"]] ], [ "./tests/vulntestsuite/CWE_89__object-directGet__no_sanitizing__select_from-sprintf_%s_simple_quote.php", [["\$query", "58", "xss"], ["\$query", "58", "sql_injection"], ["\$data", "67", "xss"]] ], [ "./tests/vulntestsuite/CWE_89__object-indexArray__func_FILTER-CLEANING-email_filter__select_from-sprintf_%s_simple_quote.php", [["\$query", "72", "xss"], ["\$query", "72", "sql_injection"], ["\$data", "81", "xss"]] ], [ "./tests/vulntestsuite/CWE_89__object-indexArray__func_preg_match-no_filtering__join-concatenation_simple_quote.php", [["\$query", "72", "xss"], ["\$query", "72", "sql_injection"], ["\$data", "81", "xss"]] ], [ "./tests/vulntestsuite/CWE_89__popen__func_FILTER-CLEANING-email_filter__select_from-concatenation_simple_quote.php", [["\$query", "56", "xss"], ["\$query", "56", "sql_injection"], ["\$data", "65", "xss"]] ], [ "./tests/vulntestsuite/CWE_89__popen__func_preg_match-no_filtering__join-sprintf_%s_simple_quote.php", [["\$query", "56", "xss"], ["\$query", "56", "sql_injection"], ["\$data", "65", "xss"]] ], [ "./tests/vulntestsuite/CWE_89__shell_exec__func_mysql_real_escape_string__multiple_select-interpretation.php", [["\$query", "49", "xss"], ["\$query", "49", "sql_injection"], ["\$data", "58", "xss"]] ], [ "./tests/vulntestsuite/CWE_89__shell_exec__no_sanitizing__multiple_AS-concatenation_simple_quote.php", [["\$query", "49", "xss"], ["\$query", "49", "sql_injection"], ["\$data", "58", "xss"]] ], [ "./tests/vulntestsuite/CWE_89__shell_exec__no_sanitizing__multiple_AS-sprintf_%s_simple_quote.php", [["\$query", "49", "xss"], ["\$query", "49", "sql_injection"], ["\$data", "58", "xss"]] ], [ "./tests/vulntestsuite/CWE_89__system__func_FILTER-CLEANING-email_filter__select_from-sprintf_%s_simple_quote.php", [["\$query", "54", "xss"], ["\$query", "54", "sql_injection"], ["\$data", "63", "xss"]] ], [ "./tests/vulntestsuite/CWE_89__system__func_preg_match-no_filtering__join-interpretation_simple_quote.php", [["\$query", "54", "xss"], ["\$query", "54", "sql_injection"], ["\$data", "63", "xss"]] ], [ "./tests/vulntestsuite/CWE_89__system__no_sanitizing__multiple_AS-concatenation.php", [["\$query", "49", "xss"], ["\$query", "49", "sql_injection"], ["\$data", "58", "xss"]] ], [ "./tests/vulntestsuite/CWE_89__unserialize__func_mysql_real_escape_string__multiple_AS-concatenation.php", [["\$string", "45", "code_injection"], ["\$query", "51", "xss"], ["\$query", "51","sql_injection"], ["\$data", "60", "xss"]] ], [ "./tests/vulntestsuite/CWE_89__unserialize__func_mysql_real_escape_string__multiple_select-concatenation.php", [["\$string", "45", "code_injection"], ["\$query", "51", "xss"], ["\$query", "51", "sql_injection"], ["\$data", "60", "xss"]] ], [ "./tests/vulntestsuite/CWE_89__unserialize__no_sanitizing__select_from_where-concatenation_simple_quote.php", [["\$string", "45", "code_injection"], ["\$query", "51", "xss"], ["\$query", "51", "sql_injection"], ["\$data", "60", "xss"]] ], [ "./tests/vulntestsuite/CWE_89__unserialize__no_sanitizing__select_from_where-interpretation_simple_quote.php", [["\$string", "45", "code_injection"], ["\$query", "51", "xss"], ["\$query", "51", "sql_injection"], ["\$data", "60", "xss"]] ], [ "./tests/vulntestsuite/CWE_90__GET__func_FILTER-CLEANING-special_chars_filter__not_name-interpretation_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_90__GET__func_FILTER-CLEANING-special_chars_filter__userByMail-concatenation_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_90__GET__func_pg_escape_literal__userByMail-sprintf_%s_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_90__GET__func_preg_match-letters_numbers__name-concatenation_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_90__GET__func_preg_match-letters_numbers__name-sprintf_%s_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_90__GET__func_preg_match-letters_numbers__userByCN-sprintf_%s_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_90__GET__func_preg_match-only_letters__not_name-concatenation_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_90__GET__func_preg_replace_ldap_char_white_list__userByMail-concatenation_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_90__GET__func_preg_replace_ldap_char_white_list__userByMail-sprintf_%s_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_90__GET__whitelist_using_array__name-sprintf_%s_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_90__GET__whitelist_using_array__userByCN-concatenation_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_90__GET__whitelist_using_array__userByCN-sprintf_%s_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_90__GET__whitelist_using_array__userByMail-sprintf_%s_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_90__POST__func_FILTER-CLEANING-full_special_chars_filter__name-interpretation_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_90__POST__func_FILTER-CLEANING-full_special_chars_filter__not_name-sprintf_%s_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_90__POST__func_FILTER-CLEANING-full_special_chars_filter__userByMail-concatenation_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_90__POST__func_FILTER-CLEANING-special_chars_filter__userByMail-sprintf_%s_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_90__POST__func_pg_escape_literal__not_name-sprintf_%s_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_90__POST__func_preg_match-only_letters__name-interpretation_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_90__POST__func_preg_match-only_letters__userByCN-concatenation_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_90__POST__func_preg_match-only_letters__userByCN-interpretation_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_90__POST__func_preg_replace_ldap_char_white_list__not_name-sprintf_%s_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_90__POST__ternary_white_list__not_name-interpretation_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_90__POST__whitelist_using_array__userByMail-concatenation_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_90__SESSION__func_FILTER-CLEANING-full_special_chars_filter__userByCN-interpretation_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_90__SESSION__func_FILTER-CLEANING-special_chars_filter__name-concatenation_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_90__SESSION__func_pg_escape_literal__not_name-interpretation_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_90__SESSION__func_preg_match-letters_numbers__name-sprintf_%s_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_90__SESSION__func_preg_match-only_letters__name-concatenation_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_90__SESSION__func_preg_replace_ldap_char_white_list__name-sprintf_%s_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_90__SESSION__func_preg_replace_ldap_char_white_list__not_name-sprintf_%s_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_90__SESSION__func_preg_replace_ldap_char_white_list__userByCN-interpretation_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_90__SESSION__func_str_replace_ldap_char_black_list__userByMail-concatenation_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_90__SESSION__ternary_white_list__not_name-concatenation_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_90__SESSION__ternary_white_list__userByCN-interpretation_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_90__SESSION__whitelist_using_array__not_name-concatenation_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_90__SESSION__whitelist_using_array__userByCN-concatenation_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_90__array-GET__func_FILTER-CLEANING-full_special_chars_filter__userByCN-concatenation_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_90__array-GET__func_FILTER-CLEANING-special_chars_filter__userByMail-interpretation_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_90__array-GET__func_preg_match-letters_numbers__userByMail-concatenation_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_90__array-GET__func_str_replace_ldap_char_black_list__name-interpretation_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_90__array-GET__ternary_white_list__not_name-concatenation_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_90__array-GET__ternary_white_list__userByCN-interpretation_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_90__array-GET__ternary_white_list__userByCN-sprintf_%s_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_90__array-GET__ternary_white_list__userByMail-interpretation_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_90__backticks__func_pg_escape_literal__not_name-sprintf_%s_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_90__backticks__func_preg_match-letters_numbers__name-sprintf_%s_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_90__backticks__ternary_white_list__name-interpretation_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_90__backticks__ternary_white_list__not_name-concatenation_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_90__backticks__ternary_white_list__userByMail-concatenation_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_90__backticks__ternary_white_list__userByMail-sprintf_%s_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_90__exec__func_FILTER-CLEANING-full_special_chars_filter__userByMail-interpretation_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_90__exec__func_FILTER-CLEANING-full_special_chars_filter__userByMail-sprintf_%s_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_90__exec__func_FILTER-CLEANING-special_chars_filter__not_name-interpretation_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_90__exec__func_FILTER-CLEANING-special_chars_filter__userByCN-concatenation_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_90__exec__func_FILTER-CLEANING-special_chars_filter__userByMail-sprintf_%s_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_90__exec__func_pg_escape_literal__not_name-interpretation_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_90__exec__func_pg_escape_literal__userByMail-sprintf_%s_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_90__exec__func_preg_match-letters_numbers__not_name-sprintf_%s_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_90__exec__func_preg_match-letters_numbers__userByCN-interpretation_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_90__exec__func_preg_match-letters_numbers__userByCN-sprintf_%s_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_90__exec__func_preg_match-only_letters__userByCN-interpretation_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_90__exec__func_preg_replace_ldap_char_white_list__not_name-sprintf_%s_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_90__exec__ternary_white_list__userByMail-interpretation_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_90__exec__whitelist_using_array__not_name-concatenation_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_90__fopen__func_FILTER-CLEANING-special_chars_filter__not_name-concatenation_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_90__fopen__func_FILTER-CLEANING-special_chars_filter__not_name-interpretation_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_90__fopen__func_pg_escape_literal__name-concatenation_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_90__fopen__func_preg_match-letters_numbers__not_name-interpretation_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_90__fopen__func_preg_match-only_letters__name-concatenation_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_90__fopen__func_preg_match-only_letters__not_name-concatenation_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_90__fopen__func_preg_replace_ldap_char_white_list__not_name-sprintf_%s_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_90__fopen__func_preg_replace_ldap_char_white_list__userByCN-sprintf_%s_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_90__fopen__whitelist_using_array__userByMail-sprintf_%s_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_90__object-Array__func_FILTER-CLEANING-special_chars_filter__userByCN-concatenation_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_90__object-Array__func_pg_escape_literal__not_name-sprintf_%s_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_90__object-Array__func_pg_escape_literal__userByCN-concatenation_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_90__object-Array__func_preg_match-only_letters__name-interpretation_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_90__object-Array__func_preg_match-only_letters__name-sprintf_%s_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_90__object-Array__func_preg_match-only_letters__userByCN-sprintf_%s_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_90__object-Array__func_preg_match-only_letters__userByMail-sprintf_%s_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_90__object-Array__func_preg_replace_ldap_char_white_list__userByCN-concatenation_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_90__object-Array__whitelist_using_array__name-sprintf_%s_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_90__object-classicGet__func_FILTER-CLEANING-full_special_chars_filter__userByMail-interpretation_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_90__object-classicGet__func_FILTER-CLEANING-special_chars_filter__userByMail-concatenation_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_90__object-classicGet__func_preg_match-letters_numbers__name-interpretation_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_90__object-classicGet__func_preg_match-letters_numbers__userByCN-concatenation_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_90__object-classicGet__func_preg_replace_ldap_char_white_list__not_name-interpretation_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_90__object-classicGet__ternary_white_list__name-interpretation_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_90__object-classicGet__ternary_white_list__not_name-interpretation_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_90__object-classicGet__whitelist_using_array__not_name-interpretation_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_90__object-classicGet__whitelist_using_array__userByCN-sprintf_%s_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_90__object-directGet__func_FILTER-CLEANING-full_special_chars_filter__userByCN-interpretation_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_90__object-directGet__func_FILTER-CLEANING-full_special_chars_filter__userByMail-interpretation_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_90__object-directGet__func_FILTER-CLEANING-special_chars_filter__name-concatenation_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_90__object-directGet__func_pg_escape_literal__name-sprintf_%s_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_90__object-directGet__func_pg_escape_literal__userByMail-interpretation_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_90__object-directGet__func_preg_match-letters_numbers__not_name-interpretation_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_90__object-directGet__ternary_white_list__userByCN-sprintf_%s_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_90__object-directGet__ternary_white_list__userByMail-sprintf_%s_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_90__object-indexArray__func_FILTER-CLEANING-full_special_chars_filter__userByCN-interpretation_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_90__object-indexArray__func_FILTER-CLEANING-special_chars_filter__userByMail-interpretation_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_90__object-indexArray__func_pg_escape_literal__userByMail-interpretation_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_90__object-indexArray__func_preg_match-letters_numbers__userByMail-sprintf_%s_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_90__object-indexArray__func_preg_replace_ldap_char_white_list__userByCN-concatenation_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_90__object-indexArray__ternary_white_list__not_name-interpretation_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_90__popen__func_FILTER-CLEANING-full_special_chars_filter__userByMail-sprintf_%s_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_90__popen__func_preg_match-letters_numbers__name-concatenation_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_90__popen__func_preg_match-letters_numbers__userByCN-concatenation_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_90__popen__func_preg_match-letters_numbers__userByCN-interpretation_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_90__popen__func_preg_match-letters_numbers__userByMail-concatenation_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_90__popen__func_preg_match-letters_numbers__userByMail-interpretation_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_90__popen__func_preg_match-only_letters__name-sprintf_%s_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_90__popen__func_preg_match-only_letters__userByCN-sprintf_%s_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_90__popen__whitelist_using_array__name-sprintf_%s_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_90__popen__whitelist_using_array__userByCN-concatenation_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_90__popen__whitelist_using_array__userByMail-concatenation_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_90__popen__whitelist_using_array__userByMail-interpretation_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_90__proc_open__func_FILTER-CLEANING-full_special_chars_filter__name-sprintf_%s_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_90__proc_open__func_FILTER-CLEANING-special_chars_filter__userByCN-concatenation_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_90__proc_open__func_FILTER-CLEANING-special_chars_filter__userByCN-interpretation_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_90__proc_open__func_pg_escape_literal__not_name-interpretation_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_90__proc_open__func_pg_escape_literal__not_name-sprintf_%s_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_90__proc_open__func_preg_match-letters_numbers__name-interpretation_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_90__proc_open__func_preg_replace_ldap_char_white_list__name-concatenation_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_90__proc_open__func_preg_replace_ldap_char_white_list__userByMail-concatenation_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_90__proc_open__ternary_white_list__userByMail-concatenation_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_90__shell_exec__func_FILTER-CLEANING-full_special_chars_filter__not_name-sprintf_%s_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_90__shell_exec__func_FILTER-CLEANING-special_chars_filter__name-concatenation_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_90__shell_exec__func_FILTER-CLEANING-special_chars_filter__not_name-sprintf_%s_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_90__shell_exec__func_FILTER-CLEANING-special_chars_filter__userByMail-concatenation_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_90__shell_exec__func_preg_match-letters_numbers__name-interpretation_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_90__shell_exec__func_preg_match-letters_numbers__not_name-sprintf_%s_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_90__shell_exec__func_preg_match-only_letters__not_name-sprintf_%s_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_90__shell_exec__func_preg_match-only_letters__userByMail-sprintf_%s_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_90__shell_exec__func_preg_replace_ldap_char_white_list__not_name-interpretation_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_90__shell_exec__ternary_white_list__name-concatenation_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_90__shell_exec__ternary_white_list__not_name-concatenation_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_90__shell_exec__ternary_white_list__userByMail-interpretation_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_90__shell_exec__whitelist_using_array__name-concatenation_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_90__shell_exec__whitelist_using_array__userByMail-sprintf_%s_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_90__system__func_FILTER-CLEANING-full_special_chars_filter__name-interpretation_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_90__system__func_FILTER-CLEANING-full_special_chars_filter__not_name-interpretation_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_90__system__func_FILTER-CLEANING-full_special_chars_filter__userByMail-concatenation_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_90__system__func_FILTER-CLEANING-special_chars_filter__name-concatenation_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_90__system__func_pg_escape_literal__name-concatenation_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_90__system__func_pg_escape_literal__userByCN-sprintf_%s_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_90__system__func_preg_match-letters_numbers__not_name-interpretation_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_90__system__ternary_white_list__name-concatenation_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_90__system__ternary_white_list__not_name-concatenation_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_90__system__ternary_white_list__userByMail-sprintf_%s_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_90__GET__func_FILTER-CLEANING-email_filter__name-concatenation_simple_quote.php", [["\$query", "54", "ldap_injection"]] ], [ "./tests/vulntestsuite/CWE_90__GET__func_FILTER-CLEANING-email_filter__userByCN-concatenation_simple_quote.php", [["\$query", "54", "ldap_injection"]] ], [ "./tests/vulntestsuite/CWE_90__GET__func_addslashes__name-interpretation_simple_quote.php", [["\$query", "49", "ldap_injection"]] ], [ "./tests/vulntestsuite/CWE_90__GET__func_addslashes__name-sprintf_%s_simple_quote.php", [["\$query", "49", "ldap_injection"]] ], [ "./tests/vulntestsuite/CWE_90__GET__func_addslashes__userByMail-sprintf_%s_simple_quote.php", [["\$query", "49", "ldap_injection"]] ], [ "./tests/vulntestsuite/CWE_90__GET__func_htmlentities__not_name-sprintf_%s_simple_quote.php", [["\$query", "49", "ldap_injection"]] ], [ "./tests/vulntestsuite/CWE_90__GET__func_htmlentities__userByMail-concatenation_simple_quote.php", [["\$query", "49", "ldap_injection"]] ], [ "./tests/vulntestsuite/CWE_90__GET__func_htmlentities__userByMail-interpretation_simple_quote.php", [["\$query", "49", "ldap_injection"]] ], [ "./tests/vulntestsuite/CWE_90__GET__func_htmlentities__userByMail-sprintf_%s_simple_quote.php", [["\$query", "49", "ldap_injection"]] ], [ "./tests/vulntestsuite/CWE_90__GET__func_htmlspecialchars__not_name-interpretation_simple_quote.php", [["\$query", "49", "ldap_injection"]] ], [ "./tests/vulntestsuite/CWE_90__GET__no_sanitizing__not_name-interpretation_simple_quote.php", [["\$query", "49", "ldap_injection"]] ], [ "./tests/vulntestsuite/CWE_90__POST__func_addslashes__name-interpretation_simple_quote.php", [["\$query", "49", "ldap_injection"]] ], [ "./tests/vulntestsuite/CWE_90__POST__func_addslashes__userByMail-concatenation_simple_quote.php", [["\$query", "49", "ldap_injection"]] ], [ "./tests/vulntestsuite/CWE_90__POST__func_htmlentities__userByMail-sprintf_%s_simple_quote.php", [["\$query", "49", "ldap_injection"]] ], [ "./tests/vulntestsuite/CWE_90__POST__no_sanitizing__name-interpretation_simple_quote.php", [["\$query", "49", "ldap_injection"]] ], [ "./tests/vulntestsuite/CWE_90__POST__no_sanitizing__not_name-sprintf_%s_simple_quote.php", [["\$query", "49", "ldap_injection"]] ], [ "./tests/vulntestsuite/CWE_90__POST__no_sanitizing__userByCN-interpretation_simple_quote.php", [["\$query", "49", "ldap_injection"]] ], [ "./tests/vulntestsuite/CWE_90__POST__no_sanitizing__userByMail-concatenation_simple_quote.php", [["\$query", "49", "ldap_injection"]] ], [ "./tests/vulntestsuite/CWE_90__fopen__func_addslashes__name-interpretation_simple_quote.php", [["\$query", "58", "ldap_injection"]] ], [ "./tests/vulntestsuite/CWE_90__fopen__func_addslashes__userByCN-interpretation_simple_quote.php", [["\$query", "58", "ldap_injection"]] ], [ "./tests/vulntestsuite/CWE_90__fopen__func_addslashes__userByCN-sprintf_%s_simple_quote.php", [["\$query", "58", "ldap_injection"]] ], [ "./tests/vulntestsuite/CWE_90__fopen__func_addslashes__userByMail-sprintf_%s_simple_quote.php", [["\$query", "58", "ldap_injection"]] ], [ "./tests/vulntestsuite/CWE_90__fopen__func_htmlentities__name-sprintf_%s_simple_quote.php", [["\$query", "58", "ldap_injection"]] ], [ "./tests/vulntestsuite/CWE_90__fopen__func_htmlspecialchars__not_name-sprintf_%s_simple_quote.php", [["\$query", "58", "ldap_injection"]] ], [ "./tests/vulntestsuite/CWE_90__fopen__func_htmlspecialchars__userByMail-interpretation_simple_quote.php", [["\$query", "58", "ldap_injection"]] ], [ "./tests/vulntestsuite/CWE_90__fopen__no_sanitizing__not_name-sprintf_%s_simple_quote.php", [["\$query", "58", "ldap_injection"]] ], [ "./tests/vulntestsuite/CWE_90__object-Array__func_FILTER-CLEANING-email_filter__name-sprintf_%s_simple_quote.php", [["\$query", "72", "ldap_injection"]] ], [ "./tests/vulntestsuite/CWE_90__object-Array__func_FILTER-CLEANING-email_filter__not_name-sprintf_%s_simple_quote.php", [["\$query", "72", "ldap_injection"]] ], [ "./tests/vulntestsuite/CWE_90__object-Array__func_FILTER-CLEANING-email_filter__userByCN-concatenation_simple_quote.php", [["\$query", "72", "ldap_injection"]] ], [ "./tests/vulntestsuite/CWE_90__object-Array__func_addslashes__userByCN-interpretation_simple_quote.php", [["\$query", "67", "ldap_injection"]] ], [ "./tests/vulntestsuite/CWE_90__object-Array__func_htmlentities__not_name-concatenation_simple_quote.php", [["\$query", "67", "ldap_injection"]] ], [ "./tests/vulntestsuite/CWE_90__object-Array__func_htmlentities__userByMail-concatenation_simple_quote.php", [["\$query", "67", "ldap_injection"]] ], [ "./tests/vulntestsuite/CWE_90__object-classicGet__func_FILTER-CLEANING-email_filter__not_name-interpretation_simple_quote.php", [["\$query", "69", "ldap_injection"]] ], [ "./tests/vulntestsuite/CWE_90__object-classicGet__func_addslashes__name-concatenation_simple_quote.php", [["\$query", "64", "ldap_injection"]] ], [ "./tests/vulntestsuite/CWE_90__object-classicGet__func_addslashes__not_name-sprintf_%s_simple_quote.php", [["\$query", "64", "ldap_injection"]] ], [ "./tests/vulntestsuite/CWE_90__object-classicGet__func_preg_match-no_filtering__name-concatenation_simple_quote.php", [["\$query", "69", "ldap_injection"]] ], [ "./tests/vulntestsuite/CWE_90__object-classicGet__func_preg_match-no_filtering__userByCN-sprintf_%s_simple_quote.php", [["\$query", "69", "ldap_injection"]] ], [ "./tests/vulntestsuite/CWE_90__object-directGet__func_FILTER-CLEANING-email_filter__not_name-concatenation_simple_quote.php", [["\$query", "63", "ldap_injection"]] ], [ "./tests/vulntestsuite/CWE_90__object-directGet__func_FILTER-CLEANING-email_filter__userByCN-concatenation_simple_quote.php", [["\$query", "63", "ldap_injection"]] ], [ "./tests/vulntestsuite/CWE_90__object-directGet__func_addslashes__not_name-sprintf_%s_simple_quote.php", [["\$query", "58", "ldap_injection"]] ], [ "./tests/vulntestsuite/CWE_90__object-directGet__func_htmlspecialchars__name-sprintf_%s_simple_quote.php", [["\$query", "58", "ldap_injection"]] ], [ "./tests/vulntestsuite/CWE_90__object-directGet__func_htmlspecialchars__not_name-interpretation_simple_quote.php", [["\$query", "58", "ldap_injection"]] ], [ "./tests/vulntestsuite/CWE_90__object-directGet__func_htmlspecialchars__userByCN-interpretation_simple_quote.php", [["\$query", "58", "ldap_injection"]] ], [ "./tests/vulntestsuite/CWE_90__object-directGet__func_htmlspecialchars__userByMail-sprintf_%s_simple_quote.php", [["\$query", "58", "ldap_injection"]] ], [ "./tests/vulntestsuite/CWE_90__object-directGet__func_preg_match-no_filtering__not_name-concatenation_simple_quote.php", [["\$query", "63", "ldap_injection"]] ], [ "./tests/vulntestsuite/CWE_90__object-directGet__func_preg_match-no_filtering__userByCN-concatenation_simple_quote.php", [["\$query", "63", "ldap_injection"]] ], [ "./tests/vulntestsuite/CWE_90__object-directGet__func_preg_match-no_filtering__userByMail-sprintf_%s_simple_quote.php", [["\$query", "63", "ldap_injection"]] ], [ "./tests/vulntestsuite/CWE_90__object-directGet__no_sanitizing__not_name-sprintf_%s_simple_quote.php", [["\$query", "58", "ldap_injection"]] ], [ "./tests/vulntestsuite/CWE_90__object-directGet__no_sanitizing__userByMail-sprintf_%s_simple_quote.php", [["\$query", "58", "ldap_injection"]] ], [ "./tests/vulntestsuite/CWE_90__object-indexArray__func_htmlentities__not_name-concatenation_simple_quote.php", [["\$query", "67", "ldap_injection"]] ], [ "./tests/vulntestsuite/CWE_90__object-indexArray__func_htmlentities__userByCN-interpretation_simple_quote.php", [["\$query", "67", "ldap_injection"]] ], [ "./tests/vulntestsuite/CWE_90__object-indexArray__func_htmlentities__userByCN-sprintf_%s_simple_quote.php", [["\$query", "67", "ldap_injection"]] ], [ "./tests/vulntestsuite/CWE_90__object-indexArray__func_htmlentities__userByMail-interpretation_simple_quote.php", [["\$query", "67", "ldap_injection"]] ], [ "./tests/vulntestsuite/CWE_90__object-indexArray__func_htmlspecialchars__not_name-interpretation_simple_quote.php", [["\$query", "67", "ldap_injection"]] ], [ "./tests/vulntestsuite/CWE_90__object-indexArray__func_htmlspecialchars__not_name-sprintf_%s_simple_quote.php", [["\$query", "67", "ldap_injection"]] ], [ "./tests/vulntestsuite/CWE_90__object-indexArray__no_sanitizing__name-concatenation_simple_quote.php", [["\$query", "67", "ldap_injection"]] ], [ "./tests/vulntestsuite/CWE_90__popen__func_FILTER-CLEANING-email_filter__name-concatenation_simple_quote.php", [["\$query", "56", "ldap_injection"]] ], [ "./tests/vulntestsuite/CWE_90__popen__func_FILTER-CLEANING-email_filter__userByMail-sprintf_%s_simple_quote.php", [["\$query", "56", "ldap_injection"]] ], [ "./tests/vulntestsuite/CWE_90__popen__func_htmlspecialchars__not_name-interpretation_simple_quote.php", [["\$query", "51", "ldap_injection"]] ], [ "./tests/vulntestsuite/CWE_90__popen__func_htmlspecialchars__userByCN-sprintf_%s_simple_quote.php", [["\$query", "51", "ldap_injection"]] ], [ "./tests/vulntestsuite/CWE_90__popen__func_htmlspecialchars__userByMail-interpretation_simple_quote.php", [["\$query", "51", "ldap_injection"]] ], [ "./tests/vulntestsuite/CWE_90__popen__func_preg_match-no_filtering__userByCN-sprintf_%s_simple_quote.php", [["\$query", "56", "ldap_injection"]] ], [ "./tests/vulntestsuite/CWE_90__popen__no_sanitizing__name-interpretation_simple_quote.php", [["\$query", "51", "ldap_injection"]] ], [ "./tests/vulntestsuite/CWE_90__popen__no_sanitizing__userByCN-interpretation_simple_quote.php", [["\$query", "51", "ldap_injection"]] ], [ "./tests/vulntestsuite/CWE_90__popen__no_sanitizing__userByMail-sprintf_%s_simple_quote.php", [["\$query", "51", "ldap_injection"]] ], [ "./tests/vulntestsuite/CWE_90__proc_open__func_FILTER-CLEANING-email_filter__name-concatenation_simple_quote.php", [["\$query", "66", "ldap_injection"]] ], [ "./tests/vulntestsuite/CWE_90__proc_open__func_addslashes__not_name-sprintf_%s_simple_quote.php", [["\$query", "61", "ldap_injection"]] ], [ "./tests/vulntestsuite/CWE_90__proc_open__func_htmlentities__not_name-concatenation_simple_quote.php", [["\$query", "61", "ldap_injection"]] ], [ "./tests/vulntestsuite/CWE_90__proc_open__func_htmlentities__userByMail-sprintf_%s_simple_quote.php", [["\$query", "61", "ldap_injection"]] ], [ "./tests/vulntestsuite/CWE_90__proc_open__func_preg_match-no_filtering__not_name-interpretation_simple_quote.php", [["\$query", "66", "ldap_injection"]] ], [ "./tests/vulntestsuite/CWE_90__proc_open__no_sanitizing__name-sprintf_%s_simple_quote.php", [["\$query", "61", "ldap_injection"]] ], [ "./tests/vulntestsuite/CWE_90__proc_open__no_sanitizing__not_name-sprintf_%s_simple_quote.php", [["\$query", "61", "ldap_injection"]] ], [ "./tests/vulntestsuite/CWE_90__shell_exec__func_addslashes__not_name-sprintf_%s_simple_quote.php", [["\$query", "49", "ldap_injection"]] ], [ "./tests/vulntestsuite/CWE_90__shell_exec__func_addslashes__userByMail-sprintf_%s_simple_quote.php", [["\$query", "49", "ldap_injection"]] ], [ "./tests/vulntestsuite/CWE_90__shell_exec__func_htmlentities__name-sprintf_%s_simple_quote.php", [["\$query", "49", "ldap_injection"]] ], [ "./tests/vulntestsuite/CWE_90__shell_exec__func_htmlentities__userByCN-interpretation_simple_quote.php", [["\$query", "49", "ldap_injection"]] ], [ "./tests/vulntestsuite/CWE_90__shell_exec__func_preg_match-no_filtering__name-concatenation_simple_quote.php", [["\$query", "54", "ldap_injection"]] ], [ "./tests/vulntestsuite/CWE_90__shell_exec__no_sanitizing__not_name-sprintf_%s_simple_quote.php", [["\$query", "49", "ldap_injection"]] ], [ "./tests/vulntestsuite/CWE_90__system__func_addslashes__not_name-sprintf_%s_simple_quote.php", [["\$query", "49", "ldap_injection"]] ], [ "./tests/vulntestsuite/CWE_90__system__func_htmlentities__userByCN-sprintf_%s_simple_quote.php", [["\$query", "49", "ldap_injection"]] ], [ "./tests/vulntestsuite/CWE_90__system__func_htmlspecialchars__userByCN-concatenation_simple_quote.php", [["\$query", "49", "ldap_injection"]] ], [ "./tests/vulntestsuite/CWE_90__system__func_htmlspecialchars__userByMail-interpretation_simple_quote.php", [["\$query", "49", "ldap_injection"]] ], [ "./tests/vulntestsuite/CWE_90__system__func_preg_match-no_filtering__userByMail-interpretation_simple_quote.php", [["\$query", "54", "ldap_injection"]] ], [ "./tests/vulntestsuite/CWE_90__system__no_sanitizing__not_name-concatenation_simple_quote.php", [["\$query", "49", "ldap_injection"]] ], [ "./tests/vulntestsuite/CWE_90__unserialize__func_FILTER-CLEANING-email_filter__not_name-concatenation_simple_quote.php", [["\$string", "45", "code_injection"], ["\$query", "56", "ldap_injection"]] ], [ "./tests/vulntestsuite/CWE_90__unserialize__func_FILTER-CLEANING-magic_quotes_filter__name-concatenation_simple_quote.php", [["\$string", "45", "code_injection"]] ], [ "./tests/vulntestsuite/CWE_90__unserialize__func_addslashes__userByCN-concatenation_simple_quote.php", [["\$string", "45", "code_injection"], ["\$query", "51", "ldap_injection"]] ], [ "./tests/vulntestsuite/CWE_90__unserialize__func_htmlspecialchars__name-interpretation_simple_quote.php", [["\$string", "45", "code_injection"], ["\$query", "51", "ldap_injection"]] ], [ "./tests/vulntestsuite/CWE_90__unserialize__func_htmlspecialchars__not_name-interpretation_simple_quote.php", [["\$string", "45", "code_injection"], ["\$query", "51", "ldap_injection"]] ], [ "./tests/vulntestsuite/CWE_90__unserialize__func_htmlspecialchars__userByCN-interpretation_simple_quote.php", [["\$string", "45", "code_injection"], ["\$query", "51", "ldap_injection"]] ], [ "./tests/vulntestsuite/CWE_90__unserialize__func_pg_escape_string__not_name-interpretation_simple_quote.php", [["\$string", "45", "code_injection"]] ], [ "./tests/vulntestsuite/CWE_90__unserialize__func_preg_match-no_filtering__not_name-sprintf_%s_simple_quote.php", [["\$string", "45", "code_injection"], ["\$query", "56", "ldap_injection"]] ], [ "./tests/vulntestsuite/CWE_90__unserialize__func_preg_replace2__not_name-concatenation_simple_quote.php", [["\$string", "45", "code_injection"]] ], [ "./tests/vulntestsuite/CWE_90__unserialize__func_preg_replace2__userByMail-interpretation_simple_quote.php", [["\$string", "45", "code_injection"]] ], [ "./tests/vulntestsuite/CWE_90__unserialize__func_preg_replace__userByMail-concatenation_simple_quote.php", [["\$string", "45", "code_injection"]] ], [ "./tests/vulntestsuite/CWE_91__GET__CAST-cast_float__ID_test-interpretation_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_91__GET__CAST-cast_int_sort_of2__ID_test-interpretation.php", [] ], [ "./tests/vulntestsuite/CWE_91__GET__CAST-cast_int_sort_of__ID_at-sprintf_%s_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_91__GET__func_FILTER-CLEANING-number_float_filter__ID_at-sprintf_%u.php", [] ], [ "./tests/vulntestsuite/CWE_91__GET__func_FILTER-VALIDATION-number_float_filter__ID_test-sprintf_%d_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_91__GET__func_FILTER-VALIDATION-number_int_filter__ID_test-concatenation_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_91__GET__func_intval__ID_test-concatenation.php", [] ], [ "./tests/vulntestsuite/CWE_91__GET__func_preg_match-letters_numbers__username-sprintf_%s_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_91__GET__ternary_white_list__ID_test-interpretation_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_91__POST__CAST-cast_float__ID_at-sprintf_%u.php", [] ], [ "./tests/vulntestsuite/CWE_91__POST__CAST-cast_float_sort_of__ID_at-sprintf_%s_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_91__POST__func_FILTER-CLEANING-number_int_filter__ID_test-concatenation_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_91__POST__func_floatval__ID_test-interpretation_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_91__POST__func_preg_match-only_letters__username_text-concatenation_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_91__POST__func_preg_match-only_numbers__ID_test-concatenation_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_91__POST__func_preg_match-only_numbers__ID_test-interpretation.php", [] ], [ "./tests/vulntestsuite/CWE_91__POST__ternary_white_list__username_at-interpretation_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_91__POST__whitelist_using_array__ID_test-concatenation.php", [] ], [ "./tests/vulntestsuite/CWE_91__SESSION__CAST-cast_int_sort_of2__ID_test-concatenation_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_91__SESSION__CAST-func_settype_int__ID_test-interpretation.php", [] ], [ "./tests/vulntestsuite/CWE_91__SESSION__func_floatval__ID_test-sprintf_%d_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_91__SESSION__func_preg_replace2__username_text-interpretation_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_91__SESSION__func_preg_replace__data-concatenation_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_91__SESSION__func_preg_replace__username-concatenation_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_91__SESSION__func_preg_replace__username-interpretation_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_91__SESSION__func_preg_replace__username-sprintf_%s_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_91__SESSION__object-func_mysql_real_escape_string__username_at-interpretation_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_91__SESSION__whitelist_using_array__username-sprintf_%s_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_91__array-GET__CAST-cast_int_sort_of2__ID_at-sprintf_%u.php", [] ], [ "./tests/vulntestsuite/CWE_91__array-GET__func_FILTER-CLEANING-number_float_filter__ID_test-interpretation.php", [] ], [ "./tests/vulntestsuite/CWE_91__array-GET__func_FILTER-CLEANING-number_float_filter__ID_test-sprintf_%d_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_91__array-GET__func_FILTER-CLEANING-number_int_filter__ID_test-interpretation_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_91__array-GET__func_FILTER-VALIDATION-number_float_filter__ID_at-sprintf_%u_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_91__array-GET__func_floatval__ID_test-interpretation_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_91__array-GET__func_mysql_real_escape_string__ID_at-sprintf_%u.php", [] ], [ "./tests/vulntestsuite/CWE_91__array-GET__func_preg_match-only_letters__data-interpretation_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_91__array-GET__object-func_mysql_real_escape_string__username_text-sprintf_%s_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_91__backticks__CAST-func_settype_int__ID_test-sprintf_%d.php", [] ], [ "./tests/vulntestsuite/CWE_91__backticks__func_FILTER-VALIDATION-number_int_filter__ID_test-interpretation.php", [] ], [ "./tests/vulntestsuite/CWE_91__backticks__ternary_white_list__username-sprintf_%s_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_91__exec__func_FILTER-VALIDATION-number_int_filter__ID_at-sprintf_%s_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_91__exec__func_htmlspecialchars__username-concatenation_simple_quote.php", [["\$query", "52" , "xml_injection"]] ], [ "./tests/vulntestsuite/CWE_91__fopen__CAST-cast_float_sort_of__ID_test-sprintf_%d.php", [] ], [ "./tests/vulntestsuite/CWE_91__fopen__CAST-cast_int__ID_test-sprintf_%d_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_91__fopen__func_FILTER-CLEANING-number_float_filter__ID_at-sprintf_%u_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_91__fopen__func_floatval__ID_at-sprintf_%u.php", [] ], [ "./tests/vulntestsuite/CWE_91__fopen__ternary_white_list__ID_test-concatenation_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_91__fopen__ternary_white_list__username-sprintf_%s_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_91__fopen__ternary_white_list__username_at-concatenation_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_91__fopen__whitelist_using_array__ID_test-interpretation_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_91__object-Array__CAST-cast_int__ID_test-concatenation_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_91__object-Array__CAST-cast_int__ID_test-interpretation_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_91__object-Array__CAST-cast_int__ID_test-sprintf_%d_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_91__object-Array__CAST-cast_int_sort_of__ID_at-sprintf_%s_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_91__object-Array__func_FILTER-CLEANING-number_int_filter__ID_test-sprintf_%d.php", [] ], [ "./tests/vulntestsuite/CWE_91__object-Array__func_intval__ID_at-sprintf_%s_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_91__object-Array__func_preg_match-letters_numbers__data-interpretation_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_91__object-classicGet__CAST-cast_float__ID_test-interpretation.php", [] ], [ "./tests/vulntestsuite/CWE_91__object-classicGet__func_FILTER-VALIDATION-number_float_filter__ID_test-concatenation_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_91__object-classicGet__func_FILTER-VALIDATION-number_int_filter__ID_test-interpretation_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_91__object-directGet__CAST-cast_int_sort_of__ID_test-concatenation.php", [] ], [ "./tests/vulntestsuite/CWE_91__object-directGet__func_FILTER-CLEANING-number_float_filter__ID_test-concatenation.php", [] ], [ "./tests/vulntestsuite/CWE_91__object-directGet__func_preg_match-only_letters__username_text-interpretation_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_91__object-directGet__whitelist_using_array__ID_at-sprintf_%s_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_91__object-indexArray__CAST-func_settype_float__ID_at-sprintf_%s_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_91__object-indexArray__CAST-func_settype_float__ID_test-sprintf_%d.php", [] ], [ "./tests/vulntestsuite/CWE_91__object-indexArray__func_FILTER-VALIDATION-number_int_filter__ID_test-sprintf_%d.php", [] ], [ "./tests/vulntestsuite/CWE_91__object-indexArray__func_preg_match-only_letters__username_text-interpretation_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_91__object-indexArray__func_preg_match-only_numbers__ID_test-concatenation.php", [] ], [ "./tests/vulntestsuite/CWE_91__object-indexArray__ternary_white_list__data-sprintf_%s_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_91__object-indexArray__ternary_white_list__username_text-sprintf_%s_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_91__popen__func_FILTER-CLEANING-number_int_filter__ID_test-sprintf_%d_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_91__popen__func_FILTER-VALIDATION-number_int_filter__ID_at-sprintf_%s_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_91__popen__whitelist_using_array__username_text-concatenation_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_91__proc_open__CAST-cast_int_sort_of__ID_at-sprintf_%s_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_91__proc_open__func_htmlspecialchars__username_text-interpretation_simple_quote.php", [["\$query", "61", "xml_injection"]] ], [ "./tests/vulntestsuite/CWE_91__proc_open__func_intval__ID_at-sprintf_%u.php", [] ], [ "./tests/vulntestsuite/CWE_91__proc_open__func_preg_match-only_letters__username_at-concatenation_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_91__proc_open__whitelist_using_array__data-concatenation_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_91__shell_exec__func_FILTER-CLEANING-number_int_filter__ID_at-sprintf_%u.php", [] ], [ "./tests/vulntestsuite/CWE_91__shell_exec__func_preg_match-only_letters__username_text-interpretation_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_91__system__CAST-cast_int_sort_of2__ID_test-interpretation_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_91__system__CAST-cast_int_sort_of__ID_at-sprintf_%u.php", [] ], [ "./tests/vulntestsuite/CWE_91__system__func_FILTER-CLEANING-number_int_filter__ID_test-sprintf_%d.php", [] ], [ "./tests/vulntestsuite/CWE_91__system__func_FILTER-VALIDATION-number_float_filter__ID_at-sprintf_%u_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_91__system__func_FILTER-VALIDATION-number_int_filter__ID_at-sprintf_%u.php", [] ], [ "./tests/vulntestsuite/CWE_91__system__func_htmlentities__username_at-sprintf_%s_simple_quote.php", [["\$query", "49", "xml_injection"]] ], [ "./tests/vulntestsuite/CWE_91__system__func_preg_match-letters_numbers__username_text-sprintf_%s_simple_quote.php", [] ], [ "./tests/vulntestsuite/CWE_91__system__func_preg_match-only_letters__username-sprintf_%s_simple_quote.php", [] ] ];
{ "content_hash": "3dadfdc4a07208772c5a57c6bc2e0111", "timestamp": "", "source": "github", "line_count": 6378, "max_line_length": 173, "avg_line_length": 35.71135152085293, "alnum_prop": 0.4730843361856634, "repo_name": "designsecurity/progpilot", "id": "ed7cd555ab2f241ec868110ce1925391984dda9c", "size": "227767", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "projects/tests/testvulntestsuite.php", "mode": "33188", "license": "mit", "language": [ { "name": "CSS", "bytes": "13906" }, { "name": "JavaScript", "bytes": "1600" }, { "name": "PHP", "bytes": "2925528" }, { "name": "Shell", "bytes": "1006" } ], "symlink_target": "" }
function dateAutomater($compile) { "ngInject"; return { transclude: true, template: require('./dateAutomater.html'), restrict: 'AE', link: function ($scope, element, attrs) { $scope.dateInfo = $scope.dateInfo || {}; var dateInfo = $scope.dateInfo, input = element.find('input'), button = element.find('button'), name = input.name || 'date'+Object.keys($scope.dateInfo).length, info = { open: false, click: function() { this.open = true } } dateInfo[name] = info; input.attr('ng-model', attrs.dateAutomater); input.attr('ng-required', attrs.ngRequired); input.attr('ng-change', attrs.dateChange); input.attr('ng-class', attrs.dateInputClass); input.attr('datepicker-options', 'dateOptions'); input.attr('current-text', 'Hoy'); input.attr('clear-text', 'Limpiar'); input.attr('close-text', 'Cerrar'); input.attr('uib-datepicker-popup', 'dd/MM/yyyy'); input.attr('is-open', 'dateInfo[\"'+name+'\"].open'); button.attr('ng-click', 'dateInfo[\"'+name+'\"].click()'); $compile(element.contents())($scope); } } }; export default dateAutomater;
{ "content_hash": "defa60929f925208e441caf71befb852", "timestamp": "", "source": "github", "line_count": 37, "max_line_length": 80, "avg_line_length": 38.75675675675676, "alnum_prop": 0.500697350069735, "repo_name": "fredyrsam/quipuUtil_front", "id": "f23c80c53bccb1352c168d5603367cad92badbde", "size": "1434", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "src/app/directives/dateAutomater.js", "mode": "33188", "license": "mit", "language": [ { "name": "CSS", "bytes": "1501" }, { "name": "HTML", "bytes": "534" }, { "name": "JavaScript", "bytes": "6081" } ], "symlink_target": "" }
export { default } from './PluginCard.container'
{ "content_hash": "73879a4ee11087d79463fabe7b6f2878", "timestamp": "", "source": "github", "line_count": 1, "max_line_length": 48, "avg_line_length": 49, "alnum_prop": 0.7346938775510204, "repo_name": "Zenika/MARCEL", "id": "de46ba6ab477024db51129c6df625816953fee00", "size": "49", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "pkg/backoffice/src/plugins/PluginCard/index.js", "mode": "33188", "license": "mit", "language": [ { "name": "CSS", "bytes": "8464" }, { "name": "Dockerfile", "bytes": "687" }, { "name": "Go", "bytes": "71206" }, { "name": "HTML", "bytes": "3184" }, { "name": "JavaScript", "bytes": "159452" }, { "name": "Shell", "bytes": "674" } ], "symlink_target": "" }
@implementation MenuCell - (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier { self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]; if (self) { // Initialization code } return self; } - (void)setSelected:(BOOL)selected animated:(BOOL)animated { [super setSelected:selected animated:animated]; if(selected){ self.bgView.backgroundColor = self.mainColor; } else{ self.bgView.backgroundColor = self.darkColor; } } -(void)awakeFromNib{ self.mainColor = [UIColor colorWithRed:47.0/255 green:168.0/255 blue:228.0/255 alpha:1.0f]; self.darkColor = [UIColor colorWithRed:10.0/255 green:78.0/255 blue:108.0/255 alpha:1.0f]; self.bgView.backgroundColor = self.darkColor; self.topSeparator.backgroundColor = [UIColor clearColor]; self.bottomSeparator.backgroundColor = [UIColor colorWithWhite:0.9f alpha:0.2f]; NSString* boldFontName = @"Avenir-Black"; self.titleLabel.textColor = [UIColor whiteColor]; self.titleLabel.font = [UIFont fontWithName:boldFontName size:14.0f]; self.countLabel.textColor = [UIColor whiteColor]; self.countLabel.backgroundColor = self.mainColor; self.countLabel.font = [UIFont fontWithName:boldFontName size:14.0f]; self.countLabel.layer.cornerRadius = 3.0f; } @end
{ "content_hash": "3ce4dfa29f28e2c2ebb8068fe60d39c7", "timestamp": "", "source": "github", "line_count": 47, "max_line_length": 95, "avg_line_length": 29.659574468085108, "alnum_prop": 0.6994261119081779, "repo_name": "blakebrannon/OEAM", "id": "889c9ad9d2ce2a65dbca11055e1dc11c9629f8a9", "size": "1551", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "Project/awAcmeNotes/MenuCell.m", "mode": "33188", "license": "mit", "language": [ { "name": "C", "bytes": "6999" }, { "name": "Objective-C", "bytes": "931056" } ], "symlink_target": "" }
package com.resmed.refresh.model.json; import com.google.gson.annotations.*; public class SynopsisData { @SerializedName("BinSleepScoreDeep") private int BinSleepScoreDeep; @SerializedName("BinSleepScoreLight") private int BinSleepScoreLight; @SerializedName("BinSleepScoreOnset") private int BinSleepScoreOnset; @SerializedName("BinSleepScoreRem") private int BinSleepScoreRem; @SerializedName("BinSleepScoreTst") private int BinSleepScoreTst; @SerializedName("BinSleepScoreWaso") private int BinSleepScoreWaso; @SerializedName("AlarmFireEpoch") private int alarmFireEpoch; @SerializedName("BodyScore") private int bodyScore; @SerializedName("DeepSleepDuration") private int deepSleepDuration; @SerializedName("LightSleepDuration") private int lightSleepDuration; @SerializedName("MindScore") private int mindScore; @SerializedName("NumberOfInterruptions") private int numberOfInterruptions; @SerializedName("REMDuration") private int remDuration; @SerializedName("SignalQualityIsValid") private int signalQualityIsValid; @SerializedName("SignalQualityMean") private float signalQualityMean; @SerializedName("SignalQualityPercBin1") private float signalQualityPercBin1; @SerializedName("SignalQualityPercBin2") private float signalQualityPercBin2; @SerializedName("SignalQualityPercBin3") private float signalQualityPercBin3; @SerializedName("SignalQualityPercBin4") private float signalQualityPercBin4; @SerializedName("SignalQualityPercBin5") private float signalQualityPercBin5; @SerializedName("SignalQualityStd") private float signalQualityStd; @SerializedName("SignalQualityValue") private int signalQualityValue; @SerializedName("SleepScore") private int sleepScore; @SerializedName("TimeInBed") private int timeInBed; @SerializedName("TimeToSleep") private int timeToSleep; @SerializedName("TotalRecordingTime") private int totalRecordingTime; @SerializedName("TotalSleepTime") private int totalSleepTime; @SerializedName("TotalWakeTime") private int totalWakeTime; public SynopsisData() { this.signalQualityIsValid = 0; } public int getAlarmFireEpoch() { return this.alarmFireEpoch; } public int getBinSleepScoreDeep() { return this.BinSleepScoreDeep; } public int getBinSleepScoreLight() { return this.BinSleepScoreLight; } public int getBinSleepScoreOnset() { return this.BinSleepScoreOnset; } public int getBinSleepScoreRem() { return this.BinSleepScoreRem; } public int getBinSleepScoreTst() { return this.BinSleepScoreTst; } public int getBinSleepScoreWaso() { return this.BinSleepScoreWaso; } public int getBodyScore() { return this.bodyScore; } public int getDeepSleepDuration() { return this.deepSleepDuration; } public int getLightSleepDuration() { return this.lightSleepDuration; } public int getMindScore() { return this.mindScore; } public int getNumberOfInterruptions() { return this.numberOfInterruptions; } public int getRemDuration() { return this.remDuration; } public float getSignalQualityMean() { return this.signalQualityMean; } public float getSignalQualityPercBin1() { return this.signalQualityPercBin1; } public float getSignalQualityPercBin2() { return this.signalQualityPercBin2; } public float getSignalQualityPercBin3() { return this.signalQualityPercBin3; } public float getSignalQualityPercBin4() { return this.signalQualityPercBin4; } public float getSignalQualityPercBin5() { return this.signalQualityPercBin5; } public float getSignalQualityStd() { return this.signalQualityStd; } public int getSignalQualityValue() { return this.signalQualityValue; } public int getSleepScore() { return this.sleepScore; } public int getTimeInBed() { return this.timeInBed; } public int getTimeToSleep() { return this.timeToSleep; } public int getTotalRecordingTime() { return this.totalRecordingTime; } public int getTotalSleepTime() { return this.totalSleepTime; } public int getTotalWakeTime() { return this.totalWakeTime; } public void setAlarmFireEpoch(final int alarmFireEpoch) { this.alarmFireEpoch = alarmFireEpoch; } public void setBinSleepScoreDeep(final int binSleepScoreDeep) { this.BinSleepScoreDeep = binSleepScoreDeep; } public void setBinSleepScoreLight(final int binSleepScoreLight) { this.BinSleepScoreLight = binSleepScoreLight; } public void setBinSleepScoreOnset(final int binSleepScoreOnset) { this.BinSleepScoreOnset = binSleepScoreOnset; } public void setBinSleepScoreRem(final int binSleepScoreRem) { this.BinSleepScoreRem = binSleepScoreRem; } public void setBinSleepScoreTst(final int binSleepScoreTst) { this.BinSleepScoreTst = binSleepScoreTst; } public void setBinSleepScoreWaso(final int binSleepScoreWaso) { this.BinSleepScoreWaso = binSleepScoreWaso; } public void setBodyScore(final int bodyScore) { this.bodyScore = bodyScore; } public void setDeepSleepDuration(final int deepSleepDuration) { this.deepSleepDuration = deepSleepDuration; } public void setLightSleepDuration(final int lightSleepDuration) { this.lightSleepDuration = lightSleepDuration; } public void setMindScore(final int mindScore) { this.mindScore = mindScore; } public void setNumberOfInterruptions(final int numberOfInterruptions) { this.numberOfInterruptions = numberOfInterruptions; } public void setRemDuration(final int remDuration) { this.remDuration = remDuration; } public void setSignalQualityIsValid(final boolean b) { int signalQualityIsValid; if (b) { signalQualityIsValid = 1; } else { signalQualityIsValid = 0; } this.signalQualityIsValid = signalQualityIsValid; } public void setSignalQualityMean(final float signalQualityMean) { this.signalQualityMean = signalQualityMean; } public void setSignalQualityPercBin1(final float signalQualityPercBin1) { this.signalQualityPercBin1 = signalQualityPercBin1; } public void setSignalQualityPercBin2(final float signalQualityPercBin2) { this.signalQualityPercBin2 = signalQualityPercBin2; } public void setSignalQualityPercBin3(final float signalQualityPercBin3) { this.signalQualityPercBin3 = signalQualityPercBin3; } public void setSignalQualityPercBin4(final float signalQualityPercBin4) { this.signalQualityPercBin4 = signalQualityPercBin4; } public void setSignalQualityPercBin5(final float signalQualityPercBin5) { this.signalQualityPercBin5 = signalQualityPercBin5; } public void setSignalQualityStd(final float signalQualityStd) { this.signalQualityStd = signalQualityStd; } public void setSignalQualityValue(final int signalQualityValue) { this.signalQualityValue = signalQualityValue; } public void setSleepScore(final int sleepScore) { this.sleepScore = sleepScore; } public void setTimeInBed(final int timeInBed) { this.timeInBed = timeInBed; } public void setTimeToSleep(final int timeToSleep) { this.timeToSleep = timeToSleep; } public void setTotalRecordingTime(final int totalRecordingTime) { this.totalRecordingTime = totalRecordingTime; } public void setTotalSleepTime(final int totalSleepTime) { this.totalSleepTime = totalSleepTime; } public void setTotalWakeTime(final int totalWakeTime) { this.totalWakeTime = totalWakeTime; } public boolean signalQualityIsValid() { return this.signalQualityIsValid == 1; } }
{ "content_hash": "3a7d50828767cd0e03916d4d5ff08d2c", "timestamp": "", "source": "github", "line_count": 298, "max_line_length": 74, "avg_line_length": 24.75503355704698, "alnum_prop": 0.7907008268944015, "repo_name": "Venryx/LucidLink", "id": "9b96ebcbd1bd971416b2306f1e7e2ea65f49ba1f", "size": "7377", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "android/app/src/main/java/com/resmed/refresh/model/json/SynopsisData.java", "mode": "33188", "license": "mit", "language": [ { "name": "Batchfile", "bytes": "130" }, { "name": "Java", "bytes": "319937" }, { "name": "JavaScript", "bytes": "3435" }, { "name": "Objective-C", "bytes": "4425" }, { "name": "Python", "bytes": "1639" }, { "name": "TypeScript", "bytes": "393450" } ], "symlink_target": "" }
package factory.factorymethod; public class ChicagoStyleVeggiePizza extends Pizza { public ChicagoStyleVeggiePizza() { name = "Chicago Deep Dish Veggie Pizza"; dough = "Extra Thick Crust Dough"; sauce = "Plum Tomato Sauce"; toppings.add("Shredded Mozzarella Cheese"); toppings.add("Black Olives"); toppings.add("Spinach"); toppings.add("Eggplant"); } void cut() { System.out.println("Cutting the pizza into square slices"); } }
{ "content_hash": "4ac139ab40f9cce78c5c5bdfbecc3831", "timestamp": "", "source": "github", "line_count": 19, "max_line_length": 61, "avg_line_length": 23.94736842105263, "alnum_prop": 0.7142857142857143, "repo_name": "miguelalba89/HFDP", "id": "758c25034547b775ca0d45569a5ce3cbe65aa791", "size": "455", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "factory/factorymethod/ChicagoStyleVeggiePizza.java", "mode": "33188", "license": "mit", "language": [ { "name": "Java", "bytes": "192220" } ], "symlink_target": "" }
@include('votes.comment') <div id="comment-modal" class="modal fade" role="dialog"> <div class="modal-dialog" style="margin:80px auto"> <!-- Modal content--> <div class="modal-content"> <div class="modal-header"> <button type="button" class="close" data-dismiss="modal">&times;</button> <h4 class="modal-title">Comments</h4> </div> <div id="comment-modal-body" class="modal-body"> </div> <div class="modal-footer"> {!! Form::open(['id' => 'comment-form','url' => 'comments/create']) !!} {{Form::textarea('body','',array("placeholder" => "Enter your comment here...", "autocomplete" => "off", "class" => "textarea"))}} {{Form::button('Post Comment',array("onclick" => "postcomment()", "id" => "postCommentButton"))}} {!! Form::close() !!} </div> </div> </div> </div>
{ "content_hash": "78b5abb0d196099aa671931b9224bcae", "timestamp": "", "source": "github", "line_count": 21, "max_line_length": 146, "avg_line_length": 46.04761904761905, "alnum_prop": 0.5077559462254395, "repo_name": "okgreece/Alignment", "id": "665cc65d9a674d8db74e0551dd278d63ebc8abae", "size": "967", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "resources/views/votes/comment-modal.blade.php", "mode": "33188", "license": "mit", "language": [ { "name": "CSS", "bytes": "2259" }, { "name": "HTML", "bytes": "1984251" }, { "name": "JavaScript", "bytes": "2115585" }, { "name": "PHP", "bytes": "644677" }, { "name": "Shell", "bytes": "1525" } ], "symlink_target": "" }
<?php include_once ('../../includes/session.inc'); if ($_sql == '') { $_sql = "SELECT " . "user_prof_nm," . "CASE user_prof_status WHEN 'A' THEN \"Activo\" WHEN 'D' THEN \"Desactivado\" END AS state," . "user_prof_cd " . " FROM user_profile WHERE user_prof_lang='SP' AND user_prof_current_flag=1 GROUP BY user_prof_nm, state, user_prof_cd ORDER BY user_prof_nm asc"; } //echo $_sql; /*****************************************/ $con = mysql_connect("localhost", "sms", "qmmF85Nv") or die(mysql_error()); mysql_select_db("sms", $con) or die(mysql_error()); //Sentencia sql (sin limit) $_pagi_sql = $_sql; //cantidad de resultados por página (opcional, por defecto 20) $_pagi_cuantos = 20; //Elegí un número pequeño para que se generen varias páginas //cantidad de enlaces que se mostrarán como máximo en la barra de navegación $_pagi_nav_num_enlaces = 3; //Elegí un número pequeño para que se note el resultado //Decidimos si queremos que se muesten los errores de mysql $_pagi_mostrar_errores = true; //recomendado true sólo en tiempo de desarrollo. //Si tenemos una consulta compleja que hace que el Paginator no funcione correctamente, //realizamos el conteo alternativo. $_pagi_conteo_alternativo = true; //recomendado false. //Definimos qué estilo CSS se utilizará para los enlaces de paginación. //El estilo debe estar definido previamente $_pagi_nav_estilo = "forget"; //definimos qué irá en el enlace a la página anterior $_pagi_nav_anterior = "&lt;"; // podría ir un tag <img> o lo que sea //definimos qué irá en el enlace a la página siguiente $_pagi_nav_siguiente = "&gt;"; // podría ir un tag <img> o lo que sea /* while($row = mysql_fetch_array($_pagi_result)){ echo $row['cli_lastname']."<br />"; } */ //Incluimos el script de paginación. Éste ya ejecuta la consulta automáticamente include ("../../includes/paginador/paginator.inc.php"); include_once('../../includes/simplepage.class.php'); $obj = new simplepage(); $obj->setTitle($title); $obj->setCSS("../../includes/style/style.css"); echo $obj->getHeader(); $img_dir = "../../images"; ?> <br> <table cellpadding="2" cellspacing="0" border="0" width="50%" > <?php $actual = mysql_fetch_array($_pagi_result); $siguiente = mysql_fetch_array($_pagi_result); if ($actual) { echo '<tr>'; echo '<td colspan="3" class="titulo"><b>' . strtoupper(substr($actual['user_prof_nm'], 0, 1)) . '</b></td>'; echo '</tr>'; echo '<tr>'; echo '<td ><a href="../../control/profile/searchProfile.php?perfil=' . $actual['user_prof_cd'] . '&par=1&status=' . substr($actual[state], 0, 1) . '" style="color:##FF0000">' . $actual['user_prof_nm'] . '</a></td>'; echo '<td class="label">' . $actual['state'] . '</td>'; echo '</tr>'; while ($siguiente) { if (substr($actual['user_prof_nm'], 0, 1) != substr($siguiente['user_prof_nm'], 0, 1)) { echo '<tr>'; echo '<td colspan="3" class="titulo"><b>' . strtoupper(substr($siguiente['user_prof_nm'], 0, 1)) . '</b></td>'; echo '</tr>'; } $actual = $siguiente; echo '<tr>'; echo '<td ><a href="../../control/profile/searchProfile.php?perfil=' . $actual['user_prof_cd'] . '&par=1&status=' . substr($actual[state], 0, 1) . '" style="color:##FF0000">' . $actual['user_prof_nm'] . '</a></td>'; echo '<td class="label">' . $actual['state'] . '</td>'; echo '</tr>'; $siguiente = mysql_fetch_array($_pagi_result); } } else { echo ' <tr> <td><b>No se encontró ninguna conincidencia.</b></td> </tr>'; } ?> </table> <br><br><br><br><br><br><br><br><br> <?php //Incluimos la barra de navegación echo "<p>" . $_pagi_navegacion . "</p>"; //Incluimos la información de la página actual echo "<p>Mostrando Perfiles " . $_pagi_info . "</p>"; /******************************************/ echo $obj->getFooter(); ?>
{ "content_hash": "006cbc7fe0182889fa61ab835f015fdc", "timestamp": "", "source": "github", "line_count": 114, "max_line_length": 217, "avg_line_length": 34.324561403508774, "alnum_prop": 0.600306670074112, "repo_name": "carlosrojaso/websms", "id": "2dea3c855cf3ce27a9c6600a18232170cdb92297", "size": "3913", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "ui/profile/showProfiles.php", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "CSS", "bytes": "11980" }, { "name": "JavaScript", "bytes": "150076" }, { "name": "PHP", "bytes": "716591" } ], "symlink_target": "" }
package com.intel.analytics.bigdl.dllib.keras.layers import com.intel.analytics.bigdl.dllib.nn.{AddConstant => BAddConstant} import com.intel.analytics.bigdl.dllib.keras.layers.{AddConstant => ZAddConstant} import com.intel.analytics.bigdl.dllib.tensor.Tensor import com.intel.analytics.bigdl.dllib.utils.Shape import com.intel.analytics.bigdl.dllib.keras.ZooSpecHelper import com.intel.analytics.bigdl.dllib.keras.serializer.ModuleSerializationTest class AddConstantSpec extends ZooSpecHelper { "AddConstant 1 Zoo" should "be the same as BigDL" in { val blayer = BAddConstant[Float](1) val zlayer = ZAddConstant[Float](1, inputShape = Shape(4, 5)) zlayer.build(Shape(-1, 4, 5)) zlayer.getOutputShape().toSingle().toArray should be (Array(-1, 4, 5)) val input = Tensor[Float](Array(3, 4, 5)).rand() compareOutputAndGradInput(blayer, zlayer, input) } "AddConstant -0.4 Zoo" should "be the same as BigDL" in { val blayer = BAddConstant[Float](-0.4) val zlayer = ZAddConstant[Float](-0.4, inputShape = Shape(4, 8, 8)) zlayer.build(Shape(-1, 4, 8, 8)) zlayer.getOutputShape().toSingle().toArray should be (Array(-1, 4, 8, 8)) val input = Tensor[Float](Array(3, 4, 8, 8)).rand() compareOutputAndGradInput(blayer, zlayer, input) } } class AddConstantSerialTest extends ModuleSerializationTest { override def test(): Unit = { val layer = ZAddConstant[Float](1, inputShape = Shape(4, 5)) layer.build(Shape(2, 4, 5)) val input = Tensor[Float](2, 4, 5).rand() runSerializationTest(layer, input) } }
{ "content_hash": "a5f6d9e012d6abc6c105261341d06cd6", "timestamp": "", "source": "github", "line_count": 42, "max_line_length": 81, "avg_line_length": 37.476190476190474, "alnum_prop": 0.7147395171537484, "repo_name": "intel-analytics/BigDL", "id": "21d57a0b5b5af8b655d52a6212d0cf45ac9a4854", "size": "2175", "binary": false, "copies": "2", "ref": "refs/heads/main", "path": "scala/dllib/src/test/scala/com/intel/analytics/bigdl/dllib/keras/layers/AddConstantSpec.scala", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "C", "bytes": "5342" }, { "name": "Dockerfile", "bytes": "139304" }, { "name": "Java", "bytes": "1321348" }, { "name": "Jupyter Notebook", "bytes": "54112822" }, { "name": "Lua", "bytes": "1904" }, { "name": "Makefile", "bytes": "19253" }, { "name": "PowerShell", "bytes": "1137" }, { "name": "PureBasic", "bytes": "593" }, { "name": "Python", "bytes": "8825782" }, { "name": "RobotFramework", "bytes": "16117" }, { "name": "Scala", "bytes": "13216148" }, { "name": "Shell", "bytes": "848241" } ], "symlink_target": "" }
ig.module( 'game.entities.shadowship' ) .requires( 'game.entities.mover' ) .defines(function(){ EntityShadowship=EntityMover.extend({ followMinDis: 170, name: 'Shadowship', size: {x:400,y:400}, offset:{x:0,y:0}, maxVel: {x: 3000, y : 3000}, zIndex: 0, collides: ig.Entity.COLLIDES.NEVER, init: function( x, y, settings ) { this.control=false; this.following=false; this.animSheet = new ig.AnimationSheet( 'media/Transition4/ShipShadow.png',400 ,400 ), this.addAnim('smallest', 1, [0],true); this.addAnim('smaller', 1,[1], true); this.addAnim('bigger',1,[2], true); this.addAnim('biggest',1,[3],true); this.addAnim("none",1,[4],true); this.speed = 50; this.currentAnim = this.anims.biggest; this.parent( x, y, settings ); }, ready: function() { //this.followTarget=ig.game.getEntityByName('Taylor'); }, update: function() { this.parent(); this.currentAnim.angle = -90 /180 * Math.PI; }, draw: function() { this.parent(); this.zIndex = 20; } }); });
{ "content_hash": "279565cb6385070bbb9b4ce7b933b506", "timestamp": "", "source": "github", "line_count": 49, "max_line_length": 96, "avg_line_length": 22.163265306122447, "alnum_prop": 0.6012891344383057, "repo_name": "SabunMacTavish/CTF-Platform", "id": "a84eb79522c46e08d791a075885b98b552a14c45", "size": "1086", "binary": false, "copies": "2", "ref": "refs/heads/master", "path": "web/compete/lib/game/entities/shadowship.js", "mode": "33261", "license": "mit", "language": [ { "name": "Batchfile", "bytes": "463" }, { "name": "CSS", "bytes": "8652" }, { "name": "CoffeeScript", "bytes": "12712" }, { "name": "HTML", "bytes": "35798" }, { "name": "Java", "bytes": "664" }, { "name": "JavaScript", "bytes": "275683" }, { "name": "PHP", "bytes": "10076" }, { "name": "Python", "bytes": "56431" }, { "name": "Shell", "bytes": "1232" } ], "symlink_target": "" }
<?xml version="1.0" encoding="utf-8"?> <selector xmlns:android="http://schemas.android.com/apk/res/android"> <item android:drawable="@android:color/black"/> </selector>
{ "content_hash": "c3d05bea4e6a371e110ebf198e5ccff4", "timestamp": "", "source": "github", "line_count": 4, "max_line_length": 69, "avg_line_length": 43, "alnum_prop": 0.7093023255813954, "repo_name": "androidroadies/AndroidUtils", "id": "5b6d8cbc43a9ca3bf4bbc298bacc69d886c01fc4", "size": "172", "binary": false, "copies": "2", "ref": "refs/heads/master", "path": "app/src/main/res/drawable/black_button_background.xml", "mode": "33188", "license": "mit", "language": [ { "name": "HTML", "bytes": "63368" }, { "name": "Java", "bytes": "2261112" } ], "symlink_target": "" }
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <title>verdi: 3 m 43 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 / extra-dev</a></li> <li class="active"><a href="">8.10.dev / verdi - dev</a></li> </ul> </div> </div> </div> <div class="article"> <div class="row"> <div class="col-md-12"> <a href="../..">« Up</a> <h1> verdi <small> dev <span class="label label-success">3 m 43 s</span> </small> </h1> <p><em><script>document.write(moment("2020-03-17 10:27:16 +0000", "YYYY-MM-DD HH:mm:ss Z").fromNow());</script> (2020-03-17 10:27:16 UTC)</em><p> <h2>Context</h2> <pre># Packages matching: installed # Name # Installed # Synopsis base-bigarray base base-threads base base-unix base conf-findutils 1 Virtual package relying on findutils conf-m4 1 Virtual package relying on m4 coq 8.10.dev Formal proof management system num 1.3 The legacy Num library for arbitrary-precision integer and rational arithmetic ocaml 4.09.0 The OCaml compiler (virtual package) ocaml-base-compiler 4.09.0 Official release 4.09.0 ocaml-config 1 OCaml Switch Configuration ocamlfind 1.8.1 A library manager for OCaml # opam file: opam-version: &quot;2.0&quot; maintainer: &quot;[email protected]&quot; homepage: &quot;https://github.com/uwplse/verdi&quot; dev-repo: &quot;git+https://github.com/uwplse/verdi.git&quot; bug-reports: &quot;https://github.com/uwplse/verdi/issues&quot; license: &quot;BSD-2-Clause&quot; synopsis: &quot;Framework for verification of implementations of distributed systems in Coq&quot; description: &quot;&quot;&quot; Verdi is a Coq framework to implement and formally verify distributed systems. Verdi supports several different fault models ranging from idealistic to realistic. Verdi&#39;s verified system transformers (VSTs) encapsulate common fault tolerance techniques. Developers can verify an application in an idealized fault model, and then apply a VST to obtain an application that is guaranteed to have analogous properties in a more adversarial environment. &quot;&quot;&quot; build: [ [&quot;./configure&quot;] [make &quot;-j%{jobs}%&quot;] ] install: [make &quot;install&quot;] depends: [ &quot;coq&quot; {(&gt;= &quot;8.7&quot; &amp; &lt; &quot;8.12~&quot;) | (= &quot;dev&quot;)} &quot;coq-inf-seq-ext&quot; {= &quot;dev&quot;} &quot;coq-struct-tact&quot; {= &quot;dev&quot;} &quot;coq-cheerios&quot; {= &quot;dev&quot;} ] tags: [ &quot;category:Computer Science/Concurrent Systems and Protocols/Theory of concurrent systems&quot; &quot;keyword:program verification&quot; &quot;keyword:distributed algorithms&quot; &quot;logpath:Verdi&quot; ] authors: [ &quot;Justin Adsuara&quot; &quot;Steve Anton&quot; &quot;Ryan Doenges&quot; &quot;Karl Palmskog&quot; &quot;Pavel Panchekha&quot; &quot;Zachary Tatlock&quot; &quot;James R. Wilcox&quot; &quot;Doug Woos&quot; ] url { src: &quot;git+https://github.com/uwplse/verdi.git#master&quot; } </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-verdi.dev coq.8.10.dev</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-verdi.dev coq.8.10.dev</code></dd> <dt>Return code</dt> <dd>0</dd> <dt>Duration</dt> <dd>1 m 6 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 coq-verdi.dev coq.8.10.dev</code></dd> <dt>Return code</dt> <dd>0</dd> <dt>Duration</dt> <dd>3 m 43 s</dd> </dl> <h2>Installation size</h2> <p>Total: 12 M</p> <ul> <li>2 M <code>../ocaml-base-compiler.4.09.0/lib/coq/user-contrib/Verdi/LiveLockServ.vo</code></li> <li>1 M <code>../ocaml-base-compiler.4.09.0/lib/coq/user-contrib/Verdi/PrimaryBackup.vo</code></li> <li>1 M <code>../ocaml-base-compiler.4.09.0/lib/coq/user-contrib/Verdi/PartialMapExecutionSimulations.vo</code></li> <li>783 K <code>../ocaml-base-compiler.4.09.0/lib/coq/user-contrib/Verdi/TotalMapSimulations.vo</code></li> <li>726 K <code>../ocaml-base-compiler.4.09.0/lib/coq/user-contrib/Verdi/LockServ.vo</code></li> <li>678 K <code>../ocaml-base-compiler.4.09.0/lib/coq/user-contrib/Verdi/FMapVeryWeak.vo</code></li> <li>500 K <code>../ocaml-base-compiler.4.09.0/lib/coq/user-contrib/Verdi/PartialMapSimulations.vo</code></li> <li>389 K <code>../ocaml-base-compiler.4.09.0/lib/coq/user-contrib/Verdi/TotalMapExecutionSimulations.vo</code></li> <li>336 K <code>../ocaml-base-compiler.4.09.0/lib/coq/user-contrib/Verdi/SeqNumCorrect.vo</code></li> <li>328 K <code>../ocaml-base-compiler.4.09.0/lib/coq/user-contrib/Verdi/PartialExtendedMapSimulations.vo</code></li> <li>257 K <code>../ocaml-base-compiler.4.09.0/lib/coq/user-contrib/Verdi/LiveLockServ.glob</code></li> <li>246 K <code>../ocaml-base-compiler.4.09.0/lib/coq/user-contrib/Verdi/LabeledNet.vo</code></li> <li>234 K <code>../ocaml-base-compiler.4.09.0/lib/coq/user-contrib/Verdi/LogCorrect.vo</code></li> <li>210 K <code>../ocaml-base-compiler.4.09.0/lib/coq/user-contrib/Verdi/SerializedMsgParamsCorrect.vo</code></li> <li>195 K <code>../ocaml-base-compiler.4.09.0/lib/coq/user-contrib/Verdi/TotalMapSimulations.glob</code></li> <li>193 K <code>../ocaml-base-compiler.4.09.0/lib/coq/user-contrib/Verdi/VarD.vo</code></li> <li>186 K <code>../ocaml-base-compiler.4.09.0/lib/coq/user-contrib/Verdi/PartialMapSimulations.glob</code></li> <li>183 K <code>../ocaml-base-compiler.4.09.0/lib/coq/user-contrib/Verdi/Counter.vo</code></li> <li>179 K <code>../ocaml-base-compiler.4.09.0/lib/coq/user-contrib/Verdi/Net.vo</code></li> <li>170 K <code>../ocaml-base-compiler.4.09.0/lib/coq/user-contrib/Verdi/PrimaryBackup.glob</code></li> <li>154 K <code>../ocaml-base-compiler.4.09.0/lib/coq/user-contrib/Verdi/GhostSimulations.vo</code></li> <li>149 K <code>../ocaml-base-compiler.4.09.0/lib/coq/user-contrib/Verdi/LockServ.glob</code></li> <li>147 K <code>../ocaml-base-compiler.4.09.0/lib/coq/user-contrib/Verdi/PartialMapExecutionSimulations.glob</code></li> <li>147 K <code>../ocaml-base-compiler.4.09.0/lib/coq/user-contrib/Verdi/SingleSimulations.vo</code></li> <li>131 K <code>../ocaml-base-compiler.4.09.0/lib/coq/user-contrib/Verdi/Net.glob</code></li> <li>131 K <code>../ocaml-base-compiler.4.09.0/lib/coq/user-contrib/Verdi/DynamicNetLemmas.vo</code></li> <li>120 K <code>../ocaml-base-compiler.4.09.0/lib/coq/user-contrib/Verdi/PartialExtendedMapSimulations.glob</code></li> <li>110 K <code>../ocaml-base-compiler.4.09.0/lib/coq/user-contrib/Verdi/StatePacketPacketDecomposition.vo</code></li> <li>99 K <code>../ocaml-base-compiler.4.09.0/lib/coq/user-contrib/Verdi/LabeledNet.glob</code></li> <li>98 K <code>../ocaml-base-compiler.4.09.0/lib/coq/user-contrib/Verdi/SerializedMsgParamsCorrect.glob</code></li> <li>85 K <code>../ocaml-base-compiler.4.09.0/lib/coq/user-contrib/Verdi/TotalMapExecutionSimulations.glob</code></li> <li>77 K <code>../ocaml-base-compiler.4.09.0/lib/coq/user-contrib/Verdi/LiveLockServ.v</code></li> <li>74 K <code>../ocaml-base-compiler.4.09.0/lib/coq/user-contrib/Verdi/VarDPrimaryBackup.vo</code></li> <li>68 K <code>../ocaml-base-compiler.4.09.0/lib/coq/user-contrib/Verdi/GhostSimulations.glob</code></li> <li>68 K <code>../ocaml-base-compiler.4.09.0/lib/coq/user-contrib/Verdi/SeqNumCorrect.glob</code></li> <li>59 K <code>../ocaml-base-compiler.4.09.0/lib/coq/user-contrib/Verdi/Log.vo</code></li> <li>58 K <code>../ocaml-base-compiler.4.09.0/lib/coq/user-contrib/Verdi/TotalMapSimulations.v</code></li> <li>58 K <code>../ocaml-base-compiler.4.09.0/lib/coq/user-contrib/Verdi/DupDropReordering.vo</code></li> <li>58 K <code>../ocaml-base-compiler.4.09.0/lib/coq/user-contrib/Verdi/NameOverlay.vo</code></li> <li>54 K <code>../ocaml-base-compiler.4.09.0/lib/coq/user-contrib/Verdi/SeqNum.vo</code></li> <li>53 K <code>../ocaml-base-compiler.4.09.0/lib/coq/user-contrib/Verdi/PartialMapSimulations.v</code></li> <li>44 K <code>../ocaml-base-compiler.4.09.0/lib/coq/user-contrib/Verdi/SerializedMsgParams.vo</code></li> <li>43 K <code>../ocaml-base-compiler.4.09.0/lib/coq/user-contrib/Verdi/Counter.glob</code></li> <li>43 K <code>../ocaml-base-compiler.4.09.0/lib/coq/user-contrib/Verdi/PartialMapExecutionSimulations.v</code></li> <li>42 K <code>../ocaml-base-compiler.4.09.0/lib/coq/user-contrib/Verdi/TraceRelations.vo</code></li> <li>41 K <code>../ocaml-base-compiler.4.09.0/lib/coq/user-contrib/Verdi/InverseTraceRelations.vo</code></li> <li>41 K <code>../ocaml-base-compiler.4.09.0/lib/coq/user-contrib/Verdi/PrimaryBackup.v</code></li> <li>40 K <code>../ocaml-base-compiler.4.09.0/lib/coq/user-contrib/Verdi/StatePacketPacketDecomposition.glob</code></li> <li>40 K <code>../ocaml-base-compiler.4.09.0/lib/coq/user-contrib/Verdi/LockServ.v</code></li> <li>40 K <code>../ocaml-base-compiler.4.09.0/lib/coq/user-contrib/Verdi/LogCorrect.glob</code></li> <li>38 K <code>../ocaml-base-compiler.4.09.0/lib/coq/user-contrib/Verdi/VarD.glob</code></li> <li>37 K <code>../ocaml-base-compiler.4.09.0/lib/coq/user-contrib/Verdi/LockServSeqNum.vo</code></li> <li>34 K <code>../ocaml-base-compiler.4.09.0/lib/coq/user-contrib/Verdi/Verdi.vo</code></li> <li>34 K <code>../ocaml-base-compiler.4.09.0/lib/coq/user-contrib/Verdi/SingleSimulations.glob</code></li> <li>32 K <code>../ocaml-base-compiler.4.09.0/lib/coq/user-contrib/Verdi/PartialExtendedMapSimulations.v</code></li> <li>31 K <code>../ocaml-base-compiler.4.09.0/lib/coq/user-contrib/Verdi/ExtrOcamlDiskOp.vo</code></li> <li>29 K <code>../ocaml-base-compiler.4.09.0/lib/coq/user-contrib/Verdi/ExtrOcamlFinInt.vo</code></li> <li>29 K <code>../ocaml-base-compiler.4.09.0/lib/coq/user-contrib/Verdi/SerializedMsgParamsCorrect.v</code></li> <li>28 K <code>../ocaml-base-compiler.4.09.0/lib/coq/user-contrib/Verdi/Net.v</code></li> <li>25 K <code>../ocaml-base-compiler.4.09.0/lib/coq/user-contrib/Verdi/SeqNumCorrect.v</code></li> <li>25 K <code>../ocaml-base-compiler.4.09.0/lib/coq/user-contrib/Verdi/HandlerMonad.vo</code></li> <li>25 K <code>../ocaml-base-compiler.4.09.0/lib/coq/user-contrib/Verdi/VerdiHints.vo</code></li> <li>22 K <code>../ocaml-base-compiler.4.09.0/lib/coq/user-contrib/Verdi/LabeledNet.v</code></li> <li>22 K <code>../ocaml-base-compiler.4.09.0/lib/coq/user-contrib/Verdi/TotalMapExecutionSimulations.v</code></li> <li>19 K <code>../ocaml-base-compiler.4.09.0/lib/coq/user-contrib/Verdi/FMapVeryWeak.glob</code></li> <li>19 K <code>../ocaml-base-compiler.4.09.0/lib/coq/user-contrib/Verdi/DupDropReordering.glob</code></li> <li>18 K <code>../ocaml-base-compiler.4.09.0/lib/coq/user-contrib/Verdi/GhostSimulations.v</code></li> <li>16 K <code>../ocaml-base-compiler.4.09.0/lib/coq/user-contrib/Verdi/StateMachineHandlerMonad.vo</code></li> <li>15 K <code>../ocaml-base-compiler.4.09.0/lib/coq/user-contrib/Verdi/ExtrOcamlNatIntExt.vo</code></li> <li>15 K <code>../ocaml-base-compiler.4.09.0/lib/coq/user-contrib/Verdi/DynamicNetLemmas.glob</code></li> <li>15 K <code>../ocaml-base-compiler.4.09.0/lib/coq/user-contrib/Verdi/NameOverlay.glob</code></li> <li>15 K <code>../ocaml-base-compiler.4.09.0/lib/coq/user-contrib/Verdi/Log.glob</code></li> <li>13 K <code>../ocaml-base-compiler.4.09.0/lib/coq/user-contrib/Verdi/HandlerMonad.glob</code></li> <li>13 K <code>../ocaml-base-compiler.4.09.0/lib/coq/user-contrib/Verdi/LogCorrect.v</code></li> <li>12 K <code>../ocaml-base-compiler.4.09.0/lib/coq/user-contrib/Verdi/Counter.v</code></li> <li>10 K <code>../ocaml-base-compiler.4.09.0/lib/coq/user-contrib/Verdi/VarD.v</code></li> <li>10 K <code>../ocaml-base-compiler.4.09.0/lib/coq/user-contrib/Verdi/ExtrOcamlList.vo</code></li> <li>10 K <code>../ocaml-base-compiler.4.09.0/lib/coq/user-contrib/Verdi/SeqNum.glob</code></li> <li>9 K <code>../ocaml-base-compiler.4.09.0/lib/coq/user-contrib/Verdi/SingleSimulations.v</code></li> <li>8 K <code>../ocaml-base-compiler.4.09.0/lib/coq/user-contrib/Verdi/StatePacketPacketDecomposition.v</code></li> <li>8 K <code>../ocaml-base-compiler.4.09.0/lib/coq/user-contrib/Verdi/SerializedMsgParams.glob</code></li> <li>7 K <code>../ocaml-base-compiler.4.09.0/lib/coq/user-contrib/Verdi/DynamicNetLemmas.v</code></li> <li>7 K <code>../ocaml-base-compiler.4.09.0/lib/coq/user-contrib/Verdi/StateMachineHandlerMonad.glob</code></li> <li>6 K <code>../ocaml-base-compiler.4.09.0/lib/coq/user-contrib/Verdi/DupDropReordering.v</code></li> <li>6 K <code>../ocaml-base-compiler.4.09.0/lib/coq/user-contrib/Verdi/VarDPrimaryBackup.glob</code></li> <li>5 K <code>../ocaml-base-compiler.4.09.0/lib/coq/user-contrib/Verdi/FMapVeryWeak.v</code></li> <li>4 K <code>../ocaml-base-compiler.4.09.0/lib/coq/user-contrib/Verdi/InverseTraceRelations.glob</code></li> <li>4 K <code>../ocaml-base-compiler.4.09.0/lib/coq/user-contrib/Verdi/TraceRelations.glob</code></li> <li>4 K <code>../ocaml-base-compiler.4.09.0/lib/coq/user-contrib/Verdi/NameOverlay.v</code></li> <li>4 K <code>../ocaml-base-compiler.4.09.0/lib/coq/user-contrib/Verdi/Log.v</code></li> <li>3 K <code>../ocaml-base-compiler.4.09.0/lib/coq/user-contrib/Verdi/SerializedMsgParams.v</code></li> <li>3 K <code>../ocaml-base-compiler.4.09.0/lib/coq/user-contrib/Verdi/VarDPrimaryBackup.v</code></li> <li>3 K <code>../ocaml-base-compiler.4.09.0/lib/coq/user-contrib/Verdi/LockServSeqNum.glob</code></li> <li>3 K <code>../ocaml-base-compiler.4.09.0/lib/coq/user-contrib/Verdi/SeqNum.v</code></li> <li>2 K <code>../ocaml-base-compiler.4.09.0/lib/coq/user-contrib/Verdi/HandlerMonad.v</code></li> <li>2 K <code>../ocaml-base-compiler.4.09.0/lib/coq/user-contrib/Verdi/ExtrOcamlBool.vo</code></li> <li>2 K <code>../ocaml-base-compiler.4.09.0/lib/coq/user-contrib/Verdi/Ssrexport.vo</code></li> <li>2 K <code>../ocaml-base-compiler.4.09.0/lib/coq/user-contrib/Verdi/StateMachineHandlerMonad.v</code></li> <li>2 K <code>../ocaml-base-compiler.4.09.0/lib/coq/user-contrib/Verdi/ExtrOcamlBasicExt.vo</code></li> <li>1 K <code>../ocaml-base-compiler.4.09.0/lib/coq/user-contrib/Verdi/TraceRelations.v</code></li> <li>1 K <code>../ocaml-base-compiler.4.09.0/lib/coq/user-contrib/Verdi/InverseTraceRelations.v</code></li> <li>1 K <code>../ocaml-base-compiler.4.09.0/lib/coq/user-contrib/Verdi/LockServSeqNum.v</code></li> <li>1 K <code>../ocaml-base-compiler.4.09.0/lib/coq/user-contrib/Verdi/ExtrOcamlFinInt.v</code></li> <li>1 K <code>../ocaml-base-compiler.4.09.0/lib/coq/user-contrib/Verdi/ExtrOcamlList.v</code></li> <li>1 K <code>../ocaml-base-compiler.4.09.0/lib/coq/user-contrib/Verdi/Verdi.glob</code></li> <li>1 K <code>../ocaml-base-compiler.4.09.0/lib/coq/user-contrib/Verdi/ExtrOcamlNatIntExt.v</code></li> <li>1 K <code>../ocaml-base-compiler.4.09.0/lib/coq/user-contrib/Verdi/Verdi.v</code></li> <li>1 K <code>../ocaml-base-compiler.4.09.0/lib/coq/user-contrib/Verdi/ExtrOcamlNatIntExt.glob</code></li> <li>1 K <code>../ocaml-base-compiler.4.09.0/lib/coq/user-contrib/Verdi/ExtrOcamlBool.v</code></li> <li>1 K <code>../ocaml-base-compiler.4.09.0/lib/coq/user-contrib/Verdi/ExtrOcamlDiskOp.glob</code></li> <li>1 K <code>../ocaml-base-compiler.4.09.0/lib/coq/user-contrib/Verdi/ExtrOcamlDiskOp.v</code></li> <li>1 K <code>../ocaml-base-compiler.4.09.0/lib/coq/user-contrib/Verdi/ExtrOcamlFinInt.glob</code></li> <li>1 K <code>../ocaml-base-compiler.4.09.0/lib/coq/user-contrib/Verdi/Ssrexport.v</code></li> <li>1 K <code>../ocaml-base-compiler.4.09.0/lib/coq/user-contrib/Verdi/ExtrOcamlList.glob</code></li> <li>1 K <code>../ocaml-base-compiler.4.09.0/lib/coq/user-contrib/Verdi/ExtrOcamlBool.glob</code></li> <li>1 K <code>../ocaml-base-compiler.4.09.0/lib/coq/user-contrib/Verdi/ExtrOcamlBasicExt.glob</code></li> <li>1 K <code>../ocaml-base-compiler.4.09.0/lib/coq/user-contrib/Verdi/VerdiHints.v</code></li> <li>1 K <code>../ocaml-base-compiler.4.09.0/lib/coq/user-contrib/Verdi/ExtrOcamlBasicExt.v</code></li> <li>1 K <code>../ocaml-base-compiler.4.09.0/lib/coq/user-contrib/Verdi/Ssrexport.glob</code></li> <li>1 K <code>../ocaml-base-compiler.4.09.0/lib/coq/user-contrib/Verdi/VerdiHints.glob</code></li> </ul> <h2>Uninstall</h2> <dl class="dl-horizontal"> <dt>Command</dt> <dd><code>opam remove -y coq-verdi.dev</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>
{ "content_hash": "28cd04f795fa36e17be4e2b764975fc3", "timestamp": "", "source": "github", "line_count": 299, "max_line_length": 157, "avg_line_length": 71.04013377926421, "alnum_prop": 0.6116002071465562, "repo_name": "coq-bench/coq-bench.github.io", "id": "6d6e3fa9c2384fe337f18e536be329a1dffa3073", "size": "21243", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "clean/Linux-x86_64-4.09.0-2.0.5/extra-dev/8.10.dev/verdi/dev.html", "mode": "33188", "license": "mit", "language": [], "symlink_target": "" }
from datetime import datetime from functools import reduce from os import makedirs, remove from os.path import join, exists, isdir def song_exists(song_title, playlist_name, music_base_path, special_playlist): song_path = join(get_song_path(playlist_name, music_base_path, special_playlist), song_title) to_remove_song=False if exists(song_path + '.mp3'): if exists(song_path + '.webm'): remove(song_path + '.webm') to_remove_song=True if exists(song_path + '.jpg'): remove(song_path + '.jpg') to_remove_song=True if exists(song_path + '.webm.part'): remove(song_path + '.webm.part') to_remove_song=True if exists(song_path + '.part'): remove(song_path + '.part') to_remove_song=True if to_remove_song: remove(song_path + '.mp3') return False else: return True else: return False def get_song_path(playlist_name, music_base_path, special_playlist): if playlist_name in special_playlist: song_path = reduce(join, [music_base_path, str(datetime.now().year), '{} {}'.format(datetime.now().year, _get_season())]) else: song_path = join(music_base_path, playlist_name) if not isdir(song_path): makedirs(song_path) return song_path def _get_season(): month = datetime.now().month if month == 12 or month < 3: return 'tel' elif 2 < month < 6: return 'tavasz' elif 5 < month < 9: return 'nyar' else: return 'osz'
{ "content_hash": "554bfe78613284ab62d6528b812b3cd9", "timestamp": "", "source": "github", "line_count": 51, "max_line_length": 97, "avg_line_length": 32.23529411764706, "alnum_prop": 0.5717761557177615, "repo_name": "zsoman/youtube-downloader", "id": "3d99ae6195cb1221165198452b3b50fe4fed5fde", "size": "1644", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "lib/python/file_handler.py", "mode": "33188", "license": "mit", "language": [ { "name": "Python", "bytes": "11636" } ], "symlink_target": "" }
namespace SpiceToken { TokenNode::TokenNode(TokenType tokenType, std::string tokenData, int lineNumber, int characterNumber) { _nodeType = tokenType; _nodeData = tokenData; _lineNumber = lineNumber; _characterNumber = characterNumber; }; TokenType TokenNode::GetType() { return _nodeType; } std::string TokenNode::GetData() { return _nodeData; } int TokenNode::GetLineNumber() { return _lineNumber; } int TokenNode::GetCharacterNumber() { return _characterNumber; } }
{ "content_hash": "e35502348c04a4b2ce994adc69fe9662", "timestamp": "", "source": "github", "line_count": 30, "max_line_length": 105, "avg_line_length": 19.866666666666667, "alnum_prop": 0.6006711409395973, "repo_name": "cbycraft/CarlRepo", "id": "7313645c1021013d08d4f9b8935271263b57ac8e", "size": "997", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "learning/Cpp/TestCpp/ClassAndStructTest/SpiceToken.cpp", "mode": "33188", "license": "mit", "language": [ { "name": "C", "bytes": "7606" }, { "name": "C#", "bytes": "20086" }, { "name": "C++", "bytes": "26025" }, { "name": "CSS", "bytes": "450" }, { "name": "HTML", "bytes": "1666" }, { "name": "JavaScript", "bytes": "8821" }, { "name": "Makefile", "bytes": "1243" }, { "name": "Python", "bytes": "2177" }, { "name": "TypeScript", "bytes": "1782" } ], "symlink_target": "" }
<?php class WCML_Aurum{ function __construct(){ add_filter( 'wcml_multi_currency_ajax_actions', array( $this,'add_ajax_action' ) ); } function add_ajax_action( $actions ){ $actions[] = 'lab_wc_add_to_cart'; return $actions; } }
{ "content_hash": "8a0b830396381c256bc4b103bd1ec4c5", "timestamp": "", "source": "github", "line_count": 17, "max_line_length": 91, "avg_line_length": 17.176470588235293, "alnum_prop": 0.5308219178082192, "repo_name": "tedc/castadiva-deploy", "id": "b0752b9d75a35eede51f62a1c3369a11ffffb6ab", "size": "292", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "web/app/plugins/woocommerce-multilingual/compatibility/class-wcml-aurum.php", "mode": "33188", "license": "mit", "language": [ { "name": "ApacheConf", "bytes": "26" }, { "name": "CSS", "bytes": "2897606" }, { "name": "HTML", "bytes": "384452" }, { "name": "JavaScript", "bytes": "4798923" }, { "name": "PHP", "bytes": "27857199" }, { "name": "Ruby", "bytes": "1008" } ], "symlink_target": "" }
package storm.kafka.trident; import com.google.common.base.Objects; import storm.kafka.Broker; import storm.kafka.Partition; import java.io.Serializable; import java.util.*; public class GlobalPartitionInformation implements Iterable<Partition>, Serializable { private Map<Integer, Broker> partitionMap; public GlobalPartitionInformation() { partitionMap = new TreeMap<Integer, Broker>(); } public void addPartition(int partitionId, Broker broker) { partitionMap.put(partitionId, broker); } @Override public String toString() { return "GlobalPartitionInformation{" + "partitionMap=" + partitionMap + '}'; } public Broker getBrokerFor(Integer partitionId) { return partitionMap.get(partitionId); } public List<Partition> getOrderedPartitions() { List<Partition> partitions = new LinkedList<Partition>(); for (Map.Entry<Integer, Broker> partition : partitionMap.entrySet()) { partitions.add(new Partition(partition.getValue(), partition.getKey())); } return partitions; } @Override public Iterator<Partition> iterator() { final Iterator<Map.Entry<Integer, Broker>> iterator = partitionMap.entrySet().iterator(); return new Iterator<Partition>() { @Override public boolean hasNext() { return iterator.hasNext(); } @Override public Partition next() { Map.Entry<Integer, Broker> next = iterator.next(); return new Partition(next.getValue(), next.getKey()); } @Override public void remove() { iterator.remove(); } }; } @Override public int hashCode() { return Objects.hashCode(partitionMap); } @Override public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null || getClass() != obj.getClass()) { return false; } final GlobalPartitionInformation other = (GlobalPartitionInformation) obj; return Objects.equal(this.partitionMap, other.partitionMap); } }
{ "content_hash": "37ffe7d36ee9b2bd0a84e57d5dd368b1", "timestamp": "", "source": "github", "line_count": 82, "max_line_length": 97, "avg_line_length": 27.5609756097561, "alnum_prop": 0.602212389380531, "repo_name": "Aloomaio/incubator-storm", "id": "76bec9e4385d6dffd21910040ac92583b9f092b6", "size": "3062", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "external/storm-kafka/src/jvm/storm/kafka/trident/GlobalPartitionInformation.java", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "C", "bytes": "52821" }, { "name": "C++", "bytes": "1650" }, { "name": "CSS", "bytes": "63637" }, { "name": "Clojure", "bytes": "894325" }, { "name": "Fancy", "bytes": "6234" }, { "name": "Java", "bytes": "2976712" }, { "name": "JavaScript", "bytes": "83688" }, { "name": "Python", "bytes": "357373" }, { "name": "Ruby", "bytes": "19946" }, { "name": "Shell", "bytes": "11945" }, { "name": "Thrift", "bytes": "9946" } ], "symlink_target": "" }
using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using Android.App; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("CompressedVideoDemo.Android")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("CompressedVideoDemo.Android")] [assembly: AssemblyCopyright("Copyright © 2014")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] [assembly: ComVisible(false)] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.0.0.0")] [assembly: AssemblyFileVersion("1.0.0.0")] // Add some common permissions, these can be removed if not needed [assembly: UsesPermission(Android.Manifest.Permission.Internet)] [assembly: UsesPermission(Android.Manifest.Permission.WriteExternalStorage)]
{ "content_hash": "8b69eff6f58856cfeeb33408d1321c98", "timestamp": "", "source": "github", "line_count": 34, "max_line_length": 84, "avg_line_length": 38.26470588235294, "alnum_prop": 0.760184473481937, "repo_name": "Xamarians/Samples", "id": "6b7236db47bc24c412c47dc83c08670bff4640c7", "size": "1304", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "CompressedVideoDemo/CompressedVideoDemo/CompressedVideoDemo.Android/Properties/AssemblyInfo.cs", "mode": "33188", "license": "mit", "language": [ { "name": "C#", "bytes": "451170" } ], "symlink_target": "" }
package main import ( "fmt" "io" "os" "strings" "time" "gopkg.in/lxc/go-lxc.v2" "github.com/lxc/lxd/shared" log "gopkg.in/inconshreveable/log15.v2" ) // Helper functions func containerPath(name string, isSnapshot bool) string { if isSnapshot { return shared.VarPath("snapshots", name) } return shared.VarPath("containers", name) } func containerValidName(name string) error { if strings.Contains(name, shared.SnapshotDelimiter) { return fmt.Errorf( "The character '%s' is reserved for snapshots.", shared.SnapshotDelimiter) } if !shared.ValidHostname(name) { return fmt.Errorf("Container name isn't a valid hostname.") } return nil } func containerValidConfigKey(k string) bool { switch k { case "boot.autostart": return true case "boot.autostart.delay": return true case "boot.autostart.priority": return true case "limits.cpu": return true case "limits.cpu.allowance": return true case "limits.cpu.priority": return true case "limits.disk.priority": return true case "limits.memory": return true case "limits.memory.enforce": return true case "limits.memory.swap": return true case "limits.memory.swap.priority": return true case "limits.network.priority": return true case "linux.kernel_modules": return true case "security.privileged": return true case "security.nesting": return true case "raw.apparmor": return true case "raw.lxc": return true case "volatile.base_image": return true case "volatile.last_state.idmap": return true case "volatile.last_state.power": return true } if strings.HasPrefix(k, "volatile.") { if strings.HasSuffix(k, ".hwaddr") { return true } if strings.HasSuffix(k, ".name") { return true } } if strings.HasPrefix(k, "environment.") { return true } if strings.HasPrefix(k, "user.") { return true } return false } func containerValidDeviceConfigKey(t, k string) bool { if k == "type" { return true } switch t { case "unix-char": switch k { case "gid": return true case "major": return true case "minor": return true case "mode": return true case "path": return true case "uid": return true default: return false } case "unix-block": switch k { case "gid": return true case "major": return true case "minor": return true case "mode": return true case "path": return true case "uid": return true default: return false } case "nic": switch k { case "limits.max": return true case "limits.ingress": return true case "limits.egress": return true case "host_name": return true case "hwaddr": return true case "mtu": return true case "name": return true case "nictype": return true case "parent": return true default: return false } case "disk": switch k { case "limits.max": return true case "limits.read": return true case "limits.write": return true case "optional": return true case "path": return true case "readonly": return true case "size": return true case "source": return true default: return false } case "none": return false default: return false } } func containerValidConfig(config map[string]string, profile bool, expanded bool) error { if config == nil { return nil } for k, _ := range config { if profile && strings.HasPrefix(k, "volatile.") { return fmt.Errorf("Volatile keys can only be set on containers.") } if k == "raw.lxc" { err := lxcValidConfig(config["raw.lxc"]) if err != nil { return err } } if !containerValidConfigKey(k) { return fmt.Errorf("Bad key: %s", k) } } return nil } func containerValidDevices(devices shared.Devices, profile bool, expanded bool) error { // Empty device list if devices == nil { return nil } // Check each device individually for _, m := range devices { for k, _ := range m { if !containerValidDeviceConfigKey(m["type"], k) { return fmt.Errorf("Invalid device configuration key for %s: %s", m["type"], k) } } if m["type"] == "nic" { if m["nictype"] == "" { return fmt.Errorf("Missing nic type") } if !shared.StringInSlice(m["nictype"], []string{"bridged", "physical", "p2p", "macvlan"}) { return fmt.Errorf("Bad nic type: %s", m["nictype"]) } if shared.StringInSlice(m["nictype"], []string{"bridged", "physical", "macvlan"}) && m["parent"] == "" { return fmt.Errorf("Missing parent for %s type nic.", m["nictype"]) } } else if m["type"] == "disk" { if m["path"] == "" { return fmt.Errorf("Disk entry is missing the required \"path\" property.") } if m["source"] == "" && m["path"] != "/" { return fmt.Errorf("Disk entry is missing the required \"source\" property.") } if m["path"] == "/" && m["source"] != "" { return fmt.Errorf("Root disk entry may not have a \"source\" property set.") } if m["size"] != "" && m["path"] != "/" { return fmt.Errorf("Only the root disk may have a size quota.") } } else if shared.StringInSlice(m["type"], []string{"unix-char", "unix-block"}) { if m["path"] == "" { return fmt.Errorf("Unix device entry is missing the required \"path\" property.") } } else if m["type"] == "none" { continue } else { return fmt.Errorf("Invalid device type: %s", m["type"]) } } // Checks on the expanded config if expanded { foundRootfs := false for _, m := range devices { if m["type"] == "disk" && m["path"] == "/" { foundRootfs = true } } if !foundRootfs { return fmt.Errorf("Container is lacking rootfs entry") } } return nil } // The container arguments type containerArgs struct { // Don't set manually Id int Architecture int BaseImage string Config map[string]string Ctype containerType Devices shared.Devices Ephemeral bool Name string Profiles []string } // The container interface type container interface { // Container actions Freeze() error Shutdown(timeout time.Duration) error Start() error Stop() error Unfreeze() error // Snapshots & migration Restore(sourceContainer container) error Checkpoint(opts lxc.CheckpointOptions) error StartFromMigration(imagesDir string) error Snapshots() ([]container, error) // Config handling Rename(newName string) error Update(newConfig containerArgs, userRequested bool) error Delete() error Export(w io.Writer) error // Live configuration CGroupSet(key string, value string) error ConfigKeySet(key string, value string) error // File handling FilePull(srcpath string, dstpath string) error FilePush(srcpath string, dstpath string, uid int, gid int, mode os.FileMode) error // Status RenderState() (*shared.ContainerState, error) IsPrivileged() bool IsRunning() bool IsFrozen() bool IsEphemeral() bool IsSnapshot() bool IsNesting() bool // Hooks OnStart() error OnStop(target string) error // Properties Id() int Name() string Architecture() int ExpandedConfig() map[string]string ExpandedDevices() shared.Devices LocalConfig() map[string]string LocalDevices() shared.Devices Profiles() []string InitPID() int State() string // Paths Path() string RootfsPath() string TemplatesPath() string StatePath() string LogFilePath() string LogPath() string // FIXME: Those should be internal functions LXContainerGet() *lxc.Container StorageStart() error StorageStop() error Storage() storage IdmapSet() *shared.IdmapSet LastIdmapSet() (*shared.IdmapSet, error) TemplateApply(trigger string) error Daemon() *Daemon } // Loader functions func containerCreateAsEmpty(d *Daemon, args containerArgs) (container, error) { // Create the container c, err := containerCreateInternal(d, args) if err != nil { return nil, err } // Now create the empty storage if err := c.Storage().ContainerCreate(c); err != nil { c.Delete() return nil, err } // Apply any post-storage configuration err = containerConfigureInternal(c) if err != nil { c.Delete() return nil, err } return c, nil } func containerCreateEmptySnapshot(d *Daemon, args containerArgs) (container, error) { // Create the snapshot c, err := containerCreateInternal(d, args) if err != nil { return nil, err } // Now create the empty snapshot if err := c.Storage().ContainerSnapshotCreateEmpty(c); err != nil { c.Delete() return nil, err } return c, nil } func containerCreateFromImage(d *Daemon, args containerArgs, hash string) (container, error) { // Create the container c, err := containerCreateInternal(d, args) if err != nil { return nil, err } if err := dbImageLastAccessUpdate(d.db, hash); err != nil { return nil, fmt.Errorf("Error updating image last use date: %s", err) } // Now create the storage from an image if err := c.Storage().ContainerCreateFromImage(c, hash); err != nil { c.Delete() return nil, err } // Apply any post-storage configuration err = containerConfigureInternal(c) if err != nil { c.Delete() return nil, err } return c, nil } func containerCreateAsCopy(d *Daemon, args containerArgs, sourceContainer container) (container, error) { // Create the container c, err := containerCreateInternal(d, args) if err != nil { return nil, err } // Now clone the storage if err := c.Storage().ContainerCopy(c, sourceContainer); err != nil { c.Delete() return nil, err } // Apply any post-storage configuration err = containerConfigureInternal(c) if err != nil { c.Delete() return nil, err } return c, nil } func containerCreateAsSnapshot(d *Daemon, args containerArgs, sourceContainer container, stateful bool) (container, error) { // Create the snapshot c, err := containerCreateInternal(d, args) if err != nil { return nil, err } // Deal with state if stateful { stateDir := sourceContainer.StatePath() err = os.MkdirAll(stateDir, 0700) if err != nil { c.Delete() return nil, err } if !sourceContainer.IsRunning() { c.Delete() return nil, fmt.Errorf("Container not running, cannot do stateful snapshot") } /* TODO: ideally we would freeze here and unfreeze below after * we've copied the filesystem, to make sure there are no * changes by the container while snapshotting. Unfortunately * there is abug in CRIU where it doesn't leave the container * in the same state it found it w.r.t. freezing, i.e. CRIU * freezes too, and then /always/ thaws, even if the container * was frozen. Until that's fixed, all calls to Unfreeze() * after snapshotting will fail. */ opts := lxc.CheckpointOptions{Directory: stateDir, Stop: false, Verbose: true} err = sourceContainer.Checkpoint(opts) err2 := CollectCRIULogFile(sourceContainer, stateDir, "snapshot", "dump") if err2 != nil { shared.Log.Warn("failed to collect criu log file", log.Ctx{"error": err2}) } } // Clone the container if err := sourceContainer.Storage().ContainerSnapshotCreate(c, sourceContainer); err != nil { c.Delete() return nil, err } // Once we're done, remove the state directory if stateful { os.RemoveAll(sourceContainer.StatePath()) } return c, nil } func containerCreateInternal(d *Daemon, args containerArgs) (container, error) { // Set default values if args.Profiles == nil { args.Profiles = []string{"default"} } if args.Config == nil { args.Config = map[string]string{} } if args.BaseImage != "" { args.Config["volatile.base_image"] = args.BaseImage } if args.Devices == nil { args.Devices = shared.Devices{} } if args.Architecture == 0 { args.Architecture = d.architectures[0] } // Validate container name if args.Ctype == cTypeRegular { err := containerValidName(args.Name) if err != nil { return nil, err } } // Validate container config err := containerValidConfig(args.Config, false, false) if err != nil { return nil, err } // Validate container devices err = containerValidDevices(args.Devices, false, false) if err != nil { return nil, err } // Validate architecture _, err = shared.ArchitectureName(args.Architecture) if err != nil { return nil, err } // Validate profiles profiles, err := dbProfiles(d.db) if err != nil { return nil, err } for _, profile := range args.Profiles { if !shared.StringInSlice(profile, profiles) { return nil, fmt.Errorf("Requested profile '%s' doesn't exist", profile) } } path := containerPath(args.Name, args.Ctype == cTypeSnapshot) if shared.PathExists(path) { return nil, fmt.Errorf("The container already exists") } // Wipe any existing log for this container name os.RemoveAll(shared.LogPath(args.Name)) // Create the container entry id, err := dbContainerCreate(d.db, args) if err != nil { return nil, err } args.Id = id return containerLXCCreate(d, args) } func containerConfigureInternal(c container) error { // Find the root device for _, m := range c.ExpandedDevices() { if m["type"] != "disk" || m["path"] != "/" || m["size"] == "" { continue } size, err := deviceParseBytes(m["size"]) if err != nil { return err } err = c.Storage().ContainerSetQuota(c, size) if err != nil { return err } break } return nil } func containerLoadById(d *Daemon, id int) (container, error) { // Get the DB record name, err := dbContainerName(d.db, id) if err != nil { return nil, err } return containerLoadByName(d, name) } func containerLoadByName(d *Daemon, name string) (container, error) { // Get the DB record args, err := dbContainerGet(d.db, name) if err != nil { return nil, err } return containerLXCLoad(d, args) }
{ "content_hash": "4b0b7db2d2f87c4c8aebdde4653dea5d", "timestamp": "", "source": "github", "line_count": 642, "max_line_length": 124, "avg_line_length": 21.23208722741433, "alnum_prop": 0.6702369598708825, "repo_name": "dustinkirkland/lxd", "id": "87dd19d3700be0f6e231bfeccd676fb251e0f88a", "size": "13631", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "lxd/container.go", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Go", "bytes": "788810" }, { "name": "Makefile", "bytes": "2920" }, { "name": "Protocol Buffer", "bytes": "711" }, { "name": "Python", "bytes": "47381" }, { "name": "Shell", "bytes": "65406" } ], "symlink_target": "" }
package at.mchris.popularmovies; import android.app.Application; import android.test.ApplicationTestCase; /** * <a href="http://d.android.com/tools/testing/testing_android.html">Testing Fundamentals</a> */ public class ApplicationTest { }
{ "content_hash": "8ceb146acdbf5d8f0c09718f16dee733", "timestamp": "", "source": "github", "line_count": 10, "max_line_length": 93, "avg_line_length": 24.2, "alnum_prop": 0.7727272727272727, "repo_name": "ChristianMoesl/popular-movies", "id": "28a09a2fc98b387a70b98360069bcc62b5e893ee", "size": "242", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "app/src/androidTest/java/at/mchris/popularmovies/ApplicationTest.java", "mode": "33188", "license": "mit", "language": [ { "name": "Java", "bytes": "77560" } ], "symlink_target": "" }
<?php namespace MPWAR\Module\Question\Application\Service; use MPWAR\Module\Question\Contract\Exception\QuestionNotExistsException; use MPWAR\Module\Question\Contract\Response\QuestionResponse; use MPWAR\Module\Question\Domain\QuestionId; use MPWAR\Module\Question\Domain\QuestionRepository; final class QuestionFinder { private $repository; public function __construct(QuestionRepository $repository) { $this->repository = $repository; } public function __invoke(QuestionId $id) { $question = $this->repository->search($id); if (null === $question) { throw new QuestionNotExistsException($id); } $response = new QuestionResponse($question->id()->value(), $question->name()->value(), $question->registrationDate()); return $response; } }
{ "content_hash": "b09ca8f27fcf46a12b2e17f7e83f53a2", "timestamp": "", "source": "github", "line_count": 31, "max_line_length": 126, "avg_line_length": 26.903225806451612, "alnum_prop": 0.6918465227817746, "repo_name": "ninina31/portal-examenes", "id": "27026ec9d6e1874ea0ddfeaabda5876041f61d40", "size": "834", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "src/MPWAR/Module/Question/Application/Service/QuestionFinder.php", "mode": "33188", "license": "mit", "language": [ { "name": "ApacheConf", "bytes": "3297" }, { "name": "HTML", "bytes": "464" }, { "name": "PHP", "bytes": "84073" } ], "symlink_target": "" }
/* * 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.apache.camel.osgi.service; import org.apache.camel.CamelContext; import org.apache.camel.Component; import org.apache.camel.Processor; import org.apache.camel.osgi.service.util.BundleDelegatingClassLoader; import org.junit.Test; import org.osgi.framework.Bundle; import static org.hamcrest.CoreMatchers.instanceOf; import static org.junit.Assert.assertThat; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; public class OsgiRoundRobinEndpointTest { @Test(expected = UnsupportedOperationException.class) public void testCreateConsumer() throws Exception { OsgiRoundRobinEndpoint endpoint = createEndpoint(); Processor processor = mock(Processor.class); endpoint.createConsumer(processor); } @Test public void testCreateProducer() throws Exception { OsgiRoundRobinEndpoint endpoint = createEndpoint(); assertThat(endpoint.createProducer(), instanceOf(OsgiRoundRobinProducer.class)); } private OsgiRoundRobinEndpoint createEndpoint() throws Exception { Bundle bundle = mock(Bundle.class); ClassLoader classLoader = new BundleDelegatingClassLoader(bundle, getClass().getClassLoader()); CamelContext camelContext = mock(CamelContext.class); when(camelContext.getApplicationContextClassLoader()).thenReturn(classLoader); Component component = mock(Component.class); when(component.getCamelContext()).thenReturn(camelContext); return new OsgiRoundRobinEndpoint("osgi:roundrobin:test", component); } }
{ "content_hash": "fa7dd1a612751ec69782a85a283c32ee", "timestamp": "", "source": "github", "line_count": 59, "max_line_length": 103, "avg_line_length": 36.20338983050848, "alnum_prop": 0.7551498127340824, "repo_name": "szhem/camel-osgi", "id": "27b1bf15ba66ec45b9bf4579ef062fe4f28bbd23", "size": "2136", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "component/src/test/java/org/apache/camel/osgi/service/OsgiRoundRobinEndpointTest.java", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Java", "bytes": "302489" } ], "symlink_target": "" }
{%extends "base.html" %} {% block title %} olaletter {% endblock %} {% block cust_right %} <div class="right_box"> <div class="navRightHead">olaletter</div> <div class="navRightContent" style="text-align:center;"> <img src="{{ MEDIA_URL }}greenstyle/gfx/olaletter.jpg" alt="olaletter" style="width:141px;height:88px;"/> </div> </div> {% endblock %} {% block content %} <div id="title"> <a href="{% url shoppy_newsletter_signup %}">olaletter</a> > Angemeldet </div> <p> Vielen Dank f&uuml;r das Interesse an unserem olaletter. Wir haben Ihnen eine E-Mail an die von Ihnen angegebene Adresse geschickt. Um einen Missbrauch Ihrer Adresse durch Dritte auszuschlie&szlig;en, m&uuml;ssen Sie diese E-Mail best&auml;tigen, bevor Sie den ersten olaletter von uns erhalten. </p> {% endblock %}
{ "content_hash": "1a46ffe9ee148b47dbf5ecf0b4984710", "timestamp": "", "source": "github", "line_count": 28, "max_line_length": 105, "avg_line_length": 28.714285714285715, "alnum_prop": 0.6990049751243781, "repo_name": "pocketone/django-shoppy", "id": "7bd44f554180add676c5e3bd920ea5e170a1d08e", "size": "804", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "shoppy/templates/greenstyle/newsletter/signup_done.html", "mode": "33188", "license": "bsd-3-clause", "language": [], "symlink_target": "" }
Helm 2.1.0 introduced the concept of a client-side Helm _plugin_. A plugin is a tool that can be accessed through the `helm` CLI, but which is not part of the built-in Helm codebase. Existing plugins can be found on [related](related.md#helm-plugins) section or by searching [Github](https://github.com/search?q=topic%3Ahelm-plugin&type=Repositories). This guide explains how to use and create plugins. ## An Overview Helm plugins are add-on tools that integrate seamlessly with Helm. They provide a way to extend the core feature set of Helm, but without requiring every new feature to be written in Go and added to the core tool. Helm plugins have the following features: - They can be added and removed from a Helm installation without impacting the core Helm tool. - They can be written in any programming language. - They integrate with Helm, and will show up in `helm help` and other places. Helm plugins live in `$(helm home)/plugins`. The Helm plugin model is partially modeled on Git's plugin model. To that end, you may sometimes hear `helm` referred to as the _porcelain_ layer, with plugins being the _plumbing_. This is a shorthand way of suggesting that Helm provides the user experience and top level processing logic, while the plugins do the "detail work" of performing a desired action. ## Installing a Plugin A Helm plugin management system is in the works. But in the short term, plugins are installed by copying the plugin directory into `$(helm home)/plugins`. ```console $ cp -a myplugin/ $(helm home)/plugins/ ``` If you have a plugin tar distribution, simply untar the plugin into the `$(helm home)/plugins` directory. ## Building Plugins In many ways, a plugin is similar to a chart. Each plugin has a top-level directory, and then a `plugin.yaml` file. ``` $(helm home)/plugins/ |- keybase/ | |- plugin.yaml |- keybase.sh ``` In the example above, the `keybase` plugin is contained inside of a directory named `keybase`. It has two files: `plugin.yaml` (required) and an executable script, `keybase.sh` (optional). The core of a plugin is a simple YAML file named `plugin.yaml`. Here is a plugin YAML for a plugin that adds support for Keybase operations: ``` name: "keybase" version: "0.1.0" usage: "Integreate Keybase.io tools with Helm" description: |- This plugin provides Keybase services to Helm. ignoreFlags: false useTunnel: false command: "$HELM_PLUGIN_DIR/keybase.sh" ``` The `name` is the name of the plugin. When Helm executes it plugin, this is the name it will use (e.g. `helm NAME` will invoke this plugin). _`name` should match the directory name._ In our example above, that means the plugin with `name: keybase` should be contained in a directory named `keybase`. Restrictions on `name`: - `name` cannot duplicate one of the existing `helm` top-level commands. - `name` must be restricted to the characters ASCII a-z, A-Z, 0-9, `_` and `-`. `version` is the SemVer 2 version of the plugin. `usage` and `description` are both used to generate the help text of a command. The `ignoreFlags` switch tells Helm to _not_ pass flags to the plugin. So if a plugin is called with `helm myplugin --foo` and `ignoreFlags: true`, then `--foo` is silently discarded. The `useTunnel` switch indicates that the plugin needs a tunnel to Tiller. This should be set to `true` _anytime a plugin talks to Tiller_. It will cause Helm to open a tunnel, and then set `$TILLER_HOST` to the right local address for that tunnel. But don't worry: if Helm detects that a tunnel is not necessary because Tiller is running locally, it will not create the tunnel. Finally, and most importantly, `command` is the command that this plugin will execute when it is called. Environment variables are interpolated before the plugin is executed. The pattern above illustrates the preferred way to indicate where the plugin program lives. There are some strategies for working with plugin commands: - If a plugin includes an executable, the executable for a `command:` should be packaged in the plugin directory. - The `command:` line will have any environment variables expanded before execution. `$HELM_PLUGIN_DIR` will point to the plugin directory. - The command itself is not executed in a shell. So you can't oneline a shell script. - Helm injects lots of configuration into environment variables. Take a look at the environment to see what information is available. - Helm makes no assumptions about the language of the plugin. You can write it in whatever you prefer. - Commands are responsible for implementing specific help text for `-h` and `--help`. Helm will use `usage` and `description` for `helm help` and `helm help myplugin`, but will not handle `helm myplugin --help`. ## Environment Variables When Helm executes a plugin, it passes the outer environment to the plugin, and also injects some additional environment variables. Variables like `KUBECONFIG` are set for the plugin if they are set in the outer environment. The following variables are guaranteed to be set: - `HELM_PLUGIN`: The path to the plugins directory - `HELM_PLUGIN_NAME`: The name of the plugin, as invoked by `helm`. So `helm myplug` will have the short name `myplug`. - `HELM_PLUGIN_DIR`: The directory that contains the plugin. - `HELM_BIN`: The path to the `helm` command (as executed by the user). - `HELM_HOME`: The path to the Helm home. - `HELM_PATH_*`: Paths to important Helm files and directories are stored in environment variables prefixed by `HELM_PATH`. - `TILLER_HOST`: The `domain:port` to Tiller. If a tunnel is created, this will point to the local endpoint for the tunnel. Otherwise, it will point to `$HELM_HOST`, `--host`, or the default host (according to Helm's rules of precedence). While `HELM_HOST` _may_ be set, there is no guarantee that it will point to the correct Tiller instance. This is done to allow plugin developer to access `HELM_HOST` in its raw state when the plugin itself needs to manually configure a connection. ## A Note on `useTunnel` If a plugin specifies `useTunnel: true`, Helm will do the following (in order): 1. Parse global flags and the environment 2. Create the tunnel 3. Set `TILLER_HOST` 4. Execute the plugin 5. Close the tunnel The tunnel is removed as soon as the `command` returns. So, for example, a command cannot background a process and assume that that process will be able to use the tunnel. ## A Note on Flag Parsing When executing a plugin, Helm will parse global flags for its own use. Some of these flags are _not_ passed on to the plugin. - `--debug`: If this is specified, `$HELM_DEBUG` is set to `1` - `--home`: This is converted to `$HELM_HOME` - `--host`: This is converted to `$HELM_HOST` - `--kube-context`: This is simply dropped. If your plugin uses `useTunnel`, this is used to set up the tunnel for you. Plugins _should_ display help text and then exit for `-h` and `--help`. In all other cases, plugins may use flags as appropriate.
{ "content_hash": "c588fa61a03ff988d0ad33506d02b05a", "timestamp": "", "source": "github", "line_count": 172, "max_line_length": 168, "avg_line_length": 40.7093023255814, "alnum_prop": 0.7502142245072836, "repo_name": "kdada/helm", "id": "72e78c25ef397093a7a2621aff0ca063ffe0a032", "size": "7028", "binary": false, "copies": "4", "ref": "refs/heads/master", "path": "docs/plugins.md", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Go", "bytes": "1063256" }, { "name": "Makefile", "bytes": "7777" }, { "name": "Protocol Buffer", "bytes": "29907" }, { "name": "Shell", "bytes": "62489" }, { "name": "Smarty", "bytes": "613" } ], "symlink_target": "" }
#pragma once #include <QtWidgets/QDialog> #include <QtWidgets/QLineEdit> #include <QtWidgets/QPushButton> #include <QtWidgets/QTextEdit> #include <QtWidgets/QSplitter> #include <QtWidgets/QTextBrowser> #include <QtWidgets/QTreeWidget> #include <QtWidgets/QCheckBox> #include "uitypes.h" /*! \ingroup uiapi */ class BINARYNINJAUIAPI HeaderImportDialog : public QDialog { Q_OBJECT QLineEdit* m_fileEdit; QPushButton* m_browseButton; QTextEdit* m_compilerFlagsEdit; QSplitter* m_splitter; QWidget* m_resultsWidget; QLayout* m_resultsLayout; QTextBrowser* m_compilerErrorsText; QTreeWidget* m_typesTree; QCheckBox* m_includeSystemTypesCheck; QCheckBox* m_builtinMacrosCheck; QPushButton* m_previewButton; QPushButton* m_importButton; BinaryViewRef m_data; std::string m_filePath; BinaryNinja::TypeParserResult m_result; std::vector<BinaryNinja::TypeParserError> m_errors; protected Q_SLOTS: void browseFile(); void updateButtons(); void previewTypes(); void importTypes(); protected: virtual void keyPressEvent(QKeyEvent* event) override; private: bool loadTypes(); bool isExistingType(const BinaryNinja::QualifiedName& name) const; bool isBuiltinType(const BinaryNinja::QualifiedName& name) const; public: HeaderImportDialog(QWidget* parent, BinaryViewRef view); ~HeaderImportDialog() = default; };
{ "content_hash": "d1243295cf7059531396abe519094e7b", "timestamp": "", "source": "github", "line_count": 55, "max_line_length": 67, "avg_line_length": 24.272727272727273, "alnum_prop": 0.7835205992509363, "repo_name": "Vector35/binaryninja-api", "id": "90ce495d86029d82f141c27fc69c09d33a97e324", "size": "1335", "binary": false, "copies": "1", "ref": "refs/heads/dev", "path": "ui/headerimportdialog.h", "mode": "33188", "license": "mit", "language": [ { "name": "Batchfile", "bytes": "7858" }, { "name": "C", "bytes": "34178" }, { "name": "C++", "bytes": "3321511" }, { "name": "CMake", "bytes": "18669" }, { "name": "CSS", "bytes": "212519" }, { "name": "HTML", "bytes": "23547" }, { "name": "JavaScript", "bytes": "16727" }, { "name": "Makefile", "bytes": "8363" }, { "name": "Python", "bytes": "2299592" }, { "name": "Rust", "bytes": "597644" }, { "name": "Shell", "bytes": "5702" } ], "symlink_target": "" }
package betterframework; import java.util.LinkedList; import java.util.List; import battlecode.common.GameActionException; import battlecode.common.RobotController; public class ComputerHandler extends BaseRobotHandler { protected ComputerHandler(RobotController rc) { super(rc); } @Override public List<Action> chooseActions() throws GameActionException { return new LinkedList<Action>(); } }
{ "content_hash": "edf22689d2a31239c26bda0cbc4ee8d6", "timestamp": "", "source": "github", "line_count": 20, "max_line_length": 65, "avg_line_length": 20.45, "alnum_prop": 0.7970660146699267, "repo_name": "djkeyes/battlecode2015bot", "id": "118ea9f7b63f74f94029767e6340dbdd0db15543", "size": "409", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "Battlecode/teams/betterframework/ComputerHandler.java", "mode": "33188", "license": "mit", "language": [ { "name": "Java", "bytes": "467440" } ], "symlink_target": "" }
from django import template register = template.Library() def dereference(value, arg): return value[arg] register.filter('dereference', dereference)
{ "content_hash": "dc2372b0f608ab4fda8f056b052bb2fc", "timestamp": "", "source": "github", "line_count": 10, "max_line_length": 43, "avg_line_length": 15.8, "alnum_prop": 0.7531645569620253, "repo_name": "trawick/edurepo", "id": "26496162b89a9b21ac4e489f168cbbb5519465c2", "size": "158", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "src/edurepo/teachers/templatetags/teachers_extras.py", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "CSS", "bytes": "4821" }, { "name": "HTML", "bytes": "57255" }, { "name": "JavaScript", "bytes": "32940" }, { "name": "Python", "bytes": "131141" }, { "name": "Shell", "bytes": "2860" } ], "symlink_target": "" }
<?xml version="1.0" encoding="UTF-8"?> <?xml-stylesheet type="text/xsl" href="ivy-report.xsl"?> <ivy-report version="1.0"> <info organisation="default" module="summingbird-build" revision="0.1-SNAPSHOT" extra-sbtVersion="0.13" extra-scalaVersion="2.10" conf="plugin" confs="compile, runtime, test, provided, optional, compile-internal, runtime-internal, test-internal, plugin, sources, docs, pom, scala-tool" date="20140114124156"/> <dependencies> </dependencies> </ivy-report>
{ "content_hash": "94382abdb17808db8ee831d8cfc04d43", "timestamp": "", "source": "github", "line_count": 15, "max_line_length": 143, "avg_line_length": 33.13333333333333, "alnum_prop": 0.7122736418511066, "repo_name": "sengt/summingbird-batch", "id": "9ee63b91ef8bf8026cd7ccd181dca1ff577a14d9", "size": "497", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "project/target/resolution-cache/reports/default-summingbird-build-plugin.xml", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Java", "bytes": "4793" }, { "name": "Scala", "bytes": "532040" }, { "name": "Shell", "bytes": "15967" } ], "symlink_target": "" }
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.ComponentModel; namespace NAudioWpfDemo.DrumMachineDemo { public class DrumPattern { private byte[,] hits; private List<string> noteNames; public DrumPattern(IEnumerable<string> notes, int steps) { this.noteNames = new List<string>(notes); this.Steps = steps; hits = new byte[Notes, steps]; } public int Steps { get; private set; } public int Notes { get { return noteNames.Count; } } public byte this[int note, int step] { get { return hits[note, step]; } set { if (hits[note, step] != value) { hits[note, step] = value; if (PatternChanged != null) { PatternChanged(this, EventArgs.Empty); } } } } public event EventHandler PatternChanged; public IList<string> NoteNames { get { return this.noteNames.AsReadOnly(); } } } }
{ "content_hash": "5da9c7f8d97860cf480b491fa1b63973", "timestamp": "", "source": "github", "line_count": 48, "max_line_length": 86, "avg_line_length": 25.416666666666668, "alnum_prop": 0.49754098360655735, "repo_name": "skor98/DtWPF", "id": "be232a021d3b60f83331d64428d2f7bbc25a45b1", "size": "1222", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "speechKit/NAudio-master/NAudioWpfDemo/DrumMachineDemo/DrumPattern.cs", "mode": "33188", "license": "mit", "language": [ { "name": "Batchfile", "bytes": "176" }, { "name": "C#", "bytes": "2911995" }, { "name": "CSS", "bytes": "3538" }, { "name": "F#", "bytes": "3322" }, { "name": "HTML", "bytes": "268280" }, { "name": "NSIS", "bytes": "9258" }, { "name": "Protocol Buffer", "bytes": "9300" }, { "name": "Visual Basic", "bytes": "275779" } ], "symlink_target": "" }
package com.dcjet.${ddata.solution.solutionName}.controller; import java.io.IOException; import java.util.ArrayList; import java.util.Arrays; import java.util.Date; import java.util.LinkedHashMap; import javax.annotation.Resource; import javax.servlet.http.HttpServletResponse; import org.apache.commons.lang.StringUtils; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.ResponseBody; import com.dcjet.apollo.framework.core.ActionResult; import com.dcjet.apollo.framework.utils.DateTimeUtil; import com.dcjet.apollo.framework.utils.PubUtil; import com.dcjet.apollo.framework.utils.constant.ExcelPostfixEnum; import com.dcjet.apollo.framework.web.common.ResponseResult; import com.dcjet.apollo.framework.web.utils.ExcelExtendUtil; import com.dcjet.${ddata.solution.solutionName}.base.BackendBaseController; import com.dcjet.${ddata.solution.solutionName}.common.FrontendGridResult; import com.dcjet.${ddata.solution.solutionName}.entity.${data.moduleName}HeadEntity; import com.dcjet.${ddata.solution.solutionName}.search.${data.moduleName}HeadSearch; import com.dcjet.${ddata.solution.solutionName}.service.I${data.moduleName}HeadService; @Controller @RequestMapping("/${data.moduleName}") public class ${data.moduleName}HeadController extends BackendBaseController { @Resource private I${data.moduleName}HeadService ${data.moduleName|firstLowerCase}HeadService; /** * 获取数据分页列表 * @param searchEntity 查询实体 * @return */ @ResponseBody @RequestMapping(value ="/getList") public FrontendGridResult<${data.moduleName}HeadEntity> getList(${data.moduleName}HeadSearch searchEntity) throws IOException { ArrayList<${data.moduleName}HeadEntity> lst = ${data.moduleName|firstLowerCase}HeadService.selectHeadListBySearch(searchEntity); int total = ${data.moduleName|firstLowerCase}HeadService.selectHeadListCountBySearch(searchEntity); FrontendGridResult<${data.moduleName}HeadEntity> result = new FrontendGridResult<${data.moduleName}HeadEntity>(total,lst); return result; } /** * 获取单条数据 * @param oid 主键 * @return */ @ResponseBody @RequestMapping(value ="/get") public ResponseResult get(String oid) { ${data.moduleName}HeadEntity head = ${data.moduleName|firstLowerCase}HeadService.selectById(oid); ResponseResult responseResult = new ResponseResult(); responseResult.addData(head); return responseResult; } /** * 数据删除 * @param oid 主键 * @return */ @ResponseBody @RequestMapping(value ="/delete") public ResponseResult delete(String oid) { ResponseResult responseResult = new ResponseResult(); ActionResult result = ${data.moduleName|firstLowerCase}HeadService.deleteBatchIdsFor(Arrays.asList(oid.split(","))); responseResult.setSuccess(result.getSuccess()); return responseResult; } /** * 数据修改 * @param oid 主键 * @return */ @ResponseBody @RequestMapping(value = "/edit") public ResponseResult edit(${data.moduleName}HeadEntity head) { ResponseResult responseResult = new ResponseResult(); ActionResult result = new ActionResult(); if (StringUtils.isNotBlank(head.getOid())) { result = ${data.moduleName|firstLowerCase}HeadService.updateByIdFor(head); } else { head.setOid(PubUtil.generateUUID()); result = ${data.moduleName|firstLowerCase}HeadService.insertFor(head); } if(result.getSuccess()) { responseResult.setSuccess(); responseResult.addData(head.getOid()); } else { responseResult.setError(result.getMessage()); responseResult.addData(""); } return responseResult; } /** * 导出Excel * @param response * @param searchEntity * @return */ @RequestMapping("/export") public void exportExcel(HttpServletResponse response, ${data.moduleName}HeadSearch searchEntity) throws IOException { //获取导出数据 ArrayList<${data.moduleName}HeadEntity> lst = ${data.moduleName|firstLowerCase}HeadService.selectHeadListForExport(searchEntity); //导出数据项 LinkedHashMap<String, String> fieldMap = new LinkedHashMap<String, String>(); {@each data.fields.rows as di, index} {@if di.isTableShow == "Y"} fieldMap.put("${di.FIELDNAME|getDcm}", "${di.FIELDDESC}"); {@/if} {@/each} //Execl中sheet名称 String sheetName = "data"; try{ String fileName = DateTimeUtil.convertDateToString( DateTimeUtil.D17_DATETIME_PATTERN, new Date()) + PubUtil.getFixLengthRandomString(5) + ExcelPostfixEnum.Office2007Xlsx.getConstValue(); //调用导出公用方法 ExcelExtendUtil.listToExcel(lst, fieldMap, sheetName, 5000, fileName, response); } catch(Exception e) { e.printStackTrace(); } } }
{ "content_hash": "345a3911271e188b78b754e46d5f9055", "timestamp": "", "source": "github", "line_count": 131, "max_line_length": 131, "avg_line_length": 35.7557251908397, "alnum_prop": 0.7540563620836892, "repo_name": "aceunlonely/ggenerator-web", "id": "7c162e54076f343a95c8a0017fc891da332503a9", "size": "4978", "binary": false, "copies": "2", "ref": "refs/heads/master", "path": "ggweb-workplace/templates/apolloFrontend1.1/TemplateFiles/javaBackend/java/controller/HeadController.java", "mode": "33188", "license": "mit", "language": [ { "name": "Batchfile", "bytes": "60" }, { "name": "CSS", "bytes": "385534" }, { "name": "HTML", "bytes": "268919" }, { "name": "Java", "bytes": "84183" }, { "name": "JavaScript", "bytes": "483316" }, { "name": "Shell", "bytes": "51" } ], "symlink_target": "" }
CoreOS is currently in heavy development and actively being tested. These instructions will bring up a single CoreOS instance under QEMU, the small Swiss Army knife of virtual machine and CPU emulators. If you need to do more such as [configuring networks][qemunet] differently refer to the [QEMU Wiki][qemuwiki] and [User Documentation][qemudoc]. You can direct questions to the [IRC channel][irc] or [mailing list][coreos-dev]. [qemunet]: http://wiki.qemu.org/Documentation/Networking [qemuwiki]: http://wiki.qemu.org/Manual [qemudoc]: http://qemu.weilnetz.de/qemu-doc.html ## Install QEMU In addition to Linux it can be run on Windows and OS X but works best on Linux. It should be available on just about any distro. ### Debian or Ubuntu Documentation for [Debian][qemudeb] has more details but to get started all you need is: ```sh sudo apt-get install qemu-system-x86 qemu-utils ``` [qemudeb]: https://wiki.debian.org/QEMU ### Fedora or Red Hat The Fedora wiki has a [quick howto][qemufed] but the basic install is easy: ```sh sudo yum install qemu-system-x86 qemu-img ``` [qemufed]: https://fedoraproject.org/wiki/How_to_use_qemu ### Arch This is all you need to get started: ```sh sudo pacman -S qemu ``` More details can be found on [Arch's QEMU wiki page](https://wiki.archlinux.org/index.php/Qemu). ### Gentoo As to be expected Gentoo can be a little more complicated but all the required kernel options and USE flags are covered in the [Gentoo Wiki][qemugen]. Usually this should be sufficient: ```sh echo app-emulation/qemu qemu_softmmu_targets_x86_64 virtfs xattr >> /etc/portage/package.use emerge -av app-emulation/qemu ``` [qemugen]: http://wiki.gentoo.org/wiki/QEMU ## Startup CoreOS Once QEMU is installed you can download and start the latest CoreOS image. ### Choosing a Channel CoreOS is released into stable, alpha and beta channels. Releases to each channel serve as a release-candidate for the next channel. For example, a bug-free alpha release is promoted bit-for-bit to the beta channel. Read the [release notes]({{site.baseurl}}/releases) for specific features and bug fixes in each channel. <div id="qemu-images"> <ul class="nav nav-tabs"> <li class="active"><a href="#stable" data-toggle="tab">Stable Channel</a></li> <li><a href="#beta" data-toggle="tab">Beta Channel</a></li> <li><a href="#alpha" data-toggle="tab">Alpha Channel</a></li> </ul> <div class="tab-content coreos-docs-image-table"> <div class="tab-pane active" id="stable"> <div class="channel-info"> <p>Versions of CoreOS are battle-tested within the Beta and Alpha channels before being promoted. Current version is CoreOS {{site.stable-channel}}.</p> </div> <p>There are two files you need: the disk image (provided in qcow2 format) and the wrapper shell script to start QEMU.</p> <pre>mkdir coreos; cd coreos wget http://stable.release.core-os.net/amd64-usr/current/coreos_production_qemu.sh wget http://stable.release.core-os.net/amd64-usr/current/coreos_production_qemu.sh.sig wget http://stable.release.core-os.net/amd64-usr/current/coreos_production_qemu_image.img.bz2 wget http://stable.release.core-os.net/amd64-usr/current/coreos_production_qemu_image.img.bz2.sig gpg --verify coreos_production_qemu.sh.sig gpg --verify coreos_production_qemu_image.img.bz2.sig bzip2 -d coreos_production_qemu_image.img chmod +x coreos_production_qemu.sh</pre> </div> <div class="tab-pane" id="alpha"> <div class="channel-info"> <p>The alpha channel closely tracks master and is released to frequently. Current version is CoreOS {{site.alpha-channel}}.</p> </div> <p>There are two files you need: the disk image (provided in qcow2 format) and the wrapper shell script to start QEMU.</p> <pre>mkdir coreos; cd coreos wget http://alpha.release.core-os.net/amd64-usr/current/coreos_production_qemu.sh wget http://alpha.release.core-os.net/amd64-usr/current/coreos_production_qemu.sh.sig wget http://alpha.release.core-os.net/amd64-usr/current/coreos_production_qemu_image.img.bz2 wget http://alpha.release.core-os.net/amd64-usr/current/coreos_production_qemu_image.img.bz2.sig gpg --verify coreos_production_qemu.sh.sig gpg --verify coreos_production_qemu_image.img.bz2.sig bzip2 -d coreos_production_qemu_image.img chmod +x coreos_production_qemu.sh</pre> </div> <div class="tab-pane" id="beta"> <div class="channel-info"> <p>The beta channel consists of promoted alpha releases. Current version is CoreOS {{site.beta-channel}}.</p> </div> <p>There are two files you need: the disk image (provided in qcow2 format) and the wrapper shell script to start QEMU.</p> <pre>mkdir coreos; cd coreos wget http://beta.release.core-os.net/amd64-usr/current/coreos_production_qemu.sh wget http://beta.release.core-os.net/amd64-usr/current/coreos_production_qemu.sh.sig wget http://beta.release.core-os.net/amd64-usr/current/coreos_production_qemu_image.img.bz2 wget http://beta.release.core-os.net/amd64-usr/current/coreos_production_qemu_image.img.bz2.sig gpg --verify coreos_production_qemu.sh.sig gpg --verify coreos_production_qemu_image.img.bz2.sig bzip2 -d coreos_production_qemu_image.img chmod +x coreos_production_qemu.sh</pre> </div> </div> </div> Starting is as simple as: ```sh ./coreos_production_qemu.sh -nographic ``` ### SSH Keys In order to log in to the virtual machine you will need to use ssh keys. If you don't already have a ssh key pair you can generate one simply by running the command `ssh-keygen`. The wrapper script will automatically look for public keys in ssh-agent if available and at the default locations `~/.ssh/id_dsa.pub` or `~/.ssh/id_rsa.pub`. If you need to provide an alternate location use the -a option: ```sh ./coreos_production_qemu.sh -a ~/.ssh/authorized_keys -- -nographic ``` Note: Options such as `-a` for the wrapper script must be specified before any options for QEMU. To make the separation between the two explicit you can use `--` but that isn't required. See `./coreos_production_qemu.sh -h` for details. Once the virtual machine has started you can log in via SSH: ```sh ssh -l core -p 2222 localhost ``` ### SSH Config To simplify this and avoid potential host key errors in the future add the following to `~/.ssh/config`: ```sh Host coreos HostName localhost Port 2222 User core StrictHostKeyChecking no UserKnownHostsFile /dev/null ``` Now you can log in to the virtual machine with: ```sh ssh coreos ``` ## Using CoreOS Now that you have a machine booted it is time to play around. Check out the [CoreOS Quickstart]({{site.baseurl}}/docs/quickstart) guide or dig into [more specific topics]({{site.baseurl}}/docs).
{ "content_hash": "bd7e0b348d22a137161471a8891d3848", "timestamp": "", "source": "github", "line_count": 186, "max_line_length": 320, "avg_line_length": 36.32258064516129, "alnum_prop": 0.7362344582593251, "repo_name": "mjg59/docs", "id": "427450a57eb95cc8c4daf4a40b06f34692626842", "size": "6782", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "os/booting-with-qemu.md", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Shell", "bytes": "5596" } ], "symlink_target": "" }
package br.beholder.memelang.model.language; // Generated from .\Memelang.g4 by ANTLR 4.7 import org.antlr.v4.runtime.tree.AbstractParseTreeVisitor; /** * This class provides an empty implementation of {@link MemelangVisitor}, * which can be extended to create a visitor which only needs to handle a subset * of the available methods. * * @param <T> The return type of the visit operation. Use {@link Void} for * operations with no return type. */ public class MemelangBaseVisitor<T> extends AbstractParseTreeVisitor<T> implements MemelangVisitor<T> { /** * {@inheritDoc} * * <p>The default implementation returns the result of calling * {@link #visitChildren} on {@code ctx}.</p> */ @Override public T visitProg(MemelangParser.ProgContext ctx) { return visitChildren(ctx); } /** * {@inheritDoc} * * <p>The default implementation returns the result of calling * {@link #visitChildren} on {@code ctx}.</p> */ @Override public T visitFuncaoInicio(MemelangParser.FuncaoInicioContext ctx) { return visitChildren(ctx); } /** * {@inheritDoc} * * <p>The default implementation returns the result of calling * {@link #visitChildren} on {@code ctx}.</p> */ @Override public T visitFuncao(MemelangParser.FuncaoContext ctx) { return visitChildren(ctx); } /** * {@inheritDoc} * * <p>The default implementation returns the result of calling * {@link #visitChildren} on {@code ctx}.</p> */ @Override public T visitParametros(MemelangParser.ParametrosContext ctx) { return visitChildren(ctx); } /** * {@inheritDoc} * * <p>The default implementation returns the result of calling * {@link #visitChildren} on {@code ctx}.</p> */ @Override public T visitParametro(MemelangParser.ParametroContext ctx) { return visitChildren(ctx); } /** * {@inheritDoc} * * <p>The default implementation returns the result of calling * {@link #visitChildren} on {@code ctx}.</p> */ @Override public T visitBloco(MemelangParser.BlocoContext ctx) { return visitChildren(ctx); } /** * {@inheritDoc} * * <p>The default implementation returns the result of calling * {@link #visitChildren} on {@code ctx}.</p> */ @Override public T visitComandos(MemelangParser.ComandosContext ctx) { return visitChildren(ctx); } /** * {@inheritDoc} * * <p>The default implementation returns the result of calling * {@link #visitChildren} on {@code ctx}.</p> */ @Override public T visitComando(MemelangParser.ComandoContext ctx) { return visitChildren(ctx); } /** * {@inheritDoc} * * <p>The default implementation returns the result of calling * {@link #visitChildren} on {@code ctx}.</p> */ @Override public T visitEntradaesaida(MemelangParser.EntradaesaidaContext ctx) { return visitChildren(ctx); } /** * {@inheritDoc} * * <p>The default implementation returns the result of calling * {@link #visitChildren} on {@code ctx}.</p> */ @Override public T visitRetorno(MemelangParser.RetornoContext ctx) { return visitChildren(ctx); } /** * {@inheritDoc} * * <p>The default implementation returns the result of calling * {@link #visitChildren} on {@code ctx}.</p> */ @Override public T visitChamadaFuncao(MemelangParser.ChamadaFuncaoContext ctx) { return visitChildren(ctx); } /** * {@inheritDoc} * * <p>The default implementation returns the result of calling * {@link #visitChildren} on {@code ctx}.</p> */ @Override public T visitParametrosChamada(MemelangParser.ParametrosChamadaContext ctx) { return visitChildren(ctx); } /** * {@inheritDoc} * * <p>The default implementation returns the result of calling * {@link #visitChildren} on {@code ctx}.</p> */ @Override public T visitCondicionais(MemelangParser.CondicionaisContext ctx) { return visitChildren(ctx); } /** * {@inheritDoc} * * <p>The default implementation returns the result of calling * {@link #visitChildren} on {@code ctx}.</p> */ @Override public T visitIfdes(MemelangParser.IfdesContext ctx) { return visitChildren(ctx); } /** * {@inheritDoc} * * <p>The default implementation returns the result of calling * {@link #visitChildren} on {@code ctx}.</p> */ @Override public T visitIfdeselse(MemelangParser.IfdeselseContext ctx) { return visitChildren(ctx); } /** * {@inheritDoc} * * <p>The default implementation returns the result of calling * {@link #visitChildren} on {@code ctx}.</p> */ @Override public T visitIfdeselseif(MemelangParser.IfdeselseifContext ctx) { return visitChildren(ctx); } /** * {@inheritDoc} * * <p>The default implementation returns the result of calling * {@link #visitChildren} on {@code ctx}.</p> */ @Override public T visitWhiledes(MemelangParser.WhiledesContext ctx) { return visitChildren(ctx); } /** * {@inheritDoc} * * <p>The default implementation returns the result of calling * {@link #visitChildren} on {@code ctx}.</p> */ @Override public T visitFordes(MemelangParser.FordesContext ctx) { return visitChildren(ctx); } /** * {@inheritDoc} * * <p>The default implementation returns the result of calling * {@link #visitChildren} on {@code ctx}.</p> */ @Override public T visitDodes(MemelangParser.DodesContext ctx) { return visitChildren(ctx); } /** * {@inheritDoc} * * <p>The default implementation returns the result of calling * {@link #visitChildren} on {@code ctx}.</p> */ @Override public T visitSwitchdes(MemelangParser.SwitchdesContext ctx) { return visitChildren(ctx); } /** * {@inheritDoc} * * <p>The default implementation returns the result of calling * {@link #visitChildren} on {@code ctx}.</p> */ @Override public T visitSwitchCase(MemelangParser.SwitchCaseContext ctx) { return visitChildren(ctx); } /** * {@inheritDoc} * * <p>The default implementation returns the result of calling * {@link #visitChildren} on {@code ctx}.</p> */ @Override public T visitDefaultdes(MemelangParser.DefaultdesContext ctx) { return visitChildren(ctx); } /** * {@inheritDoc} * * <p>The default implementation returns the result of calling * {@link #visitChildren} on {@code ctx}.</p> */ @Override public T visitDeclaracoes(MemelangParser.DeclaracoesContext ctx) { return visitChildren(ctx); } /** * {@inheritDoc} * * <p>The default implementation returns the result of calling * {@link #visitChildren} on {@code ctx}.</p> */ @Override public T visitDeclaracao(MemelangParser.DeclaracaoContext ctx) { return visitChildren(ctx); } /** * {@inheritDoc} * * <p>The default implementation returns the result of calling * {@link #visitChildren} on {@code ctx}.</p> */ @Override public T visitMultidimensional(MemelangParser.MultidimensionalContext ctx) { return visitChildren(ctx); } /** * {@inheritDoc} * * <p>The default implementation returns the result of calling * {@link #visitChildren} on {@code ctx}.</p> */ @Override public T visitDeclaracoesArray(MemelangParser.DeclaracoesArrayContext ctx) { return visitChildren(ctx); } /** * {@inheritDoc} * * <p>The default implementation returns the result of calling * {@link #visitChildren} on {@code ctx}.</p> */ @Override public T visitSubArrayDeclaracoes(MemelangParser.SubArrayDeclaracoesContext ctx) { return visitChildren(ctx); } /** * {@inheritDoc} * * <p>The default implementation returns the result of calling * {@link #visitChildren} on {@code ctx}.</p> */ @Override public T visitAtribuicoes(MemelangParser.AtribuicoesContext ctx) { return visitChildren(ctx); } /** * {@inheritDoc} * * <p>The default implementation returns the result of calling * {@link #visitChildren} on {@code ctx}.</p> */ @Override public T visitAtribuicoesIncEDec(MemelangParser.AtribuicoesIncEDecContext ctx) { return visitChildren(ctx); } /** * {@inheritDoc} * * <p>The default implementation returns the result of calling * {@link #visitChildren} on {@code ctx}.</p> */ @Override public T visitTipoComVoid(MemelangParser.TipoComVoidContext ctx) { return visitChildren(ctx); } /** * {@inheritDoc} * * <p>The default implementation returns the result of calling * {@link #visitChildren} on {@code ctx}.</p> */ @Override public T visitTipo(MemelangParser.TipoContext ctx) { return visitChildren(ctx); } /** * {@inheritDoc} * * <p>The default implementation returns the result of calling * {@link #visitChildren} on {@code ctx}.</p> */ @Override public T visitExpressao(MemelangParser.ExpressaoContext ctx) { return visitChildren(ctx); } /** * {@inheritDoc} * * <p>The default implementation returns the result of calling * {@link #visitChildren} on {@code ctx}.</p> */ @Override public T visitOperations(MemelangParser.OperationsContext ctx) { return visitChildren(ctx); } /** * {@inheritDoc} * * <p>The default implementation returns the result of calling * {@link #visitChildren} on {@code ctx}.</p> */ @Override public T visitOp_atr(MemelangParser.Op_atrContext ctx) { return visitChildren(ctx); } /** * {@inheritDoc} * * <p>The default implementation returns the result of calling * {@link #visitChildren} on {@code ctx}.</p> */ @Override public T visitOp_rel(MemelangParser.Op_relContext ctx) { return visitChildren(ctx); } /** * {@inheritDoc} * * <p>The default implementation returns the result of calling * {@link #visitChildren} on {@code ctx}.</p> */ @Override public T visitOp_neg(MemelangParser.Op_negContext ctx) { return visitChildren(ctx); } /** * {@inheritDoc} * * <p>The default implementation returns the result of calling * {@link #visitChildren} on {@code ctx}.</p> */ @Override public T visitOp_bitwise(MemelangParser.Op_bitwiseContext ctx) { return visitChildren(ctx); } /** * {@inheritDoc} * * <p>The default implementation returns the result of calling * {@link #visitChildren} on {@code ctx}.</p> */ @Override public T visitOp_arit_baixa(MemelangParser.Op_arit_baixaContext ctx) { return visitChildren(ctx); } /** * {@inheritDoc} * * <p>The default implementation returns the result of calling * {@link #visitChildren} on {@code ctx}.</p> */ @Override public T visitOp_logica(MemelangParser.Op_logicaContext ctx) { return visitChildren(ctx); } /** * {@inheritDoc} * * <p>The default implementation returns the result of calling * {@link #visitChildren} on {@code ctx}.</p> */ @Override public T visitVal_final(MemelangParser.Val_finalContext ctx) { return visitChildren(ctx); } }
{ "content_hash": "9ccba7e02f71f4c9f3befd63a94f7020", "timestamp": "", "source": "github", "line_count": 295, "max_line_length": 122, "avg_line_length": 35.46440677966102, "alnum_prop": 0.6991970942458421, "repo_name": "BeholderDEV/MemeLang", "id": "f48a5022ad58dfe01be1aaa9495821f32ea53c1f", "size": "10462", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "src/br/beholder/memelang/model/language/MemelangBaseVisitor.java", "mode": "33188", "license": "mit", "language": [ { "name": "ANTLR", "bytes": "4648" }, { "name": "Assembly", "bytes": "83" }, { "name": "HTML", "bytes": "3753" }, { "name": "Java", "bytes": "431026" } ], "symlink_target": "" }
"use strict"; import chai = require("chai"); import StringCase = require("../../strings/StringCase"); var asr = chai.assert; suite("StringCase", function StringCaseTest() { test("isCamelCase()", function isCamelCase() { camelCase.forEach((str) => asr.isTrue(StringCase.isCamelCase(str))); camelCaseNum.forEach((str) => asr.isTrue(StringCase.isCamelCase(str))); }); test("isTitleCase()", function isTitleCase() { titleCase.forEach((str) => asr.isTrue(StringCase.isTitleCase(str))); titleCaseNum.forEach((str) => asr.isTrue(StringCase.isTitleCase(str))); }); test("isUnderscoreCase()", function isUnderscoreCase() { underscoreCase.forEach((str) => asr.isTrue(StringCase.isUnderscoreCase(str))); underscoreCaseNum.forEach((str) => asr.isTrue(StringCase.isUnderscoreCase(str))); }); var orig = ["At_Bat_Cat", "ABC", "atBatCat", "at_sat_vat", "CharAt"]; var camelCase = ["atBatCat", "aBC", "atBatCat", "atSatVat", "charAt"]; var titleCase = ["AtBatCat", "ABC", "AtBatCat", "AtSatVat", "CharAt"]; var underscoreCase = ["At_Bat_Cat", "A_B_C", "At_Bat_Cat", "at_sat_vat", "Char_At"]; test("toCamelCase(basic)", function toCamelCase() { orig.forEach((str, i) => asr.equal(StringCase.toCamelCase(str), camelCase[i])); }); test("toTitleCase(basic)", function toTitleCase() { orig.forEach((str, i) => asr.equal(StringCase.toTitleCase(str), titleCase[i])); }); test("toUnderscoreCase(basic)", function toUnderscoreCase() { orig.forEach((str, i) => asr.equal(StringCase.toUnderscoreCase(str), underscoreCase[i])); }); var origNum = ["At1", "At123", "At1At", "At123At", "At_1", "At_123", "At_1_At", "at_1_at", "At_123_At", "at1", "at123", "at1at", "at123at"]; var camelCaseNum = ["at1", "at123", "at1At", "at123At", "at1", "at123", "at1At", "at1At", "at123At", "at1", "at123", "at1at", "at123at"]; var titleCaseNum = ["At1", "At123", "At1At", "At123At", "At1", "At123", "At1At", "At1At", "At123At", "At1", "At123", "At1at", "At123at"]; var underscoreCaseNum = ["At_1", "At_123", "At_1_At", "At_123_At", "At_1", "At_123", "At_1_At", "at_1_at", "At_123_At", "At_1", "At_123", "At_1at", "At_123at"]; test("toCamelCase(numeric)", function toCamelCase() { origNum.forEach((str, i) => asr.equal(StringCase.toCamelCase(str), camelCaseNum[i])); }); test("toTitleCase(numeric)", function toTitleCase() { origNum.forEach((str, i) => asr.equal(StringCase.toTitleCase(str), titleCaseNum[i])); }); test("toUnderscoreCase(numeric)", function toUnderscoreCase() { origNum.forEach((str, i) => asr.equal(StringCase.toUnderscoreCase(str), underscoreCaseNum[i])); }); test("toUnderscoreCase(capitalize)", function toUnderscoreCaseCapitalize() { asr.equal(StringCase.toSeparatedCase("-_-", "-", true), "-_-"); asr.equal(StringCase.toSeparatedCase("TheTestCase", "-", false), "The-Test-Case"); asr.equal(StringCase.toSeparatedCase("The-Test-Case", "-", false), "The-Test-Case"); asr.equal(StringCase.toSeparatedCase("1-2-3", "-", true), "1-2-3"); asr.equal(StringCase.toSeparatedCase("a-snake-case", "-", true), "A-Snake-Case"); asr.equal(StringCase.toSeparatedCase("upper-Case-lower-Case", "-", true), "Upper-Case-Lower-Case"); }); });
{ "content_hash": "96ed56d356ec339d3a5d274d9c05b753", "timestamp": "", "source": "github", "line_count": 67, "max_line_length": 164, "avg_line_length": 51.88059701492537, "alnum_prop": 0.6070195627157653, "repo_name": "TeamworkGuy2/ts-code-generator", "id": "0f512da0c2badbd7ba265da8aa33a1e6cedbba2c", "size": "3478", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "test/strings/StringCaseTest.ts", "mode": "33188", "license": "mit", "language": [ { "name": "JavaScript", "bytes": "73146" }, { "name": "TypeScript", "bytes": "74457" } ], "symlink_target": "" }
"""Convert SEW checkpoint.""" import argparse import json import os import fairseq import torch from fairseq.data import Dictionary # Register SEW's fairseq modules from sew_asapp import tasks # noqa: F401 from transformers import ( SEWConfig, SEWForCTC, SEWModel, Wav2Vec2CTCTokenizer, Wav2Vec2FeatureExtractor, Wav2Vec2Processor, logging, ) logging.set_verbosity_info() logger = logging.get_logger(__name__) MAPPING = { "post_extract_proj": "feature_projection", "encoder.pos_conv.0": "encoder.pos_conv_embed.conv", "self_attn.k_proj": "encoder.layers.*.attention.k_proj", "self_attn.v_proj": "encoder.layers.*.attention.v_proj", "self_attn.q_proj": "encoder.layers.*.attention.q_proj", "self_attn.out_proj": "encoder.layers.*.attention.out_proj", "self_attn_layer_norm": "encoder.layers.*.layer_norm", "fc1": "encoder.layers.*.feed_forward.intermediate_dense", "fc2": "encoder.layers.*.feed_forward.output_dense", "final_layer_norm": "encoder.layers.*.final_layer_norm", "encoder.upsample.0": "encoder.upsample.projection", "encoder.layer_norm": "encoder.layer_norm", "w2v_model.layer_norm": "layer_norm", "w2v_encoder.proj": "lm_head", "mask_emb": "masked_spec_embed", } def set_recursively(hf_pointer, key, value, full_name, weight_type): for attribute in key.split("."): hf_pointer = getattr(hf_pointer, attribute) if weight_type is not None: hf_shape = getattr(hf_pointer, weight_type).shape else: hf_shape = hf_pointer.shape assert hf_shape == value.shape, ( f"Shape of hf {key + '.' + weight_type if weight_type is not None else ''} is {hf_shape}, but should be" f" {value.shape} for {full_name}" ) if weight_type == "weight": hf_pointer.weight.data = value elif weight_type == "weight_g": hf_pointer.weight_g.data = value elif weight_type == "weight_v": hf_pointer.weight_v.data = value elif weight_type == "bias": hf_pointer.bias.data = value else: hf_pointer.data = value logger.info(f"{key + '.' + weight_type if weight_type is not None else ''} was initialized from {full_name}.") def recursively_load_weights(fairseq_model, hf_model, is_finetuned): unused_weights = [] fairseq_dict = fairseq_model.state_dict() feature_extractor = hf_model.sew.feature_extractor if is_finetuned else hf_model.feature_extractor for name, value in fairseq_dict.items(): is_used = False if "conv_layers" in name: load_conv_layer( name, value, feature_extractor, unused_weights, hf_model.config.feat_extract_norm == "group", ) is_used = True else: for key, mapped_key in MAPPING.items(): mapped_key = "sew." + mapped_key if (is_finetuned and mapped_key != "lm_head") else mapped_key if key in name or key.split("w2v_model.")[-1] == name.split(".")[0]: is_used = True if "*" in mapped_key: layer_index = name.split(key)[0].split(".")[-2] mapped_key = mapped_key.replace("*", layer_index) if "weight_g" in name: weight_type = "weight_g" elif "weight_v" in name: weight_type = "weight_v" elif "weight" in name: weight_type = "weight" elif "bias" in name: weight_type = "bias" else: weight_type = None set_recursively(hf_model, mapped_key, value, name, weight_type) continue if not is_used: unused_weights.append(name) logger.warning(f"Unused weights: {unused_weights}") def load_conv_layer(full_name, value, feature_extractor, unused_weights, use_group_norm): name = full_name.split("conv_layers.")[-1] items = name.split(".") layer_id = int(items[0]) type_id = int(items[1]) if type_id == 0: if "bias" in name: assert value.shape == feature_extractor.conv_layers[layer_id].conv.bias.data.shape, ( f"{full_name} has size {value.shape}, but" f" {feature_extractor.conv_layers[layer_id].conv.bias.data.shape} was found." ) feature_extractor.conv_layers[layer_id].conv.bias.data = value logger.info(f"Feat extract conv layer {layer_id} was initialized from {full_name}.") elif "weight" in name: assert value.shape == feature_extractor.conv_layers[layer_id].conv.weight.data.shape, ( f"{full_name} has size {value.shape}, but" f" {feature_extractor.conv_layers[layer_id].conv.weight.data.shape} was found." ) feature_extractor.conv_layers[layer_id].conv.weight.data = value logger.info(f"Feat extract conv layer {layer_id} was initialized from {full_name}.") elif (type_id == 2 and not use_group_norm) or (type_id == 2 and layer_id == 0 and use_group_norm): if "bias" in name: assert value.shape == feature_extractor.conv_layers[layer_id].layer_norm.bias.data.shape, ( f"{full_name} has size {value.shape}, but {feature_extractor[layer_id].layer_norm.bias.data.shape} was" " found." ) feature_extractor.conv_layers[layer_id].layer_norm.bias.data = value logger.info(f"Feat extract layer norm weight of layer {layer_id} was initialized from {full_name}.") elif "weight" in name: assert value.shape == feature_extractor.conv_layers[layer_id].layer_norm.weight.data.shape, ( f"{full_name} has size {value.shape}, but" f" {feature_extractor[layer_id].layer_norm.weight.data.shape} was found." ) feature_extractor.conv_layers[layer_id].layer_norm.weight.data = value logger.info(f"Feat extract layer norm weight of layer {layer_id} was initialized from {full_name}.") else: unused_weights.append(full_name) def convert_config(model, is_finetuned): config = SEWConfig() if is_finetuned: fs_config = model.w2v_encoder.w2v_model.cfg else: fs_config = model.cfg config.conv_bias = fs_config.conv_bias conv_layers = eval(fs_config.conv_feature_layers) config.conv_dim = [x[0] for x in conv_layers] config.conv_kernel = [x[1] for x in conv_layers] config.conv_stride = [x[2] for x in conv_layers] config.feat_extract_activation = "gelu" config.feat_extract_norm = "layer" if fs_config.extractor_mode == "layer_norm" else "group" config.final_dropout = 0.0 config.hidden_act = fs_config.activation_fn.name config.hidden_size = fs_config.encoder_embed_dim config.initializer_range = 0.02 config.intermediate_size = fs_config.encoder_ffn_embed_dim config.layer_norm_eps = 1e-5 config.layerdrop = fs_config.encoder_layerdrop config.num_attention_heads = fs_config.encoder_attention_heads config.num_conv_pos_embedding_groups = fs_config.conv_pos_groups config.num_conv_pos_embeddings = fs_config.conv_pos config.num_feat_extract_layers = len(conv_layers) config.num_hidden_layers = fs_config.encoder_layers config.squeeze_factor = fs_config.squeeze_factor # take care of any params that are overridden by the Wav2VecCtc model if is_finetuned: fs_config = model.cfg config.final_dropout = fs_config.final_dropout config.layerdrop = fs_config.layerdrop config.activation_dropout = fs_config.activation_dropout config.apply_spec_augment = fs_config.mask_prob > 0 or fs_config.mask_channel_prob > 0 config.attention_dropout = fs_config.attention_dropout config.feat_proj_dropout = fs_config.dropout_input config.hidden_dropout = fs_config.dropout config.mask_feature_length = fs_config.mask_channel_length config.mask_feature_prob = fs_config.mask_channel_prob config.mask_time_length = fs_config.mask_length config.mask_time_prob = fs_config.mask_prob config.feature_extractor_type = "Wav2Vec2FeatureExtractor" config.tokenizer_class = "Wav2Vec2CTCTokenizer" return config @torch.no_grad() def convert_sew_checkpoint( checkpoint_path, pytorch_dump_folder_path, config_path=None, dict_path=None, is_finetuned=True ): """ Copy/paste/tweak model's weights to transformers design. """ if is_finetuned: model, _, _ = fairseq.checkpoint_utils.load_model_ensemble_and_task( [checkpoint_path], arg_overrides={"data": "/".join(dict_path.split("/")[:-1])} ) else: model, _, _ = fairseq.checkpoint_utils.load_model_ensemble_and_task([checkpoint_path]) if config_path is not None: config = SEWConfig.from_pretrained(config_path) else: config = convert_config(model[0], is_finetuned) model = model[0].eval() return_attention_mask = True if config.feat_extract_norm == "layer" else False feature_extractor = Wav2Vec2FeatureExtractor( feature_size=1, sampling_rate=16000, padding_value=0, do_normalize=True, return_attention_mask=return_attention_mask, ) if is_finetuned: if dict_path: target_dict = Dictionary.load(dict_path) # important change bos & pad token id since CTC symbol is <pad> and # not <s> as in fairseq target_dict.indices[target_dict.bos_word] = target_dict.pad_index target_dict.indices[target_dict.pad_word] = target_dict.bos_index config.bos_token_id = target_dict.pad_index config.pad_token_id = target_dict.bos_index config.eos_token_id = target_dict.eos_index config.vocab_size = len(target_dict.symbols) vocab_path = os.path.join(pytorch_dump_folder_path, "vocab.json") if not os.path.isdir(pytorch_dump_folder_path): logger.error("--pytorch_dump_folder_path ({}) should be a directory".format(pytorch_dump_folder_path)) return os.makedirs(pytorch_dump_folder_path, exist_ok=True) with open(vocab_path, "w", encoding="utf-8") as vocab_handle: json.dump(target_dict.indices, vocab_handle) tokenizer = Wav2Vec2CTCTokenizer( vocab_path, unk_token=target_dict.unk_word, pad_token=target_dict.pad_word, bos_token=target_dict.bos_word, eos_token=target_dict.eos_word, word_delimiter_token="|", do_lower_case=False, ) processor = Wav2Vec2Processor(feature_extractor=feature_extractor, tokenizer=tokenizer) processor.save_pretrained(pytorch_dump_folder_path) hf_model = SEWForCTC(config) else: hf_model = SEWModel(config) feature_extractor.save_pretrained(pytorch_dump_folder_path) recursively_load_weights(model, hf_model, is_finetuned) hf_model.save_pretrained(pytorch_dump_folder_path) if __name__ == "__main__": parser = argparse.ArgumentParser() parser.add_argument("--pytorch_dump_folder_path", default=None, type=str, help="Path to the output PyTorch model.") parser.add_argument("--checkpoint_path", default=None, type=str, help="Path to fairseq checkpoint") parser.add_argument("--dict_path", default=None, type=str, help="Path to dict of fine-tuned model") parser.add_argument("--config_path", default=None, type=str, help="Path to hf config.json of model to convert") parser.add_argument( "--is_finetuned", action="store_true", help="Whether the model to convert is a fine-tuned model or not" ) args = parser.parse_args() convert_sew_checkpoint( args.checkpoint_path, args.pytorch_dump_folder_path, args.config_path, args.dict_path, args.is_finetuned )
{ "content_hash": "0cd23775e734753287a4a7436ff00f24", "timestamp": "", "source": "github", "line_count": 291, "max_line_length": 119, "avg_line_length": 41.7147766323024, "alnum_prop": 0.6250102973885823, "repo_name": "huggingface/transformers", "id": "58c0338a850d0f8cd4aa13660453bb8805c6af9a", "size": "12744", "binary": false, "copies": "1", "ref": "refs/heads/main", "path": "src/transformers/models/sew/convert_sew_original_pytorch_checkpoint_to_pytorch.py", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "C", "bytes": "6021" }, { "name": "C++", "bytes": "12959" }, { "name": "Cuda", "bytes": "175419" }, { "name": "Dockerfile", "bytes": "18218" }, { "name": "Jsonnet", "bytes": "937" }, { "name": "Makefile", "bytes": "3430" }, { "name": "Python", "bytes": "35742012" }, { "name": "Shell", "bytes": "30374" } ], "symlink_target": "" }
/* * The Oxygen Webhelp plugin redistributes this file under the terms of the MIT license. * The full license terms of this license are available in the file MIT-License.txt * located in the same directory as the present file you are reading. */ .cleditorMain {border:1px solid #999; padding:0 1px 1px; background-color:white} .cleditorMain iframe {border:none; margin:0; padding:0} .cleditorMain textarea {border:none; margin:0; padding:0; overflow-y:scroll; font:10pt Arial,Verdana; resize:none; outline:none /* webkit grip focus */} .cleditorToolbar {background: url('../img/toolbar.gif') repeat} .cleditorGroup {float:left; height:26px} .cleditorButton {float:left; width:24px; height:24px; margin:1px 0 1px 0; background: url('../img/buttons.gif')} .cleditorDisabled {opacity:0.3; filter:alpha(opacity=30)} .cleditorDivider {float:left; width:1px; height:23px; margin:1px 0 1px 0; background:#CCC} .cleditorPopup {border:solid 1px #999; background-color:white; color:#333333; position:absolute; font:10pt Arial,Verdana; cursor:default; z-index:10000} .cleditorList div {padding:2px 4px 2px 4px} .cleditorList p, .cleditorList h1, .cleditorList h2, .cleditorList h3, .cleditorList h4, .cleditorList h5, .cleditorList h6, .cleditorList font {padding:0; margin:0; background-color:Transparent} .cleditorColor {width:150px; padding:1px 0 0 1px} .cleditorColor div {float:left; width:14px; height:14px; margin:0 1px 1px 0} .cleditorPrompt {background-color:#F6F7F9; padding:4px; font-size:8.5pt} .cleditorPrompt input, .cleditorPrompt textarea {font:8.5pt Arial,Verdana;} .cleditorMsg {background-color:#FDFCEE; width:150px; padding:4px; font-size:8.5pt}
{ "content_hash": "b3a7d4b3c6674468990a32b2cd857709", "timestamp": "", "source": "github", "line_count": 30, "max_line_length": 152, "avg_line_length": 56.5, "alnum_prop": 0.7522123893805309, "repo_name": "WgStreamsets/datacollector", "id": "ef8938ddb73eba8ab0923b7dddd3d383b11c0634", "size": "1695", "binary": false, "copies": "5", "ref": "refs/heads/master", "path": "docs/generated/oxygen-webhelp/resources/css/jquery.cleditor.css", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "ANTLR", "bytes": "89702" }, { "name": "CSS", "bytes": "112118" }, { "name": "Groovy", "bytes": "15336" }, { "name": "HTML", "bytes": "397587" }, { "name": "Java", "bytes": "12551673" }, { "name": "JavaScript", "bytes": "905534" }, { "name": "Protocol Buffer", "bytes": "3463" }, { "name": "Python", "bytes": "28037" }, { "name": "Shell", "bytes": "24655" } ], "symlink_target": "" }
#include <aws/core/client/AWSError.h> #include <aws/core/utils/HashingUtils.h> #include <aws/s3/S3Errors.h> using namespace Aws::Client; using namespace Aws::S3; using namespace Aws::Utils; static const int NO_SUCH_BUCKET_HASH = HashingUtils::HashString("NoSuchBucket"); static const int OBJECT_ALREADY_IN_ACTIVE_TIER_HASH = HashingUtils::HashString("ObjectAlreadyInActiveTierError"); static const int NO_SUCH_UPLOAD_HASH = HashingUtils::HashString("NoSuchUpload"); static const int OBJECT_NOT_IN_ACTIVE_TIER_HASH = HashingUtils::HashString("ObjectNotInActiveTierError"); static const int BUCKET_ALREADY_EXISTS_HASH = HashingUtils::HashString("BucketAlreadyExists"); static const int NO_SUCH_KEY_HASH = HashingUtils::HashString("NoSuchKey"); namespace Aws { namespace S3 { namespace S3ErrorMapper { AWSError<CoreErrors> GetErrorForName(const char* errorName) { int hashCode = HashingUtils::HashString(errorName); if (hashCode == NO_SUCH_BUCKET_HASH) { return AWSError<CoreErrors>(static_cast<CoreErrors>(S3Errors::NO_SUCH_BUCKET), false); } else if (hashCode == OBJECT_ALREADY_IN_ACTIVE_TIER_HASH) { return AWSError<CoreErrors>(static_cast<CoreErrors>(S3Errors::OBJECT_ALREADY_IN_ACTIVE_TIER), false); } else if (hashCode == NO_SUCH_UPLOAD_HASH) { return AWSError<CoreErrors>(static_cast<CoreErrors>(S3Errors::NO_SUCH_UPLOAD), false); } else if (hashCode == OBJECT_NOT_IN_ACTIVE_TIER_HASH) { return AWSError<CoreErrors>(static_cast<CoreErrors>(S3Errors::OBJECT_NOT_IN_ACTIVE_TIER), false); } else if (hashCode == BUCKET_ALREADY_EXISTS_HASH) { return AWSError<CoreErrors>(static_cast<CoreErrors>(S3Errors::BUCKET_ALREADY_EXISTS), false); } else if (hashCode == NO_SUCH_KEY_HASH) { return AWSError<CoreErrors>(static_cast<CoreErrors>(S3Errors::NO_SUCH_KEY), false); } return AWSError<CoreErrors>(CoreErrors::UNKNOWN, false); } } // namespace S3ErrorMapper } // namespace S3 } // namespace Aws
{ "content_hash": "94b07d5030de2a84551e794619e308ad", "timestamp": "", "source": "github", "line_count": 57, "max_line_length": 113, "avg_line_length": 34.421052631578945, "alnum_prop": 0.7456676860346585, "repo_name": "kahkeng/aws-sdk-cpp", "id": "376869e96b303ba0b6960576c7184ee4593650bf", "size": "2533", "binary": false, "copies": "2", "ref": "refs/heads/master", "path": "aws-cpp-sdk-s3/source/S3Errors.cpp", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "C", "bytes": "7595" }, { "name": "C++", "bytes": "37744404" }, { "name": "CMake", "bytes": "265388" }, { "name": "Java", "bytes": "214644" }, { "name": "Python", "bytes": "46021" } ], "symlink_target": "" }
:: :: a batch script for converting classified, buffered, LiDAR tiles :: into a number of raster products with a tile-based multi-core :: batch pipeline :: :: :: specify parameters :: :: allows you to run the script from other folders set PATH=%PATH%;C:\Users\Public\lastools\bin; :: here we specify the directory (e.g. the folder) in which the :: classified, buffered, LiDAR tiles are stored set INPUT_TILES=C:\lastools_output\classified_buffered_tiles :: here we specify in which format the original raw flight lines :: files are stored in the RAW_FLIGHT_LINES folder set RAW_FORMAT=las :: here we specify the directory (e.g. the folder) in which the :: temporary files are stored set TEMP_FILES=C:\lastools_temp :: here we specify the directory (e.g. the folder) in which the :: resulting output files are stored set OUTPUT_FILES=C:\lastools_output :: here we specify the resolution of the output DEMs set STEP=1.0 :: here we specify the number of cores we want to run on set NUM_CORES=7 rmdir %TEMP_FILES% /s /q :: :: start processing :: :: create raster DTM hillshades (with resolution of STEP meters) mkdir %OUTPUT_FILES%\tiles_dtm las2dem -i %INPUT_TILES%\*.laz ^ -keep_class 2 -extra_pass -step %STEP% -use_tile_bb -hillshade ^ -odir %OUTPUT_FILES%\tiles_dtm -opng ^ -cores %NUM_CORES% :: create raster DSM hillshades (with resolution of STEP meters) mkdir %OUTPUT_FILES%\tiles_dsm las2dem -i %INPUT_TILES%\*.laz ^ -first_only -step %STEP% -use_tile_bb -hillshade ^ -odir %OUTPUT_FILES%\tiles_dsm -opng ^ -cores %NUM_CORES% :: create height normalized tiles (stores "height above ground" as z coordinate) mkdir %TEMP_FILES%\height_normalized lasheight -i %INPUT_TILES%\*.laz ^ -replace_z ^ -odir %TEMP_FILES%\height_normalized -olaz ^ -cores %NUM_CORES% :: create canopy height raster (with resolution of STEP meters) lasgrid -i %TEMP_FILES%\height_normalized\*.laz -merged ^ -highest -step %STEP% -false -set_min_max 0 10 -fill 2 ^ -o %OUTPUT_FILES%\canopy.png echo "bye bye" goto the_end :the_end
{ "content_hash": "593aefb6bef2c8634d803ee11dba5c2f", "timestamp": "", "source": "github", "line_count": 76, "max_line_length": 80, "avg_line_length": 28.94736842105263, "alnum_prop": 0.6709090909090909, "repo_name": "strummerTFIU/TFG-IsometricMaps", "id": "5a6d0ee3a456a42b6a01d4d41f653924fdb4aa64", "size": "2200", "binary": false, "copies": "2", "ref": "refs/heads/master", "path": "LAStools/example_batch_scripts/typical_raster_products_pipeline.bat", "mode": "33188", "license": "mit", "language": [ { "name": "Batchfile", "bytes": "74547" }, { "name": "C", "bytes": "38544" }, { "name": "C++", "bytes": "3818448" }, { "name": "CSS", "bytes": "6545" }, { "name": "HTML", "bytes": "84210" }, { "name": "JavaScript", "bytes": "4426196" }, { "name": "Makefile", "bytes": "7231" }, { "name": "POV-Ray SDL", "bytes": "6094" }, { "name": "Python", "bytes": "677184" }, { "name": "Shell", "bytes": "1583" } ], "symlink_target": "" }
"""Support for the (unofficial) Tado API.""" import asyncio from datetime import timedelta import logging from PyTado.interface import Tado from requests import RequestException import requests.exceptions from homeassistant.components.climate.const import PRESET_AWAY, PRESET_HOME from homeassistant.config_entries import ConfigEntry from homeassistant.const import CONF_PASSWORD, CONF_USERNAME from homeassistant.core import HomeAssistant, callback from homeassistant.exceptions import ConfigEntryNotReady from homeassistant.helpers import config_validation as cv from homeassistant.helpers.dispatcher import dispatcher_send from homeassistant.helpers.event import async_track_time_interval from homeassistant.util import Throttle from .const import ( CONF_FALLBACK, DATA, DOMAIN, INSIDE_TEMPERATURE_MEASUREMENT, SIGNAL_TADO_UPDATE_RECEIVED, TEMP_OFFSET, UPDATE_LISTENER, UPDATE_TRACK, ) _LOGGER = logging.getLogger(__name__) PLATFORMS = ["binary_sensor", "sensor", "climate", "water_heater"] MIN_TIME_BETWEEN_UPDATES = timedelta(minutes=4) SCAN_INTERVAL = timedelta(minutes=5) CONFIG_SCHEMA = cv.deprecated(DOMAIN) async def async_setup(hass: HomeAssistant, config: dict): """Set up the Tado component.""" hass.data.setdefault(DOMAIN, {}) return True async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry): """Set up Tado from a config entry.""" _async_import_options_from_data_if_missing(hass, entry) username = entry.data[CONF_USERNAME] password = entry.data[CONF_PASSWORD] fallback = entry.options.get(CONF_FALLBACK, True) tadoconnector = TadoConnector(hass, username, password, fallback) try: await hass.async_add_executor_job(tadoconnector.setup) except KeyError: _LOGGER.error("Failed to login to tado") return False except RuntimeError as exc: _LOGGER.error("Failed to setup tado: %s", exc) return ConfigEntryNotReady except requests.exceptions.Timeout as ex: raise ConfigEntryNotReady from ex except requests.exceptions.HTTPError as ex: if ex.response.status_code > 400 and ex.response.status_code < 500: _LOGGER.error("Failed to login to tado: %s", ex) return False raise ConfigEntryNotReady from ex # Do first update await hass.async_add_executor_job(tadoconnector.update) # Poll for updates in the background update_track = async_track_time_interval( hass, lambda now: tadoconnector.update(), SCAN_INTERVAL, ) update_listener = entry.add_update_listener(_async_update_listener) hass.data[DOMAIN][entry.entry_id] = { DATA: tadoconnector, UPDATE_TRACK: update_track, UPDATE_LISTENER: update_listener, } for platform in PLATFORMS: hass.async_create_task( hass.config_entries.async_forward_entry_setup(entry, platform) ) return True @callback def _async_import_options_from_data_if_missing(hass: HomeAssistant, entry: ConfigEntry): options = dict(entry.options) if CONF_FALLBACK not in options: options[CONF_FALLBACK] = entry.data.get(CONF_FALLBACK, True) hass.config_entries.async_update_entry(entry, options=options) async def _async_update_listener(hass: HomeAssistant, entry: ConfigEntry): """Handle options update.""" await hass.config_entries.async_reload(entry.entry_id) async def async_unload_entry(hass: HomeAssistant, entry: ConfigEntry): """Unload a config entry.""" unload_ok = all( await asyncio.gather( *[ hass.config_entries.async_forward_entry_unload(entry, platform) for platform in PLATFORMS ] ) ) hass.data[DOMAIN][entry.entry_id][UPDATE_TRACK]() hass.data[DOMAIN][entry.entry_id][UPDATE_LISTENER]() if unload_ok: hass.data[DOMAIN].pop(entry.entry_id) return unload_ok class TadoConnector: """An object to store the Tado data.""" def __init__(self, hass, username, password, fallback): """Initialize Tado Connector.""" self.hass = hass self._username = username self._password = password self._fallback = fallback self.home_id = None self.home_name = None self.tado = None self.zones = None self.devices = None self.data = { "device": {}, "weather": {}, "zone": {}, } @property def fallback(self): """Return fallback flag to Smart Schedule.""" return self._fallback def setup(self): """Connect to Tado and fetch the zones.""" self.tado = Tado(self._username, self._password) self.tado.setDebugging(True) # Load zones and devices self.zones = self.tado.getZones() self.devices = self.tado.getDevices() tado_home = self.tado.getMe()["homes"][0] self.home_id = tado_home["id"] self.home_name = tado_home["name"] @Throttle(MIN_TIME_BETWEEN_UPDATES) def update(self): """Update the registered zones.""" for device in self.devices: self.update_sensor("device", device["shortSerialNo"]) for zone in self.zones: self.update_sensor("zone", zone["id"]) self.data["weather"] = self.tado.getWeather() dispatcher_send( self.hass, SIGNAL_TADO_UPDATE_RECEIVED.format(self.home_id, "weather", "data"), ) def update_sensor(self, sensor_type, sensor): """Update the internal data from Tado.""" _LOGGER.debug("Updating %s %s", sensor_type, sensor) try: if sensor_type == "device": data = self.tado.getDeviceInfo(sensor) if ( INSIDE_TEMPERATURE_MEASUREMENT in data["characteristics"]["capabilities"] ): data[TEMP_OFFSET] = self.tado.getDeviceInfo(sensor, TEMP_OFFSET) elif sensor_type == "zone": data = self.tado.getZoneState(sensor) else: _LOGGER.debug("Unknown sensor: %s", sensor_type) return except RuntimeError: _LOGGER.error( "Unable to connect to Tado while updating %s %s", sensor_type, sensor, ) return self.data[sensor_type][sensor] = data _LOGGER.debug( "Dispatching update to %s %s %s: %s", self.home_id, sensor_type, sensor, data, ) dispatcher_send( self.hass, SIGNAL_TADO_UPDATE_RECEIVED.format(self.home_id, sensor_type, sensor), ) def get_capabilities(self, zone_id): """Return the capabilities of the devices.""" return self.tado.getCapabilities(zone_id) def reset_zone_overlay(self, zone_id): """Reset the zone back to the default operation.""" self.tado.resetZoneOverlay(zone_id) self.update_sensor("zone", zone_id) def set_presence( self, presence=PRESET_HOME, ): """Set the presence to home or away.""" if presence == PRESET_AWAY: self.tado.setAway() elif presence == PRESET_HOME: self.tado.setHome() def set_zone_overlay( self, zone_id=None, overlay_mode=None, temperature=None, duration=None, device_type="HEATING", mode=None, fan_speed=None, swing=None, ): """Set a zone overlay.""" _LOGGER.debug( "Set overlay for zone %s: overlay_mode=%s, temp=%s, duration=%s, type=%s, mode=%s fan_speed=%s swing=%s", zone_id, overlay_mode, temperature, duration, device_type, mode, fan_speed, swing, ) try: self.tado.setZoneOverlay( zone_id, overlay_mode, temperature, duration, device_type, "ON", mode, fanSpeed=fan_speed, swing=swing, ) except RequestException as exc: _LOGGER.error("Could not set zone overlay: %s", exc) self.update_sensor("zone", zone_id) def set_zone_off(self, zone_id, overlay_mode, device_type="HEATING"): """Set a zone to off.""" try: self.tado.setZoneOverlay( zone_id, overlay_mode, None, None, device_type, "OFF" ) except RequestException as exc: _LOGGER.error("Could not set zone overlay: %s", exc) self.update_sensor("zone", zone_id) def set_temperature_offset(self, device_id, offset): """Set temperature offset of device.""" try: self.tado.setTempOffset(device_id, offset) except RequestException as exc: _LOGGER.error("Could not set temperature offset: %s", exc)
{ "content_hash": "323c0c62a772d21d2e0be92d3402abc6", "timestamp": "", "source": "github", "line_count": 301, "max_line_length": 117, "avg_line_length": 30.461794019933556, "alnum_prop": 0.5987566801177882, "repo_name": "adrienbrault/home-assistant", "id": "094465d38aaaba79ca0c50db3d1623b501aa5425", "size": "9169", "binary": false, "copies": "1", "ref": "refs/heads/dev", "path": "homeassistant/components/tado/__init__.py", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Dockerfile", "bytes": "1795" }, { "name": "Python", "bytes": "32021043" }, { "name": "Shell", "bytes": "4900" } ], "symlink_target": "" }
package org.elasticsearch.index.query; import org.apache.lucene.search.BooleanQuery; import org.apache.lucene.search.IndexOrDocValuesQuery; import org.apache.lucene.search.MatchNoDocsQuery; import org.apache.lucene.search.PointRangeQuery; import org.apache.lucene.search.Query; import org.apache.lucene.search.TermQuery; import org.elasticsearch.common.ParsingException; import org.elasticsearch.common.lucene.search.MultiPhrasePrefixQuery; import org.elasticsearch.search.internal.SearchContext; import org.elasticsearch.test.AbstractQueryTestCase; import java.io.IOException; import java.util.HashMap; import java.util.Map; import static org.elasticsearch.test.AbstractBuilderTestCase.STRING_ALIAS_FIELD_NAME; import static org.hamcrest.CoreMatchers.either; import static org.hamcrest.CoreMatchers.instanceOf; import static org.hamcrest.Matchers.containsString; import static org.hamcrest.Matchers.notNullValue; public class MatchPhrasePrefixQueryBuilderTests extends AbstractQueryTestCase<MatchPhrasePrefixQueryBuilder> { @Override protected MatchPhrasePrefixQueryBuilder doCreateTestQueryBuilder() { String fieldName = randomFrom(STRING_FIELD_NAME, STRING_ALIAS_FIELD_NAME, BOOLEAN_FIELD_NAME, INT_FIELD_NAME, DOUBLE_FIELD_NAME, DATE_FIELD_NAME); Object value; if (isTextField(fieldName)) { int terms = randomIntBetween(0, 3); StringBuilder builder = new StringBuilder(); for (int i = 0; i < terms; i++) { builder.append(randomAlphaOfLengthBetween(1, 10)).append(" "); } value = builder.toString().trim(); } else { value = getRandomValueForFieldName(fieldName); } MatchPhrasePrefixQueryBuilder matchQuery = new MatchPhrasePrefixQueryBuilder(fieldName, value); if (randomBoolean() && isTextField(fieldName)) { matchQuery.analyzer(randomFrom("simple", "keyword", "whitespace")); } if (randomBoolean()) { matchQuery.slop(randomIntBetween(0, 10)); } if (randomBoolean()) { matchQuery.maxExpansions(randomIntBetween(1, 10000)); } return matchQuery; } @Override protected Map<String, MatchPhrasePrefixQueryBuilder> getAlternateVersions() { Map<String, MatchPhrasePrefixQueryBuilder> alternateVersions = new HashMap<>(); MatchPhrasePrefixQueryBuilder matchPhrasePrefixQuery = new MatchPhrasePrefixQueryBuilder(randomAlphaOfLengthBetween(1, 10), randomAlphaOfLengthBetween(1, 10)); String contentString = "{\n" + " \"match_phrase_prefix\" : {\n" + " \"" + matchPhrasePrefixQuery.fieldName() + "\" : \"" + matchPhrasePrefixQuery.value() + "\"\n" + " }\n" + "}"; alternateVersions.put(contentString, matchPhrasePrefixQuery); return alternateVersions; } @Override protected void doAssertLuceneQuery(MatchPhrasePrefixQueryBuilder queryBuilder, Query query, SearchContext context) throws IOException { assertThat(query, notNullValue()); assertThat(query, either(instanceOf(BooleanQuery.class)).or(instanceOf(MultiPhrasePrefixQuery.class)) .or(instanceOf(TermQuery.class)).or(instanceOf(PointRangeQuery.class)) .or(instanceOf(IndexOrDocValuesQuery.class)).or(instanceOf(MatchNoDocsQuery.class))); } public void testIllegalValues() { IllegalArgumentException e = expectThrows(IllegalArgumentException.class, () -> new MatchPhrasePrefixQueryBuilder(null, "value")); assertEquals("[match_phrase_prefix] requires fieldName", e.getMessage()); e = expectThrows(IllegalArgumentException.class, () -> new MatchPhrasePrefixQueryBuilder("fieldName", null)); assertEquals("[match_phrase_prefix] requires query value", e.getMessage()); MatchPhrasePrefixQueryBuilder matchQuery = new MatchPhrasePrefixQueryBuilder("fieldName", "text"); e = expectThrows(IllegalArgumentException.class, () -> matchQuery.maxExpansions(-1)); } public void testBadAnalyzer() throws IOException { MatchPhrasePrefixQueryBuilder matchQuery = new MatchPhrasePrefixQueryBuilder("fieldName", "text"); matchQuery.analyzer("bogusAnalyzer"); QueryShardException e = expectThrows(QueryShardException.class, () -> matchQuery.toQuery(createShardContext())); assertThat(e.getMessage(), containsString("analyzer [bogusAnalyzer] not found")); } public void testPhraseOnFieldWithNoTerms() { MatchPhrasePrefixQueryBuilder matchQuery = new MatchPhrasePrefixQueryBuilder(DATE_FIELD_NAME, "three term phrase"); matchQuery.analyzer("whitespace"); expectThrows(IllegalArgumentException.class, () -> matchQuery.doToQuery(createShardContext())); } public void testPhrasePrefixMatchQuery() throws IOException { String json1 = "{\n" + " \"match_phrase_prefix\" : {\n" + " \"message\" : \"this is a test\"\n" + " }\n" + "}"; String expected = "{\n" + " \"match_phrase_prefix\" : {\n" + " \"message\" : {\n" + " \"query\" : \"this is a test\",\n" + " \"slop\" : 0,\n" + " \"max_expansions\" : 50,\n" + " \"boost\" : 1.0\n" + " }\n" + " }\n" + "}"; MatchPhrasePrefixQueryBuilder qb = (MatchPhrasePrefixQueryBuilder) parseQuery(json1); checkGeneratedJson(expected, qb); String json3 = "{\n" + " \"match_phrase_prefix\" : {\n" + " \"message\" : {\n" + " \"query\" : \"this is a test\",\n" + " \"max_expansions\" : 10\n" + " }\n" + " }\n" + "}"; expected = "{\n" + " \"match_phrase_prefix\" : {\n" + " \"message\" : {\n" + " \"query\" : \"this is a test\",\n" + " \"slop\" : 0,\n" + " \"max_expansions\" : 10,\n" + " \"boost\" : 1.0\n" + " }\n" + " }\n" + "}"; qb = (MatchPhrasePrefixQueryBuilder) parseQuery(json3); checkGeneratedJson(expected, qb); } public void testParseFailsWithMultipleFields() throws IOException { String json = "{\n" + " \"match_phrase_prefix\" : {\n" + " \"message1\" : {\n" + " \"query\" : \"this is a test\"\n" + " },\n" + " \"message2\" : {\n" + " \"query\" : \"this is a test\"\n" + " }\n" + " }\n" + "}"; ParsingException e = expectThrows(ParsingException.class, () -> parseQuery(json)); assertEquals("[match_phrase_prefix] query doesn't support multiple fields, found [message1] and [message2]", e.getMessage()); String shortJson = "{\n" + " \"match_phrase_prefix\" : {\n" + " \"message1\" : \"this is a test\",\n" + " \"message2\" : \"this is a test\"\n" + " }\n" + "}"; e = expectThrows(ParsingException.class, () -> parseQuery(shortJson)); assertEquals("[match_phrase_prefix] query doesn't support multiple fields, found [message1] and [message2]", e.getMessage()); } }
{ "content_hash": "e38e463a82e7248e1428aa958d9b6518", "timestamp": "", "source": "github", "line_count": 174, "max_line_length": 138, "avg_line_length": 44.41379310344828, "alnum_prop": 0.5844979296066253, "repo_name": "gfyoung/elasticsearch", "id": "fd722ef0c77af632150831668e2489047e484a34", "size": "8516", "binary": false, "copies": "12", "ref": "refs/heads/master", "path": "server/src/test/java/org/elasticsearch/index/query/MatchPhrasePrefixQueryBuilderTests.java", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "ANTLR", "bytes": "11082" }, { "name": "Batchfile", "bytes": "13592" }, { "name": "Emacs Lisp", "bytes": "3341" }, { "name": "FreeMarker", "bytes": "45" }, { "name": "Groovy", "bytes": "330070" }, { "name": "HTML", "bytes": "2186" }, { "name": "Java", "bytes": "42238459" }, { "name": "Perl", "bytes": "7271" }, { "name": "Python", "bytes": "54395" }, { "name": "Shell", "bytes": "108747" } ], "symlink_target": "" }
namespace AutoUpdaterDotNET { partial class DownloadUpdateDialog { /// <summary> /// Required designer variable. /// </summary> private System.ComponentModel.IContainer components = null; /// <summary> /// Clean up any resources being used. /// </summary> /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param> protected override void Dispose(bool disposing) { if (disposing && (components != null)) { components.Dispose(); } base.Dispose(disposing); } #region Windows Form Designer generated code /// <summary> /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// </summary> private void InitializeComponent() { System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(DownloadUpdateDialog)); this.pictureBoxIcon = new System.Windows.Forms.PictureBox(); this.progressBar = new System.Windows.Forms.ProgressBar(); this.labelInformation = new System.Windows.Forms.Label(); this.labelSize = new System.Windows.Forms.Label(); ((System.ComponentModel.ISupportInitialize)(this.pictureBoxIcon)).BeginInit(); this.SuspendLayout(); // // pictureBoxIcon // this.pictureBoxIcon.Image = global::AutoUpdaterDotNET.Properties.Resources.download_32; resources.ApplyResources(this.pictureBoxIcon, "pictureBoxIcon"); this.pictureBoxIcon.Name = "pictureBoxIcon"; this.pictureBoxIcon.TabStop = false; // // progressBar // resources.ApplyResources(this.progressBar, "progressBar"); this.progressBar.Name = "progressBar"; // // labelInformation // resources.ApplyResources(this.labelInformation, "labelInformation"); this.labelInformation.Name = "labelInformation"; // // labelSize // resources.ApplyResources(this.labelSize, "labelSize"); this.labelSize.Name = "labelSize"; // // DownloadUpdateDialog // resources.ApplyResources(this, "$this"); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.Controls.Add(this.labelSize); this.Controls.Add(this.labelInformation); this.Controls.Add(this.progressBar); this.Controls.Add(this.pictureBoxIcon); this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog; this.MaximizeBox = false; this.MinimizeBox = false; this.Name = "DownloadUpdateDialog"; this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.DownloadUpdateDialog_FormClosing); this.Load += new System.EventHandler(this.DownloadUpdateDialogLoad); ((System.ComponentModel.ISupportInitialize)(this.pictureBoxIcon)).EndInit(); this.ResumeLayout(false); this.PerformLayout(); } #endregion private System.Windows.Forms.PictureBox pictureBoxIcon; private System.Windows.Forms.ProgressBar progressBar; private System.Windows.Forms.Label labelInformation; private System.Windows.Forms.Label labelSize; } }
{ "content_hash": "9927851501839146ec77e6cb5be1737e", "timestamp": "", "source": "github", "line_count": 88, "max_line_length": 152, "avg_line_length": 42.43181818181818, "alnum_prop": 0.5940010712372791, "repo_name": "ravibpatel/AutoUpdater.NET", "id": "ec655db78725d9c6b14ec180d55ad4c4ede2f580", "size": "3736", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "AutoUpdater.NET/DownloadUpdateDialog.Designer.cs", "mode": "33188", "license": "mit", "language": [ { "name": "C#", "bytes": "102918" } ], "symlink_target": "" }
<?xml version="1.0" encoding="UTF-8"?> <project version="4"> <component name="CMakeRunConfigurationManager" shouldGenerate="true" shouldDeleteObsolete="true"> <generated> <config projectName="ReverseVowelsOfAString" targetName="ReverseVowelsOfAString" /> </generated> </component> <component name="CMakeSettings"> <configurations> <configuration PROFILE_NAME="Debug" CONFIG_NAME="Debug" /> </configurations> </component> <component name="ChangeListManager"> <list default="true" id="8a3063da-675c-42ed-ae06-307c54d4d13f" name="Default Changelist" comment=""> <change afterPath="$PROJECT_DIR$/../BullsAndCows/.idea/vcs.xml" afterDir="false" /> <change afterPath="$PROJECT_DIR$/../ReverseString/.idea/vcs.xml" afterDir="false" /> <change beforePath="$PROJECT_DIR$/../NimGame/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/../NimGame/.idea/workspace.xml" afterDir="false" /> <change beforePath="$PROJECT_DIR$/../PowerOfFour/PowerOfFour.cpp" beforeDir="false" /> <change beforePath="$PROJECT_DIR$/../PowerOfThree/PowerOfThree.cpp" beforeDir="false" /> <change beforePath="$PROJECT_DIR$/../RangeSumQueryImmutable/RangeSumQueryImmutable.cpp" beforeDir="false" /> <change beforePath="$PROJECT_DIR$/../ReverseString/ReverseString.cpp" beforeDir="false" /> <change beforePath="$PROJECT_DIR$/../ReverseTheVowelsOfAString/ReverseTheVowelsOfAString.cpp" beforeDir="false" /> </list> <ignored path="$PROJECT_DIR$/cmake-build-debug/" /> <option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" /> <option name="SHOW_DIALOG" value="false" /> <option name="HIGHLIGHT_CONFLICTS" value="true" /> <option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" /> <option name="LAST_RESOLUTION" value="IGNORE" /> </component> <component name="ExecutionTargetManager" SELECTED_TARGET="CMakeBuildProfile:Debug" /> <component name="FileEditorManager"> <leaf /> </component> <component name="Git.Settings"> <option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$/../../.." /> </component> <component name="IdeDocumentHistory"> <option name="CHANGED_PATHS"> <list> <option value="$PROJECT_DIR$/main.cpp" /> </list> </option> </component> <component name="ProjectFrameBounds"> <option name="y" value="23" /> <option name="width" value="1680" /> <option name="height" value="951" /> </component> <component name="ProjectLevelVcsManager" settingsEditedManually="true"> <ConfirmationsSetting value="1" id="Add" /> </component> <component name="ProjectView"> <navigator proportions="" version="1"> <foldersAlwaysOnTop value="true" /> </navigator> <panes> <pane id="ProjectPane" /> <pane id="Scope" /> </panes> </component> <component name="PropertiesComponent"> <property name="WebServerToolWindowFactoryState" value="false" /> <property name="nodejs_interpreter_path.stuck_in_default_project" value="undefined stuck path" /> <property name="nodejs_npm_path_reset_for_default_project" value="true" /> </component> <component name="RunDashboard"> <option name="ruleStates"> <list> <RuleState> <option name="name" value="ConfigurationTypeDashboardGroupingRule" /> </RuleState> <RuleState> <option name="name" value="StatusDashboardGroupingRule" /> </RuleState> </list> </option> </component> <component name="RunManager"> <configuration name="ReverseVowelsOfAString" type="CMakeRunConfiguration" factoryName="Application" PASS_PARENT_ENVS_2="true" PROJECT_NAME="ReverseVowelsOfAString" TARGET_NAME="ReverseVowelsOfAString" CONFIG_NAME="Debug" RUN_TARGET_PROJECT_NAME="ReverseVowelsOfAString" RUN_TARGET_NAME="ReverseVowelsOfAString"> <method v="2"> <option name="com.jetbrains.cidr.execution.CidrBuildBeforeRunTaskProvider$BuildBeforeRunTask" enabled="true" /> </method> </configuration> </component> <component name="SvnConfiguration"> <configuration /> </component> <component name="TaskManager"> <task active="true" id="Default" summary="Default task"> <changelist id="8a3063da-675c-42ed-ae06-307c54d4d13f" name="Default Changelist" comment="" /> <created>1566332865553</created> <option name="number" value="Default" /> <option name="presentableId" value="Default" /> <updated>1566332865553</updated> <workItem from="1566332866714" duration="306000" /> </task> <servers /> </component> <component name="TimeTrackingManager"> <option name="totallyTimeSpent" value="306000" /> </component> <component name="ToolWindowManager"> <frame x="0" y="23" width="1680" height="951" extended-state="0" /> <layout> <window_info id="Favorites" side_tool="true" /> <window_info active="true" content_ui="combo" id="Project" order="0" visible="true" weight="0.24969475" /> <window_info id="Structure" order="1" side_tool="true" weight="0.25" /> <window_info anchor="bottom" id="Database Changes" /> <window_info anchor="bottom" id="Version Control" /> <window_info anchor="bottom" id="Terminal" /> <window_info anchor="bottom" id="Event Log" side_tool="true" /> <window_info anchor="bottom" id="CMake" /> <window_info anchor="bottom" id="Message" order="0" /> <window_info anchor="bottom" id="Find" order="1" /> <window_info anchor="bottom" id="Run" order="2" /> <window_info anchor="bottom" id="Debug" order="3" weight="0.4" /> <window_info anchor="bottom" id="Cvs" order="4" weight="0.25" /> <window_info anchor="bottom" id="Inspection" order="5" weight="0.4" /> <window_info anchor="bottom" id="TODO" order="6" /> <window_info anchor="right" id="Database" /> <window_info anchor="right" id="Commander" internal_type="SLIDING" order="0" type="SLIDING" weight="0.4" /> <window_info anchor="right" id="Ant Build" order="1" weight="0.25" /> <window_info anchor="right" content_ui="combo" id="Hierarchy" order="2" weight="0.25" /> </layout> </component> <component name="TypeScriptGeneratedFilesManager"> <option name="version" value="1" /> </component> <component name="editorHistoryManager"> <entry file="file://$PROJECT_DIR$/CMakeLists.txt"> <provider selected="true" editor-type-id="text-editor" /> </entry> <entry file="file://$PROJECT_DIR$/main.cpp"> <provider selected="true" editor-type-id="text-editor"> <state relative-caret-position="135"> <caret line="9" column="25" selection-start-line="9" selection-start-column="25" selection-end-line="9" selection-end-column="25" /> <folding> <element signature="e#0#19#0" expanded="true" /> </folding> </state> </provider> </entry> </component> </project>
{ "content_hash": "85c2dca43f955b77ebe53eaa1c8a8fa7", "timestamp": "", "source": "github", "line_count": 145, "max_line_length": 315, "avg_line_length": 47.83448275862069, "alnum_prop": 0.6646482122260668, "repo_name": "busebd12/InterviewPreparation", "id": "ce7424b7cd707c94d135ca7a61535101bff24e18", "size": "6936", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "LeetCode/C++/General/Easy/ReverseVowelsOfAString/.idea/workspace.xml", "mode": "33188", "license": "mit", "language": [ { "name": "C", "bytes": "9011022" }, { "name": "C++", "bytes": "14785379" }, { "name": "CMake", "bytes": "10099860" }, { "name": "Java", "bytes": "54365" }, { "name": "Makefile", "bytes": "5154401" }, { "name": "TeX", "bytes": "41241" } ], "symlink_target": "" }
line1=Opcje konfiguracyjne,11 lease_sort=Uporządkuj dzierżawy wg,1,0-Kolejności w pliku,1-Adresów IP,2-Nazw hostów hostnet_list=Pokaż podsieci i hosty jako,1,0-Ikony,1-Listę dhcpd_nocols=Ilość ikon w wierszu,0 lease_tz=Pokazuj czas dzierżawy wg,1,0-GMT,1-Czasu lokalnego lease_refresh=Sekund pomiędzy odświeżaniem listy dzierżawy,3,Nigdy show_ip=Wyświetlać adres IP hostów?,1,1-Tak,0-Nie show_mac=Wyświetlać adres MAC hostów?,1,1-Tak,0-Nie group_name=Wyświetl nazwy grupy jako,1,1-<tt>domain&#45;name</tt>,0-Ilość lub nazwa użytkowników,2-Opis desc_name=Wyświetlać inne opisy obiektów zamiast nazw,1,1-Tak,0-Nie display_max=Maksymalna liczba wyświetlanych podsieci i hostów,3,Nieograniczona add_file=Dodaj nowe podsieci&#44; hosty i grupy do pliku,3,Główny plik konfiguracyjny line2=Opcje systemowe,11 dhcpd_conf=Plik konfiguracyjny serwera DHCP,0 dhcpd_path=Plik programu serwera DHCP,0 start_cmd=Polecenie uruchomienia serwera DHCP,3,Wykonaj uruchomienie serwera restart_cmd=Polecenia do zastosowania konfiguracji,3,Ubij i zrestartuj stop_cmd=Polecenie zatrzymania serwera DHCP,3,Ubij proces pid_file=Ścieżka do pliku z numerem PID serwera DHCP,0 lease_file=Plik dzierżaw serwera DHCP,0 interfaces_type=Typ interfejsów pliku,4,redhat-Redhat,mandrake-Mandrake,suse-SuSE,debian-Debian,caldera-Caldera,gentoo-Gentoo,-Webmin version=Wersja serwera DHCP,3,Automatycznie
{ "content_hash": "dc37896fa4e279944164ab1aabcf945f", "timestamp": "", "source": "github", "line_count": 22, "max_line_length": 133, "avg_line_length": 62.13636363636363, "alnum_prop": 0.825164594001463, "repo_name": "nawawi/webmin", "id": "e4fddd97110d1373b2930e37dd2e99711cbda21d", "size": "1403", "binary": false, "copies": "2", "ref": "refs/heads/master", "path": "dhcpd/config.info.pl", "mode": "33188", "license": "bsd-3-clause", "language": [ { "name": "Batchfile", "bytes": "3160" }, { "name": "C", "bytes": "15136" }, { "name": "C#", "bytes": "15069" }, { "name": "CSS", "bytes": "110895" }, { "name": "Emacs Lisp", "bytes": "17723" }, { "name": "Erlang", "bytes": "41" }, { "name": "HTML", "bytes": "27269076" }, { "name": "Java", "bytes": "257445" }, { "name": "JavaScript", "bytes": "373859" }, { "name": "MAXScript", "bytes": "29130" }, { "name": "Makefile", "bytes": "22074" }, { "name": "NewLisp", "bytes": "82942" }, { "name": "PHP", "bytes": "18899" }, { "name": "Perl", "bytes": "11057755" }, { "name": "Prolog", "bytes": "69637" }, { "name": "Python", "bytes": "76600" }, { "name": "Raku", "bytes": "1067573" }, { "name": "Roff", "bytes": "30578" }, { "name": "Ruby", "bytes": "56964" }, { "name": "Shell", "bytes": "53390" }, { "name": "Smalltalk", "bytes": "40772" }, { "name": "SystemVerilog", "bytes": "23230" } ], "symlink_target": "" }
title: pterosaurs layout: redirect author: pterosaurs link tags: site pterosaurs redirect: http://www.pteros.com/pterosaurs.html ---
{ "content_hash": "2afa66a614182cfa9b68305f98e6ca57", "timestamp": "", "source": "github", "line_count": 6, "max_line_length": 47, "avg_line_length": 22.166666666666668, "alnum_prop": 0.7894736842105263, "repo_name": "jsikucom/jsikucom.github.io", "id": "226e3e876763dcbedb9dcd735abb84c2ea0a016a", "size": "137", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "_posts/Links/2017-10-21-pterosaurs.md", "mode": "33188", "license": "mit", "language": [ { "name": "CSS", "bytes": "10182" }, { "name": "HTML", "bytes": "26414" }, { "name": "JavaScript", "bytes": "1752" } ], "symlink_target": "" }